@kteneyck/cesium-timeline-react 0.8.0 → 0.10.0
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 +140 -40
- package/dist/cesium-timeline-react.js +955 -858
- package/dist/cesium-timeline-react.umd.cjs +4 -4
- package/dist/index.d.ts +20 -0
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(it,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react"),require("cesium"),require("@kteneyck/cesium-timeline-core")):typeof define=="function"&&define.amd?define(["exports","react","cesium","@kteneyck/cesium-timeline-core"],n):(it=typeof globalThis<"u"?globalThis:it||self,n(it.CesiumTimelineReact={},it.React,it.Cesium,it.CesiumTimelineCore))})(this,(function(it,n,qt,E){"use strict";function $t(R){const C=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(R){for(const F in R)if(F!=="default"){const d=Object.getOwnPropertyDescriptor(R,F);Object.defineProperty(C,F,d.get?d:{enumerable:!0,get:()=>R[F]})}}return C.default=R,Object.freeze(C)}const _=$t(qt);var It={exports:{}},St={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var Yt;function te(){if(Yt)return St;Yt=1;var R=Symbol.for("react.transitional.element"),C=Symbol.for("react.fragment");function F(d,j,k){var J=null;if(k!==void 0&&(J=""+k),j.key!==void 0&&(J=""+j.key),"key"in j){k={};for(var N in j)N!=="key"&&(k[N]=j[N])}else k=j;return j=k.ref,{$$typeof:R,type:d,key:J,ref:j!==void 0?j:null,props:k}}return St.Fragment=C,St.jsx=F,St.jsxs=F,St}var jt={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var Wt;function ee(){return Wt||(Wt=1,process.env.NODE_ENV!=="production"&&(function(){function R(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Et?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Z:return"Fragment";case T:return"Profiler";case dt:return"StrictMode";case Q:return"Suspense";case S:return"SuspenseList";case gt:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case ft:return"Portal";case K:return t.displayName||"Context";case M:return(t._context.displayName||"Context")+".Consumer";case nt:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case L:return i=t.displayName||null,i!==null?i:R(t.type)||"Memo";case rt:i=t._payload,t=t._init;try{return R(t(i))}catch{}}return null}function C(t){return""+t}function F(t){try{C(t);var i=!1}catch{i=!0}if(i){i=console;var a=i.error,g=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return a.call(i,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",g),C(t)}}function d(t){if(t===Z)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===rt)return"<...>";try{var i=R(t);return i?"<"+i+">":"<...>"}catch{return"<...>"}}function j(){var t=ot.A;return t===null?null:t.getOwner()}function k(){return Error("react-stack-top-frame")}function J(t){if(s.call(t,"key")){var i=Object.getOwnPropertyDescriptor(t,"key").get;if(i&&i.isReactWarning)return!1}return t.key!==void 0}function N(t,i){function a(){at||(at=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",i))}a.isReactWarning=!0,Object.defineProperty(t,"key",{get:a,configurable:!0})}function pt(){var t=R(this.type);return q[t]||(q[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function z(t,i,a,g,ut,mt){var A=a.ref;return t={$$typeof:U,type:t,key:i,props:a,_owner:g},(A!==void 0?A:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:pt}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ut}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:mt}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function Y(t,i,a,g,ut,mt){var A=i.children;if(A!==void 0)if(g)if(b(A)){for(g=0;g<A.length;g++)W(A[g]);Object.freeze&&Object.freeze(A)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else W(A);if(s.call(i,"key")){A=R(t);var tt=Object.keys(i).filter(function(wt){return wt!=="key"});g=0<tt.length?"{key: someKey, "+tt.join(": ..., ")+": ...}":"{key: someKey}",H[A+g]||(tt=0<tt.length?"{"+tt.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,T,R,rt,R),lt[R+T]=!0)}if(R=null,E!==void 0&&(I(E),R=""+E),X(u)&&(I(u.key),R=""+u.key),"key"in u){E={};for(var pt in u)pt!=="key"&&(E[pt]=u[pt])}else E=u;return R&&N(E,typeof e=="function"?e.displayName||e.name||"Unknown":e),Y(e,R,E,j(),ft,bt)}function Q(e){K(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===tt&&(e._payload.status==="fulfilled"?K(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function K(e){return typeof e=="object"&&e!==null&&e.$$typeof===st}var z=n,st=Symbol.for("react.transitional.element"),ct=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),at=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),M=Symbol.for("react.context"),nt=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),mt=Symbol.for("react.memo"),tt=Symbol.for("react.lazy"),c=Symbol.for("react.activity"),D=Symbol.for("react.client.reference"),A=z.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,W=Array.isArray,B=console.createTask?console.createTask:function(){return null};z={react_stack_bottom_frame:function(e){return e()}};var L,O={},l=z.react_stack_bottom_frame.bind(z,k)(),y=B(i(k)),lt={};jt.Fragment=q,jt.jsx=function(e,u,E){var T=1e4>A.recentlyCreatedOwnerStacks++;return V(e,u,E,!1,T?Error("react-stack-top-frame"):l,T?B(i(e)):y)},jt.jsxs=function(e,u,E){var T=1e4>A.recentlyCreatedOwnerStacks++;return V(e,u,E,!0,T?Error("react-stack-top-frame"):l,T?B(i(e)):y)}})()),jt}var Xt;function Zt(){return Xt||(Xt=1,process.env.NODE_ENV==="production"?St.exports=Vt():St.exports=Kt()),St.exports}var a=Zt();const Qt=520,qt=()=>a.jsxs("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"currentColor","aria-hidden":"true",children:[a.jsx("rect",{x:"1",y:"0",width:"4",height:"16",rx:"1"}),a.jsx("rect",{x:"9",y:"0",width:"4",height:"16",rx:"1"})]}),Jt=()=>a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("polyline",{points:"3,5 7,9 11,5"})}),Nt=()=>a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("polyline",{points:"3,9 7,5 11,9"})}),Yt=({currentTime:v,isPlaying:C,multiplier:I,dateTimeFormat:i,timezone:j,isLive:k,hasStartTime:X,hasEndTime:N,showJumpToStart:it=!0,showJumpToEnd:Y=!0,onPlayPause:V,onJumpToStart:Q,onRewind:K,onFastForward:z,onJumpToEnd:st,onJumpToLive:ct,onResetSpeed:q,onDateTimeClick:at,theme:w,swimLanesVisible:x,onToggleSwimLanes:M,labels:nt})=>{const J=I<0,$=I>1,mt=I===1,tt=Math.abs(I),c=n.useMemo(()=>({...b.DEFAULT_LABELS,...nt}),[nt]),D=n.useRef(null),[A,F]=n.useState(!1);n.useEffect(()=>{const l=D.current;if(!l)return;const y=new ResizeObserver(([lt])=>{F(lt.contentRect.width<Qt)});return y.observe(l),()=>y.disconnect()},[]);const W={background:"none",border:"1px solid transparent",cursor:"pointer",fontSize:"16px",padding:"0",display:"flex",alignItems:"center",justifyContent:"center",minWidth:"32px",width:"32px",height:"32px",borderRadius:"4px",transition:"background-color 0.15s, color 0.15s",fontFamily:"system-ui, -apple-system, sans-serif",flexShrink:0,lineHeight:1},B=l=>({...W,color:l?w.buttonActiveColor:w.buttonColor,borderColor:l?`${w.buttonActiveColor}33`:"transparent"}),L=(l,y)=>{l.currentTarget.style.backgroundColor=y?`${w.buttonActiveColor}22`:w.buttonHoverColor+"44"},O=l=>{l.currentTarget.style.backgroundColor="transparent"};return a.jsxs("div",{ref:D,style:{display:A?"flex":"grid",gridTemplateColumns:A?void 0:"1fr auto 1fr",alignItems:"center",padding:"6px 16px",backgroundColor:w.controlBarBackground,borderBottom:`1px solid ${w.controlBarBorder}`,fontFamily:"system-ui, -apple-system, sans-serif"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[a.jsx("div",{onClick:at,title:at?c.dateTimeClickTooltip:void 0,style:{color:w.labelColor,fontFamily:"monospace",lineHeight:1.15,cursor:at?"pointer":"default",borderRadius:"4px",padding:"2px 4px",transition:"background 0.15s"},onMouseEnter:l=>{at&&(l.currentTarget.style.background=w.buttonHoverColor+"44")},onMouseLeave:l=>l.currentTarget.style.background="transparent",children:(()=>{const{timeFormat:l,dateFormat:y}=b.splitForDisplay(i),lt=b.getTimezoneAbbr(v,j);return a.jsxs(a.Fragment,{children:[l&&a.jsx("div",{style:{fontSize:"2em",fontWeight:"bold",letterSpacing:"0.02em"},children:b.formatDateTime(v,l,j)}),y&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[a.jsx("span",{style:{fontSize:"1.15em",letterSpacing:"0.03em",color:w.buttonActiveColor},children:b.formatDateTime(v,y,j)}),lt&&a.jsx("span",{style:{fontSize:"0.9em",color:w.labelColor,opacity:.7,fontWeight:"bold",letterSpacing:"0.04em"},children:lt})]})]})})()}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px",justifyContent:"center"},children:[a.jsx("button",{onClick:ct,style:{...W,fontSize:"11px",fontWeight:"bold",letterSpacing:"0.05em",width:"52px",minWidth:"52px",height:"20px",borderRadius:"3px",color:k?w.controlBarBackground:w.buttonActiveColor,backgroundColor:k?w.buttonActiveColor:"transparent",borderColor:w.buttonActiveColor,opacity:k?1:.55},onMouseEnter:l=>{l.currentTarget.style.opacity="1"},onMouseLeave:l=>{l.currentTarget.style.opacity=k?"1":"0.55"},title:k?c.liveActiveTooltip:c.liveTooltip,children:k?c.liveActiveLabel:c.liveLabel}),a.jsx("div",{style:{height:"20px",display:"flex",alignItems:"center"},children:!mt&&a.jsx("button",{onClick:()=>q(),style:{...W,fontSize:"11px",color:w.buttonActiveColor,borderColor:`${w.buttonActiveColor}44`,width:"52px",minWidth:"52px",height:"20px"},onMouseEnter:l=>L(l,!0),onMouseLeave:O,title:c.resetSpeedTooltip,children:J?`◀ ${tt}×`:`${tt}× ▶`})})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",...A?{flex:1,justifyContent:"center"}:{}},children:[it&&a.jsx("button",{onClick:X?Q:void 0,disabled:!X,style:{...B(!1),opacity:X?1:.3,cursor:X?"pointer":"default"},onMouseEnter:X?l=>L(l,!1):void 0,onMouseLeave:X?O:void 0,title:X?c.jumpToStartTooltip:c.noStartTimeTooltip,children:"⏮"}),a.jsx("button",{onClick:K,style:{...B(J),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:l=>L(l,J),onMouseLeave:O,title:J?b.resolveLabel(c.rewindActiveTooltip,tt):c.rewindTooltip,children:J?a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[tt,"×"]}),"◀◀"]}):"◀◀"}),a.jsx("button",{onClick:()=>V(!C),style:{...W,color:w.buttonActiveColor,fontSize:"18px",width:"40px",minWidth:"40px",height:"40px",borderColor:`${w.buttonActiveColor}55`,borderRadius:"50%",paddingLeft:C?"0":"2px"},onMouseEnter:l=>L(l,!0),onMouseLeave:O,title:C?c.pauseTooltip:J?c.playFromRewindTooltip:c.playTooltip,children:C?a.jsx(qt,{}):"▶"}),a.jsx("button",{onClick:z,style:{...B($),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:l=>L(l,$),onMouseLeave:O,title:$?b.resolveLabel(c.fastForwardActiveTooltip,tt):c.fastForwardTooltip,children:$?a.jsxs(a.Fragment,{children:["▶▶",a.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[tt,"×"]})]}):"▶▶"}),Y&&a.jsx("button",{onClick:N?st:void 0,disabled:!N,style:{...B(!1),opacity:N?1:.3,cursor:N?"pointer":"default"},onMouseEnter:N?l=>L(l,!1):void 0,onMouseLeave:N?O:void 0,title:N?c.jumpToEndTooltip:c.noEndTimeTooltip,children:"⏭"})]}),!A&&a.jsx("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:M!=null&&x!=null&&a.jsx("button",{onClick:M,style:{...W,color:w.buttonActiveColor,borderColor:`${w.buttonActiveColor}33`},onMouseEnter:l=>L(l,x),onMouseLeave:O,title:x?c.collapseSwimLanesTooltip:c.expandSwimLanesTooltip,children:x?a.jsx(Jt,{}):a.jsx(Nt,{})})}),A&&M!=null&&x!=null&&a.jsx("button",{onClick:M,style:{...W,color:w.buttonActiveColor,borderColor:`${w.buttonActiveColor}33`,marginLeft:"4px"},onMouseEnter:l=>L(l,x),onMouseLeave:O,title:x?c.collapseSwimLanesTooltip:c.expandSwimLanesTooltip,children:x?a.jsx(Jt,{}):a.jsx(Nt,{})})]})},Lt=n.forwardRef((v,C)=>{const{currentTime:I,defaultStartMs:i,defaultEndMs:j,theme:k,maxTicks:X,timezone:N,dateTimeFormat:it,months:Y,onTimeChange:V,onDragStart:Q,onDragEnd:K,swimLanes:z,showSwimLanes:st,onSwimLaneItemClick:ct,onSwimLaneItemHover:q,onSwimLaneItemDoubleClick:at,onSwimLaneItemContextMenu:w,onSwimLaneReorder:x}=v,M=n.useRef(null),nt=n.useRef(k),J=n.useRef(X),$=n.useRef(N),mt=n.useRef(it),tt=n.useRef(Y),c=n.useRef(i),D=n.useRef(j),A=n.useRef(S.JulianDate.toDate(I).getTime());n.useEffect(()=>{nt.current=k},[k]),n.useEffect(()=>{J.current=X},[X]),n.useEffect(()=>{$.current=N,m()},[N]),n.useEffect(()=>{mt.current=it,m()},[it]),n.useEffect(()=>{tt.current=Y,m()},[Y]);const F=n.useRef(z??[]),W=n.useRef(st??(z!=null&&z.length>0)),B=n.useRef(0),L=n.useRef(null),O=n.useRef(null),l=n.useRef(ct),y=n.useRef(q),lt=n.useRef(at),e=n.useRef(w),u=n.useRef(x);n.useEffect(()=>{l.current=ct},[ct]),n.useEffect(()=>{y.current=q},[q]),n.useEffect(()=>{lt.current=at},[at]),n.useEffect(()=>{e.current=w},[w]),n.useEffect(()=>{u.current=x},[x]),n.useEffect(()=>{F.current=z??[],m()},[z]),n.useEffect(()=>{W.current=st??(z!=null&&z.length>0),m()},[st,z]);const E=n.useRef(null),T=n.useRef(null),ft=n.useRef(!1),bt=n.useRef(0),R=n.useRef("none"),rt=n.useRef(0),pt=n.useRef(0),Tt=n.useRef(0),gt=n.useRef("none"),Mt=n.useRef(0),xt=n.useRef(0),H=n.useRef(0),Dt=n.useRef(0),Et=(t,r)=>Math.hypot(r.clientX-t.clientX,r.clientY-t.clientY),ht=n.useCallback(()=>({startMs:c.current,endMs:D.current,currentMs:A.current,theme:nt.current,maxTicks:J.current,timezone:$.current,use12h:/h/.test(mt.current??""),months:tt.current,swimLanes:F.current,showSwimLanes:W.current,scrollTop:B.current,reorderState:O.current}),[]);n.useImperativeHandle(C,()=>({zoomTo(t,r,s){const p=Math.max(b.MIN_SPAN_MS,Math.min(b.MAX_SPAN_MS,r-t)),o=(t+r)/2;c.current=o-p/2,D.current=o+p/2,s!==void 0&&(A.current=s),m()},getVisibleRange(){return{startMs:c.current,endMs:D.current}},startFollow(t){if(bt.current=t,T.current!==null)return;ft.current=!0;let r=performance.now();const s=()=>{const p=performance.now(),o=p-r;r=p;const d=o*bt.current;c.current+=d,D.current+=d,A.current+=d,m(),T.current=requestAnimationFrame(s)};T.current=requestAnimationFrame(s)},stopFollow(){ft.current=!1,T.current!==null&&(cancelAnimationFrame(T.current),T.current=null)},correctFollow(t){if(!ft.current)return;const r=t-A.current;A.current=t,c.current+=r,D.current+=r},appendSwimLane(t){F.current=[...F.current,t],m()},updateSwimLane(t,r){F.current=F.current.map(s=>s.id===t?{...s,...r,id:s.id}:s),m()},removeSwimLane(t){F.current=F.current.filter(r=>r.id!==t),m()},reorderSwimLanes(t){const r=new Map(F.current.map(p=>[p.id,p])),s=[];for(const p of t){const o=r.get(p);o&&s.push(o)}F.current=s,m()}}));const m=n.useCallback(()=>{const t=M.current;if(!t)return;const r=t.getContext("2d");if(!r)return;const s=t.getBoundingClientRect(),p=s.width,o=s.height;if(p===0||o===0)return;const d=window.devicePixelRatio||1,g=Math.round(p*d),h=Math.round(o*d);(t.width!==g||t.height!==h)&&(t.width=g,t.height=h),r.save(),r.scale(d,d);const P=b.drawTimeline(r,p,o,ht());P!==B.current&&(B.current=P),r.restore()},[ht]);n.useLayoutEffect(()=>{m();const t=M.current;if(!t)return;const r=new ResizeObserver(()=>m());return r.observe(t),()=>r.disconnect()},[m]),n.useEffect(()=>{if(ft.current)return;const t=S.JulianDate.toDate(I).getTime();A.current!==t&&(A.current=t,m())},[I,m]);const Rt=n.useCallback(t=>{if(E.current!==null)return;const r=()=>{const s=M.current,p=D.current-c.current,o=t*p*.01;if(c.current+=o,D.current+=o,s){const d=s.getBoundingClientRect(),g=Math.max(0,Math.min(d.width,pt.current-d.left)),h=c.current+g/d.width*(D.current-c.current);A.current=h,V(S.JulianDate.fromDate(new Date(h)))}m(),E.current=requestAnimationFrame(r)};E.current=requestAnimationFrame(r)},[m,V]),wt=n.useCallback(()=>{E.current!==null&&(cancelAnimationFrame(E.current),E.current=null)},[]),dt=n.useCallback((t,r,s,p)=>b.hitTestSwimLane(t,r,s,p,ht()),[ht]),At=n.useCallback((t,r,s)=>b.hitTestLaneLabel(t,r,s,ht()),[ht]),yt=n.useCallback((t,r)=>b.isInSwimLaneRegion(t,r,ht()),[ht]),Ot=n.useCallback(t=>{t.preventDefault();const r=t.currentTarget.getBoundingClientRect(),s=t.clientX-r.left,p=t.clientY-r.top;if(t.button===0&&u.current){const o=At(s,p,r.height);if(o){const g=F.current.findIndex(h=>h.id===o.id);O.current={dragging:!0,dragLaneId:o.id,dragStartY:t.clientY,currentY:t.clientY,insertIndex:g},t.currentTarget.style.cursor="grabbing";return}}if(t.button===0&&yt(p,r.height)){const o=(A.current-c.current)/(D.current-c.current)*r.width;if(!(Math.abs(s-o)<=10)&&dt(s,p,r.width,r.height)){Tt.current=performance.now();return}}if(t.button===0){R.current="scrub",pt.current=t.clientX,t.currentTarget.style.cursor="grabbing",Q==null||Q();const o=c.current+s/r.width*(D.current-c.current);A.current=o,m(),V(S.JulianDate.fromDate(new Date(o)))}else if(t.button===1)R.current="slide",rt.current=t.clientX;else if(t.button===2){if(e.current&&yt(p,r.height))return;R.current="zoom",rt.current=t.clientX}},[m,V,Q,At,yt,dt]);n.useEffect(()=>{const t=s=>{const p=O.current;if(p&&p.dragging){p.currentY=s.clientY;const h=M.current;if(h){const P=h.getBoundingClientRect(),Z=s.clientY-P.top;let Ct=-B.current;const It=F.current;let Bt=It.length;for(let kt=0;kt<It.length;kt++){const Ht=It[kt].height??b.DEFAULT_LANE_HEIGHT,ee=Ct+Ht/2;if(Z<ee){Bt=kt;break}Ct+=Ht+b.LANE_GAP}p.insertIndex=Bt}m();return}if(R.current==="none")return;const o=M.current;if(!o)return;const d=o.getBoundingClientRect(),g=d.width;if(R.current==="scrub"){pt.current=s.clientX;const h=s.clientX-d.left,P=g*.08;h<P?Rt(-1):h>g-P?Rt(1):wt();const Z=Math.max(0,Math.min(g,h)),vt=c.current+Z/g*(D.current-c.current);A.current=vt,m(),V(S.JulianDate.fromDate(new Date(vt)))}else if(R.current==="slide"){const h=rt.current-s.clientX;if(rt.current=s.clientX,h!==0){const P=h/g*(D.current-c.current);c.current+=P,D.current+=P,m()}}else if(R.current==="zoom"){const h=rt.current-s.clientX;rt.current=s.clientX,h!==0&&f(Math.pow(1.01,h))}},r=()=>{var p;const s=O.current;if(s&&s.dragging){const o=Math.abs(s.currentY-s.dragStartY),d=F.current,g=d.findIndex(h=>h.id===s.dragLaneId);if(o>5&&g>=0&&s.insertIndex!==g&&s.insertIndex!==g+1){const h=[...d],[P]=h.splice(g,1),Z=s.insertIndex>g?s.insertIndex-1:s.insertIndex;h.splice(Z,0,P),F.current=h,(p=u.current)==null||p.call(u,h.map(vt=>vt.id))}O.current=null,M.current&&(M.current.style.cursor="default"),m();return}wt(),R.current="none",M.current&&(M.current.style.cursor="default"),K==null||K()};return document.addEventListener("mousemove",t),document.addEventListener("mouseup",r),()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r)}},[m,V,K,Rt,wt]);const f=n.useCallback(t=>{const r=b.zoomRange(c.current,D.current,t);c.current=r.startMs,D.current=r.endMs,m()},[m]),_=n.useCallback(t=>{t.preventDefault();const r=M.current;if(!r)return;const s=r.getBoundingClientRect(),p=t.clientY-s.top,o=W.current,d=F.current;if(o&&d.length>0){const g=Math.max(0,s.height-b.TICK_AREA_HEIGHT);if(p>=0&&p<g){let h=0;for(const Z of d)h+=(Z.height??b.DEFAULT_LANE_HEIGHT)+b.LANE_GAP;const P=Math.max(0,h-g);if(P>0){B.current=Math.max(0,Math.min(P,B.current+t.deltaY*b.SWIM_LANE_SCROLL_SPEED)),m();return}}}f(Math.pow(1.05,t.deltaY>0?-1:1))},[f,m]);n.useEffect(()=>{const t=M.current;if(t)return t.addEventListener("wheel",_,{passive:!1}),()=>t.removeEventListener("wheel",_)},[_]),n.useEffect(()=>{const t=M.current;if(!t)return;const r=o=>{o.preventDefault();const d=t.getBoundingClientRect();if(o.touches.length===1){const g=o.touches[0].clientX-d.left,h=Math.max(0,Math.min(d.width,g)),P=c.current+h/d.width*(D.current-c.current);Dt.current=A.current,gt.current="scrub",Mt.current=o.touches[0].clientX,pt.current=o.touches[0].clientX,A.current=P,m(),Q==null||Q(),V(S.JulianDate.fromDate(new Date(P)))}else o.touches.length>=2&&(gt.current==="scrub"&&(A.current=Dt.current,m(),V(S.JulianDate.fromDate(new Date(Dt.current)))),gt.current="pinch",xt.current=Et(o.touches[0],o.touches[1]),H.current=(o.touches[0].clientX+o.touches[1].clientX)/2-d.left)},s=o=>{o.preventDefault();const d=t.getBoundingClientRect();if(gt.current==="scrub"&&o.touches.length>=1){const g=o.touches[0].clientX-d.left,h=d.width*.08;if(pt.current=o.touches[0].clientX,g<h)Rt(-1);else if(g>d.width-h)Rt(1);else{wt();const P=Math.max(0,Math.min(d.width,g)),Z=c.current+P/d.width*(D.current-c.current);A.current=Z,m(),V(S.JulianDate.fromDate(new Date(Z)))}}else if(gt.current==="slide"&&o.touches.length>=1){const g=Mt.current-o.touches[0].clientX;if(Mt.current=o.touches[0].clientX,g!==0){const h=g/d.width*(D.current-c.current);c.current+=h,D.current+=h,m()}}else if(gt.current==="pinch"&&o.touches.length>=2){const g=Et(o.touches[0],o.touches[1]),h=(o.touches[0].clientX+o.touches[1].clientX)/2-d.left;if(g>0&&xt.current>0){const P=c.current+H.current/d.width*(D.current-c.current),Z=b.zoomAroundMs(c.current,D.current,xt.current/g,P);c.current=Z.startMs,D.current=Z.endMs,m()}xt.current=g,H.current=h}},p=o=>{wt(),gt.current==="scrub"&&(K==null||K()),o.touches.length===0?gt.current="none":o.touches.length===1&&(gt.current="slide",Mt.current=o.touches[0].clientX)};return t.addEventListener("touchstart",r,{passive:!1}),t.addEventListener("touchmove",s,{passive:!1}),t.addEventListener("touchend",p,{passive:!1}),()=>{t.removeEventListener("touchstart",r),t.removeEventListener("touchmove",s),t.removeEventListener("touchend",p)}},[m,Q,K,V,f,Rt,wt]);const U=n.useCallback(t=>{var g,h,P;if(R.current!=="none")return;const r=t.currentTarget.getBoundingClientRect(),s=t.clientX-r.left,p=t.clientY-r.top,o=(A.current-c.current)/(D.current-c.current)*r.width,d=Math.abs(s-o)<=10;if(yt(p,r.height)){const Z=dt(s,p,r.width,r.height),vt=L.current;if(Z)t.currentTarget.style.cursor=d?"grab":"pointer",(!vt||vt.item.id!==Z.item.id||vt.lane.id!==Z.lane.id)&&(L.current=Z,(g=y.current)==null||g.call(y,{laneId:Z.lane.id,item:Z.item,originalEvent:t.nativeEvent}),m());else if(vt&&(L.current=null,(h=y.current)==null||h.call(y,null),m()),d)t.currentTarget.style.cursor="grab";else{const Ct=At(s,p,r.height);t.currentTarget.style.cursor=Ct&&u.current?"grab":"default"}return}L.current&&(L.current=null,(P=y.current)==null||P.call(y,null),m()),t.currentTarget.style.cursor=d?"grab":"default"},[m,dt,yt,At]),ut=n.useCallback(t=>{var g;if(performance.now()-Tt.current>300)return;const s=t.currentTarget.getBoundingClientRect(),p=t.clientX-s.left,o=t.clientY-s.top,d=dt(p,o,s.width,s.height);d&&((g=l.current)==null||g.call(l,{laneId:d.lane.id,item:d.item,originalEvent:t.nativeEvent}))},[dt]),G=n.useCallback(t=>{var d;const r=t.currentTarget.getBoundingClientRect(),s=t.clientX-r.left,p=t.clientY-r.top,o=dt(s,p,r.width,r.height);o&&((d=lt.current)==null||d.call(lt,{laneId:o.lane.id,item:o.item,originalEvent:t.nativeEvent}))},[dt]),et=n.useCallback(t=>{const r=t.currentTarget.getBoundingClientRect(),s=t.clientX-r.left,p=t.clientY-r.top,o=dt(s,p,r.width,r.height);o&&e.current?(t.preventDefault(),e.current({laneId:o.lane.id,item:o.item,originalEvent:t.nativeEvent})):t.preventDefault()},[dt]);return n.useEffect(()=>()=>{E.current!==null&&cancelAnimationFrame(E.current),T.current!==null&&cancelAnimationFrame(T.current)},[]),a.jsx("canvas",{ref:M,style:{width:"100%",flex:1,minHeight:0,display:"block",cursor:"default"},onMouseDown:Ot,onMouseMove:U,onClick:ut,onDoubleClick:G,onMouseLeave:()=>{var t;L.current&&(L.current=null,(t=y.current)==null||t.call(y,null),m()),R.current==="none"&&M.current&&(M.current.style.cursor="default")},onContextMenu:et})});Lt.displayName="TimelineCanvas";const zt=[2,4,8,16,32,100,1],Wt=[1,2,4,8,16,32,100],$t=({startTime:v,endTime:C,currentTime:I,clock:i,onTimeChange:j,onPlayPause:k,onMultiplierChange:X,height:N,showControls:it=!0,showJumpToStart:Y,showJumpToEnd:V,enableDrag:Q=!0,dateTimeFormat:K,onDateTimeClick:z,jumpToTime:st,maxTicks:ct,ffSpeeds:q=zt,rwSpeeds:at=Wt,theme:w,className:x,timezone:M,swimLanes:nt,showSwimLanes:J,onShowSwimLanesChange:$,swimLaneTransition:mt="animated",onSwimLaneItemClick:tt,onSwimLaneItemHover:c,onSwimLaneItemDoubleClick:D,onSwimLaneItemContextMenu:A,onSwimLaneReorder:F,labels:W})=>{const B=()=>Date.now(),L=v?S.JulianDate.toDate(b.toJulianDate(v)).getTime():B()-432e5,O=C?S.JulianDate.toDate(b.toJulianDate(C)).getTime():B()+12*3600*1e3,[l,y]=n.useState(()=>b.toJulianDate(I??v??S.JulianDate.fromDate(new Date))),[lt,e]=n.useState((i==null?void 0:i.shouldAnimate)??!1),[u,E]=n.useState((i==null?void 0:i.multiplier)??1),[T,ft]=n.useState(J??!0);n.useEffect(()=>{J!=null&&ft(J)},[J]);const bt=()=>{const f=!T;ft(f),$==null||$(f)},R=nt!=null&&nt.length>0,rt=n.useRef(null),[pt,Tt]=n.useState(0);n.useEffect(()=>{const f=rt.current;if(!f)return;const _=new ResizeObserver(([U])=>Tt(U.borderBoxSize[0].blockSize));return _.observe(f),()=>_.disconnect()},[it]);const Mt=R&&!T?`${pt+b.TICK_AREA_HEIGHT}px`:N!=null?`${N}px`:"100%",xt=n.useRef(!1),H=n.useRef(null),Dt={...b.defaultTheme,...w};n.useEffect(()=>{if(!i)return;const f=()=>{if(!xt.current){const _=S.JulianDate.clone(i.currentTime);if(y(_),e(i.shouldAnimate),E(i.multiplier),H.current){const{startMs:U,endMs:ut}=H.current.getVisibleRange(),G=ut-U,et=S.JulianDate.toDate(_).getTime(),t=et-U;t<=G*.1?H.current.zoomTo(et-G*.1,et+G*.9,et):t>=G*.9&&H.current.zoomTo(et-G*.9,et+G*.1,et)}}};return i.onTick.addEventListener(f),()=>{i.onTick.removeEventListener(f)}},[i]),n.useEffect(()=>{if(i)return;const f=setInterval(()=>{if(xt.current)return;const _=S.JulianDate.fromDate(new Date);if(y(_),H.current){const{startMs:U,endMs:ut}=H.current.getVisibleRange(),G=ut-U,et=S.JulianDate.toDate(_).getTime(),t=et-U;t<=G*.1?H.current.zoomTo(et-G*.1,et+G*.9,et):t>=G*.9&&H.current.zoomTo(et-G*.9,et+G*.1,et)}},1e3);return()=>clearInterval(f)},[i]),n.useEffect(()=>{if(!st)return;const f=b.toJulianDate(st);if(ht(f),H.current){const{startMs:_,endMs:U}=H.current.getVisibleRange(),ut=U-_,G=S.JulianDate.toDate(f).getTime();H.current.zoomTo(G-ut/2,G+ut/2)}},[st]);const Et=(f,_=!0)=>{i&&(i.multiplier=f,_&&(i.shouldAnimate=!0)),E(f),_&&e(!0),X==null||X(f)},ht=f=>{y(f),i&&(i.currentTime=S.JulianDate.clone(f)),j==null||j(f)},m=f=>{f&&u<0&&Et(1,!1),i&&(i.shouldAnimate=f),e(f),k==null||k(f)},Rt=()=>{const f=q.length>0?q:zt,_=u>1?u:1,U=f.indexOf(_),ut=f[U<0||U===f.length-1?0:U+1];Et(ut)},wt=()=>{const f=at.length>0?at:Wt,_=u<0?Math.abs(u):0,U=f.indexOf(_),ut=-f[U<0||U===f.length-1?0:U+1];Et(ut)},dt=()=>{var _;const f=b.toJulianDate(v??S.JulianDate.fromDate(new Date(L)));i&&(i.currentTime=S.JulianDate.clone(f)),y(f),(_=H.current)==null||_.zoomTo(L,O)},At=()=>{var _;const f=b.toJulianDate(C??S.JulianDate.fromDate(new Date(O)));i&&(i.currentTime=S.JulianDate.clone(f)),y(f),(_=H.current)==null||_.zoomTo(L,O)},yt=()=>{const f=S.JulianDate.fromDate(new Date);i&&(i.currentTime=S.JulianDate.clone(f)),y(f),Et(1);const _=Date.now();if(H.current){const{startMs:U,endMs:ut}=H.current.getVisibleRange(),G=ut-U;H.current.zoomTo(_-G/2,_+G/2)}},Ot=Math.abs(S.JulianDate.toDate(l).getTime()-Date.now())<1e4;return a.jsxs("div",{className:x,style:{width:"100%",height:Mt,overflow:"hidden",display:"flex",flexDirection:"column",fontFamily:"system-ui, -apple-system, sans-serif",transition:mt==="animated"?"height 0.2s ease":void 0},children:[it&&a.jsx("div",{ref:rt,children:a.jsx(Yt,{currentTime:l,isPlaying:lt,multiplier:u,isLive:Ot,hasStartTime:v!=null,hasEndTime:C!=null,showJumpToStart:Y,showJumpToEnd:V,onPlayPause:m,onJumpToStart:dt,onRewind:wt,onFastForward:Rt,onJumpToEnd:At,onJumpToLive:yt,onResetSpeed:()=>Et(1),onDateTimeClick:z,dateTimeFormat:K,timezone:M,theme:Dt,swimLanesVisible:R?T:void 0,onToggleSwimLanes:R?bt:void 0,labels:W})}),Q!==!1&&a.jsx(Lt,{ref:H,currentTime:l,defaultStartMs:L,defaultEndMs:O,theme:Dt,maxTicks:ct,timezone:M,dateTimeFormat:K,months:W==null?void 0:W.months,onTimeChange:ht,onDragStart:()=>{xt.current=!0},onDragEnd:()=>{xt.current=!1},swimLanes:nt,showSwimLanes:T,onSwimLaneItemClick:tt,onSwimLaneItemHover:c,onSwimLaneItemDoubleClick:D,onSwimLaneItemContextMenu:A,onSwimLaneReorder:F})]})},te=({startTime:v,endTime:C,currentTime:I,width:i,height:j,tickInterval:k,showLabels:X,snapToTicks:N,enableDrag:it,theme:Y,onTimeChange:V,onVisibleRangeChange:Q,onDragStart:K,onDragEnd:z})=>{const st=n.useMemo(()=>b.generateTicks(v,C,k,i),[v,C,k,i]),ct=n.useMemo(()=>b.timeToPosition(I,v,C,i),[I,v,C,i]),q=n.useRef(null),at=x=>{if(!it)return;const M=x.currentTarget.getBoundingClientRect(),nt=x.clientX-M.left,J=Math.max(0,Math.min(i,nt));if(!(Math.abs(J-ct)<=10)){let O=J;N&&(O=b.snapToTick(J,st,10));const l=new Date(v).getTime(),y=new Date(C).getTime();V(S.JulianDate.fromDate(new Date(l+O/i*(y-l))));return}K==null||K();const mt=x.clientX,tt=new Date(I).getTime(),c=new Date(v).getTime(),A=(new Date(C).getTime()-c)/i;let F=0,W=!1;const B=O=>{F=O.clientX-mt,W=!0,q.current||(q.current=requestAnimationFrame(()=>{if(W){const l=tt+F*A;V(S.JulianDate.fromDate(new Date(l))),W=!1}q.current=null}))},L=()=>{document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",L),q.current!==null&&(cancelAnimationFrame(q.current),q.current=null),z==null||z()};document.addEventListener("mousemove",B),document.addEventListener("mouseup",L)},w=x=>{x.preventDefault();const M=x.shiftKey?x.deltaY:x.deltaX!==0?x.deltaX:x.deltaY;if(Math.abs(M)<1)return;const nt=new Date(v).getTime(),J=new Date(C).getTime(),$=M/i*(J-nt)*.5;Q==null||Q(S.JulianDate.fromDate(new Date(nt+$)),S.JulianDate.fromDate(new Date(J+$)))};return a.jsxs("svg",{width:"100%",height:j,style:{backgroundColor:Y.backgroundColor,display:"block",cursor:"default"},onMouseDown:at,onWheel:w,children:[a.jsx("rect",{width:i,height:j,fill:Y.backgroundColor}),st.map((x,M)=>a.jsxs("g",{children:[a.jsx("line",{x1:x.position,y1:j-(x.isMajor?Y.majorTickHeight:Y.minorTickHeight),x2:x.position,y2:j,stroke:x.isMajor?Y.majorTickColor:Y.tickColor,strokeWidth:"1"}),X&&x.isMajor&&x.label&&a.jsx("text",{x:x.position,y:j-Y.majorTickHeight-5,textAnchor:"middle",fill:Y.labelColor,fontSize:Y.fontSize,fontFamily:"monospace",children:x.label})]},M)),a.jsx("line",{x1:ct,y1:0,x2:ct,y2:j,stroke:Y.indicatorColor,strokeWidth:Y.indicatorLineWidth,pointerEvents:"none"}),it&&a.jsx("rect",{x:Math.max(0,ct-10),y:0,width:20,height:j,fill:"transparent",style:{cursor:"ew-resize"},pointerEvents:"visiblePainted"}),a.jsx("circle",{cx:ct,cy:5,r:4,fill:Y.indicatorColor,pointerEvents:"none"})]})};Object.defineProperty(ot,"TICK_AREA_HEIGHT",{enumerable:!0,get:()=>b.TICK_AREA_HEIGHT}),ot.Timeline=$t,ot.TimelineCanvas=Lt,ot.TimelineControls=Yt,ot.TimelineSVG=te,Object.keys(b).forEach(v=>{v!=="default"&&!Object.prototype.hasOwnProperty.call(ot,v)&&Object.defineProperty(ot,v,{enumerable:!0,get:()=>b[v]})}),Object.defineProperty(ot,Symbol.toStringTag,{value:"Module"})}));
|
|
22
|
+
<%s key={someKey} {...props} />`,g,A,tt,A),H[A+g]=!0)}if(A=null,a!==void 0&&(F(a),A=""+a),J(i)&&(F(i.key),A=""+i.key),"key"in i){a={};for(var st in i)st!=="key"&&(a[st]=i[st])}else a=i;return A&&N(a,typeof t=="function"?t.displayName||t.name||"Unknown":t),z(t,A,a,j(),ut,mt)}function W(t){O(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===rt&&(t._payload.status==="fulfilled"?O(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function O(t){return typeof t=="object"&&t!==null&&t.$$typeof===U}var ct=n,U=Symbol.for("react.transitional.element"),ft=Symbol.for("react.portal"),Z=Symbol.for("react.fragment"),dt=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),K=Symbol.for("react.context"),nt=Symbol.for("react.forward_ref"),Q=Symbol.for("react.suspense"),S=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),rt=Symbol.for("react.lazy"),gt=Symbol.for("react.activity"),Et=Symbol.for("react.client.reference"),ot=ct.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,s=Object.prototype.hasOwnProperty,b=Array.isArray,v=console.createTask?console.createTask:function(){return null};ct={react_stack_bottom_frame:function(t){return t()}};var at,q={},D=ct.react_stack_bottom_frame.bind(ct,k)(),$=v(d(k)),H={};jt.Fragment=Z,jt.jsx=function(t,i,a){var g=1e4>ot.recentlyCreatedOwnerStacks++;return Y(t,i,a,!1,g?Error("react-stack-top-frame"):D,g?v(d(t)):$)},jt.jsxs=function(t,i,a){var g=1e4>ot.recentlyCreatedOwnerStacks++;return Y(t,i,a,!0,g?Error("react-stack-top-frame"):D,g?v(d(t)):$)}})()),jt}var Bt;function ne(){return Bt||(Bt=1,process.env.NODE_ENV==="production"?It.exports=te():It.exports=ee()),It.exports}var l=ne();const re=520,oe=()=>l.jsxs("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"currentColor","aria-hidden":"true",children:[l.jsx("rect",{x:"1",y:"0",width:"4",height:"16",rx:"1"}),l.jsx("rect",{x:"9",y:"0",width:"4",height:"16",rx:"1"})]}),Ht=()=>l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("polyline",{points:"3,5 7,9 11,5"})}),Gt=()=>l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("polyline",{points:"3,9 7,5 11,9"})}),se={sm:{width:44,height:18,fontSize:"10px",dot:5,borderRadius:"3px"},md:{width:56,height:22,fontSize:"11px",dot:6,borderRadius:"3px"},lg:{width:72,height:30,fontSize:"13px",dot:8,borderRadius:"4px"}},Ut=({currentTime:R,isPlaying:C,multiplier:F,dateTimeFormat:d,timezone:j,isLive:k,hasStartTime:J,hasEndTime:N,showJumpToStart:pt=!0,showJumpToEnd:z=!0,onPlayPause:Y,onJumpToStart:W,onRewind:O,onFastForward:ct,onJumpToEnd:U,onJumpToLive:ft,onResetSpeed:Z,onDateTimeClick:dt,theme:T,swimLanesVisible:M,onToggleSwimLanes:K,labels:nt,liveButtonSize:Q="md",liveButtonPosition:S="left",live:L=!1})=>{const rt=F<0,gt=F>1,Et=F===1,ot=Math.abs(F),s=n.useMemo(()=>({...E.DEFAULT_LABELS,...nt}),[nt]),b=n.useRef(null),[v,at]=n.useState(!1);n.useEffect(()=>{const a=b.current;if(!a)return;const g=new ResizeObserver(([ut])=>{at(ut.contentRect.width<re)});return g.observe(a),()=>g.disconnect()},[]);const q={background:"none",border:"1px solid transparent",cursor:"pointer",fontSize:"16px",padding:"0",display:"flex",alignItems:"center",justifyContent:"center",minWidth:"32px",width:"32px",height:"32px",borderRadius:"4px",transition:"background-color 0.15s, color 0.15s",fontFamily:"system-ui, -apple-system, sans-serif",flexShrink:0,lineHeight:1},D=a=>({...q,color:a?T.buttonActiveColor:T.buttonColor,borderColor:a?`${T.buttonActiveColor}33`:"transparent"}),$=(a,g)=>{a.currentTarget.style.backgroundColor=g?`${T.buttonActiveColor}22`:T.buttonHoverColor+"44"},H=a=>{a.currentTarget.style.backgroundColor="transparent"},t=se[Q],i=l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[l.jsxs("button",{onClick:L?void 0:ft,style:{...q,fontSize:t.fontSize,fontWeight:"bold",letterSpacing:"0.05em",width:`${t.width}px`,minWidth:`${t.width}px`,height:`${t.height}px`,borderRadius:t.borderRadius,color:L||k?T.controlBarBackground:T.buttonActiveColor,backgroundColor:L||k?T.buttonActiveColor:"transparent",borderColor:T.buttonActiveColor,opacity:1,gap:"4px",cursor:L?"default":"pointer"},onMouseEnter:L?void 0:(a=>{a.currentTarget.style.opacity="1"}),onMouseLeave:L?void 0:(a=>{a.currentTarget.style.opacity=k?"1":"0.55"}),title:L||k?s.liveActiveTooltip:s.liveTooltip,children:[(L||k)&&l.jsx("span",{style:{width:`${t.dot}px`,height:`${t.dot}px`,borderRadius:"50%",backgroundColor:T.liveDotColor,display:"inline-block",flexShrink:0}}),L||k?s.liveActiveLabel:s.liveLabel]}),!Et&&!L&&l.jsx("button",{onClick:()=>Z(),style:{...q,fontSize:"11px",color:T.buttonActiveColor,borderColor:`${T.buttonActiveColor}44`,width:`${t.width}px`,minWidth:`${t.width}px`,height:`${t.height}px`},onMouseEnter:a=>$(a,!0),onMouseLeave:H,title:s.resetSpeedTooltip,children:rt?`◀ ${ot}×`:`${ot}× ▶`})]});return l.jsxs("div",{ref:b,style:{display:v?"flex":"grid",gridTemplateColumns:v?void 0:"1fr auto 1fr",alignItems:"center",padding:"6px 16px",backgroundColor:T.controlBarBackground,borderBottom:`1px solid ${T.controlBarBorder}`,fontFamily:"system-ui, -apple-system, sans-serif"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[l.jsx("div",{onClick:L?void 0:dt,title:!L&&dt?s.dateTimeClickTooltip:void 0,style:{color:T.labelColor,fontFamily:"monospace",lineHeight:1.15,cursor:!L&&dt?"pointer":"default",borderRadius:"4px",padding:"2px 4px",transition:"background 0.15s"},onMouseEnter:a=>{!L&&dt&&(a.currentTarget.style.background=T.buttonHoverColor+"44")},onMouseLeave:a=>a.currentTarget.style.background="transparent",children:(()=>{const{timeFormat:a,dateFormat:g}=E.splitForDisplay(d),ut=E.getTimezoneAbbr(R,j);return l.jsxs(l.Fragment,{children:[a&&l.jsx("div",{style:{fontSize:"2em",fontWeight:"bold",letterSpacing:"0.02em"},children:E.formatDateTime(R,a,j)}),g&&l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[l.jsx("span",{style:{fontSize:"1.15em",letterSpacing:"0.03em",color:T.buttonActiveColor},children:E.formatDateTime(R,g,j)}),ut&&l.jsx("span",{style:{fontSize:"0.9em",color:T.labelColor,opacity:.7,fontWeight:"bold",letterSpacing:"0.04em"},children:ut})]})]})})()}),S==="left"&&i]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",...v?{flex:1,justifyContent:"center"}:{}},children:[!L&&pt&&l.jsx("button",{onClick:J?W:void 0,disabled:!J,style:{...D(!1),opacity:J?1:.3,cursor:J?"pointer":"default"},onMouseEnter:J?a=>$(a,!1):void 0,onMouseLeave:J?H:void 0,title:J?s.jumpToStartTooltip:s.noStartTimeTooltip,children:"⏮"}),!L&&l.jsx("button",{onClick:O,style:{...D(rt),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:a=>$(a,rt),onMouseLeave:H,title:rt?E.resolveLabel(s.rewindActiveTooltip,ot):s.rewindTooltip,children:rt?l.jsxs(l.Fragment,{children:[l.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[ot,"×"]}),"◀◀"]}):"◀◀"}),!L&&l.jsx("button",{onClick:()=>Y(!C),style:{...q,color:T.buttonActiveColor,fontSize:"18px",width:"40px",minWidth:"40px",height:"40px",borderColor:`${T.buttonActiveColor}55`,borderRadius:"50%",paddingLeft:C?"0":"2px"},onMouseEnter:a=>$(a,!0),onMouseLeave:H,title:C?s.pauseTooltip:rt?s.playFromRewindTooltip:s.playTooltip,children:C?l.jsx(oe,{}):"▶"}),!L&&l.jsx("button",{onClick:ct,style:{...D(gt),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:a=>$(a,gt),onMouseLeave:H,title:gt?E.resolveLabel(s.fastForwardActiveTooltip,ot):s.fastForwardTooltip,children:gt?l.jsxs(l.Fragment,{children:["▶▶",l.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[ot,"×"]})]}):"▶▶"}),!L&&z&&l.jsx("button",{onClick:N?U:void 0,disabled:!N,style:{...D(!1),opacity:N?1:.3,cursor:N?"pointer":"default"},onMouseEnter:N?a=>$(a,!1):void 0,onMouseLeave:N?H:void 0,title:N?s.jumpToEndTooltip:s.noEndTimeTooltip,children:"⏭"})]}),!v&&l.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:"8px"},children:[S==="right"&&i,K!=null&&M!=null&&l.jsx("button",{onClick:K,style:{...q,color:T.buttonActiveColor,borderColor:`${T.buttonActiveColor}33`},onMouseEnter:a=>$(a,M),onMouseLeave:H,title:M?s.collapseSwimLanesTooltip:s.expandSwimLanesTooltip,children:M?l.jsx(Ht,{}):l.jsx(Gt,{})})]}),v&&K!=null&&M!=null&&l.jsx("button",{onClick:K,style:{...q,color:T.buttonActiveColor,borderColor:`${T.buttonActiveColor}33`,marginLeft:"4px"},onMouseEnter:a=>$(a,M),onMouseLeave:H,title:M?s.collapseSwimLanesTooltip:s.expandSwimLanesTooltip,children:M?l.jsx(Ht,{}):l.jsx(Gt,{})})]})},Nt=n.forwardRef((R,C)=>{const{currentTime:F,defaultStartMs:d,defaultEndMs:j,theme:k,maxTicks:J,timezone:N,dateTimeFormat:pt,months:z,onTimeChange:Y,onDragStart:W,onDragEnd:O,onRangeSelect:ct,swimLanes:U,showSwimLanes:ft,onSwimLaneItemClick:Z,onSwimLaneItemHover:dt,onSwimLaneItemDoubleClick:T,onSwimLaneItemContextMenu:M,onSwimLaneReorder:K,disableNeedleDrag:nt,invertScrollZoom:Q}=R,S=n.useRef(null),L=n.useRef(k),rt=n.useRef(J),gt=n.useRef(N),Et=n.useRef(pt),ot=n.useRef(z),s=n.useRef(d),b=n.useRef(j),v=n.useRef(_.JulianDate.toDate(F).getTime());n.useEffect(()=>{L.current=k},[k]),n.useEffect(()=>{rt.current=J},[J]),n.useEffect(()=>{gt.current=N,x()},[N]),n.useEffect(()=>{Et.current=pt,x()},[pt]),n.useEffect(()=>{ot.current=z,x()},[z]);const at=n.useRef(nt??!1);n.useEffect(()=>{at.current=nt??!1},[nt]);const q=n.useRef(Q??!1);n.useEffect(()=>{q.current=Q??!1},[Q]);const D=n.useRef(U??[]),$=n.useRef(ft??(U!=null&&U.length>0)),H=n.useRef(0),t=n.useRef(null),i=n.useRef(null),a=n.useRef(Z),g=n.useRef(dt),ut=n.useRef(T),mt=n.useRef(M),A=n.useRef(K);n.useEffect(()=>{a.current=Z},[Z]),n.useEffect(()=>{g.current=dt},[dt]),n.useEffect(()=>{ut.current=T},[T]),n.useEffect(()=>{mt.current=M},[M]),n.useEffect(()=>{A.current=K},[K]),n.useEffect(()=>{D.current=U??[],x()},[U]),n.useEffect(()=>{$.current=ft??(U!=null&&U.length>0),x()},[ft,U]);const tt=n.useRef(null),st=n.useRef(null),wt=n.useRef(!1),Ot=n.useRef(0),P=n.useRef("none"),xt=n.useRef(0),Dt=n.useRef(0),Pt=n.useRef(0),Ct=n.useRef(0),Ft=n.useRef(0),bt=n.useRef(null),B=n.useRef(ct);n.useEffect(()=>{B.current=ct},[ct]);const vt=n.useRef(null),lt=n.useRef("none"),yt=n.useRef(0),At=n.useRef(0),kt=n.useRef(0),Lt=n.useRef(0),Xt=(e,r)=>Math.hypot(r.clientX-e.clientX,r.clientY-e.clientY),Rt=n.useCallback(()=>({startMs:s.current,endMs:b.current,currentMs:v.current,theme:L.current,maxTicks:rt.current,timezone:gt.current,use12h:/h/.test(Et.current??""),months:ot.current,swimLanes:D.current,showSwimLanes:$.current,scrollTop:H.current,reorderState:i.current,rangeSelection:bt.current,hoverMs:vt.current}),[]);n.useImperativeHandle(C,()=>({zoomTo(e,r,o){const p=Math.max(E.MIN_SPAN_MS,Math.min(E.MAX_SPAN_MS,r-e)),c=(e+r)/2;s.current=c-p/2,b.current=c+p/2,o!==void 0&&(v.current=o),x()},getVisibleRange(){return{startMs:s.current,endMs:b.current}},startFollow(e){if(Ot.current=e,st.current!==null)return;wt.current=!0;let r=performance.now();const o=()=>{const p=performance.now(),c=p-r;r=p;const u=c*Ot.current;s.current+=u,b.current+=u,v.current+=u,x(),st.current=requestAnimationFrame(o)};st.current=requestAnimationFrame(o)},stopFollow(){wt.current=!1,st.current!==null&&(cancelAnimationFrame(st.current),st.current=null)},correctFollow(e){if(!wt.current)return;const r=e-v.current;v.current=e,s.current+=r,b.current+=r},appendSwimLane(e){D.current=[...D.current,e],x()},updateSwimLane(e,r){D.current=D.current.map(o=>o.id===e?{...o,...r,id:o.id}:o),x()},removeSwimLane(e){D.current=D.current.filter(r=>r.id!==e),x()},reorderSwimLanes(e){const r=new Map(D.current.map(p=>[p.id,p])),o=[];for(const p of e){const c=r.get(p);c&&o.push(c)}D.current=o,x()}}));const x=n.useCallback(()=>{const e=S.current;if(!e)return;const r=e.getContext("2d");if(!r)return;const o=e.getBoundingClientRect(),p=o.width,c=o.height;if(p===0||c===0)return;const u=window.devicePixelRatio||1,m=Math.round(p*u),f=Math.round(c*u);(e.width!==m||e.height!==f)&&(e.width=m,e.height=f),r.save(),r.scale(u,u);const y=E.drawTimeline(r,p,c,Rt());y!==H.current&&(H.current=y),r.restore()},[Rt]);n.useLayoutEffect(()=>{x();const e=S.current;if(!e)return;const r=new ResizeObserver(()=>x());return r.observe(e),()=>r.disconnect()},[x]),n.useEffect(()=>{if(wt.current)return;const e=_.JulianDate.toDate(F).getTime();v.current!==e&&(v.current=e,x())},[F,x]);const Tt=n.useCallback(e=>{if(tt.current!==null)return;const r=()=>{const o=S.current,p=b.current-s.current,c=e*p*.01;if(s.current+=c,b.current+=c,o){const u=o.getBoundingClientRect(),m=Math.max(0,Math.min(u.width,Dt.current-u.left)),f=s.current+m/u.width*(b.current-s.current);v.current=f,Y(_.JulianDate.fromDate(new Date(f)))}x(),tt.current=requestAnimationFrame(r)};tt.current=requestAnimationFrame(r)},[x,Y]),h=n.useCallback(()=>{tt.current!==null&&(cancelAnimationFrame(tt.current),tt.current=null)},[]),w=n.useCallback((e,r,o,p)=>E.hitTestSwimLane(e,r,o,p,Rt()),[Rt]),X=n.useCallback((e,r,o)=>E.hitTestLaneLabel(e,r,o,Rt()),[Rt]),et=n.useCallback((e,r)=>E.isInSwimLaneRegion(e,r,Rt()),[Rt]),G=n.useCallback(e=>{e.preventDefault();const r=e.currentTarget.getBoundingClientRect(),o=e.clientX-r.left,p=e.clientY-r.top;if(e.button===0&&A.current){const c=X(o,p,r.height);if(c){const m=D.current.findIndex(f=>f.id===c.id);i.current={dragging:!0,dragLaneId:c.id,dragStartY:e.clientY,currentY:e.clientY,insertIndex:m},e.currentTarget.style.cursor="grabbing";return}}if(e.button===0&&et(p,r.height)){const c=(v.current-s.current)/(b.current-s.current)*r.width;if(!(Math.abs(o-c)<=10)&&w(o,p,r.width,r.height)){Pt.current=performance.now();return}}if(e.button===0){if(at.current){P.current="slide",xt.current=e.clientX;return}const c=(v.current-s.current)/(b.current-s.current)*r.width,u=Math.abs(o-c)<=10,m=p>=r.height-E.TICK_AREA_HEIGHT;if(!u&&m)P.current="rangeSelectPending",Ft.current=o,Ct.current=s.current+o/r.width*(b.current-s.current),e.currentTarget.style.cursor="crosshair",W==null||W();else{P.current="scrub",Dt.current=e.clientX,e.currentTarget.style.cursor="grabbing",W==null||W();const f=s.current+o/r.width*(b.current-s.current);v.current=f,x(),Y(_.JulianDate.fromDate(new Date(f)))}}else if(e.button===1)P.current="slide",xt.current=e.clientX;else if(e.button===2){if(mt.current&&et(p,r.height))return;P.current="zoom",xt.current=e.clientX}},[x,Y,W,X,et,w]);n.useEffect(()=>{const e=o=>{const p=i.current;if(p&&p.dragging){p.currentY=o.clientY;const f=S.current;if(f){const y=f.getBoundingClientRect(),I=o.clientY-y.top;let _t=-H.current;const zt=D.current;let Zt=zt.length;for(let Jt=0;Jt<zt.length;Jt++){const Qt=zt[Jt].height??E.DEFAULT_LANE_HEIGHT,de=_t+Qt/2;if(I<de){Zt=Jt;break}_t+=Qt+E.LANE_GAP}p.insertIndex=Zt}x();return}if(P.current==="none")return;const c=S.current;if(!c)return;const u=c.getBoundingClientRect(),m=u.width;if(P.current==="scrub"){Dt.current=o.clientX;const f=o.clientX-u.left,y=m*.08;f<y?Tt(-1):f>m-y?Tt(1):h();const I=Math.max(0,Math.min(m,f)),ht=s.current+I/m*(b.current-s.current);v.current=ht,x(),Y(_.JulianDate.fromDate(new Date(ht)))}else if(P.current==="rangeSelectPending"||P.current==="rangeSelect"){const f=o.clientX-u.left,y=Math.abs(f-Ft.current);if(P.current==="rangeSelectPending"&&y>=3&&(P.current="rangeSelect"),P.current==="rangeSelect"){const I=Math.max(0,Math.min(m,f)),ht=s.current+I/m*(b.current-s.current);bt.current={startMs:Ct.current,endMs:ht},x()}}else if(P.current==="slide"){const f=xt.current-o.clientX;if(xt.current=o.clientX,f!==0){const y=f/m*(b.current-s.current);s.current+=y,b.current+=y,x()}}else if(P.current==="zoom"){const f=xt.current-o.clientX;xt.current=o.clientX,f!==0&&V(Math.pow(1.01,f))}},r=()=>{var p,c;const o=i.current;if(o&&o.dragging){const u=Math.abs(o.currentY-o.dragStartY),m=D.current,f=m.findIndex(y=>y.id===o.dragLaneId);if(u>5&&f>=0&&o.insertIndex!==f&&o.insertIndex!==f+1){const y=[...m],[I]=y.splice(f,1),ht=o.insertIndex>f?o.insertIndex-1:o.insertIndex;y.splice(ht,0,I),D.current=y,(p=A.current)==null||p.call(A,y.map(_t=>_t.id))}i.current=null,S.current&&(S.current.style.cursor="default"),x();return}if(h(),P.current==="rangeSelectPending"){v.current=Ct.current,bt.current=null,P.current="none",S.current&&(S.current.style.cursor="default"),x(),Y(_.JulianDate.fromDate(new Date(Ct.current))),O==null||O();return}if(P.current==="rangeSelect"){const u=bt.current;if(bt.current=null,u){const m=Math.min(u.startMs,u.endMs),f=Math.max(u.startMs,u.endMs);s.current=m,b.current=f;const y=Math.max(m,Math.min(f,v.current));y!==v.current&&(v.current=y,Y(_.JulianDate.fromDate(new Date(y))));const I=_.JulianDate.fromDate(new Date(m)),ht=_.JulianDate.fromDate(new Date(f));(c=B.current)==null||c.call(B,I,ht)}P.current="none",S.current&&(S.current.style.cursor="default"),x(),O==null||O();return}P.current="none",S.current&&(S.current.style.cursor="default"),O==null||O()};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",r),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",r)}},[x,Y,O,Tt,h]);const V=n.useCallback(e=>{const r=E.zoomRange(s.current,b.current,e);s.current=r.startMs,b.current=r.endMs,x()},[x]),Mt=n.useCallback(e=>{e.preventDefault();const r=S.current;if(!r)return;const o=r.getBoundingClientRect(),p=e.clientY-o.top,c=$.current,u=D.current;if(c&&u.length>0){const m=Math.max(0,o.height-E.TICK_AREA_HEIGHT);if(p>=0&&p<m){let f=0;for(const I of u)f+=(I.height??E.DEFAULT_LANE_HEIGHT)+E.LANE_GAP;const y=Math.max(0,f-m);if(y>0){H.current=Math.max(0,Math.min(y,H.current+e.deltaY*E.SWIM_LANE_SCROLL_SPEED)),x();return}}}V(Math.pow(1.05,e.deltaY>0===q.current?-1:1))},[V,x]);n.useEffect(()=>{const e=S.current;if(e)return e.addEventListener("wheel",Mt,{passive:!1}),()=>e.removeEventListener("wheel",Mt)},[Mt]),n.useEffect(()=>{const e=S.current;if(!e)return;const r=c=>{c.preventDefault();const u=e.getBoundingClientRect();if(c.touches.length===1){const m=c.touches[0].clientX-u.left,f=Math.max(0,Math.min(u.width,m)),y=s.current+f/u.width*(b.current-s.current);Lt.current=v.current,at.current?(lt.current="slide",yt.current=c.touches[0].clientX):(lt.current="scrub",yt.current=c.touches[0].clientX,Dt.current=c.touches[0].clientX,v.current=y,x(),W==null||W(),Y(_.JulianDate.fromDate(new Date(y))))}else c.touches.length>=2&&(lt.current==="scrub"&&(v.current=Lt.current,x(),Y(_.JulianDate.fromDate(new Date(Lt.current)))),lt.current="pinch",At.current=Xt(c.touches[0],c.touches[1]),kt.current=(c.touches[0].clientX+c.touches[1].clientX)/2-u.left)},o=c=>{c.preventDefault();const u=e.getBoundingClientRect();if(lt.current==="scrub"&&c.touches.length>=1){const m=c.touches[0].clientX-u.left,f=u.width*.08;if(Dt.current=c.touches[0].clientX,m<f)Tt(-1);else if(m>u.width-f)Tt(1);else{h();const y=Math.max(0,Math.min(u.width,m)),I=s.current+y/u.width*(b.current-s.current);v.current=I,x(),Y(_.JulianDate.fromDate(new Date(I)))}}else if(lt.current==="slide"&&c.touches.length>=1){const m=yt.current-c.touches[0].clientX;if(yt.current=c.touches[0].clientX,m!==0){const f=m/u.width*(b.current-s.current);s.current+=f,b.current+=f,x()}}else if(lt.current==="pinch"&&c.touches.length>=2){const m=Xt(c.touches[0],c.touches[1]),f=(c.touches[0].clientX+c.touches[1].clientX)/2-u.left;if(m>0&&At.current>0){const y=s.current+kt.current/u.width*(b.current-s.current),I=E.zoomAroundMs(s.current,b.current,At.current/m,y);s.current=I.startMs,b.current=I.endMs,x()}At.current=m,kt.current=f}},p=c=>{h(),lt.current==="scrub"&&(O==null||O()),c.touches.length===0?lt.current="none":c.touches.length===1&&(lt.current="slide",yt.current=c.touches[0].clientX)};return e.addEventListener("touchstart",r,{passive:!1}),e.addEventListener("touchmove",o,{passive:!1}),e.addEventListener("touchend",p,{passive:!1}),()=>{e.removeEventListener("touchstart",r),e.removeEventListener("touchmove",o),e.removeEventListener("touchend",p)}},[x,W,O,Y,V,Tt,h]);const ue=n.useCallback(e=>{var m,f,y;const r=e.currentTarget.getBoundingClientRect(),o=e.clientX-r.left,p=e.clientY-r.top;if(P.current==="none")if(at.current)vt.current!==null&&(vt.current=null);else{const I=s.current+Math.max(0,Math.min(r.width,o))/r.width*(b.current-s.current);vt.current!==I&&(vt.current=I)}if(P.current!=="none"){vt.current=null;return}const c=(v.current-s.current)/(b.current-s.current)*r.width,u=!at.current&&Math.abs(o-c)<=10;if(et(p,r.height)){const I=w(o,p,r.width,r.height),ht=t.current;if(I)e.currentTarget.style.cursor=u?"grab":"pointer",(!ht||ht.item.id!==I.item.id||ht.lane.id!==I.lane.id)&&(t.current=I,(m=g.current)==null||m.call(g,{laneId:I.lane.id,item:I.item,originalEvent:e.nativeEvent}));else if(ht&&(t.current=null,(f=g.current)==null||f.call(g,null)),u)e.currentTarget.style.cursor="grab";else{const _t=X(o,p,r.height);e.currentTarget.style.cursor=_t&&A.current?"grab":"default"}x();return}t.current&&(t.current=null,(y=g.current)==null||y.call(g,null)),u?e.currentTarget.style.cursor="grab":!at.current&&p>=r.height-E.TICK_AREA_HEIGHT?e.currentTarget.style.cursor="crosshair":e.currentTarget.style.cursor="default",x()},[x,w,et,X]),le=n.useCallback(e=>{var m;if(performance.now()-Pt.current>300)return;const o=e.currentTarget.getBoundingClientRect(),p=e.clientX-o.left,c=e.clientY-o.top,u=w(p,c,o.width,o.height);u&&((m=a.current)==null||m.call(a,{laneId:u.lane.id,item:u.item,originalEvent:e.nativeEvent}))},[w]),ie=n.useCallback(e=>{var u;const r=e.currentTarget.getBoundingClientRect(),o=e.clientX-r.left,p=e.clientY-r.top,c=w(o,p,r.width,r.height);c&&((u=ut.current)==null||u.call(ut,{laneId:c.lane.id,item:c.item,originalEvent:e.nativeEvent}))},[w]),fe=n.useCallback(e=>{const r=e.currentTarget.getBoundingClientRect(),o=e.clientX-r.left,p=e.clientY-r.top,c=w(o,p,r.width,r.height);c&&mt.current?(e.preventDefault(),mt.current({laneId:c.lane.id,item:c.item,originalEvent:e.nativeEvent})):e.preventDefault()},[w]);return n.useEffect(()=>()=>{tt.current!==null&&cancelAnimationFrame(tt.current),st.current!==null&&cancelAnimationFrame(st.current)},[]),l.jsx("canvas",{ref:S,style:{width:"100%",flex:1,minHeight:0,display:"block",cursor:"default"},onMouseDown:G,onMouseMove:ue,onClick:le,onDoubleClick:ie,onMouseLeave:()=>{var e;t.current&&(t.current=null,(e=g.current)==null||e.call(g,null)),vt.current=null,P.current==="none"&&S.current&&(S.current.style.cursor="default"),x()},onContextMenu:fe})});Nt.displayName="TimelineCanvas";const Kt=[2,4,8,16,32,100,1],Vt=[1,2,4,8,16,32,100],ce=({startTime:R,endTime:C,currentTime:F,clock:d,onTimeChange:j,onPlayPause:k,onMultiplierChange:J,height:N,showControls:pt=!0,showJumpToStart:z,showJumpToEnd:Y,enableDrag:W=!0,dateTimeFormat:O,onDateTimeClick:ct,jumpToTime:U,maxTicks:ft,ffSpeeds:Z=Kt,rwSpeeds:dt=Vt,theme:T,className:M,timezone:K,swimLanes:nt,showSwimLanes:Q,onShowSwimLanesChange:S,swimLaneTransition:L="animated",onSwimLaneItemClick:rt,onSwimLaneItemHover:gt,onSwimLaneItemDoubleClick:Et,onSwimLaneItemContextMenu:ot,onSwimLaneReorder:s,onRangeSelect:b,labels:v,liveButtonSize:at,liveButtonPosition:q,live:D,invertScrollZoom:$})=>{const H=()=>Date.now(),t=R?_.JulianDate.toDate(E.toJulianDate(R)).getTime():H()-432e5,i=C?_.JulianDate.toDate(E.toJulianDate(C)).getTime():H()+12*3600*1e3,[a,g]=n.useState(()=>E.toJulianDate(F??R??_.JulianDate.fromDate(new Date))),[ut,mt]=n.useState((d==null?void 0:d.shouldAnimate)??!1),[A,tt]=n.useState((d==null?void 0:d.multiplier)??1),[st,wt]=n.useState(Q??!0);n.useEffect(()=>{Q!=null&&wt(Q)},[Q]);const Ot=()=>{const h=!st;wt(h),S==null||S(h)},P=nt!=null&&nt.length>0,xt=n.useRef(null),[Dt,Pt]=n.useState(0);n.useEffect(()=>{const h=xt.current;if(!h)return;const w=new ResizeObserver(([X])=>Pt(X.borderBoxSize[0].blockSize));return w.observe(h),()=>w.disconnect()},[pt]);const Ft=P&&!st?`${Dt+E.TICK_AREA_HEIGHT}px`:N!=null?`${N}px`:"100%",bt=n.useRef(!1),B=n.useRef(null),vt={...E.defaultTheme,...T};n.useEffect(()=>{if(!d)return;const h=()=>{if(!bt.current){const w=_.JulianDate.clone(d.currentTime);if(g(w),mt(d.shouldAnimate),tt(d.multiplier),B.current){const{startMs:X,endMs:et}=B.current.getVisibleRange(),G=et-X,V=_.JulianDate.toDate(w).getTime(),Mt=V-X;Mt<=G*.1?B.current.zoomTo(V-G*.1,V+G*.9,V):Mt>=G*.9&&B.current.zoomTo(V-G*.9,V+G*.1,V)}}};return d.onTick.addEventListener(h),()=>{d.onTick.removeEventListener(h)}},[d]),n.useEffect(()=>{if(d)return;const h=setInterval(()=>{if(bt.current)return;const w=_.JulianDate.fromDate(new Date);if(g(w),B.current){const{startMs:X,endMs:et}=B.current.getVisibleRange(),G=et-X,V=_.JulianDate.toDate(w).getTime(),Mt=V-X;Mt<=G*.1?B.current.zoomTo(V-G*.1,V+G*.9,V):Mt>=G*.9&&B.current.zoomTo(V-G*.9,V+G*.1,V)}},1e3);return()=>clearInterval(h)},[d]),n.useEffect(()=>{if(!U||D)return;const h=E.toJulianDate(U);if(yt(h),B.current){const{startMs:w,endMs:X}=B.current.getVisibleRange(),et=X-w,G=_.JulianDate.toDate(h).getTime();B.current.zoomTo(G-et/2,G+et/2)}},[U]);const lt=(h,w=!0)=>{d&&(d.multiplier=h,w&&(d.shouldAnimate=!0)),tt(h),w&&mt(!0),J==null||J(h)},yt=h=>{g(h),d&&(d.currentTime=_.JulianDate.clone(h)),j==null||j(h)},At=h=>{h&&A<0&<(1,!1),d&&(d.shouldAnimate=h),mt(h),k==null||k(h)},kt=()=>{const h=Z.length>0?Z:Kt,w=A>1?A:1,X=h.indexOf(w),et=h[X<0||X===h.length-1?0:X+1];lt(et)},Lt=()=>{const h=dt.length>0?dt:Vt,w=A<0?Math.abs(A):0,X=h.indexOf(w),et=-h[X<0||X===h.length-1?0:X+1];lt(et)},Xt=()=>{var w;const h=E.toJulianDate(R??_.JulianDate.fromDate(new Date(t)));d&&(d.currentTime=_.JulianDate.clone(h)),g(h),(w=B.current)==null||w.zoomTo(t,i)},Rt=()=>{var w;const h=E.toJulianDate(C??_.JulianDate.fromDate(new Date(i)));d&&(d.currentTime=_.JulianDate.clone(h)),g(h),(w=B.current)==null||w.zoomTo(t,i)},x=()=>{const h=_.JulianDate.fromDate(new Date);d&&(d.currentTime=_.JulianDate.clone(h)),g(h),lt(1);const w=Date.now();if(B.current){const{startMs:X,endMs:et}=B.current.getVisibleRange(),G=et-X;B.current.zoomTo(w-G/2,w+G/2)}},Tt=Math.abs(_.JulianDate.toDate(a).getTime()-Date.now())<2e3;return l.jsxs("div",{className:M,style:{width:"100%",height:Ft,overflow:"hidden",display:"flex",flexDirection:"column",fontFamily:"system-ui, -apple-system, sans-serif",transition:L==="animated"?"height 0.2s ease":void 0},children:[pt&&l.jsx("div",{ref:xt,children:l.jsx(Ut,{currentTime:a,isPlaying:ut,multiplier:A,isLive:Tt,hasStartTime:R!=null,hasEndTime:C!=null,showJumpToStart:z,showJumpToEnd:Y,onPlayPause:At,onJumpToStart:Xt,onRewind:Lt,onFastForward:kt,onJumpToEnd:Rt,onJumpToLive:x,onResetSpeed:()=>lt(1),onDateTimeClick:ct,dateTimeFormat:O,timezone:K,theme:vt,swimLanesVisible:P?st:void 0,onToggleSwimLanes:P?Ot:void 0,labels:v,liveButtonSize:at,liveButtonPosition:q,live:D})}),(W!==!1||D)&&l.jsx(Nt,{ref:B,currentTime:a,defaultStartMs:t,defaultEndMs:i,theme:vt,maxTicks:ft,timezone:K,dateTimeFormat:O,months:v==null?void 0:v.months,onTimeChange:yt,onDragStart:()=>{bt.current=!0},onDragEnd:()=>{bt.current=!1},disableNeedleDrag:!!D,invertScrollZoom:$,swimLanes:nt,showSwimLanes:st,onSwimLaneItemClick:rt,onSwimLaneItemHover:gt,onSwimLaneItemDoubleClick:Et,onSwimLaneItemContextMenu:ot,onSwimLaneReorder:s,onRangeSelect:b})]})},ae=({startTime:R,endTime:C,currentTime:F,width:d,height:j,tickInterval:k,showLabels:J,snapToTicks:N,enableDrag:pt,theme:z,onTimeChange:Y,onVisibleRangeChange:W,onDragStart:O,onDragEnd:ct})=>{const U=n.useMemo(()=>E.generateTicks(R,C,k,d),[R,C,k,d]),ft=n.useMemo(()=>E.timeToPosition(F,R,C,d),[F,R,C,d]),Z=n.useRef(null),dt=M=>{if(!pt)return;const K=M.currentTarget.getBoundingClientRect(),nt=M.clientX-K.left,Q=Math.max(0,Math.min(d,nt));if(!(Math.abs(Q-ft)<=10)){let q=Q;N&&(q=E.snapToTick(Q,U,10));const D=new Date(R).getTime(),$=new Date(C).getTime();Y(_.JulianDate.fromDate(new Date(D+q/d*($-D))));return}O==null||O();const L=M.clientX,rt=new Date(F).getTime(),gt=new Date(R).getTime(),ot=(new Date(C).getTime()-gt)/d;let s=0,b=!1;const v=q=>{s=q.clientX-L,b=!0,Z.current||(Z.current=requestAnimationFrame(()=>{if(b){const D=rt+s*ot;Y(_.JulianDate.fromDate(new Date(D))),b=!1}Z.current=null}))},at=()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",at),Z.current!==null&&(cancelAnimationFrame(Z.current),Z.current=null),ct==null||ct()};document.addEventListener("mousemove",v),document.addEventListener("mouseup",at)},T=M=>{M.preventDefault();const K=M.shiftKey?M.deltaY:M.deltaX!==0?M.deltaX:M.deltaY;if(Math.abs(K)<1)return;const nt=new Date(R).getTime(),Q=new Date(C).getTime(),S=K/d*(Q-nt)*.5;W==null||W(_.JulianDate.fromDate(new Date(nt+S)),_.JulianDate.fromDate(new Date(Q+S)))};return l.jsxs("svg",{width:"100%",height:j,style:{backgroundColor:z.backgroundColor,display:"block",cursor:"default"},onMouseDown:dt,onWheel:T,children:[l.jsx("rect",{width:d,height:j,fill:z.backgroundColor}),U.map((M,K)=>l.jsxs("g",{children:[l.jsx("line",{x1:M.position,y1:j-(M.isMajor?z.majorTickHeight:z.minorTickHeight),x2:M.position,y2:j,stroke:M.isMajor?z.majorTickColor:z.tickColor,strokeWidth:"1"}),J&&M.isMajor&&M.label&&l.jsx("text",{x:M.position,y:j-z.majorTickHeight-5,textAnchor:"middle",fill:z.labelColor,fontSize:z.fontSize,fontFamily:"monospace",children:M.label})]},K)),l.jsx("line",{x1:ft,y1:0,x2:ft,y2:j,stroke:z.indicatorColor,strokeWidth:z.indicatorLineWidth,pointerEvents:"none"}),pt&&l.jsx("rect",{x:Math.max(0,ft-10),y:0,width:20,height:j,fill:"transparent",style:{cursor:"ew-resize"},pointerEvents:"visiblePainted"}),l.jsx("circle",{cx:ft,cy:5,r:4,fill:z.indicatorColor,pointerEvents:"none"})]})};Object.defineProperty(it,"TICK_AREA_HEIGHT",{enumerable:!0,get:()=>E.TICK_AREA_HEIGHT}),it.Timeline=ce,it.TimelineCanvas=Nt,it.TimelineControls=Ut,it.TimelineSVG=ae,Object.keys(E).forEach(R=>{R!=="default"&&!Object.prototype.hasOwnProperty.call(it,R)&&Object.defineProperty(it,R,{enumerable:!0,get:()=>E[R]})}),Object.defineProperty(it,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
CHANGED
|
@@ -33,6 +33,12 @@ export declare interface ControlsProps {
|
|
|
33
33
|
onToggleSwimLanes?: () => void;
|
|
34
34
|
/** Overrides for control-bar labels and tooltips (i18n / custom verbiage). */
|
|
35
35
|
labels?: Partial<TimelineLabels>;
|
|
36
|
+
/** @see TimelineBaseProps.liveButtonSize */
|
|
37
|
+
liveButtonSize?: 'sm' | 'md' | 'lg';
|
|
38
|
+
/** @see TimelineBaseProps.liveButtonPosition */
|
|
39
|
+
liveButtonPosition?: 'left' | 'right';
|
|
40
|
+
/** @see TimelineBaseProps.live */
|
|
41
|
+
live?: boolean;
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
export { TICK_AREA_HEIGHT }
|
|
@@ -79,6 +85,11 @@ declare interface TimelineCanvasProps {
|
|
|
79
85
|
onTimeChange: (time: Cesium.JulianDate) => void;
|
|
80
86
|
onDragStart?: () => void;
|
|
81
87
|
onDragEnd?: () => void;
|
|
88
|
+
/** When true, needle scrub is disabled (left-click becomes pan). Zoom and pan remain active. */
|
|
89
|
+
disableNeedleDrag?: boolean;
|
|
90
|
+
/** @see TimelineBaseProps.invertScrollZoom */
|
|
91
|
+
invertScrollZoom?: boolean;
|
|
92
|
+
onRangeSelect?: (start: Cesium.JulianDate, end: Cesium.JulianDate) => void;
|
|
82
93
|
swimLanes?: SwimLane[];
|
|
83
94
|
showSwimLanes?: boolean;
|
|
84
95
|
onSwimLaneItemClick?: (info: SwimLaneEventInfo) => void;
|
|
@@ -122,12 +133,21 @@ export declare interface TimelineProps {
|
|
|
122
133
|
onSwimLaneItemDoubleClick?: (info: SwimLaneEventInfo) => void;
|
|
123
134
|
onSwimLaneItemContextMenu?: (info: SwimLaneEventInfo) => void;
|
|
124
135
|
onSwimLaneReorder?: (orderedLaneIds: string[]) => void;
|
|
136
|
+
onRangeSelect?: (start: Cesium.JulianDate, end: Cesium.JulianDate) => void;
|
|
125
137
|
/**
|
|
126
138
|
* Overrides for control-bar labels and tooltips.
|
|
127
139
|
* Useful for localisation or custom verbiage — provide only the strings you
|
|
128
140
|
* want to change; everything else falls back to the English defaults.
|
|
129
141
|
*/
|
|
130
142
|
labels?: Partial<TimelineLabels>;
|
|
143
|
+
/** @see TimelineBaseProps.liveButtonSize */
|
|
144
|
+
liveButtonSize?: 'sm' | 'md' | 'lg';
|
|
145
|
+
/** @see TimelineBaseProps.liveButtonPosition */
|
|
146
|
+
liveButtonPosition?: 'left' | 'right';
|
|
147
|
+
/** @see TimelineBaseProps.live */
|
|
148
|
+
live?: boolean;
|
|
149
|
+
/** @see TimelineBaseProps.invertScrollZoom */
|
|
150
|
+
invertScrollZoom?: boolean;
|
|
131
151
|
}
|
|
132
152
|
|
|
133
153
|
export declare const TimelineSVG: default_2.FC<TimelineSVGProps>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kteneyck/cesium-timeline-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "React timeline component for Cesium with clock integration",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "kteneyck",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@types/react-dom": ">=18"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@kteneyck/cesium-timeline-core": "0.
|
|
55
|
+
"@kteneyck/cesium-timeline-core": "0.10.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@testing-library/jest-dom": "^6.0.0",
|