Files
lcp-visualizer/blocks/bar-graph/build/index.js
2025-01-16 00:11:34 -08:00

1 line
121 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(()=>{"use strict";var t,e={301:(t,e,n)=>{var r={};n.r(r),n.d(r,{FILE:()=>Wt,HTML:()=>Jt,TEXT:()=>Kt,URL:()=>zt});const i=window.wp.blocks,o=window.wp.i18n,a=window.wp.blockEditor,s=window.wp.components,l=window.wp.element;function c(t,e,...n){if("undefined"!=typeof process&&void 0===e)throw new Error("invariant requires an error message argument");if(!t){let t;if(void 0===e)t=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let r=0;t=new Error(e.replace(/%s/g,(function(){return n[r++]}))),t.name="Invariant Violation"}throw t.framesToPop=1,t}}var u=n(792);const h=window.React,d="undefined"!=typeof window?h.useLayoutEffect:h.useEffect;function f(t,e,n){return function(t,e,n){const[r,i]=function(t,e,n){const[r,i]=(0,h.useState)((()=>e(t))),o=(0,h.useCallback)((()=>{const o=e(t);u(r,o)||(i(o),n&&n())}),[r,t,n]);return d(o),[r,o]}(t,e,n);return d((function(){const e=t.getHandlerId();if(null!=e)return t.subscribeToStateChange(i,{handlerIds:[e]})}),[t,i]),r}(e,t||(()=>({})),(()=>n.reconnect()))}function g(t,e){const n=[...e||[]];return null==e&&"function"!=typeof t&&n.push(t),(0,h.useMemo)((()=>"function"==typeof t?t():t),n)}function p(t){return(0,h.useMemo)((()=>t.hooks.dragSource()),[t])}function v(t){return(0,h.useMemo)((()=>t.hooks.dragPreview()),[t])}function m(t,e,n,r){let i=n?n.call(r,t,e):void 0;if(void 0!==i)return!!i;if(t===e)return!0;if("object"!=typeof t||!t||"object"!=typeof e||!e)return!1;const o=Object.keys(t),a=Object.keys(e);if(o.length!==a.length)return!1;const s=Object.prototype.hasOwnProperty.bind(e);for(let a=0;a<o.length;a++){const l=o[a];if(!s(l))return!1;const c=t[l],u=e[l];if(i=n?n.call(r,c,u,l):void 0,!1===i||void 0===i&&c!==u)return!1}return!0}function y(t){return null!==t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}function b(t){const e={};return Object.keys(t).forEach((n=>{const r=t[n];if(n.endsWith("Ref"))e[n]=t[n];else{const t=function(t){return(e=null,n=null)=>{if(!(0,h.isValidElement)(e)){const r=e;return t(r,n),r}const r=e;return function(t){if("string"==typeof t.type)return;const e=t.type.displayName||t.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${e} into a <div>, or turn it into a drag source or a drop target itself.`)}(r),function(t,e){const n=t.ref;return c("string"!=typeof n,"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),n?(0,h.cloneElement)(t,{ref:t=>{w(n,t),w(e,t)}}):(0,h.cloneElement)(t,{ref:e})}(r,n?e=>t(e,n):t)}}(r);e[n]=()=>t}})),e}function w(t,e){"function"==typeof t?t(e):t.current=e}class x{receiveHandlerId(t){this.handlerId!==t&&(this.handlerId=t,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(t){this.dragSourceOptionsInternal=t}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(t){this.dragPreviewOptionsInternal=t}reconnect(){const t=this.reconnectDragSource();this.reconnectDragPreview(t)}reconnectDragSource(){const t=this.dragSource,e=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return e&&this.disconnectDragSource(),this.handlerId?t?(e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=t,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,t,this.dragSourceOptions)),e):(this.lastConnectedDragSource=t,e):e}reconnectDragPreview(t=!1){const e=this.dragPreview,n=t||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();n&&this.disconnectDragPreview(),this.handlerId&&(e?n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=e,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,e,this.dragPreviewOptions)):this.lastConnectedDragPreview=e)}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!m(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!m(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(t){this.hooks=b({dragSource:(t,e)=>{this.clearDragSource(),this.dragSourceOptions=e||null,y(t)?this.dragSourceRef=t:this.dragSourceNode=t,this.reconnectDragSource()},dragPreview:(t,e)=>{this.clearDragPreview(),this.dragPreviewOptions=e||null,y(t)?this.dragPreviewRef=t:this.dragPreviewNode=t,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=t}}const _=(0,h.createContext)({dragDropManager:void 0});function C(){const{dragDropManager:t}=(0,h.useContext)(_);return c(null!=t,"Expected drag drop context"),t}let S=!1,O=!1;class D{receiveHandlerId(t){this.sourceId=t}getHandlerId(){return this.sourceId}canDrag(){c(!S,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return S=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{S=!1}}isDragging(){if(!this.sourceId)return!1;c(!O,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return O=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{O=!1}}subscribeToStateChange(t,e){return this.internalMonitor.subscribeToStateChange(t,e)}isDraggingSource(t){return this.internalMonitor.isDraggingSource(t)}isOverTarget(t,e){return this.internalMonitor.isOverTarget(t,e)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(t){return this.internalMonitor.subscribeToOffsetChange(t)}canDragSource(t){return this.internalMonitor.canDragSource(t)}canDropOnTarget(t){return this.internalMonitor.canDropOnTarget(t)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.sourceId=null,this.internalMonitor=t.getMonitor()}}class T{beginDrag(){const t=this.spec,e=this.monitor;let n=null;return n="object"==typeof t.item?t.item:"function"==typeof t.item?t.item(e):{},null!=n?n:null}canDrag(){const t=this.spec,e=this.monitor;return"boolean"==typeof t.canDrag?t.canDrag:"function"!=typeof t.canDrag||t.canDrag(e)}isDragging(t,e){const n=this.spec,r=this.monitor,{isDragging:i}=n;return i?i(r):e===t.getSourceId()}endDrag(){const t=this.spec,e=this.monitor,n=this.connector,{end:r}=t;r&&r(e.getItem(),e),n.reconnect()}constructor(t,e,n){this.spec=t,this.monitor=e,this.connector=n}}function I(t,e){const n=g(t,e);c(!n.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const r=function(){const t=C();return(0,h.useMemo)((()=>new D(t)),[t])}(),i=function(t,e){const n=C(),r=(0,h.useMemo)((()=>new x(n.getBackend())),[n]);return d((()=>(r.dragSourceOptions=t||null,r.reconnect(),()=>r.disconnectDragSource())),[r,t]),d((()=>(r.dragPreviewOptions=e||null,r.reconnect(),()=>r.disconnectDragPreview())),[r,e]),r}(n.options,n.previewOptions);return function(t,e,n){const r=C(),i=function(t,e,n){const r=(0,h.useMemo)((()=>new T(t,e,n)),[e,n]);return(0,h.useEffect)((()=>{r.spec=t}),[t]),r}(t,e,n),o=function(t){return(0,h.useMemo)((()=>{const e=t.type;return c(null!=e,"spec.type must be defined"),e}),[t])}(t);d((function(){if(null!=o){const[t,a]=function(t,e,n){const r=n.getRegistry(),i=r.addSource(t,e);return[i,()=>r.removeSource(i)]}(o,i,r);return e.receiveHandlerId(t),n.receiveHandlerId(t),a}}),[r,e,n,i,o])}(n,r,i),[f(n.collect,r,i),p(i),v(i)]}function E(t){return(0,h.useMemo)((()=>t.hooks.dropTarget()),[t])}class k{get connectTarget(){return this.dropTarget}reconnect(){const t=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();t&&this.disconnectDropTarget();const e=this.dropTarget;this.handlerId&&(e?t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=e,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,e,this.dropTargetOptions)):this.lastConnectedDropTarget=e)}receiveHandlerId(t){t!==this.handlerId&&(this.handlerId=t,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(t){this.dropTargetOptionsInternal=t}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!m(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(t){this.hooks=b({dropTarget:(t,e)=>{this.clearDropTarget(),this.dropTargetOptions=e,y(t)?this.dropTargetRef=t:this.dropTargetNode=t,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=t}}let N=!1;class j{receiveHandlerId(t){this.targetId=t}getHandlerId(){return this.targetId}subscribeToStateChange(t,e){return this.internalMonitor.subscribeToStateChange(t,e)}canDrop(){if(!this.targetId)return!1;c(!N,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return N=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{N=!1}}isOver(t){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,t)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.targetId=null,this.internalMonitor=t.getMonitor()}}class M{canDrop(){const t=this.spec,e=this.monitor;return!t.canDrop||t.canDrop(e.getItem(),e)}hover(){const t=this.spec,e=this.monitor;t.hover&&t.hover(e.getItem(),e)}drop(){const t=this.spec,e=this.monitor;if(t.drop)return t.drop(e.getItem(),e)}constructor(t,e){this.spec=t,this.monitor=e}}function P(t,e){const n=g(t,e),r=function(){const t=C();return(0,h.useMemo)((()=>new j(t)),[t])}(),i=function(t){const e=C(),n=(0,h.useMemo)((()=>new k(e.getBackend())),[e]);return d((()=>(n.dropTargetOptions=t||null,n.reconnect(),()=>n.disconnectDropTarget())),[t]),n}(n.options);return function(t,e,n){const r=C(),i=function(t,e){const n=(0,h.useMemo)((()=>new M(t,e)),[e]);return(0,h.useEffect)((()=>{n.spec=t}),[t]),n}(t,e),o=function(t){const{accept:e}=t;return(0,h.useMemo)((()=>(c(null!=t.accept,"accept must be defined"),Array.isArray(e)?e:[e])),[e])}(t);d((function(){const[t,a]=function(t,e,n){const r=n.getRegistry(),i=r.addTarget(t,e);return[i,()=>r.removeTarget(i)]}(o,i,r);return e.receiveHandlerId(t),n.receiveHandlerId(t),a}),[r,e,i,n,o.map((t=>t.toString())).join("|")])}(n,r,i),[f(n.collect,r,i),E(i)]}const A=window.ReactJSXRuntime;function R(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var L="function"==typeof Symbol&&Symbol.observable||"@@observable",$=function(){return Math.random().toString(36).substring(7).split("").join(".")},H={INIT:"@@redux/INIT"+$(),REPLACE:"@@redux/REPLACE"+$(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+$()}};function B(t,e,n){var r;if("function"==typeof e&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(R(0));if("function"==typeof e&&void 0===n&&(n=e,e=void 0),void 0!==n){if("function"!=typeof n)throw new Error(R(1));return n(B)(t,e)}if("function"!=typeof t)throw new Error(R(2));var i=t,o=e,a=[],s=a,l=!1;function c(){s===a&&(s=a.slice())}function u(){if(l)throw new Error(R(3));return o}function h(t){if("function"!=typeof t)throw new Error(R(4));if(l)throw new Error(R(5));var e=!0;return c(),s.push(t),function(){if(e){if(l)throw new Error(R(6));e=!1,c();var n=s.indexOf(t);s.splice(n,1),a=null}}}function d(t){if(!function(t){if("object"!=typeof t||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}(t))throw new Error(R(7));if(void 0===t.type)throw new Error(R(8));if(l)throw new Error(R(9));try{l=!0,o=i(o,t)}finally{l=!1}for(var e=a=s,n=0;n<e.length;n++)(0,e[n])();return t}return d({type:H.INIT}),(r={dispatch:d,subscribe:h,getState:u,replaceReducer:function(t){if("function"!=typeof t)throw new Error(R(10));i=t,d({type:H.REPLACE})}})[L]=function(){var t,e=h;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(R(11));function n(){t.next&&t.next(u())}return n(),{unsubscribe:e(n)}}})[L]=function(){return this},t},r}function U(t){return"object"==typeof t}const F="dnd-core/INIT_COORDS",V="dnd-core/BEGIN_DRAG",G="dnd-core/PUBLISH_DRAG_SOURCE",X="dnd-core/HOVER",q="dnd-core/DROP",Y="dnd-core/END_DRAG";function W(t,e){return{type:F,payload:{sourceClientOffset:e||null,clientOffset:t||null}}}const z={type:F,payload:{clientOffset:null,sourceClientOffset:null}};function K(t){return function(e=[],n={publishSource:!0}){const{publishSource:r=!0,clientOffset:i,getSourceClientOffset:o}=n,a=t.getMonitor(),s=t.getRegistry();t.dispatch(W(i)),function(t,e,n){c(!e.isDragging(),"Cannot call beginDrag while dragging."),t.forEach((function(t){c(n.getSource(t),"Expected sourceIds to be registered.")}))}(e,a,s);const l=function(t,e){let n=null;for(let r=t.length-1;r>=0;r--)if(e.canDragSource(t[r])){n=t[r];break}return n}(e,a);if(null==l)return void t.dispatch(z);let u=null;if(i){if(!o)throw new Error("getSourceClientOffset must be defined");!function(t){c("function"==typeof t,"When clientOffset is provided, getSourceClientOffset must be a function.")}(o),u=o(l)}t.dispatch(W(i,u));const h=s.getSource(l).beginDrag(a,l);if(null==h)return;!function(t){c(U(t),"Item must be an object.")}(h),s.pinSource(l);const d=s.getSourceType(l);return{type:V,payload:{itemType:d,item:h,sourceId:l,clientOffset:i||null,sourceClientOffset:u||null,isSourcePublic:!!r}}}}function J(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Z(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){J(t,e,n[e])}))}return t}function Q(t){return function(e={}){const n=t.getMonitor(),r=t.getRegistry();!function(t){c(t.isDragging(),"Cannot call drop while not dragging."),c(!t.didDrop(),"Cannot call drop twice during one drag operation.")}(n);const i=function(t){const e=t.getTargetIds().filter(t.canDropOnTarget,t);return e.reverse(),e}(n);i.forEach(((i,o)=>{const a=function(t,e,n,r){const i=n.getTarget(t);let o=i?i.drop(r,t):void 0;return function(t){c(void 0===t||U(t),"Drop result must either be an object or undefined.")}(o),void 0===o&&(o=0===e?{}:r.getDropResult()),o}(i,o,r,n),s={type:q,payload:{dropResult:Z({},e,a)}};t.dispatch(s)}))}}function tt(t){return function(){const e=t.getMonitor(),n=t.getRegistry();!function(t){c(t.isDragging(),"Cannot call endDrag while not dragging.")}(e);const r=e.getSourceId();return null!=r&&(n.getSource(r,!0).endDrag(e,r),n.unpinSource()),{type:Y}}}function et(t,e){return null===e?null===t:Array.isArray(t)?t.some((t=>t===e)):t===e}function nt(t){return function(e,{clientOffset:n}={}){!function(t){c(Array.isArray(t),"Expected targetIds to be an array.")}(e);const r=e.slice(0),i=t.getMonitor(),o=t.getRegistry();return function(t,e,n){for(let r=t.length-1;r>=0;r--){const i=t[r];et(e.getTargetType(i),n)||t.splice(r,1)}}(r,o,i.getItemType()),function(t,e,n){c(e.isDragging(),"Cannot call hover while not dragging."),c(!e.didDrop(),"Cannot call hover after drop.");for(let e=0;e<t.length;e++){const r=t[e];c(t.lastIndexOf(r)===e,"Expected targetIds to be unique in the passed array."),c(n.getTarget(r),"Expected targetIds to be registered.")}}(r,i,o),function(t,e,n){t.forEach((function(t){n.getTarget(t).hover(e,t)}))}(r,i,o),{type:X,payload:{targetIds:r,clientOffset:n||null}}}}function rt(t){return function(){if(t.getMonitor().isDragging())return{type:G}}}class it{receiveBackend(t){this.backend=t}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const t=this,{dispatch:e}=this.store,n=function(t){return{beginDrag:K(t),publishDragSource:rt(t),hover:nt(t),drop:Q(t),endDrag:tt(t)}}(this);return Object.keys(n).reduce(((r,i)=>{const o=n[i];var a;return r[i]=(a=o,(...n)=>{const r=a.apply(t,n);void 0!==r&&e(r)}),r}),{})}dispatch(t){this.store.dispatch(t)}constructor(t,e){this.isSetUp=!1,this.handleRefCountChange=()=>{const t=this.store.getState().refCount>0;this.backend&&(t&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!t&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=t,this.monitor=e,t.subscribe(this.handleRefCountChange)}}function ot(t,e){return{x:t.x-e.x,y:t.y-e.y}}const at=[],st=[];at.__IS_NONE__=!0,st.__IS_ALL__=!0;class lt{subscribeToStateChange(t,e={}){const{handlerIds:n}=e;c("function"==typeof t,"listener must be a function."),c(void 0===n||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");let r=this.store.getState().stateId;return this.store.subscribe((()=>{const e=this.store.getState(),i=e.stateId;try{const o=i===r||i===r+1&&!function(t,e){return t!==at&&(t===st||void 0===e||(n=t,e.filter((t=>n.indexOf(t)>-1))).length>0);var n}(e.dirtyHandlerIds,n);o||t()}finally{r=i}}))}subscribeToOffsetChange(t){c("function"==typeof t,"listener must be a function.");let e=this.store.getState().dragOffset;return this.store.subscribe((()=>{const n=this.store.getState().dragOffset;n!==e&&(e=n,t())}))}canDragSource(t){if(!t)return!1;const e=this.registry.getSource(t);return c(e,`Expected to find a valid source. sourceId=${t}`),!this.isDragging()&&e.canDrag(this,t)}canDropOnTarget(t){if(!t)return!1;const e=this.registry.getTarget(t);return c(e,`Expected to find a valid target. targetId=${t}`),!(!this.isDragging()||this.didDrop())&&(et(this.registry.getTargetType(t),this.getItemType())&&e.canDrop(this,t))}isDragging(){return Boolean(this.getItemType())}isDraggingSource(t){if(!t)return!1;const e=this.registry.getSource(t,!0);return c(e,`Expected to find a valid source. sourceId=${t}`),!(!this.isDragging()||!this.isSourcePublic())&&(this.registry.getSourceType(t)===this.getItemType()&&e.isDragging(this,t))}isOverTarget(t,e={shallow:!1}){if(!t)return!1;const{shallow:n}=e;if(!this.isDragging())return!1;const r=this.registry.getTargetType(t),i=this.getItemType();if(i&&!et(r,i))return!1;const o=this.getTargetIds();if(!o.length)return!1;const a=o.indexOf(t);return n?a===o.length-1:a>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return Boolean(this.store.getState().dragOperation.isSourcePublic)}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return function(t){const{clientOffset:e,initialClientOffset:n,initialSourceClientOffset:r}=t;return e&&n&&r?ot((o=r,{x:(i=e).x+o.x,y:i.y+o.y}),n):null;var i,o}(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return function(t){const{clientOffset:e,initialClientOffset:n}=t;return e&&n?ot(e,n):null}(this.store.getState().dragOffset)}constructor(t,e){this.store=t,this.registry=e}}const ct="undefined"!=typeof global?global:self,ut=ct.MutationObserver||ct.WebKitMutationObserver;function ht(t){return function(){const e=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(e),clearInterval(n),t()}}}const dt="function"==typeof ut?function(t){let e=1;const n=new ut(t),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){e=-e,r.data=e}}:ht;class ft{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,e){this.onError=t,this.release=e,this.task=null}}const gt=new class{enqueueTask(t){const{queue:e,requestFlush:n}=this;e.length||(n(),this.flushing=!0),e[e.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const e=this.index;if(this.index++,t[e].call(),this.index>this.capacity){for(let e=0,n=t.length-this.index;e<n;e++)t[e]=t[e+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=dt(this.flush),this.requestErrorThrow=ht((()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()}))}},pt=new class{create(t){const e=this.freeTasks,n=e.length?e.pop():new ft(this.onError,(t=>e[e.length]=t));return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}(gt.registerPendingError),vt="dnd-core/ADD_SOURCE",mt="dnd-core/ADD_TARGET",yt="dnd-core/REMOVE_SOURCE",bt="dnd-core/REMOVE_TARGET";function wt(t,e){e&&Array.isArray(t)?t.forEach((t=>wt(t,!1))):c("string"==typeof t||"symbol"==typeof t,e?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var xt;!function(t){t.SOURCE="SOURCE",t.TARGET="TARGET"}(xt||(xt={}));let _t=0;function Ct(t){switch(t[0]){case"S":return xt.SOURCE;case"T":return xt.TARGET;default:throw new Error(`Cannot parse handler ID: ${t}`)}}function St(t,e){const n=t.entries();let r=!1;do{const{done:t,value:[,i]}=n.next();if(i===e)return!0;r=!!t}while(!r);return!1}class Ot{addSource(t,e){wt(t),function(t){c("function"==typeof t.canDrag,"Expected canDrag to be a function."),c("function"==typeof t.beginDrag,"Expected beginDrag to be a function."),c("function"==typeof t.endDrag,"Expected endDrag to be a function.")}(e);const n=this.addHandler(xt.SOURCE,t,e);return this.store.dispatch(function(t){return{type:vt,payload:{sourceId:t}}}(n)),n}addTarget(t,e){wt(t,!0),function(t){c("function"==typeof t.canDrop,"Expected canDrop to be a function."),c("function"==typeof t.hover,"Expected hover to be a function."),c("function"==typeof t.drop,"Expected beginDrag to be a function.")}(e);const n=this.addHandler(xt.TARGET,t,e);return this.store.dispatch(function(t){return{type:mt,payload:{targetId:t}}}(n)),n}containsHandler(t){return St(this.dragSources,t)||St(this.dropTargets,t)}getSource(t,e=!1){return c(this.isSourceId(t),"Expected a valid source ID."),e&&t===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(t)}getTarget(t){return c(this.isTargetId(t),"Expected a valid target ID."),this.dropTargets.get(t)}getSourceType(t){return c(this.isSourceId(t),"Expected a valid source ID."),this.types.get(t)}getTargetType(t){return c(this.isTargetId(t),"Expected a valid target ID."),this.types.get(t)}isSourceId(t){return Ct(t)===xt.SOURCE}isTargetId(t){return Ct(t)===xt.TARGET}removeSource(t){var e;c(this.getSource(t),"Expected an existing source."),this.store.dispatch(function(t){return{type:yt,payload:{sourceId:t}}}(t)),e=()=>{this.dragSources.delete(t),this.types.delete(t)},gt.enqueueTask(pt.create(e))}removeTarget(t){c(this.getTarget(t),"Expected an existing target."),this.store.dispatch(function(t){return{type:bt,payload:{targetId:t}}}(t)),this.dropTargets.delete(t),this.types.delete(t)}pinSource(t){const e=this.getSource(t);c(e,"Expected an existing source."),this.pinnedSourceId=t,this.pinnedSource=e}unpinSource(){c(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(t,e,n){const r=function(t){const e=(_t++).toString();switch(t){case xt.SOURCE:return`S${e}`;case xt.TARGET:return`T${e}`;default:throw new Error(`Unknown Handler Role: ${t}`)}}(t);return this.types.set(r,e),t===xt.SOURCE?this.dragSources.set(r,n):t===xt.TARGET&&this.dropTargets.set(r,n),r}constructor(t){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=t}}const Dt=(t,e)=>t===e;function Tt(t=at,e){switch(e.type){case X:break;case vt:case mt:case bt:case yt:return at;default:return st}const{targetIds:n=[],prevTargetIds:r=[]}=e.payload,i=function(t,e){const n=new Map,r=t=>{n.set(t,n.has(t)?n.get(t)+1:1)};t.forEach(r),e.forEach(r);const i=[];return n.forEach(((t,e)=>{1===t&&i.push(e)})),i}(n,r);if(!(i.length>0)&&function(t,e,n=Dt){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!n(t[r],e[r]))return!1;return!0}(n,r))return at;const o=r[r.length-1],a=n[n.length-1];return o!==a&&(o&&i.push(o),a&&i.push(a)),i}function It(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const Et={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function kt(t=Et,e){const{payload:n}=e;switch(e.type){case F:case V:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case X:return r=t.clientOffset,i=n.clientOffset,!r&&!i||r&&i&&r.x===i.x&&r.y===i.y?t:function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){It(t,e,n[e])}))}return t}({},t,{clientOffset:n.clientOffset});case Y:case q:return Et;default:return t}var r,i}function Nt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function jt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){Nt(t,e,n[e])}))}return t}const Mt={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Pt(t=Mt,e){const{payload:n}=e;switch(e.type){case V:return jt({},t,{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case G:return jt({},t,{isSourcePublic:!0});case X:return jt({},t,{targetIds:n.targetIds});case bt:return-1===t.targetIds.indexOf(n.targetId)?t:jt({},t,{targetIds:(r=t.targetIds,i=n.targetId,r.filter((t=>t!==i)))});case q:return jt({},t,{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case Y:return jt({},t,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return t}var r,i}function At(t=0,e){switch(e.type){case vt:case mt:return t+1;case yt:case bt:return t-1;default:return t}}function Rt(t=0){return t+1}function Lt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $t(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){Lt(t,e,n[e])}))}return t}function Ht(t={},e){return{dirtyHandlerIds:Tt(t.dirtyHandlerIds,{type:e.type,payload:$t({},e.payload,{prevTargetIds:(n=t,r=[],"dragOperation.targetIds".split(".").reduce(((t,e)=>t&&t[e]?t[e]:r||null),n))})}),dragOffset:kt(t.dragOffset,e),refCount:At(t.refCount,e),dragOperation:Pt(t.dragOperation,e),stateId:Rt(t.stateId)};var n,r}function Bt(t,e=void 0,n={},r=!1){const i=function(t){const e="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return B(Ht,t&&e&&e({name:"dnd-core",instanceId:"dnd-core"}))}(r),o=new lt(i,new Ot(i)),a=new it(i,o),s=t(a,e,n);return a.receiveBackend(s),a}let Ut=0;const Ft=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var Vt=(0,h.memo)((function(t){var{children:e}=t,n=function(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}(t,["children"]);const[r,i]=function(t){if("manager"in t)return[{dragDropManager:t.manager},!1];return[function(t,e=Gt(),n,r){const i=e;return i[Ft]||(i[Ft]={dragDropManager:Bt(t,e,n,r)}),i[Ft]}(t.backend,t.context,t.options,t.debugMode),!t.context]}(n);return(0,h.useEffect)((()=>{if(i){const t=Gt();return++Ut,()=>{0==--Ut&&(t[Ft]=null)}}}),[]),(0,A.jsx)(_.Provider,{value:r,children:e})}));function Gt(){return"undefined"!=typeof global?global:window}function Xt(t){let e=null;return()=>(null==e&&(e=t()),e)}class qt{enter(t){const e=this.entered.length;return this.entered=function(t,e){const n=new Set,r=t=>n.add(t);t.forEach(r),e.forEach(r);const i=[];return n.forEach((t=>i.push(t))),i}(this.entered.filter((e=>this.isNodeInDocument(e)&&(!e.contains||e.contains(t)))),[t]),0===e&&this.entered.length>0}leave(t){const e=this.entered.length;var n,r;return this.entered=(n=this.entered.filter(this.isNodeInDocument),r=t,n.filter((t=>t!==r))),e>0&&0===this.entered.length}reset(){this.entered=[]}constructor(t){this.entered=[],this.isNodeInDocument=t}}class Yt{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach((t=>{Object.defineProperty(this.item,t,{configurable:!0,enumerable:!0,get:()=>(console.warn(`Browser doesn't allow reading "${t}" until the drop event.`),null)})}))}loadDataTransfer(t){if(t){const e={};Object.keys(this.config.exposeProperties).forEach((n=>{const r=this.config.exposeProperties[n];null!=r&&(e[n]={value:r(t,this.config.matchesTypes),configurable:!0,enumerable:!0})})),Object.defineProperties(this.item,e)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(t,e){return e===t.getSourceId()}endDrag(){}constructor(t){this.config=t,this.item={},this.initializeExposedProperties()}}const Wt="__NATIVE_FILE__",zt="__NATIVE_URL__",Kt="__NATIVE_TEXT__",Jt="__NATIVE_HTML__";function Zt(t,e,n){const r=e.reduce(((e,n)=>e||t.getData(n)),"");return null!=r?r:n}const Qt={[Wt]:{exposeProperties:{files:t=>Array.prototype.slice.call(t.files),items:t=>t.items,dataTransfer:t=>t},matchesTypes:["Files"]},[Jt]:{exposeProperties:{html:(t,e)=>Zt(t,e,""),dataTransfer:t=>t},matchesTypes:["Html","text/html"]},[zt]:{exposeProperties:{urls:(t,e)=>Zt(t,e,"").split("\n"),dataTransfer:t=>t},matchesTypes:["Url","text/uri-list"]},[Kt]:{exposeProperties:{text:(t,e)=>Zt(t,e,""),dataTransfer:t=>t},matchesTypes:["Text","text/plain"]}};function te(t){if(!t)return null;const e=Array.prototype.slice.call(t.types||[]);return Object.keys(Qt).filter((t=>{const n=Qt[t];return!!(null==n?void 0:n.matchesTypes)&&n.matchesTypes.some((t=>e.indexOf(t)>-1))}))[0]||null}const ee=Xt((()=>/firefox/i.test(navigator.userAgent))),ne=Xt((()=>Boolean(window.safari)));class re{interpolate(t){const{xs:e,ys:n,c1s:r,c2s:i,c3s:o}=this;let a=e.length-1;if(t===e[a])return n[a];let s,l=0,c=o.length-1;for(;l<=c;){s=Math.floor(.5*(l+c));const r=e[s];if(r<t)l=s+1;else{if(!(r>t))return n[s];c=s-1}}a=Math.max(0,c);const u=t-e[a],h=u*u;return n[a]+r[a]*u+i[a]*h+o[a]*u*h}constructor(t,e){const{length:n}=t,r=[];for(let t=0;t<n;t++)r.push(t);r.sort(((e,n)=>t[e]<t[n]?-1:1));const i=[],o=[],a=[];let s,l;for(let r=0;r<n-1;r++)s=t[r+1]-t[r],l=e[r+1]-e[r],o.push(s),i.push(l),a.push(l/s);const c=[a[0]];for(let t=0;t<o.length-1;t++){const e=a[t],n=a[t+1];if(e*n<=0)c.push(0);else{s=o[t];const r=o[t+1],i=s+r;c.push(3*i/((i+r)/e+(i+s)/n))}}c.push(a[a.length-1]);const u=[],h=[];let d;for(let t=0;t<c.length-1;t++){d=a[t];const e=c[t],n=1/o[t],r=e+c[t+1]-d-d;u.push((d-e-r)*n),h.push(r*n*n)}this.xs=t,this.ys=e,this.c1s=c,this.c2s=u,this.c3s=h}}function ie(t){const e=1===t.nodeType?t:t.parentElement;if(!e)return null;const{top:n,left:r}=e.getBoundingClientRect();return{x:r,y:n}}function oe(t){return{x:t.clientX,y:t.clientY}}class ae{get window(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}get document(){var t;return(null===(t=this.globalContext)||void 0===t?void 0:t.document)?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var t;return(null===(t=this.optionsArgs)||void 0===t?void 0:t.rootElement)||this.window}constructor(t,e){this.ownerDocument=null,this.globalContext=t,this.optionsArgs=e}}function se(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function le(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){se(t,e,n[e])}))}return t}class ce{profile(){var t,e;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null===(t=this.dragStartSourceIds)||void 0===t?void 0:t.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null===(e=this.dragOverTargetIds)||void 0===e?void 0:e.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){const t=this.rootElement;if(void 0!==t){if(t.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");t.__isReactDndBackendSetUp=!0,this.addEventListeners(t)}}teardown(){const t=this.rootElement;var e;void 0!==t&&(t.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&(null===(e=this.window)||void 0===e||e.cancelAnimationFrame(this.asyncEndDragFrameId)))}connectDragPreview(t,e,n){return this.sourcePreviewNodeOptions.set(t,n),this.sourcePreviewNodes.set(t,e),()=>{this.sourcePreviewNodes.delete(t),this.sourcePreviewNodeOptions.delete(t)}}connectDragSource(t,e,n){this.sourceNodes.set(t,e),this.sourceNodeOptions.set(t,n);const r=e=>this.handleDragStart(e,t),i=t=>this.handleSelectStart(t);return e.setAttribute("draggable","true"),e.addEventListener("dragstart",r),e.addEventListener("selectstart",i),()=>{this.sourceNodes.delete(t),this.sourceNodeOptions.delete(t),e.removeEventListener("dragstart",r),e.removeEventListener("selectstart",i),e.setAttribute("draggable","false")}}connectDropTarget(t,e){const n=e=>this.handleDragEnter(e,t),r=e=>this.handleDragOver(e,t),i=e=>this.handleDrop(e,t);return e.addEventListener("dragenter",n),e.addEventListener("dragover",r),e.addEventListener("drop",i),()=>{e.removeEventListener("dragenter",n),e.removeEventListener("dragover",r),e.removeEventListener("drop",i)}}addEventListeners(t){t.addEventListener&&(t.addEventListener("dragstart",this.handleTopDragStart),t.addEventListener("dragstart",this.handleTopDragStartCapture,!0),t.addEventListener("dragend",this.handleTopDragEndCapture,!0),t.addEventListener("dragenter",this.handleTopDragEnter),t.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.addEventListener("dragover",this.handleTopDragOver),t.addEventListener("dragover",this.handleTopDragOverCapture,!0),t.addEventListener("drop",this.handleTopDrop),t.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(t){t.removeEventListener&&(t.removeEventListener("dragstart",this.handleTopDragStart),t.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),t.removeEventListener("dragend",this.handleTopDragEndCapture,!0),t.removeEventListener("dragenter",this.handleTopDragEnter),t.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.removeEventListener("dragover",this.handleTopDragOver),t.removeEventListener("dragover",this.handleTopDragOverCapture,!0),t.removeEventListener("drop",this.handleTopDrop),t.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const t=this.monitor.getSourceId(),e=this.sourceNodeOptions.get(t);return le({dropEffect:this.altKeyPressed?"copy":"move"},e||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const t=this.monitor.getSourceId();return le({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(t)||{})}isDraggingNativeItem(){const t=this.monitor.getItemType();return Object.keys(r).some((e=>r[e]===t))}beginDragNativeItem(t,e){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(t,e){const n=Qt[t];if(!n)throw new Error(`native type ${t} has no configuration`);const r=new Yt(n);return r.loadDataTransfer(e),r}(t,e),this.currentNativeHandle=this.registry.addSource(t,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(t){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=t,this.mouseMoveTimeoutTimer=setTimeout((()=>{var t;return null===(t=this.rootElement)||void 0===t?void 0:t.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}),1e3)}clearCurrentDragSourceNode(){var t;return!!this.currentDragSourceNode&&(this.currentDragSourceNode=null,this.rootElement&&(null===(t=this.window)||void 0===t||t.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0)}handleDragStart(t,e){t.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(e))}handleDragEnter(t,e){this.dragEnterTargetIds.unshift(e)}handleDragOver(t,e){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(e)}handleDrop(t,e){this.dropTargetIds.unshift(e)}constructor(t,e,n){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=t=>{const e=this.sourceNodes.get(t);return e&&ie(e)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=t=>Boolean(t&&this.document&&this.document.body&&this.document.body.contains(t)),this.endDragIfSourceWasRemovedFromDOM=()=>{const t=this.currentDragSourceNode;null==t||this.isNodeInDocument(t)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=t=>{null===this.hoverRafId&&"undefined"!=typeof requestAnimationFrame&&(this.hoverRafId=requestAnimationFrame((()=>{this.monitor.isDragging()&&this.actions.hover(t||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null})))},this.cancelHover=()=>{null!==this.hoverRafId&&"undefined"!=typeof cancelAnimationFrame&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=t=>{if(t.defaultPrevented)return;const{dragStartSourceIds:e}=this;this.dragStartSourceIds=null;const n=oe(t);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(e||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:n});const{dataTransfer:r}=t,i=te(r);if(this.monitor.isDragging()){if(r&&"function"==typeof r.setDragImage){const t=this.monitor.getSourceId(),e=this.sourceNodes.get(t),i=this.sourcePreviewNodes.get(t)||e;if(i){const{anchorX:t,anchorY:o,offsetX:a,offsetY:s}=this.getCurrentSourcePreviewNodeOptions(),l=function(t,e,n,r,i){const o="IMG"===(m=e).nodeName&&(ee()||!(null===(y=document.documentElement)||void 0===y?void 0:y.contains(m))),a=ie(o?t:e),s={x:n.x-a.x,y:n.y-a.y},{offsetWidth:l,offsetHeight:c}=t,{anchorX:u,anchorY:h}=r,{dragPreviewWidth:d,dragPreviewHeight:f}=function(t,e,n,r){let i=t?e.width:n,o=t?e.height:r;return ne()&&t&&(o/=window.devicePixelRatio,i/=window.devicePixelRatio),{dragPreviewWidth:i,dragPreviewHeight:o}}(o,e,l,c),{offsetX:g,offsetY:p}=i,v=0===p||p;var m,y;return{x:0===g||g?g:new re([0,.5,1],[s.x,s.x/l*d,s.x+d-l]).interpolate(u),y:v?p:(()=>{let t=new re([0,.5,1],[s.y,s.y/c*f,s.y+f-c]).interpolate(h);return ne()&&o&&(t+=(window.devicePixelRatio-1)*f),t})()}}(e,i,n,{anchorX:t,anchorY:o},{offsetX:a,offsetY:s});r.setDragImage(i,l.x,l.y)}}try{null==r||r.setData("application/json",{})}catch(t){}this.setCurrentDragSourceNode(t.target);const{captureDraggingState:e}=this.getCurrentSourcePreviewNodeOptions();e?this.actions.publishDragSource():setTimeout((()=>this.actions.publishDragSource()),0)}else if(i)this.beginDragNativeItem(i);else{if(r&&!r.types&&(t.target&&!t.target.hasAttribute||!t.target.hasAttribute("draggable")))return;t.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=t=>{var e;if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()&&(null===(e=this.currentNativeSource)||void 0===e||e.loadDataTransfer(t.dataTransfer)),!this.enterLeaveCounter.enter(t.target)||this.monitor.isDragging())return;const{dataTransfer:n}=t,r=te(n);r&&this.beginDragNativeItem(r,n)},this.handleTopDragEnter=t=>{const{dragEnterTargetIds:e}=this;this.dragEnterTargetIds=[],this.monitor.isDragging()&&(this.altKeyPressed=t.altKey,e.length>0&&this.actions.hover(e,{clientOffset:oe(t)}),e.some((t=>this.monitor.canDropOnTarget(t)))&&(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect=this.getCurrentDropEffect())))},this.handleTopDragOverCapture=t=>{var e;this.dragOverTargetIds=[],this.isDraggingNativeItem()&&(null===(e=this.currentNativeSource)||void 0===e||e.loadDataTransfer(t.dataTransfer))},this.handleTopDragOver=t=>{const{dragOverTargetIds:e}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging())return t.preventDefault(),void(t.dataTransfer&&(t.dataTransfer.dropEffect="none"));this.altKeyPressed=t.altKey,this.lastClientOffset=oe(t),this.scheduleHover(e),(e||[]).some((t=>this.monitor.canDropOnTarget(t)))?(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?t.preventDefault():(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=t=>{this.isDraggingNativeItem()&&t.preventDefault(),this.enterLeaveCounter.leave(t.target)&&(this.isDraggingNativeItem()&&setTimeout((()=>this.endDragNativeItem()),0),this.cancelHover())},this.handleTopDropCapture=t=>{var e;this.dropTargetIds=[],this.isDraggingNativeItem()?(t.preventDefault(),null===(e=this.currentNativeSource)||void 0===e||e.loadDataTransfer(t.dataTransfer)):te(t.dataTransfer)&&t.preventDefault(),this.enterLeaveCounter.reset()},this.handleTopDrop=t=>{const{dropTargetIds:e}=this;this.dropTargetIds=[],this.actions.hover(e,{clientOffset:oe(t)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=t=>{const e=t.target;"function"==typeof e.dragDrop&&("INPUT"===e.tagName||"SELECT"===e.tagName||"TEXTAREA"===e.tagName||e.isContentEditable||(t.preventDefault(),e.dragDrop()))},this.options=new ae(e,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new qt(this.isNodeInDocument)}}const ue=function(t,e,n){return new ce(t,e,n)},he="dataset_item",de=({item:t,datasetKey:e,moveItem:n,updateItem:r,items:i})=>{const[a,c]=(0,l.useState)(!1),u=(0,l.useRef)(null),[{isDragging:h},d]=I({type:he,item:{id:t.id,datasetKey:e},collect:t=>({isDragging:t.isDragging()})}),[{isOver:f},g]=P({accept:he,hover(e,r){if(!u.current)return;if(e.id===t.id)return;const i=u.current.getBoundingClientRect(),o=(i.bottom-i.top)/2,a=(i.right-i.left)/2,s=r.getClientOffset();if(!s)return;const l=s.y-i.top,c=s.x-i.left>a&&l>o;n(e.id,t.id,c)},collect:t=>({isOver:t.isOver()})});d(g(u));const p=i.filter((e=>e.parent===t.id)),v={marginLeft:20*(t=>{let e=0,n=i.find((e=>e.id===t));for(;n&&n.parent;)e++,n=i.find((t=>t.id===n.parent));return e})(t.id)+"px",opacity:h?.5:1,cursor:"move",background:f?"#f0f0f0":"white",border:f?"2px dashed #0073aa":"1px solid #e2e4e7",marginBottom:"8px",transition:"all 0.2s ease"};return(0,A.jsxs)("div",{children:[(0,A.jsx)("div",{ref:u,style:v,children:(0,A.jsx)(s.Card,{children:(0,A.jsx)(s.CardBody,{children:(0,A.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[(0,A.jsx)(s.TextControl,{placeholder:(0,o.__)("Label","lcp"),value:t.label,onChange:n=>r(e,t.id,"label",n),style:{flex:2}}),(0,A.jsx)(s.TextControl,{type:"number",placeholder:(0,o.__)("Value","lcp"),value:t.value,onChange:n=>r(e,t.id,"value",parseFloat(n)),style:{flex:1}}),(0,A.jsxs)("div",{style:{position:"relative"},children:[(0,A.jsx)(s.Button,{onClick:()=>c(!0),style:{backgroundColor:t.color,width:"30px",height:"30px",borderRadius:"50%",padding:0,border:"1px solid #ddd"}}),a&&(0,A.jsx)(s.Popover,{onClose:()=>c(!1),position:"bottom center",children:(0,A.jsx)("div",{style:{padding:"10px"},children:(0,A.jsx)(s.ColorPicker,{color:t.color,onChange:n=>r(e,t.id,"color",n),enableAlpha:!1})})})]})]})})})}),p.map((t=>(0,A.jsx)(de,{item:t,datasetKey:e,moveItem:n,updateItem:r,items:i},t.id)))]})},fe=({value:t,onChange:e})=>{const[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(t||{}),c=()=>{const t=`Dataset ${Object.keys(i).length+1}`,n={...i,[t]:[{id:`dataset-${Date.now()}`,label:t,parent:null,value:0,color:"#000000"}]};a(n),e(n)},u=(t,n,r,o)=>{const s={...i,[t]:i[t].map((t=>t.id===n?{...t,[r]:o}:t))};a(s),e(s)},h=(t,n,r)=>{const o=Object.keys(i).find((e=>i[e].some((e=>e.id===t))));if(!o)return;const s=[...i[o]],l=s.find((e=>e.id===t)),c=s.find((t=>t.id===n));if(!l||!c)return;let u=c;for(;u.parent;){if(u.parent===t)return;u=s.find((t=>t.id===u.parent))}l.parent=r?n:c.parent;const h={...i,[o]:s};a(h),e(h)};return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(s.Button,{variant:"primary",onClick:()=>{r(!0),0===Object.keys(i).length&&c()},children:(0,o.__)("Open Dataset Builder","lcp")}),n&&(0,A.jsx)(s.Modal,{title:(0,o.__)("Dataset Builder","lcp"),onRequestClose:()=>r(!1),style:{width:"90vw"},children:(0,A.jsx)(Vt,{backend:ue,children:(0,A.jsxs)("div",{style:{padding:"20px"},children:[Object.entries(i).map((([t,n])=>(0,A.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,A.jsx)("h3",{children:t}),(0,A.jsx)("div",{children:n.filter((t=>!t.parent)).map((e=>(0,A.jsx)(de,{item:e,datasetKey:t,moveItem:h,updateItem:u,items:n},e.id)))}),(0,A.jsx)(s.Button,{variant:"secondary",onClick:()=>(t=>{const n={id:`item-${Date.now()}`,label:"New Item",parent:null,value:0,color:"#000000"},r={...i,[t]:[...i[t],n]};a(r),e(r)})(t),style:{marginTop:"10px"},children:(0,o.__)("Add Item","lcp")})]},t))),(0,A.jsx)(s.Button,{variant:"primary",onClick:c,style:{marginTop:"20px"},children:(0,o.__)("Add New Dataset","lcp")})]})})})]})},ge=["#FF6384","#36A2EB","#FFCE56","#4BC0C0","#9966FF","#FF9F40","#FF6384","#C9CBCF","#4BC0C0","#FF9F40"],pe=({value:t,onChange:e,dataSource:n,onDataSourceChange:r})=>{const[i,c]=(0,l.useState)(""),[u,h]=(0,l.useState)(""),[d,f]=(0,l.useState)("");(0,l.useEffect)((()=>{if(t&&Object.keys(t).length>0)if("manual_json"===n)h(JSON.stringify(t,null,2));else if("csv_url"===n){const e=t[Object.keys(t)[0]]?.[0]?.sourceUrl;e&&c(e)}}),[]);const g=[{label:(0,o.__)("Manual JSON","lcp"),value:"manual_json"},{label:(0,o.__)("CSV Upload","lcp"),value:"csv_upload"},{label:(0,o.__)("CSV URL","lcp"),value:"csv_url"},{label:(0,o.__)("Dataset Builder","lcp"),value:"dataset_builder"}],p=(t,e="")=>{try{const n=t.split("\n");if(n.length<2)throw new Error("CSV must have at least a header row and one data row");const r=n[0].split(",").map((t=>t.trim()));if(!r.includes("label")||!r.includes("value"))throw new Error('CSV must have "label" and "value" columns');const i={"Dataset 1":n.slice(1).filter((t=>t.trim())).map(((t,n)=>{const i=t.split(",").map((t=>t.trim())),o={};return r.forEach(((t,e)=>{"color"!==t||i[e]?o[t]=i[e]:o[t]=ge[n%ge.length]})),e&&(o.sourceUrl=e),o}))};return f(""),i}catch(t){return f("Error parsing CSV: "+t.message),null}};return(0,A.jsxs)("div",{className:"lcp-data-selector",children:[(0,A.jsx)(s.SelectControl,{label:(0,o.__)("Data Source","lcp"),value:n,options:g,onChange:r}),"dataset_builder"===n&&(0,A.jsx)(fe,{value:t,onChange:t=>{e(t)}}),"manual_json"===n&&(0,A.jsx)(s.TextareaControl,{label:(0,o.__)("JSON Data","lcp"),help:(0,o.__)("Enter datasets with arrays containing objects with label and value properties. Color is optional.","lcp"),value:u,onChange:t=>{h(t);const n=(t=>{try{const e=JSON.parse(t);if("object"!=typeof e||Array.isArray(e))throw new Error("Data must be an object with dataset names as keys");return Object.entries(e).forEach((([t,e])=>{if(!Array.isArray(e))throw new Error(`Dataset "${t}" must be an array`);e.forEach(((e,n)=>{if(!e.label||!e.value)throw new Error(`Item at index ${n} in dataset "${t}" is missing required fields (label or value)`);e.color||(e.color=ge[n%ge.length])}))})),f(""),e}catch(t){return f(t.message),null}})(t);n&&e(n)},placeholder:'{\n "Dataset 1": [\n {\n "label": "Label 1",\n "value": 100,\n "color": "red"\n },\n {\n "label": "Label 2",\n "value": 200\n }\n ],\n "Dataset 2": [\n {\n "label": "Label 3",\n "value": 300,\n "color": "green"\n }\n ]\n}'}),"csv_upload"===n&&(0,A.jsx)(a.MediaUploadCheck,{children:(0,A.jsx)(a.MediaUpload,{onSelect:t=>{const n=t.url;fetch(t.url).then((t=>t.text())).then((t=>{const r=p(t,n);r&&e(r)})).catch((t=>{f("Error reading CSV file: "+t.message)}))},allowedTypes:["text/csv"],render:({open:e})=>(0,A.jsxs)("div",{children:[(0,A.jsx)(s.Button,{onClick:e,isPrimary:!0,children:(0,o.__)("Upload CSV File","lcp")}),t&&Object.keys(t).length>0&&t[Object.keys(t)[0]]?.[0]?.sourceUrl&&(0,A.jsxs)("div",{className:"current-file",style:{marginTop:"10px"},children:[(0,o.__)("Current file:","lcp")," ",t[Object.keys(t)[0]][0].sourceUrl.split("/").pop()]})]})})}),"csv_url"===n&&(0,A.jsx)(s.TextControl,{label:(0,o.__)("CSV URL","lcp"),value:i,onChange:t=>{c(t),t&&fetch(t).then((t=>t.text())).then((n=>{const r=p(n,t);r&&e(r)})).catch((t=>{f("Error fetching CSV file: "+t.message)}))},help:(0,o.__)("Enter URL of a CSV file with label and value columns. Color column is optional.","lcp")}),d&&(0,A.jsx)("div",{className:"lcp-data-selector-error",style:{color:"red",marginTop:"10px"},children:d}),t&&Object.keys(t).length>0&&(0,A.jsxs)("div",{className:"data-preview",style:{marginTop:"15px"},children:[(0,A.jsx)("h4",{children:(0,o.__)("Current Data Preview:","lcp")}),(0,A.jsx)("div",{style:{fontSize:"12px",color:"#666"},children:Object.entries(t).map((([t,e])=>(0,A.jsxs)("div",{children:[t,": ",e.length," ",(0,o.__)("data points","lcp")]},t)))})]})]})};function ve(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}function me(t){return t}var ye=1e-6;function be(t){return"translate("+t+",0)"}function we(t){return"translate(0,"+t+")"}function xe(t){return e=>+t(e)}function _e(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function Ce(){return!this.__axis}function Se(t,e){var n=[],r=null,i=null,o=6,a=6,s=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=1===t||4===t?-1:1,u=4===t||2===t?"x":"y",h=1===t||3===t?be:we;function d(d){var f=null==r?e.ticks?e.ticks.apply(e,n):e.domain():r,g=null==i?e.tickFormat?e.tickFormat.apply(e,n):me:i,p=Math.max(o,0)+s,v=e.range(),m=+v[0]+l,y=+v[v.length-1]+l,b=(e.bandwidth?_e:xe)(e.copy(),l),w=d.selection?d.selection():d,x=w.selectAll(".domain").data([null]),_=w.selectAll(".tick").data(f,e).order(),C=_.exit(),S=_.enter().append("g").attr("class","tick"),O=_.select("line"),D=_.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),_=_.merge(S),O=O.merge(S.append("line").attr("stroke","currentColor").attr(u+"2",c*o)),D=D.merge(S.append("text").attr("fill","currentColor").attr(u,c*p).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),d!==w&&(x=x.transition(d),_=_.transition(d),O=O.transition(d),D=D.transition(d),C=C.transition(d).attr("opacity",ye).attr("transform",(function(t){return isFinite(t=b(t))?h(t+l):this.getAttribute("transform")})),S.attr("opacity",ye).attr("transform",(function(t){var e=this.parentNode.__axis;return h((e&&isFinite(e=e(t))?e:b(t))+l)}))),C.remove(),x.attr("d",4===t||2===t?a?"M"+c*a+","+m+"H"+l+"V"+y+"H"+c*a:"M"+l+","+m+"V"+y:a?"M"+m+","+c*a+"V"+l+"H"+y+"V"+c*a:"M"+m+","+l+"H"+y),_.attr("opacity",1).attr("transform",(function(t){return h(b(t)+l)})),O.attr(u+"2",c*o),D.attr(u,c*p).text(g),w.filter(Ce).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),w.each((function(){this.__axis=b}))}return d.scale=function(t){return arguments.length?(e=t,d):e},d.ticks=function(){return n=Array.from(arguments),d},d.tickArguments=function(t){return arguments.length?(n=null==t?[]:Array.from(t),d):n.slice()},d.tickValues=function(t){return arguments.length?(r=null==t?null:Array.from(t),d):r&&r.slice()},d.tickFormat=function(t){return arguments.length?(i=t,d):i},d.tickSize=function(t){return arguments.length?(o=a=+t,d):o},d.tickSizeInner=function(t){return arguments.length?(o=+t,d):o},d.tickSizeOuter=function(t){return arguments.length?(a=+t,d):a},d.tickPadding=function(t){return arguments.length?(s=+t,d):s},d.offset=function(t){return arguments.length?(l=+t,d):l},d}function Oe(t){return Se(3,t)}function De(t){return Se(4,t)}function Te(){}function Ie(t){return null==t?Te:function(){return this.querySelector(t)}}function Ee(){return[]}function ke(t){return null==t?Ee:function(){return this.querySelectorAll(t)}}function Ne(t){return function(){return this.matches(t)}}function je(t){return function(e){return e.matches(t)}}var Me=Array.prototype.find;function Pe(){return this.firstElementChild}var Ae=Array.prototype.filter;function Re(){return Array.from(this.children)}function Le(t){return new Array(t.length)}function $e(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function He(t,e,n,r,i,o){for(var a,s=0,l=e.length,c=o.length;s<c;++s)(a=e[s])?(a.__data__=o[s],r[s]=a):n[s]=new $e(t,o[s]);for(;s<l;++s)(a=e[s])&&(i[s]=a)}function Be(t,e,n,r,i,o,a){var s,l,c,u=new Map,h=e.length,d=o.length,f=new Array(h);for(s=0;s<h;++s)(l=e[s])&&(f[s]=c=a.call(l,l.__data__,s,e)+"",u.has(c)?i[s]=l:u.set(c,l));for(s=0;s<d;++s)c=a.call(t,o[s],s,o)+"",(l=u.get(c))?(r[s]=l,l.__data__=o[s],u.delete(c)):n[s]=new $e(t,o[s]);for(s=0;s<h;++s)(l=e[s])&&u.get(f[s])===l&&(i[s]=l)}function Ue(t){return t.__data__}function Fe(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Ve(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}$e.prototype={constructor:$e,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var Ge="http://www.w3.org/1999/xhtml";const Xe={svg:"http://www.w3.org/2000/svg",xhtml:Ge,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function qe(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Xe.hasOwnProperty(e)?{space:Xe[e],local:t}:t}function Ye(t){return function(){this.removeAttribute(t)}}function We(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ze(t,e){return function(){this.setAttribute(t,e)}}function Ke(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Je(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function Ze(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Qe(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function tn(t){return function(){this.style.removeProperty(t)}}function en(t,e,n){return function(){this.style.setProperty(t,e,n)}}function nn(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function rn(t,e){return t.style.getPropertyValue(e)||Qe(t).getComputedStyle(t,null).getPropertyValue(e)}function on(t){return function(){delete this[t]}}function an(t,e){return function(){this[t]=e}}function sn(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function ln(t){return t.trim().split(/^|\s+/)}function cn(t){return t.classList||new un(t)}function un(t){this._node=t,this._names=ln(t.getAttribute("class")||"")}function hn(t,e){for(var n=cn(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function dn(t,e){for(var n=cn(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function fn(t){return function(){hn(this,t)}}function gn(t){return function(){dn(this,t)}}function pn(t,e){return function(){(e.apply(this,arguments)?hn:dn)(this,t)}}function vn(){this.textContent=""}function mn(t){return function(){this.textContent=t}}function yn(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function bn(){this.innerHTML=""}function wn(t){return function(){this.innerHTML=t}}function xn(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Cn(){this.nextSibling&&this.parentNode.appendChild(this)}function Sn(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function On(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Ge&&e.documentElement.namespaceURI===Ge?e.createElement(t):e.createElementNS(n,t)}}function Dn(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Tn(t){var e=qe(t);return(e.local?Dn:On)(e)}function In(){return null}function En(){var t=this.parentNode;t&&t.removeChild(this)}function kn(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Nn(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function jn(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r<o;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function Mn(t,e,n){return function(){var r,i=this.__on,o=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var a=0,s=i.length;a<s;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),void(r.value=e);this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function Pn(t,e,n){var r=Qe(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function An(t,e){return function(){return Pn(this,t,e)}}function Rn(t,e){return function(){return Pn(this,t,e.apply(this,arguments))}}un.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Ln=[null];function $n(t,e){this._groups=t,this._parents=e}function Hn(){return new $n([[document.documentElement]],Ln)}$n.prototype=Hn.prototype={constructor:$n,select:function(t){"function"!=typeof t&&(t=Ie(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a,s=e[i],l=s.length,c=r[i]=new Array(l),u=0;u<l;++u)(o=s[u])&&(a=t.call(o,o.__data__,u,s))&&("__data__"in o&&(a.__data__=o.__data__),c[u]=a);return new $n(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return null==(e=t.apply(this,arguments))?[]:Array.isArray(e)?e:Array.from(e);var e}}(t):ke(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a,s=e[o],l=s.length,c=0;c<l;++c)(a=s[c])&&(r.push(t.call(a,a.__data__,c,s)),i.push(a));return new $n(r,i)},selectChild:function(t){return this.select(null==t?Pe:function(t){return function(){return Me.call(this.children,t)}}("function"==typeof t?t:je(t)))},selectChildren:function(t){return this.selectAll(null==t?Re:function(t){return function(){return Ae.call(this.children,t)}}("function"==typeof t?t:je(t)))},filter:function(t){"function"!=typeof t&&(t=Ne(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],c=0;c<s;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&l.push(o);return new $n(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,Ue);var n,r=e?Be:He,i=this._parents,o=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var a=o.length,s=new Array(a),l=new Array(a),c=new Array(a),u=0;u<a;++u){var h=i[u],d=o[u],f=d.length,g=Fe(t.call(h,h&&h.__data__,u,i)),p=g.length,v=l[u]=new Array(p),m=s[u]=new Array(p);r(h,d,v,m,c[u]=new Array(f),g,e);for(var y,b,w=0,x=0;w<p;++w)if(y=v[w]){for(w>=x&&(x=w+1);!(b=m[x])&&++x<p;);y._next=b||null}}return(s=new $n(s,i))._enter=l,s._exit=c,s},enter:function(){return new $n(this._enter||this._groups.map(Le),this._parents)},exit:function(){return new $n(this._exit||this._groups.map(Le),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==n?o.remove():n(o),r&&i?r.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),l=0;l<a;++l)for(var c,u=n[l],h=r[l],d=u.length,f=s[l]=new Array(d),g=0;g<d;++g)(c=u[g]||h[g])&&(f[g]=c);for(;l<i;++l)s[l]=n[l];return new $n(s,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=Ve);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a,s=n[o],l=s.length,c=i[o]=new Array(l),u=0;u<l;++u)(a=s[u])&&(c[u]=a);c.sort(e)}return new $n(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,o=e[n],a=0,s=o.length;a<s;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,e){var n=qe(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?We:Ye:"function"==typeof e?n.local?Ze:Je:n.local?Ke:ze)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?tn:"function"==typeof e?nn:en)(t,e,null==n?"":n)):rn(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?on:"function"==typeof e?sn:an)(t,e)):this.node()[t]},classed:function(t,e){var n=ln(t+"");if(arguments.length<2){for(var r=cn(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?pn:e?fn:gn)(n,e))},text:function(t){return arguments.length?this.each(null==t?vn:("function"==typeof t?yn:mn)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?bn:("function"==typeof t?xn:wn)(t)):this.node().innerHTML},raise:function(){return this.each(Cn)},lower:function(){return this.each(Sn)},append:function(t){var e="function"==typeof t?t:Tn(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:Tn(t),r=null==e?In:"function"==typeof e?e:Ie(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(En)},clone:function(t){return this.select(t?Nn:kn)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=function(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?Mn:jn,r=0;r<a;++r)this.each(s(o[r],e,n));return this}var s=this.node().__on;if(s)for(var l,c=0,u=s.length;c<u;++c)for(r=0,l=s[c];r<a;++r)if((i=o[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Rn:An)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};const Bn=Hn;var Un={value:()=>{}};function Fn(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new Vn(r)}function Vn(t){this._=t}function Gn(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Xn(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Un,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}Vn.prototype=Fn.prototype={constructor:Vn,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=Xn(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Xn(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=Gn(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Vn(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};const qn=Fn;var Yn,Wn,zn=0,Kn=0,Jn=0,Zn=0,Qn=0,tr=0,er="object"==typeof performance&&performance.now?performance:Date,nr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function rr(){return Qn||(nr(ir),Qn=er.now()+tr)}function ir(){Qn=0}function or(){this._call=this._time=this._next=null}function ar(t,e,n){var r=new or;return r.restart(t,e,n),r}function sr(){Qn=(Zn=er.now())+tr,zn=Kn=0;try{!function(){rr(),++zn;for(var t,e=Yn;e;)(t=Qn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--zn}()}finally{zn=0,function(){for(var t,e,n=Yn,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Yn=e);Wn=t,cr(r)}(),Qn=0}}function lr(){var t=er.now(),e=t-Zn;e>1e3&&(tr-=e,Zn=t)}function cr(t){zn||(Kn&&(Kn=clearTimeout(Kn)),t-Qn>24?(t<1/0&&(Kn=setTimeout(sr,t-er.now()-tr)),Jn&&(Jn=clearInterval(Jn))):(Jn||(Zn=er.now(),Jn=setInterval(lr,1e3)),zn=1,nr(sr)))}function ur(t,e,n){var r=new or;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}or.prototype=ar.prototype={constructor:or,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?rr():+n)+(null==e?0:+e),this._next||Wn===this||(Wn?Wn._next=this:Yn=this,Wn=this),this._call=t,this._time=n,cr()},stop:function(){this._call&&(this._call=null,this._time=1/0,cr())}};var hr=qn("start","end","cancel","interrupt"),dr=[];function fr(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(l){var c,u,h,d;if(1!==n.state)return s();for(c in i)if((d=i[c]).name===n.name){if(3===d.state)return ur(o);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete i[c]):+c<e&&(d.state=6,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete i[c])}if(ur((function(){3===n.state&&(n.state=4,n.timer.restart(a,n.delay,n.time),a(l))})),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(h=n.tween.length),c=0,u=-1;c<h;++c)(d=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++u]=d);r.length=u+1}}function a(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(s),n.state=5,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),s())}function s(){for(var r in n.state=6,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=ar((function(t){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=t&&o(t-n.delay)}),0,n.time)}(t,n,{name:e,index:r,group:i,on:hr,tween:dr,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function gr(t,e){var n=vr(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function pr(t,e){var n=vr(t,e);if(n.state>3)throw new Error("too late; already running");return n}function vr(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function mr(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var yr,br=180/Math.PI,wr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function xr(t,e,n,r,i,o){var a,s,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),t*r<e*n&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*br,skewX:Math.atan(l)*br,scaleX:a,scaleY:s}}function _r(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s=[],l=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var l=a.push("translate(",null,e,null,n);s.push({i:l-4,x:mr(t,i)},{i:l-2,x:mr(r,o)})}else(i||o)&&a.push("translate("+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,s,l),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:mr(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,l),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:mr(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,l),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:mr(t,n)},{i:s-2,x:mr(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(t){for(var e,n=-1,r=l.length;++n<r;)s[(e=l[n]).i]=e.x(t);return s.join("")}}}var Cr=_r((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?wr:xr(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),Sr=_r((function(t){return null==t?wr:(yr||(yr=document.createElementNS("http://www.w3.org/2000/svg","g")),yr.setAttribute("transform",t),(t=yr.transform.baseVal.consolidate())?xr((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):wr)}),", ",")",")");function Or(t,e){var n,r;return function(){var i=pr(this,t),o=i.tween;if(o!==n)for(var a=0,s=(r=n=o).length;a<s;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}i.tween=r}}function Dr(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var o=pr(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:e,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=s;break}l===c&&i.push(s)}o.tween=i}}function Tr(t,e,n){var r=t._id;return t.each((function(){var t=pr(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return vr(t,r).value[e]}}function Ir(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Er(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function kr(){}var Nr=.7,jr=1/Nr,Mr="\\s*([+-]?\\d+)\\s*",Pr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ar="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Rr=/^#([0-9a-f]{3,8})$/,Lr=new RegExp(`^rgb\\(${Mr},${Mr},${Mr}\\)$`),$r=new RegExp(`^rgb\\(${Ar},${Ar},${Ar}\\)$`),Hr=new RegExp(`^rgba\\(${Mr},${Mr},${Mr},${Pr}\\)$`),Br=new RegExp(`^rgba\\(${Ar},${Ar},${Ar},${Pr}\\)$`),Ur=new RegExp(`^hsl\\(${Pr},${Ar},${Ar}\\)$`),Fr=new RegExp(`^hsla\\(${Pr},${Ar},${Ar},${Pr}\\)$`),Vr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Gr(){return this.rgb().formatHex()}function Xr(){return this.rgb().formatRgb()}function qr(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Rr.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Yr(e):3===n?new Kr(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Wr(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Wr(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Lr.exec(t))?new Kr(e[1],e[2],e[3],1):(e=$r.exec(t))?new Kr(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Hr.exec(t))?Wr(e[1],e[2],e[3],e[4]):(e=Br.exec(t))?Wr(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ur.exec(t))?ni(e[1],e[2]/100,e[3]/100,1):(e=Fr.exec(t))?ni(e[1],e[2]/100,e[3]/100,e[4]):Vr.hasOwnProperty(t)?Yr(Vr[t]):"transparent"===t?new Kr(NaN,NaN,NaN,0):null}function Yr(t){return new Kr(t>>16&255,t>>8&255,255&t,1)}function Wr(t,e,n,r){return r<=0&&(t=e=n=NaN),new Kr(t,e,n,r)}function zr(t,e,n,r){return 1===arguments.length?((i=t)instanceof kr||(i=qr(i)),i?new Kr((i=i.rgb()).r,i.g,i.b,i.opacity):new Kr):new Kr(t,e,n,null==r?1:r);var i}function Kr(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Jr(){return`#${ei(this.r)}${ei(this.g)}${ei(this.b)}`}function Zr(){const t=Qr(this.opacity);return`${1===t?"rgb(":"rgba("}${ti(this.r)}, ${ti(this.g)}, ${ti(this.b)}${1===t?")":`, ${t})`}`}function Qr(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ti(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ei(t){return((t=ti(t))<16?"0":"")+t.toString(16)}function ni(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ii(t,e,n,r)}function ri(t){if(t instanceof ii)return new ii(t.h,t.s,t.l,t.opacity);if(t instanceof kr||(t=qr(t)),!t)return new ii;if(t instanceof ii)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=l>0&&l<1?0:a,new ii(a,s,l,t.opacity)}function ii(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function oi(t){return(t=(t||0)%360)<0?t+360:t}function ai(t){return Math.max(0,Math.min(1,t||0))}function si(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function li(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}Ir(kr,qr,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Gr,formatHex:Gr,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ri(this).formatHsl()},formatRgb:Xr,toString:Xr}),Ir(Kr,zr,Er(kr,{brighter(t){return t=null==t?jr:Math.pow(jr,t),new Kr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Nr:Math.pow(Nr,t),new Kr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Kr(ti(this.r),ti(this.g),ti(this.b),Qr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Jr,formatHex:Jr,formatHex8:function(){return`#${ei(this.r)}${ei(this.g)}${ei(this.b)}${ei(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Zr,toString:Zr})),Ir(ii,(function(t,e,n,r){return 1===arguments.length?ri(t):new ii(t,e,n,null==r?1:r)}),Er(kr,{brighter(t){return t=null==t?jr:Math.pow(jr,t),new ii(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Nr:Math.pow(Nr,t),new ii(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Kr(si(t>=240?t-240:t+120,i,r),si(t,i,r),si(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new ii(oi(this.h),ai(this.s),ai(this.l),Qr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Qr(this.opacity);return`${1===t?"hsl(":"hsla("}${oi(this.h)}, ${100*ai(this.s)}%, ${100*ai(this.l)}%${1===t?")":`, ${t})`}`}}));const ci=t=>()=>t;function ui(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):ci(isNaN(t)?e:t)}const hi=function t(e){var n=function(t){return 1==(t=+t)?ui:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):ci(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=zr(t)).r,(e=zr(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=ui(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function di(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),s=new Array(i);for(n=0;n<i;++n)r=zr(e[n]),o[n]=r.r||0,a[n]=r.g||0,s[n]=r.b||0;return o=t(o),a=t(a),s=t(s),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=s(t),r+""}}}di((function(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=r<e-1?t[r+2]:2*o-i;return li((n-r/e)*e,a,i,o,s)}})),di((function(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],o=t[r%e],a=t[(r+1)%e],s=t[(r+2)%e];return li((n-r/e)*e,i,o,a,s)}}));var fi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,gi=new RegExp(fi.source,"g");function pi(t,e){var n,r,i,o=fi.lastIndex=gi.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=fi.exec(t))&&(r=gi.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:mr(n,r)})),o=gi.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,r=0;r<e;++r)s[(n=l[r]).i]=n.x(t);return s.join("")})}function vi(t,e){var n;return("number"==typeof e?mr:e instanceof qr?hi:(n=qr(e))?(e=n,hi):pi)(t,e)}function mi(t){return function(){this.removeAttribute(t)}}function yi(t){return function(){this.removeAttributeNS(t.space,t.local)}}function bi(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=e(r=a,n)}}function wi(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=e(r=a,n)}}function xi(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttribute(t))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttribute(t)}}function _i(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttributeNS(t.space,t.local)}}function Ci(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Si(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Oi(t,e){return function(){gr(this,t).delay=+e.apply(this,arguments)}}function Di(t,e){return e=+e,function(){gr(this,t).delay=e}}function Ti(t,e){return function(){pr(this,t).duration=+e.apply(this,arguments)}}function Ii(t,e){return e=+e,function(){pr(this,t).duration=e}}var Ei=Bn.prototype.constructor;function ki(t){return function(){this.style.removeProperty(t)}}var Ni=0;function ji(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Mi(){return++Ni}var Pi=Bn.prototype;ji.prototype=function(t){return Bn().transition(t)}.prototype={constructor:ji,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Ie(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s,l,c=r[a],u=c.length,h=o[a]=new Array(u),d=0;d<u;++d)(s=c[d])&&(l=t.call(s,s.__data__,d,c))&&("__data__"in s&&(l.__data__=s.__data__),h[d]=l,fr(h[d],e,n,d,h,vr(s,n)));return new ji(o,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=ke(t));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var l,c=r[s],u=c.length,h=0;h<u;++h)if(l=c[h]){for(var d,f=t.call(l,l.__data__,h,c),g=vr(l,n),p=0,v=f.length;p<v;++p)(d=f[p])&&fr(d,e,n,p,f,g);o.push(f),a.push(l)}return new ji(o,a,e,n)},selectChild:Pi.selectChild,selectChildren:Pi.selectChildren,filter:function(t){"function"!=typeof t&&(t=Ne(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],c=0;c<s;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&l.push(o);return new ji(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var l,c=e[s],u=n[s],h=c.length,d=a[s]=new Array(h),f=0;f<h;++f)(l=c[f]||u[f])&&(d[f]=l);for(;s<r;++s)a[s]=e[s];return new ji(a,this._parents,this._name,this._id)},selection:function(){return new Ei(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Mi(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,c=0;c<l;++c)if(a=s[c]){var u=vr(a,e);fr(a,t,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new ji(r,this._parents,t,n)},call:Pi.call,nodes:Pi.nodes,node:Pi.node,size:Pi.size,empty:Pi.empty,each:Pi.each,on:function(t,e){var n=this._id;return arguments.length<2?vr(this.node(),n).on.on(t):this.each(function(t,e,n){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?gr:pr;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=qe(t),r="transform"===n?Sr:vi;return this.attrTween(t,"function"==typeof e?(n.local?_i:xi)(n,r,Tr(this,"attr."+t,e)):null==e?(n.local?yi:mi)(n):(n.local?wi:bi)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=qe(t);return this.tween(n,(r.local?Ci:Si)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?Cr:vi;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=rn(this,t),a=(this.style.removeProperty(t),rn(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,ki(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=rn(this,t),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(t),l=s=rn(this,t)),a===l?null:a===r&&l===i?o:(i=l,o=e(r=a,s))}}(t,r,Tr(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var l=pr(this,t),c=l.on,u=null==l.value[a]?o||(o=ki(e)):void 0;c===n&&i===u||(r=(n=c).copy()).on(s,i=u),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=rn(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Tr(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=vr(this.node(),n).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==e?Or:Dr)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Oi:Di)(e,t)):vr(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ti:Ii)(e,t)):vr(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){pr(this,t).ease=e}}(e,t)):vr(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;pr(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise((function(o,a){var s={value:a},l={value:function(){0==--i&&o()}};n.each((function(){var n=pr(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(s),e._.interrupt.push(s),e._.end.push(l)),n.on=e})),0===i&&o()}))},[Symbol.iterator]:Pi[Symbol.iterator]};var Ai={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Ri(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}Bn.prototype.interrupt=function(t){return this.each((function(){!function(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}(this,t)}))},Bn.prototype.transition=function(t){var e,n;t instanceof ji?(e=t._id,t=t._name):(e=Mi(),(n=Ai).time=rr(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,c=0;c<l;++c)(a=s[c])&&fr(a,t,e,c,s,n||Ri(a,e));return new ji(r,this._parents,t,e)};const{abs:Li,max:$i,min:Hi}=Math;function Bi(t){return{type:t}}function Ui(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}["w","e"].map(Bi),["n","s"].map(Bi),["n","w","e","s","nw","ne","sw","se"].map(Bi);class Fi extends Map{constructor(t,e=Gi){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(Vi(this,t))}has(t){return super.has(Vi(this,t))}set(t,e){return super.set(function({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}(this,t),e)}delete(t){return super.delete(function({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}(this,t))}}function Vi({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function Gi(t){return null!==t&&"object"==typeof t?t.valueOf():t}Set;const Xi=Symbol("implicit");function qi(){var t=new Fi,e=[],n=[],r=Xi;function i(i){let o=t.get(i);if(void 0===o){if(r!==Xi)return r;t.set(i,o=e.push(i)-1)}return n[o%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new Fi;for(const r of n)t.has(r)||t.set(r,e.push(r)-1);return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return qi(e,n).unknown(r)},Ui.apply(i,arguments),i}function Yi(){var t,e,n=qi().unknown(void 0),r=n.domain,i=n.range,o=0,a=1,s=!1,l=0,c=0,u=.5;function h(){var n=r().length,h=a<o,d=h?a:o,f=h?o:a;t=(f-d)/Math.max(1,n-l+2*c),s&&(t=Math.floor(t)),d+=(f-d-t*(n-l))*u,e=t*(1-l),s&&(d=Math.round(d),e=Math.round(e));var g=function(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(i);++r<i;)o[r]=t+r*n;return o}(n).map((function(e){return d+t*e}));return i(h?g.reverse():g)}return delete n.unknown,n.domain=function(t){return arguments.length?(r(t),h()):r()},n.range=function(t){return arguments.length?([o,a]=t,o=+o,a=+a,h()):[o,a]},n.rangeRound=function(t){return[o,a]=t,o=+o,a=+a,s=!0,h()},n.bandwidth=function(){return e},n.step=function(){return t},n.round=function(t){return arguments.length?(s=!!t,h()):s},n.padding=function(t){return arguments.length?(l=Math.min(1,c=+t),h()):l},n.paddingInner=function(t){return arguments.length?(l=Math.min(1,t),h()):l},n.paddingOuter=function(t){return arguments.length?(c=+t,h()):c},n.align=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),h()):u},n.copy=function(){return Yi(r(),[o,a]).round(s).paddingInner(l).paddingOuter(c).align(u)},Ui.apply(h(),arguments)}const Wi=Math.sqrt(50),zi=Math.sqrt(10),Ki=Math.sqrt(2);function Ji(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=Wi?10:o>=zi?5:o>=Ki?2:1;let s,l,c;return i<0?(c=Math.pow(10,-i)/a,s=Math.round(t*c),l=Math.round(e*c),s/c<t&&++s,l/c>e&&--l,c=-c):(c=Math.pow(10,i)*a,s=Math.round(t/c),l=Math.round(e/c),s*c<t&&++s,l*c>e&&--l),l<s&&.5<=n&&n<2?Ji(t,e,2*n):[s,l,c]}function Zi(t,e,n){return Ji(t=+t,e=+e,n=+n)[2]}function Qi(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function to(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function eo(t){let e,n,r;function i(t,r,i=0,o=t.length){if(i<o){if(0!==e(r,r))return o;do{const e=i+o>>>1;n(t[e],r)<0?i=e+1:o=e}while(i<o)}return i}return 2!==t.length?(e=Qi,n=(e,n)=>Qi(t(e),n),r=(e,n)=>t(e)-n):(e=t===Qi||t===to?t:no,n=t,r=t),{left:i,center:function(t,e,n=0,o=t.length){const a=i(t,e,n,o-1);return a>n&&r(t[a-1],e)>-r(t[a],e)?a-1:a},right:function(t,r,i=0,o=t.length){if(i<o){if(0!==e(r,r))return o;do{const e=i+o>>>1;n(t[e],r)<=0?i=e+1:o=e}while(i<o)}return i}}}function no(){return 0}const ro=eo(Qi),io=ro.right,oo=(ro.left,eo((function(t){return null===t?NaN:+t})).center,io);function ao(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(n=0;n<i;++n)o[n]=uo(t[n],e[n]);for(;n<r;++n)a[n]=e[n];return function(t){for(n=0;n<i;++n)a[n]=o[n](t);return a}}function so(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function lo(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=uo(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}function co(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(o){for(n=0;n<r;++n)i[n]=t[n]*(1-o)+e[n]*o;return i}}function uo(t,e){var n,r,i=typeof e;return null==e||"boolean"===i?ci(e):("number"===i?mr:"string"===i?(n=qr(e))?(e=n,hi):pi:e instanceof qr?hi:e instanceof Date?so:(r=e,!ArrayBuffer.isView(r)||r instanceof DataView?Array.isArray(e)?ao:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?lo:mr:co))(t,e)}function ho(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function fo(t){return+t}var go=[0,1];function po(t){return t}function vo(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:(n=isNaN(e)?NaN:.5,function(){return n});var n}function mo(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return i<r?(r=vo(i,r),o=n(a,o)):(r=vo(r,i),o=n(o,a)),function(t){return o(r(t))}}function yo(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<r;)i[a]=vo(t[a],t[a+1]),o[a]=n(e[a],e[a+1]);return function(e){var n=oo(t,e,1,r)-1;return o[n](i[n](e))}}var bo,wo=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xo(t){if(!(e=wo.exec(t)))throw new Error("invalid format: "+t);var e;return new _o({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function _o(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Co(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function So(t){return(t=Co(Math.abs(t)))?t[1]:NaN}function Oo(t,e){var n=Co(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}xo.prototype=_o.prototype,_o.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Do={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Oo(100*t,e),r:Oo,s:function(t,e){var n=Co(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(bo=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Co(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function To(t){return t}var Io,Eo,ko,No=Array.prototype.map,jo=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Mo(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){if(!((n=+n)>0))return[];if((t=+t)==(e=+e))return[t];const r=e<t,[i,o,a]=r?Ji(e,t,n):Ji(t,e,n);if(!(o>=i))return[];const s=o-i+1,l=new Array(s);if(r)if(a<0)for(let t=0;t<s;++t)l[t]=(o-t)/-a;else for(let t=0;t<s;++t)l[t]=(o-t)*a;else if(a<0)for(let t=0;t<s;++t)l[t]=(i+t)/-a;else for(let t=0;t<s;++t)l[t]=(i+t)*a;return l}(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return function(t,e,n,r){var i,o=function(t,e,n){n=+n;const r=(e=+e)<(t=+t),i=r?Zi(e,t,n):Zi(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}(t,e,n);switch((r=xo(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(So(e)/3)))-So(Math.abs(t)))}(o,a))||(r.precision=i),ko(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,So(e)-So(t))+1}(o,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-So(Math.abs(t)))}(o))||(r.precision=i-2*("%"===r.type))}return Eo(r)}(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,o=e(),a=0,s=o.length-1,l=o[a],c=o[s],u=10;for(c<l&&(i=l,l=c,c=i,i=a,a=s,s=i);u-- >0;){if((i=Zi(l,c,n))===r)return o[a]=l,o[s]=c,e(o);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i}r=i}return t},t}function Po(){var t=function(){var t,e,n,r,i,o,a=go,s=go,l=uo,c=po;function u(){var t,e,n,l=Math.min(a.length,s.length);return c!==po&&(t=a[0],e=a[l-1],t>e&&(n=t,t=e,e=n),c=function(n){return Math.max(t,Math.min(e,n))}),r=l>2?yo:mo,i=o=null,h}function h(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),s,l)))(t(c(e)))}return h.invert=function(n){return c(e((o||(o=r(s,a.map(t),mr)))(n)))},h.domain=function(t){return arguments.length?(a=Array.from(t,fo),u()):a.slice()},h.range=function(t){return arguments.length?(s=Array.from(t),u()):s.slice()},h.rangeRound=function(t){return s=Array.from(t),l=ho,u()},h.clamp=function(t){return arguments.length?(c=!!t||po,u()):c!==po},h.interpolate=function(t){return arguments.length?(l=t,u()):l},h.unknown=function(t){return arguments.length?(n=t,h):n},function(n,r){return t=n,e=r,u()}}()(po,po);return t.copy=function(){return e=t,Po().domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());var e},Ui.apply(t,arguments),Mo(t)}function Ao(t){return"string"==typeof t?new $n([[document.querySelector(t)]],[document.documentElement]):new $n([[t]],Ln)}function Ro(t,e,n){this.k=t,this.x=e,this.y=n}Io=function(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?To:(e=No.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?To:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(No.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=xo(t)).fill,n=t.align,h=t.sign,d=t.symbol,f=t.zero,g=t.width,p=t.comma,v=t.precision,m=t.trim,y=t.type;"n"===y?(p=!0,y="g"):Do[y]||(void 0===v&&(v=12),m=!0,y="g"),(f||"0"===e&&"="===n)&&(f=!0,e="0",n="=");var b="$"===d?i:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===d?o:/[%p]/.test(y)?l:"",x=Do[y],_=/[defgprs%]/.test(y);function C(t){var i,o,l,d=b,C=w;if("c"===y)C=x(t)+C,t="";else{var S=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:x(Math.abs(t),v),m&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),S&&0==+t&&"+"!==h&&(S=!1),d=(S?"("===h?h:c:"-"===h||"("===h?"":h)+d,C=("s"===y?jo[8+bo/3]:"")+C+(S&&"("===h?")":""),_)for(i=-1,o=t.length;++i<o;)if(48>(l=t.charCodeAt(i))||l>57){C=(46===l?a+t.slice(i+1):t.slice(i))+C,t=t.slice(0,i);break}}p&&!f&&(t=r(t,1/0));var O=d.length+t.length+C.length,D=O<g?new Array(g-O+1).join(e):"";switch(p&&f&&(t=r(D+t,D.length?g-C.length:1/0),D=""),n){case"<":t=d+t+C+D;break;case"=":t=d+D+t+C;break;case"^":t=D.slice(0,O=D.length>>1)+d+t+C+D.slice(O);break;default:t=D+d+t+C}return s(t)}return v=void 0===v?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),C.toString=function(){return t+""},C}return{format:h,formatPrefix:function(t,e){var n=h(((t=xo(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(So(e)/3))),i=Math.pow(10,-r),o=jo[8+r/3];return function(t){return n(i*t)+o}}}}({thousands:",",grouping:[3],currency:["$",""]}),Eo=Io.format,ko=Io.formatPrefix,Ro.prototype={constructor:Ro,scale:function(t){return 1===t?this:new Ro(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Ro(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},new Ro(1,0,0),Ro.prototype;const Lo=({data:t,width:e="100%",height:n="400px",backgroundColor:r,title:i,showGridX:o,showGridY:a,xGridColor:s,yGridColor:c,xGridWidth:u,yGridWidth:h,showBarValues:d,xAxisLabel:f,yAxisLabel:g,colorSource:p,defaultBarColor:v,customColors:m,barOpacity:y,enableHierarchicalView:b,enableStackedBars:w,selectedParentId:x,setAttributes:_})=>{const C=(0,l.useRef)(),S=(0,l.useRef)(),O=(t,e)=>{const n=qr(t).rgb();return zr(Math.max(0,n.r-e),Math.max(0,n.g-e),Math.max(0,n.b-e)).toString()};return(0,l.useEffect)((()=>{if(!t||!C.current||!S.current)return;Ao(C.current).selectAll("*").remove();let e=t;b&&!w&&(e={},Object.entries(t).forEach((([t,n])=>{const r=n.filter((t=>t.parent===x));r.length>0&&(e[t]=r)})));const l=[];Object.entries(e).forEach((([e,n])=>{n.forEach((n=>{if(!w||null===n.parent){const r=n.color||v,i=(e=>{const n=[];return Object.entries(t).forEach((([t,r])=>{r.forEach((r=>{r.parent===e&&n.push({...r,dataset:t,color:r.color||v})}))})),n})(n.id),o={id:n.id,dataset:e,label:n.label||"",value:parseFloat(n.value)||0,color:r,hasChildren:i.length>0,children:[]};if(w&&i.length>0){let t=new Set([r]);i.forEach(((e,n)=>{let i=e.color||r;for(;t.has(i);)i=O(i,30);t.add(i),o.children.push({id:e.id,label:e.label,value:parseFloat(e.value)||0,color:i})}))}l.push(o)}}))}));const D=S.current.clientWidth,T="number"==typeof n?n:400,I={top:i?40:20,right:20,bottom:f?50:30,left:g?60:40},E=Math.max(D-I.left-I.right,0),k=Math.max(T-I.top-I.bottom,0),N=Ao(C.current).attr("width",D).attr("height",T).style("background-color",r);i&&N.append("text").attr("x",D/2).attr("y",20).attr("text-anchor","middle").style("font-size","16px").text(i);const j=N.append("g").attr("transform",`translate(${I.left},${I.top})`),M=Yi().domain(l.map((t=>t.label))).range([0,E]).padding(.1),P=Po().domain([0,ve(l,(t=>w?t.value+t.children.reduce(((t,e)=>t+e.value),0):t.value))||100]).range([k,0]);o&&j.append("g").attr("class","grid x-grid").attr("transform",`translate(0,${k})`).style("color",s).style("stroke-width",u).call(Oe(M).tickSize(-k).tickFormat("")),a&&j.append("g").attr("class","grid y-grid").style("color",c).style("stroke-width",h).call(De(P).tickSize(-E).tickFormat(""));const A=j.selectAll(".bar-group").data(l).enter().append("g").attr("class","bar-group").attr("transform",(t=>`translate(${M(t.label)},0)`));A.append("rect").attr("class","main-bar").attr("y",(t=>P(t.value))).attr("width",M.bandwidth()).attr("height",(t=>k-P(t.value))).attr("fill",(t=>(t=>{switch(p){case"singleColor":return v;case"customColors":const e=m?.find((e=>e.dataset===t.dataset&&e.label===t.label));return e?e.color:t.color;default:return t.color}})(t))).style("opacity",y).style("cursor",(t=>t.hasChildren&&!w?"pointer":"default")),w&&A.each((function(t){let e=t.value;t.children.forEach((t=>{Ao(this).append("rect").attr("class","child-bar").attr("y",(()=>P(e+t.value))).attr("width",M.bandwidth()).attr("height",(()=>k-P(t.value))).attr("fill",t.color).style("opacity",y),e+=t.value}))})),b&&!w&&(A.selectAll(".main-bar").on("click",(function(t,e){e.hasChildren&&_&&_({selectedParentId:e.id})})),null!==x&&N.append("text").attr("x",I.left).attr("y",I.top/2).attr("class","back-button").style("cursor","pointer").style("font-weight","bold").text("← Back").on("click",(function(){if(_){let e=null;Object.values(t).forEach((t=>{const n=t.find((t=>t.id===x));n&&(e=n.parent)})),_({selectedParentId:e})}}))),d&&A.each((function(t){if(Ao(this).append("text").attr("class","bar-value").attr("x",M.bandwidth()/2).attr("y",P(t.value)-5).attr("text-anchor","middle").text(t.value),w){let e=t.value;t.children.forEach((t=>{Ao(this).append("text").attr("class","bar-value").attr("x",M.bandwidth()/2).attr("y",P(e+t.value)-5).attr("text-anchor","middle").text(t.value),e+=t.value}))}})),j.append("g").attr("transform",`translate(0,${k})`).call(Oe(M)).selectAll("text").style("text-anchor","end").attr("dx","-.8em").attr("dy",".15em").attr("transform","rotate(-45)"),j.append("g").call(De(P)),f&&j.append("text").attr("class","x-axis-label").attr("x",E/2).attr("y",k+40).attr("text-anchor","middle").style("font-size","12px").text(f),g&&j.append("text").attr("class","y-axis-label").attr("transform","rotate(-90)").attr("x",-k/2).attr("y",-45).attr("text-anchor","middle").style("font-size","12px").text(g)}),[t,e,n,i,o,a,s,c,u,h,d,f,g,p,v,m,y,b,w,x]),(0,A.jsx)("div",{ref:S,className:"bar-graph",style:{width:e,height:n,backgroundColor:r,position:"relative"},children:(0,A.jsx)("svg",{ref:C})})},$o=({label:t,value:e,onChange:n})=>{const{number:r,unit:i}=(t=>{const e=t?.match(/^(\d+)(.*)$/);return e?{number:parseInt(e[1],10),unit:e[2]||"px"}:{number:300,unit:"px"}})(e);return(0,A.jsxs)("div",{className:"lcp-dimension-control",children:[(0,A.jsx)("label",{className:"components-base-control__label",children:t}),(0,A.jsxs)("div",{style:{display:"flex",gap:"8px",alignItems:"flex-start"},children:[(0,A.jsx)(s.TextControl,{type:"number",value:r,onChange:t=>{n(`${t}${i}`)},min:0,style:{width:"80px"}}),(0,A.jsx)(s.SelectControl,{value:i,options:[{label:"Pixels (px)",value:"px"},{label:"Percentage (%)",value:"%"},{label:"Viewport Width (vw)",value:"vw"},{label:"Viewport Height (vh)",value:"vh"}],onChange:t=>{n(`${r}${t}`)},style:{minWidth:"100px"}})]})]})},Ho=({data:t,colorSource:e,singleColor:n,customColors:r,onColorSourceChange:i,onSingleColorChange:a,onCustomColorChange:c})=>{const[u,h]=(0,l.useState)(null),d=(t,e)=>{const n=r.find((n=>n.dataset===t&&n.label===e));return n?n.color:"#FF6384"};return(0,A.jsxs)("div",{className:"lcp-color-controls",children:[(0,A.jsx)(s.SelectControl,{label:(0,o.__)("Color Source","lcp"),value:e,options:[{label:(0,o.__)("Default Colors","lcp"),value:"default"},{label:(0,o.__)("Single Color","lcp"),value:"singleColor"},{label:(0,o.__)("Custom Colors","lcp"),value:"customColors"}],onChange:i}),"singleColor"===e&&(0,A.jsxs)("div",{className:"components-base-control",children:[(0,A.jsx)("label",{className:"components-base-control__label",children:(0,o.__)("Bar Color","lcp")}),(0,A.jsx)(s.ColorPicker,{color:n,onChangeComplete:t=>a(t.hex)})]}),"customColors"===e&&(0,A.jsx)("div",{className:"custom-colors-grid",style:{marginTop:"10px"},children:(()=>{const e=[];return Object.entries(t).forEach((([t,n])=>{n.forEach((n=>{e.push({dataset:t,label:n.label,value:n.value})}))})),e})().map(((t,e)=>(0,A.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"8px",gap:"8px"},children:[(0,A.jsx)("span",{style:{flex:1},children:t.label}),(0,A.jsx)(s.Button,{onClick:()=>h(e),style:{backgroundColor:d(t.dataset,t.label),width:"24px",height:"24px",borderRadius:"50%",padding:0,border:"1px solid #ddd"}}),u===e&&(0,A.jsx)(s.Popover,{onClose:()=>h(null),children:(0,A.jsx)("div",{style:{padding:"12px"},children:(0,A.jsx)(s.ColorPicker,{color:d(t.dataset,t.label),onChangeComplete:e=>{c(t.dataset,t.label,e.hex)}})})})]},`${t.dataset}-${t.label}`)))})]})},Bo=JSON.parse('{"UU":"lcp/bar-graph"}');(0,i.registerBlockType)(Bo.UU,{edit:function({attributes:t,setAttributes:e}){const{chartHeight:n,chartWidth:r,barColor:i,barOpacity:c,backgroundColor:u,showGridY:h,yGridColor:d,xGridColor:f,xGridWidth:g,yGridWidth:p,chartData:v,dataSource:m,displayChartTitle:y,chartTitle:b,allowDownload:w,downloadMaxWidth:x,showSorting:_,showFiltering:C,showBarValues:S,showGridX:O,xAxisLabel:D,yAxisLabel:T,chartColorSource:I,chartCustomColors:E,enableHierarchicalView:k,enableStackedBars:N,selectedParentId:j}=t,M=(0,a.useBlockProps)(),P=t=>{console.log("New data:",t),e({chartData:t})},R=t=>{e({dataSource:t,chartData:{}})},L=(t,n,r)=>{const i=[...E],o=i.findIndex((e=>e.dataset===t&&e.label===n));o>=0?i[o].color=r:i.push({dataset:t,label:n,color:r}),e({chartCustomColors:i})},[$,H]=(0,l.useState)(!1),[B,U]=(0,l.useState)(!1),F=()=>{H(!$)},V=()=>{U(!B)},[G,X]=(0,l.useState)(!1),q=()=>{X(!G)};return console.log("Chart data:",v),t.chartData&&"object"==typeof t.chartData||e({chartData:{}}),(0,A.jsxs)("div",{...M,children:[(0,A.jsx)(a.InspectorControls,{children:(0,A.jsx)(s.TabPanel,{className:"lcp-tab-panel",activeClass:"active-tab",tabs:[{name:"data",title:(0,o.__)("Data Settings","lcp"),className:"tab-data"},{name:"appearance",title:(0,o.__)("Appearance","lcp"),className:"tab-appearance"},{name:"tools",title:(0,o.__)("Tools Settings","lcp"),className:"tab-tools"}],children:t=>"data"===t.name?(0,A.jsxs)(s.Panel,{children:[(0,A.jsx)(s.PanelBody,{title:"Data Settings",children:(0,A.jsx)(pe,{value:v,onChange:P,dataSource:m,onDataSourceChange:R})}),(0,A.jsxs)(s.PanelBody,{title:(0,o.__)("Chart Settings","lcp"),initialOpen:!0,children:[(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Enable Hierarchical View","lcp"),checked:k,onChange:t=>e({enableHierarchicalView:t})}),(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Enable Stacked Bars","lcp"),checked:N,onChange:t=>e({enableStackedBars:t})}),(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Display Chart Title","lcp"),checked:y,onChange:t=>e({displayChartTitle:t})}),y&&(0,A.jsx)(s.TextControl,{label:(0,o.__)("Chart Title","lcp"),value:b,onChange:t=>e({chartTitle:t})}),(0,A.jsx)($o,{label:(0,o.__)("Chart Width","lcp"),value:r,onChange:t=>e({chartWidth:t})}),(0,A.jsx)($o,{label:(0,o.__)("Chart Height","lcp"),value:n,onChange:t=>e({chartHeight:t})})]}),(0,A.jsxs)(s.PanelBody,{title:"Appearance",children:[(0,A.jsxs)("div",{className:"background-color-row",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"10px"},children:[(0,A.jsx)("span",{children:"Background Color"}),(0,A.jsx)(s.Button,{className:"background-color-button",onClick:q,style:{backgroundColor:u,width:"26px",height:"26px",borderRadius:"50%",border:"1px solid #ccc"}}),G&&(0,A.jsx)(s.Popover,{position:"bottom center",onClose:q,children:(0,A.jsx)(s.ColorPicker,{color:u,onChangeComplete:t=>{return n=t.hex,void e({backgroundColor:n});var n}})})]}),(0,A.jsx)(Ho,{data:v,colorSource:I,singleColor:i,customColors:E,onColorSourceChange:t=>e({chartColorSource:t}),onSingleColorChange:t=>e({barColor:t}),onCustomColorChange:L}),(0,A.jsx)(s.RangeControl,{label:(0,o.__)("Bar Opacity","lcp"),value:c,onChange:t=>e({barOpacity:t}),min:0,max:1,step:.1}),(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Show Bar Values","lcp"),checked:S,onChange:t=>e({showBarValues:t})})]}),(0,A.jsxs)(s.PanelBody,{title:"Grid Settings",children:[(0,A.jsx)(s.TextControl,{label:(0,o.__)("X-Axis Label","lcp"),value:D,onChange:t=>e({xAxisLabel:t})}),(0,A.jsx)(s.TextControl,{label:(0,o.__)("Y-Axis Label","lcp"),value:T,onChange:t=>e({yAxisLabel:t})}),(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Show X-Axis Grid","lcp"),checked:O,onChange:t=>e({showGridX:t})}),(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Show Y-Axis Grid","lcp"),checked:h,onChange:t=>e({showGridY:t})}),h&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"y-grid-color-row",style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"},children:[(0,A.jsx)("span",{children:"Y-Axis Grid Color"}),(0,A.jsx)(s.Button,{className:"grid-color-button",onClick:F,style:{backgroundColor:d,width:"26px",height:"26px",borderRadius:"50%",border:"1px solid #ccc"}}),$&&(0,A.jsx)(s.Popover,{position:"bottom center",onClose:F,children:(0,A.jsx)(s.ColorPicker,{color:d,onChangeComplete:t=>{return n=t.hex,void e({yGridColor:n});var n}})})]}),(0,A.jsx)(s.RangeControl,{label:(0,o.__)("Y-Axis Grid Width","lcp"),value:p,onChange:t=>e({yGridWidth:t}),min:1,max:5,step:1})]}),O&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"x-grid-color-row",style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"},children:[(0,A.jsx)("span",{children:"X-Axis Grid Color"}),(0,A.jsx)(s.Button,{className:"grid-color-button",onClick:V,style:{backgroundColor:f,width:"26px",height:"26px",borderRadius:"50%",border:"1px solid #ccc"}}),B&&(0,A.jsx)(s.Popover,{position:"bottom center",onClose:V,children:(0,A.jsx)(s.ColorPicker,{color:f,onChangeComplete:t=>{return n=t.hex,void e({xGridColor:n});var n}})})]}),(0,A.jsx)(s.RangeControl,{label:(0,o.__)("X-Axis Grid Width","lcp"),value:g,onChange:t=>e({xGridWidth:t}),min:1,max:5,step:1})]})]})]}):"appearance"===t.name?(0,A.jsx)(s.PanelBody,{}):"tools"===t.name?(0,A.jsxs)(s.PanelBody,{children:[(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Allow Download","lcp"),checked:w,onChange:t=>e({allowDownload:t})}),w&&(0,A.jsx)(s.TextControl,{type:"number",label:(0,o.__)("Max Download Width (px)","lcp"),value:parseInt(x),onChange:t=>e({downloadMaxWidth:`${t}px`}),min:100,max:5e3}),(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Show Sorting Options","lcp"),checked:_,onChange:t=>e({showSorting:t})}),(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Show Filtering Options","lcp"),checked:C,onChange:t=>e({showFiltering:t})})]}):void 0})}),w&&(0,A.jsx)("div",{className:"lcp-bar-graph-toolbar",children:(0,A.jsx)(s.Button,{isPrimary:!0,onClick:()=>{const t=document.querySelector(".bar-graph svg");if(!t)return;const e=document.createElement("canvas"),n=(new XMLSerializer).serializeToString(t),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),i=window.URL||window.webkitURL||window,o=i.createObjectURL(r),a=new Image;a.onload=()=>{e.width=t.width.baseVal.value,e.height=t.height.baseVal.value;const n=e.getContext("2d");n.fillStyle=u,n.fillRect(0,0,e.width,e.height),n.drawImage(a,0,0),e.toBlob((t=>{const e=URL.createObjectURL(t),n=document.createElement("a");n.href=e,n.download="bar-graph.png",document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(e),i.revokeObjectURL(o)}),"image/png")},a.src=o},icon:"download",children:(0,o.__)("Download Graph","lcp")})}),v&&Object.keys(v).length>0?(0,A.jsx)(Lo,{data:v,height:n,width:r,backgroundColor:u,defaultBarColor:i,barOpacity:c,showGridX:O,showGridY:h,yGridColor:d,xGridColor:f,xGridWidth:g,yGridWidth:p,title:y?b:"",showBarValues:S,xAxisLabel:D,yAxisLabel:T,colorSource:I,customColors:E,enableHierarchicalView:k,enableStackedBars:N,selectedParentId:j,setAttributes:e}):(0,A.jsx)("div",{className:"lcp-bar-graph-placeholder",style:{height:n,width:r,backgroundColor:u,display:"flex",alignItems:"center",justifyContent:"center",border:"2px dashed #ccc",borderRadius:"4px",color:"#666"},children:(0,o.__)("Please add data using the Data Settings panel","lcp")})]})},save:function({attributes:t}){const{chartHeight:e,backgroundColor:n}=t;return(0,A.jsx)("div",{...a.useBlockProps.save(),children:(0,A.jsx)("div",{className:"lcp-bar-graph",style:{height:e,backgroundColor:n}})})}})},792:t=>{t.exports=function t(e,n){if(e===n)return!0;if(e&&n&&"object"==typeof e&&"object"==typeof n){if(e.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(e)){if((r=e.length)!=n.length)return!1;for(i=r;0!=i--;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if((r=(o=Object.keys(e)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;0!=i--;){var a=o[i];if(!t(e[a],n[a]))return!1}return!0}return e!=e&&n!=n}}},n={};function r(t){var i=n[t];if(void 0!==i)return i.exports;var o=n[t]={exports:{}};return e[t](o,o.exports,r),o.exports}r.m=e,t=[],r.O=(e,n,i,o)=>{if(!n){var a=1/0;for(u=0;u<t.length;u++){for(var[n,i,o]=t[u],s=!0,l=0;l<n.length;l++)(!1&o||a>=o)&&Object.keys(r.O).every((t=>r.O[t](n[l])))?n.splice(l--,1):(s=!1,o<a&&(a=o));if(s){t.splice(u--,1);var c=i();void 0!==c&&(e=c)}}return e}o=o||0;for(var u=t.length;u>0&&t[u-1][2]>o;u--)t[u]=t[u-1];t[u]=[n,i,o]},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t={57:0,350:0};r.O.j=e=>0===t[e];var e=(e,n)=>{var i,o,[a,s,l]=n,c=0;if(a.some((e=>0!==t[e]))){for(i in s)r.o(s,i)&&(r.m[i]=s[i]);if(l)var u=l(r)}for(e&&e(n);c<a.length;c++)o=a[c],r.o(t,o)&&t[o]&&t[o][0](),t[o]=0;return r.O(u)},n=globalThis.webpackChunklcp_bar_graph=globalThis.webpackChunklcp_bar_graph||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})();var i=r.O(void 0,[350],(()=>r(301)));i=r.O(i)})();