@kteneyck/cesium-timeline-react 0.5.0 → 0.6.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 +86 -0
- package/dist/cesium-timeline-react.js +705 -699
- package/dist/cesium-timeline-react.umd.cjs +4 -4
- package/dist/index.d.ts +9 -0
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(q,
|
|
1
|
+
(function(q,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react"),require("cesium"),require("@kteneyck/cesium-timeline-core")):typeof define=="function"&&define.amd?define(["exports","react","cesium","@kteneyck/cesium-timeline-core"],o):(q=typeof globalThis<"u"?globalThis:q||self,o(q.CesiumTimelineReact={},q.React,q.Cesium,q.CesiumTimelineCore))})(this,(function(q,o,Xt,R){"use strict";function Yt(g){const _=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(g){for(const O in g)if(O!=="default"){const i=Object.getOwnPropertyDescriptor(g,O);Object.defineProperty(_,O,i.get?i:{enumerable:!0,get:()=>g[O]})}}return _.default=g,Object.freeze(_)}const C=Yt(Xt);var Et={exports:{}},xt={};/**
|
|
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 St;function zt(){if(St)return xt;St=1;var g=Symbol.for("react.transitional.element"),_=Symbol.for("react.fragment");function O(i,D,A){var F=null;if(A!==void 0&&(F=""+A),D.key!==void 0&&(F=""+D.key),"key"in D){A={};for(var J in D)J!=="key"&&(A[J]=D[J])}else A=D;return D=A.ref,{$$typeof:g,type:i,key:F,ref:D!==void 0?D:null,props:A}}return xt.Fragment=_,xt.jsx=O,xt.jsxs=O,xt}var vt={};/**
|
|
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 Ct;function Wt(){return Ct||(Ct=1,process.env.NODE_ENV!=="production"&&(function(){function g(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ot?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case B:return"Fragment";case h:return"Profiler";case et:return"StrictMode";case f:return"Suspense";case E:return"SuspenseList";case y:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case tt:return"Portal";case H:return e.displayName||"Context";case b:return(e._context.displayName||"Context")+".Consumer";case Q:var d=e.render;return e=e.displayName,e||(e=d.displayName||d.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case N:return d=e.displayName||null,d!==null?d:g(e.type)||"Memo";case M:d=e._payload,e=e._init;try{return g(e(d))}catch{}}return null}function _(e){return""+e}function O(e){try{_(e);var d=!1}catch{d=!0}if(d){d=console;var v=d.error,T=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return v.call(d,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",T),_(e)}}function i(e){if(e===B)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===M)return"<...>";try{var d=g(e);return d?"<"+d+">":"<...>"}catch{return"<...>"}}function D(){var e=Y.A;return e===null?null:e.getOwner()}function A(){return Error("react-stack-top-frame")}function F(e){if(nt.call(e,"key")){var d=Object.getOwnPropertyDescriptor(e,"key").get;if(d&&d.isReactWarning)return!1}return e.key!==void 0}function J(e,d){function v(){I||(I=!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)",d))}v.isReactWarning=!0,Object.defineProperty(e,"key",{get:v,configurable:!0})}function z(){var e=g(this.type);return L[e]||(L[e]=!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.")),e=this.props.ref,e!==void 0?e:null}function k(e,d,v,T,ct,pt){var w=v.ref;return e={$$typeof:$,type:e,key:d,props:v,_owner:T},(w!==void 0?w:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:z}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ct}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:pt}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function G(e,d,v,T,ct,pt){var w=d.children;if(w!==void 0)if(T)if(U(w)){for(T=0;T<w.length;T++)W(w[T]);Object.freeze&&Object.freeze(w)}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(w);if(nt.call(d,"key")){w=g(e);var st=Object.keys(d).filter(function(gt){return gt!=="key"});T=0<st.length?"{key: someKey, "+st.join(": ..., ")+": ...}":"{key: someKey}",K[w+T]||(st=0<st.length?"{"+st.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} />`,D,M,at,M),ot[M+D]=!0)}if(M=null,b!==void 0&&(O(b),M=""+b),P(h)&&(O(h.key),M=""+h.key),"key"in h){b={};for(var it in h)it!=="key"&&(b[it]=h[it])}else b=h;return M&&J(b,typeof e=="function"?e.displayName||e.name||"Unknown":e),C(e,M,b,T(),lt,ut)}function B(e){st(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===S&&(e._payload.status==="fulfilled"?st(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function st(e){return typeof e=="object"&&e!==null&&e.$$typeof===$}var Z=r,$=Symbol.for("react.transitional.element"),tt=Symbol.for("react.portal"),H=Symbol.for("react.fragment"),et=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),U=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),nt=Symbol.for("react.activity"),ct=Symbol.for("react.client.reference"),N=Z.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=Object.prototype.hasOwnProperty,X=Array.isArray,R=console.createTask?console.createTask:function(){return null};Z={react_stack_bottom_frame:function(e){return e()}};var l,I={},L=Z.react_stack_bottom_frame.bind(Z,j)(),rt=R(u(j)),ot={};vt.Fragment=H,vt.jsx=function(e,h,b){var D=1e4>N.recentlyCreatedOwnerStacks++;return G(e,h,b,!1,D?Error("react-stack-top-frame"):L,D?R(u(e)):rt)},vt.jsxs=function(e,h,b){var D=1e4>N.recentlyCreatedOwnerStacks++;return G(e,h,b,!0,D?Error("react-stack-top-frame"):L,D?R(u(e)):rt)}})()),vt}var St;function Bt(){return St||(St=1,process.env.NODE_ENV==="production"?Rt.exports=zt():Rt.exports=Wt()),Rt.exports}var a=Bt();const Ht=520,Ut=()=>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"})]}),Lt=()=>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"})}),Ot=()=>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"})}),It=({currentTime:v,isPlaying:_,multiplier:O,dateTimeFormat:u,timezone:T,isLive:j,hasStartTime:P,hasEndTime:J,showJumpToStart:W=!0,showJumpToEnd:C=!0,onPlayPause:G,onJumpToStart:B,onRewind:st,onFastForward:Z,onJumpToEnd:$,onJumpToLive:tt,onResetSpeed:H,onDateTimeClick:et,theme:d,swimLanesVisible:E,onToggleSwimLanes:U})=>{const z=O<0,f=O>1,w=O===1,k=Math.abs(O),S=r.useRef(null),[nt,ct]=r.useState(!1);r.useEffect(()=>{const l=S.current;if(!l)return;const I=new ResizeObserver(([L])=>{ct(L.contentRect.width<Ht)});return I.observe(l),()=>I.disconnect()},[]);const N={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},V=l=>({...N,color:l?d.buttonActiveColor:d.buttonColor,borderColor:l?`${d.buttonActiveColor}33`:"transparent"}),X=(l,I)=>{l.currentTarget.style.backgroundColor=I?`${d.buttonActiveColor}22`:d.buttonHoverColor+"44"},R=l=>{l.currentTarget.style.backgroundColor="transparent"};return a.jsxs("div",{ref:S,style:{display:nt?"flex":"grid",gridTemplateColumns:nt?void 0:"1fr auto 1fr",alignItems:"center",padding:"6px 16px",backgroundColor:d.controlBarBackground,borderBottom:`1px solid ${d.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:et,title:et?"Click to jump to a date/time":void 0,style:{color:d.labelColor,fontFamily:"monospace",lineHeight:1.15,cursor:et?"pointer":"default",borderRadius:"4px",padding:"2px 4px",transition:"background 0.15s"},onMouseEnter:l=>{et&&(l.currentTarget.style.background=d.buttonHoverColor+"44")},onMouseLeave:l=>l.currentTarget.style.background="transparent",children:(()=>{const{timeFormat:l,dateFormat:I}=y.splitForDisplay(u),L=y.getTimezoneAbbr(v,T);return a.jsxs(a.Fragment,{children:[l&&a.jsx("div",{style:{fontSize:"2em",fontWeight:"bold",letterSpacing:"0.02em"},children:y.formatDateTime(v,l,T)}),I&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[a.jsx("span",{style:{fontSize:"1.15em",letterSpacing:"0.03em",color:d.buttonActiveColor},children:y.formatDateTime(v,I,T)}),L&&a.jsx("span",{style:{fontSize:"0.9em",color:d.labelColor,opacity:.7,fontWeight:"bold",letterSpacing:"0.04em"},children:L})]})]})})()}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px",justifyContent:"center"},children:[a.jsx("button",{onClick:tt,style:{...N,fontSize:"11px",fontWeight:"bold",letterSpacing:"0.05em",width:"52px",minWidth:"52px",height:"20px",borderRadius:"3px",color:j?d.controlBarBackground:d.buttonActiveColor,backgroundColor:j?d.buttonActiveColor:"transparent",borderColor:d.buttonActiveColor,opacity:j?1:.55},onMouseEnter:l=>{l.currentTarget.style.opacity="1"},onMouseLeave:l=>{l.currentTarget.style.opacity=j?"1":"0.55"},title:j?"Currently live":"Jump to live (now)",children:j?"● LIVE":"LIVE"}),a.jsx("div",{style:{height:"20px",display:"flex",alignItems:"center"},children:!w&&a.jsx("button",{onClick:()=>H(),style:{...N,fontSize:"11px",color:d.buttonActiveColor,borderColor:`${d.buttonActiveColor}44`,width:"52px",minWidth:"52px",height:"20px"},onMouseEnter:l=>X(l,!0),onMouseLeave:R,title:"Reset to 1× speed",children:z?`◀ ${k}×`:`${k}× ▶`})})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",...nt?{flex:1,justifyContent:"center"}:{}},children:[W&&a.jsx("button",{onClick:P?B:void 0,disabled:!P,style:{...V(!1),opacity:P?1:.3,cursor:P?"pointer":"default"},onMouseEnter:P?l=>X(l,!1):void 0,onMouseLeave:P?R:void 0,title:P?"Jump to start":"No start time set",children:"⏮"}),a.jsx("button",{onClick:st,style:{...V(z),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:l=>X(l,z),onMouseLeave:R,title:z?`Reverse ${k}× — click to speed up, press play to stop`:"Rewind",children:z?a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[k,"×"]}),"◀◀"]}):"◀◀"}),a.jsx("button",{onClick:()=>G(!_),style:{...N,color:d.buttonActiveColor,fontSize:"18px",width:"40px",minWidth:"40px",height:"40px",borderColor:`${d.buttonActiveColor}55`,borderRadius:"50%",paddingLeft:_?"0":"2px"},onMouseEnter:l=>X(l,!0),onMouseLeave:R,title:_?"Pause":z?"Play (reset to 1×)":"Play",children:_?a.jsx(Ut,{}):"▶"}),a.jsx("button",{onClick:Z,style:{...V(f),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:l=>X(l,f),onMouseLeave:R,title:f?`${k}× speed — click to increase, click again at max to reset`:"Fast forward",children:f?a.jsxs(a.Fragment,{children:["▶▶",a.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[k,"×"]})]}):"▶▶"}),C&&a.jsx("button",{onClick:J?$:void 0,disabled:!J,style:{...V(!1),opacity:J?1:.3,cursor:J?"pointer":"default"},onMouseEnter:J?l=>X(l,!1):void 0,onMouseLeave:J?R:void 0,title:J?"Jump to end":"No end time set",children:"⏭"})]}),!nt&&a.jsx("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:U!=null&&E!=null&&a.jsx("button",{onClick:U,style:{...N,color:d.buttonActiveColor,borderColor:`${d.buttonActiveColor}33`},onMouseEnter:l=>X(l,E),onMouseLeave:R,title:E?"Collapse swim lanes":"Expand swim lanes",children:E?a.jsx(Lt,{}):a.jsx(Ot,{})})}),nt&&U!=null&&E!=null&&a.jsx("button",{onClick:U,style:{...N,color:d.buttonActiveColor,borderColor:`${d.buttonActiveColor}33`,marginLeft:"4px"},onMouseEnter:l=>X(l,E),onMouseLeave:R,title:E?"Collapse swim lanes":"Expand swim lanes",children:E?a.jsx(Lt,{}):a.jsx(Ot,{})})]})},Mt=r.forwardRef((v,_)=>{const{currentTime:O,defaultStartMs:u,defaultEndMs:T,theme:j,maxTicks:P,timezone:J,onTimeChange:W,onDragStart:C,onDragEnd:G,swimLanes:B,showSwimLanes:st,onSwimLaneItemClick:Z,onSwimLaneItemHover:$,onSwimLaneItemDoubleClick:tt,onSwimLaneItemContextMenu:H,onSwimLaneReorder:et}=v,d=r.useRef(null),E=r.useRef(j),U=r.useRef(P),z=r.useRef(J),f=r.useRef(u),w=r.useRef(T),k=r.useRef(A.JulianDate.toDate(O).getTime());r.useEffect(()=>{E.current=j},[j]),r.useEffect(()=>{U.current=P},[P]),r.useEffect(()=>{z.current=J,m()},[J]);const S=r.useRef(B??[]),nt=r.useRef(st??(B!=null&&B.length>0)),ct=r.useRef(0),N=r.useRef(null),V=r.useRef(null),X=r.useRef(Z),R=r.useRef($),l=r.useRef(tt),I=r.useRef(H),L=r.useRef(et);r.useEffect(()=>{X.current=Z},[Z]),r.useEffect(()=>{R.current=$},[$]),r.useEffect(()=>{l.current=tt},[tt]),r.useEffect(()=>{I.current=H},[H]),r.useEffect(()=>{L.current=et},[et]),r.useEffect(()=>{S.current=B??[],m()},[B]),r.useEffect(()=>{nt.current=st??(B!=null&&B.length>0),m()},[st,B]);const rt=r.useRef(null),ot=r.useRef(null),e=r.useRef(!1),h=r.useRef(0),b=r.useRef("none"),D=r.useRef(0),lt=r.useRef(0),ut=r.useRef(0),M=r.useRef("none"),at=r.useRef(0),it=r.useRef(0),bt=(t,n)=>Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY),ft=r.useCallback(()=>({startMs:f.current,endMs:w.current,currentMs:k.current,theme:E.current,maxTicks:U.current,timezone:z.current,swimLanes:S.current,showSwimLanes:nt.current,scrollTop:ct.current,reorderState:V.current}),[]);r.useImperativeHandle(_,()=>({zoomTo(t,n,s){const c=Math.max(y.MIN_SPAN_MS,Math.min(y.MAX_SPAN_MS,n-t)),o=(t+n)/2;f.current=o-c/2,w.current=o+c/2,s!==void 0&&(k.current=s),m()},getVisibleRange(){return{startMs:f.current,endMs:w.current}},startFollow(t){if(h.current=t,ot.current!==null)return;e.current=!0;let n=performance.now();const s=()=>{const c=performance.now(),o=c-n;n=c;const i=o*h.current;f.current+=i,w.current+=i,k.current+=i,m(),ot.current=requestAnimationFrame(s)};ot.current=requestAnimationFrame(s)},stopFollow(){e.current=!1,ot.current!==null&&(cancelAnimationFrame(ot.current),ot.current=null)},correctFollow(t){if(!e.current)return;const n=t-k.current;k.current=t,f.current+=n,w.current+=n},appendSwimLane(t){S.current=[...S.current,t],m()},updateSwimLane(t,n){S.current=S.current.map(s=>s.id===t?{...s,...n,id:s.id}:s),m()},removeSwimLane(t){S.current=S.current.filter(n=>n.id!==t),m()},reorderSwimLanes(t){const n=new Map(S.current.map(c=>[c.id,c])),s=[];for(const c of t){const o=n.get(c);o&&s.push(o)}S.current=s,m()}}));const m=r.useCallback(()=>{const t=d.current;if(!t)return;const n=t.getContext("2d");if(!n)return;const s=t.getBoundingClientRect(),c=s.width,o=s.height;if(c===0||o===0)return;const i=window.devicePixelRatio||1,g=Math.round(c*i),x=Math.round(o*i);(t.width!==g||t.height!==x)&&(t.width=g,t.height=x),n.save(),n.scale(i,i);const F=y.drawTimeline(n,c,o,ft());F!==ct.current&&(ct.current=F),n.restore()},[ft]);r.useLayoutEffect(()=>{m();const t=d.current;if(!t)return;const n=new ResizeObserver(()=>m());return n.observe(t),()=>n.disconnect()},[m]),r.useEffect(()=>{if(e.current)return;const t=A.JulianDate.toDate(O).getTime();k.current!==t&&(k.current=t,m())},[O,m]);const Y=r.useCallback(t=>{if(rt.current!==null)return;const n=()=>{const s=d.current,c=w.current-f.current,o=t*c*.01;if(f.current+=o,w.current+=o,s){const i=s.getBoundingClientRect(),g=Math.max(0,Math.min(i.width,lt.current-i.left)),x=f.current+g/i.width*(w.current-f.current);k.current=x,W(A.JulianDate.fromDate(new Date(x)))}m(),rt.current=requestAnimationFrame(n)};rt.current=requestAnimationFrame(n)},[m,W]),pt=r.useCallback(()=>{rt.current!==null&&(cancelAnimationFrame(rt.current),rt.current=null)},[]),Q=r.useCallback((t,n,s,c)=>y.hitTestSwimLane(t,n,s,c,ft()),[ft]),ht=r.useCallback((t,n,s)=>y.hitTestLaneLabel(t,n,s,ft()),[ft]),mt=r.useCallback((t,n)=>y.isInSwimLaneRegion(t,n,ft()),[ft]),Tt=r.useCallback(t=>{t.preventDefault();const n=t.currentTarget.getBoundingClientRect(),s=t.clientX-n.left,c=t.clientY-n.top;if(t.button===0&&L.current){const o=ht(s,c,n.height);if(o){const g=S.current.findIndex(x=>x.id===o.id);V.current={dragging:!0,dragLaneId:o.id,dragStartY:t.clientY,currentY:t.clientY,insertIndex:g},t.currentTarget.style.cursor="grabbing";return}}if(t.button===0&&mt(c,n.height)){const o=(k.current-f.current)/(w.current-f.current)*n.width;if(!(Math.abs(s-o)<=10)&&Q(s,c,n.width,n.height)){ut.current=performance.now();return}}if(t.button===0){b.current="scrub",lt.current=t.clientX,t.currentTarget.style.cursor="grabbing",C==null||C();const o=f.current+s/n.width*(w.current-f.current);k.current=o,m(),W(A.JulianDate.fromDate(new Date(o)))}else if(t.button===1)b.current="slide",D.current=t.clientX;else if(t.button===2){if(I.current&&mt(c,n.height))return;b.current="zoom",D.current=t.clientX}},[m,W,C,ht,mt,Q]);r.useEffect(()=>{const t=s=>{const c=V.current;if(c&&c.dragging){c.currentY=s.clientY;const x=d.current;if(x){const F=x.getBoundingClientRect(),K=s.clientY-F.top;let wt=-ct.current;const At=S.current;let Jt=At.length;for(let yt=0;yt<At.length;yt++){const Nt=At[yt].height??y.DEFAULT_LANE_HEIGHT,Kt=wt+Nt/2;if(K<Kt){Jt=yt;break}wt+=Nt+y.LANE_GAP}c.insertIndex=Jt}m();return}if(b.current==="none")return;const o=d.current;if(!o)return;const i=o.getBoundingClientRect(),g=i.width;if(b.current==="scrub"){lt.current=s.clientX;const x=s.clientX-i.left,F=g*.08;x<F?Y(-1):x>g-F?Y(1):pt();const K=Math.max(0,Math.min(g,x)),dt=f.current+K/g*(w.current-f.current);k.current=dt,m(),W(A.JulianDate.fromDate(new Date(dt)))}else if(b.current==="slide"){const x=D.current-s.clientX;if(D.current=s.clientX,x!==0){const F=x/g*(w.current-f.current);f.current+=F,w.current+=F,m()}}else if(b.current==="zoom"){const x=D.current-s.clientX;D.current=s.clientX,x!==0&>(Math.pow(1.01,x))}},n=()=>{var c;const s=V.current;if(s&&s.dragging){const o=Math.abs(s.currentY-s.dragStartY),i=S.current,g=i.findIndex(x=>x.id===s.dragLaneId);if(o>5&&g>=0&&s.insertIndex!==g&&s.insertIndex!==g+1){const x=[...i],[F]=x.splice(g,1),K=s.insertIndex>g?s.insertIndex-1:s.insertIndex;x.splice(K,0,F),S.current=x,(c=L.current)==null||c.call(L,x.map(dt=>dt.id))}V.current=null,d.current&&(d.current.style.cursor="default"),m();return}pt(),b.current="none",d.current&&(d.current.style.cursor="default"),G==null||G()};return document.addEventListener("mousemove",t),document.addEventListener("mouseup",n),()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)}},[m,W,G,Y,pt]);const gt=r.useCallback(t=>{const n=y.zoomRange(f.current,w.current,t);f.current=n.startMs,w.current=n.endMs,m()},[m]),Et=r.useCallback(t=>{t.preventDefault();const n=d.current;if(!n)return;const s=n.getBoundingClientRect(),c=t.clientY-s.top,o=nt.current,i=S.current;if(o&&i.length>0){const g=Math.max(0,s.height-y.TICK_AREA_HEIGHT);if(c>=0&&c<g){let x=0;for(const K of i)x+=(K.height??y.DEFAULT_LANE_HEIGHT)+y.LANE_GAP;const F=Math.max(0,x-g);if(F>0){ct.current=Math.max(0,Math.min(F,ct.current+t.deltaY*y.SWIM_LANE_SCROLL_SPEED)),m();return}}}gt(Math.pow(1.05,t.deltaY>0?-1:1))},[gt,m]);r.useEffect(()=>{const t=d.current;if(t)return t.addEventListener("wheel",Et,{passive:!1}),()=>t.removeEventListener("wheel",Et)},[Et]),r.useEffect(()=>{const t=d.current;if(!t)return;const n=o=>{o.preventDefault();const i=t.getBoundingClientRect();if(o.touches.length===1){const g=o.touches[0].clientX-i.left,x=Math.max(0,Math.min(i.width,g)),F=f.current+x/i.width*(w.current-f.current);M.current="scrub",at.current=o.touches[0].clientX,lt.current=o.touches[0].clientX,k.current=F,m(),C==null||C(),W(A.JulianDate.fromDate(new Date(F)))}else o.touches.length>=2&&(M.current="pinch",it.current=bt(o.touches[0],o.touches[1]))},s=o=>{o.preventDefault();const i=t.getBoundingClientRect();if(M.current==="scrub"&&o.touches.length>=1){const g=o.touches[0].clientX-i.left,x=i.width*.08;if(lt.current=o.touches[0].clientX,g<x)Y(-1);else if(g>i.width-x)Y(1);else{pt();const F=Math.max(0,Math.min(i.width,g)),K=f.current+F/i.width*(w.current-f.current);k.current=K,m(),W(A.JulianDate.fromDate(new Date(K)))}}else if(M.current==="slide"&&o.touches.length>=1){const g=at.current-o.touches[0].clientX;if(at.current=o.touches[0].clientX,g!==0){const x=g/i.width*(w.current-f.current);f.current+=x,w.current+=x,m()}}else if(M.current==="pinch"&&o.touches.length>=2){const g=bt(o.touches[0],o.touches[1]);g>0&&it.current>0&>(it.current/g),it.current=g}},c=o=>{pt(),M.current==="scrub"&&(G==null||G()),o.touches.length===0?M.current="none":o.touches.length===1&&(M.current="slide",at.current=o.touches[0].clientX)};return t.addEventListener("touchstart",n,{passive:!1}),t.addEventListener("touchmove",s,{passive:!1}),t.addEventListener("touchend",c,{passive:!1}),()=>{t.removeEventListener("touchstart",n),t.removeEventListener("touchmove",s),t.removeEventListener("touchend",c)}},[m,C,G,W,gt,Y,pt]);const Dt=r.useCallback(t=>{var g,x,F;if(b.current!=="none")return;const n=t.currentTarget.getBoundingClientRect(),s=t.clientX-n.left,c=t.clientY-n.top,o=(k.current-f.current)/(w.current-f.current)*n.width,i=Math.abs(s-o)<=10;if(mt(c,n.height)){const K=Q(s,c,n.width,n.height),dt=N.current;if(K)t.currentTarget.style.cursor=i?"grab":"pointer",(!dt||dt.item.id!==K.item.id||dt.lane.id!==K.lane.id)&&(N.current=K,(g=R.current)==null||g.call(R,{laneId:K.lane.id,item:K.item,originalEvent:t.nativeEvent}),m());else if(dt&&(N.current=null,(x=R.current)==null||x.call(R,null),m()),i)t.currentTarget.style.cursor="grab";else{const wt=ht(s,c,n.height);t.currentTarget.style.cursor=wt&&L.current?"grab":"default"}return}N.current&&(N.current=null,(F=R.current)==null||F.call(R,null),m()),t.currentTarget.style.cursor=i?"grab":"default"},[m,Q,mt,ht]),_t=r.useCallback(t=>{var g;if(performance.now()-ut.current>300)return;const s=t.currentTarget.getBoundingClientRect(),c=t.clientX-s.left,o=t.clientY-s.top,i=Q(c,o,s.width,s.height);i&&((g=X.current)==null||g.call(X,{laneId:i.lane.id,item:i.item,originalEvent:t.nativeEvent}))},[Q]),jt=r.useCallback(t=>{var i;const n=t.currentTarget.getBoundingClientRect(),s=t.clientX-n.left,c=t.clientY-n.top,o=Q(s,c,n.width,n.height);o&&((i=l.current)==null||i.call(l,{laneId:o.lane.id,item:o.item,originalEvent:t.nativeEvent}))},[Q]),p=r.useCallback(t=>{const n=t.currentTarget.getBoundingClientRect(),s=t.clientX-n.left,c=t.clientY-n.top,o=Q(s,c,n.width,n.height);o&&I.current?(t.preventDefault(),I.current({laneId:o.lane.id,item:o.item,originalEvent:t.nativeEvent})):t.preventDefault()},[Q]);return r.useEffect(()=>()=>{rt.current!==null&&cancelAnimationFrame(rt.current),ot.current!==null&&cancelAnimationFrame(ot.current)},[]),a.jsx("canvas",{ref:d,style:{width:"100%",flex:1,minHeight:0,display:"block",cursor:"default"},onMouseDown:Tt,onMouseMove:Dt,onClick:_t,onDoubleClick:jt,onMouseLeave:()=>{var t;N.current&&(N.current=null,(t=R.current)==null||t.call(R,null),m()),b.current==="none"&&d.current&&(d.current.style.cursor="default")},onContextMenu:p})});Mt.displayName="TimelineCanvas";const Pt=[2,4,8,16,32,100,1],Ft=[1,2,4,8,16,32,100],Gt=({startTime:v,endTime:_,currentTime:O,clock:u,onTimeChange:T,onPlayPause:j,onMultiplierChange:P,height:J,showControls:W=!0,showJumpToStart:C,showJumpToEnd:G,enableDrag:B=!0,dateTimeFormat:st,onDateTimeClick:Z,jumpToTime:$,maxTicks:tt,ffSpeeds:H=Pt,rwSpeeds:et=Ft,theme:d,className:E,timezone:U,swimLanes:z,showSwimLanes:f,onShowSwimLanesChange:w,swimLaneTransition:k="animated",onSwimLaneItemClick:S,onSwimLaneItemHover:nt,onSwimLaneItemDoubleClick:ct,onSwimLaneItemContextMenu:N,onSwimLaneReorder:V})=>{const X=()=>Date.now(),R=v?A.JulianDate.toDate(y.toJulianDate(v)).getTime():X()-432e5,l=_?A.JulianDate.toDate(y.toJulianDate(_)).getTime():X()+12*3600*1e3,[I,L]=r.useState(()=>y.toJulianDate(O??v??A.JulianDate.fromDate(new Date))),[rt,ot]=r.useState((u==null?void 0:u.shouldAnimate)??!1),[e,h]=r.useState((u==null?void 0:u.multiplier)??1),[b,D]=r.useState(f??!0);r.useEffect(()=>{f!=null&&D(f)},[f]);const lt=()=>{const p=!b;D(p),w==null||w(p)},ut=z!=null&&z.length>0,M=r.useRef(null),[at,it]=r.useState(0);r.useEffect(()=>{const p=M.current;if(!p)return;const t=new ResizeObserver(([n])=>it(n.borderBoxSize[0].blockSize));return t.observe(p),()=>t.disconnect()},[W]);const ft=ut&&!b?`${at+y.TICK_AREA_HEIGHT}px`:J!=null?`${J}px`:"100%",m=r.useRef(!1),Y=r.useRef(null),pt={...y.defaultTheme,...d};r.useEffect(()=>{if(!u)return;const p=()=>{if(!m.current){const t=A.JulianDate.clone(u.currentTime);if(L(t),ot(u.shouldAnimate),h(u.multiplier),Y.current){const{startMs:n,endMs:s}=Y.current.getVisibleRange(),c=s-n,o=A.JulianDate.toDate(t).getTime(),i=o-n;i<=c*.1?Y.current.zoomTo(o-c*.1,o+c*.9,o):i>=c*.9&&Y.current.zoomTo(o-c*.9,o+c*.1,o)}}};return u.onTick.addEventListener(p),()=>{u.onTick.removeEventListener(p)}},[u]),r.useEffect(()=>{if(u)return;const p=setInterval(()=>{if(m.current)return;const t=A.JulianDate.fromDate(new Date);if(L(t),Y.current){const{startMs:n,endMs:s}=Y.current.getVisibleRange(),c=s-n,o=A.JulianDate.toDate(t).getTime(),i=o-n;i<=c*.1?Y.current.zoomTo(o-c*.1,o+c*.9,o):i>=c*.9&&Y.current.zoomTo(o-c*.9,o+c*.1,o)}},1e3);return()=>clearInterval(p)},[u]),r.useEffect(()=>{if(!$)return;const p=y.toJulianDate($);if(ht(p),Y.current){const{startMs:t,endMs:n}=Y.current.getVisibleRange(),s=n-t,c=A.JulianDate.toDate(p).getTime();Y.current.zoomTo(c-s/2,c+s/2)}},[$]);const Q=(p,t=!0)=>{u&&(u.multiplier=p,t&&(u.shouldAnimate=!0)),h(p),t&&ot(!0),P==null||P(p)},ht=p=>{L(p),u&&(u.currentTime=A.JulianDate.clone(p)),T==null||T(p)},mt=p=>{p&&e<0&&Q(1,!1),u&&(u.shouldAnimate=p),ot(p),j==null||j(p)},Tt=()=>{const p=H.length>0?H:Pt,t=e>1?e:1,n=p.indexOf(t),s=p[n<0||n===p.length-1?0:n+1];Q(s)},gt=()=>{const p=et.length>0?et:Ft,t=e<0?Math.abs(e):0,n=p.indexOf(t),s=-p[n<0||n===p.length-1?0:n+1];Q(s)},Et=()=>{var t;const p=y.toJulianDate(v??A.JulianDate.fromDate(new Date(R)));u&&(u.currentTime=A.JulianDate.clone(p)),L(p),(t=Y.current)==null||t.zoomTo(R,l)},Dt=()=>{var t;const p=y.toJulianDate(_??A.JulianDate.fromDate(new Date(l)));u&&(u.currentTime=A.JulianDate.clone(p)),L(p),(t=Y.current)==null||t.zoomTo(R,l)},_t=()=>{var n;const p=A.JulianDate.fromDate(new Date);u&&(u.currentTime=A.JulianDate.clone(p)),L(p),Q(1);const t=Date.now();(n=Y.current)==null||n.zoomTo(t-12*3600*1e3,t+12*3600*1e3)},jt=Math.abs(A.JulianDate.toDate(I).getTime()-Date.now())<1e4;return a.jsxs("div",{className:E,style:{width:"100%",height:ft,overflow:"hidden",display:"flex",flexDirection:"column",fontFamily:"system-ui, -apple-system, sans-serif",transition:k==="animated"?"height 0.2s ease":void 0},children:[W&&a.jsx("div",{ref:M,children:a.jsx(It,{currentTime:I,isPlaying:rt,multiplier:e,isLive:jt,hasStartTime:v!=null,hasEndTime:_!=null,showJumpToStart:C,showJumpToEnd:G,onPlayPause:mt,onJumpToStart:Et,onRewind:gt,onFastForward:Tt,onJumpToEnd:Dt,onJumpToLive:_t,onResetSpeed:()=>Q(1),onDateTimeClick:Z,dateTimeFormat:st,timezone:U,theme:pt,swimLanesVisible:ut?b:void 0,onToggleSwimLanes:ut?lt:void 0})}),B!==!1&&a.jsx(Mt,{ref:Y,currentTime:I,defaultStartMs:R,defaultEndMs:l,theme:pt,maxTicks:tt,timezone:U,onTimeChange:ht,onDragStart:()=>{m.current=!0},onDragEnd:()=>{m.current=!1},swimLanes:z,showSwimLanes:b,onSwimLaneItemClick:S,onSwimLaneItemHover:nt,onSwimLaneItemDoubleClick:ct,onSwimLaneItemContextMenu:N,onSwimLaneReorder:V})]})},Vt=({startTime:v,endTime:_,currentTime:O,width:u,height:T,tickInterval:j,showLabels:P,snapToTicks:J,enableDrag:W,theme:C,onTimeChange:G,onVisibleRangeChange:B,onDragStart:st,onDragEnd:Z})=>{const $=r.useMemo(()=>y.generateTicks(v,_,j,u),[v,_,j,u]),tt=r.useMemo(()=>y.timeToPosition(O,v,_,u),[O,v,_,u]),H=r.useRef(null),et=E=>{if(!W)return;const U=E.currentTarget.getBoundingClientRect(),z=E.clientX-U.left,f=Math.max(0,Math.min(u,z));if(!(Math.abs(f-tt)<=10)){let I=f;J&&(I=y.snapToTick(f,$,10));const L=new Date(v).getTime(),rt=new Date(_).getTime();G(A.JulianDate.fromDate(new Date(L+I/u*(rt-L))));return}st==null||st();const k=E.clientX,S=new Date(O).getTime(),nt=new Date(v).getTime(),N=(new Date(_).getTime()-nt)/u;let V=0,X=!1;const R=I=>{V=I.clientX-k,X=!0,H.current||(H.current=requestAnimationFrame(()=>{if(X){const L=S+V*N;G(A.JulianDate.fromDate(new Date(L))),X=!1}H.current=null}))},l=()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",l),H.current!==null&&(cancelAnimationFrame(H.current),H.current=null),Z==null||Z()};document.addEventListener("mousemove",R),document.addEventListener("mouseup",l)},d=E=>{E.preventDefault();const U=E.shiftKey?E.deltaY:E.deltaX!==0?E.deltaX:E.deltaY;if(Math.abs(U)<1)return;const z=new Date(v).getTime(),f=new Date(_).getTime(),w=U/u*(f-z)*.5;B==null||B(A.JulianDate.fromDate(new Date(z+w)),A.JulianDate.fromDate(new Date(f+w)))};return a.jsxs("svg",{width:"100%",height:T,style:{backgroundColor:C.backgroundColor,display:"block",cursor:"default"},onMouseDown:et,onWheel:d,children:[a.jsx("rect",{width:u,height:T,fill:C.backgroundColor}),$.map((E,U)=>a.jsxs("g",{children:[a.jsx("line",{x1:E.position,y1:T-(E.isMajor?C.majorTickHeight:C.minorTickHeight),x2:E.position,y2:T,stroke:E.isMajor?C.majorTickColor:C.tickColor,strokeWidth:"1"}),P&&E.isMajor&&E.label&&a.jsx("text",{x:E.position,y:T-C.majorTickHeight-5,textAnchor:"middle",fill:C.labelColor,fontSize:C.fontSize,fontFamily:"monospace",children:E.label})]},U)),a.jsx("line",{x1:tt,y1:0,x2:tt,y2:T,stroke:C.indicatorColor,strokeWidth:C.indicatorLineWidth,pointerEvents:"none"}),W&&a.jsx("rect",{x:Math.max(0,tt-10),y:0,width:20,height:T,fill:"transparent",style:{cursor:"ew-resize"},pointerEvents:"visiblePainted"}),a.jsx("circle",{cx:tt,cy:5,r:4,fill:C.indicatorColor,pointerEvents:"none"})]})};Object.defineProperty(q,"TICK_AREA_HEIGHT",{enumerable:!0,get:()=>y.TICK_AREA_HEIGHT}),q.Timeline=Gt,q.TimelineCanvas=Mt,q.TimelineControls=It,q.TimelineSVG=Vt,Object.keys(y).forEach(v=>{v!=="default"&&!Object.prototype.hasOwnProperty.call(q,v)&&Object.defineProperty(q,v,{enumerable:!0,get:()=>y[v]})}),Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})}));
|
|
22
|
+
<%s key={someKey} {...props} />`,T,w,st,w),K[w+T]=!0)}if(w=null,v!==void 0&&(O(v),w=""+v),F(d)&&(O(d.key),w=""+d.key),"key"in d){v={};for(var ut in d)ut!=="key"&&(v[ut]=d[ut])}else v=d;return w&&J(v,typeof e=="function"?e.displayName||e.name||"Unknown":e),k(e,w,v,D(),ct,pt)}function W(e){rt(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===M&&(e._payload.status==="fulfilled"?rt(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function rt(e){return typeof e=="object"&&e!==null&&e.$$typeof===$}var Z=o,$=Symbol.for("react.transitional.element"),tt=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),et=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),b=Symbol.for("react.consumer"),H=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),ot=Symbol.for("react.client.reference"),Y=Z.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,nt=Object.prototype.hasOwnProperty,U=Array.isArray,j=console.createTask?console.createTask:function(){return null};Z={react_stack_bottom_frame:function(e){return e()}};var I,L={},l=Z.react_stack_bottom_frame.bind(Z,A)(),S=j(i(A)),K={};vt.Fragment=B,vt.jsx=function(e,d,v){var T=1e4>Y.recentlyCreatedOwnerStacks++;return G(e,d,v,!1,T?Error("react-stack-top-frame"):l,T?j(i(e)):S)},vt.jsxs=function(e,d,v){var T=1e4>Y.recentlyCreatedOwnerStacks++;return G(e,d,v,!0,T?Error("react-stack-top-frame"):l,T?j(i(e)):S)}})()),vt}var kt;function Bt(){return kt||(kt=1,process.env.NODE_ENV==="production"?Et.exports=zt():Et.exports=Wt()),Et.exports}var u=Bt();const Ht=520,Ut=()=>u.jsxs("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"currentColor","aria-hidden":"true",children:[u.jsx("rect",{x:"1",y:"0",width:"4",height:"16",rx:"1"}),u.jsx("rect",{x:"9",y:"0",width:"4",height:"16",rx:"1"})]}),Lt=()=>u.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:u.jsx("polyline",{points:"3,5 7,9 11,5"})}),Ot=()=>u.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:u.jsx("polyline",{points:"3,9 7,5 11,9"})}),It=({currentTime:g,isPlaying:_,multiplier:O,dateTimeFormat:i,timezone:D,isLive:A,hasStartTime:F,hasEndTime:J,showJumpToStart:z=!0,showJumpToEnd:k=!0,onPlayPause:G,onJumpToStart:W,onRewind:rt,onFastForward:Z,onJumpToEnd:$,onJumpToLive:tt,onResetSpeed:B,onDateTimeClick:et,theme:h,swimLanesVisible:b,onToggleSwimLanes:H,labels:Q})=>{const f=O<0,E=O>1,N=O===1,M=Math.abs(O),y=o.useMemo(()=>({...R.DEFAULT_LABELS,...Q}),[Q]),ot=o.useRef(null),[Y,nt]=o.useState(!1);o.useEffect(()=>{const l=ot.current;if(!l)return;const S=new ResizeObserver(([K])=>{nt(K.contentRect.width<Ht)});return S.observe(l),()=>S.disconnect()},[]);const U={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},j=l=>({...U,color:l?h.buttonActiveColor:h.buttonColor,borderColor:l?`${h.buttonActiveColor}33`:"transparent"}),I=(l,S)=>{l.currentTarget.style.backgroundColor=S?`${h.buttonActiveColor}22`:h.buttonHoverColor+"44"},L=l=>{l.currentTarget.style.backgroundColor="transparent"};return u.jsxs("div",{ref:ot,style:{display:Y?"flex":"grid",gridTemplateColumns:Y?void 0:"1fr auto 1fr",alignItems:"center",padding:"6px 16px",backgroundColor:h.controlBarBackground,borderBottom:`1px solid ${h.controlBarBorder}`,fontFamily:"system-ui, -apple-system, sans-serif"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[u.jsx("div",{onClick:et,title:et?y.dateTimeClickTooltip:void 0,style:{color:h.labelColor,fontFamily:"monospace",lineHeight:1.15,cursor:et?"pointer":"default",borderRadius:"4px",padding:"2px 4px",transition:"background 0.15s"},onMouseEnter:l=>{et&&(l.currentTarget.style.background=h.buttonHoverColor+"44")},onMouseLeave:l=>l.currentTarget.style.background="transparent",children:(()=>{const{timeFormat:l,dateFormat:S}=R.splitForDisplay(i),K=R.getTimezoneAbbr(g,D);return u.jsxs(u.Fragment,{children:[l&&u.jsx("div",{style:{fontSize:"2em",fontWeight:"bold",letterSpacing:"0.02em"},children:R.formatDateTime(g,l,D)}),S&&u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[u.jsx("span",{style:{fontSize:"1.15em",letterSpacing:"0.03em",color:h.buttonActiveColor},children:R.formatDateTime(g,S,D)}),K&&u.jsx("span",{style:{fontSize:"0.9em",color:h.labelColor,opacity:.7,fontWeight:"bold",letterSpacing:"0.04em"},children:K})]})]})})()}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px",justifyContent:"center"},children:[u.jsx("button",{onClick:tt,style:{...U,fontSize:"11px",fontWeight:"bold",letterSpacing:"0.05em",width:"52px",minWidth:"52px",height:"20px",borderRadius:"3px",color:A?h.controlBarBackground:h.buttonActiveColor,backgroundColor:A?h.buttonActiveColor:"transparent",borderColor:h.buttonActiveColor,opacity:A?1:.55},onMouseEnter:l=>{l.currentTarget.style.opacity="1"},onMouseLeave:l=>{l.currentTarget.style.opacity=A?"1":"0.55"},title:A?y.liveActiveTooltip:y.liveTooltip,children:A?y.liveActiveLabel:y.liveLabel}),u.jsx("div",{style:{height:"20px",display:"flex",alignItems:"center"},children:!N&&u.jsx("button",{onClick:()=>B(),style:{...U,fontSize:"11px",color:h.buttonActiveColor,borderColor:`${h.buttonActiveColor}44`,width:"52px",minWidth:"52px",height:"20px"},onMouseEnter:l=>I(l,!0),onMouseLeave:L,title:y.resetSpeedTooltip,children:f?`◀ ${M}×`:`${M}× ▶`})})]})]}),u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",...Y?{flex:1,justifyContent:"center"}:{}},children:[z&&u.jsx("button",{onClick:F?W:void 0,disabled:!F,style:{...j(!1),opacity:F?1:.3,cursor:F?"pointer":"default"},onMouseEnter:F?l=>I(l,!1):void 0,onMouseLeave:F?L:void 0,title:F?y.jumpToStartTooltip:y.noStartTimeTooltip,children:"⏮"}),u.jsx("button",{onClick:rt,style:{...j(f),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:l=>I(l,f),onMouseLeave:L,title:f?R.resolveLabel(y.rewindActiveTooltip,M):y.rewindTooltip,children:f?u.jsxs(u.Fragment,{children:[u.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[M,"×"]}),"◀◀"]}):"◀◀"}),u.jsx("button",{onClick:()=>G(!_),style:{...U,color:h.buttonActiveColor,fontSize:"18px",width:"40px",minWidth:"40px",height:"40px",borderColor:`${h.buttonActiveColor}55`,borderRadius:"50%",paddingLeft:_?"0":"2px"},onMouseEnter:l=>I(l,!0),onMouseLeave:L,title:_?y.pauseTooltip:f?y.playFromRewindTooltip:y.playTooltip,children:_?u.jsx(Ut,{}):"▶"}),u.jsx("button",{onClick:Z,style:{...j(E),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:l=>I(l,E),onMouseLeave:L,title:E?R.resolveLabel(y.fastForwardActiveTooltip,M):y.fastForwardTooltip,children:E?u.jsxs(u.Fragment,{children:["▶▶",u.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[M,"×"]})]}):"▶▶"}),k&&u.jsx("button",{onClick:J?$:void 0,disabled:!J,style:{...j(!1),opacity:J?1:.3,cursor:J?"pointer":"default"},onMouseEnter:J?l=>I(l,!1):void 0,onMouseLeave:J?L:void 0,title:J?y.jumpToEndTooltip:y.noEndTimeTooltip,children:"⏭"})]}),!Y&&u.jsx("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:H!=null&&b!=null&&u.jsx("button",{onClick:H,style:{...U,color:h.buttonActiveColor,borderColor:`${h.buttonActiveColor}33`},onMouseEnter:l=>I(l,b),onMouseLeave:L,title:b?y.collapseSwimLanesTooltip:y.expandSwimLanesTooltip,children:b?u.jsx(Lt,{}):u.jsx(Ot,{})})}),Y&&H!=null&&b!=null&&u.jsx("button",{onClick:H,style:{...U,color:h.buttonActiveColor,borderColor:`${h.buttonActiveColor}33`,marginLeft:"4px"},onMouseEnter:l=>I(l,b),onMouseLeave:L,title:b?y.collapseSwimLanesTooltip:y.expandSwimLanesTooltip,children:b?u.jsx(Lt,{}):u.jsx(Ot,{})})]})},yt=o.forwardRef((g,_)=>{const{currentTime:O,defaultStartMs:i,defaultEndMs:D,theme:A,maxTicks:F,timezone:J,onTimeChange:z,onDragStart:k,onDragEnd:G,swimLanes:W,showSwimLanes:rt,onSwimLaneItemClick:Z,onSwimLaneItemHover:$,onSwimLaneItemDoubleClick:tt,onSwimLaneItemContextMenu:B,onSwimLaneReorder:et}=g,h=o.useRef(null),b=o.useRef(A),H=o.useRef(F),Q=o.useRef(J),f=o.useRef(i),E=o.useRef(D),N=o.useRef(C.JulianDate.toDate(O).getTime());o.useEffect(()=>{b.current=A},[A]),o.useEffect(()=>{H.current=F},[F]),o.useEffect(()=>{Q.current=J,x()},[J]);const M=o.useRef(W??[]),y=o.useRef(rt??(W!=null&&W.length>0)),ot=o.useRef(0),Y=o.useRef(null),nt=o.useRef(null),U=o.useRef(Z),j=o.useRef($),I=o.useRef(tt),L=o.useRef(B),l=o.useRef(et);o.useEffect(()=>{U.current=Z},[Z]),o.useEffect(()=>{j.current=$},[$]),o.useEffect(()=>{I.current=tt},[tt]),o.useEffect(()=>{L.current=B},[B]),o.useEffect(()=>{l.current=et},[et]),o.useEffect(()=>{M.current=W??[],x()},[W]),o.useEffect(()=>{y.current=rt??(W!=null&&W.length>0),x()},[rt,W]);const S=o.useRef(null),K=o.useRef(null),e=o.useRef(!1),d=o.useRef(0),v=o.useRef("none"),T=o.useRef(0),ct=o.useRef(0),pt=o.useRef(0),w=o.useRef("none"),st=o.useRef(0),ut=o.useRef(0),gt=(t,n)=>Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY),dt=o.useCallback(()=>({startMs:f.current,endMs:E.current,currentMs:N.current,theme:b.current,maxTicks:H.current,timezone:Q.current,swimLanes:M.current,showSwimLanes:y.current,scrollTop:ot.current,reorderState:nt.current}),[]);o.useImperativeHandle(_,()=>({zoomTo(t,n,r){const a=Math.max(R.MIN_SPAN_MS,Math.min(R.MAX_SPAN_MS,n-t)),s=(t+n)/2;f.current=s-a/2,E.current=s+a/2,r!==void 0&&(N.current=r),x()},getVisibleRange(){return{startMs:f.current,endMs:E.current}},startFollow(t){if(d.current=t,K.current!==null)return;e.current=!0;let n=performance.now();const r=()=>{const a=performance.now(),s=a-n;n=a;const c=s*d.current;f.current+=c,E.current+=c,N.current+=c,x(),K.current=requestAnimationFrame(r)};K.current=requestAnimationFrame(r)},stopFollow(){e.current=!1,K.current!==null&&(cancelAnimationFrame(K.current),K.current=null)},correctFollow(t){if(!e.current)return;const n=t-N.current;N.current=t,f.current+=n,E.current+=n},appendSwimLane(t){M.current=[...M.current,t],x()},updateSwimLane(t,n){M.current=M.current.map(r=>r.id===t?{...r,...n,id:r.id}:r),x()},removeSwimLane(t){M.current=M.current.filter(n=>n.id!==t),x()},reorderSwimLanes(t){const n=new Map(M.current.map(a=>[a.id,a])),r=[];for(const a of t){const s=n.get(a);s&&r.push(s)}M.current=r,x()}}));const x=o.useCallback(()=>{const t=h.current;if(!t)return;const n=t.getContext("2d");if(!n)return;const r=t.getBoundingClientRect(),a=r.width,s=r.height;if(a===0||s===0)return;const c=window.devicePixelRatio||1,p=Math.round(a*c),m=Math.round(s*c);(t.width!==p||t.height!==m)&&(t.width=p,t.height=m),n.save(),n.scale(c,c);const P=R.drawTimeline(n,a,s,dt());P!==ot.current&&(ot.current=P),n.restore()},[dt]);o.useLayoutEffect(()=>{x();const t=h.current;if(!t)return;const n=new ResizeObserver(()=>x());return n.observe(t),()=>n.disconnect()},[x]),o.useEffect(()=>{if(e.current)return;const t=C.JulianDate.toDate(O).getTime();N.current!==t&&(N.current=t,x())},[O,x]);const lt=o.useCallback(t=>{if(S.current!==null)return;const n=()=>{const r=h.current,a=E.current-f.current,s=t*a*.01;if(f.current+=s,E.current+=s,r){const c=r.getBoundingClientRect(),p=Math.max(0,Math.min(c.width,ct.current-c.left)),m=f.current+p/c.width*(E.current-f.current);N.current=m,z(C.JulianDate.fromDate(new Date(m)))}x(),S.current=requestAnimationFrame(n)};S.current=requestAnimationFrame(n)},[x,z]),X=o.useCallback(()=>{S.current!==null&&(cancelAnimationFrame(S.current),S.current=null)},[]),at=o.useCallback((t,n,r,a)=>R.hitTestSwimLane(t,n,r,a,dt()),[dt]),it=o.useCallback((t,n,r)=>R.hitTestLaneLabel(t,n,r,dt()),[dt]),ht=o.useCallback((t,n)=>R.isInSwimLaneRegion(t,n,dt()),[dt]),Tt=o.useCallback(t=>{t.preventDefault();const n=t.currentTarget.getBoundingClientRect(),r=t.clientX-n.left,a=t.clientY-n.top;if(t.button===0&&l.current){const s=it(r,a,n.height);if(s){const p=M.current.findIndex(m=>m.id===s.id);nt.current={dragging:!0,dragLaneId:s.id,dragStartY:t.clientY,currentY:t.clientY,insertIndex:p},t.currentTarget.style.cursor="grabbing";return}}if(t.button===0&&ht(a,n.height)){const s=(N.current-f.current)/(E.current-f.current)*n.width;if(!(Math.abs(r-s)<=10)&&at(r,a,n.width,n.height)){pt.current=performance.now();return}}if(t.button===0){v.current="scrub",ct.current=t.clientX,t.currentTarget.style.cursor="grabbing",k==null||k();const s=f.current+r/n.width*(E.current-f.current);N.current=s,x(),z(C.JulianDate.fromDate(new Date(s)))}else if(t.button===1)v.current="slide",T.current=t.clientX;else if(t.button===2){if(L.current&&ht(a,n.height))return;v.current="zoom",T.current=t.clientX}},[x,z,k,it,ht,at]);o.useEffect(()=>{const t=r=>{const a=nt.current;if(a&&a.dragging){a.currentY=r.clientY;const m=h.current;if(m){const P=m.getBoundingClientRect(),V=r.clientY-P.top;let Rt=-ot.current;const jt=M.current;let Jt=jt.length;for(let wt=0;wt<jt.length;wt++){const Nt=jt[wt].height??R.DEFAULT_LANE_HEIGHT,Vt=Rt+Nt/2;if(V<Vt){Jt=wt;break}Rt+=Nt+R.LANE_GAP}a.insertIndex=Jt}x();return}if(v.current==="none")return;const s=h.current;if(!s)return;const c=s.getBoundingClientRect(),p=c.width;if(v.current==="scrub"){ct.current=r.clientX;const m=r.clientX-c.left,P=p*.08;m<P?lt(-1):m>p-P?lt(1):X();const V=Math.max(0,Math.min(p,m)),ft=f.current+V/p*(E.current-f.current);N.current=ft,x(),z(C.JulianDate.fromDate(new Date(ft)))}else if(v.current==="slide"){const m=T.current-r.clientX;if(T.current=r.clientX,m!==0){const P=m/p*(E.current-f.current);f.current+=P,E.current+=P,x()}}else if(v.current==="zoom"){const m=T.current-r.clientX;T.current=r.clientX,m!==0&&mt(Math.pow(1.01,m))}},n=()=>{var a;const r=nt.current;if(r&&r.dragging){const s=Math.abs(r.currentY-r.dragStartY),c=M.current,p=c.findIndex(m=>m.id===r.dragLaneId);if(s>5&&p>=0&&r.insertIndex!==p&&r.insertIndex!==p+1){const m=[...c],[P]=m.splice(p,1),V=r.insertIndex>p?r.insertIndex-1:r.insertIndex;m.splice(V,0,P),M.current=m,(a=l.current)==null||a.call(l,m.map(ft=>ft.id))}nt.current=null,h.current&&(h.current.style.cursor="default"),x();return}X(),v.current="none",h.current&&(h.current.style.cursor="default"),G==null||G()};return document.addEventListener("mousemove",t),document.addEventListener("mouseup",n),()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)}},[x,z,G,lt,X]);const mt=o.useCallback(t=>{const n=R.zoomRange(f.current,E.current,t);f.current=n.startMs,E.current=n.endMs,x()},[x]),bt=o.useCallback(t=>{t.preventDefault();const n=h.current;if(!n)return;const r=n.getBoundingClientRect(),a=t.clientY-r.top,s=y.current,c=M.current;if(s&&c.length>0){const p=Math.max(0,r.height-R.TICK_AREA_HEIGHT);if(a>=0&&a<p){let m=0;for(const V of c)m+=(V.height??R.DEFAULT_LANE_HEIGHT)+R.LANE_GAP;const P=Math.max(0,m-p);if(P>0){ot.current=Math.max(0,Math.min(P,ot.current+t.deltaY*R.SWIM_LANE_SCROLL_SPEED)),x();return}}}mt(Math.pow(1.05,t.deltaY>0?-1:1))},[mt,x]);o.useEffect(()=>{const t=h.current;if(t)return t.addEventListener("wheel",bt,{passive:!1}),()=>t.removeEventListener("wheel",bt)},[bt]),o.useEffect(()=>{const t=h.current;if(!t)return;const n=s=>{s.preventDefault();const c=t.getBoundingClientRect();if(s.touches.length===1){const p=s.touches[0].clientX-c.left,m=Math.max(0,Math.min(c.width,p)),P=f.current+m/c.width*(E.current-f.current);w.current="scrub",st.current=s.touches[0].clientX,ct.current=s.touches[0].clientX,N.current=P,x(),k==null||k(),z(C.JulianDate.fromDate(new Date(P)))}else s.touches.length>=2&&(w.current="pinch",ut.current=gt(s.touches[0],s.touches[1]))},r=s=>{s.preventDefault();const c=t.getBoundingClientRect();if(w.current==="scrub"&&s.touches.length>=1){const p=s.touches[0].clientX-c.left,m=c.width*.08;if(ct.current=s.touches[0].clientX,p<m)lt(-1);else if(p>c.width-m)lt(1);else{X();const P=Math.max(0,Math.min(c.width,p)),V=f.current+P/c.width*(E.current-f.current);N.current=V,x(),z(C.JulianDate.fromDate(new Date(V)))}}else if(w.current==="slide"&&s.touches.length>=1){const p=st.current-s.touches[0].clientX;if(st.current=s.touches[0].clientX,p!==0){const m=p/c.width*(E.current-f.current);f.current+=m,E.current+=m,x()}}else if(w.current==="pinch"&&s.touches.length>=2){const p=gt(s.touches[0],s.touches[1]);p>0&&ut.current>0&&mt(ut.current/p),ut.current=p}},a=s=>{X(),w.current==="scrub"&&(G==null||G()),s.touches.length===0?w.current="none":s.touches.length===1&&(w.current="slide",st.current=s.touches[0].clientX)};return t.addEventListener("touchstart",n,{passive:!1}),t.addEventListener("touchmove",r,{passive:!1}),t.addEventListener("touchend",a,{passive:!1}),()=>{t.removeEventListener("touchstart",n),t.removeEventListener("touchmove",r),t.removeEventListener("touchend",a)}},[x,k,G,z,mt,lt,X]);const Mt=o.useCallback(t=>{var p,m,P;if(v.current!=="none")return;const n=t.currentTarget.getBoundingClientRect(),r=t.clientX-n.left,a=t.clientY-n.top,s=(N.current-f.current)/(E.current-f.current)*n.width,c=Math.abs(r-s)<=10;if(ht(a,n.height)){const V=at(r,a,n.width,n.height),ft=Y.current;if(V)t.currentTarget.style.cursor=c?"grab":"pointer",(!ft||ft.item.id!==V.item.id||ft.lane.id!==V.lane.id)&&(Y.current=V,(p=j.current)==null||p.call(j,{laneId:V.lane.id,item:V.item,originalEvent:t.nativeEvent}),x());else if(ft&&(Y.current=null,(m=j.current)==null||m.call(j,null),x()),c)t.currentTarget.style.cursor="grab";else{const Rt=it(r,a,n.height);t.currentTarget.style.cursor=Rt&&l.current?"grab":"default"}return}Y.current&&(Y.current=null,(P=j.current)==null||P.call(j,null),x()),t.currentTarget.style.cursor=c?"grab":"default"},[x,at,ht,it]),Dt=o.useCallback(t=>{var p;if(performance.now()-pt.current>300)return;const r=t.currentTarget.getBoundingClientRect(),a=t.clientX-r.left,s=t.clientY-r.top,c=at(a,s,r.width,r.height);c&&((p=U.current)==null||p.call(U,{laneId:c.lane.id,item:c.item,originalEvent:t.nativeEvent}))},[at]),_t=o.useCallback(t=>{var c;const n=t.currentTarget.getBoundingClientRect(),r=t.clientX-n.left,a=t.clientY-n.top,s=at(r,a,n.width,n.height);s&&((c=I.current)==null||c.call(I,{laneId:s.lane.id,item:s.item,originalEvent:t.nativeEvent}))},[at]),At=o.useCallback(t=>{const n=t.currentTarget.getBoundingClientRect(),r=t.clientX-n.left,a=t.clientY-n.top,s=at(r,a,n.width,n.height);s&&L.current?(t.preventDefault(),L.current({laneId:s.lane.id,item:s.item,originalEvent:t.nativeEvent})):t.preventDefault()},[at]);return o.useEffect(()=>()=>{S.current!==null&&cancelAnimationFrame(S.current),K.current!==null&&cancelAnimationFrame(K.current)},[]),u.jsx("canvas",{ref:h,style:{width:"100%",flex:1,minHeight:0,display:"block",cursor:"default"},onMouseDown:Tt,onMouseMove:Mt,onClick:Dt,onDoubleClick:_t,onMouseLeave:()=>{var t;Y.current&&(Y.current=null,(t=j.current)==null||t.call(j,null),x()),v.current==="none"&&h.current&&(h.current.style.cursor="default")},onContextMenu:At})});yt.displayName="TimelineCanvas";const Ft=[2,4,8,16,32,100,1],Pt=[1,2,4,8,16,32,100],Gt=({startTime:g,endTime:_,currentTime:O,clock:i,onTimeChange:D,onPlayPause:A,onMultiplierChange:F,height:J,showControls:z=!0,showJumpToStart:k,showJumpToEnd:G,enableDrag:W=!0,dateTimeFormat:rt,onDateTimeClick:Z,jumpToTime:$,maxTicks:tt,ffSpeeds:B=Ft,rwSpeeds:et=Pt,theme:h,className:b,timezone:H,swimLanes:Q,showSwimLanes:f,onShowSwimLanesChange:E,swimLaneTransition:N="animated",onSwimLaneItemClick:M,onSwimLaneItemHover:y,onSwimLaneItemDoubleClick:ot,onSwimLaneItemContextMenu:Y,onSwimLaneReorder:nt,labels:U})=>{const j=()=>Date.now(),I=g?C.JulianDate.toDate(R.toJulianDate(g)).getTime():j()-432e5,L=_?C.JulianDate.toDate(R.toJulianDate(_)).getTime():j()+12*3600*1e3,[l,S]=o.useState(()=>R.toJulianDate(O??g??C.JulianDate.fromDate(new Date))),[K,e]=o.useState((i==null?void 0:i.shouldAnimate)??!1),[d,v]=o.useState((i==null?void 0:i.multiplier)??1),[T,ct]=o.useState(f??!0);o.useEffect(()=>{f!=null&&ct(f)},[f]);const pt=()=>{const t=!T;ct(t),E==null||E(t)},w=Q!=null&&Q.length>0,st=o.useRef(null),[ut,gt]=o.useState(0);o.useEffect(()=>{const t=st.current;if(!t)return;const n=new ResizeObserver(([r])=>gt(r.borderBoxSize[0].blockSize));return n.observe(t),()=>n.disconnect()},[z]);const x=w&&!T?`${ut+R.TICK_AREA_HEIGHT}px`:J!=null?`${J}px`:"100%",lt=o.useRef(!1),X=o.useRef(null),at={...R.defaultTheme,...h};o.useEffect(()=>{if(!i)return;const t=()=>{if(!lt.current){const n=C.JulianDate.clone(i.currentTime);if(S(n),e(i.shouldAnimate),v(i.multiplier),X.current){const{startMs:r,endMs:a}=X.current.getVisibleRange(),s=a-r,c=C.JulianDate.toDate(n).getTime(),p=c-r;p<=s*.1?X.current.zoomTo(c-s*.1,c+s*.9,c):p>=s*.9&&X.current.zoomTo(c-s*.9,c+s*.1,c)}}};return i.onTick.addEventListener(t),()=>{i.onTick.removeEventListener(t)}},[i]),o.useEffect(()=>{if(i)return;const t=setInterval(()=>{if(lt.current)return;const n=C.JulianDate.fromDate(new Date);if(S(n),X.current){const{startMs:r,endMs:a}=X.current.getVisibleRange(),s=a-r,c=C.JulianDate.toDate(n).getTime(),p=c-r;p<=s*.1?X.current.zoomTo(c-s*.1,c+s*.9,c):p>=s*.9&&X.current.zoomTo(c-s*.9,c+s*.1,c)}},1e3);return()=>clearInterval(t)},[i]),o.useEffect(()=>{if(!$)return;const t=R.toJulianDate($);if(ht(t),X.current){const{startMs:n,endMs:r}=X.current.getVisibleRange(),a=r-n,s=C.JulianDate.toDate(t).getTime();X.current.zoomTo(s-a/2,s+a/2)}},[$]);const it=(t,n=!0)=>{i&&(i.multiplier=t,n&&(i.shouldAnimate=!0)),v(t),n&&e(!0),F==null||F(t)},ht=t=>{S(t),i&&(i.currentTime=C.JulianDate.clone(t)),D==null||D(t)},Tt=t=>{t&&d<0&&it(1,!1),i&&(i.shouldAnimate=t),e(t),A==null||A(t)},mt=()=>{const t=B.length>0?B:Ft,n=d>1?d:1,r=t.indexOf(n),a=t[r<0||r===t.length-1?0:r+1];it(a)},bt=()=>{const t=et.length>0?et:Pt,n=d<0?Math.abs(d):0,r=t.indexOf(n),a=-t[r<0||r===t.length-1?0:r+1];it(a)},Mt=()=>{var n;const t=R.toJulianDate(g??C.JulianDate.fromDate(new Date(I)));i&&(i.currentTime=C.JulianDate.clone(t)),S(t),(n=X.current)==null||n.zoomTo(I,L)},Dt=()=>{var n;const t=R.toJulianDate(_??C.JulianDate.fromDate(new Date(L)));i&&(i.currentTime=C.JulianDate.clone(t)),S(t),(n=X.current)==null||n.zoomTo(I,L)},_t=()=>{var r;const t=C.JulianDate.fromDate(new Date);i&&(i.currentTime=C.JulianDate.clone(t)),S(t),it(1);const n=Date.now();(r=X.current)==null||r.zoomTo(n-12*3600*1e3,n+12*3600*1e3)},At=Math.abs(C.JulianDate.toDate(l).getTime()-Date.now())<1e4;return u.jsxs("div",{className:b,style:{width:"100%",height:x,overflow:"hidden",display:"flex",flexDirection:"column",fontFamily:"system-ui, -apple-system, sans-serif",transition:N==="animated"?"height 0.2s ease":void 0},children:[z&&u.jsx("div",{ref:st,children:u.jsx(It,{currentTime:l,isPlaying:K,multiplier:d,isLive:At,hasStartTime:g!=null,hasEndTime:_!=null,showJumpToStart:k,showJumpToEnd:G,onPlayPause:Tt,onJumpToStart:Mt,onRewind:bt,onFastForward:mt,onJumpToEnd:Dt,onJumpToLive:_t,onResetSpeed:()=>it(1),onDateTimeClick:Z,dateTimeFormat:rt,timezone:H,theme:at,swimLanesVisible:w?T:void 0,onToggleSwimLanes:w?pt:void 0,labels:U})}),W!==!1&&u.jsx(yt,{ref:X,currentTime:l,defaultStartMs:I,defaultEndMs:L,theme:at,maxTicks:tt,timezone:H,onTimeChange:ht,onDragStart:()=>{lt.current=!0},onDragEnd:()=>{lt.current=!1},swimLanes:Q,showSwimLanes:T,onSwimLaneItemClick:M,onSwimLaneItemHover:y,onSwimLaneItemDoubleClick:ot,onSwimLaneItemContextMenu:Y,onSwimLaneReorder:nt})]})},Kt=({startTime:g,endTime:_,currentTime:O,width:i,height:D,tickInterval:A,showLabels:F,snapToTicks:J,enableDrag:z,theme:k,onTimeChange:G,onVisibleRangeChange:W,onDragStart:rt,onDragEnd:Z})=>{const $=o.useMemo(()=>R.generateTicks(g,_,A,i),[g,_,A,i]),tt=o.useMemo(()=>R.timeToPosition(O,g,_,i),[O,g,_,i]),B=o.useRef(null),et=b=>{if(!z)return;const H=b.currentTarget.getBoundingClientRect(),Q=b.clientX-H.left,f=Math.max(0,Math.min(i,Q));if(!(Math.abs(f-tt)<=10)){let L=f;J&&(L=R.snapToTick(f,$,10));const l=new Date(g).getTime(),S=new Date(_).getTime();G(C.JulianDate.fromDate(new Date(l+L/i*(S-l))));return}rt==null||rt();const N=b.clientX,M=new Date(O).getTime(),y=new Date(g).getTime(),Y=(new Date(_).getTime()-y)/i;let nt=0,U=!1;const j=L=>{nt=L.clientX-N,U=!0,B.current||(B.current=requestAnimationFrame(()=>{if(U){const l=M+nt*Y;G(C.JulianDate.fromDate(new Date(l))),U=!1}B.current=null}))},I=()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",I),B.current!==null&&(cancelAnimationFrame(B.current),B.current=null),Z==null||Z()};document.addEventListener("mousemove",j),document.addEventListener("mouseup",I)},h=b=>{b.preventDefault();const H=b.shiftKey?b.deltaY:b.deltaX!==0?b.deltaX:b.deltaY;if(Math.abs(H)<1)return;const Q=new Date(g).getTime(),f=new Date(_).getTime(),E=H/i*(f-Q)*.5;W==null||W(C.JulianDate.fromDate(new Date(Q+E)),C.JulianDate.fromDate(new Date(f+E)))};return u.jsxs("svg",{width:"100%",height:D,style:{backgroundColor:k.backgroundColor,display:"block",cursor:"default"},onMouseDown:et,onWheel:h,children:[u.jsx("rect",{width:i,height:D,fill:k.backgroundColor}),$.map((b,H)=>u.jsxs("g",{children:[u.jsx("line",{x1:b.position,y1:D-(b.isMajor?k.majorTickHeight:k.minorTickHeight),x2:b.position,y2:D,stroke:b.isMajor?k.majorTickColor:k.tickColor,strokeWidth:"1"}),F&&b.isMajor&&b.label&&u.jsx("text",{x:b.position,y:D-k.majorTickHeight-5,textAnchor:"middle",fill:k.labelColor,fontSize:k.fontSize,fontFamily:"monospace",children:b.label})]},H)),u.jsx("line",{x1:tt,y1:0,x2:tt,y2:D,stroke:k.indicatorColor,strokeWidth:k.indicatorLineWidth,pointerEvents:"none"}),z&&u.jsx("rect",{x:Math.max(0,tt-10),y:0,width:20,height:D,fill:"transparent",style:{cursor:"ew-resize"},pointerEvents:"visiblePainted"}),u.jsx("circle",{cx:tt,cy:5,r:4,fill:k.indicatorColor,pointerEvents:"none"})]})};Object.defineProperty(q,"TICK_AREA_HEIGHT",{enumerable:!0,get:()=>R.TICK_AREA_HEIGHT}),q.Timeline=Gt,q.TimelineCanvas=yt,q.TimelineControls=It,q.TimelineSVG=Kt,Object.keys(R).forEach(g=>{g!=="default"&&!Object.prototype.hasOwnProperty.call(q,g)&&Object.defineProperty(q,g,{enumerable:!0,get:()=>R[g]})}),Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { SwimLane } from '@kteneyck/cesium-timeline-core';
|
|
|
4
4
|
import { SwimLaneEventInfo } from '@kteneyck/cesium-timeline-core';
|
|
5
5
|
import { TICK_AREA_HEIGHT } from '@kteneyck/cesium-timeline-core';
|
|
6
6
|
import { TickInterval } from '@kteneyck/cesium-timeline-core';
|
|
7
|
+
import { TimelineLabels } from '@kteneyck/cesium-timeline-core';
|
|
7
8
|
import { TimelineTheme } from '@kteneyck/cesium-timeline-core';
|
|
8
9
|
|
|
9
10
|
/** React-specific controls props (uses Cesium.JulianDate for currentTime). */
|
|
@@ -30,6 +31,8 @@ export declare interface ControlsProps {
|
|
|
30
31
|
theme: TimelineTheme;
|
|
31
32
|
swimLanesVisible?: boolean;
|
|
32
33
|
onToggleSwimLanes?: () => void;
|
|
34
|
+
/** Overrides for control-bar labels and tooltips (i18n / custom verbiage). */
|
|
35
|
+
labels?: Partial<TimelineLabels>;
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
export { TICK_AREA_HEIGHT }
|
|
@@ -115,6 +118,12 @@ export declare interface TimelineProps {
|
|
|
115
118
|
onSwimLaneItemDoubleClick?: (info: SwimLaneEventInfo) => void;
|
|
116
119
|
onSwimLaneItemContextMenu?: (info: SwimLaneEventInfo) => void;
|
|
117
120
|
onSwimLaneReorder?: (orderedLaneIds: string[]) => void;
|
|
121
|
+
/**
|
|
122
|
+
* Overrides for control-bar labels and tooltips.
|
|
123
|
+
* Useful for localisation or custom verbiage — provide only the strings you
|
|
124
|
+
* want to change; everything else falls back to the English defaults.
|
|
125
|
+
*/
|
|
126
|
+
labels?: Partial<TimelineLabels>;
|
|
118
127
|
}
|
|
119
128
|
|
|
120
129
|
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.6.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.6.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/react": "19.0.1",
|