diff --git a/assets/index-0dd28062.js b/assets/index-e64488a1.js similarity index 96% rename from assets/index-0dd28062.js rename to assets/index-e64488a1.js index 2788b4eb..c813663e 100644 --- a/assets/index-0dd28062.js +++ b/assets/index-e64488a1.js @@ -398,7 +398,7 @@ PERFORMANCE OF THIS SOFTWARE. background: #434252; } /* ====== */`);const u$4=React.forwardRef(({className:_e,theme:lt,draggerClassName:Rt,direction:At=z$4.Vertical,onDragging:Pt},Dt)=>{const Lt=`__dbk__gutter ${At} ${_e||lt}`,Bt=`__dbk__dragger ${At} ${Rt||lt}`;return jsxRuntimeExports.jsx("div",Object.assign({className:Lt,ref:Dt,dir:At,onMouseDown:Pt,onTouchStart:C$4?Pt:void 0},{children:jsxRuntimeExports.jsx("div",{className:Bt},void 0)}),void 0)});var h$5;function p$5(_e,lt,Rt){let At,Pt;return lt?(At=_e/2,Pt=_e):Rt?(At=_e,Pt=_e/2):(At=_e,Pt=_e),{aGutterSize:At,bGutterSize:Pt}}function f$5(_e,lt){switch(lt.type){case h$5.SetIsReadyToCompute:return Object.assign(Object.assign({},_e),{isReady:lt.payload.isReady});case h$5.CreatePairs:{const{direction:Rt,children:At,gutters:Pt}=lt.payload,Dt=At[0].parentNode;if(!Dt)throw new Error("Cannot create pairs - parent is undefined.");const Lt=c$4(Rt,Dt);if(Lt===void 0)throw new Error(`Cannot create pairs - parent has undefined or zero size: ${Lt}.`);const Bt=[];return At.forEach((Nt,jt)=>{if(jt>0){const Ut=At[jt-1],Gt=At[jt],qt=Pt[jt-1],Xt=Rt===z$4.Horizontal?Ut.getBoundingClientRect().left:Ut.getBoundingClientRect().top,Kt=Rt===z$4.Horizontal?Gt.getBoundingClientRect().right:Gt.getBoundingClientRect().bottom,Zt=Rt===z$4.Horizontal?Ut.getBoundingClientRect().width+qt.getBoundingClientRect().width+Gt.getBoundingClientRect().width:Ut.getBoundingClientRect().height+qt.getBoundingClientRect().height+Gt.getBoundingClientRect().height,Qt=Rt===z$4.Horizontal?qt.getBoundingClientRect().width:qt.getBoundingClientRect().height,Jt={idx:jt-1,a:Ut,b:Gt,gutter:qt,parent:Dt,start:Xt,end:Kt,size:Zt,gutterSize:Qt,aSizePct:100/At.length,bSizePct:100/At.length};Bt.push(Jt)}}),Object.assign(Object.assign({},_e),{pairs:Bt})}case h$5.StartDragging:{const{gutterIdx:Rt}=lt.payload;return Object.assign(Object.assign({},_e),{isDragging:!0,draggingIdx:Rt})}case h$5.StopDragging:return Object.assign(Object.assign({},_e),{isDragging:!1});case h$5.CalculateSizes:{const{direction:Rt,gutterIdx:At}=lt.payload,Pt=_e.pairs[At],Dt=c$4(Rt,Pt.parent);if(!Dt)throw new Error("Cannot calculate sizes - 'pair.parent' has undefined or zero size.");const Lt=Pt.gutter[Rt===z$4.Horizontal?"clientWidth":"clientHeight"],Bt=At===0,Nt=At===_e.pairs.length-1,{aGutterSize:jt,bGutterSize:Ut}=p$5(Lt,Bt,Nt);let Gt,qt,Xt,Kt,Zt;return Rt===z$4.Horizontal?(Gt=Pt.a.getBoundingClientRect().left,qt=Pt.b.getBoundingClientRect().right,Kt=(Pt.a.getBoundingClientRect().width+jt)/Dt*100,Zt=(Pt.b.getBoundingClientRect().width+Ut)/Dt*100,Xt=Pt.a.getBoundingClientRect().width+jt+Ut+Pt.b.getBoundingClientRect().width):(Gt=Pt.a.getBoundingClientRect().top,qt=Pt.b.getBoundingClientRect().bottom,Kt=(Pt.a.getBoundingClientRect().height+jt)/Dt*100,Zt=(Pt.b.getBoundingClientRect().height+Ut)/Dt*100,Xt=Pt.a.getBoundingClientRect().height+jt+Ut+Pt.b.getBoundingClientRect().height),_e.pairs[At]=Object.assign(Object.assign({},Pt),{start:Gt,end:qt,size:Xt,aSizePct:Kt,bSizePct:Zt,gutterSize:Lt}),Object.assign({},_e)}default:return _e}}function _$4(_e,lt=0,Rt=[]){return reactExports.Children.toArray(_e).reduce((At,Pt,Dt)=>(reactIsExports.isFragment(Pt)?At.push.apply(At,_$4(Pt.props.children,lt+1,Rt.concat(Pt.key||Dt))):reactExports.isValidElement(Pt)?At.push(reactExports.cloneElement(Pt,{key:Rt.concat(String(Pt.key)).join(".")})):typeof Pt!="string"&&typeof Pt!="number"||At.push(Pt),At),[])}(function(_e){_e[_e.SetIsReadyToCompute=0]="SetIsReadyToCompute",_e[_e.CreatePairs=1]="CreatePairs",_e[_e.CalculateSizes=2]="CalculateSizes",_e[_e.StartDragging=3]="StartDragging",_e[_e.StopDragging=4]="StopDragging"})(h$5||(h$5={}));const b$5=_e=>"changedTouches"in _e;var z$4,w$5;(function(_e){_e.Horizontal="Horizontal",_e.Vertical="Vertical"})(z$4||(z$4={})),function(_e){_e.Light="Light",_e.Dark="Dark"}(w$5||(w$5={}));const C$4=typeof window<"u"&&"ontouchstart"in window;function y$5(_e){return _e===z$4.Horizontal?"col-resize":"row-resize"}const S$6={isReady:!1,isDragging:!1,pairs:[]};function m$5({direction:_e=z$4.Horizontal,minWidths:lt=[],minHeights:Rt=[],initialSizes:At,gutterTheme:Pt=w$5.Dark,gutterClassName:Dt,draggerClassName:Lt,children:Bt,onResizeStarted:Nt,onResizeFinished:jt,classes:Ut=[]}){const Gt=_$4(Bt),[qt,Xt]=reactExports.useReducer(f$5,S$6),Kt=reactExports.useRef(null),Zt=reactExports.useRef([]),Qt=reactExports.useRef([]);Zt.current=[],Qt.current=[];const Jt=React.useCallback(_n=>{Xt({type:h$5.SetIsReadyToCompute,payload:{isReady:_n}})},[]),en=React.useCallback((_n,xn)=>{Xt({type:h$5.StartDragging,payload:{gutterIdx:xn}});const ln=qt.pairs[xn];Nt==null||Nt(ln.idx),ln.a.style.userSelect="none",ln.b.style.userSelect="none",ln.gutter.style.cursor=y$5(_n),ln.parent.style.cursor=y$5(_n),document.body.style.cursor=y$5(_n)},[qt.pairs]),tn=React.useCallback(()=>{Xt({type:h$5.StopDragging});const _n=[];for(let ln=0;ln{Xt({type:h$5.CalculateSizes,payload:{direction:_n,gutterIdx:xn}})},[]),cn=React.useCallback((_n,xn,ln)=>{Xt({type:h$5.CreatePairs,payload:{direction:_n,children:xn,gutters:ln}})},[]),un=React.useCallback((_n,xn,ln,Mn)=>{const Tn=xn[0].parentNode;if(!Tn)throw new Error("Cannot set initial sizes - parent is undefined");if(c$4(_n,Tn)===void 0)throw new Error("Cannot set initial sizes - parent has undefined size");xn.forEach((An,Cn)=>{const wn=Cn===0,Fn=Cn===xn.length-1;let $n,Pn=0;xn.length>1&&(Pn=ln[Fn?Cn-1:Cn].getBoundingClientRect()[_n===z$4.Horizontal?"width":"height"],Pn=wn||Fn?Pn/2:Pn),$n=Mn&&Cn{if(qt.draggingIdx===void 0)throw new Error("Cannot adjust size - 'draggingIdx' is undefined");const ln=qt.pairs[qt.draggingIdx];if(ln.size===void 0)throw new Error("Cannot adjust size - 'pair.size' is undefined");if(ln.gutterSize===void 0)throw new Error("Cannot adjust size - 'pair.gutterSize' is undefined");const Mn=ln.aSizePct+ln.bSizePct,Tn=xn/ln.size*Mn,An=Mn-xn/ln.size*Mn,Cn=qt.draggingIdx===0,wn=qt.draggingIdx===qt.pairs.length-1,{aGutterSize:Fn,bGutterSize:$n}=p$5(ln.gutterSize,Cn,wn),Pn=`calc(${Tn}% - ${Fn}px)`,Vn=`calc(${An}% - ${$n}px)`;_n===z$4.Horizontal?(ln.a.style.width=Pn,ln.b.style.width=Vn):(ln.a.style.height=Pn,ln.b.style.height=Vn)},[qt.draggingIdx,qt.pairs,_e]),sn=React.useCallback((_n,xn,ln)=>{if(!qt.isDragging)return;if(qt.draggingIdx===void 0)throw new Error("Cannot drag - 'draggingIdx' is undefined");const Mn=qt.pairs[qt.draggingIdx];if(Mn.start===void 0)throw new Error("Cannot drag - 'pair.start' is undefined");if(Mn.size===void 0)throw new Error("Cannot drag - 'pair.size' is undefined");if(Mn.gutterSize===void 0)throw new Error("Cannot drag - 'pair.gutterSize' is undefined");let Tn=function(wn,Fn){const $n=b$5(Fn)?Fn.changedTouches[0]:Fn;return wn===z$4.Horizontal?$n.clientX:$n.clientY}(xn,_n)-Mn.start,An=16,Cn=16;ln.length>qt.draggingIdx&&(An=ln[qt.draggingIdx]),ln.length>=qt.draggingIdx+1&&(Cn=ln[qt.draggingIdx+1]),Tn=Mn.size-(Mn.gutterSize+Cn)&&(Tn=Mn.size-(Mn.gutterSize+Cn)),rn(xn,Tn)},[qt.isDragging,qt.draggingIdx,qt.pairs,rn]),pn=()=>{if(qt.isDragging){if(qt.draggingIdx===void 0)throw new Error("Cannot calculate sizes after dragging = 'state.draggingIdx' is undefined");an(_e,qt.draggingIdx),tn()}},bn=_n=>{qt.isDragging&&(b$5(_n)&&_n.preventDefault(),sn(_n,_e,_e===z$4.Horizontal?lt:Rt))};function gn(_n,xn){if(!_n.current)throw new Error("Can't add element to ref object - ref isn't initialized");xn&&!_n.current.includes(xn)&&_n.current.push(xn)}return l$5("mouseup",pn,[qt.isDragging,tn]),l$5("mousemove",bn,[_e,qt.isDragging,sn,lt,Rt]),l$5("touchend",pn,[qt.isDragging,tn],{condition:C$4}),l$5("touchmove",bn,[_e,qt.isDragging,sn,lt,Rt],{condition:C$4,passive:!C$4}),reactExports.useEffect(function(){if(!Kt.current)return;const _n=Kt.current.parentElement;if(!_n)return;const xn=new ResizeObserver(()=>{const ln=getComputedStyle(_n),Mn=_e===z$4.Horizontal?_n.clientWidth:_n.clientHeight;Jt(!!ln&&!!Mn)});return xn.observe(_n),()=>{xn.disconnect()}},[Kt.current,_e]),reactExports.useEffect(function(){if(qt.isReady&&(!Zt.current||Zt.current[0].offsetParent)){if(!Zt.current||!Qt.current)throw new Error("Cannot create pairs - either variable 'childRefs' or 'gutterRefs' is undefined");Gt.length<=1?un(_e,Zt.current,Qt.current,At):(un(_e,Zt.current,Qt.current,At),cn(_e,Zt.current,Qt.current))}},[Bt,qt.isReady,_e,un,cn,At]),jsxRuntimeExports.jsx("div",Object.assign({className:`__dbk__container ${_e}`,ref:Kt},{children:qt.isReady&&Gt.map((_n,xn)=>jsxRuntimeExports.jsxs(React.Fragment,{children:[jsxRuntimeExports.jsx("div",Object.assign({ref:ln=>gn(Zt,ln),className:"__dbk__child-wrapper "+(xngn(Qt,ln),className:Dt,theme:Pt,draggerClassName:Lt,direction:_e,onDragging:()=>{return an(_e,ln=xn),void en(_e,ln);var ln}},void 0)]},xn))}),void 0)}const urlAlphabet="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let nanoid$1=(_e=21)=>{let lt="",Rt=crypto.getRandomValues(new Uint8Array(_e));for(;_e--;)lt+=urlAlphabet[Rt[_e]&63];return lt};function produce(_e,lt){const Rt=lodashExports$1.clone(_e);return lt(Rt),Rt}function transaction(_e,lt){return lt(lodashExports$1.clone(_e))}const producify=_e=>lt=>{const Rt=structuredClone(lt);return _e(Rt),Rt};function withProduce(_e){return lt=>reactExports.createElement(_e,{...lt,produce:Rt=>{var At;return(At=lt==null?void 0:lt.onChange)==null?void 0:At.call(lt,Pt=>produce(Pt,Rt))}})}const DndContext=reactExports.createContext({dragDropManager:void 0});function formatProdErrorMessage$1(_e){return"Minified Redux error #"+_e+"; visit https://redux.js.org/Errors?code="+_e+" for the full message or use the non-minified dev environment for full errors. "}var $$observable$1=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),randomString$1=function(){return Math.random().toString(36).substring(7).split("").join(".")},ActionTypes$1={INIT:"@@redux/INIT"+randomString$1(),REPLACE:"@@redux/REPLACE"+randomString$1(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+randomString$1()}};function isPlainObject$2(_e){if(typeof _e!="object"||_e===null)return!1;for(var lt=_e;Object.getPrototypeOf(lt)!==null;)lt=Object.getPrototypeOf(lt);return Object.getPrototypeOf(_e)===lt}function createStore$2(_e,lt,Rt){var At;if(typeof lt=="function"&&typeof Rt=="function"||typeof Rt=="function"&&typeof arguments[3]=="function")throw new Error(formatProdErrorMessage$1(0));if(typeof lt=="function"&&typeof Rt>"u"&&(Rt=lt,lt=void 0),typeof Rt<"u"){if(typeof Rt!="function")throw new Error(formatProdErrorMessage$1(1));return Rt(createStore$2)(_e,lt)}if(typeof _e!="function")throw new Error(formatProdErrorMessage$1(2));var Pt=_e,Dt=lt,Lt=[],Bt=Lt,Nt=!1;function jt(){Bt===Lt&&(Bt=Lt.slice())}function Ut(){if(Nt)throw new Error(formatProdErrorMessage$1(3));return Dt}function Gt(Zt){if(typeof Zt!="function")throw new Error(formatProdErrorMessage$1(4));if(Nt)throw new Error(formatProdErrorMessage$1(5));var Qt=!0;return jt(),Bt.push(Zt),function(){if(Qt){if(Nt)throw new Error(formatProdErrorMessage$1(6));Qt=!1,jt();var en=Bt.indexOf(Zt);Bt.splice(en,1),Lt=null}}}function qt(Zt){if(!isPlainObject$2(Zt))throw new Error(formatProdErrorMessage$1(7));if(typeof Zt.type>"u")throw new Error(formatProdErrorMessage$1(8));if(Nt)throw new Error(formatProdErrorMessage$1(9));try{Nt=!0,Dt=Pt(Dt,Zt)}finally{Nt=!1}for(var Qt=Lt=Bt,Jt=0;JtAt&&At[Pt]?At[Pt]:Rt||null,_e)}function without$1(_e,lt){return _e.filter(Rt=>Rt!==lt)}function isObject$8(_e){return typeof _e=="object"}function xor(_e,lt){const Rt=new Map,At=Dt=>{Rt.set(Dt,Rt.has(Dt)?Rt.get(Dt)+1:1)};_e.forEach(At),lt.forEach(At);const Pt=[];return Rt.forEach((Dt,Lt)=>{Dt===1&&Pt.push(Lt)}),Pt}function intersection(_e,lt){return _e.filter(Rt=>lt.indexOf(Rt)>-1)}const INIT_COORDS="dnd-core/INIT_COORDS",BEGIN_DRAG="dnd-core/BEGIN_DRAG",PUBLISH_DRAG_SOURCE="dnd-core/PUBLISH_DRAG_SOURCE",HOVER="dnd-core/HOVER",DROP="dnd-core/DROP",END_DRAG="dnd-core/END_DRAG";function setClientOffset(_e,lt){return{type:INIT_COORDS,payload:{sourceClientOffset:lt||null,clientOffset:_e||null}}}const ResetCoordinatesAction={type:INIT_COORDS,payload:{clientOffset:null,sourceClientOffset:null}};function createBeginDrag(_e){return function(Rt=[],At={publishSource:!0}){const{publishSource:Pt=!0,clientOffset:Dt,getSourceClientOffset:Lt}=At,Bt=_e.getMonitor(),Nt=_e.getRegistry();_e.dispatch(setClientOffset(Dt)),verifyInvariants$1(Rt,Bt,Nt);const jt=getDraggableSource(Rt,Bt);if(jt==null){_e.dispatch(ResetCoordinatesAction);return}let Ut=null;if(Dt){if(!Lt)throw new Error("getSourceClientOffset must be defined");verifyGetSourceClientOffsetIsFunction(Lt),Ut=Lt(jt)}_e.dispatch(setClientOffset(Dt,Ut));const qt=Nt.getSource(jt).beginDrag(Bt,jt);if(qt==null)return;verifyItemIsObject(qt),Nt.pinSource(jt);const Xt=Nt.getSourceType(jt);return{type:BEGIN_DRAG,payload:{itemType:Xt,item:qt,sourceId:jt,clientOffset:Dt||null,sourceClientOffset:Ut||null,isSourcePublic:!!Pt}}}}function verifyInvariants$1(_e,lt,Rt){invariant$2(!lt.isDragging(),"Cannot call beginDrag while dragging."),_e.forEach(function(At){invariant$2(Rt.getSource(At),"Expected sourceIds to be registered.")})}function verifyGetSourceClientOffsetIsFunction(_e){invariant$2(typeof _e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function verifyItemIsObject(_e){invariant$2(isObject$8(_e),"Item must be an object.")}function getDraggableSource(_e,lt){let Rt=null;for(let At=_e.length-1;At>=0;At--)if(lt.canDragSource(_e[At])){Rt=_e[At];break}return Rt}function _defineProperty$8(_e,lt,Rt){return lt in _e?Object.defineProperty(_e,lt,{value:Rt,enumerable:!0,configurable:!0,writable:!0}):_e[lt]=Rt,_e}function _objectSpread$4(_e){for(var lt=1;lt{const Nt=determineDropResult(Lt,Bt,Pt,At),jt={type:DROP,payload:{dropResult:_objectSpread$4({},Rt,Nt)}};_e.dispatch(jt)})}}function verifyInvariants(_e){invariant$2(_e.isDragging(),"Cannot call drop while not dragging."),invariant$2(!_e.didDrop(),"Cannot call drop twice during one drag operation.")}function determineDropResult(_e,lt,Rt,At){const Pt=Rt.getTarget(_e);let Dt=Pt?Pt.drop(At,_e):void 0;return verifyDropResultType(Dt),typeof Dt>"u"&&(Dt=lt===0?{}:At.getDropResult()),Dt}function verifyDropResultType(_e){invariant$2(typeof _e>"u"||isObject$8(_e),"Drop result must either be an object or undefined.")}function getDroppableTargets(_e){const lt=_e.getTargetIds().filter(_e.canDropOnTarget,_e);return lt.reverse(),lt}function createEndDrag(_e){return function(){const Rt=_e.getMonitor(),At=_e.getRegistry();verifyIsDragging(Rt);const Pt=Rt.getSourceId();return Pt!=null&&(At.getSource(Pt,!0).endDrag(Rt,Pt),At.unpinSource()),{type:END_DRAG}}}function verifyIsDragging(_e){invariant$2(_e.isDragging(),"Cannot call endDrag while not dragging.")}function matchesType(_e,lt){return lt===null?_e===null:Array.isArray(_e)?_e.some(Rt=>Rt===lt):_e===lt}function createHover(_e){return function(Rt,{clientOffset:At}={}){verifyTargetIdsIsArray(Rt);const Pt=Rt.slice(0),Dt=_e.getMonitor(),Lt=_e.getRegistry(),Bt=Dt.getItemType();return removeNonMatchingTargetIds(Pt,Lt,Bt),checkInvariants(Pt,Dt,Lt),hoverAllTargets(Pt,Dt,Lt),{type:HOVER,payload:{targetIds:Pt,clientOffset:At||null}}}}function verifyTargetIdsIsArray(_e){invariant$2(Array.isArray(_e),"Expected targetIds to be an array.")}function checkInvariants(_e,lt,Rt){invariant$2(lt.isDragging(),"Cannot call hover while not dragging."),invariant$2(!lt.didDrop(),"Cannot call hover after drop.");for(let At=0;At<_e.length;At++){const Pt=_e[At];invariant$2(_e.lastIndexOf(Pt)===At,"Expected targetIds to be unique in the passed array.");const Dt=Rt.getTarget(Pt);invariant$2(Dt,"Expected targetIds to be registered.")}}function removeNonMatchingTargetIds(_e,lt,Rt){for(let At=_e.length-1;At>=0;At--){const Pt=_e[At],Dt=lt.getTargetType(Pt);matchesType(Dt,Rt)||_e.splice(At,1)}}function hoverAllTargets(_e,lt,Rt){_e.forEach(function(At){Rt.getTarget(At).hover(lt,At)})}function createPublishDragSource(_e){return function(){if(_e.getMonitor().isDragging())return{type:PUBLISH_DRAG_SOURCE}}}function createDragDropActions(_e){return{beginDrag:createBeginDrag(_e),publishDragSource:createPublishDragSource(_e),hover:createHover(_e),drop:createDrop(_e),endDrag:createEndDrag(_e)}}class DragDropManagerImpl{receiveBackend(lt){this.backend=lt}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const lt=this,{dispatch:Rt}=this.store;function At(Dt){return(...Lt)=>{const Bt=Dt.apply(lt,Lt);typeof Bt<"u"&&Rt(Bt)}}const Pt=createDragDropActions(this);return Object.keys(Pt).reduce((Dt,Lt)=>{const Bt=Pt[Lt];return Dt[Lt]=At(Bt),Dt},{})}dispatch(lt){this.store.dispatch(lt)}constructor(lt,Rt){this.isSetUp=!1,this.handleRefCountChange=()=>{const At=this.store.getState().refCount>0;this.backend&&(At&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!At&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=lt,this.monitor=Rt,lt.subscribe(this.handleRefCountChange)}}function add$1(_e,lt){return{x:_e.x+lt.x,y:_e.y+lt.y}}function subtract$1(_e,lt){return{x:_e.x-lt.x,y:_e.y-lt.y}}function getSourceClientOffset(_e){const{clientOffset:lt,initialClientOffset:Rt,initialSourceClientOffset:At}=_e;return!lt||!Rt||!At?null:subtract$1(add$1(lt,At),Rt)}function getDifferenceFromInitialOffset(_e){const{clientOffset:lt,initialClientOffset:Rt}=_e;return!lt||!Rt?null:subtract$1(lt,Rt)}const NONE$2=[],ALL=[];NONE$2.__IS_NONE__=!0;ALL.__IS_ALL__=!0;function areDirty(_e,lt){return _e===NONE$2?!1:_e===ALL||typeof lt>"u"?!0:intersection(lt,_e).length>0}class DragDropMonitorImpl{subscribeToStateChange(lt,Rt={}){const{handlerIds:At}=Rt;invariant$2(typeof lt=="function","listener must be a function."),invariant$2(typeof At>"u"||Array.isArray(At),"handlerIds, when specified, must be an array of strings.");let Pt=this.store.getState().stateId;const Dt=()=>{const Lt=this.store.getState(),Bt=Lt.stateId;try{Bt===Pt||Bt===Pt+1&&!areDirty(Lt.dirtyHandlerIds,At)||lt()}finally{Pt=Bt}};return this.store.subscribe(Dt)}subscribeToOffsetChange(lt){invariant$2(typeof lt=="function","listener must be a function.");let Rt=this.store.getState().dragOffset;const At=()=>{const Pt=this.store.getState().dragOffset;Pt!==Rt&&(Rt=Pt,lt())};return this.store.subscribe(At)}canDragSource(lt){if(!lt)return!1;const Rt=this.registry.getSource(lt);return invariant$2(Rt,`Expected to find a valid source. sourceId=${lt}`),this.isDragging()?!1:Rt.canDrag(this,lt)}canDropOnTarget(lt){if(!lt)return!1;const Rt=this.registry.getTarget(lt);if(invariant$2(Rt,`Expected to find a valid target. targetId=${lt}`),!this.isDragging()||this.didDrop())return!1;const At=this.registry.getTargetType(lt),Pt=this.getItemType();return matchesType(At,Pt)&&Rt.canDrop(this,lt)}isDragging(){return!!this.getItemType()}isDraggingSource(lt){if(!lt)return!1;const Rt=this.registry.getSource(lt,!0);if(invariant$2(Rt,`Expected to find a valid source. sourceId=${lt}`),!this.isDragging()||!this.isSourcePublic())return!1;const At=this.registry.getSourceType(lt),Pt=this.getItemType();return At!==Pt?!1:Rt.isDragging(this,lt)}isOverTarget(lt,Rt={shallow:!1}){if(!lt)return!1;const{shallow:At}=Rt;if(!this.isDragging())return!1;const Pt=this.registry.getTargetType(lt),Dt=this.getItemType();if(Dt&&!matchesType(Pt,Dt))return!1;const Lt=this.getTargetIds();if(!Lt.length)return!1;const Bt=Lt.indexOf(lt);return At?Bt===Lt.length-1:Bt>-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!!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 getSourceClientOffset(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return getDifferenceFromInitialOffset(this.store.getState().dragOffset)}constructor(lt,Rt){this.store=lt,this.registry=Rt}}const scope=typeof global<"u"?global:self,BrowserMutationObserver=scope.MutationObserver||scope.WebKitMutationObserver;function makeRequestCallFromTimer(_e){return function(){const Rt=setTimeout(Pt,0),At=setInterval(Pt,50);function Pt(){clearTimeout(Rt),clearInterval(At),_e()}}}function makeRequestCallFromMutationObserver(_e){let lt=1;const Rt=new BrowserMutationObserver(_e),At=document.createTextNode("");return Rt.observe(At,{characterData:!0}),function(){lt=-lt,At.data=lt}}const makeRequestCall=typeof BrowserMutationObserver=="function"?makeRequestCallFromMutationObserver:makeRequestCallFromTimer;class AsapQueue{enqueueTask(lt){const{queue:Rt,requestFlush:At}=this;Rt.length||(At(),this.flushing=!0),Rt[Rt.length]=lt}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:lt}=this;for(;this.indexthis.capacity){for(let At=0,Pt=lt.length-this.index;At{this.pendingErrors.push(lt),this.requestErrorThrow()},this.requestFlush=makeRequestCall(this.flush),this.requestErrorThrow=makeRequestCallFromTimer(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class RawTask{call(){try{this.task&&this.task()}catch(lt){this.onError(lt)}finally{this.task=null,this.release(this)}}constructor(lt,Rt){this.onError=lt,this.release=Rt,this.task=null}}class TaskFactory{create(lt){const Rt=this.freeTasks,At=Rt.length?Rt.pop():new RawTask(this.onError,Pt=>Rt[Rt.length]=Pt);return At.task=lt,At}constructor(lt){this.onError=lt,this.freeTasks=[]}}const asapQueue=new AsapQueue,taskFactory=new TaskFactory(asapQueue.registerPendingError);function asap(_e){asapQueue.enqueueTask(taskFactory.create(_e))}const ADD_SOURCE="dnd-core/ADD_SOURCE",ADD_TARGET="dnd-core/ADD_TARGET",REMOVE_SOURCE="dnd-core/REMOVE_SOURCE",REMOVE_TARGET="dnd-core/REMOVE_TARGET";function addSource(_e){return{type:ADD_SOURCE,payload:{sourceId:_e}}}function addTarget(_e){return{type:ADD_TARGET,payload:{targetId:_e}}}function removeSource(_e){return{type:REMOVE_SOURCE,payload:{sourceId:_e}}}function removeTarget(_e){return{type:REMOVE_TARGET,payload:{targetId:_e}}}function validateSourceContract(_e){invariant$2(typeof _e.canDrag=="function","Expected canDrag to be a function."),invariant$2(typeof _e.beginDrag=="function","Expected beginDrag to be a function."),invariant$2(typeof _e.endDrag=="function","Expected endDrag to be a function.")}function validateTargetContract(_e){invariant$2(typeof _e.canDrop=="function","Expected canDrop to be a function."),invariant$2(typeof _e.hover=="function","Expected hover to be a function."),invariant$2(typeof _e.drop=="function","Expected beginDrag to be a function.")}function validateType(_e,lt){if(lt&&Array.isArray(_e)){_e.forEach(Rt=>validateType(Rt,!1));return}invariant$2(typeof _e=="string"||typeof _e=="symbol",lt?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var HandlerRole;(function(_e){_e.SOURCE="SOURCE",_e.TARGET="TARGET"})(HandlerRole||(HandlerRole={}));let nextUniqueId=0;function getNextUniqueId(){return nextUniqueId++}function getNextHandlerId(_e){const lt=getNextUniqueId().toString();switch(_e){case HandlerRole.SOURCE:return`S${lt}`;case HandlerRole.TARGET:return`T${lt}`;default:throw new Error(`Unknown Handler Role: ${_e}`)}}function parseRoleFromHandlerId(_e){switch(_e[0]){case"S":return HandlerRole.SOURCE;case"T":return HandlerRole.TARGET;default:throw new Error(`Cannot parse handler ID: ${_e}`)}}function mapContainsValue(_e,lt){const Rt=_e.entries();let At=!1;do{const{done:Pt,value:[,Dt]}=Rt.next();if(Dt===lt)return!0;At=!!Pt}while(!At);return!1}class HandlerRegistryImpl{addSource(lt,Rt){validateType(lt),validateSourceContract(Rt);const At=this.addHandler(HandlerRole.SOURCE,lt,Rt);return this.store.dispatch(addSource(At)),At}addTarget(lt,Rt){validateType(lt,!0),validateTargetContract(Rt);const At=this.addHandler(HandlerRole.TARGET,lt,Rt);return this.store.dispatch(addTarget(At)),At}containsHandler(lt){return mapContainsValue(this.dragSources,lt)||mapContainsValue(this.dropTargets,lt)}getSource(lt,Rt=!1){return invariant$2(this.isSourceId(lt),"Expected a valid source ID."),Rt&<===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(lt)}getTarget(lt){return invariant$2(this.isTargetId(lt),"Expected a valid target ID."),this.dropTargets.get(lt)}getSourceType(lt){return invariant$2(this.isSourceId(lt),"Expected a valid source ID."),this.types.get(lt)}getTargetType(lt){return invariant$2(this.isTargetId(lt),"Expected a valid target ID."),this.types.get(lt)}isSourceId(lt){return parseRoleFromHandlerId(lt)===HandlerRole.SOURCE}isTargetId(lt){return parseRoleFromHandlerId(lt)===HandlerRole.TARGET}removeSource(lt){invariant$2(this.getSource(lt),"Expected an existing source."),this.store.dispatch(removeSource(lt)),asap(()=>{this.dragSources.delete(lt),this.types.delete(lt)})}removeTarget(lt){invariant$2(this.getTarget(lt),"Expected an existing target."),this.store.dispatch(removeTarget(lt)),this.dropTargets.delete(lt),this.types.delete(lt)}pinSource(lt){const Rt=this.getSource(lt);invariant$2(Rt,"Expected an existing source."),this.pinnedSourceId=lt,this.pinnedSource=Rt}unpinSource(){invariant$2(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(lt,Rt,At){const Pt=getNextHandlerId(lt);return this.types.set(Pt,Rt),lt===HandlerRole.SOURCE?this.dragSources.set(Pt,At):lt===HandlerRole.TARGET&&this.dropTargets.set(Pt,At),Pt}constructor(lt){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=lt}}const strictEquality=(_e,lt)=>_e===lt;function areCoordsEqual(_e,lt){return!_e&&!lt?!0:!_e||!lt?!1:_e.x===lt.x&&_e.y===lt.y}function areArraysEqual$1(_e,lt,Rt=strictEquality){if(_e.length!==lt.length)return!1;for(let At=0;At<_e.length;++At)if(!Rt(_e[At],lt[At]))return!1;return!0}function reduce$5(_e=NONE$2,lt){switch(lt.type){case HOVER:break;case ADD_SOURCE:case ADD_TARGET:case REMOVE_TARGET:case REMOVE_SOURCE:return NONE$2;case BEGIN_DRAG:case PUBLISH_DRAG_SOURCE:case END_DRAG:case DROP:default:return ALL}const{targetIds:Rt=[],prevTargetIds:At=[]}=lt.payload,Pt=xor(Rt,At);if(!(Pt.length>0||!areArraysEqual$1(Rt,At)))return NONE$2;const Lt=At[At.length-1],Bt=Rt[Rt.length-1];return Lt!==Bt&&(Lt&&Pt.push(Lt),Bt&&Pt.push(Bt)),Pt}function _defineProperty$7(_e,lt,Rt){return lt in _e?Object.defineProperty(_e,lt,{value:Rt,enumerable:!0,configurable:!0,writable:!0}):_e[lt]=Rt,_e}function _objectSpread$3(_e){for(var lt=1;lt=0)&&Object.prototype.propertyIsEnumerable.call(_e,At)&&(Rt[At]=_e[At])}return Rt}function _objectWithoutPropertiesLoose$2(_e,lt){if(_e==null)return{};var Rt={},At=Object.keys(_e),Pt,Dt;for(Dt=0;Dt=0)&&(Rt[Pt]=_e[Pt]);return Rt}let refCount=0;const INSTANCE_SYM=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var DndProvider=reactExports.memo(function(lt){var{children:Rt}=lt,At=_objectWithoutProperties$1(lt,["children"]);const[Pt,Dt]=getDndContextValue(At);return reactExports.useEffect(()=>{if(Dt){const Lt=getGlobalContext();return++refCount,()=>{--refCount===0&&(Lt[INSTANCE_SYM]=null)}}},[]),jsxRuntimeExports.jsx(DndContext.Provider,{value:Pt,children:Rt})});function getDndContextValue(_e){if("manager"in _e)return[{dragDropManager:_e.manager},!1];const lt=createSingletonDndContext(_e.backend,_e.context,_e.options,_e.debugMode),Rt=!_e.context;return[lt,Rt]}function createSingletonDndContext(_e,lt=getGlobalContext(),Rt,At){const Pt=lt;return Pt[INSTANCE_SYM]||(Pt[INSTANCE_SYM]={dragDropManager:createDragDropManager(_e,lt,Rt,At)}),Pt[INSTANCE_SYM]}function getGlobalContext(){return typeof global<"u"?global:window}var fastDeepEqual=function _e(lt,Rt){if(lt===Rt)return!0;if(lt&&Rt&&typeof lt=="object"&&typeof Rt=="object"){if(lt.constructor!==Rt.constructor)return!1;var At,Pt,Dt;if(Array.isArray(lt)){if(At=lt.length,At!=Rt.length)return!1;for(Pt=At;Pt--!==0;)if(!_e(lt[Pt],Rt[Pt]))return!1;return!0}if(lt.constructor===RegExp)return lt.source===Rt.source&<.flags===Rt.flags;if(lt.valueOf!==Object.prototype.valueOf)return lt.valueOf()===Rt.valueOf();if(lt.toString!==Object.prototype.toString)return lt.toString()===Rt.toString();if(Dt=Object.keys(lt),At=Dt.length,At!==Object.keys(Rt).length)return!1;for(Pt=At;Pt--!==0;)if(!Object.prototype.hasOwnProperty.call(Rt,Dt[Pt]))return!1;for(Pt=At;Pt--!==0;){var Lt=Dt[Pt];if(!_e(lt[Lt],Rt[Lt]))return!1}return!0}return lt!==lt&&Rt!==Rt};const equal$1=getDefaultExportFromCjs(fastDeepEqual),useIsomorphicLayoutEffect$6=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect;function useCollector(_e,lt,Rt){const[At,Pt]=reactExports.useState(()=>lt(_e)),Dt=reactExports.useCallback(()=>{const Lt=lt(_e);equal$1(At,Lt)||(Pt(Lt),Rt&&Rt())},[At,_e,Rt]);return useIsomorphicLayoutEffect$6(Dt),[At,Dt]}function useMonitorOutput(_e,lt,Rt){const[At,Pt]=useCollector(_e,lt,Rt);return useIsomorphicLayoutEffect$6(function(){const Lt=_e.getHandlerId();if(Lt!=null)return _e.subscribeToStateChange(Pt,{handlerIds:[Lt]})},[_e,Pt]),At}function useCollectedProps(_e,lt,Rt){return useMonitorOutput(lt,_e||(()=>({})),()=>Rt.reconnect())}function useOptionalFactory(_e,lt){const Rt=[...lt||[]];return lt==null&&typeof _e!="function"&&Rt.push(_e),reactExports.useMemo(()=>typeof _e=="function"?_e():_e,Rt)}function useConnectDragSource(_e){return reactExports.useMemo(()=>_e.hooks.dragSource(),[_e])}function useConnectDragPreview(_e){return reactExports.useMemo(()=>_e.hooks.dragPreview(),[_e])}let isCallingCanDrag=!1,isCallingIsDragging=!1;class DragSourceMonitorImpl{receiveHandlerId(lt){this.sourceId=lt}getHandlerId(){return this.sourceId}canDrag(){invariant$2(!isCallingCanDrag,"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 isCallingCanDrag=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{isCallingCanDrag=!1}}isDragging(){if(!this.sourceId)return!1;invariant$2(!isCallingIsDragging,"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 isCallingIsDragging=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{isCallingIsDragging=!1}}subscribeToStateChange(lt,Rt){return this.internalMonitor.subscribeToStateChange(lt,Rt)}isDraggingSource(lt){return this.internalMonitor.isDraggingSource(lt)}isOverTarget(lt,Rt){return this.internalMonitor.isOverTarget(lt,Rt)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(lt){return this.internalMonitor.subscribeToOffsetChange(lt)}canDragSource(lt){return this.internalMonitor.canDragSource(lt)}canDropOnTarget(lt){return this.internalMonitor.canDropOnTarget(lt)}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(lt){this.sourceId=null,this.internalMonitor=lt.getMonitor()}}let isCallingCanDrop=!1;class DropTargetMonitorImpl{receiveHandlerId(lt){this.targetId=lt}getHandlerId(){return this.targetId}subscribeToStateChange(lt,Rt){return this.internalMonitor.subscribeToStateChange(lt,Rt)}canDrop(){if(!this.targetId)return!1;invariant$2(!isCallingCanDrop,"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 isCallingCanDrop=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{isCallingCanDrop=!1}}isOver(lt){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,lt):!1}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(lt){this.targetId=null,this.internalMonitor=lt.getMonitor()}}function registerTarget(_e,lt,Rt){const At=Rt.getRegistry(),Pt=At.addTarget(_e,lt);return[Pt,()=>At.removeTarget(Pt)]}function registerSource(_e,lt,Rt){const At=Rt.getRegistry(),Pt=At.addSource(_e,lt);return[Pt,()=>At.removeSource(Pt)]}function shallowEqual$1(_e,lt,Rt,At){let Pt=Rt?Rt.call(At,_e,lt):void 0;if(Pt!==void 0)return!!Pt;if(_e===lt)return!0;if(typeof _e!="object"||!_e||typeof lt!="object"||!lt)return!1;const Dt=Object.keys(_e),Lt=Object.keys(lt);if(Dt.length!==Lt.length)return!1;const Bt=Object.prototype.hasOwnProperty.bind(lt);for(let Nt=0;Nt, or turn it into a drag source or a drop target itself.`)}function wrapHookToRecognizeElement(_e){return(lt=null,Rt=null)=>{if(!reactExports.isValidElement(lt)){const Dt=lt;return _e(Dt,Rt),Dt}const At=lt;return throwIfCompositeComponentElement(At),cloneWithRef(At,Rt?Dt=>_e(Dt,Rt):_e)}}function wrapConnectorHooks(_e){const lt={};return Object.keys(_e).forEach(Rt=>{const At=_e[Rt];if(Rt.endsWith("Ref"))lt[Rt]=_e[Rt];else{const Pt=wrapHookToRecognizeElement(At);lt[Rt]=()=>Pt}}),lt}function setRef(_e,lt){typeof _e=="function"?_e(lt):_e.current=lt}function cloneWithRef(_e,lt){const Rt=_e.ref;return invariant$2(typeof Rt!="string","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 or
. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),Rt?reactExports.cloneElement(_e,{ref:At=>{setRef(Rt,At),setRef(lt,At)}}):reactExports.cloneElement(_e,{ref:lt})}class SourceConnector{receiveHandlerId(lt){this.handlerId!==lt&&(this.handlerId=lt,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(lt){this.dragSourceOptionsInternal=lt}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(lt){this.dragPreviewOptionsInternal=lt}reconnect(){const lt=this.reconnectDragSource();this.reconnectDragPreview(lt)}reconnectDragSource(){const lt=this.dragSource,Rt=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return Rt&&this.disconnectDragSource(),this.handlerId?lt?(Rt&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=lt,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,lt,this.dragSourceOptions)),Rt):(this.lastConnectedDragSource=lt,Rt):Rt}reconnectDragPreview(lt=!1){const Rt=this.dragPreview,At=lt||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(At&&this.disconnectDragPreview(),!!this.handlerId){if(!Rt){this.lastConnectedDragPreview=Rt;return}At&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=Rt,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,Rt,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!shallowEqual$1(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!shallowEqual$1(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(lt){this.hooks=wrapConnectorHooks({dragSource:(Rt,At)=>{this.clearDragSource(),this.dragSourceOptions=At||null,isRef(Rt)?this.dragSourceRef=Rt:this.dragSourceNode=Rt,this.reconnectDragSource()},dragPreview:(Rt,At)=>{this.clearDragPreview(),this.dragPreviewOptions=At||null,isRef(Rt)?this.dragPreviewRef=Rt:this.dragPreviewNode=Rt,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=lt}}class TargetConnector{get connectTarget(){return this.dropTarget}reconnect(){const lt=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();lt&&this.disconnectDropTarget();const Rt=this.dropTarget;if(this.handlerId){if(!Rt){this.lastConnectedDropTarget=Rt;return}lt&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=Rt,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,Rt,this.dropTargetOptions))}}receiveHandlerId(lt){lt!==this.handlerId&&(this.handlerId=lt,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(lt){this.dropTargetOptionsInternal=lt}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!shallowEqual$1(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(lt){this.hooks=wrapConnectorHooks({dropTarget:(Rt,At)=>{this.clearDropTarget(),this.dropTargetOptions=At,isRef(Rt)?this.dropTargetRef=Rt:this.dropTargetNode=Rt,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=lt}}function useDragDropManager(){const{dragDropManager:_e}=reactExports.useContext(DndContext);return invariant$2(_e!=null,"Expected drag drop context"),_e}function useDragSourceConnector(_e,lt){const Rt=useDragDropManager(),At=reactExports.useMemo(()=>new SourceConnector(Rt.getBackend()),[Rt]);return useIsomorphicLayoutEffect$6(()=>(At.dragSourceOptions=_e||null,At.reconnect(),()=>At.disconnectDragSource()),[At,_e]),useIsomorphicLayoutEffect$6(()=>(At.dragPreviewOptions=lt||null,At.reconnect(),()=>At.disconnectDragPreview()),[At,lt]),At}function useDragSourceMonitor(){const _e=useDragDropManager();return reactExports.useMemo(()=>new DragSourceMonitorImpl(_e),[_e])}class DragSourceImpl{beginDrag(){const lt=this.spec,Rt=this.monitor;let At=null;return typeof lt.item=="object"?At=lt.item:typeof lt.item=="function"?At=lt.item(Rt):At={},At??null}canDrag(){const lt=this.spec,Rt=this.monitor;return typeof lt.canDrag=="boolean"?lt.canDrag:typeof lt.canDrag=="function"?lt.canDrag(Rt):!0}isDragging(lt,Rt){const At=this.spec,Pt=this.monitor,{isDragging:Dt}=At;return Dt?Dt(Pt):Rt===lt.getSourceId()}endDrag(){const lt=this.spec,Rt=this.monitor,At=this.connector,{end:Pt}=lt;Pt&&Pt(Rt.getItem(),Rt),At.reconnect()}constructor(lt,Rt,At){this.spec=lt,this.monitor=Rt,this.connector=At}}function useDragSource(_e,lt,Rt){const At=reactExports.useMemo(()=>new DragSourceImpl(_e,lt,Rt),[lt,Rt]);return reactExports.useEffect(()=>{At.spec=_e},[_e]),At}function useDragType(_e){return reactExports.useMemo(()=>{const lt=_e.type;return invariant$2(lt!=null,"spec.type must be defined"),lt},[_e])}function useRegisteredDragSource(_e,lt,Rt){const At=useDragDropManager(),Pt=useDragSource(_e,lt,Rt),Dt=useDragType(_e);useIsomorphicLayoutEffect$6(function(){if(Dt!=null){const[Bt,Nt]=registerSource(Dt,Pt,At);return lt.receiveHandlerId(Bt),Rt.receiveHandlerId(Bt),Nt}},[At,lt,Rt,Pt,Dt])}function useDrag(_e,lt){const Rt=useOptionalFactory(_e,lt);invariant$2(!Rt.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 At=useDragSourceMonitor(),Pt=useDragSourceConnector(Rt.options,Rt.previewOptions);return useRegisteredDragSource(Rt,At,Pt),[useCollectedProps(Rt.collect,At,Pt),useConnectDragSource(Pt),useConnectDragPreview(Pt)]}function useConnectDropTarget(_e){return reactExports.useMemo(()=>_e.hooks.dropTarget(),[_e])}function useDropTargetConnector(_e){const lt=useDragDropManager(),Rt=reactExports.useMemo(()=>new TargetConnector(lt.getBackend()),[lt]);return useIsomorphicLayoutEffect$6(()=>(Rt.dropTargetOptions=_e||null,Rt.reconnect(),()=>Rt.disconnectDropTarget()),[_e]),Rt}function useDropTargetMonitor(){const _e=useDragDropManager();return reactExports.useMemo(()=>new DropTargetMonitorImpl(_e),[_e])}function useAccept(_e){const{accept:lt}=_e;return reactExports.useMemo(()=>(invariant$2(_e.accept!=null,"accept must be defined"),Array.isArray(lt)?lt:[lt]),[lt])}class DropTargetImpl{canDrop(){const lt=this.spec,Rt=this.monitor;return lt.canDrop?lt.canDrop(Rt.getItem(),Rt):!0}hover(){const lt=this.spec,Rt=this.monitor;lt.hover&<.hover(Rt.getItem(),Rt)}drop(){const lt=this.spec,Rt=this.monitor;if(lt.drop)return lt.drop(Rt.getItem(),Rt)}constructor(lt,Rt){this.spec=lt,this.monitor=Rt}}function useDropTarget(_e,lt){const Rt=reactExports.useMemo(()=>new DropTargetImpl(_e,lt),[lt]);return reactExports.useEffect(()=>{Rt.spec=_e},[_e]),Rt}function useRegisteredDropTarget(_e,lt,Rt){const At=useDragDropManager(),Pt=useDropTarget(_e,lt),Dt=useAccept(_e);useIsomorphicLayoutEffect$6(function(){const[Bt,Nt]=registerTarget(Dt,Pt,At);return lt.receiveHandlerId(Bt),Rt.receiveHandlerId(Bt),Nt},[At,lt,Pt,Rt,Dt.map(Lt=>Lt.toString()).join("|")])}function useDrop(_e,lt){const Rt=useOptionalFactory(_e,lt),At=useDropTargetMonitor(),Pt=useDropTargetConnector(Rt.options);return useRegisteredDropTarget(Rt,At,Pt),[useCollectedProps(Rt.collect,At,Pt),useConnectDropTarget(Pt)]}function memoize(_e){let lt=null;return()=>(lt==null&&(lt=_e()),lt)}function without(_e,lt){return _e.filter(Rt=>Rt!==lt)}function union(_e,lt){const Rt=new Set,At=Dt=>Rt.add(Dt);_e.forEach(At),lt.forEach(At);const Pt=[];return Rt.forEach(Dt=>Pt.push(Dt)),Pt}class EnterLeaveCounter{enter(lt){const Rt=this.entered.length,At=Pt=>this.isNodeInDocument(Pt)&&(!Pt.contains||Pt.contains(lt));return this.entered=union(this.entered.filter(At),[lt]),Rt===0&&this.entered.length>0}leave(lt){const Rt=this.entered.length;return this.entered=without(this.entered.filter(this.isNodeInDocument),lt),Rt>0&&this.entered.length===0}reset(){this.entered=[]}constructor(lt){this.entered=[],this.isNodeInDocument=lt}}class NativeDragSource{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(lt=>{Object.defineProperty(this.item,lt,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${lt}" until the drop event.`),null}})})}loadDataTransfer(lt){if(lt){const Rt={};Object.keys(this.config.exposeProperties).forEach(At=>{const Pt=this.config.exposeProperties[At];Pt!=null&&(Rt[At]={value:Pt(lt,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,Rt)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(lt,Rt){return Rt===lt.getSourceId()}endDrag(){}constructor(lt){this.config=lt,this.item={},this.initializeExposedProperties()}}const FILE="__NATIVE_FILE__",URL$1="__NATIVE_URL__",TEXT="__NATIVE_TEXT__",HTML="__NATIVE_HTML__",NativeTypes=Object.freeze(Object.defineProperty({__proto__:null,FILE,HTML,TEXT,URL:URL$1},Symbol.toStringTag,{value:"Module"}));function getDataFromDataTransfer(_e,lt,Rt){const At=lt.reduce((Pt,Dt)=>Pt||_e.getData(Dt),"");return At??Rt}const nativeTypesConfig={[FILE]:{exposeProperties:{files:_e=>Array.prototype.slice.call(_e.files),items:_e=>_e.items,dataTransfer:_e=>_e},matchesTypes:["Files"]},[HTML]:{exposeProperties:{html:(_e,lt)=>getDataFromDataTransfer(_e,lt,""),dataTransfer:_e=>_e},matchesTypes:["Html","text/html"]},[URL$1]:{exposeProperties:{urls:(_e,lt)=>getDataFromDataTransfer(_e,lt,"").split(` -`),dataTransfer:_e=>_e},matchesTypes:["Url","text/uri-list"]},[TEXT]:{exposeProperties:{text:(_e,lt)=>getDataFromDataTransfer(_e,lt,""),dataTransfer:_e=>_e},matchesTypes:["Text","text/plain"]}};function createNativeDragSource(_e,lt){const Rt=nativeTypesConfig[_e];if(!Rt)throw new Error(`native type ${_e} has no configuration`);const At=new NativeDragSource(Rt);return At.loadDataTransfer(lt),At}function matchNativeItemType(_e){if(!_e)return null;const lt=Array.prototype.slice.call(_e.types||[]);return Object.keys(nativeTypesConfig).filter(Rt=>{const At=nativeTypesConfig[Rt];return At!=null&&At.matchesTypes?At.matchesTypes.some(Pt=>lt.indexOf(Pt)>-1):!1})[0]||null}const isFirefox=memoize(()=>/firefox/i.test(navigator.userAgent)),isSafari=memoize(()=>!!window.safari);class MonotonicInterpolant{interpolate(lt){const{xs:Rt,ys:At,c1s:Pt,c2s:Dt,c3s:Lt}=this;let Bt=Rt.length-1;if(lt===Rt[Bt])return At[Bt];let Nt=0,jt=Lt.length-1,Ut;for(;Nt<=jt;){Ut=Math.floor(.5*(Nt+jt));const Xt=Rt[Ut];if(Xtlt)jt=Ut-1;else return At[Ut]}Bt=Math.max(0,jt);const Gt=lt-Rt[Bt],qt=Gt*Gt;return At[Bt]+Pt[Bt]*Gt+Dt[Bt]*qt+Lt[Bt]*Gt*qt}constructor(lt,Rt){const{length:At}=lt,Pt=[];for(let Xt=0;Xtlt[Xt]{let un=new MonotonicInterpolant([0,.5,1],[Nt.y,Nt.y/Ut*Kt,Nt.y+Kt-Ut]).interpolate(qt);return isSafari()&&Dt&&(un+=(window.devicePixelRatio-1)*Kt),un},Qt=()=>new MonotonicInterpolant([0,.5,1],[Nt.x,Nt.x/jt*Xt,Nt.x+Xt-jt]).interpolate(Gt),{offsetX:Jt,offsetY:en}=Pt,tn=Jt===0||Jt,an=en===0||en;return{x:tn?Jt:Qt(),y:an?en:Zt()}}class OptionsReader{get window(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}get document(){var lt;return!((lt=this.globalContext)===null||lt===void 0)&<.document?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var lt;return((lt=this.optionsArgs)===null||lt===void 0?void 0:lt.rootElement)||this.window}constructor(lt,Rt){this.ownerDocument=null,this.globalContext=lt,this.optionsArgs=Rt}}function _defineProperty$4(_e,lt,Rt){return lt in _e?Object.defineProperty(_e,lt,{value:Rt,enumerable:!0,configurable:!0,writable:!0}):_e[lt]=Rt,_e}function _objectSpread(_e){for(var lt=1;lt{this.sourcePreviewNodes.delete(lt),this.sourcePreviewNodeOptions.delete(lt)}}connectDragSource(lt,Rt,At){this.sourceNodes.set(lt,Rt),this.sourceNodeOptions.set(lt,At);const Pt=Lt=>this.handleDragStart(Lt,lt),Dt=Lt=>this.handleSelectStart(Lt);return Rt.setAttribute("draggable","true"),Rt.addEventListener("dragstart",Pt),Rt.addEventListener("selectstart",Dt),()=>{this.sourceNodes.delete(lt),this.sourceNodeOptions.delete(lt),Rt.removeEventListener("dragstart",Pt),Rt.removeEventListener("selectstart",Dt),Rt.setAttribute("draggable","false")}}connectDropTarget(lt,Rt){const At=Lt=>this.handleDragEnter(Lt,lt),Pt=Lt=>this.handleDragOver(Lt,lt),Dt=Lt=>this.handleDrop(Lt,lt);return Rt.addEventListener("dragenter",At),Rt.addEventListener("dragover",Pt),Rt.addEventListener("drop",Dt),()=>{Rt.removeEventListener("dragenter",At),Rt.removeEventListener("dragover",Pt),Rt.removeEventListener("drop",Dt)}}addEventListeners(lt){lt.addEventListener&&(lt.addEventListener("dragstart",this.handleTopDragStart),lt.addEventListener("dragstart",this.handleTopDragStartCapture,!0),lt.addEventListener("dragend",this.handleTopDragEndCapture,!0),lt.addEventListener("dragenter",this.handleTopDragEnter),lt.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),lt.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),lt.addEventListener("dragover",this.handleTopDragOver),lt.addEventListener("dragover",this.handleTopDragOverCapture,!0),lt.addEventListener("drop",this.handleTopDrop),lt.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(lt){lt.removeEventListener&&(lt.removeEventListener("dragstart",this.handleTopDragStart),lt.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),lt.removeEventListener("dragend",this.handleTopDragEndCapture,!0),lt.removeEventListener("dragenter",this.handleTopDragEnter),lt.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),lt.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),lt.removeEventListener("dragover",this.handleTopDragOver),lt.removeEventListener("dragover",this.handleTopDragOverCapture,!0),lt.removeEventListener("drop",this.handleTopDrop),lt.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const lt=this.monitor.getSourceId(),Rt=this.sourceNodeOptions.get(lt);return _objectSpread({dropEffect:this.altKeyPressed?"copy":"move"},Rt||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const lt=this.monitor.getSourceId(),Rt=this.sourcePreviewNodeOptions.get(lt);return _objectSpread({anchorX:.5,anchorY:.5,captureDraggingState:!1},Rt||{})}isDraggingNativeItem(){const lt=this.monitor.getItemType();return Object.keys(NativeTypes).some(Rt=>NativeTypes[Rt]===lt)}beginDragNativeItem(lt,Rt){this.clearCurrentDragSourceNode(),this.currentNativeSource=createNativeDragSource(lt,Rt),this.currentNativeHandle=this.registry.addSource(lt,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(lt){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=lt;const Rt=1e3;this.mouseMoveTimeoutTimer=setTimeout(()=>{var At;return(At=this.rootElement)===null||At===void 0?void 0:At.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},Rt)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var lt;(lt=this.window)===null||lt===void 0||lt.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(lt,Rt){lt.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(Rt))}handleDragEnter(lt,Rt){this.dragEnterTargetIds.unshift(Rt)}handleDragOver(lt,Rt){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(Rt)}handleDrop(lt,Rt){this.dropTargetIds.unshift(Rt)}constructor(lt,Rt,At){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=Pt=>{const Dt=this.sourceNodes.get(Pt);return Dt&&getNodeClientOffset(Dt)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=Pt=>!!(Pt&&this.document&&this.document.body&&this.document.body.contains(Pt)),this.endDragIfSourceWasRemovedFromDOM=()=>{const Pt=this.currentDragSourceNode;Pt==null||this.isNodeInDocument(Pt)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=Pt=>{this.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(Pt||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=Pt=>{if(Pt.defaultPrevented)return;const{dragStartSourceIds:Dt}=this;this.dragStartSourceIds=null;const Lt=getEventClientOffset(Pt);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(Dt||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:Lt});const{dataTransfer:Bt}=Pt,Nt=matchNativeItemType(Bt);if(this.monitor.isDragging()){if(Bt&&typeof Bt.setDragImage=="function"){const Ut=this.monitor.getSourceId(),Gt=this.sourceNodes.get(Ut),qt=this.sourcePreviewNodes.get(Ut)||Gt;if(qt){const{anchorX:Xt,anchorY:Kt,offsetX:Zt,offsetY:Qt}=this.getCurrentSourcePreviewNodeOptions(),tn=getDragPreviewOffset(Gt,qt,Lt,{anchorX:Xt,anchorY:Kt},{offsetX:Zt,offsetY:Qt});Bt.setDragImage(qt,tn.x,tn.y)}}try{Bt==null||Bt.setData("application/json",{})}catch{}this.setCurrentDragSourceNode(Pt.target);const{captureDraggingState:jt}=this.getCurrentSourcePreviewNodeOptions();jt?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(Nt)this.beginDragNativeItem(Nt);else{if(Bt&&!Bt.types&&(Pt.target&&!Pt.target.hasAttribute||!Pt.target.hasAttribute("draggable")))return;Pt.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=Pt=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var Dt;(Dt=this.currentNativeSource)===null||Dt===void 0||Dt.loadDataTransfer(Pt.dataTransfer)}if(!this.enterLeaveCounter.enter(Pt.target)||this.monitor.isDragging())return;const{dataTransfer:Bt}=Pt,Nt=matchNativeItemType(Bt);Nt&&this.beginDragNativeItem(Nt,Bt)},this.handleTopDragEnter=Pt=>{const{dragEnterTargetIds:Dt}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=Pt.altKey,Dt.length>0&&this.actions.hover(Dt,{clientOffset:getEventClientOffset(Pt)}),Dt.some(Bt=>this.monitor.canDropOnTarget(Bt))&&(Pt.preventDefault(),Pt.dataTransfer&&(Pt.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=Pt=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var Dt;(Dt=this.currentNativeSource)===null||Dt===void 0||Dt.loadDataTransfer(Pt.dataTransfer)}},this.handleTopDragOver=Pt=>{const{dragOverTargetIds:Dt}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){Pt.preventDefault(),Pt.dataTransfer&&(Pt.dataTransfer.dropEffect="none");return}this.altKeyPressed=Pt.altKey,this.lastClientOffset=getEventClientOffset(Pt),this.scheduleHover(Dt),(Dt||[]).some(Bt=>this.monitor.canDropOnTarget(Bt))?(Pt.preventDefault(),Pt.dataTransfer&&(Pt.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?Pt.preventDefault():(Pt.preventDefault(),Pt.dataTransfer&&(Pt.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=Pt=>{this.isDraggingNativeItem()&&Pt.preventDefault(),this.enterLeaveCounter.leave(Pt.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=Pt=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var Dt;Pt.preventDefault(),(Dt=this.currentNativeSource)===null||Dt===void 0||Dt.loadDataTransfer(Pt.dataTransfer)}else matchNativeItemType(Pt.dataTransfer)&&Pt.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=Pt=>{const{dropTargetIds:Dt}=this;this.dropTargetIds=[],this.actions.hover(Dt,{clientOffset:getEventClientOffset(Pt)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=Pt=>{const Dt=Pt.target;typeof Dt.dragDrop=="function"&&(Dt.tagName==="INPUT"||Dt.tagName==="SELECT"||Dt.tagName==="TEXTAREA"||Dt.isContentEditable||(Pt.preventDefault(),Dt.dragDrop()))},this.options=new OptionsReader(Rt,At),this.actions=lt.getActions(),this.monitor=lt.getMonitor(),this.registry=lt.getRegistry(),this.enterLeaveCounter=new EnterLeaveCounter(this.isNodeInDocument)}}const HTML5Backend=function(lt,Rt,At){return new HTML5BackendImpl(lt,Rt,At)};function useEvent(_e){if(typeof window>"u")return _e;const lt=reactExports.useRef(null);return reactExports.useLayoutEffect(()=>{lt.current=_e}),reactExports.useCallback((...Rt)=>{var At;(At=lt.current)===null||At===void 0||At.call(lt,...Rt)},[])}const printedWarnings={};function warn$1(_e,lt){printedWarnings[_e]||(printedWarnings[_e]=!0,console.error("[material-ui-popup-state] WARNING",lt))}const initCoreState={isOpen:!1,setAnchorElUsed:!1,anchorEl:void 0,anchorPosition:void 0,hovered:!1,focused:!1,_openEventType:null,_childPopupState:null,_deferNextOpen:!1,_deferNextClose:!1};function usePopupState({parentPopupState:_e,popupId:lt,variant:Rt,disableAutoFocus:At}){const Pt=reactExports.useRef(!0);reactExports.useEffect(()=>(Pt.current=!0,()=>{Pt.current=!1}),[]);const[Dt,Lt]=reactExports.useState(initCoreState),Bt=reactExports.useCallback(en=>{Pt.current&&Lt(en)},[]),Nt=reactExports.useCallback(en=>Bt(tn=>({...tn,setAnchorElUsed:!0,anchorEl:en??void 0})),[]),jt=useEvent(en=>(Dt.isOpen?qt(en):Ut(en),Dt)),Ut=useEvent(en=>{const tn=en instanceof Element?void 0:en,an=en instanceof Element?en:(en==null?void 0:en.currentTarget)instanceof Element?en.currentTarget:void 0;if((tn==null?void 0:tn.type)==="touchstart"){Bt(pn=>({...pn,_deferNextOpen:!0}));return}const cn=tn==null?void 0:tn.clientX,un=tn==null?void 0:tn.clientY,rn=typeof cn=="number"&&typeof un=="number"?{left:cn,top:un}:void 0,sn=pn=>{if(!en&&!pn.setAnchorElUsed&&Rt!=="dialog"&&warn$1("missingEventOrAnchorEl","eventOrAnchorEl should be defined if setAnchorEl is not used"),_e){if(!_e.isOpen)return pn;setTimeout(()=>_e._setChildPopupState(Jt))}const bn={...pn,isOpen:!0,anchorPosition:rn,hovered:(tn==null?void 0:tn.type)==="mouseover"||pn.hovered,focused:(tn==null?void 0:tn.type)==="focus"||pn.focused,_openEventType:tn==null?void 0:tn.type};return tn!=null&&tn.currentTarget?pn.setAnchorElUsed||(bn.anchorEl=tn==null?void 0:tn.currentTarget):an&&(bn.anchorEl=an),bn};Bt(pn=>pn._deferNextOpen?(setTimeout(()=>Bt(sn),0),{...pn,_deferNextOpen:!1}):sn(pn))}),Gt=en=>{const{_childPopupState:tn}=en;return setTimeout(()=>{tn==null||tn.close(),_e==null||_e._setChildPopupState(null)}),{...en,isOpen:!1,hovered:!1,focused:!1}},qt=useEvent(en=>{const tn=en instanceof Element?void 0:en;if((tn==null?void 0:tn.type)==="touchstart"){Bt(an=>({...an,_deferNextClose:!0}));return}Bt(an=>an._deferNextClose?(setTimeout(()=>Bt(Gt),0),{...an,_deferNextClose:!1}):Gt(an))}),Xt=reactExports.useCallback((en,tn)=>{en?Ut(tn):qt(tn)},[]),Kt=useEvent(en=>{const{relatedTarget:tn}=en;Bt(an=>an.hovered&&!(tn instanceof Element&&isElementInPopup(tn,Jt))?an.focused?{...an,hovered:!1}:Gt(an):an)}),Zt=useEvent(en=>{if(!en)return;const{relatedTarget:tn}=en;Bt(an=>an.focused&&!(tn instanceof Element&&isElementInPopup(tn,Jt))?an.hovered?{...an,focused:!1}:Gt(an):an)}),Qt=reactExports.useCallback(en=>Bt(tn=>({...tn,_childPopupState:en})),[]),Jt={...Dt,setAnchorEl:Nt,popupId:lt,variant:Rt,open:Ut,close:qt,toggle:jt,setOpen:Xt,onBlur:Zt,onMouseLeave:Kt,disableAutoFocus:At??!!(Dt.hovered||Dt.focused),_setChildPopupState:Qt};return Jt}function controlAriaProps({isOpen:_e,popupId:lt,variant:Rt}){return{...Rt==="popover"?{"aria-haspopup":!0,"aria-controls":_e&<!=null?lt:void 0}:Rt==="popper"?{"aria-describedby":_e&<!=null?lt:void 0}:void 0}}function bindTrigger(_e){return{...controlAriaProps(_e),onClick:_e.open,onTouchStart:_e.open}}function bindPopover({isOpen:_e,anchorEl:lt,anchorPosition:Rt,close:At,popupId:Pt,onMouseLeave:Dt,disableAutoFocus:Lt,_openEventType:Bt}){return{id:Pt,anchorEl:lt,anchorPosition:Rt,anchorReference:Bt==="contextmenu"?"anchorPosition":"anchorEl",open:_e,onClose:At,onMouseLeave:Dt,...Lt&&{disableAutoFocus:!0,disableEnforceFocus:!0,disableRestoreFocus:!0}}}function bindMenu({isOpen:_e,anchorEl:lt,anchorPosition:Rt,close:At,popupId:Pt,onMouseLeave:Dt,disableAutoFocus:Lt,_openEventType:Bt}){return{id:Pt,anchorEl:lt,anchorPosition:Rt,anchorReference:Bt==="contextmenu"?"anchorPosition":"anchorEl",open:_e,onClose:At,onMouseLeave:Dt,...Lt&&{autoFocus:!1,disableAutoFocusItem:!0,disableAutoFocus:!0,disableEnforceFocus:!0,disableRestoreFocus:!0}}}function getPopup(_e,{popupId:lt}){if(!lt)return null;const Rt=typeof _e.getRootNode=="function"?_e.getRootNode():document;return typeof Rt.getElementById=="function"?Rt.getElementById(lt):null}function isElementInPopup(_e,lt){const{anchorEl:Rt,_childPopupState:At}=lt;return isAncestor(Rt,_e)||isAncestor(getPopup(_e,lt),_e)||At!=null&&isElementInPopup(_e,At)}function isAncestor(_e,lt){if(!_e)return!1;for(;lt;){if(lt===_e)return!0;lt=lt.parentElement}return!1}function PopupState({children:_e,popupId:lt,variant:Rt,parentPopupState:At,disableAutoFocus:Pt}){const Dt=usePopupState({popupId:lt,variant:Rt,parentPopupState:At,disableAutoFocus:Pt}),Lt=_e(Dt);return Lt??null}PopupState.propTypes={children:PropTypes$1.func.isRequired,popupId:PropTypes$1.string,variant:PropTypes$1.oneOf(["popover","popper"]).isRequired,parentPopupState:PropTypes$1.object,disableAutoFocus:PropTypes$1.bool};function ViewControls({onSplitHorizontal:_e,onClose:lt,onSplitVertical:Rt,closeDisabled:At,splitHorizontalDisabled:Pt,splitVerticalDisabled:Dt,onPopOut:Lt,popOutDisabled:Bt}){return jsxRuntimeExports.jsx(PopupState,{variant:"popover",children:Nt=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Stack$1,{sx:{m:1},children:jsxRuntimeExports.jsx(Tooltip$1,{title:"Panel Options",children:jsxRuntimeExports.jsx(IconButton$1,{size:"small",...bindTrigger(Nt),children:jsxRuntimeExports.jsx(MoreVertOutlined,{fontSize:"small"})})})}),jsxRuntimeExports.jsxs(Menu$1,{TransitionProps:{mountOnEnter:!0,unmountOnExit:!0},...bindMenu(Nt),transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"top"},children:[jsxRuntimeExports.jsxs(MenuItem$1,{onClick:()=>{Rt==null||Rt(),Nt.close()},disabled:Dt,children:[jsxRuntimeExports.jsx(ListItemIcon$1,{children:jsxRuntimeExports.jsx(SplitIcon,{fontSize:"small"})}),jsxRuntimeExports.jsx(ListItemText$1,{children:"Split Vertical"})]}),jsxRuntimeExports.jsxs(MenuItem$1,{onClick:()=>{_e==null||_e(),Nt.close()},disabled:Pt,children:[jsxRuntimeExports.jsx(ListItemIcon$1,{children:jsxRuntimeExports.jsx(SplitIcon,{fontSize:"small",sx:{transform:"rotate(90deg)"}})}),jsxRuntimeExports.jsx(ListItemText$1,{children:"Split Horizontal"})]}),jsxRuntimeExports.jsx(Divider$1,{}),!Bt&&jsxRuntimeExports.jsxs(Box$1,{children:[jsxRuntimeExports.jsxs(MenuItem$1,{onClick:()=>{Lt==null||Lt(),Nt.close()},children:[jsxRuntimeExports.jsx(ListItemIcon$1,{children:jsxRuntimeExports.jsx(OpenInNewOutlined,{fontSize:"small"})}),jsxRuntimeExports.jsx(ListItemText$1,{children:"Pop Out"})]}),jsxRuntimeExports.jsx(Divider$1,{})]}),jsxRuntimeExports.jsxs(MenuItem$1,{onClick:()=>{lt==null||lt(),Nt.close()},disabled:At,children:[jsxRuntimeExports.jsx(ListItemIcon$1,{children:jsxRuntimeExports.jsx(CloseOutlined,{fontSize:"small"})}),jsxRuntimeExports.jsx(ListItemText$1,{children:"Close Panel"})]})]})]})})}function findInTree(_e,lt){const Rt=At=>{var Pt;return"children"in At&&((Pt=At.children)!=null&&Pt.length)?lodashExports$1.flatMap(At.children,Rt):[At]};return lodashExports$1.find(Rt(_e),lt)}const ViewTreeContext=reactExports.createContext({});function useViewTreeContext(){return reactExports.useContext(ViewTreeContext)}function handleSwap(_e,lt,Rt){const At=findInTree(_e,Dt=>Dt.key===lt),Pt=findInTree(_e,Dt=>Dt.key===Rt);if((At==null?void 0:At.type)==="leaf"&&(Pt==null?void 0:Pt.type)==="leaf"){const Dt=lodashExports$1.pick(At,"content","key"),Lt=lodashExports$1.pick(Pt,"content","key");Object.assign(At,Lt),Object.assign(Pt,Dt)}return _e}function ViewTree(_e){const{onChange:lt,root:Rt}=_e;return jsxRuntimeExports.jsx(DndProvider,{backend:HTML5Backend,children:jsxRuntimeExports.jsx(ViewBranch,{..._e,onSwap:(At,Pt)=>{Rt&&(lt==null||lt(produce(Rt,Dt=>handleSwap(Dt,At,Pt))))}})})}function ViewLeaf({root:_e={type:"leaf",key:""},renderLeaf:lt,onChange:Rt,onClose:At,onPopOut:Pt,canPopOut:Dt,depth:Lt=0,onSwap:Bt,onDrop:Nt}){const[{isOver:jt},Ut]=useDrop(()=>({accept:["panel"],collect:Kt=>({isOver:Kt.isOver()&&Kt.getItem().key!==_e.key&&!!_e.acceptDrop}),drop:Kt=>{Nt==null||Nt(Kt,_e),Bt==null||Bt(Kt.key,_e.key)}})),[{isDragging:Gt},qt]=useDrag(()=>({type:"panel",item:_e,collect:Kt=>({isDragging:Kt.isDragging()})})),Xt=reactExports.useMemo(()=>{const Kt=Zt=>Rt==null?void 0:Rt(transaction(_e,Qt=>({key:nanoid$1(),type:"branch",orientation:Zt,children:[{...structuredClone(Qt),size:50,key:nanoid$1()},{...structuredClone(Qt),size:50,key:nanoid$1()}]})));return _e.type==="leaf"?{isViewTree:!0,state:_e.content,controls:jsxRuntimeExports.jsx(ViewControls,{onClose:At,closeDisabled:!Lt,onSplitHorizontal:()=>Kt("horizontal"),onSplitVertical:()=>Kt("vertical"),onPopOut:()=>Pt==null?void 0:Pt(_e),popOutDisabled:!(Dt!=null&&Dt(_e))}),dragHandle:jsxRuntimeExports.jsx(Box$1,{ref:qt,sx:{display:"flex",alignItems:"center"},children:jsxRuntimeExports.jsx(DragIndicatorOutlined,{fontSize:"small",color:"disabled",sx:{mr:.5,cursor:"grab"}})}),onChange:Zt=>Rt==null?void 0:Rt(produce(_e,Qt=>{Qt.content={...Qt.content,...Zt}}))}:{}},[Rt,At,Lt,_e,qt]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Flex,{ref:Ut,sx:{overflow:"hidden","::before":{pointerEvents:"none",content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1,boxShadow:Kt=>jt?`inset 0 0 0 2px ${Kt.palette.primary.main}`:"none",transition:Kt=>Kt.transitions.create("box-shadow")},transition:Kt=>Kt.transitions.create("opacity"),opacity:Kt=>Gt?Kt.palette.action.disabledOpacity:1},children:jsxRuntimeExports.jsx(ViewTreeContext.Provider,{value:Xt,children:lt==null?void 0:lt(_e)})})})}function ViewBranch(_e){const{root:lt={type:"leaf",key:""},onChange:Rt,depth:At=0}=_e,{palette:Pt,spacing:Dt,transitions:Lt}=useTheme(),Bt=useCss$1({"div&":{background:Pt.text.secondary,opacity:.5,transition:Lt.create("opacity"),"&.Horizontal":{width:"3px"},"&.Vertical":{height:"3px"}}}),Nt=useCss$1({"div&":{background:Pt.mode==="dark"?Pt.background.default:Pt.divider,boxShadow:`inset 0 0 0 1px ${Pt.background.paper}`,"&:hover":{background:Pt.primary.main,boxShadow:"none"},"&.Horizontal":{padding:0,width:"3px"},"&.Vertical":{padding:0}}}),jt=Gt=>Number(Dt(Gt).slice(0,-2));function Ut(Gt,qt=[]){const Xt=lodashExports$1.chain(qt).map(Kt=>lodashExports$1.isUndefined(Kt.size)||isNaN(Kt.size)?0:Kt.size).sum().value();return lodashExports$1.isUndefined(Gt)?100-Xt:Gt}return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:lt.type==="leaf"?jsxRuntimeExports.jsx(ViewLeaf,{..._e}):jsxRuntimeExports.jsx(m$5,{gutterClassName:Nt,draggerClassName:Bt,onResizeFinished:(Gt,qt)=>Rt==null?void 0:Rt(produce(lt,Xt=>{lodashExports$1.forEach(qt,(Kt,Zt)=>{Xt.children[Zt].size=Kt})})),minHeights:lodashExports$1.map(lt.children,()=>jt(6)-8),minWidths:lodashExports$1.map(lt.children,()=>jt(32)),initialSizes:lodashExports$1.map(lt.children,(Gt,qt,Xt)=>Ut(Gt.size,Xt)),direction:{vertical:z$4.Vertical,horizontal:z$4.Horizontal}[lt.orientation],children:lodashExports$1.map(lt.children,(Gt,qt)=>reactExports.createElement(ViewBranch,{..._e,key:Gt.key,depth:At+1,root:Gt,onChange:Xt=>Rt==null?void 0:Rt(produce(lt,Kt=>Kt.children[qt]=Xt)),onClose:()=>Rt==null?void 0:Rt(transaction(lt,Xt=>(Xt.children.splice(qt,1),Xt.children.length===1?Xt.children[0].type==="leaf"?{type:"leaf",key:nanoid$1(),content:Xt.children[0].content}:Xt.children[0]:(lodashExports$1.forEach(Xt.children,(Kt,Zt,Qt)=>Kt.size=100/Qt.length),Xt))))}))})})}function useSmallDisplay(){const _e=useTheme();return useMediaQuery(_e.breakpoints.down("sm"))}const itemHeight$1=_e=>_e?48:36,padding$1=8;function Select({trigger:_e,items:lt,value:Rt,onChange:At,showTooltip:Pt,placeholder:Dt="Select Option"}){const Lt=useSmallDisplay(),Bt=lodashExports$1.max([lodashExports$1.findIndex(lt,{value:Rt}),0])??0;return jsxRuntimeExports.jsx(PopupState,{variant:"popover",children:Nt=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Tooltip$1,{title:Dt,children:jsxRuntimeExports.jsx("span",{children:_e==null?void 0:_e(bindTrigger(Nt))})}),jsxRuntimeExports.jsx(Menu$1,{...bindMenu(Nt),anchorOrigin:{horizontal:"center",vertical:-itemHeight$1(Lt)*Bt-padding$1},transformOrigin:{vertical:"top",horizontal:"center"},children:lodashExports$1.map(lt,({value:jt,label:Ut,disabled:Gt,icon:qt})=>jsxRuntimeExports.jsx(Tooltip$1,{title:Pt&&jt,placement:"right",children:jsxRuntimeExports.jsxs(MenuItem$1,{disabled:Gt,value:jt,selected:jt===Rt,onClick:()=>{Nt.close(),At==null||At(jt)},children:[qt&&jsxRuntimeExports.jsx(ListItemIcon$1,{sx:{transform:"scale(0.8)"},children:qt}),Ut]},jt)},jt))})]})})}function SelectField(_e){const{placeholder:lt,value:Rt,items:At=[],onChange:Pt}=_e;return jsxRuntimeExports.jsx(TextField$1,{sx:{minWidth:120},select:!0,label:lt,defaultValue:Rt,variant:"filled",..._e,onChange:Dt=>Pt==null?void 0:Pt(Dt.target.value),children:lodashExports$1.map(At,Dt=>jsxRuntimeExports.jsx(MenuItem$1,{value:Dt.value,children:Dt.label},Dt.value))})}const defaultRemotes=[{url:"https://cdn.jsdelivr.net/gh/path-visualiser/app@adapter-warthog-wasm-dist/warthog-wasm.mjs",transport:"ipc",key:"default-ipc"}],defaultRenderers=[{url:"internal://d2-renderer/",key:"d2-renderer",transport:"native"}],defaultPlaybackRate=1,defaults$3={renderer:defaultRenderers,remote:defaultRemotes,"playback/playbackRate":defaultPlaybackRate,"appearance/theme":"dark","appearance/acrylic":!0,"appearance/accentColor":"blue","behaviour/showOnStart":"explore"},[useSettings,SettingsProvider]=createSlice({},withLocalStorage("settings",defaults$3)),{common,...accentColors}=colors,shadow=` +`),dataTransfer:_e=>_e},matchesTypes:["Url","text/uri-list"]},[TEXT]:{exposeProperties:{text:(_e,lt)=>getDataFromDataTransfer(_e,lt,""),dataTransfer:_e=>_e},matchesTypes:["Text","text/plain"]}};function createNativeDragSource(_e,lt){const Rt=nativeTypesConfig[_e];if(!Rt)throw new Error(`native type ${_e} has no configuration`);const At=new NativeDragSource(Rt);return At.loadDataTransfer(lt),At}function matchNativeItemType(_e){if(!_e)return null;const lt=Array.prototype.slice.call(_e.types||[]);return Object.keys(nativeTypesConfig).filter(Rt=>{const At=nativeTypesConfig[Rt];return At!=null&&At.matchesTypes?At.matchesTypes.some(Pt=>lt.indexOf(Pt)>-1):!1})[0]||null}const isFirefox=memoize(()=>/firefox/i.test(navigator.userAgent)),isSafari=memoize(()=>!!window.safari);class MonotonicInterpolant{interpolate(lt){const{xs:Rt,ys:At,c1s:Pt,c2s:Dt,c3s:Lt}=this;let Bt=Rt.length-1;if(lt===Rt[Bt])return At[Bt];let Nt=0,jt=Lt.length-1,Ut;for(;Nt<=jt;){Ut=Math.floor(.5*(Nt+jt));const Xt=Rt[Ut];if(Xtlt)jt=Ut-1;else return At[Ut]}Bt=Math.max(0,jt);const Gt=lt-Rt[Bt],qt=Gt*Gt;return At[Bt]+Pt[Bt]*Gt+Dt[Bt]*qt+Lt[Bt]*Gt*qt}constructor(lt,Rt){const{length:At}=lt,Pt=[];for(let Xt=0;Xtlt[Xt]{let un=new MonotonicInterpolant([0,.5,1],[Nt.y,Nt.y/Ut*Kt,Nt.y+Kt-Ut]).interpolate(qt);return isSafari()&&Dt&&(un+=(window.devicePixelRatio-1)*Kt),un},Qt=()=>new MonotonicInterpolant([0,.5,1],[Nt.x,Nt.x/jt*Xt,Nt.x+Xt-jt]).interpolate(Gt),{offsetX:Jt,offsetY:en}=Pt,tn=Jt===0||Jt,an=en===0||en;return{x:tn?Jt:Qt(),y:an?en:Zt()}}class OptionsReader{get window(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}get document(){var lt;return!((lt=this.globalContext)===null||lt===void 0)&<.document?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var lt;return((lt=this.optionsArgs)===null||lt===void 0?void 0:lt.rootElement)||this.window}constructor(lt,Rt){this.ownerDocument=null,this.globalContext=lt,this.optionsArgs=Rt}}function _defineProperty$4(_e,lt,Rt){return lt in _e?Object.defineProperty(_e,lt,{value:Rt,enumerable:!0,configurable:!0,writable:!0}):_e[lt]=Rt,_e}function _objectSpread(_e){for(var lt=1;lt{this.sourcePreviewNodes.delete(lt),this.sourcePreviewNodeOptions.delete(lt)}}connectDragSource(lt,Rt,At){this.sourceNodes.set(lt,Rt),this.sourceNodeOptions.set(lt,At);const Pt=Lt=>this.handleDragStart(Lt,lt),Dt=Lt=>this.handleSelectStart(Lt);return Rt.setAttribute("draggable","true"),Rt.addEventListener("dragstart",Pt),Rt.addEventListener("selectstart",Dt),()=>{this.sourceNodes.delete(lt),this.sourceNodeOptions.delete(lt),Rt.removeEventListener("dragstart",Pt),Rt.removeEventListener("selectstart",Dt),Rt.setAttribute("draggable","false")}}connectDropTarget(lt,Rt){const At=Lt=>this.handleDragEnter(Lt,lt),Pt=Lt=>this.handleDragOver(Lt,lt),Dt=Lt=>this.handleDrop(Lt,lt);return Rt.addEventListener("dragenter",At),Rt.addEventListener("dragover",Pt),Rt.addEventListener("drop",Dt),()=>{Rt.removeEventListener("dragenter",At),Rt.removeEventListener("dragover",Pt),Rt.removeEventListener("drop",Dt)}}addEventListeners(lt){lt.addEventListener&&(lt.addEventListener("dragstart",this.handleTopDragStart),lt.addEventListener("dragstart",this.handleTopDragStartCapture,!0),lt.addEventListener("dragend",this.handleTopDragEndCapture,!0),lt.addEventListener("dragenter",this.handleTopDragEnter),lt.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),lt.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),lt.addEventListener("dragover",this.handleTopDragOver),lt.addEventListener("dragover",this.handleTopDragOverCapture,!0),lt.addEventListener("drop",this.handleTopDrop),lt.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(lt){lt.removeEventListener&&(lt.removeEventListener("dragstart",this.handleTopDragStart),lt.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),lt.removeEventListener("dragend",this.handleTopDragEndCapture,!0),lt.removeEventListener("dragenter",this.handleTopDragEnter),lt.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),lt.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),lt.removeEventListener("dragover",this.handleTopDragOver),lt.removeEventListener("dragover",this.handleTopDragOverCapture,!0),lt.removeEventListener("drop",this.handleTopDrop),lt.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const lt=this.monitor.getSourceId(),Rt=this.sourceNodeOptions.get(lt);return _objectSpread({dropEffect:this.altKeyPressed?"copy":"move"},Rt||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const lt=this.monitor.getSourceId(),Rt=this.sourcePreviewNodeOptions.get(lt);return _objectSpread({anchorX:.5,anchorY:.5,captureDraggingState:!1},Rt||{})}isDraggingNativeItem(){const lt=this.monitor.getItemType();return Object.keys(NativeTypes).some(Rt=>NativeTypes[Rt]===lt)}beginDragNativeItem(lt,Rt){this.clearCurrentDragSourceNode(),this.currentNativeSource=createNativeDragSource(lt,Rt),this.currentNativeHandle=this.registry.addSource(lt,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(lt){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=lt;const Rt=1e3;this.mouseMoveTimeoutTimer=setTimeout(()=>{var At;return(At=this.rootElement)===null||At===void 0?void 0:At.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},Rt)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var lt;(lt=this.window)===null||lt===void 0||lt.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(lt,Rt){lt.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(Rt))}handleDragEnter(lt,Rt){this.dragEnterTargetIds.unshift(Rt)}handleDragOver(lt,Rt){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(Rt)}handleDrop(lt,Rt){this.dropTargetIds.unshift(Rt)}constructor(lt,Rt,At){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=Pt=>{const Dt=this.sourceNodes.get(Pt);return Dt&&getNodeClientOffset(Dt)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=Pt=>!!(Pt&&this.document&&this.document.body&&this.document.body.contains(Pt)),this.endDragIfSourceWasRemovedFromDOM=()=>{const Pt=this.currentDragSourceNode;Pt==null||this.isNodeInDocument(Pt)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=Pt=>{this.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(Pt||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=Pt=>{if(Pt.defaultPrevented)return;const{dragStartSourceIds:Dt}=this;this.dragStartSourceIds=null;const Lt=getEventClientOffset(Pt);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(Dt||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:Lt});const{dataTransfer:Bt}=Pt,Nt=matchNativeItemType(Bt);if(this.monitor.isDragging()){if(Bt&&typeof Bt.setDragImage=="function"){const Ut=this.monitor.getSourceId(),Gt=this.sourceNodes.get(Ut),qt=this.sourcePreviewNodes.get(Ut)||Gt;if(qt){const{anchorX:Xt,anchorY:Kt,offsetX:Zt,offsetY:Qt}=this.getCurrentSourcePreviewNodeOptions(),tn=getDragPreviewOffset(Gt,qt,Lt,{anchorX:Xt,anchorY:Kt},{offsetX:Zt,offsetY:Qt});Bt.setDragImage(qt,tn.x,tn.y)}}try{Bt==null||Bt.setData("application/json",{})}catch{}this.setCurrentDragSourceNode(Pt.target);const{captureDraggingState:jt}=this.getCurrentSourcePreviewNodeOptions();jt?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(Nt)this.beginDragNativeItem(Nt);else{if(Bt&&!Bt.types&&(Pt.target&&!Pt.target.hasAttribute||!Pt.target.hasAttribute("draggable")))return;Pt.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=Pt=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var Dt;(Dt=this.currentNativeSource)===null||Dt===void 0||Dt.loadDataTransfer(Pt.dataTransfer)}if(!this.enterLeaveCounter.enter(Pt.target)||this.monitor.isDragging())return;const{dataTransfer:Bt}=Pt,Nt=matchNativeItemType(Bt);Nt&&this.beginDragNativeItem(Nt,Bt)},this.handleTopDragEnter=Pt=>{const{dragEnterTargetIds:Dt}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=Pt.altKey,Dt.length>0&&this.actions.hover(Dt,{clientOffset:getEventClientOffset(Pt)}),Dt.some(Bt=>this.monitor.canDropOnTarget(Bt))&&(Pt.preventDefault(),Pt.dataTransfer&&(Pt.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=Pt=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var Dt;(Dt=this.currentNativeSource)===null||Dt===void 0||Dt.loadDataTransfer(Pt.dataTransfer)}},this.handleTopDragOver=Pt=>{const{dragOverTargetIds:Dt}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){Pt.preventDefault(),Pt.dataTransfer&&(Pt.dataTransfer.dropEffect="none");return}this.altKeyPressed=Pt.altKey,this.lastClientOffset=getEventClientOffset(Pt),this.scheduleHover(Dt),(Dt||[]).some(Bt=>this.monitor.canDropOnTarget(Bt))?(Pt.preventDefault(),Pt.dataTransfer&&(Pt.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?Pt.preventDefault():(Pt.preventDefault(),Pt.dataTransfer&&(Pt.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=Pt=>{this.isDraggingNativeItem()&&Pt.preventDefault(),this.enterLeaveCounter.leave(Pt.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=Pt=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var Dt;Pt.preventDefault(),(Dt=this.currentNativeSource)===null||Dt===void 0||Dt.loadDataTransfer(Pt.dataTransfer)}else matchNativeItemType(Pt.dataTransfer)&&Pt.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=Pt=>{const{dropTargetIds:Dt}=this;this.dropTargetIds=[],this.actions.hover(Dt,{clientOffset:getEventClientOffset(Pt)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=Pt=>{const Dt=Pt.target;typeof Dt.dragDrop=="function"&&(Dt.tagName==="INPUT"||Dt.tagName==="SELECT"||Dt.tagName==="TEXTAREA"||Dt.isContentEditable||(Pt.preventDefault(),Dt.dragDrop()))},this.options=new OptionsReader(Rt,At),this.actions=lt.getActions(),this.monitor=lt.getMonitor(),this.registry=lt.getRegistry(),this.enterLeaveCounter=new EnterLeaveCounter(this.isNodeInDocument)}}const HTML5Backend=function(lt,Rt,At){return new HTML5BackendImpl(lt,Rt,At)};function useEvent(_e){if(typeof window>"u")return _e;const lt=reactExports.useRef(null);return reactExports.useLayoutEffect(()=>{lt.current=_e}),reactExports.useCallback((...Rt)=>{var At;(At=lt.current)===null||At===void 0||At.call(lt,...Rt)},[])}const printedWarnings={};function warn$1(_e,lt){printedWarnings[_e]||(printedWarnings[_e]=!0,console.error("[material-ui-popup-state] WARNING",lt))}const initCoreState={isOpen:!1,setAnchorElUsed:!1,anchorEl:void 0,anchorPosition:void 0,hovered:!1,focused:!1,_openEventType:null,_childPopupState:null,_deferNextOpen:!1,_deferNextClose:!1};function usePopupState({parentPopupState:_e,popupId:lt,variant:Rt,disableAutoFocus:At}){const Pt=reactExports.useRef(!0);reactExports.useEffect(()=>(Pt.current=!0,()=>{Pt.current=!1}),[]);const[Dt,Lt]=reactExports.useState(initCoreState),Bt=reactExports.useCallback(en=>{Pt.current&&Lt(en)},[]),Nt=reactExports.useCallback(en=>Bt(tn=>({...tn,setAnchorElUsed:!0,anchorEl:en??void 0})),[]),jt=useEvent(en=>(Dt.isOpen?qt(en):Ut(en),Dt)),Ut=useEvent(en=>{const tn=en instanceof Element?void 0:en,an=en instanceof Element?en:(en==null?void 0:en.currentTarget)instanceof Element?en.currentTarget:void 0;if((tn==null?void 0:tn.type)==="touchstart"){Bt(pn=>({...pn,_deferNextOpen:!0}));return}const cn=tn==null?void 0:tn.clientX,un=tn==null?void 0:tn.clientY,rn=typeof cn=="number"&&typeof un=="number"?{left:cn,top:un}:void 0,sn=pn=>{if(!en&&!pn.setAnchorElUsed&&Rt!=="dialog"&&warn$1("missingEventOrAnchorEl","eventOrAnchorEl should be defined if setAnchorEl is not used"),_e){if(!_e.isOpen)return pn;setTimeout(()=>_e._setChildPopupState(Jt))}const bn={...pn,isOpen:!0,anchorPosition:rn,hovered:(tn==null?void 0:tn.type)==="mouseover"||pn.hovered,focused:(tn==null?void 0:tn.type)==="focus"||pn.focused,_openEventType:tn==null?void 0:tn.type};return tn!=null&&tn.currentTarget?pn.setAnchorElUsed||(bn.anchorEl=tn==null?void 0:tn.currentTarget):an&&(bn.anchorEl=an),bn};Bt(pn=>pn._deferNextOpen?(setTimeout(()=>Bt(sn),0),{...pn,_deferNextOpen:!1}):sn(pn))}),Gt=en=>{const{_childPopupState:tn}=en;return setTimeout(()=>{tn==null||tn.close(),_e==null||_e._setChildPopupState(null)}),{...en,isOpen:!1,hovered:!1,focused:!1}},qt=useEvent(en=>{const tn=en instanceof Element?void 0:en;if((tn==null?void 0:tn.type)==="touchstart"){Bt(an=>({...an,_deferNextClose:!0}));return}Bt(an=>an._deferNextClose?(setTimeout(()=>Bt(Gt),0),{...an,_deferNextClose:!1}):Gt(an))}),Xt=reactExports.useCallback((en,tn)=>{en?Ut(tn):qt(tn)},[]),Kt=useEvent(en=>{const{relatedTarget:tn}=en;Bt(an=>an.hovered&&!(tn instanceof Element&&isElementInPopup(tn,Jt))?an.focused?{...an,hovered:!1}:Gt(an):an)}),Zt=useEvent(en=>{if(!en)return;const{relatedTarget:tn}=en;Bt(an=>an.focused&&!(tn instanceof Element&&isElementInPopup(tn,Jt))?an.hovered?{...an,focused:!1}:Gt(an):an)}),Qt=reactExports.useCallback(en=>Bt(tn=>({...tn,_childPopupState:en})),[]),Jt={...Dt,setAnchorEl:Nt,popupId:lt,variant:Rt,open:Ut,close:qt,toggle:jt,setOpen:Xt,onBlur:Zt,onMouseLeave:Kt,disableAutoFocus:At??!!(Dt.hovered||Dt.focused),_setChildPopupState:Qt};return Jt}function controlAriaProps({isOpen:_e,popupId:lt,variant:Rt}){return{...Rt==="popover"?{"aria-haspopup":!0,"aria-controls":_e&<!=null?lt:void 0}:Rt==="popper"?{"aria-describedby":_e&<!=null?lt:void 0}:void 0}}function bindTrigger(_e){return{...controlAriaProps(_e),onClick:_e.open,onTouchStart:_e.open}}function bindPopover({isOpen:_e,anchorEl:lt,anchorPosition:Rt,close:At,popupId:Pt,onMouseLeave:Dt,disableAutoFocus:Lt,_openEventType:Bt}){return{id:Pt,anchorEl:lt,anchorPosition:Rt,anchorReference:Bt==="contextmenu"?"anchorPosition":"anchorEl",open:_e,onClose:At,onMouseLeave:Dt,...Lt&&{disableAutoFocus:!0,disableEnforceFocus:!0,disableRestoreFocus:!0}}}function bindMenu({isOpen:_e,anchorEl:lt,anchorPosition:Rt,close:At,popupId:Pt,onMouseLeave:Dt,disableAutoFocus:Lt,_openEventType:Bt}){return{id:Pt,anchorEl:lt,anchorPosition:Rt,anchorReference:Bt==="contextmenu"?"anchorPosition":"anchorEl",open:_e,onClose:At,onMouseLeave:Dt,...Lt&&{autoFocus:!1,disableAutoFocusItem:!0,disableAutoFocus:!0,disableEnforceFocus:!0,disableRestoreFocus:!0}}}function getPopup(_e,{popupId:lt}){if(!lt)return null;const Rt=typeof _e.getRootNode=="function"?_e.getRootNode():document;return typeof Rt.getElementById=="function"?Rt.getElementById(lt):null}function isElementInPopup(_e,lt){const{anchorEl:Rt,_childPopupState:At}=lt;return isAncestor(Rt,_e)||isAncestor(getPopup(_e,lt),_e)||At!=null&&isElementInPopup(_e,At)}function isAncestor(_e,lt){if(!_e)return!1;for(;lt;){if(lt===_e)return!0;lt=lt.parentElement}return!1}function PopupState({children:_e,popupId:lt,variant:Rt,parentPopupState:At,disableAutoFocus:Pt}){const Dt=usePopupState({popupId:lt,variant:Rt,parentPopupState:At,disableAutoFocus:Pt}),Lt=_e(Dt);return Lt??null}PopupState.propTypes={children:PropTypes$1.func.isRequired,popupId:PropTypes$1.string,variant:PropTypes$1.oneOf(["popover","popper"]).isRequired,parentPopupState:PropTypes$1.object,disableAutoFocus:PropTypes$1.bool};function ViewControls({onSplitHorizontal:_e,onClose:lt,onSplitVertical:Rt,closeDisabled:At,splitHorizontalDisabled:Pt,splitVerticalDisabled:Dt,onPopOut:Lt,popOutDisabled:Bt}){return jsxRuntimeExports.jsx(PopupState,{variant:"popover",children:Nt=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Stack$1,{sx:{m:1},children:jsxRuntimeExports.jsx(Tooltip$1,{title:"Panel Options",children:jsxRuntimeExports.jsx(IconButton$1,{size:"small",...bindTrigger(Nt),children:jsxRuntimeExports.jsx(MoreVertOutlined,{fontSize:"small"})})})}),jsxRuntimeExports.jsxs(Menu$1,{TransitionProps:{mountOnEnter:!0,unmountOnExit:!0},...bindMenu(Nt),transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"top"},children:[jsxRuntimeExports.jsxs(MenuItem$1,{onClick:()=>{Rt==null||Rt(),Nt.close()},disabled:Dt,children:[jsxRuntimeExports.jsx(ListItemIcon$1,{children:jsxRuntimeExports.jsx(SplitIcon,{fontSize:"small"})}),jsxRuntimeExports.jsx(ListItemText$1,{children:"Split Vertical"})]}),jsxRuntimeExports.jsxs(MenuItem$1,{onClick:()=>{_e==null||_e(),Nt.close()},disabled:Pt,children:[jsxRuntimeExports.jsx(ListItemIcon$1,{children:jsxRuntimeExports.jsx(SplitIcon,{fontSize:"small",sx:{transform:"rotate(90deg)"}})}),jsxRuntimeExports.jsx(ListItemText$1,{children:"Split Horizontal"})]}),jsxRuntimeExports.jsx(Divider$1,{}),!Bt&&jsxRuntimeExports.jsxs(Box$1,{children:[jsxRuntimeExports.jsxs(MenuItem$1,{onClick:()=>{Lt==null||Lt(),Nt.close()},children:[jsxRuntimeExports.jsx(ListItemIcon$1,{children:jsxRuntimeExports.jsx(OpenInNewOutlined,{fontSize:"small"})}),jsxRuntimeExports.jsx(ListItemText$1,{children:"Pop Out"})]}),jsxRuntimeExports.jsx(Divider$1,{})]}),jsxRuntimeExports.jsxs(MenuItem$1,{onClick:()=>{lt==null||lt(),Nt.close()},disabled:At,children:[jsxRuntimeExports.jsx(ListItemIcon$1,{children:jsxRuntimeExports.jsx(CloseOutlined,{fontSize:"small"})}),jsxRuntimeExports.jsx(ListItemText$1,{children:"Close Panel"})]})]})]})})}function findInTree(_e,lt){const Rt=At=>{var Pt;return"children"in At&&((Pt=At.children)!=null&&Pt.length)?lodashExports$1.flatMap(At.children,Rt):[At]};return lodashExports$1.find(Rt(_e),lt)}const ViewTreeContext=reactExports.createContext({});function useViewTreeContext(){return reactExports.useContext(ViewTreeContext)}function handleSwap(_e,lt,Rt){const At=findInTree(_e,Dt=>Dt.key===lt),Pt=findInTree(_e,Dt=>Dt.key===Rt);if((At==null?void 0:At.type)==="leaf"&&(Pt==null?void 0:Pt.type)==="leaf"){const Dt=lodashExports$1.pick(At,"content","key"),Lt=lodashExports$1.pick(Pt,"content","key");Object.assign(At,Lt),Object.assign(Pt,Dt)}return _e}function ViewTree(_e){const{onChange:lt,root:Rt}=_e;return jsxRuntimeExports.jsx(DndProvider,{backend:HTML5Backend,children:jsxRuntimeExports.jsx(ViewBranch,{..._e,onSwap:(At,Pt)=>{Rt&&(lt==null||lt(produce(Rt,Dt=>handleSwap(Dt,At,Pt))))}})})}function ViewLeaf({root:_e={type:"leaf",key:""},renderLeaf:lt,onChange:Rt,onClose:At,onPopOut:Pt,canPopOut:Dt,depth:Lt=0,onSwap:Bt,onDrop:Nt}){const[{isOver:jt},Ut]=useDrop(()=>({accept:["panel"],collect:Kt=>({isOver:Kt.isOver()&&Kt.getItem().key!==_e.key&&!!_e.acceptDrop}),drop:Kt=>{Nt==null||Nt(Kt,_e),Bt==null||Bt(Kt.key,_e.key)}})),[{isDragging:Gt},qt]=useDrag(()=>({type:"panel",item:_e,collect:Kt=>({isDragging:Kt.isDragging()})})),Xt=reactExports.useMemo(()=>{const Kt=Zt=>Rt==null?void 0:Rt(transaction(_e,Qt=>({key:nanoid$1(),type:"branch",orientation:Zt,children:[{...structuredClone(Qt),size:50,key:nanoid$1()},{...structuredClone(Qt),size:50,key:nanoid$1()}]})));return _e.type==="leaf"?{isViewTree:!0,state:_e.content,controls:jsxRuntimeExports.jsx(ViewControls,{onClose:At,closeDisabled:!Lt,onSplitHorizontal:()=>Kt("horizontal"),onSplitVertical:()=>Kt("vertical"),onPopOut:()=>Pt==null?void 0:Pt(_e),popOutDisabled:!(Dt!=null&&Dt(_e))}),dragHandle:jsxRuntimeExports.jsx(Box$1,{ref:qt,sx:{display:"flex",alignItems:"center"},children:jsxRuntimeExports.jsx(DragIndicatorOutlined,{fontSize:"small",color:"disabled",sx:{mr:.5,cursor:"grab"}})}),onChange:Zt=>Rt==null?void 0:Rt(produce(_e,Qt=>{Qt.content={...Qt.content,...Zt}}))}:{}},[Rt,At,Lt,_e,qt]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Flex,{ref:Ut,sx:{overflow:"hidden","::before":{pointerEvents:"none",content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1,boxShadow:Kt=>jt?`inset 0 0 0 2px ${Kt.palette.primary.main}`:"none",transition:Kt=>Kt.transitions.create("box-shadow")},transition:Kt=>Kt.transitions.create("opacity"),opacity:Kt=>Gt?Kt.palette.action.disabledOpacity:1},children:jsxRuntimeExports.jsx(ViewTreeContext.Provider,{value:Xt,children:lt==null?void 0:lt(_e)})})})}function ViewBranch(_e){const{root:lt={type:"leaf",key:""},onChange:Rt,depth:At=0}=_e,{palette:Pt,spacing:Dt,transitions:Lt}=useTheme(),Bt=lt.type==="branch"&<.locked,Nt=useCss$1({...Bt&&{display:"none"},"div&":{background:Pt.text.secondary,opacity:.5,transition:Lt.create("opacity"),"&.Horizontal":{width:"3px"},"&.Vertical":{height:"3px"}}}),jt=useCss$1({...Bt&&{pointerEvents:"none"},"div&":{background:Pt.mode==="dark"?Pt.background.default:Pt.divider,boxShadow:`inset 0 0 0 1px ${Pt.background.paper}`,"&:hover":{background:Pt.primary.main,boxShadow:"none"},"&.Horizontal":{padding:0,width:"3px"},"&.Vertical":{padding:0}}}),Ut=qt=>Number(Dt(qt).slice(0,-2));function Gt(qt,Xt=[]){const Kt=lodashExports$1.chain(Xt).map(Zt=>lodashExports$1.isUndefined(Zt.size)||isNaN(Zt.size)?0:Zt.size).sum().value();return lodashExports$1.isUndefined(qt)?100-Kt:qt}return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:lt.type==="leaf"?jsxRuntimeExports.jsx(ViewLeaf,{..._e}):jsxRuntimeExports.jsx(m$5,{gutterClassName:jt,draggerClassName:Nt,onResizeFinished:(qt,Xt)=>Rt==null?void 0:Rt(produce(lt,Kt=>{lodashExports$1.forEach(Xt,(Zt,Qt)=>{Kt.children[Qt].size=Zt})})),minHeights:lodashExports$1.map(lt.children,()=>Ut(6)-8),minWidths:lodashExports$1.map(lt.children,()=>Ut(32)),initialSizes:lodashExports$1.map(lt.children,(qt,Xt,Kt)=>Gt(qt.size,Kt)),direction:{vertical:z$4.Vertical,horizontal:z$4.Horizontal}[lt.orientation],children:lodashExports$1.map(lt.children,(qt,Xt)=>qt.hidden?jsxRuntimeExports.jsx(Box$1,{},"placeholder"):reactExports.createElement(ViewBranch,{..._e,key:qt.key,depth:At+1,root:qt,onChange:Kt=>Rt==null?void 0:Rt(produce(lt,Zt=>Zt.children[Xt]=Kt)),onClose:()=>Rt==null?void 0:Rt(transaction(lt,Kt=>(Kt.children.splice(Xt,1),Kt.children.length===1?Kt.children[0].type==="leaf"?{type:"leaf",key:nanoid$1(),content:Kt.children[0].content}:Kt.children[0]:(lodashExports$1.forEach(Kt.children,(Zt,Qt,Jt)=>Zt.size=100/Jt.length),Kt))))}))})})}function useSmallDisplay(){const _e=useTheme();return useMediaQuery(_e.breakpoints.down("sm"))}const itemHeight$1=_e=>_e?48:36,padding$1=8;function Select({trigger:_e,items:lt,value:Rt,onChange:At,showTooltip:Pt,placeholder:Dt="Select Option"}){const Lt=useSmallDisplay(),Bt=lodashExports$1.max([lodashExports$1.findIndex(lt,{value:Rt}),0])??0;return jsxRuntimeExports.jsx(PopupState,{variant:"popover",children:Nt=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Tooltip$1,{title:Dt,children:jsxRuntimeExports.jsx("span",{children:_e==null?void 0:_e(bindTrigger(Nt))})}),jsxRuntimeExports.jsx(Menu$1,{...bindMenu(Nt),anchorOrigin:{horizontal:"center",vertical:-itemHeight$1(Lt)*Bt-padding$1},transformOrigin:{vertical:"top",horizontal:"center"},children:lodashExports$1.map(lt,({value:jt,label:Ut,disabled:Gt,icon:qt})=>jsxRuntimeExports.jsx(Tooltip$1,{title:Pt&&jt,placement:"right",children:jsxRuntimeExports.jsxs(MenuItem$1,{disabled:Gt,value:jt,selected:jt===Rt,onClick:()=>{Nt.close(),At==null||At(jt)},children:[qt&&jsxRuntimeExports.jsx(ListItemIcon$1,{sx:{transform:"scale(0.8)"},children:qt}),Ut]},jt)},jt))})]})})}function SelectField(_e){const{placeholder:lt,value:Rt,items:At=[],onChange:Pt}=_e;return jsxRuntimeExports.jsx(TextField$1,{sx:{minWidth:120},select:!0,label:lt,defaultValue:Rt,variant:"filled",..._e,onChange:Dt=>Pt==null?void 0:Pt(Dt.target.value),children:lodashExports$1.map(At,Dt=>jsxRuntimeExports.jsx(MenuItem$1,{value:Dt.value,children:Dt.label},Dt.value))})}const defaultRemotes=[{url:"https://cdn.jsdelivr.net/gh/path-visualiser/app@adapter-warthog-wasm-dist/warthog-wasm.mjs",transport:"ipc",key:"default-ipc"}],defaultRenderers=[{url:"internal://d2-renderer/",key:"d2-renderer",transport:"native"}],defaultPlaybackRate=1,defaults$3={renderer:defaultRenderers,remote:defaultRemotes,"playback/playbackRate":defaultPlaybackRate,"appearance/theme":"dark","appearance/acrylic":!0,"appearance/accentColor":"blue","behaviour/showOnStart":"explore"},[useSettings,SettingsProvider]=createSlice({},withLocalStorage("settings",defaults$3)),{common,...accentColors}=colors,shadow=` 0px 4px 9px -1px rgb(0 0 0 / 4%), 0px 5px 24px 0px rgb(0 0 0 / 4%), 0px 10px 48px 0px rgb(0 0 0 / 4%) @@ -662,7 +662,7 @@ Use Save As... to download, then click back to return to this page.`)&&(location -moz-user-select: none; -ms-user-select: none; overflow-anchor: none; - `}},Lt=[At,Rt,Pt,Dt];return{always:getStyles(Lt,"always"),resting:getStyles(Lt,"resting"),dragging:getStyles(Lt,"dragging"),dropAnimating:getStyles(Lt,"dropAnimating"),userCancel:getStyles(Lt,"userCancel")}},useIsomorphicLayoutEffect$3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?reactExports.useLayoutEffect:reactExports.useEffect,getHead=function _e(){var lt=document.querySelector("head");return lt||invariant(!1),lt},createStyleEl=function _e(lt){var Rt=document.createElement("style");return lt&&Rt.setAttribute("nonce",lt),Rt.type="text/css",Rt};function useStyleMarshal(_e,lt){var Rt=useMemo(function(){return getStyles$1(_e)},[_e]),At=reactExports.useRef(null),Pt=reactExports.useRef(null),Dt=useCallback(memoizeOne(function(Gt){var qt=Pt.current;qt||invariant(!1),qt.textContent=Gt}),[]),Lt=useCallback(function(Gt){var qt=At.current;qt||invariant(!1),qt.textContent=Gt},[]);useIsomorphicLayoutEffect$3(function(){!At.current&&!Pt.current||invariant(!1);var Gt=createStyleEl(lt),qt=createStyleEl(lt);return At.current=Gt,Pt.current=qt,Gt.setAttribute(prefix$1+"-always",_e),qt.setAttribute(prefix$1+"-dynamic",_e),getHead().appendChild(Gt),getHead().appendChild(qt),Lt(Rt.always),Dt(Rt.resting),function(){var Xt=function(Zt){var Qt=Zt.current;Qt||invariant(!1),getHead().removeChild(Qt),Zt.current=null};Xt(At),Xt(Pt)}},[lt,Lt,Dt,Rt.always,Rt.resting,_e]);var Bt=useCallback(function(){return Dt(Rt.dragging)},[Dt,Rt.dragging]),Nt=useCallback(function(Gt){if(Gt==="DROP"){Dt(Rt.dropAnimating);return}Dt(Rt.userCancel)},[Dt,Rt.dropAnimating,Rt.userCancel]),jt=useCallback(function(){Pt.current&&Dt(Rt.resting)},[Dt,Rt.resting]),Ut=useMemo(function(){return{dragging:Bt,dropping:Nt,resting:jt}},[Bt,Nt,jt]);return Ut}var getWindowFromEl=function(_e){return _e&&_e.ownerDocument?_e.ownerDocument.defaultView:window};function isHtmlElement(_e){return _e instanceof getWindowFromEl(_e).HTMLElement}function findDragHandle(_e,lt){var Rt="["+dragHandle.contextId+'="'+_e+'"]',At=toArray$1(document.querySelectorAll(Rt));if(!At.length)return null;var Pt=find$1(At,function(Dt){return Dt.getAttribute(dragHandle.draggableId)===lt});return!Pt||!isHtmlElement(Pt)?null:Pt}function useFocusMarshal(_e){var lt=reactExports.useRef({}),Rt=reactExports.useRef(null),At=reactExports.useRef(null),Pt=reactExports.useRef(!1),Dt=useCallback(function(qt,Xt){var Kt={id:qt,focus:Xt};return lt.current[qt]=Kt,function(){var Qt=lt.current,Jt=Qt[qt];Jt!==Kt&&delete Qt[qt]}},[]),Lt=useCallback(function(qt){var Xt=findDragHandle(_e,qt);Xt&&Xt!==document.activeElement&&Xt.focus()},[_e]),Bt=useCallback(function(qt,Xt){Rt.current===qt&&(Rt.current=Xt)},[]),Nt=useCallback(function(){At.current||Pt.current&&(At.current=requestAnimationFrame(function(){At.current=null;var qt=Rt.current;qt&&Lt(qt)}))},[Lt]),jt=useCallback(function(qt){Rt.current=null;var Xt=document.activeElement;Xt&&Xt.getAttribute(dragHandle.draggableId)===qt&&(Rt.current=qt)},[]);useIsomorphicLayoutEffect$3(function(){return Pt.current=!0,function(){Pt.current=!1;var qt=At.current;qt&&cancelAnimationFrame(qt)}},[]);var Ut=useMemo(function(){return{register:Dt,tryRecordFocus:jt,tryRestoreFocusRecorded:Nt,tryShiftRecord:Bt}},[Dt,jt,Nt,Bt]);return Ut}function createRegistry(){var _e={draggables:{},droppables:{}},lt=[];function Rt(Gt){return lt.push(Gt),function(){var Xt=lt.indexOf(Gt);Xt!==-1&<.splice(Xt,1)}}function At(Gt){lt.length&<.forEach(function(qt){return qt(Gt)})}function Pt(Gt){return _e.draggables[Gt]||null}function Dt(Gt){var qt=Pt(Gt);return qt||invariant(!1),qt}var Lt={register:function(qt){_e.draggables[qt.descriptor.id]=qt,At({type:"ADDITION",value:qt})},update:function(qt,Xt){var Kt=_e.draggables[Xt.descriptor.id];Kt&&Kt.uniqueId===qt.uniqueId&&(delete _e.draggables[Xt.descriptor.id],_e.draggables[qt.descriptor.id]=qt)},unregister:function(qt){var Xt=qt.descriptor.id,Kt=Pt(Xt);Kt&&qt.uniqueId===Kt.uniqueId&&(delete _e.draggables[Xt],At({type:"REMOVAL",value:qt}))},getById:Dt,findById:Pt,exists:function(qt){return!!Pt(qt)},getAllByType:function(qt){return values(_e.draggables).filter(function(Xt){return Xt.descriptor.type===qt})}};function Bt(Gt){return _e.droppables[Gt]||null}function Nt(Gt){var qt=Bt(Gt);return qt||invariant(!1),qt}var jt={register:function(qt){_e.droppables[qt.descriptor.id]=qt},unregister:function(qt){var Xt=Bt(qt.descriptor.id);Xt&&qt.uniqueId===Xt.uniqueId&&delete _e.droppables[qt.descriptor.id]},getById:Nt,findById:Bt,exists:function(qt){return!!Bt(qt)},getAllByType:function(qt){return values(_e.droppables).filter(function(Xt){return Xt.descriptor.type===qt})}};function Ut(){_e.draggables={},_e.droppables={},lt.length=0}return{draggable:Lt,droppable:jt,subscribe:Rt,clean:Ut}}function useRegistry(){var _e=useMemo(createRegistry,[]);return reactExports.useEffect(function(){return function(){requestAnimationFrame(_e.clean)}},[_e]),_e}var StoreContext=React.createContext(null),getBodyElement=function(){var _e=document.body;return _e||invariant(!1),_e},visuallyHidden={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},getId=function _e(lt){return"rbd-announcement-"+lt};function useAnnouncer(_e){var lt=useMemo(function(){return getId(_e)},[_e]),Rt=reactExports.useRef(null);reactExports.useEffect(function(){var Dt=document.createElement("div");return Rt.current=Dt,Dt.id=lt,Dt.setAttribute("aria-live","assertive"),Dt.setAttribute("aria-atomic","true"),_extends$2(Dt.style,visuallyHidden),getBodyElement().appendChild(Dt),function(){setTimeout(function(){var Nt=getBodyElement();Nt.contains(Dt)&&Nt.removeChild(Dt),Dt===Rt.current&&(Rt.current=null)})}},[lt]);var At=useCallback(function(Pt){var Dt=Rt.current;if(Dt){Dt.textContent=Pt;return}},[]);return At}var count=0,defaults$2={separator:"::"};function useUniqueId(_e,lt){return lt===void 0&&(lt=defaults$2),useMemo(function(){return""+_e+lt.separator+count++},[lt.separator,_e])}function getElementId(_e){var lt=_e.contextId,Rt=_e.uniqueId;return"rbd-hidden-text-"+lt+"-"+Rt}function useHiddenTextElement(_e){var lt=_e.contextId,Rt=_e.text,At=useUniqueId("hidden-text",{separator:"-"}),Pt=useMemo(function(){return getElementId({contextId:lt,uniqueId:At})},[At,lt]);return reactExports.useEffect(function(){var Lt=document.createElement("div");return Lt.id=Pt,Lt.textContent=Rt,Lt.style.display="none",getBodyElement().appendChild(Lt),function(){var Nt=getBodyElement();Nt.contains(Lt)&&Nt.removeChild(Lt)}},[Pt,Rt]),Pt}var AppContext=React.createContext(null);function usePrevious(_e){var lt=reactExports.useRef(_e);return reactExports.useEffect(function(){lt.current=_e}),lt}function create$1(){var _e=null;function lt(){return!!_e}function Rt(Lt){return Lt===_e}function At(Lt){_e&&invariant(!1);var Bt={abandon:Lt};return _e=Bt,Bt}function Pt(){_e||invariant(!1),_e=null}function Dt(){_e&&(_e.abandon(),Pt())}return{isClaimed:lt,isActive:Rt,claim:At,release:Pt,tryAbandon:Dt}}var tab=9,enter=13,escape$1=27,space=32,pageUp=33,pageDown=34,end=35,home=36,arrowLeft=37,arrowUp=38,arrowRight=39,arrowDown=40,_preventedKeys,preventedKeys=(_preventedKeys={},_preventedKeys[enter]=!0,_preventedKeys[tab]=!0,_preventedKeys),preventStandardKeyEvents=function(_e){preventedKeys[_e.keyCode]&&_e.preventDefault()},supportedEventName=function(){var _e="visibilitychange";if(typeof document>"u")return _e;var lt=[_e,"ms"+_e,"webkit"+_e,"moz"+_e,"o"+_e],Rt=find$1(lt,function(At){return"on"+At in document});return Rt||_e}(),primaryButton=0,sloppyClickThreshold=5;function isSloppyClickThresholdExceeded(_e,lt){return Math.abs(lt.x-_e.x)>=sloppyClickThreshold||Math.abs(lt.y-_e.y)>=sloppyClickThreshold}var idle$1={type:"IDLE"};function getCaptureBindings(_e){var lt=_e.cancel,Rt=_e.completed,At=_e.getPhase,Pt=_e.setPhase;return[{eventName:"mousemove",fn:function(Lt){var Bt=Lt.button,Nt=Lt.clientX,jt=Lt.clientY;if(Bt===primaryButton){var Ut={x:Nt,y:jt},Gt=At();if(Gt.type==="DRAGGING"){Lt.preventDefault(),Gt.actions.move(Ut);return}Gt.type!=="PENDING"&&invariant(!1);var qt=Gt.point;if(isSloppyClickThresholdExceeded(qt,Ut)){Lt.preventDefault();var Xt=Gt.actions.fluidLift(Ut);Pt({type:"DRAGGING",actions:Xt})}}}},{eventName:"mouseup",fn:function(Lt){var Bt=At();if(Bt.type!=="DRAGGING"){lt();return}Lt.preventDefault(),Bt.actions.drop({shouldBlockNextClick:!0}),Rt()}},{eventName:"mousedown",fn:function(Lt){At().type==="DRAGGING"&&Lt.preventDefault(),lt()}},{eventName:"keydown",fn:function(Lt){var Bt=At();if(Bt.type==="PENDING"){lt();return}if(Lt.keyCode===escape$1){Lt.preventDefault(),lt();return}preventStandardKeyEvents(Lt)}},{eventName:"resize",fn:lt},{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(){At().type==="PENDING"&<()}},{eventName:"webkitmouseforcedown",fn:function(Lt){var Bt=At();if(Bt.type==="IDLE"&&invariant(!1),Bt.actions.shouldRespectForcePress()){lt();return}Lt.preventDefault()}},{eventName:supportedEventName,fn:lt}]}function useMouseSensor(_e){var lt=reactExports.useRef(idle$1),Rt=reactExports.useRef(noop$2),At=useMemo(function(){return{eventName:"mousedown",fn:function(Gt){if(!Gt.defaultPrevented&&Gt.button===primaryButton&&!(Gt.ctrlKey||Gt.metaKey||Gt.shiftKey||Gt.altKey)){var qt=_e.findClosestDraggableId(Gt);if(qt){var Xt=_e.tryGetLock(qt,Lt,{sourceEvent:Gt});if(Xt){Gt.preventDefault();var Kt={x:Gt.clientX,y:Gt.clientY};Rt.current(),jt(Xt,Kt)}}}}}},[_e]),Pt=useMemo(function(){return{eventName:"webkitmouseforcewillbegin",fn:function(Gt){if(!Gt.defaultPrevented){var qt=_e.findClosestDraggableId(Gt);if(qt){var Xt=_e.findOptionsForDraggable(qt);Xt&&(Xt.shouldRespectForcePress||_e.canGetLock(qt)&&Gt.preventDefault())}}}}},[_e]),Dt=useCallback(function(){var Gt={passive:!1,capture:!0};Rt.current=bindEvents(window,[Pt,At],Gt)},[Pt,At]),Lt=useCallback(function(){var Ut=lt.current;Ut.type!=="IDLE"&&(lt.current=idle$1,Rt.current(),Dt())},[Dt]),Bt=useCallback(function(){var Ut=lt.current;Lt(),Ut.type==="DRAGGING"&&Ut.actions.cancel({shouldBlockNextClick:!0}),Ut.type==="PENDING"&&Ut.actions.abort()},[Lt]),Nt=useCallback(function(){var Gt={capture:!0,passive:!1},qt=getCaptureBindings({cancel:Bt,completed:Lt,getPhase:function(){return lt.current},setPhase:function(Kt){lt.current=Kt}});Rt.current=bindEvents(window,qt,Gt)},[Bt,Lt]),jt=useCallback(function(Gt,qt){lt.current.type!=="IDLE"&&invariant(!1),lt.current={type:"PENDING",point:qt,actions:Gt},Nt()},[Nt]);useIsomorphicLayoutEffect$3(function(){return Dt(),function(){Rt.current()}},[Dt])}var _scrollJumpKeys;function noop$1$1(){}var scrollJumpKeys=(_scrollJumpKeys={},_scrollJumpKeys[pageDown]=!0,_scrollJumpKeys[pageUp]=!0,_scrollJumpKeys[home]=!0,_scrollJumpKeys[end]=!0,_scrollJumpKeys);function getDraggingBindings(_e,lt){function Rt(){lt(),_e.cancel()}function At(){lt(),_e.drop()}return[{eventName:"keydown",fn:function(Dt){if(Dt.keyCode===escape$1){Dt.preventDefault(),Rt();return}if(Dt.keyCode===space){Dt.preventDefault(),At();return}if(Dt.keyCode===arrowDown){Dt.preventDefault(),_e.moveDown();return}if(Dt.keyCode===arrowUp){Dt.preventDefault(),_e.moveUp();return}if(Dt.keyCode===arrowRight){Dt.preventDefault(),_e.moveRight();return}if(Dt.keyCode===arrowLeft){Dt.preventDefault(),_e.moveLeft();return}if(scrollJumpKeys[Dt.keyCode]){Dt.preventDefault();return}preventStandardKeyEvents(Dt)}},{eventName:"mousedown",fn:Rt},{eventName:"mouseup",fn:Rt},{eventName:"click",fn:Rt},{eventName:"touchstart",fn:Rt},{eventName:"resize",fn:Rt},{eventName:"wheel",fn:Rt,options:{passive:!0}},{eventName:supportedEventName,fn:Rt}]}function useKeyboardSensor(_e){var lt=reactExports.useRef(noop$1$1),Rt=useMemo(function(){return{eventName:"keydown",fn:function(Dt){if(Dt.defaultPrevented||Dt.keyCode!==space)return;var Lt=_e.findClosestDraggableId(Dt);if(!Lt)return;var Bt=_e.tryGetLock(Lt,Ut,{sourceEvent:Dt});if(!Bt)return;Dt.preventDefault();var Nt=!0,jt=Bt.snapLift();lt.current();function Ut(){Nt||invariant(!1),Nt=!1,lt.current(),At()}lt.current=bindEvents(window,getDraggingBindings(jt,Ut),{capture:!0,passive:!1})}}},[_e]),At=useCallback(function(){var Dt={passive:!1,capture:!0};lt.current=bindEvents(window,[Rt],Dt)},[Rt]);useIsomorphicLayoutEffect$3(function(){return At(),function(){lt.current()}},[At])}var idle$2={type:"IDLE"},timeForLongPress=120,forcePressThreshold=.15;function getWindowBindings(_e){var lt=_e.cancel,Rt=_e.getPhase;return[{eventName:"orientationchange",fn:lt},{eventName:"resize",fn:lt},{eventName:"contextmenu",fn:function(Pt){Pt.preventDefault()}},{eventName:"keydown",fn:function(Pt){if(Rt().type!=="DRAGGING"){lt();return}Pt.keyCode===escape$1&&Pt.preventDefault(),lt()}},{eventName:supportedEventName,fn:lt}]}function getHandleBindings(_e){var lt=_e.cancel,Rt=_e.completed,At=_e.getPhase;return[{eventName:"touchmove",options:{capture:!1},fn:function(Dt){var Lt=At();if(Lt.type!=="DRAGGING"){lt();return}Lt.hasMoved=!0;var Bt=Dt.touches[0],Nt=Bt.clientX,jt=Bt.clientY,Ut={x:Nt,y:jt};Dt.preventDefault(),Lt.actions.move(Ut)}},{eventName:"touchend",fn:function(Dt){var Lt=At();if(Lt.type!=="DRAGGING"){lt();return}Dt.preventDefault(),Lt.actions.drop({shouldBlockNextClick:!0}),Rt()}},{eventName:"touchcancel",fn:function(Dt){if(At().type!=="DRAGGING"){lt();return}Dt.preventDefault(),lt()}},{eventName:"touchforcechange",fn:function(Dt){var Lt=At();Lt.type==="IDLE"&&invariant(!1);var Bt=Dt.touches[0];if(Bt){var Nt=Bt.force>=forcePressThreshold;if(Nt){var jt=Lt.actions.shouldRespectForcePress();if(Lt.type==="PENDING"){jt&<();return}if(jt){if(Lt.hasMoved){Dt.preventDefault();return}lt();return}Dt.preventDefault()}}}},{eventName:supportedEventName,fn:lt}]}function useTouchSensor(_e){var lt=reactExports.useRef(idle$2),Rt=reactExports.useRef(noop$2),At=useCallback(function(){return lt.current},[]),Pt=useCallback(function(Xt){lt.current=Xt},[]),Dt=useMemo(function(){return{eventName:"touchstart",fn:function(Xt){if(!Xt.defaultPrevented){var Kt=_e.findClosestDraggableId(Xt);if(Kt){var Zt=_e.tryGetLock(Kt,Bt,{sourceEvent:Xt});if(Zt){var Qt=Xt.touches[0],Jt=Qt.clientX,en=Qt.clientY,tn={x:Jt,y:en};Rt.current(),Gt(Zt,tn)}}}}}},[_e]),Lt=useCallback(function(){var Xt={capture:!0,passive:!1};Rt.current=bindEvents(window,[Dt],Xt)},[Dt]),Bt=useCallback(function(){var qt=lt.current;qt.type!=="IDLE"&&(qt.type==="PENDING"&&clearTimeout(qt.longPressTimerId),Pt(idle$2),Rt.current(),Lt())},[Lt,Pt]),Nt=useCallback(function(){var qt=lt.current;Bt(),qt.type==="DRAGGING"&&qt.actions.cancel({shouldBlockNextClick:!0}),qt.type==="PENDING"&&qt.actions.abort()},[Bt]),jt=useCallback(function(){var Xt={capture:!0,passive:!1},Kt={cancel:Nt,completed:Bt,getPhase:At},Zt=bindEvents(window,getHandleBindings(Kt),Xt),Qt=bindEvents(window,getWindowBindings(Kt),Xt);Rt.current=function(){Zt(),Qt()}},[Nt,At,Bt]),Ut=useCallback(function(){var Xt=At();Xt.type!=="PENDING"&&invariant(!1);var Kt=Xt.actions.fluidLift(Xt.point);Pt({type:"DRAGGING",actions:Kt,hasMoved:!1})},[At,Pt]),Gt=useCallback(function(Xt,Kt){At().type!=="IDLE"&&invariant(!1);var Zt=setTimeout(Ut,timeForLongPress);Pt({type:"PENDING",point:Kt,actions:Xt,longPressTimerId:Zt}),jt()},[jt,At,Pt,Ut]);useIsomorphicLayoutEffect$3(function(){return Lt(),function(){Rt.current();var Kt=At();Kt.type==="PENDING"&&(clearTimeout(Kt.longPressTimerId),Pt(idle$2))}},[At,Lt,Pt]),useIsomorphicLayoutEffect$3(function(){var Xt=bindEvents(window,[{eventName:"touchmove",fn:function(){},options:{capture:!1,passive:!1}}]);return Xt},[])}var interactiveTagNames={input:!0,button:!0,textarea:!0,select:!0,option:!0,optgroup:!0,video:!0,audio:!0};function isAnInteractiveElement(_e,lt){if(lt==null)return!1;var Rt=!!interactiveTagNames[lt.tagName.toLowerCase()];if(Rt)return!0;var At=lt.getAttribute("contenteditable");return At==="true"||At===""?!0:lt===_e?!1:isAnInteractiveElement(_e,lt.parentElement)}function isEventInInteractiveElement(_e,lt){var Rt=lt.target;return isHtmlElement(Rt)?isAnInteractiveElement(_e,Rt):!1}var getBorderBoxCenterPosition=function(_e){return getRect(_e.getBoundingClientRect()).center};function isElement$1(_e){return _e instanceof getWindowFromEl(_e).Element}var supportedMatchesName=function(){var _e="matches";if(typeof document>"u")return _e;var lt=[_e,"msMatchesSelector","webkitMatchesSelector"],Rt=find$1(lt,function(At){return At in Element.prototype});return Rt||_e}();function closestPonyfill(_e,lt){return _e==null?null:_e[supportedMatchesName](lt)?_e:closestPonyfill(_e.parentElement,lt)}function closest$1(_e,lt){return _e.closest?_e.closest(lt):closestPonyfill(_e,lt)}function getSelector(_e){return"["+dragHandle.contextId+'="'+_e+'"]'}function findClosestDragHandleFromEvent(_e,lt){var Rt=lt.target;if(!isElement$1(Rt))return null;var At=getSelector(_e),Pt=closest$1(Rt,At);return!Pt||!isHtmlElement(Pt)?null:Pt}function tryGetClosestDraggableIdFromEvent(_e,lt){var Rt=findClosestDragHandleFromEvent(_e,lt);return Rt?Rt.getAttribute(dragHandle.draggableId):null}function findDraggable(_e,lt){var Rt="["+draggable.contextId+'="'+_e+'"]',At=toArray$1(document.querySelectorAll(Rt)),Pt=find$1(At,function(Dt){return Dt.getAttribute(draggable.id)===lt});return!Pt||!isHtmlElement(Pt)?null:Pt}function preventDefault(_e){_e.preventDefault()}function _isActive(_e){var lt=_e.expected,Rt=_e.phase,At=_e.isLockActive;return _e.shouldWarn,!(!At()||lt!==Rt)}function canStart(_e){var lt=_e.lockAPI,Rt=_e.store,At=_e.registry,Pt=_e.draggableId;if(lt.isClaimed())return!1;var Dt=At.draggable.findById(Pt);return!(!Dt||!Dt.options.isEnabled||!canStartDrag(Rt.getState(),Pt))}function tryStart(_e){var lt=_e.lockAPI,Rt=_e.contextId,At=_e.store,Pt=_e.registry,Dt=_e.draggableId,Lt=_e.forceSensorStop,Bt=_e.sourceEvent,Nt=canStart({lockAPI:lt,store:At,registry:Pt,draggableId:Dt});if(!Nt)return null;var jt=Pt.draggable.getById(Dt),Ut=findDraggable(Rt,jt.descriptor.id);if(!Ut||Bt&&!jt.options.canDragInteractiveElements&&isEventInInteractiveElement(Ut,Bt))return null;var Gt=lt.claim(Lt||noop$2),qt="PRE_DRAG";function Xt(){return jt.options.shouldRespectForcePress}function Kt(){return lt.isActive(Gt)}function Zt(un,rn){_isActive({expected:un,phase:qt,isLockActive:Kt,shouldWarn:!0})&&At.dispatch(rn())}var Qt=Zt.bind(null,"DRAGGING");function Jt(un){function rn(){lt.release(),qt="COMPLETED"}qt!=="PRE_DRAG"&&(rn(),qt!=="PRE_DRAG"&&invariant(!1)),At.dispatch(lift(un.liftActionArgs)),qt="DRAGGING";function sn(pn,bn){if(bn===void 0&&(bn={shouldBlockNextClick:!1}),un.cleanup(),bn.shouldBlockNextClick){var gn=bindEvents(window,[{eventName:"click",fn:preventDefault,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(gn)}rn(),At.dispatch(drop({reason:pn}))}return _extends$2({isActive:function(){return _isActive({expected:"DRAGGING",phase:qt,isLockActive:Kt,shouldWarn:!1})},shouldRespectForcePress:Xt,drop:function(bn){return sn("DROP",bn)},cancel:function(bn){return sn("CANCEL",bn)}},un.actions)}function en(un){var rn=rafSchd$1(function(pn){Qt(function(){return move({client:pn})})}),sn=Jt({liftActionArgs:{id:Dt,clientSelection:un,movementMode:"FLUID"},cleanup:function(){return rn.cancel()},actions:{move:rn}});return _extends$2({},sn,{move:rn})}function tn(){var un={moveUp:function(){return Qt(moveUp)},moveRight:function(){return Qt(moveRight)},moveDown:function(){return Qt(moveDown)},moveLeft:function(){return Qt(moveLeft)}};return Jt({liftActionArgs:{id:Dt,clientSelection:getBorderBoxCenterPosition(Ut),movementMode:"SNAP"},cleanup:noop$2,actions:un})}function an(){var un=_isActive({expected:"PRE_DRAG",phase:qt,isLockActive:Kt,shouldWarn:!0});un&<.release()}var cn={isActive:function(){return _isActive({expected:"PRE_DRAG",phase:qt,isLockActive:Kt,shouldWarn:!1})},shouldRespectForcePress:Xt,fluidLift:en,snapLift:tn,abort:an};return cn}var defaultSensors=[useMouseSensor,useKeyboardSensor,useTouchSensor];function useSensorMarshal(_e){var lt=_e.contextId,Rt=_e.store,At=_e.registry,Pt=_e.customSensors,Dt=_e.enableDefaultSensors,Lt=[].concat(Dt?defaultSensors:[],Pt||[]),Bt=reactExports.useState(function(){return create$1()})[0],Nt=useCallback(function(en,tn){en.isDragging&&!tn.isDragging&&Bt.tryAbandon()},[Bt]);useIsomorphicLayoutEffect$3(function(){var en=Rt.getState(),tn=Rt.subscribe(function(){var an=Rt.getState();Nt(en,an),en=an});return tn},[Bt,Rt,Nt]),useIsomorphicLayoutEffect$3(function(){return Bt.tryAbandon},[Bt.tryAbandon]);for(var jt=useCallback(function(Jt){return canStart({lockAPI:Bt,registry:At,store:Rt,draggableId:Jt})},[Bt,At,Rt]),Ut=useCallback(function(Jt,en,tn){return tryStart({lockAPI:Bt,registry:At,contextId:lt,store:Rt,draggableId:Jt,forceSensorStop:en,sourceEvent:tn&&tn.sourceEvent?tn.sourceEvent:null})},[lt,Bt,At,Rt]),Gt=useCallback(function(Jt){return tryGetClosestDraggableIdFromEvent(lt,Jt)},[lt]),qt=useCallback(function(Jt){var en=At.draggable.findById(Jt);return en?en.options:null},[At.draggable]),Xt=useCallback(function(){Bt.isClaimed()&&(Bt.tryAbandon(),Rt.getState().phase!=="IDLE"&&Rt.dispatch(flush()))},[Bt,Rt]),Kt=useCallback(Bt.isClaimed,[Bt]),Zt=useMemo(function(){return{canGetLock:jt,tryGetLock:Ut,findClosestDraggableId:Gt,findOptionsForDraggable:qt,tryReleaseLock:Xt,isLockClaimed:Kt}},[jt,Ut,Gt,qt,Xt,Kt]),Qt=0;QtjsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[_e,lt,Rt]});function ListEditorField({toggleable:_e,deletable:lt,editable:Rt=!0,onChangeItem:At=()=>{},onDeleteItem:Pt=()=>{},extras:Dt,enabled:Lt=!1,editor:Bt=jsxRuntimeExports.jsx(DefaultListEditorInput,{}),value:Nt,id:jt,i:Ut=0,autoFocus:Gt,sortable:qt,button:Xt=!0,renderEditor:Kt=defaultEditorRenderer}){const Zt=useAcrylic(),Qt=usePaper(),[Jt,en]=reactExports.useState(null),tn=Xt?ButtonBase$1:Box$1;return jsxRuntimeExports.jsx(PublicDraggable,{index:Ut,draggableId:`${jt}`,children:(an,cn)=>jsxRuntimeExports.jsx("div",{ref:an.innerRef,...an.draggableProps,children:jsxRuntimeExports.jsx(Stack$1,{direction:"row",alignItems:"center",sx:{...Xt?{transition:un=>un.transitions.create("background"),"&:hover":{background:un=>un.palette.action.hover}}:void 0,...cn.isDragging?{...Qt(1),...Zt}:void 0},children:Kt==null?void 0:Kt({value:Nt,onValueChange:un=>At(jt??Ut,un,Lt),handle:qt&&jsxRuntimeExports.jsx(Flex,{...an.dragHandleProps,color:"text.secondary",sx:{flex:0,p:2},children:jsxRuntimeExports.jsx(DragHandleOutlined,{})}),content:jsxRuntimeExports.jsx(tn,{sx:{flex:1,display:"block",textAlign:"left",px:2},children:reactExports.cloneElement(Bt,{onDelete:()=>Pt(jt??Ut),autoFocus:Gt,value:Nt,key:jt??Ut,onValueChange:un=>At(jt??Ut,un,Lt),onChange:un=>At(jt??Ut,un.target.value,Lt),ref:un=>en(un)})}),extras:jsxRuntimeExports.jsxs(Flex,{sx:{flex:0,px:1},children:[_e&&jsxRuntimeExports.jsx(Switch$2,{color:"primary",edge:"end",onChange:(un,rn)=>At(jt??Ut,Nt,rn),checked:Lt}),Rt&&jsxRuntimeExports.jsx(IconButton$1,{edge:"end",onClick:()=>{Jt!=null&&Jt.focus&&Jt.focus()},children:jsxRuntimeExports.jsx(EditIcon,{})}),lt&&jsxRuntimeExports.jsx(IconButton$1,{onClick:()=>Pt(jt??Ut),children:jsxRuntimeExports.jsx(DeleteIcon,{})}),Dt&&Dt(Nt)]})})})})})}function reorder(_e,lt,Rt){const At=Array.from(_e),[Pt]=At.splice(lt,1);return At.splice(Rt,0,Pt),At}function Editor(_e){const{addItemLabel:lt="Add Item",UNSAFE_label:Rt,UNSAFE_text:At,onAddItem:Pt=()=>{},onDeleteItem:Dt=()=>{},items:Lt=[],placeholder:Bt,autoFocus:Nt,category:jt,order:Ut,onChange:Gt,addItemExtras:qt}=_e,Xt=usePaper(),Kt=useInitialRender(),Zt=useTheme(),[Qt,Jt]=reactExports.useState(Lt),[en,tn]=reactExports.useState(-1);reactExports.useEffect(()=>{const rn=setTimeout(()=>{Jt(Lt)},Zt.transitions.duration.standard);return()=>{clearTimeout(rn)}},[Lt,Jt,Zt.transitions.duration.standard]);const an=lodashExports$1.uniqBy([...Qt,...Lt],rn=>rn.id).map(rn=>Lt.find(sn=>rn.id===sn.id)??rn).map((rn,sn)=>{const{enabled:pn,editor:bn,value:gn,id:_n}=rn??{};return{value:gn,render:xn=>jsxRuntimeExports.jsx(Collapse$1,{in:!!Lt.find(ln=>ln.id===rn.id),unmountOnExit:!0,appear:!Kt,mountOnEnter:!0,children:jsxRuntimeExports.jsx(ListEditorField,{..._e,onDeleteItem:ln=>{Dt(ln),tn(-1)},enabled:pn,editor:bn,value:gn,id:_n,i:sn,autoFocus:Nt||sn===en,...xn})}),key:_n,in:!!Lt.find(xn=>xn.id===rn.id)}}),cn=lodashExports$1.sortBy(an,rn=>jt==null?void 0:jt(rn.value),rn=>Ut==null?void 0:Ut(rn.value)).map(rn=>({...rn,render:sn=>jsxRuntimeExports.jsx(Box$1,{children:rn.render(sn)},rn.key)}));return jsxRuntimeExports.jsx(DragDropContext,{onDragEnd:rn=>{if(!rn.destination)return;const sn=reorder(Lt,rn.source.index,rn.destination.index);Gt==null||Gt(sn),Jt(sn)},children:jsxRuntimeExports.jsxs(List$2,{subheader:Rt||At?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs(ListSubheader$1,{disableSticky:!0,children:[Rt&&jsxRuntimeExports.jsx(Type$1,{variant:"body1",gutterBottom:!0,color:"textPrimary",children:Rt}),At&&jsxRuntimeExports.jsx(Type$1,{variant:"body2",color:"text.secondary",gutterBottom:!0,style:{marginBottom:Zt.spacing(3)},children:At})]})}):void 0,children:[jsxRuntimeExports.jsx(Box$1,{mt:jt?-1:0,children:jsxRuntimeExports.jsx(ConnectedDroppable,{droppableId:"list",children:rn=>jsxRuntimeExports.jsxs("div",{...rn.droppableProps,ref:rn.innerRef,children:[(()=>{const sn=[];return cn.forEach((pn,bn)=>{jt&&un(cn,bn,pn)&&sn.push(jsxRuntimeExports.jsx(Collapse$1,{in:Lt.some(gn=>jt(gn.value)===jt(pn.value)),appear:!0,children:jsxRuntimeExports.jsx(Box$1,{pl:2,pb:2,pt:1,children:jsxRuntimeExports.jsx(Type$1,{variant:"overline",color:"text.secondary",children:jt(pn.value)})})},jt(pn.value))),sn.push(pn.render())}),sn})(),rn.placeholder]})})}),jsxRuntimeExports.jsx(Collapse$1,{in:!(Lt!=null&&Lt.length),children:jsxRuntimeExports.jsx(Box$1,{ml:2,mb:1,pt:jt?1:0,children:jsxRuntimeExports.jsx(Type$1,{component:"div",color:"text.secondary",children:Bt??"No items"})})}),jsxRuntimeExports.jsxs(Stack$1,{p:2,pt:2,gap:2,direction:"row",children:[jsxRuntimeExports.jsx(Button$2,{disableElevation:!0,variant:"outlined",startIcon:jsxRuntimeExports.jsx(Add,{}),onClick:()=>{Pt(),tn(Lt.length)},sx:{...Xt(1)},children:jsxRuntimeExports.jsx(Box$1,{sx:{color:"text.primary"},children:lt})}),qt]})]})});function un(rn,sn,pn){return!!(jt&&(rn[sn-1]===void 0||jt(rn[sn-1].value)!==jt(pn.value)))}}function ListEditor({onChange:_e,value:lt,editor:Rt,create:At,onFocus:Pt,...Dt}){const[Lt,Bt]=reactExports.useState(lt??[]);function Nt(jt){Bt(jt),_e==null||_e(jt)}return reactExports.useEffect(()=>{Bt(lt??[])},[lt]),jsxRuntimeExports.jsx(Box$1,{children:jsxRuntimeExports.jsx(Editor,{...Dt,items:Lt.map(jt=>({id:jt.key,value:jt,editor:Rt==null?void 0:Rt(jt)})),deletable:!0,editable:!1,onAddItem:()=>{const jt=nanoid$1();Nt==null||Nt([...Lt,{key:jt,...At==null?void 0:At()}]),lodashExports$1.defer(()=>Pt==null?void 0:Pt(jt))},onDeleteItem:jt=>Nt==null?void 0:Nt(lodashExports$1.filter(Lt,Ut=>Ut.key!==jt)),onChangeItem:(jt,Ut)=>Nt==null?void 0:Nt(lodashExports$1.map(Lt,Gt=>Gt.key===jt?Ut:Gt)),onChange:jt=>Nt==null?void 0:Nt(lodashExports$1.map(jt,Ut=>Ut.value))})})}const comparators=[{key:"equal",apply:({value:_e,reference:lt})=>_e===lt,needsReference:!0},{key:"less-than",apply:({value:_e,reference:lt})=>_e_e>lt,needsReference:!0},{key:"changed",apply:({value:_e,property:lt,step:Rt,node:At})=>{if(At.parent){const Pt=lodashExports$1.findLast(At.parent.events,Dt=>Dt.step({value:Bt,label:lodashExports$1.startCase(Bt)})),onChange:Bt=>At({type:Bt==="any"?void 0:Bt}),value:_e.type??"any"}),jsxRuntimeExports.jsx(Divider$1,{flexItem:!0,orientation:"vertical",sx:{mx:2}}),jsxRuntimeExports.jsx(SelectField,{placeholder:"Property",sx:{minWidth:140,textOverflow:"ellipsis",whiteSpace:"nowrap"},items:lodashExports$1.map(Rt,Bt=>({value:Bt,label:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[lodashExports$1.last(Bt.split(".")),jsxRuntimeExports.jsx(Space,{}),jsxRuntimeExports.jsx(Type$1,{color:"text.secondary",variant:"body2",component:"span",children:`event.${Bt}`})]})})),onChange:Bt=>At({property:Bt}),value:_e.property}),jsxRuntimeExports.jsx(Space,{}),jsxRuntimeExports.jsx(SelectField,{placeholder:"Condition",items:comparators.map(Bt=>({value:Bt.key,label:lodashExports$1.startCase(Bt.key)})),value:((Pt=_e.condition)==null?void 0:Pt.key)??((Dt=comparators==null?void 0:comparators[0])==null?void 0:Dt.key),onChange:Bt=>At({condition:lodashExports$1.find(comparators,{key:Bt})})}),jsxRuntimeExports.jsx(Space,{}),jsxRuntimeExports.jsx(TextField$1,{label:"Reference",fullWidth:!0,defaultValue:`${_e.reference??0}`,variant:"filled",inputProps:{inputMode:"numeric",pattern:"[0-9]*"},onChange:Bt=>At({reference:+Bt.target.value}),type:"number",disabled:!((Lt=_e.condition)!=null&&Lt.needsReference)}),jsxRuntimeExports.jsx(Space,{sx:{px:2}}),jsxRuntimeExports.jsx(Switch,{checked:!!_e.active,onChange:(Bt,Nt)=>At({active:Nt}),sx:{mr:-4}})]})}function BreakpointListEditor({layer:_e}){var Lt,Bt,Nt;const{layer:lt,setLayer:Rt}=useLayer(_e),{breakpoints:At}=(lt==null?void 0:lt.source)??{};function Pt(jt){lt&&Rt(produce(lt,Ut=>lodashExports$1.set(Ut,"source.breakpoints",jt)))}const Dt=reactExports.useMemo(()=>{var jt,Ut,Gt;return lodashExports$1.chain((Gt=(Ut=(jt=lt==null?void 0:lt.source)==null?void 0:jt.trace)==null?void 0:Ut.content)==null?void 0:Gt.events).flatMap(lodashExports$1.keys).uniq().filter(qt=>qt!=="type").value()},[(Nt=(Bt=(Lt=lt==null?void 0:lt.source)==null?void 0:Lt.trace)==null?void 0:Bt.content)==null?void 0:Nt.events]);return jsxRuntimeExports.jsx(Box$1,{sx:{overflow:"auto hidden",width:"100%"},children:jsxRuntimeExports.jsx(Scroll,{x:!0,children:jsxRuntimeExports.jsx(Box$1,{sx:{minWidth:720,mb:2},children:jsxRuntimeExports.jsx(ListEditor,{sortable:!0,button:!1,icon:null,value:At,deletable:!0,editable:!1,editor:jt=>jsxRuntimeExports.jsx(BreakpointEditor,{value:jt,properties:Dt}),create:()=>({active:!0,property:Dt==null?void 0:Dt[0],condition:comparators==null?void 0:comparators[0],type:void 0,reference:0}),onChange:jt=>Pt(jt),addItemLabel:"Breakpoint",placeholder:"Get started by adding a breakpoint."})})})})}const divider$3=jsxRuntimeExports.jsx(Divider$1,{orientation:"vertical",flexItem:!0,sx:{m:1,height:_e=>_e.spacing(3),alignSelf:"auto"}});function DebugPage({template:_e}){const{controls:lt,onChange:Rt,state:At,dragHandle:Pt}=useViewTreeContext(),[Dt,Lt]=reactExports.useState("standard"),{key:Bt,setKey:Nt,layers:jt,layer:Ut,setLayer:Gt}=useLayer(),{code:qt}=(Ut==null?void 0:Ut.source)??{};function Xt(Kt){return jsxRuntimeExports.jsx(Type$1,{variant:"overline",color:"text.secondary",children:Kt})}return jsxRuntimeExports.jsx(TabContext,{value:Dt,children:jsxRuntimeExports.jsxs(_e,{onChange:Rt,stack:At,children:[jsxRuntimeExports.jsx(_e.Title,{children:"Debugger"}),jsxRuntimeExports.jsx(_e.Handle,{children:Pt}),jsxRuntimeExports.jsxs(_e.Options,{children:[jsxRuntimeExports.jsx(FeaturePicker,{icon:jsxRuntimeExports.jsx(LayersIcon,{}),label:"Layer",value:Bt,items:lodashExports$1.map(jt,Kt=>({id:Kt.key,name:inferLayerName(Kt)})),onChange:Nt,arrow:!0,ellipsis:12}),divider$3,jsxRuntimeExports.jsxs(TabList$1,{onChange:(Kt,Zt)=>Lt(Zt),children:[jsxRuntimeExports.jsx(Tab$1,{label:"Standard",value:"standard",disabled:!Ut}),jsxRuntimeExports.jsx(Tab$1,{label:"Advanced",value:"advanced",disabled:!Ut})]})]}),jsxRuntimeExports.jsx(_e.Content,{children:Ut?jsxRuntimeExports.jsx(Scroll,{y:!0,children:jsxRuntimeExports.jsxs(Box$1,{pt:6,height:"100%",children:[jsxRuntimeExports.jsx(TabPanel$1,{value:"standard",children:jsxRuntimeExports.jsxs(Box$1,{mx:-2,children:[jsxRuntimeExports.jsx(Box$1,{px:2,children:Xt("Breakpoints")}),jsxRuntimeExports.jsx(BreakpointListEditor,{layer:Ut==null?void 0:Ut.key})]})}),jsxRuntimeExports.jsx(TabPanel$1,{value:"advanced",sx:{p:0,height:"100%"},children:jsxRuntimeExports.jsx(ScriptEditor,{code:qt??makeTemplate(lodashExports$1.values(templates)),onChange:Kt=>Ut&&Gt(produce(Ut,Zt=>lodashExports$1.set(Zt,"source.code",Kt)))})})]})}):jsxRuntimeExports.jsx(Placeholder$2,{icon:jsxRuntimeExports.jsx(DebuggerIcon,{}),label:"Debugger",secondary:"Configure breakpoints and other debugging options here. First, you'll need to load a trace."})}),jsxRuntimeExports.jsx(_e.Extras,{children:lt})]})})}const scriptRel="modulepreload",assetsURL=function(_e,lt){return new URL(_e,lt).href},seen={},__vitePreload=function _e(lt,Rt,At){if(!Rt||Rt.length===0)return lt();const Pt=document.getElementsByTagName("link");return Promise.all(Rt.map(Dt=>{if(Dt=assetsURL(Dt,At),Dt in seen)return;seen[Dt]=!0;const Lt=Dt.endsWith(".css"),Bt=Lt?'[rel="stylesheet"]':"";if(!!At)for(let Ut=Pt.length-1;Ut>=0;Ut--){const Gt=Pt[Ut];if(Gt.href===Dt&&(!Lt||Gt.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${Dt}"]${Bt}`))return;const jt=document.createElement("link");if(jt.rel=Lt?"stylesheet":scriptRel,Lt||(jt.as="script",jt.crossOrigin=""),jt.href=Dt,document.head.appendChild(jt),Lt)return new Promise((Ut,Gt)=>{jt.addEventListener("load",Ut),jt.addEventListener("error",()=>Gt(new Error(`Unable to preload CSS for ${Dt}`)))})})).then(()=>lt()).catch(Dt=>{const Lt=new Event("vite:preloadError",{cancelable:!0});if(Lt.payload=Dt,window.dispatchEvent(Lt),!Lt.defaultPrevented)throw Dt})};function _typeof(_e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof=function(lt){return typeof lt}:_typeof=function(lt){return lt&&typeof Symbol=="function"&<.constructor===Symbol&<!==Symbol.prototype?"symbol":typeof lt},_typeof(_e)}function _classCallCheck(_e,lt){if(!(_e instanceof lt))throw new TypeError("Cannot call a class as a function")}function _defineProperties(_e,lt){for(var Rt=0;Rt"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function _construct(_e,lt,Rt){return _isNativeReflectConstruct()?_construct=Reflect.construct:_construct=function(Pt,Dt,Lt){var Bt=[null];Bt.push.apply(Bt,Dt);var Nt=Function.bind.apply(Pt,Bt),jt=new Nt;return Lt&&_setPrototypeOf(jt,Lt.prototype),jt},_construct.apply(null,arguments)}function _isNativeFunction(_e){return Function.toString.call(_e).indexOf("[native code]")!==-1}function _wrapNativeSuper(_e){var lt=typeof Map=="function"?new Map:void 0;return _wrapNativeSuper=function(At){if(At===null||!_isNativeFunction(At))return At;if(typeof At!="function")throw new TypeError("Super expression must either be null or a function");if(typeof lt<"u"){if(lt.has(At))return lt.get(At);lt.set(At,Pt)}function Pt(){return _construct(At,arguments,_getPrototypeOf(this).constructor)}return Pt.prototype=Object.create(At.prototype,{constructor:{value:Pt,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Pt,At)},_wrapNativeSuper(_e)}function _assertThisInitialized(_e){if(_e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _e}function _possibleConstructorReturn(_e,lt){return lt&&(typeof lt=="object"||typeof lt=="function")?lt:_assertThisInitialized(_e)}function _createSuper(_e){var lt=_isNativeReflectConstruct();return function(){var At=_getPrototypeOf(_e),Pt;if(lt){var Dt=_getPrototypeOf(this).constructor;Pt=Reflect.construct(At,arguments,Dt)}else Pt=At.apply(this,arguments);return _possibleConstructorReturn(this,Pt)}}function _superPropBase(_e,lt){for(;!Object.prototype.hasOwnProperty.call(_e,lt)&&(_e=_getPrototypeOf(_e),_e!==null););return _e}function _get(_e,lt,Rt){return typeof Reflect<"u"&&Reflect.get?_get=Reflect.get:_get=function(Pt,Dt,Lt){var Bt=_superPropBase(Pt,Dt);if(Bt){var Nt=Object.getOwnPropertyDescriptor(Bt,Dt);return Nt.get?Nt.get.call(Lt):Nt.value}},_get(_e,lt,Rt||_e)}function _slicedToArray(_e,lt){return _arrayWithHoles(_e)||_iterableToArrayLimit(_e,lt)||_unsupportedIterableToArray(_e,lt)||_nonIterableRest()}function _toArray(_e){return _arrayWithHoles(_e)||_iterableToArray(_e)||_unsupportedIterableToArray(_e)||_nonIterableRest()}function _arrayWithHoles(_e){if(Array.isArray(_e))return _e}function _iterableToArray(_e){if(typeof Symbol<"u"&&Symbol.iterator in Object(_e))return Array.from(_e)}function _iterableToArrayLimit(_e,lt){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(_e)))){var Rt=[],At=!0,Pt=!1,Dt=void 0;try{for(var Lt=_e[Symbol.iterator](),Bt;!(At=(Bt=Lt.next()).done)&&(Rt.push(Bt.value),!(lt&&Rt.length===lt));At=!0);}catch(Nt){Pt=!0,Dt=Nt}finally{try{!At&&Lt.return!=null&&Lt.return()}finally{if(Pt)throw Dt}}return Rt}}function _unsupportedIterableToArray(_e,lt){if(_e){if(typeof _e=="string")return _arrayLikeToArray(_e,lt);var Rt=Object.prototype.toString.call(_e).slice(8,-1);if(Rt==="Object"&&_e.constructor&&(Rt=_e.constructor.name),Rt==="Map"||Rt==="Set")return Array.from(_e);if(Rt==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Rt))return _arrayLikeToArray(_e,lt)}}function _arrayLikeToArray(_e,lt){(lt==null||lt>_e.length)&&(lt=_e.length);for(var Rt=0,At=new Array(lt);Rt"u")return _e;var lt=[_e,"ms"+_e,"webkit"+_e,"moz"+_e,"o"+_e],Rt=find$1(lt,function(At){return"on"+At in document});return Rt||_e}(),primaryButton=0,sloppyClickThreshold=5;function isSloppyClickThresholdExceeded(_e,lt){return Math.abs(lt.x-_e.x)>=sloppyClickThreshold||Math.abs(lt.y-_e.y)>=sloppyClickThreshold}var idle$1={type:"IDLE"};function getCaptureBindings(_e){var lt=_e.cancel,Rt=_e.completed,At=_e.getPhase,Pt=_e.setPhase;return[{eventName:"mousemove",fn:function(Lt){var Bt=Lt.button,Nt=Lt.clientX,jt=Lt.clientY;if(Bt===primaryButton){var Ut={x:Nt,y:jt},Gt=At();if(Gt.type==="DRAGGING"){Lt.preventDefault(),Gt.actions.move(Ut);return}Gt.type!=="PENDING"&&invariant(!1);var qt=Gt.point;if(isSloppyClickThresholdExceeded(qt,Ut)){Lt.preventDefault();var Xt=Gt.actions.fluidLift(Ut);Pt({type:"DRAGGING",actions:Xt})}}}},{eventName:"mouseup",fn:function(Lt){var Bt=At();if(Bt.type!=="DRAGGING"){lt();return}Lt.preventDefault(),Bt.actions.drop({shouldBlockNextClick:!0}),Rt()}},{eventName:"mousedown",fn:function(Lt){At().type==="DRAGGING"&&Lt.preventDefault(),lt()}},{eventName:"keydown",fn:function(Lt){var Bt=At();if(Bt.type==="PENDING"){lt();return}if(Lt.keyCode===escape$1){Lt.preventDefault(),lt();return}preventStandardKeyEvents(Lt)}},{eventName:"resize",fn:lt},{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(){At().type==="PENDING"&<()}},{eventName:"webkitmouseforcedown",fn:function(Lt){var Bt=At();if(Bt.type==="IDLE"&&invariant(!1),Bt.actions.shouldRespectForcePress()){lt();return}Lt.preventDefault()}},{eventName:supportedEventName,fn:lt}]}function useMouseSensor(_e){var lt=reactExports.useRef(idle$1),Rt=reactExports.useRef(noop$2),At=useMemo(function(){return{eventName:"mousedown",fn:function(Gt){if(!Gt.defaultPrevented&&Gt.button===primaryButton&&!(Gt.ctrlKey||Gt.metaKey||Gt.shiftKey||Gt.altKey)){var qt=_e.findClosestDraggableId(Gt);if(qt){var Xt=_e.tryGetLock(qt,Lt,{sourceEvent:Gt});if(Xt){Gt.preventDefault();var Kt={x:Gt.clientX,y:Gt.clientY};Rt.current(),jt(Xt,Kt)}}}}}},[_e]),Pt=useMemo(function(){return{eventName:"webkitmouseforcewillbegin",fn:function(Gt){if(!Gt.defaultPrevented){var qt=_e.findClosestDraggableId(Gt);if(qt){var Xt=_e.findOptionsForDraggable(qt);Xt&&(Xt.shouldRespectForcePress||_e.canGetLock(qt)&&Gt.preventDefault())}}}}},[_e]),Dt=useCallback(function(){var Gt={passive:!1,capture:!0};Rt.current=bindEvents(window,[Pt,At],Gt)},[Pt,At]),Lt=useCallback(function(){var Ut=lt.current;Ut.type!=="IDLE"&&(lt.current=idle$1,Rt.current(),Dt())},[Dt]),Bt=useCallback(function(){var Ut=lt.current;Lt(),Ut.type==="DRAGGING"&&Ut.actions.cancel({shouldBlockNextClick:!0}),Ut.type==="PENDING"&&Ut.actions.abort()},[Lt]),Nt=useCallback(function(){var Gt={capture:!0,passive:!1},qt=getCaptureBindings({cancel:Bt,completed:Lt,getPhase:function(){return lt.current},setPhase:function(Kt){lt.current=Kt}});Rt.current=bindEvents(window,qt,Gt)},[Bt,Lt]),jt=useCallback(function(Gt,qt){lt.current.type!=="IDLE"&&invariant(!1),lt.current={type:"PENDING",point:qt,actions:Gt},Nt()},[Nt]);useIsomorphicLayoutEffect$3(function(){return Dt(),function(){Rt.current()}},[Dt])}var _scrollJumpKeys;function noop$1$1(){}var scrollJumpKeys=(_scrollJumpKeys={},_scrollJumpKeys[pageDown]=!0,_scrollJumpKeys[pageUp]=!0,_scrollJumpKeys[home]=!0,_scrollJumpKeys[end]=!0,_scrollJumpKeys);function getDraggingBindings(_e,lt){function Rt(){lt(),_e.cancel()}function At(){lt(),_e.drop()}return[{eventName:"keydown",fn:function(Dt){if(Dt.keyCode===escape$1){Dt.preventDefault(),Rt();return}if(Dt.keyCode===space){Dt.preventDefault(),At();return}if(Dt.keyCode===arrowDown){Dt.preventDefault(),_e.moveDown();return}if(Dt.keyCode===arrowUp){Dt.preventDefault(),_e.moveUp();return}if(Dt.keyCode===arrowRight){Dt.preventDefault(),_e.moveRight();return}if(Dt.keyCode===arrowLeft){Dt.preventDefault(),_e.moveLeft();return}if(scrollJumpKeys[Dt.keyCode]){Dt.preventDefault();return}preventStandardKeyEvents(Dt)}},{eventName:"mousedown",fn:Rt},{eventName:"mouseup",fn:Rt},{eventName:"click",fn:Rt},{eventName:"touchstart",fn:Rt},{eventName:"resize",fn:Rt},{eventName:"wheel",fn:Rt,options:{passive:!0}},{eventName:supportedEventName,fn:Rt}]}function useKeyboardSensor(_e){var lt=reactExports.useRef(noop$1$1),Rt=useMemo(function(){return{eventName:"keydown",fn:function(Dt){if(Dt.defaultPrevented||Dt.keyCode!==space)return;var Lt=_e.findClosestDraggableId(Dt);if(!Lt)return;var Bt=_e.tryGetLock(Lt,Ut,{sourceEvent:Dt});if(!Bt)return;Dt.preventDefault();var Nt=!0,jt=Bt.snapLift();lt.current();function Ut(){Nt||invariant(!1),Nt=!1,lt.current(),At()}lt.current=bindEvents(window,getDraggingBindings(jt,Ut),{capture:!0,passive:!1})}}},[_e]),At=useCallback(function(){var Dt={passive:!1,capture:!0};lt.current=bindEvents(window,[Rt],Dt)},[Rt]);useIsomorphicLayoutEffect$3(function(){return At(),function(){lt.current()}},[At])}var idle$2={type:"IDLE"},timeForLongPress=120,forcePressThreshold=.15;function getWindowBindings(_e){var lt=_e.cancel,Rt=_e.getPhase;return[{eventName:"orientationchange",fn:lt},{eventName:"resize",fn:lt},{eventName:"contextmenu",fn:function(Pt){Pt.preventDefault()}},{eventName:"keydown",fn:function(Pt){if(Rt().type!=="DRAGGING"){lt();return}Pt.keyCode===escape$1&&Pt.preventDefault(),lt()}},{eventName:supportedEventName,fn:lt}]}function getHandleBindings(_e){var lt=_e.cancel,Rt=_e.completed,At=_e.getPhase;return[{eventName:"touchmove",options:{capture:!1},fn:function(Dt){var Lt=At();if(Lt.type!=="DRAGGING"){lt();return}Lt.hasMoved=!0;var Bt=Dt.touches[0],Nt=Bt.clientX,jt=Bt.clientY,Ut={x:Nt,y:jt};Dt.preventDefault(),Lt.actions.move(Ut)}},{eventName:"touchend",fn:function(Dt){var Lt=At();if(Lt.type!=="DRAGGING"){lt();return}Dt.preventDefault(),Lt.actions.drop({shouldBlockNextClick:!0}),Rt()}},{eventName:"touchcancel",fn:function(Dt){if(At().type!=="DRAGGING"){lt();return}Dt.preventDefault(),lt()}},{eventName:"touchforcechange",fn:function(Dt){var Lt=At();Lt.type==="IDLE"&&invariant(!1);var Bt=Dt.touches[0];if(Bt){var Nt=Bt.force>=forcePressThreshold;if(Nt){var jt=Lt.actions.shouldRespectForcePress();if(Lt.type==="PENDING"){jt&<();return}if(jt){if(Lt.hasMoved){Dt.preventDefault();return}lt();return}Dt.preventDefault()}}}},{eventName:supportedEventName,fn:lt}]}function useTouchSensor(_e){var lt=reactExports.useRef(idle$2),Rt=reactExports.useRef(noop$2),At=useCallback(function(){return lt.current},[]),Pt=useCallback(function(Xt){lt.current=Xt},[]),Dt=useMemo(function(){return{eventName:"touchstart",fn:function(Xt){if(!Xt.defaultPrevented){var Kt=_e.findClosestDraggableId(Xt);if(Kt){var Zt=_e.tryGetLock(Kt,Bt,{sourceEvent:Xt});if(Zt){var Qt=Xt.touches[0],Jt=Qt.clientX,en=Qt.clientY,tn={x:Jt,y:en};Rt.current(),Gt(Zt,tn)}}}}}},[_e]),Lt=useCallback(function(){var Xt={capture:!0,passive:!1};Rt.current=bindEvents(window,[Dt],Xt)},[Dt]),Bt=useCallback(function(){var qt=lt.current;qt.type!=="IDLE"&&(qt.type==="PENDING"&&clearTimeout(qt.longPressTimerId),Pt(idle$2),Rt.current(),Lt())},[Lt,Pt]),Nt=useCallback(function(){var qt=lt.current;Bt(),qt.type==="DRAGGING"&&qt.actions.cancel({shouldBlockNextClick:!0}),qt.type==="PENDING"&&qt.actions.abort()},[Bt]),jt=useCallback(function(){var Xt={capture:!0,passive:!1},Kt={cancel:Nt,completed:Bt,getPhase:At},Zt=bindEvents(window,getHandleBindings(Kt),Xt),Qt=bindEvents(window,getWindowBindings(Kt),Xt);Rt.current=function(){Zt(),Qt()}},[Nt,At,Bt]),Ut=useCallback(function(){var Xt=At();Xt.type!=="PENDING"&&invariant(!1);var Kt=Xt.actions.fluidLift(Xt.point);Pt({type:"DRAGGING",actions:Kt,hasMoved:!1})},[At,Pt]),Gt=useCallback(function(Xt,Kt){At().type!=="IDLE"&&invariant(!1);var Zt=setTimeout(Ut,timeForLongPress);Pt({type:"PENDING",point:Kt,actions:Xt,longPressTimerId:Zt}),jt()},[jt,At,Pt,Ut]);useIsomorphicLayoutEffect$3(function(){return Lt(),function(){Rt.current();var Kt=At();Kt.type==="PENDING"&&(clearTimeout(Kt.longPressTimerId),Pt(idle$2))}},[At,Lt,Pt]),useIsomorphicLayoutEffect$3(function(){var Xt=bindEvents(window,[{eventName:"touchmove",fn:function(){},options:{capture:!1,passive:!1}}]);return Xt},[])}var interactiveTagNames={input:!0,button:!0,textarea:!0,select:!0,option:!0,optgroup:!0,video:!0,audio:!0};function isAnInteractiveElement(_e,lt){if(lt==null)return!1;var Rt=!!interactiveTagNames[lt.tagName.toLowerCase()];if(Rt)return!0;var At=lt.getAttribute("contenteditable");return At==="true"||At===""?!0:lt===_e?!1:isAnInteractiveElement(_e,lt.parentElement)}function isEventInInteractiveElement(_e,lt){var Rt=lt.target;return isHtmlElement(Rt)?isAnInteractiveElement(_e,Rt):!1}var getBorderBoxCenterPosition=function(_e){return getRect(_e.getBoundingClientRect()).center};function isElement$1(_e){return _e instanceof getWindowFromEl(_e).Element}var supportedMatchesName=function(){var _e="matches";if(typeof document>"u")return _e;var lt=[_e,"msMatchesSelector","webkitMatchesSelector"],Rt=find$1(lt,function(At){return At in Element.prototype});return Rt||_e}();function closestPonyfill(_e,lt){return _e==null?null:_e[supportedMatchesName](lt)?_e:closestPonyfill(_e.parentElement,lt)}function closest$1(_e,lt){return _e.closest?_e.closest(lt):closestPonyfill(_e,lt)}function getSelector(_e){return"["+dragHandle.contextId+'="'+_e+'"]'}function findClosestDragHandleFromEvent(_e,lt){var Rt=lt.target;if(!isElement$1(Rt))return null;var At=getSelector(_e),Pt=closest$1(Rt,At);return!Pt||!isHtmlElement(Pt)?null:Pt}function tryGetClosestDraggableIdFromEvent(_e,lt){var Rt=findClosestDragHandleFromEvent(_e,lt);return Rt?Rt.getAttribute(dragHandle.draggableId):null}function findDraggable(_e,lt){var Rt="["+draggable.contextId+'="'+_e+'"]',At=toArray$1(document.querySelectorAll(Rt)),Pt=find$1(At,function(Dt){return Dt.getAttribute(draggable.id)===lt});return!Pt||!isHtmlElement(Pt)?null:Pt}function preventDefault(_e){_e.preventDefault()}function _isActive(_e){var lt=_e.expected,Rt=_e.phase,At=_e.isLockActive;return _e.shouldWarn,!(!At()||lt!==Rt)}function canStart(_e){var lt=_e.lockAPI,Rt=_e.store,At=_e.registry,Pt=_e.draggableId;if(lt.isClaimed())return!1;var Dt=At.draggable.findById(Pt);return!(!Dt||!Dt.options.isEnabled||!canStartDrag(Rt.getState(),Pt))}function tryStart(_e){var lt=_e.lockAPI,Rt=_e.contextId,At=_e.store,Pt=_e.registry,Dt=_e.draggableId,Lt=_e.forceSensorStop,Bt=_e.sourceEvent,Nt=canStart({lockAPI:lt,store:At,registry:Pt,draggableId:Dt});if(!Nt)return null;var jt=Pt.draggable.getById(Dt),Ut=findDraggable(Rt,jt.descriptor.id);if(!Ut||Bt&&!jt.options.canDragInteractiveElements&&isEventInInteractiveElement(Ut,Bt))return null;var Gt=lt.claim(Lt||noop$2),qt="PRE_DRAG";function Xt(){return jt.options.shouldRespectForcePress}function Kt(){return lt.isActive(Gt)}function Zt(un,rn){_isActive({expected:un,phase:qt,isLockActive:Kt,shouldWarn:!0})&&At.dispatch(rn())}var Qt=Zt.bind(null,"DRAGGING");function Jt(un){function rn(){lt.release(),qt="COMPLETED"}qt!=="PRE_DRAG"&&(rn(),qt!=="PRE_DRAG"&&invariant(!1)),At.dispatch(lift(un.liftActionArgs)),qt="DRAGGING";function sn(pn,bn){if(bn===void 0&&(bn={shouldBlockNextClick:!1}),un.cleanup(),bn.shouldBlockNextClick){var gn=bindEvents(window,[{eventName:"click",fn:preventDefault,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(gn)}rn(),At.dispatch(drop({reason:pn}))}return _extends$2({isActive:function(){return _isActive({expected:"DRAGGING",phase:qt,isLockActive:Kt,shouldWarn:!1})},shouldRespectForcePress:Xt,drop:function(bn){return sn("DROP",bn)},cancel:function(bn){return sn("CANCEL",bn)}},un.actions)}function en(un){var rn=rafSchd$1(function(pn){Qt(function(){return move({client:pn})})}),sn=Jt({liftActionArgs:{id:Dt,clientSelection:un,movementMode:"FLUID"},cleanup:function(){return rn.cancel()},actions:{move:rn}});return _extends$2({},sn,{move:rn})}function tn(){var un={moveUp:function(){return Qt(moveUp)},moveRight:function(){return Qt(moveRight)},moveDown:function(){return Qt(moveDown)},moveLeft:function(){return Qt(moveLeft)}};return Jt({liftActionArgs:{id:Dt,clientSelection:getBorderBoxCenterPosition(Ut),movementMode:"SNAP"},cleanup:noop$2,actions:un})}function an(){var un=_isActive({expected:"PRE_DRAG",phase:qt,isLockActive:Kt,shouldWarn:!0});un&<.release()}var cn={isActive:function(){return _isActive({expected:"PRE_DRAG",phase:qt,isLockActive:Kt,shouldWarn:!1})},shouldRespectForcePress:Xt,fluidLift:en,snapLift:tn,abort:an};return cn}var defaultSensors=[useMouseSensor,useKeyboardSensor,useTouchSensor];function useSensorMarshal(_e){var lt=_e.contextId,Rt=_e.store,At=_e.registry,Pt=_e.customSensors,Dt=_e.enableDefaultSensors,Lt=[].concat(Dt?defaultSensors:[],Pt||[]),Bt=reactExports.useState(function(){return create$1()})[0],Nt=useCallback(function(en,tn){en.isDragging&&!tn.isDragging&&Bt.tryAbandon()},[Bt]);useIsomorphicLayoutEffect$3(function(){var en=Rt.getState(),tn=Rt.subscribe(function(){var an=Rt.getState();Nt(en,an),en=an});return tn},[Bt,Rt,Nt]),useIsomorphicLayoutEffect$3(function(){return Bt.tryAbandon},[Bt.tryAbandon]);for(var jt=useCallback(function(Jt){return canStart({lockAPI:Bt,registry:At,store:Rt,draggableId:Jt})},[Bt,At,Rt]),Ut=useCallback(function(Jt,en,tn){return tryStart({lockAPI:Bt,registry:At,contextId:lt,store:Rt,draggableId:Jt,forceSensorStop:en,sourceEvent:tn&&tn.sourceEvent?tn.sourceEvent:null})},[lt,Bt,At,Rt]),Gt=useCallback(function(Jt){return tryGetClosestDraggableIdFromEvent(lt,Jt)},[lt]),qt=useCallback(function(Jt){var en=At.draggable.findById(Jt);return en?en.options:null},[At.draggable]),Xt=useCallback(function(){Bt.isClaimed()&&(Bt.tryAbandon(),Rt.getState().phase!=="IDLE"&&Rt.dispatch(flush()))},[Bt,Rt]),Kt=useCallback(Bt.isClaimed,[Bt]),Zt=useMemo(function(){return{canGetLock:jt,tryGetLock:Ut,findClosestDraggableId:Gt,findOptionsForDraggable:qt,tryReleaseLock:Xt,isLockClaimed:Kt}},[jt,Ut,Gt,qt,Xt,Kt]),Qt=0;QtjsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[_e,lt,Rt]});function ListEditorField({toggleable:_e,deletable:lt,editable:Rt=!0,onChangeItem:At=()=>{},onDeleteItem:Pt=()=>{},extras:Dt,enabled:Lt=!1,editor:Bt=jsxRuntimeExports.jsx(DefaultListEditorInput,{}),value:Nt,id:jt,i:Ut=0,autoFocus:Gt,sortable:qt,button:Xt=!0,renderEditor:Kt=defaultEditorRenderer}){const Zt=useAcrylic(),Qt=usePaper(),[Jt,en]=reactExports.useState(null),tn=Xt?ButtonBase$1:Box$1;return jsxRuntimeExports.jsx(PublicDraggable,{index:Ut,draggableId:`${jt}`,children:(an,cn)=>jsxRuntimeExports.jsx("div",{ref:an.innerRef,...an.draggableProps,children:jsxRuntimeExports.jsx(Stack$1,{direction:"row",alignItems:"center",sx:{...Xt?{transition:un=>un.transitions.create("background"),"&:hover":{background:un=>un.palette.action.hover}}:void 0,...cn.isDragging?{...Qt(1),...Zt}:void 0},children:Kt==null?void 0:Kt({value:Nt,onValueChange:un=>At(jt??Ut,un,Lt),handle:qt&&jsxRuntimeExports.jsx(Flex,{...an.dragHandleProps,color:"text.secondary",sx:{flex:0,p:2},children:jsxRuntimeExports.jsx(DragHandleOutlined,{})}),content:jsxRuntimeExports.jsx(tn,{sx:{flex:1,display:"block",textAlign:"left",px:2},children:reactExports.cloneElement(Bt,{onDelete:()=>Pt(jt??Ut),autoFocus:Gt,value:Nt,key:jt??Ut,onValueChange:un=>At(jt??Ut,un,Lt),onChange:un=>At(jt??Ut,un.target.value,Lt),ref:un=>en(un)})}),extras:jsxRuntimeExports.jsxs(Flex,{sx:{flex:0,px:1},children:[_e&&jsxRuntimeExports.jsx(Switch$2,{color:"primary",edge:"end",onChange:(un,rn)=>At(jt??Ut,Nt,rn),checked:Lt}),Rt&&jsxRuntimeExports.jsx(IconButton$1,{edge:"end",onClick:()=>{Jt!=null&&Jt.focus&&Jt.focus()},children:jsxRuntimeExports.jsx(EditIcon,{})}),lt&&jsxRuntimeExports.jsx(IconButton$1,{onClick:()=>Pt(jt??Ut),children:jsxRuntimeExports.jsx(DeleteIcon,{})}),Dt&&Dt(Nt)]})})})})})}function reorder(_e,lt,Rt){const At=Array.from(_e),[Pt]=At.splice(lt,1);return At.splice(Rt,0,Pt),At}function Editor(_e){const{addItemLabel:lt="Add Item",UNSAFE_label:Rt,UNSAFE_text:At,onAddItem:Pt=()=>{},onDeleteItem:Dt=()=>{},items:Lt=[],placeholder:Bt,autoFocus:Nt,category:jt,order:Ut,onChange:Gt,addItemExtras:qt}=_e,Xt=usePaper(),Kt=useInitialRender(),Zt=useTheme(),[Qt,Jt]=reactExports.useState(Lt),[en,tn]=reactExports.useState(-1);reactExports.useEffect(()=>{const rn=setTimeout(()=>{Jt(Lt)},Zt.transitions.duration.standard);return()=>{clearTimeout(rn)}},[Lt,Jt,Zt.transitions.duration.standard]);const an=lodashExports$1.uniqBy([...Qt,...Lt],rn=>rn.id).map(rn=>Lt.find(sn=>rn.id===sn.id)??rn).map((rn,sn)=>{const{enabled:pn,editor:bn,value:gn,id:_n}=rn??{};return{value:gn,render:xn=>jsxRuntimeExports.jsx(Collapse$1,{in:!!Lt.find(ln=>ln.id===rn.id),unmountOnExit:!0,appear:!Kt,mountOnEnter:!0,children:jsxRuntimeExports.jsx(ListEditorField,{..._e,onDeleteItem:ln=>{Dt(ln),tn(-1)},enabled:pn,editor:bn,value:gn,id:_n,i:sn,autoFocus:Nt||sn===en,...xn})}),key:_n,in:!!Lt.find(xn=>xn.id===rn.id)}}),cn=lodashExports$1.sortBy(an,rn=>jt==null?void 0:jt(rn.value),rn=>Ut==null?void 0:Ut(rn.value)).map(rn=>({...rn,render:sn=>jsxRuntimeExports.jsx(Box$1,{children:rn.render(sn)},rn.key)}));return jsxRuntimeExports.jsx(DragDropContext,{onDragEnd:rn=>{if(!rn.destination)return;const sn=reorder(Lt,rn.source.index,rn.destination.index);Gt==null||Gt(sn),Jt(sn)},children:jsxRuntimeExports.jsxs(List$2,{subheader:Rt||At?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs(ListSubheader$1,{disableSticky:!0,children:[Rt&&jsxRuntimeExports.jsx(Type$1,{variant:"body1",gutterBottom:!0,color:"textPrimary",children:Rt}),At&&jsxRuntimeExports.jsx(Type$1,{variant:"body2",color:"text.secondary",gutterBottom:!0,style:{marginBottom:Zt.spacing(3)},children:At})]})}):void 0,children:[jsxRuntimeExports.jsx(Box$1,{mt:jt?-1:0,children:jsxRuntimeExports.jsx(ConnectedDroppable,{droppableId:"list",children:rn=>jsxRuntimeExports.jsxs("div",{...rn.droppableProps,ref:rn.innerRef,children:[(()=>{const sn=[];return cn.forEach((pn,bn)=>{jt&&un(cn,bn,pn)&&sn.push(jsxRuntimeExports.jsx(Collapse$1,{in:Lt.some(gn=>jt(gn.value)===jt(pn.value)),appear:!0,children:jsxRuntimeExports.jsx(Box$1,{pl:2,pb:2,pt:1,children:jsxRuntimeExports.jsx(Type$1,{variant:"overline",color:"text.secondary",children:jt(pn.value)})})},jt(pn.value))),sn.push(pn.render())}),sn})(),rn.placeholder]})})}),jsxRuntimeExports.jsx(Collapse$1,{in:!(Lt!=null&&Lt.length),children:jsxRuntimeExports.jsx(Box$1,{ml:2,mb:1,pt:jt?1:0,children:jsxRuntimeExports.jsx(Type$1,{component:"div",color:"text.secondary",children:Bt??"No items"})})}),jsxRuntimeExports.jsxs(Stack$1,{p:2,pt:2,gap:2,direction:"row",children:[jsxRuntimeExports.jsx(Button$2,{disableElevation:!0,variant:"outlined",startIcon:jsxRuntimeExports.jsx(Add,{}),onClick:()=>{Pt(),tn(Lt.length)},sx:{...Xt(1)},children:jsxRuntimeExports.jsx(Box$1,{sx:{color:"text.primary"},children:lt})}),qt]})]})});function un(rn,sn,pn){return!!(jt&&(rn[sn-1]===void 0||jt(rn[sn-1].value)!==jt(pn.value)))}}function ListEditor({onChange:_e,value:lt,editor:Rt,create:At,onFocus:Pt,...Dt}){const[Lt,Bt]=reactExports.useState(lt??[]);function Nt(jt){Bt(jt),_e==null||_e(jt)}return reactExports.useEffect(()=>{Bt(lt??[])},[lt]),jsxRuntimeExports.jsx(Box$1,{children:jsxRuntimeExports.jsx(Editor,{...Dt,items:Lt.map(jt=>({id:jt.key,value:jt,editor:Rt==null?void 0:Rt(jt)})),deletable:!0,editable:!1,onAddItem:()=>{const jt=nanoid$1();Nt==null||Nt([...Lt,{key:jt,...At==null?void 0:At()}]),lodashExports$1.defer(()=>Pt==null?void 0:Pt(jt))},onDeleteItem:jt=>Nt==null?void 0:Nt(lodashExports$1.filter(Lt,Ut=>Ut.key!==jt)),onChangeItem:(jt,Ut)=>Nt==null?void 0:Nt(lodashExports$1.map(Lt,Gt=>Gt.key===jt?Ut:Gt)),onChange:jt=>Nt==null?void 0:Nt(lodashExports$1.map(jt,Ut=>Ut.value))})})}const comparators=[{key:"equal",apply:({value:_e,reference:lt})=>_e===lt,needsReference:!0},{key:"less-than",apply:({value:_e,reference:lt})=>_e_e>lt,needsReference:!0},{key:"changed",apply:({value:_e,property:lt,step:Rt,node:At})=>{if(At.parent){const Pt=lodashExports$1.findLast(At.parent.events,Dt=>Dt.step({value:Bt,label:lodashExports$1.startCase(Bt)})),onChange:Bt=>At({type:Bt==="any"?void 0:Bt}),value:_e.type??"any"}),jsxRuntimeExports.jsx(Divider$1,{flexItem:!0,orientation:"vertical",sx:{mx:2}}),jsxRuntimeExports.jsx(SelectField,{placeholder:"Property",sx:{minWidth:140,textOverflow:"ellipsis",whiteSpace:"nowrap"},items:lodashExports$1.map(Rt,Bt=>({value:Bt,label:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[lodashExports$1.last(Bt.split(".")),jsxRuntimeExports.jsx(Space,{}),jsxRuntimeExports.jsx(Type$1,{color:"text.secondary",variant:"body2",component:"span",children:`event.${Bt}`})]})})),onChange:Bt=>At({property:Bt}),value:_e.property}),jsxRuntimeExports.jsx(Space,{}),jsxRuntimeExports.jsx(SelectField,{placeholder:"Condition",items:comparators.map(Bt=>({value:Bt.key,label:lodashExports$1.startCase(Bt.key)})),value:((Pt=_e.condition)==null?void 0:Pt.key)??((Dt=comparators==null?void 0:comparators[0])==null?void 0:Dt.key),onChange:Bt=>At({condition:lodashExports$1.find(comparators,{key:Bt})})}),jsxRuntimeExports.jsx(Space,{}),jsxRuntimeExports.jsx(TextField$1,{label:"Reference",fullWidth:!0,defaultValue:`${_e.reference??0}`,variant:"filled",inputProps:{inputMode:"numeric",pattern:"[0-9]*"},onChange:Bt=>At({reference:+Bt.target.value}),type:"number",disabled:!((Lt=_e.condition)!=null&&Lt.needsReference)}),jsxRuntimeExports.jsx(Space,{sx:{px:2}}),jsxRuntimeExports.jsx(Switch,{checked:!!_e.active,onChange:(Bt,Nt)=>At({active:Nt}),sx:{mr:-4}})]})}function BreakpointListEditor({layer:_e}){var Lt,Bt,Nt;const{layer:lt,setLayer:Rt}=useLayer(_e),{breakpoints:At}=(lt==null?void 0:lt.source)??{};function Pt(jt){lt&&Rt(produce(lt,Ut=>lodashExports$1.set(Ut,"source.breakpoints",jt)))}const Dt=reactExports.useMemo(()=>{var jt,Ut,Gt;return lodashExports$1.chain((Gt=(Ut=(jt=lt==null?void 0:lt.source)==null?void 0:jt.trace)==null?void 0:Ut.content)==null?void 0:Gt.events).flatMap(lodashExports$1.keys).uniq().filter(qt=>qt!=="type").value()},[(Nt=(Bt=(Lt=lt==null?void 0:lt.source)==null?void 0:Lt.trace)==null?void 0:Bt.content)==null?void 0:Nt.events]);return jsxRuntimeExports.jsx(Box$1,{sx:{overflow:"auto hidden",width:"100%"},children:jsxRuntimeExports.jsx(Scroll,{x:!0,children:jsxRuntimeExports.jsx(Box$1,{sx:{minWidth:720,mb:2},children:jsxRuntimeExports.jsx(ListEditor,{sortable:!0,button:!1,icon:null,value:At,deletable:!0,editable:!1,editor:jt=>jsxRuntimeExports.jsx(BreakpointEditor,{value:jt,properties:Dt}),create:()=>({active:!0,property:Dt==null?void 0:Dt[0],condition:comparators==null?void 0:comparators[0],type:void 0,reference:0}),onChange:jt=>Pt(jt),addItemLabel:"Breakpoint",placeholder:"Get started by adding a breakpoint."})})})})}const divider$3=jsxRuntimeExports.jsx(Divider$1,{orientation:"vertical",flexItem:!0,sx:{m:1,height:_e=>_e.spacing(3),alignSelf:"auto"}});function DebugPage({template:_e}){const{controls:lt,onChange:Rt,state:At,dragHandle:Pt}=useViewTreeContext(),[Dt,Lt]=reactExports.useState("standard"),{key:Bt,setKey:Nt,layers:jt,layer:Ut,setLayer:Gt}=useLayer(),{code:qt}=(Ut==null?void 0:Ut.source)??{};function Xt(Kt){return jsxRuntimeExports.jsx(Type$1,{variant:"overline",color:"text.secondary",children:Kt})}return jsxRuntimeExports.jsx(TabContext,{value:Dt,children:jsxRuntimeExports.jsxs(_e,{onChange:Rt,stack:At,children:[jsxRuntimeExports.jsx(_e.Title,{children:"Debugger"}),jsxRuntimeExports.jsx(_e.Handle,{children:Pt}),jsxRuntimeExports.jsxs(_e.Options,{children:[jsxRuntimeExports.jsx(FeaturePicker,{icon:jsxRuntimeExports.jsx(LayersIcon,{}),label:"Layer",value:Bt,items:lodashExports$1.map(jt,Kt=>({id:Kt.key,name:inferLayerName(Kt)})),onChange:Nt,arrow:!0,ellipsis:12}),divider$3,jsxRuntimeExports.jsxs(TabList$1,{onChange:(Kt,Zt)=>Lt(Zt),children:[jsxRuntimeExports.jsx(Tab$1,{label:"Standard",value:"standard",disabled:!Ut}),jsxRuntimeExports.jsx(Tab$1,{label:"Advanced",value:"advanced",disabled:!Ut})]})]}),jsxRuntimeExports.jsx(_e.Content,{children:Ut?jsxRuntimeExports.jsx(Scroll,{y:!0,children:jsxRuntimeExports.jsxs(Box$1,{pt:6,height:"100%",children:[jsxRuntimeExports.jsx(TabPanel$1,{value:"standard",sx:{p:2},children:jsxRuntimeExports.jsxs(Box$1,{mx:-2,children:[jsxRuntimeExports.jsx(Box$1,{px:2,children:Xt("Breakpoints")}),jsxRuntimeExports.jsx(BreakpointListEditor,{layer:Ut==null?void 0:Ut.key})]})}),jsxRuntimeExports.jsx(TabPanel$1,{value:"advanced",sx:{p:0,height:"100%"},children:jsxRuntimeExports.jsx(ScriptEditor,{code:qt??makeTemplate(lodashExports$1.values(templates)),onChange:Kt=>Ut&&Gt(produce(Ut,Zt=>lodashExports$1.set(Zt,"source.code",Kt)))})})]})}):jsxRuntimeExports.jsx(Placeholder$2,{icon:jsxRuntimeExports.jsx(DebuggerIcon,{}),label:"Debugger",secondary:"Configure breakpoints and other debugging options here. First, you'll need to load a trace."})}),jsxRuntimeExports.jsx(_e.Extras,{children:lt})]})})}const scriptRel="modulepreload",assetsURL=function(_e,lt){return new URL(_e,lt).href},seen={},__vitePreload=function _e(lt,Rt,At){if(!Rt||Rt.length===0)return lt();const Pt=document.getElementsByTagName("link");return Promise.all(Rt.map(Dt=>{if(Dt=assetsURL(Dt,At),Dt in seen)return;seen[Dt]=!0;const Lt=Dt.endsWith(".css"),Bt=Lt?'[rel="stylesheet"]':"";if(!!At)for(let Ut=Pt.length-1;Ut>=0;Ut--){const Gt=Pt[Ut];if(Gt.href===Dt&&(!Lt||Gt.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${Dt}"]${Bt}`))return;const jt=document.createElement("link");if(jt.rel=Lt?"stylesheet":scriptRel,Lt||(jt.as="script",jt.crossOrigin=""),jt.href=Dt,document.head.appendChild(jt),Lt)return new Promise((Ut,Gt)=>{jt.addEventListener("load",Ut),jt.addEventListener("error",()=>Gt(new Error(`Unable to preload CSS for ${Dt}`)))})})).then(()=>lt()).catch(Dt=>{const Lt=new Event("vite:preloadError",{cancelable:!0});if(Lt.payload=Dt,window.dispatchEvent(Lt),!Lt.defaultPrevented)throw Dt})};function _typeof(_e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof=function(lt){return typeof lt}:_typeof=function(lt){return lt&&typeof Symbol=="function"&<.constructor===Symbol&<!==Symbol.prototype?"symbol":typeof lt},_typeof(_e)}function _classCallCheck(_e,lt){if(!(_e instanceof lt))throw new TypeError("Cannot call a class as a function")}function _defineProperties(_e,lt){for(var Rt=0;Rt"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function _construct(_e,lt,Rt){return _isNativeReflectConstruct()?_construct=Reflect.construct:_construct=function(Pt,Dt,Lt){var Bt=[null];Bt.push.apply(Bt,Dt);var Nt=Function.bind.apply(Pt,Bt),jt=new Nt;return Lt&&_setPrototypeOf(jt,Lt.prototype),jt},_construct.apply(null,arguments)}function _isNativeFunction(_e){return Function.toString.call(_e).indexOf("[native code]")!==-1}function _wrapNativeSuper(_e){var lt=typeof Map=="function"?new Map:void 0;return _wrapNativeSuper=function(At){if(At===null||!_isNativeFunction(At))return At;if(typeof At!="function")throw new TypeError("Super expression must either be null or a function");if(typeof lt<"u"){if(lt.has(At))return lt.get(At);lt.set(At,Pt)}function Pt(){return _construct(At,arguments,_getPrototypeOf(this).constructor)}return Pt.prototype=Object.create(At.prototype,{constructor:{value:Pt,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Pt,At)},_wrapNativeSuper(_e)}function _assertThisInitialized(_e){if(_e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _e}function _possibleConstructorReturn(_e,lt){return lt&&(typeof lt=="object"||typeof lt=="function")?lt:_assertThisInitialized(_e)}function _createSuper(_e){var lt=_isNativeReflectConstruct();return function(){var At=_getPrototypeOf(_e),Pt;if(lt){var Dt=_getPrototypeOf(this).constructor;Pt=Reflect.construct(At,arguments,Dt)}else Pt=At.apply(this,arguments);return _possibleConstructorReturn(this,Pt)}}function _superPropBase(_e,lt){for(;!Object.prototype.hasOwnProperty.call(_e,lt)&&(_e=_getPrototypeOf(_e),_e!==null););return _e}function _get(_e,lt,Rt){return typeof Reflect<"u"&&Reflect.get?_get=Reflect.get:_get=function(Pt,Dt,Lt){var Bt=_superPropBase(Pt,Dt);if(Bt){var Nt=Object.getOwnPropertyDescriptor(Bt,Dt);return Nt.get?Nt.get.call(Lt):Nt.value}},_get(_e,lt,Rt||_e)}function _slicedToArray(_e,lt){return _arrayWithHoles(_e)||_iterableToArrayLimit(_e,lt)||_unsupportedIterableToArray(_e,lt)||_nonIterableRest()}function _toArray(_e){return _arrayWithHoles(_e)||_iterableToArray(_e)||_unsupportedIterableToArray(_e)||_nonIterableRest()}function _arrayWithHoles(_e){if(Array.isArray(_e))return _e}function _iterableToArray(_e){if(typeof Symbol<"u"&&Symbol.iterator in Object(_e))return Array.from(_e)}function _iterableToArrayLimit(_e,lt){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(_e)))){var Rt=[],At=!0,Pt=!1,Dt=void 0;try{for(var Lt=_e[Symbol.iterator](),Bt;!(At=(Bt=Lt.next()).done)&&(Rt.push(Bt.value),!(lt&&Rt.length===lt));At=!0);}catch(Nt){Pt=!0,Dt=Nt}finally{try{!At&&Lt.return!=null&&Lt.return()}finally{if(Pt)throw Dt}}return Rt}}function _unsupportedIterableToArray(_e,lt){if(_e){if(typeof _e=="string")return _arrayLikeToArray(_e,lt);var Rt=Object.prototype.toString.call(_e).slice(8,-1);if(Rt==="Object"&&_e.constructor&&(Rt=_e.constructor.name),Rt==="Map"||Rt==="Set")return Array.from(_e);if(Rt==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Rt))return _arrayLikeToArray(_e,lt)}}function _arrayLikeToArray(_e,lt){(lt==null||lt>_e.length)&&(lt=_e.length);for(var Rt=0,At=new Array(lt);Rt"u"||_e[Symbol.iterator]==null){if(Array.isArray(_e)||(Rt=_unsupportedIterableToArray(_e))||lt&&_e&&typeof _e.length=="number"){Rt&&(_e=Rt);var At=0,Pt=function(){};return{s:Pt,n:function(){return At>=_e.length?{done:!0}:{done:!1,value:_e[At++]}},e:function(Nt){throw Nt},f:Pt}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Dt=!0,Lt=!1,Bt;return{s:function(){Rt=_e[Symbol.iterator]()},n:function(){var Nt=Rt.next();return Dt=Nt.done,Nt},e:function(Nt){Lt=!0,Bt=Nt},f:function(){try{!Dt&&Rt.return!=null&&Rt.return()}finally{if(Lt)throw Bt}}}}var Char={ANCHOR:"&",COMMENT:"#",TAG:"!",DIRECTIVES_END:"-",DOCUMENT_END:"."},Type={ALIAS:"ALIAS",BLANK_LINE:"BLANK_LINE",BLOCK_FOLDED:"BLOCK_FOLDED",BLOCK_LITERAL:"BLOCK_LITERAL",COMMENT:"COMMENT",DIRECTIVE:"DIRECTIVE",DOCUMENT:"DOCUMENT",FLOW_MAP:"FLOW_MAP",FLOW_SEQ:"FLOW_SEQ",MAP:"MAP",MAP_KEY:"MAP_KEY",MAP_VALUE:"MAP_VALUE",PLAIN:"PLAIN",QUOTE_DOUBLE:"QUOTE_DOUBLE",QUOTE_SINGLE:"QUOTE_SINGLE",SEQ:"SEQ",SEQ_ITEM:"SEQ_ITEM"},defaultTagPrefix="tag:yaml.org,2002:",defaultTags={MAP:"tag:yaml.org,2002:map",SEQ:"tag:yaml.org,2002:seq",STR:"tag:yaml.org,2002:str"};function findLineStarts(_e){for(var lt=[0],Rt=_e.indexOf(` `);Rt!==-1;)Rt+=1,lt.push(Rt),Rt=_e.indexOf(` @@ -1992,4 +1992,4 @@ void main(void)\r src: url('${lt.dataSrc}'); font-weight: ${lt.weight}; font-style: ${lt.style}; - }`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(_e){this._stylesheet!==_e&&(this._stylesheet=_e,this.styleID++)}normalizeColor(_e){return Array.isArray(_e)&&(_e=rgb2hex(_e)),typeof _e=="number"?hex2string(_e):_e}dropShadowToCSS(){let _e=this.normalizeColor(this.dropShadowColor);const lt=this.dropShadowAlpha,Rt=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),At=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);_e.startsWith("#")&<<1&&(_e+=(lt*255|0).toString(16).padStart(2,"0"));const Pt=`${Rt}px ${At}px`;return this.dropShadowBlur>0?`text-shadow: ${Pt} ${this.dropShadowBlur}px ${_e}`:`text-shadow: ${Pt} ${_e}`}reset(){Object.assign(this,_HTMLTextStyle.defaultOptions)}onBeforeDraw(){const{fontsDirty:_e}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&_e?new Promise(lt=>setTimeout(lt,100)):Promise.resolve()}get isSafari(){const{userAgent:_e}=settings.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(_e)}set fillGradientStops(_e){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(_e){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(_e){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(_e){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(_e){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(_e){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(_e){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};let HTMLTextStyle=_HTMLTextStyle;HTMLTextStyle.availableFonts={};HTMLTextStyle.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};const _HTMLText=class extends Sprite{constructor(_e="",lt={}){super(Texture.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this._loading=!1,this.localStyleID=-1,this.dirty=!1,this.ownsStyle=!1;const Rt=new Image,At=Texture.from(Rt,{scaleMode:settings.SCALE_MODE,resourceOptions:{autoLoad:!1}});At.orig=new Rectangle,At.trim=new Rectangle,this.texture=At;const Pt="http://www.w3.org/2000/svg",Dt="http://www.w3.org/1999/xhtml",Lt=document.createElementNS(Pt,"svg"),Bt=document.createElementNS(Pt,"foreignObject"),Nt=document.createElementNS(Dt,"div"),jt=document.createElementNS(Dt,"style");Bt.setAttribute("width","10000"),Bt.setAttribute("height","10000"),Bt.style.overflow="hidden",Lt.appendChild(Bt),this.maxWidth=_HTMLText.defaultMaxWidth,this.maxHeight=_HTMLText.defaultMaxHeight,this._domElement=Nt,this._styleElement=jt,this._svgRoot=Lt,this._foreignObject=Bt,this._foreignObject.appendChild(jt),this._foreignObject.appendChild(Nt),this._image=Rt,this._loadImage=new Image,this._autoResolution=_HTMLText.defaultAutoResolution,this._resolution=_HTMLText.defaultResolution??settings.RESOLUTION,this.text=_e,this.style=lt}measureText(_e){var Bt,Nt;const{text:lt,style:Rt,resolution:At}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},_e);Object.assign(this._domElement,{innerHTML:lt,style:Rt.toCSS(At)}),this._styleElement.textContent=Rt.toGlobalCSS(),document.body.appendChild(this._svgRoot);const Pt=this._domElement.getBoundingClientRect();this._svgRoot.remove();const Dt=Math.min(this.maxWidth,Math.ceil(Pt.width)),Lt=Math.min(this.maxHeight,Math.ceil(Pt.height));return this._svgRoot.setAttribute("width",Dt.toString()),this._svgRoot.setAttribute("height",Lt.toString()),lt!==this._text&&(this._domElement.innerHTML=this._text),Rt!==this._style&&(Object.assign(this._domElement,{style:(Bt=this._style)==null?void 0:Bt.toCSS(At)}),this._styleElement.textContent=(Nt=this._style)==null?void 0:Nt.toGlobalCSS()),{width:Dt+Rt.padding*2,height:Lt+Rt.padding*2}}async updateText(_e=!0){const{style:lt,_image:Rt,_loadImage:At}=this;if(this.localStyleID!==lt.styleID&&(this.dirty=!0,this.localStyleID=lt.styleID),!this.dirty&&_e)return;const{width:Pt,height:Dt}=this.measureText();Rt.width=At.width=Math.ceil(Math.max(1,Pt)),Rt.height=At.height=Math.ceil(Math.max(1,Dt)),this._loading||(this._loading=!0,await new Promise(Lt=>{At.onload=async()=>{await lt.onBeforeDraw(),this._loading=!1,Rt.src=At.src,At.onload=null,At.src="",this.updateTexture(),Lt()};const Bt=new XMLSerializer().serializeToString(this._svgRoot);At.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(Bt)}`}))}get source(){return this._image}updateTexture(){const{style:_e,texture:lt,_image:Rt,resolution:At}=this,{padding:Pt}=_e,{baseTexture:Dt}=lt;lt.trim.width=lt._frame.width=Rt.width/At,lt.trim.height=lt._frame.height=Rt.height/At,lt.trim.x=-Pt,lt.trim.y=-Pt,lt.orig.width=lt._frame.width-Pt*2,lt.orig.height=lt._frame.height-Pt*2,this._onTextureUpdate(),Dt.setRealSize(Rt.width,Rt.height,At),this.dirty=!1}_render(_e){this._autoResolution&&this._resolution!==_e.resolution&&(this._resolution=_e.resolution,this.dirty=!0),this.updateText(!0),super._render(_e)}_renderCanvas(_e){this._autoResolution&&this._resolution!==_e.resolution&&(this._resolution=_e.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(_e)}getLocalBounds(_e){return this.updateText(!0),super.getLocalBounds(_e)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(_e){var Rt,At,Pt,Dt,Lt;typeof _e=="boolean"&&(_e={children:_e}),_e=Object.assign({},_HTMLText.defaultDestroyOptions,_e),super.destroy(_e);const lt=null;this.ownsStyle&&((Rt=this._style)==null||Rt.cleanFonts()),this._style=lt,(At=this._svgRoot)==null||At.remove(),this._svgRoot=lt,(Pt=this._domElement)==null||Pt.remove(),this._domElement=lt,(Dt=this._foreignObject)==null||Dt.remove(),this._foreignObject=lt,(Lt=this._styleElement)==null||Lt.remove(),this._styleElement=lt,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=lt,this._image.src="",this._image=lt}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(_e){this.updateText(!0);const lt=sign$2(this.scale.x)||1;this.scale.x=lt*_e/this._image.width/this.resolution,this._width=_e}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(_e){this.updateText(!0);const lt=sign$2(this.scale.y)||1;this.scale.y=lt*_e/this._image.height/this.resolution,this._height=_e}get style(){return this._style}set style(_e){this._style!==_e&&(_e=_e||{},_e instanceof HTMLTextStyle?(this.ownsStyle=!1,this._style=_e):_e instanceof TextStyle?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=HTMLTextStyle.from(_e)):(this.ownsStyle=!0,this._style=new HTMLTextStyle(_e)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(_e){_e=String(_e===""||_e===null||_e===void 0?" ":_e),_e=this.sanitiseText(_e),this._text!==_e&&(this._text=_e,this.dirty=!0)}get resolution(){return this._resolution}set resolution(_e){this._autoResolution=!1,this._resolution!==_e&&(this._resolution=_e,this.dirty=!0)}sanitiseText(_e){return _e.replace(/
/gi,"
").replace(/
/gi,"
").replace(/ /gi," ")}};let HTMLText=_HTMLText;HTMLText.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0};HTMLText.defaultMaxWidth=2024;HTMLText.defaultMaxHeight=2024;HTMLText.defaultAutoResolution=!0;function makeRenderer(_e,lt){return{constructor:_e,meta:lt}}function quickselect(_e,lt,Rt,At,Pt){quickselectStep(_e,lt,Rt||0,At||_e.length-1,Pt||defaultCompare)}function quickselectStep(_e,lt,Rt,At,Pt){for(;At>Rt;){if(At-Rt>600){var Dt=At-Rt+1,Lt=lt-Rt+1,Bt=Math.log(Dt),Nt=.5*Math.exp(2*Bt/3),jt=.5*Math.sqrt(Bt*Nt*(Dt-Nt)/Dt)*(Lt-Dt/2<0?-1:1),Ut=Math.max(Rt,Math.floor(lt-Lt*Nt/Dt+jt)),Gt=Math.min(At,Math.floor(lt+(Dt-Lt)*Nt/Dt+jt));quickselectStep(_e,lt,Ut,Gt,Pt)}var qt=_e[lt],Xt=Rt,Kt=At;for(swap(_e,Rt,lt),Pt(_e[At],qt)>0&&swap(_e,Rt,At);Xt0;)Kt--}Pt(_e[Rt],qt)===0?swap(_e,Rt,Kt):(Kt++,swap(_e,Kt,At)),Kt<=lt&&(Rt=Kt+1),lt<=Kt&&(At=Kt-1)}}function swap(_e,lt,Rt){var At=_e[lt];_e[lt]=_e[Rt],_e[Rt]=At}function defaultCompare(_e,lt){return _elt?1:0}class RBush{constructor(lt=9){this._maxEntries=Math.max(4,lt),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(lt){let Rt=this.data;const At=[];if(!intersects(lt,Rt))return At;const Pt=this.toBBox,Dt=[];for(;Rt;){for(let Lt=0;Lt=0&&Dt[Rt].children.length>this._maxEntries;)this._split(Dt,Rt),Rt--;this._adjustParentBBoxes(Pt,Dt,Rt)}_split(lt,Rt){const At=lt[Rt],Pt=At.children.length,Dt=this._minEntries;this._chooseSplitAxis(At,Dt,Pt);const Lt=this._chooseSplitIndex(At,Dt,Pt),Bt=createNode(At.children.splice(Lt,At.children.length-Lt));Bt.height=At.height,Bt.leaf=At.leaf,calcBBox(At,this.toBBox),calcBBox(Bt,this.toBBox),Rt?lt[Rt-1].children.push(Bt):this._splitRoot(At,Bt)}_splitRoot(lt,Rt){this.data=createNode([lt,Rt]),this.data.height=lt.height+1,this.data.leaf=!1,calcBBox(this.data,this.toBBox)}_chooseSplitIndex(lt,Rt,At){let Pt,Dt=1/0,Lt=1/0;for(let Bt=Rt;Bt<=At-Rt;Bt++){const Nt=distBBox(lt,0,Bt,this.toBBox),jt=distBBox(lt,Bt,At,this.toBBox),Ut=intersectionArea(Nt,jt),Gt=bboxArea(Nt)+bboxArea(jt);Ut=Rt;jt--){const Ut=lt.children[jt];extend(Bt,lt.leaf?Dt(Ut):Ut),Nt+=bboxMargin(Bt)}return Nt}_adjustParentBBoxes(lt,Rt,At){for(let Pt=At;Pt>=0;Pt--)extend(Rt[Pt],lt)}_condense(lt){for(let Rt=lt.length-1,At;Rt>=0;Rt--)lt[Rt].children.length===0?Rt>0?(At=lt[Rt-1].children,At.splice(At.indexOf(lt[Rt]),1)):this.clear():calcBBox(lt[Rt],this.toBBox)}}function findItem(_e,lt,Rt){if(!Rt)return lt.indexOf(_e);for(let At=0;At=_e.minX&<.maxY>=_e.minY}function createNode(_e){return{children:_e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function multiSelect(_e,lt,Rt,At,Pt){const Dt=[lt,Rt];for(;Dt.length;){if(Rt=Dt.pop(),lt=Dt.pop(),Rt-lt<=At)continue;const Lt=lt+Math.ceil((Rt-lt)/At/2)*At;quickselect(_e,Lt,lt,Rt,Pt),Dt.push(lt,Lt,Lt,Rt)}}class Bush extends RBush{toBBox(lt){return{minX:lt.left,minY:lt.top,maxX:lt.right,maxY:lt.bottom}}compareMinX(lt,Rt){return lt.left-Rt.left}compareMinY(lt,Rt){return lt.top-Rt.top}}const defaultD2RendererOptions={screenSize:{width:1,height:1},workerCount:4,workerIndex:0,tileResolution:{width:64,height:64},tileSubdivision:0,refreshInterval:1e3/60,animationDuration:150,debounceInterval:1e3/60,errorColor:"#f44336",backgroundColor:"#ffffff",accentColor:"#333333",dynamicResolution:{intervalMs:5e3,increment:.25,maxScale:1.5,minScale:1,dtMax:1.5,dtMin:1.1}};var dist$1={},__assign=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign=Object.assign||function(_e){for(var lt,Rt=1,At=arguments.length;Rt0?1:-1}),shim$4}var sign$1=isImplemented$6()?Math.sign:requireShim$4(),sign=sign$1,abs=Math.abs,floor$1=Math.floor,toInteger$1=function(_e){return isNaN(_e)?0:(_e=Number(_e),_e===0||!isFinite(_e)?_e:sign(_e)*floor$1(abs(_e)))},toInteger=toInteger$1,max$3=Math.max,toPosInteger=function(_e){return max$3(0,toInteger(_e))},validCallable=function(_e){if(typeof _e!="function")throw new TypeError(_e+" is not a function");return _e},isValue$4=isValue$6,validValue=function(_e){if(!isValue$4(_e))throw new TypeError("Cannot use null or undefined");return _e},custom={exports:{}},isImplemented$5=function(){var _e=Object.assign,lt;return typeof _e!="function"?!1:(lt={foo:"raz"},_e(lt,{bar:"dwa"},{trzy:"trzy"}),lt.foo+lt.bar+lt.trzy==="razdwatrzy")},isImplemented$4,hasRequiredIsImplemented$3;function requireIsImplemented$3(){return hasRequiredIsImplemented$3||(hasRequiredIsImplemented$3=1,isImplemented$4=function(){try{return Object.keys("primitive"),!0}catch{return!1}}),isImplemented$4}var shim$3,hasRequiredShim$3;function requireShim$3(){if(hasRequiredShim$3)return shim$3;hasRequiredShim$3=1;var _e=isValue$6,lt=Object.keys;return shim$3=function(Rt){return lt(_e(Rt)?Object(Rt):Rt)},shim$3}var keys,hasRequiredKeys;function requireKeys(){return hasRequiredKeys||(hasRequiredKeys=1,keys=requireIsImplemented$3()()?Object.keys:requireShim$3()),keys}var shim$2,hasRequiredShim$2;function requireShim$2(){if(hasRequiredShim$2)return shim$2;hasRequiredShim$2=1;var _e=requireKeys(),lt=validValue,Rt=Math.max;return shim$2=function(At,Pt){var Dt,Lt,Bt=Rt(arguments.length,2),Nt;for(At=Object(lt(At)),Nt=function(jt){try{At[jt]=Pt[jt]}catch(Ut){Dt||(Dt=Ut)}},Lt=1;Lt-1},shim$1}var contains$1=isImplemented$3()?String.prototype.contains:requireShim$1(),isValue$1=is$4,isPlainFunction=is,assign=assign$1,normalizeOpts=normalizeOptions,contains=contains$1,d$1=d$2.exports=function(_e,lt){var Rt,At,Pt,Dt,Lt;return arguments.length<2||typeof _e!="string"?(Dt=lt,lt=_e,_e=null):Dt=arguments[2],isValue$1(_e)?(Rt=contains.call(_e,"c"),At=contains.call(_e,"e"),Pt=contains.call(_e,"w")):(Rt=Pt=!0,At=!1),Lt={value:lt,configurable:Rt,enumerable:At,writable:Pt},Dt?assign(normalizeOpts(Dt),Lt):Lt};d$1.gs=function(_e,lt,Rt){var At,Pt,Dt,Lt;return typeof _e!="string"?(Dt=Rt,Rt=lt,lt=_e,_e=null):Dt=arguments[3],isValue$1(lt)?isPlainFunction(lt)?isValue$1(Rt)?isPlainFunction(Rt)||(Dt=Rt,Rt=void 0):Rt=void 0:(Dt=lt,lt=Rt=void 0):lt=void 0,isValue$1(_e)?(At=contains.call(_e,"c"),Pt=contains.call(_e,"e")):(At=!0,Pt=!1),Lt={get:lt,set:Rt,configurable:At,enumerable:Pt},Dt?assign(normalizeOpts(Dt),Lt):Lt};var dExports=d$2.exports,eventEmitter={exports:{}};(function(_e,lt){var Rt=dExports,At=validCallable,Pt=Function.prototype.apply,Dt=Function.prototype.call,Lt=Object.create,Bt=Object.defineProperty,Nt=Object.defineProperties,jt=Object.prototype.hasOwnProperty,Ut={configurable:!0,enumerable:!1,writable:!0},Gt,qt,Xt,Kt,Zt,Qt,Jt;Gt=function(en,tn){var an;return At(tn),jt.call(this,"__ee__")?an=this.__ee__:(an=Ut.value=Lt(null),Bt(this,"__ee__",Ut),Ut.value=null),an[en]?typeof an[en]=="object"?an[en].push(tn):an[en]=[an[en],tn]:an[en]=tn,this},qt=function(en,tn){var an,cn;return At(tn),cn=this,Gt.call(this,en,an=function(){Xt.call(cn,en,an),Pt.call(tn,this,arguments)}),an.__eeOnceListener__=tn,this},Xt=function(en,tn){var an,cn,un,rn;if(At(tn),!jt.call(this,"__ee__"))return this;if(an=this.__ee__,!an[en])return this;if(cn=an[en],typeof cn=="object")for(rn=0;un=cn[rn];++rn)(un===tn||un.__eeOnceListener__===tn)&&(cn.length===2?an[en]=cn[rn?0:1]:cn.splice(rn,1));else(cn===tn||cn.__eeOnceListener__===tn)&&delete an[en];return this},Kt=function(en){var tn,an,cn,un,rn;if(jt.call(this,"__ee__")&&(un=this.__ee__[en],!!un))if(typeof un=="object"){for(an=arguments.length,rn=new Array(an-1),tn=1;tn=55296&&an<=56319&&(sn+=qt[++Qt])),sn=Xt?jt.call(Xt,Kt,sn,Jt):sn,Zt?(Ut.value=sn,Gt(en,Jt,Ut)):en[Jt]=sn,++Jt;tn=Jt}}if(tn===void 0)for(tn=At(qt.length),Zt&&(en=new Zt(tn)),Qt=0;Qt=6&&(Rt-=6),G(Rt<1?255*((lt-_e)*Rt+_e):Rt<3?255*lt:Rt<4?255*((lt-_e)*(4-Rt)+_e):255*_e)},X=function(_e,lt,Rt){lt/=100;var At=(Rt/=100)<=.5?Rt*(lt+1):Rt+lt-Rt*lt,Pt=2*Rt-At;return{r:O(Pt,At,(_e/=60)+2),g:O(Pt,At,_e),b:O(Pt,At,_e-2)}},Y=function(_e,lt,Rt,At){return{r:G(255*(1-_e)*(At=1-At)),g:G(255*(1-lt)*At),b:G(255*(1-Rt)*At)}},j=function(_e,lt,Rt){_e/=255,lt/=255,Rt/=255;var At=1-Math.max(_e,lt,Rt),Pt=1-At,Dt=Pt&&(Pt-lt)/Pt,Lt=Pt&&(Pt-Rt)/Pt;return{c:G(100*(Pt&&(Pt-_e)/Pt)),m:G(100*Dt),y:G(100*Lt),k:G(100*At)}},K=function(_e,lt,Rt,At){At===void 0&&(At=1),_e/=255,lt/=255,Rt/=255,At=Math.min(At,1);var Pt=Math.max(_e,lt,Rt),Dt=Math.min(_e,lt,Rt),Lt=Pt-Dt,Bt=0,Nt=0,jt=(Pt+Dt)/2;if(Lt!==0){switch(Pt){case _e:Bt=(lt-Rt)/Lt%6;break;case lt:Bt=(Rt-_e)/Lt+2;break;case Rt:Bt=(_e-lt)/Lt+4}(Bt=G(60*Bt))<0&&(Bt+=360),Nt=Lt/(1-Math.abs(2*jt-1))}return{h:Bt,s:G(100*Nt),l:G(100*jt),a:At}},I=function(_e,lt){if(_e<0&&(_e+=360),_e>360&&(_e-=360),_e===360||_e===0)return _e;var Rt=[[0,120],[120,180],[180,240],[240,360]],At=[[0,60],[60,120],[120,240],[240,360]],Pt=lt?At:Rt,Dt=0,Lt=0,Bt=0,Nt=0;return(lt?Rt:At).find(function(jt,Ut){return _e>=jt[0]&&_e360||_e<0)&&(_e-=360*Math.floor(_e/360)),_e},N=function(_e){return typeof _e=="string"&&(_e=m$1.test(_e)?B(_e)/100:+_e),isNaN(+_e)||_e>1?1:G(_e)},V=function(_e,lt,Rt){return lt.reduce(function(At,Pt){return e(e([],At,!0),[t(t({},_e),{h:Rt===i.ADDITIVE?x(_e.h+Pt):x(I(I(_e.h,!1)+Pt,!0))})],!1)},[t({},_e)])},U=function(_e,lt){return V(_e,[30,-30],lt)},q=function(_e,lt){return V(_e,[180],lt)},$=function(_e,lt){return V(_e,[150,-150],lt)},_=function(_e,lt){return V(_e,[120,-120],lt)},Q=function(_e,lt){return V(_e,[60,-120,180],lt)},z$1=function(_e,lt){return V(_e,[90,-90,180],lt)},J=function(_e){return typeof _e=="string"?function(lt){var Rt;if(Object.keys(r).some(function(At){if(b[At].test(lt))return Rt=At,!0}),!Rt&&~f.indexOf(lt)&&(Rt=r.HEX),!Rt)throw new Error(E);return Rt}(_e):function(lt){var Rt,At=!1,Pt=L(Object.keys(lt));if(p[Pt]&&(Rt=p[Pt]),Rt&&Rt===r.RGB){var Dt=Object.entries(lt).some(function(Bt){return!y.test("".concat(Bt[1]))}),Lt=Object.entries(lt).some(function(Bt){return!(m$1.test("".concat(Bt[1]))||!y.test("".concat(Bt[1]))&&!isNaN(+Bt[1])&&+Bt[1]<=255)});Dt&&Lt&&(At=!0),Dt||(Rt=r.HEX)}if(!Rt||At)throw new Error(v);return Rt}(_e)},W=((c={})[r.HEX]=function(_e){var lt=(~f.indexOf(_e)?o[_e]:_e).match(b.HEX),Rt={r:M(lt[1]||lt[5]),g:M(lt[2]||lt[6]),b:M(lt[3]||lt[7])},At=lt[4]||lt[8];return At!==void 0&&(Rt.a=M(At)/255),Rt},c[r.RGB]=function(_e){var lt=_e.match(b.RGB),Rt=D(lt[1]||lt[5]),At=D(lt[2]||lt[6]),Pt=D(lt[3]||lt[7]),Dt=lt[4]||lt[8],Lt={r:Math.min(Rt,255),g:Math.min(At,255),b:Math.min(Pt,255)};return Dt!==void 0&&(Lt.a=N(Dt)),Lt},c[r.HSL]=function(_e){var lt=_e.match(b.HSL),Rt=x(lt[1]||lt[5]),At=C(lt[2]||lt[6]),Pt=C(lt[3]||lt[7]),Dt=lt[4]||lt[8],Lt=X(Rt,At,Pt);return Dt!==void 0&&(Lt.a=N(Dt)),Lt},c[r.CMYK]=function(_e){var lt=_e.match(b.CMYK),Rt=S(lt[1]||lt[6]),At=S(lt[2]||lt[7]),Pt=S(lt[3]||lt[8]),Dt=S(lt[4]||lt[9]),Lt=lt[5]||lt[10],Bt=Y(Rt,At,Pt,Dt);return Lt!==void 0&&(Bt.a=N(Lt)),Bt},c),Z=((s={})[r.HEX]=function(_e){var lt={r:D("".concat(_e.r)),g:D("".concat(_e.g)),b:D("".concat(_e.b))};return H(_e,"a")&&(lt.a=Math.min(D("".concat(_e.a),!0),1)),lt},s[r.RGB]=function(_e){return this.HEX(_e)},s[r.HSL]=function(_e){var lt=C("".concat(_e.s)),Rt=C("".concat(_e.l)),At=X(x(_e.h),lt,Rt);return H(_e,"a")&&(At.a=N(_e.a)),At},s[r.CMYK]=function(_e){var lt=S("".concat(_e.c)),Rt=S("".concat(_e.m)),At=S("".concat(_e.y)),Pt=S("".concat(_e.k)),Dt=Y(lt,Rt,At,Pt);return H(_e,"a")&&(Dt.a=N(_e.a)),Dt},s),tt=function(_e,lt){return lt===void 0&&(lt=J(_e)),typeof _e=="string"?W[lt](_e):Z[lt](_e)},et=((d={})[r.HEX]=function(_e){return{r:R(_e.r),g:R(_e.g),b:R(_e.b)}},d.HEXA=function(_e){var lt=et.HEX(_e);return lt.a=H(_e,"a")?R(255*_e.a):"0xFF",lt},d[r.RGB]=function(_e,lt){return H(_e,"a")&&delete _e.a,ot(_e,lt)},d.RGBA=function(_e,lt){return _e.a=H(_e,"a")?G(_e.a):1,ot(_e,lt)},d[r.HSL]=function(_e,lt){var Rt=K(_e.r,_e.g,_e.b);return delete Rt.a,at(Rt,lt)},d.HSLA=function(_e,lt){var Rt=et.HSL(_e,lt);return Rt.a=H(_e,"a")?G(_e.a,lt):1,Rt},d[r.CMYK]=function(_e,lt){return ut(j(_e.r,_e.g,_e.b),lt)},d.CMYKA=function(_e,lt){var Rt=et.CMYK(_e,lt);return Rt.a=H(_e,"a")?G(_e.a,lt):1,Rt},d),rt=function(_e,lt,Rt,At){var Pt=J(_e),Dt=typeof _e=="string",Lt=tt(_e,Pt),Bt=typeof _e=="string"&&H(Lt,"a")||typeof _e!="string"&&H(_e,"a"),Nt=K(Lt.r,Lt.g,Lt.b,Lt.a);Bt||delete Nt.a;var jt=Rt?Nt.l/(lt+1):(100-Nt.l)/(lt+1),Ut=Array(lt).fill(null).map(function(Gt,qt){return t(t({},Nt),{l:Nt.l+jt*(qt+1)*(1-2*+Rt)})});switch(Pt){case r.HEX:default:return Ut.map(function(Gt){var qt=X(Gt.h,Gt.s,Gt.l);return Bt&&(qt.a=Gt.a),Dt?Bt?w.HEX(ot(t(t({},qt),{a:G(255*qt.a)}),At)):w.HEX(ot(qt,At)):Bt?et.HEXA(qt):et.HEX(qt)});case r.RGB:return Ut.map(function(Gt){var qt=X(Gt.h,Gt.s,Gt.l);return Bt&&(qt.a=Gt.a),Dt?w.RGB(ot(qt,At)):Bt?et.RGBA(qt,At):et.RGB(qt,At)});case r.HSL:return Ut.map(function(Gt){return Dt?w.HSL(at(Gt,At)):Bt?et.HSLA(t(t({},X(Gt.h,Gt.s,Gt.l)),{a:Gt.a}),At):et.HSL(X(Gt.h,Gt.s,Gt.l),At)})}},nt=((h={buildHarmony:function(_e,lt,Rt,At){var Pt=J(_e),Dt=tt(_e,Pt),Lt=K(Dt.r,Dt.g,Dt.b,Dt.a),Bt=typeof _e=="string"&&H(Dt,"a")||typeof _e!="string"&&H(_e,"a"),Nt=typeof _e=="string";switch(Pt){case r.HEX:default:return Bt?this.HEXA(at(Lt,0),lt,Rt,Nt):this.HEX(at(Lt,0),lt,Rt,Nt);case r.HSL:return Bt?this.HSLA(Lt,lt,Rt,Nt,At):this.HSL(Lt,lt,Rt,Nt,At);case r.RGB:return Bt?this.RGBA(Lt,lt,Rt,Nt,At):this.RGB(Lt,lt,Rt,Nt,At)}}})[r.HEX]=function(_e,lt,Rt,At){return lt(_e,Rt).map(function(Pt){return At?w.HEX(X(Pt.h,Pt.s,Pt.l)):et.HEX(X(Pt.h,Pt.s,Pt.l))})},h.HEXA=function(_e,lt,Rt,At){return lt(_e,Rt).map(function(Pt){return At?w.HEX(t(t({},X(Pt.h,Pt.s,Pt.l)),{a:255*N(Pt.a)})):et.HEXA(t(t({},X(Pt.h,Pt.s,Pt.l)),{a:N(Pt.a)}))})},h[r.RGB]=function(_e,lt,Rt,At,Pt){return lt(_e,Rt).map(function(Dt){return At?w.RGB(ot(X(Dt.h,Dt.s,Dt.l),Pt)):et.RGB(X(Dt.h,Dt.s,Dt.l),Pt)})},h.RGBA=function(_e,lt,Rt,At,Pt){return lt(_e,Rt).map(function(Dt){return At?w.RGB(ot(t(t({},X(Dt.h,Dt.s,Dt.l)),{a:N(Dt.a)}),Pt)):et.RGBA(t(t({},X(Dt.h,Dt.s,Dt.l)),{a:N(Dt.a)}),Pt)})},h[r.HSL]=function(_e,lt,Rt,At,Pt){return lt(_e,Rt).map(function(Dt){return At?w.HSL(at({h:Dt.h,s:Dt.s,l:Dt.l},Pt)):et.HSL(X(Dt.h,Dt.s,Dt.l),Pt)})},h.HSLA=function(_e,lt,Rt,At,Pt){return lt(_e,Rt).map(function(Dt){return At?w.HSL(at(t(t({},Dt),{a:N(Dt.a)}),Pt)):et.HSLA(t(t({},X(Dt.h,Dt.s,Dt.l)),{a:N(Dt.a)}),Pt)})},h),it=((l={mix:function(_e,lt){var Rt,At,Pt,Dt,Lt,Bt,Nt,jt,Ut,Gt,qt,Xt,Kt,Zt,Qt,Jt=_e.map(function(cn){var un=J(cn);return tt(cn,un)}),en=lt===i.SUBTRACTIVE?Jt.map(function(cn){var un,rn,sn,pn,bn,gn,_n,xn,ln,Mn,Tn,An,Cn,wn,Fn=(un=cn.r,rn=cn.g,sn=cn.b,pn=Math.min(un,rn,sn),bn=Math.min(255-un,255-rn,255-sn),gn=un-pn,_n=rn-pn,xn=sn-pn,ln=Math.min(gn,_n),Mn=gn-ln,Tn=(_n+ln)/2,An=(xn+_n-ln)/2,Cn=Math.max(Mn,Tn,An)/Math.max(gn,_n,xn),wn=isNaN(Cn)||Cn===1/0||Cn<=0?1:Cn,{r:Mn/wn+bn,y:Tn/wn+bn,b:An/wn+bn});return H(cn,"a")&&(Fn.a=cn.a),Fn}):null;function tn(cn){var un=lt===i.ADDITIVE?{r:0,g:0,b:0,a:0}:{r:0,y:0,b:0,a:0};return cn.reduce(function(rn,sn){var pn=H(sn,"a")?sn.a:1,bn={r:Math.min(rn.r+sn.r*pn,255),b:Math.min(rn.b+sn.b*pn,255),a:1-(1-pn)*(1-rn.a)},gn="g"in rn?rn.g:rn.y,_n="g"in sn?sn.g:sn.y;return t(t({},bn),lt===i.ADDITIVE?{g:Math.min(gn+_n*pn,255)}:{y:Math.min(gn+_n*pn,255)})},un)}if(lt===i.ADDITIVE)Rt=tn(Jt);else{var an=tn(en);At=an.r,Pt=an.y,Dt=an.b,Lt=Math.min(At,Pt,Dt),Bt=Math.min(255-At,255-Pt,255-Dt),Nt=At-Lt,jt=Pt-Lt,Ut=Dt-Lt,Gt=Math.min(jt,Ut),qt=Nt+jt-Gt,Xt=jt+Gt,Kt=2*(Ut-Gt),Zt=Math.max(qt,Xt,Kt)/Math.max(Nt,jt,Ut),Qt=isNaN(Zt)||Zt===1/0||Zt<=0?1:Zt,(Rt={r:qt/Qt+Bt,g:Xt/Qt+Bt,b:Kt/Qt+Bt}).a=an.a}return{r:G(Rt.r),g:G(Rt.g),b:G(Rt.b),a:k(Rt.a,0,1)}}})[r.HEX]=function(_e,lt,Rt){var At=this.mix(_e,lt);return delete At.a,Rt?w.HEX(At):et.HEX(At)},l.HEXA=function(_e,lt,Rt){var At=this.mix(_e,lt);return At.a=Rt?255*N(At.a):N(At.a),Rt?w.HEX(At):et.HEXA(At)},l[r.RGB]=function(_e,lt,Rt,At){var Pt=this.mix(_e,lt);return delete Pt.a,Rt?w.RGB(Pt):et.RGB(Pt,At)},l.RGBA=function(_e,lt,Rt,At){var Pt=this.mix(_e,lt);return Rt?w.RGB(Pt):et.RGBA(Pt,At)},l[r.HSL]=function(_e,lt,Rt,At){var Pt=this.mix(_e,lt),Dt=K(Pt.r,Pt.g,Pt.b);return delete Pt.a,delete Dt.a,Rt?w.HSL(Dt):et.HSL(Pt,At)},l.HSLA=function(_e,lt,Rt,At){var Pt=this.mix(_e,lt),Dt=K(Pt.r,Pt.g,Pt.b,Pt.a);return Rt?w.HSL(Dt):et.HSLA(Pt,At)},l),ot=function(_e,lt){return t({r:G(_e.r,lt),g:G(_e.g,lt),b:G(_e.b,lt)},H(_e,"a")?{a:G(_e.a,lt)}:{})},at=function(_e,lt){return t({h:G(_e.h,lt),s:G(_e.s,lt),l:G(_e.l,lt)},H(_e,"a")?{a:G(_e.a,lt)}:{})},ut=function(_e,lt){return{c:G(_e.c,lt),m:G(_e.m,lt),y:G(_e.y,lt),k:G(_e.k,lt)}},ct=function(_e,lt,Rt,At,Pt,Dt){var Lt=Pt(tt(_e,lt),At);return Rt?Dt(Lt):Lt},st=function(_e,lt,Rt,At,Pt,Dt,Lt){Rt<1&&(Rt=5);var Bt=function(Nt,jt,Ut){var Gt=Ut-1,qt=(jt.r-Nt.r)/Gt,Xt=(jt.g-Nt.g)/Gt,Kt=(jt.b-Nt.b)/Gt,Zt=N(Nt.a),Qt=(N(jt.a)-Zt)/Gt;return Array(Ut).fill(null).map(function(Jt,en){return en===0?Nt:en===Gt?jt:{r:G(Nt.r+qt*en),g:G(Nt.g+Xt*en),b:G(Nt.b+Kt*en),a:G(Zt+Qt*en)}})}(tt(_e),tt(lt),Rt);return Bt.map(function(Nt){var jt=Dt(Nt,Pt);return At?Lt(jt):jt})},dt=function(){function _e(lt,Rt){Rt===void 0&&(Rt=6),this.rgb=tt(lt),this._decimals=Rt,this.updateHSL(),this.updateCMYK()}return _e.prototype.updateRGB=function(){this.rgb=t(t({},X(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},_e.prototype.updateRGBFromCMYK=function(){this.rgb=t(t({},Y(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},_e.prototype.updateHSL=function(){this.hsl=K(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},_e.prototype.updateCMYK=function(){this.cmyk=j(this.rgb.r,this.rgb.g,this.rgb.b)},_e.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},_e.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},_e.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},_e.prototype.setDecimals=function(lt){return this._decimals=lt,this},_e.prototype.setH=function(lt){return this.hsl.h=x(lt),this.updateRGBAndCMYK()},_e.prototype.setS=function(lt){return this.hsl.s=k(lt,0,100),this.updateRGBAndCMYK()},_e.prototype.setL=function(lt){return this.hsl.l=k(lt,0,100),this.updateRGBAndCMYK()},_e.prototype.setR=function(lt){return this.rgb.r=k(lt,0,255),this.updateHSLAndCMYK()},_e.prototype.setG=function(lt){return this.rgb.g=k(lt,0,255),this.updateHSLAndCMYK()},_e.prototype.setB=function(lt){return this.rgb.b=k(lt,0,255),this.updateHSLAndCMYK()},_e.prototype.setA=function(lt){return this.hsl.a=this.rgb.a=k(lt,0,1),this},_e.prototype.setC=function(lt){return this.cmyk.c=k(lt,0,100),this.updateRGBAndHSL()},_e.prototype.setM=function(lt){return this.cmyk.m=k(lt,0,100),this.updateRGBAndHSL()},_e.prototype.setY=function(lt){return this.cmyk.y=k(lt,0,100),this.updateRGBAndHSL()},_e.prototype.setK=function(lt){return this.cmyk.k=k(lt,0,100),this.updateRGBAndHSL()},Object.defineProperty(_e.prototype,"decimals",{get:function(){return this._decimals},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"H",{get:function(){return G(this.hsl.h,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"S",{get:function(){return G(this.hsl.s,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"L",{get:function(){return G(this.hsl.l,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"R",{get:function(){return G(this.rgb.r,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"G",{get:function(){return G(this.rgb.g,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"B",{get:function(){return G(this.rgb.b,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"A",{get:function(){return G(this.hsl.a,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"C",{get:function(){return G(this.cmyk.c,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"M",{get:function(){return G(this.cmyk.m,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"Y",{get:function(){return G(this.cmyk.y,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"K",{get:function(){return G(this.cmyk.k,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"HEXObject",{get:function(){return et.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"HEXAObject",{get:function(){return et.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"RGBAObject",{get:function(){return t(t({},this.RGBObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"HSLAObject",{get:function(){return t(t({},this.HSLObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"CMYKAObject",{get:function(){return t(t({},this.CMYKObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"HEX",{get:function(){return w.HEX({r:this.R,g:this.G,b:this.B})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"HEXA",{get:function(){return w.HEX({r:this.R,g:this.G,b:this.B,a:255*this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"RGB",{get:function(){return w.RGB({r:this.R,g:this.G,b:this.B})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"RGBA",{get:function(){return w.RGB({r:this.R,g:this.G,b:this.B,a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"HSL",{get:function(){return w.HSL({h:this.H,s:this.S,l:this.L})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"HSLA",{get:function(){return w.HSL({h:this.H,s:this.S,l:this.L,a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"CMYK",{get:function(){return w.CMYK({c:this.C,m:this.M,y:this.Y,k:this.K})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"CMYKA",{get:function(){return w.CMYK({c:this.C,m:this.M,y:this.Y,k:this.K,a:this.A})},enumerable:!1,configurable:!0}),_e.toHEX=function(lt,Rt){Rt===void 0&&(Rt=!0);var At=J(lt);return ct(lt,At,Rt,0,et.HEX,w.HEX)},_e.toHEXA=function(lt,Rt){Rt===void 0&&(Rt=!0);var At=J(lt);return ct(lt,At,Rt,0,et.HEXA,w.HEX)},_e.toRGB=function(lt,Rt,At){Rt===void 0&&(Rt=!0),At===void 0&&(At=6);var Pt=J(lt);return ct(lt,Pt,Rt,At,et.RGB,w.RGB)},_e.toRGBA=function(lt,Rt,At){Rt===void 0&&(Rt=!0),At===void 0&&(At=6);var Pt=J(lt);return ct(lt,Pt,Rt,At,et.RGBA,w.RGB)},_e.toHSL=function(lt,Rt,At){Rt===void 0&&(Rt=!0),At===void 0&&(At=6);var Pt=J(lt);return ct(lt,Pt,Rt,At,et.HSL,w.HSL)},_e.toHSLA=function(lt,Rt,At){Rt===void 0&&(Rt=!0),At===void 0&&(At=6);var Pt=J(lt);return ct(lt,Pt,Rt,At,et.HSLA,w.HSL)},_e.toCMYK=function(lt,Rt,At){Rt===void 0&&(Rt=!0),At===void 0&&(At=6);var Pt=J(lt);return ct(lt,Pt,Rt,At,et.CMYK,w.CMYK)},_e.toCMYKA=function(lt,Rt,At){Rt===void 0&&(Rt=!0),At===void 0&&(At=6);var Pt=J(lt);return ct(lt,Pt,Rt,At,et.CMYKA,w.CMYK)},_e.getBlendHEX=function(lt,Rt,At,Pt,Dt){return At===void 0&&(At=5),Pt===void 0&&(Pt=!0),Dt===void 0&&(Dt=6),st(lt,Rt,At,Pt,Dt,et.HEX,w.HEX)},_e.getBlendHEXA=function(lt,Rt,At,Pt,Dt){return At===void 0&&(At=5),Pt===void 0&&(Pt=!0),Dt===void 0&&(Dt=6),st(lt,Rt,At,Pt,Dt,et.HEXA,w.HEX)},_e.getBlendRGB=function(lt,Rt,At,Pt,Dt){return At===void 0&&(At=5),Pt===void 0&&(Pt=!0),Dt===void 0&&(Dt=6),st(lt,Rt,At,Pt,Dt,et.RGB,w.RGB)},_e.getBlendRGBA=function(lt,Rt,At,Pt,Dt){return At===void 0&&(At=5),Pt===void 0&&(Pt=!0),Dt===void 0&&(Dt=6),st(lt,Rt,At,Pt,Dt,et.RGBA,w.RGB)},_e.getBlendHSL=function(lt,Rt,At,Pt,Dt){return At===void 0&&(At=5),Pt===void 0&&(Pt=!0),Dt===void 0&&(Dt=6),st(lt,Rt,At,Pt,Dt,et.HSL,w.HSL)},_e.getBlendHSLA=function(lt,Rt,At,Pt,Dt){return At===void 0&&(At=5),Pt===void 0&&(Pt=!0),Dt===void 0&&(Dt=6),st(lt,Rt,At,Pt,Dt,et.HSLA,w.HSL)},_e.getMixHEX=function(lt,Rt,At){return Rt===void 0&&(Rt=i.ADDITIVE),At===void 0&&(At=!0),it.HEX(lt,Rt,At)},_e.getMixHEXA=function(lt,Rt,At){return Rt===void 0&&(Rt=i.ADDITIVE),At===void 0&&(At=!0),it.HEXA(lt,Rt,At)},_e.getMixRGB=function(lt,Rt,At,Pt){return Rt===void 0&&(Rt=i.ADDITIVE),At===void 0&&(At=!0),Pt===void 0&&(Pt=6),it.RGB(lt,Rt,At,Pt)},_e.getMixRGBA=function(lt,Rt,At,Pt){return Rt===void 0&&(Rt=i.ADDITIVE),At===void 0&&(At=!0),Pt===void 0&&(Pt=6),it.RGBA(lt,Rt,At,Pt)},_e.getMixHSL=function(lt,Rt,At,Pt){return Rt===void 0&&(Rt=i.ADDITIVE),At===void 0&&(At=!0),Pt===void 0&&(Pt=6),it.HSL(lt,Rt,At,Pt)},_e.getMixHSLA=function(lt,Rt,At,Pt){return Rt===void 0&&(Rt=i.ADDITIVE),At===void 0&&(At=!0),Pt===void 0&&(Pt=6),it.HSLA(lt,Rt,At,Pt)},_e.getShades=function(lt,Rt,At){return At===void 0&&(At=6),rt(lt,Rt,!0,At)},_e.getTints=function(lt,Rt,At){return At===void 0&&(At=6),rt(lt,Rt,!1,At)},_e.getHarmony=function(lt,Rt,At,Pt){return Rt===void 0&&(Rt=n.COMPLEMENTARY),At===void 0&&(At=i.ADDITIVE),Pt===void 0&&(Pt=6),function(Dt,Lt,Bt,Nt){var jt;return(jt={},jt[n.ANALOGOUS]=nt.buildHarmony(Lt,U,Nt,Bt),jt[n.COMPLEMENTARY]=nt.buildHarmony(Lt,q,Nt,Bt),jt[n.SPLIT_COMPLEMENTARY]=nt.buildHarmony(Lt,$,Nt,Bt),jt[n.TRIADIC]=nt.buildHarmony(Lt,_,Nt,Bt),jt[n.TETRADIC]=nt.buildHarmony(Lt,Q,Nt,Bt),jt[n.SQUARE]=nt.buildHarmony(Lt,z$1,Nt,Bt),jt)[Dt]}(Rt,lt,Pt,At)},_e}();const defaultContext={current:void 0,parent:void 0,events:void 0,color:{source:2533018,destination:15753874,expanding:16733986,updating:16733986,generating:16771899,closing:11583173,end:15483002},scale:10,fill:"#000000",alpha:1},{ceil:ceil$1,PI}=Math,getFillStyle=(_e,lt)=>new dt(_e).setA(lt??defaultContext.alpha).RGBA,getStrokeStyle=(_e,lt)=>getFillStyle(_e,lt);function transform(_e,lt){return{width:_e.width*lt.scale.x,height:_e.height*lt.scale.y,x:_e.x*lt.scale.x+lt.x,y:_e.y*lt.scale.y+lt.y}}const text={draw(_e,lt,Rt){if(_e.text){const At=transform(_e,{x:_e.textX,y:_e.textY,scale:{x:1,y:1}}),Pt=transform(At,Rt);lt.font=`${_e.fontSize*Rt.scale.x}px Arial`,lt.fillStyle=getFillStyle(_e.fontColor,_e.alpha),lt.fillText(_e.text,Pt.x,Pt.y)}},test(_e){return{left:-1/0,right:1/0,top:-1/0,bottom:1/0}}},rect={draw(_e,lt,Rt){const{x:At,y:Pt,width:Dt,height:Lt}=transform(_e,Rt);lt.fillStyle=getFillStyle(_e.fill,_e.alpha),lt.fillRect(ceil$1(At),ceil$1(Pt),ceil$1(Dt)||1,ceil$1(Lt)||1)},test(_e){return{left:_e.x,right:_e.x+_e.width,top:_e.y,bottom:_e.y+_e.height}}},circle={draw(_e,lt,Rt){lt.fillStyle=getFillStyle(_e.fill,_e.alpha),lt.beginPath();const At=transform({..._e,width:_e.radius,height:_e.radius},Rt);lt.ellipse(ceil$1(At.x),ceil$1(At.y),ceil$1(At.width),ceil$1(At.height),0,0,2*PI),lt.fill()},test(_e){return{left:_e.x-_e.radius,right:_e.x+_e.radius,top:_e.y-_e.radius,bottom:_e.y+_e.radius}}},polygon={draw(_e,lt,Rt){const[At,...Pt]=_e.points;lt.beginPath(),lt.fillStyle=getFillStyle(_e.fill,_e.alpha);const{x:Dt,y:Lt}=transform({...At,width:0,height:0},Rt);lt.moveTo(ceil$1(Dt),ceil$1(Lt));for(const Bt of Pt){const{x:Nt,y:jt}=transform({...Bt,width:0,height:0},Rt);lt.lineTo(ceil$1(Nt),ceil$1(jt))}lt.closePath(),lt.fill()},test(_e){var lt,Rt,At,Pt;return{left:((lt=lodashExports.minBy(_e.points,"x"))==null?void 0:lt.x)??0,right:((Rt=lodashExports.maxBy(_e.points,"x"))==null?void 0:Rt.x)??0,top:((At=lodashExports.minBy(_e.points,"y"))==null?void 0:At.y)??0,bottom:((Pt=lodashExports.maxBy(_e.points,"y"))==null?void 0:Pt.y)??0}}},path={draw(_e,lt,Rt){const[At,...Pt]=_e.points;lt.beginPath(),lt.lineCap="round",lt.lineJoin="round",lt.strokeStyle=getStrokeStyle(_e.fill,_e.alpha);const{x:Dt,y:Lt,width:Bt}=transform({...At,width:_e.lineWidth,height:0},Rt);lt.lineWidth=ceil$1(Bt),lt.moveTo(ceil$1(Dt),ceil$1(Lt));for(const Nt of Pt){const{x:jt,y:Ut}=transform({...Nt,width:0,height:0},Rt);lt.lineTo(ceil$1(jt),ceil$1(Ut))}lt.stroke()},test(_e){var lt,Rt,At,Pt;return{left:((lt=lodashExports.minBy(_e.points,"x"))==null?void 0:lt.x)??0-_e.lineWidth??0,right:((Rt=lodashExports.maxBy(_e.points,"x"))==null?void 0:Rt.x)??0+_e.lineWidth??0,top:((At=lodashExports.minBy(_e.points,"y"))==null?void 0:At.y)??0-_e.lineWidth??0,bottom:((Pt=lodashExports.maxBy(_e.points,"y"))==null?void 0:Pt.y)??0+_e.lineWidth??0}}},primitives={text,path,rect,polygon,circle};var rgb$1={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]},rgb=rgb$1;rgb.hsl=function(_e){var lt=_e[0]/255,Rt=_e[1]/255,At=_e[2]/255,Pt=Math.min(lt,Rt,At),Dt=Math.max(lt,Rt,At),Lt=Dt-Pt,Bt,Nt,jt;return Dt===Pt?Bt=0:lt===Dt?Bt=(Rt-At)/Lt:Rt===Dt?Bt=2+(At-lt)/Lt:At===Dt&&(Bt=4+(lt-Rt)/Lt),Bt=Math.min(Bt*60,360),Bt<0&&(Bt+=360),jt=(Pt+Dt)/2,Dt===Pt?Nt=0:jt<=.5?Nt=Lt/(Dt+Pt):Nt=Lt/(2-Dt-Pt),[Bt,Nt*100,jt*100]};const{log2,max:max$2}=Math,z=_e=>lodashExports.floor(log2(_e+1));function getTiles({right:_e,left:lt,bottom:Rt,top:At},Pt){const Dt=max$2(z(_e-lt),z(Rt-At))-Pt,Lt=2**Dt,Bt={left:lodashExports.floor(lt/Lt),right:lodashExports.ceil((_e+1)/Lt),top:lodashExports.floor(At/Lt),bottom:lodashExports.ceil((Rt+1)/Lt)};return{zoom:Dt,order:Lt,tiles:lodashExports.shuffle(_default({x:lodashExports.range(Bt.left,Bt.right+1),y:lodashExports.range(Bt.top,Bt.bottom+1)}).map(Nt=>{const jt=Nt.x*Lt,Ut=Nt.y*Lt;return{tile:Nt,bounds:{left:jt-Lt/2,right:jt+Lt/2,top:Ut-Lt/2,bottom:Ut+Lt/2}}}))}}const defaultBounds={top:0,left:0,right:1,bottom:1},isValue=_e=>lodashExports.isNumber(_e)&&!isNaN(_e),d2RendererWorkerUrl=""+new URL("D2Renderer.worker-67a71515.js",import.meta.url).href;class D2RendererWorkerAdapter extends Worker{constructor(){super(d2RendererWorkerUrl,{type:"module"})}call(lt,Rt,At=[]){return this.postMessage({action:lt,payload:Rt},At)}on(lt,Rt){const At=Pt=>{const{action:Dt,payload:Lt}=Pt.data;Dt===lt&&Rt(Lt)};return this.addEventListener("message",At),()=>this.removeEventListener("message",At)}}function intersect(_e,lt){return!(lt.left>=_e.right||lt.right<=_e.left||lt.top>=_e.bottom||lt.bottom<=_e.top)}const{max:max$1,min:min$1}=Math,_Tile=class BE extends Sprite{constructor(lt,Rt){super(lt),this.bounds=Rt,this.destroying=!1,this.age=BE.age++}};_Tile.age=0;let Tile=_Tile;function handleNaN(_e,lt){return lodashExports.isNaN(_e)?lt:_e}var Zl,Vs,$p,wp,Tl,Bu,Tp,Cp,G0,V0,NE,q0,FE,jm,z0,Y0,X0,jE,K0,zE,Z0,UE,Q0,HE,U0,PE,H0,ME,J0,WE,W0,OE,ev,GE,tv,VE,nv,qE;class D2Renderer extends EventEmitter{constructor(){super(...arguments);Ps(this,V0);Ps(this,q0);Ps(this,X0);Ps(this,K0);Ps(this,Z0);Ps(this,Q0);Ps(this,U0);Ps(this,H0);Ps(this,J0);Ps(this,W0);Ps(this,ev);Ps(this,tv);Ps(this,nv);Ps(this,Zl,void 0);Ps(this,Vs,void 0);Ps(this,$p,void 0);Ps(this,wp,void 0);Ps(this,Tl,defaultD2RendererOptions);Ps(this,Bu,[]);Ps(this,Tp,new Bush(16));Ps(this,Cp,void 0);Ps(this,G0,0);Ps(this,jm,lodashExports.once(()=>lodashExports.debounce(()=>Fl(this,U0,PE).call(this),_o(this,Tl).debounceInterval)));Ps(this,z0,lodashExports.once(()=>lodashExports.throttle(()=>Fl(this,H0,ME).call(this),_o(this,Tl).refreshInterval)));Ps(this,Y0,lodashExports.once(()=>lodashExports.throttle(Rt=>Fl(this,J0,WE).call(this,Rt),_o(this,Tl).refreshInterval)))}getInstance(){return{app:_o(this,Zl),viewport:_o(this,Vs)}}fitCamera(Rt=lodashExports.constant(!0)){var Pt,Dt,Lt,Bt;const At=lodashExports.values(_o(this,Tp).all()).flat().filter(Rt);if(At.length){const Nt=lodashExports.reduce(At,(jt,Ut)=>({top:handleNaN(min$1(jt.top,Ut.top),jt.top),left:handleNaN(min$1(jt.left,Ut.left),jt.left),bottom:handleNaN(max$1(jt.bottom,Ut.bottom),jt.bottom),right:handleNaN(max$1(jt.right,Ut.right),jt.right)}),{bottom:-1/0,top:1/0,left:1/0,right:-1/0});(Bt=(Pt=_o(this,Vs))==null?void 0:Pt.animate)==null||Bt.call(Pt,{position:new Point((Nt.left+Nt.right)/2,(Nt.top+Nt.bottom)/2),scale:((Lt=(Dt=_o(this,Vs))==null?void 0:Dt.findFit)==null?void 0:Lt.call(Dt,Nt.right-Nt.left,Nt.bottom-Nt.top))*.8,ease:"easeOutExpo",time:_o(this,Tl).animationDuration*1.5,callbackOnComplete:()=>_o(this,jm).call(this)()})}}initialCamera(){var Rt,At;(At=(Rt=_o(this,Vs))==null?void 0:Rt.animate)==null||At.call(Rt,{scale:1,ease:"easeOutExpo",time:_o(this,Tl).animationDuration*1.5,callbackOnComplete:()=>_o(this,jm).call(this)()})}getView(){var Rt;return(Rt=_o(this,Zl))==null?void 0:Rt.view}async toDataUrl(){var Rt,At,Pt,Dt,Lt;return(At=(Rt=_o(this,Zl))==null?void 0:Rt.render)==null||At.call(Rt),(Lt=(Dt=(Pt=_o(this,Zl))==null?void 0:Pt.view)==null?void 0:Dt.toDataURL)==null?void 0:Lt.call(Dt)}setup(Rt){const At={...defaultD2RendererOptions,...Rt};Fl(this,q0,FE).call(this,At),this.setOptions(At),Fl(this,K0,zE).call(this,At)}destroy(){lodashExports.map(_o(this,Bu),Rt=>Rt.terminate()),_o(this,Zl).destroy()}add(Rt){const At=nanoid();lodashExports.map(_o(this,Bu),Dt=>Dt.call("add",[Rt,At]));const Pt=lodashExports.map(Rt,({component:Dt,meta:Lt})=>({...defaultBounds,...lodashExports.pickBy(primitives[Dt.$].test(Dt),isValue),component:Dt,meta:Lt,index:Fl(this,V0,NE).call(this)}));return _o(this,Tp).load(Pt),()=>lodashExports.defer(()=>{for(const Dt of Pt)_o(this,Tp).remove(Dt);lodashExports.map(_o(this,Bu),Dt=>Dt.call("remove",[At]))})}setOptions(Rt){const At={..._o(this,Tl),...Rt};Fl(this,Z0,UE).call(this,At),_p(this,Tl,At),Fl(this,U0,PE).call(this),Fl(this,H0,ME).call(this)}}Zl=new WeakMap,Vs=new WeakMap,$p=new WeakMap,wp=new WeakMap,Tl=new WeakMap,Bu=new WeakMap,Tp=new WeakMap,Cp=new WeakMap,G0=new WeakMap,V0=new WeakSet,NE=function(){return DE(this,G0)._++},q0=new WeakSet,FE=function(Rt){_p(this,Zl,new Application({backgroundAlpha:0,width:Rt.screenSize.width,height:Rt.screenSize.height,autoDensity:!0,resolution:2})),_p(this,Vs,new ht({stopPropagation:!0,screenWidth:Rt.screenSize.width,screenHeight:Rt.screenSize.height,events:_o(this,Zl).renderer.events,passiveWheel:!1})),_o(this,Vs).on("clicked",At=>{const{x:Pt,y:Dt}=At.world,Lt=_o(this,Tp).search({minX:Pt,minY:Dt,maxX:Pt+Number.MIN_VALUE,maxY:Dt+Number.MIN_VALUE});this.emit("click",At.event,{world:At.world,components:Lt})}),_o(this,Zl).stage.addChild(_o(this,Vs)),_o(this,Vs).drag().pinch().wheel().decelerate({friction:.98}).clampZoom({maxScale:300,minScale:1e-5}),_o(this,Vs).on("moved",()=>{_o(this,jm).call(this)(),_o(this,z0).call(this)()}),_o(this,Vs).on("mousemove",At=>_o(this,Y0).call(this)(At)),_p(this,$p,new Container),_o(this,Vs).addChild(_o(this,$p)),_p(this,wp,new Graphics),_o(this,Vs).addChild(_o(this,wp)),_p(this,Cp,new Graphics),_o(this,Vs).addChild(_o(this,Cp)),Fl(this,X0,jE).call(this)},jm=new WeakMap,z0=new WeakMap,Y0=new WeakMap,X0=new WeakSet,jE=function(){const{dynamicResolution:Rt}=_o(this,Tl),{dtMax:At,dtMin:Pt,increment:Dt,intervalMs:Lt,maxScale:Bt,minScale:Nt}=Rt,jt=lodashExports.floor(Ticker.targetFPMS*Lt);let Ut=0,Gt=0,qt=1;_o(this,Zl).ticker.add(Xt=>{const{tileResolution:Kt}=_o(this,Tl);if(!(Ut%jt)){const Zt=Gt/jt;qt=lodashExports.clamp(Zt>=At?qt+Dt:Zt<=Pt?qt-Dt:qt,Nt,Bt),lodashExports.map(_o(this,Bu),Qt=>{Qt.call("setTileResolution",[{width:lodashExports.ceil(Kt.width/qt),height:lodashExports.ceil(Kt.height/qt)}])}),Gt=0}Gt+=Xt,Ut++})},K0=new WeakSet,zE=function(Rt){lodashExports.map(_o(this,Bu),At=>At.terminate()),_p(this,Bu,lodashExports.times(Rt.workerCount,At=>{const Pt=new D2RendererWorkerAdapter;return Pt.on("update",Dt=>Fl(this,Q0,HE).call(this,Dt)),Pt.onerror=Dt=>{throw Dt},Pt.call("setup",[{...Rt,workerIndex:At}]),Pt}))},Z0=new WeakSet,UE=function(Rt){var Dt,Lt,Bt,Nt;const{width:At,height:Pt}=Rt.screenSize;(Bt=(Lt=(Dt=_o(this,Zl))==null?void 0:Dt.renderer)==null?void 0:Lt.resize)==null||Bt.call(Lt,At,Pt),(Nt=_o(this,Vs))==null||Nt.resize(At,Pt),lodashExports.map(_o(this,Bu),jt=>{jt.call("setTileResolution",[{width:lodashExports.ceil(Rt.tileResolution.width),height:lodashExports.ceil(Rt.tileResolution.height)}])})},Q0=new WeakSet,HE=function({bounds:Rt,bitmap:At}){const Pt=Texture.from(At);Fl(this,ev,GE).call(this,Pt,Rt)},U0=new WeakSet,PE=function(){const{top:Rt,bottom:At,left:Pt,right:Dt}=_o(this,Vs);lodashExports.map(_o(this,Bu),Lt=>Lt.call("setFrustum",[{top:Rt,bottom:At,left:Pt,right:Dt}]))},H0=new WeakSet,ME=function(){var Lt,Bt,Nt,jt,Ut;const{tileSubdivision:Rt,accentColor:At}=_o(this,Tl),{tiles:Pt}=getTiles(_o(this,Vs),Rt),Dt=Fl(this,W0,OE).call(this);(Lt=_o(this,wp))==null||Lt.clear(),(Bt=_o(this,wp))==null||Bt.lineStyle(1*Dt,At,.5),(Nt=_o(this,wp))==null||Nt.beginFill(At,.05);for(const{bounds:Gt}of Pt)lodashExports.find((jt=_o(this,$p))==null?void 0:jt.children,qt=>lodashExports.isEqual(qt.bounds,Gt))||(Ut=_o(this,wp))==null||Ut.drawRect(Gt.left,Gt.top,Gt.right-Gt.left,Gt.bottom-Gt.top)},J0=new WeakSet,WE=function(Rt){var Nt;const{accentColor:At}=_o(this,Tl),Pt=Fl(this,W0,OE).call(this),{x:Dt,y:Lt}=_o(this,Vs).toWorld(Rt.globalX,Rt.globalY),Bt=_o(this,Tp).search({minX:Dt,minY:Lt,maxX:Dt+Number.MIN_VALUE,maxY:Lt+Number.MIN_VALUE});_o(this,Cp).clear(),_o(this,Cp).lineStyle(2*Pt,At,1);for(const jt of Bt)(Nt=_o(this,Cp))==null||Nt.drawRect(jt.left,jt.top,jt.right-jt.left,jt.bottom-jt.top)},W0=new WeakSet,OE=function(){const{right:Rt,left:At}=_o(this,Vs),{width:Pt}=_o(this,Tl).screenSize;return(Rt-At)/Pt},ev=new WeakSet,GE=async function(Rt,At){var Lt,Bt;const{tileSubdivision:Pt}=_o(this,Tl),{tiles:Dt}=getTiles(_o(this,Vs),Pt);if(lodashExports.find(Dt,Nt=>lodashExports.isEqual(Nt.bounds,At))){const Nt={x:(At.right-At.left)/Rt.width,y:(At.bottom-At.top)/Rt.height},jt=new Tile(Rt,At);(Lt=_o(this,$p))==null||Lt.addChild(jt).setTransform(At.left,At.top,Nt.x,Nt.y),_o(this,z0).call(this)(),await Fl(this,tv,VE).call(this,jt),lodashExports.forEach((Bt=_o(this,$p))==null?void 0:Bt.children,async Ut=>{intersect(Ut.bounds,At)&&Ut.age{const Dt=Lt=>{Rt.alpha+=Lt/Ticker.targetFPMS/_o(this,Tl).animationDuration,Rt.alpha>1&&(At.remove(Dt),Pt())};Rt.alpha=0,At.add(Dt)})},nv=new WeakSet,qE=function(Rt){const At=_o(this,Zl).ticker;return new Promise(Pt=>{const Dt=Lt=>{Rt.alpha-=Lt/Ticker.targetFPMS/_o(this,Tl).animationDuration,Rt.alpha<0&&(At.remove(Dt),Pt())};Rt.alpha=1,At.add(Dt)})};const D2Renderer$1=makeRenderer(D2Renderer,{components:["rect","circle","path","polygon"],id:"d2-renderer",name:"Pixi",description:"Provides 2D Visualisation Support",version:"1.0.0"}),renderers={"d2-renderer":D2Renderer$1};class NativeRendererTransport{constructor(lt){this.options=lt}async get(){const{hostname:lt}=url$2(this.options.url);return renderers[lt]}}const transports={native:{name:"Internal",constructor:NativeRendererTransport}};function RendererService(){const[{renderer:_e}]=useSettings(),[,lt]=useRenderers();return useAsync(async()=>{const Rt=[];for(const{transport:At,url:Pt,key:Dt,disabled:Lt}of _e??[])if(!Lt){const Bt=new transports[At].constructor({url:Pt});Rt.push({key:Dt,url:Pt,renderer:await Bt.get()})}lt(()=>Rt)},[_e,lt]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}const statusColor$1={connected:"success.light",connecting:"warning.light",error:"error.light",disabled:"text.disabled"};function RendererEditor({value:_e,onValueChange:lt}){const[Rt]=useRenderers(),At=usePaper(),Pt=lodashExports$1.find(Rt,{key:_e.key});function Dt(Bt){lt==null||lt(merge$3(_e,Bt))}const Lt=_e!=null&&_e.disabled?"disabled":Pt?"connected":"error";return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",py:1,children:[jsxRuntimeExports.jsxs(Box$1,{flex:1,sx:{width:0,overflow:"hidden","> *":{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},children:[jsxRuntimeExports.jsx(Type$1,{children:Pt?`${Pt.renderer.meta.name} ${Pt.renderer.meta.version}`:lodashExports$1.startCase(Lt)}),jsxRuntimeExports.jsx(Type$1,{variant:"body2",color:"text.secondary",children:Pt?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("span",{children:Pt.renderer.meta.description}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsxs("span",{children:["Contributes: ",lodashExports$1.join(Pt.renderer.meta.components,", ")]})]}):(_e==null?void 0:_e.url)||"No URL"})]}),jsxRuntimeExports.jsx(Chip$1,{sx:{mx:1,color:statusColor$1[Lt],...lodashExports$1.omit(At(1),"borderRadius")},size:"small",label:lodashExports$1.startCase(Lt)}),jsxRuntimeExports.jsx(Tooltip$1,{title:`${_e.disabled?"Enable":"Disable"} Renderer`,children:jsxRuntimeExports.jsx(Box$1,{children:jsxRuntimeExports.jsx(Switch$2,{checked:!_e.disabled,onChange:(Bt,Nt)=>Dt({disabled:!Nt})})})}),jsxRuntimeExports.jsx(ManagedModal,{trigger:Bt=>jsxRuntimeExports.jsx(IconButtonWithTooltip,{icon:jsxRuntimeExports.jsx(EditIcon,{}),label:"Edit Renderer",sx:{mr:-3},onClick:Bt}),appBar:{children:jsxRuntimeExports.jsx(AppBarTitle,{children:"Edit Renderer"})},children:jsxRuntimeExports.jsxs(Box$1,{p:2.5,children:[jsxRuntimeExports.jsx(TextField$1,{defaultValue:_e.url,onChange:Bt=>Dt({url:Bt.target.value}),fullWidth:!0,variant:"filled",label:"URL",sx:{mb:2}}),jsxRuntimeExports.jsx(SelectField,{placeholder:"Renderer Type",items:lodashExports$1.entries(transports).map(([Bt,{name:Nt}])=>({value:Bt,label:Nt})),fullWidth:!0,value:_e.transport,onChange:Bt=>Dt({transport:Bt})})]})})]})})}function RendererListEditor(){const[{renderer:_e},lt]=useSettings();return jsxRuntimeExports.jsx(Box$1,{sx:{mx:-2},children:jsxRuntimeExports.jsx(ListEditor,{sortable:!0,button:!1,editor:Rt=>jsxRuntimeExports.jsx(RendererEditor,{value:Rt}),icon:null,value:_e,onChange:lodashExports$1.debounce(Rt=>lt(()=>({renderer:Rt})),300),addItemLabel:"Add Renderer",create:()=>({transport:defaultTransport,url:"",disabled:!0}),addItemExtras:jsxRuntimeExports.jsx(FeaturePickerButton,{icon:jsxRuntimeExports.jsx(ResetIcon,{}),onClick:()=>lt(()=>({renderer:defaultRenderers})),children:"Reset to Defaults"})})})}function useConnectionStatus(_e){const[{connections:lt}]=useLoading(),Rt=useConnectionResolver(),[{remote:At}]=useSettings(),Pt=lodashExports$1.find(At,{url:_e});return Pt&&!(Pt!=null&&Pt.disabled)?Rt({url:_e})?"connected":lt?"connecting":_e?"error":"not-connected":"not-connected"}const statusColor={connected:"success.light",connecting:"warning.light",error:"error.light","not-connected":"text.disabled"};function ServerEditor({value:_e,onValueChange:lt}){const Rt=useConnection(_e.url),At=usePaper(),Pt=useConnectionStatus(_e.url),Dt=reactExports.useMemo(()=>debounce$2(Lt=>{lt==null||lt(merge$3(_e,Lt))},300),[lt,_e]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",py:.5,children:[jsxRuntimeExports.jsxs(Box$1,{flex:1,sx:{width:0,overflow:"hidden","> *":{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},children:[jsxRuntimeExports.jsx(Type$1,{children:Rt?`${Rt.name} ${Rt.version}`:lodashExports$1.startCase(Pt)}),jsxRuntimeExports.jsx(Type$1,{variant:"body2",color:"text.secondary",children:(Rt==null?void 0:Rt.description)??((_e==null?void 0:_e.url)||"No URL")})]}),jsxRuntimeExports.jsx(Chip$1,{sx:{mx:1,color:statusColor[Pt],...lodashExports$1.omit(At(1),"borderRadius")},size:"small",label:lodashExports$1.startCase(Pt)}),jsxRuntimeExports.jsx(Tooltip$1,{title:`${_e.disabled?"Enable":"Disable"} Connection`,children:jsxRuntimeExports.jsx(Box$1,{children:jsxRuntimeExports.jsx(Switch$2,{defaultChecked:!_e.disabled,onChange:(Lt,Bt)=>Dt({disabled:!Bt})})})}),jsxRuntimeExports.jsx(ManagedModal,{trigger:Lt=>jsxRuntimeExports.jsx(IconButtonWithTooltip,{icon:jsxRuntimeExports.jsx(EditIcon,{}),label:"Edit Connection",sx:{mr:-3},onClick:Lt}),appBar:{children:jsxRuntimeExports.jsx(AppBarTitle,{children:"Edit Connection"})},children:jsxRuntimeExports.jsxs(Box$1,{p:2.5,children:[jsxRuntimeExports.jsx(TextField$1,{defaultValue:_e.url,onChange:Lt=>Dt({url:Lt.target.value}),fullWidth:!0,variant:"filled",label:"URL",sx:{mb:2}}),jsxRuntimeExports.jsx(SelectField,{placeholder:"Connection Type",items:lodashExports$1.entries(transports$1).map(([Lt,{name:Bt}])=>({value:Lt,label:Bt})),fullWidth:!0,value:_e.transport,onChange:Lt=>Dt({transport:Lt})})]})})]})})}function ServerListEditor(){const[{remote:_e},lt]=useSettings();return jsxRuntimeExports.jsx(Box$1,{sx:{mx:-2},children:jsxRuntimeExports.jsx(ListEditor,{sortable:!0,button:!1,editor:Rt=>jsxRuntimeExports.jsx(ServerEditor,{value:Rt}),icon:null,value:_e,onChange:lodashExports$1.debounce(Rt=>lt(()=>({remote:Rt})),300),addItemLabel:"Add Solver",create:()=>({transport:defaultTransport,url:"",disabled:!0}),addItemExtras:jsxRuntimeExports.jsx(FeaturePickerButton,{icon:jsxRuntimeExports.jsx(ResetIcon,{}),onClick:()=>lt(()=>({remote:defaultRemotes})),children:"Reset to Defaults"})})})}const contacts=[{name:"Dr Daniel Harabor",email:"daniel.harabor@monash.edu"},{name:"Dr Michael Wybrow",email:"michael.wybrow@monash.edu"},{name:"Kevin Zheng",email:"kevin.zheng@monash.edu"},{name:"Francis Anthony",email:"fant0003@student.monash.edu"},{name:"Karan Batta",email:"krnbatta@gmail.com"},{name:"Jay Wingate",email:"jaypeterwingate@gmail.com"},{name:"Leo Whitehead",email:"leo@whiteheadsoftware.dev"},{name:"Can Wang",email:"camwang@outlook.com"},{name:"Rory Tobin-Underwood",email:"rorytu@gmail.com"}];function AboutContent(){function _e(lt,Rt){return jsxRuntimeExports.jsxs(Box$1,{sx:{pt:2},children:[jsxRuntimeExports.jsx(Type$1,{variant:"overline",color:"text.secondary",children:lt}),jsxRuntimeExports.jsx(Type$1,{variant:"body2",children:Rt})]})}return jsxRuntimeExports.jsxs(Box$1,{children:[jsxRuntimeExports.jsx(Box$1,{sx:{pt:0,pb:2},children:jsxRuntimeExports.jsx("img",{src:logo,height:"64"})}),jsxRuntimeExports.jsx(Type$1,{variant:"h6",children:name}),_e("Build Info",jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:version_name})),_e("Team",jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(List$2,{sx:{mx:-2},children:contacts.map(({name:lt,email:Rt},At)=>jsxRuntimeExports.jsxs(ListItemButton$1,{href:`mailto:${Rt}`,children:[jsxRuntimeExports.jsx(ListItemAvatar$1,{children:jsxRuntimeExports.jsx(Avatar$1,{children:lodashExports$1.head(lt)})}),jsxRuntimeExports.jsx(ListItemText$1,{primary:lt,secondary:Rt})]},At))})})),_e("Resources",jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(List$2,{sx:{mx:-2},children:jsxRuntimeExports.jsxs(ListItemButton$1,{target:"_blank",href:"https://github.com/path-visualiser",children:[jsxRuntimeExports.jsx(ListItemIcon$1,{children:jsxRuntimeExports.jsx(GitHub,{})}),jsxRuntimeExports.jsx(ListItemText$1,{primary:"Repository",secondary:"https://github.com/path-visualiser"})]})})}))]})}const formatLabel=_e=>`${_e}x`;function SettingsPage({template:_e}){const{controls:lt,onChange:Rt,state:At,dragHandle:Pt}=useViewTreeContext(),[{"playback/playbackRate":Dt=1,"appearance/acrylic":Lt,"appearance/theme":Bt="light","appearance/accentColor":Nt="teal","behaviour/showOnStart":jt},Ut]=useSettings(),[Gt,qt]=reactExports.useState("general");function Xt(Zt){return jsxRuntimeExports.jsx(Type$1,{variant:"overline",color:"text.secondary",children:Zt})}function Kt(Zt){return jsxRuntimeExports.jsx(Type$1,{variant:"body1",sx:{mr:4,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:Zt})}return jsxRuntimeExports.jsx(TabContext,{value:Gt,children:jsxRuntimeExports.jsxs(_e,{onChange:Rt,stack:At,children:[jsxRuntimeExports.jsx(_e.Title,{children:"Settings"}),jsxRuntimeExports.jsx(_e.Handle,{children:Pt}),jsxRuntimeExports.jsx(_e.Options,{children:jsxRuntimeExports.jsxs(TabList$1,{onChange:(Zt,Qt)=>qt(Qt),children:[jsxRuntimeExports.jsx(Tab$1,{label:"General",value:"general"}),jsxRuntimeExports.jsx(Tab$1,{label:"Connections",value:"connections"}),jsxRuntimeExports.jsx(Tab$1,{label:"Renderers",value:"renderers"}),jsxRuntimeExports.jsx(Tab$1,{label:"Map Parsers",value:"map-parsers"}),jsxRuntimeExports.jsx(Tab$1,{label:"About",value:"about"})]})}),jsxRuntimeExports.jsx(_e.Content,{children:jsxRuntimeExports.jsx(Flex,{vertical:!0,children:jsxRuntimeExports.jsx(Scroll,{y:!0,children:jsxRuntimeExports.jsxs(Flex,{vertical:!0,pt:6,children:[jsxRuntimeExports.jsx(TabPanel$1,{value:"general",children:jsxRuntimeExports.jsxs(Box$1,{children:[Xt("Playback"),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[Kt("Playback Rate"),jsxRuntimeExports.jsx(Slider$1,{sx:{maxWidth:320,mr:2},marks:[1,2,5,10].map(Zt=>({value:Zt*defaultPlaybackRate,label:formatLabel(Zt)})),step:1*defaultPlaybackRate,min:1*defaultPlaybackRate,max:10*defaultPlaybackRate,valueLabelFormat:Zt=>formatLabel(Zt/defaultPlaybackRate),valueLabelDisplay:"auto",defaultValue:Dt,onChangeCommitted:(Zt,Qt)=>Ut(()=>({"playback/playbackRate":Qt}))})]}),Xt("Appearance"),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[Kt("Acrylic"),jsxRuntimeExports.jsx(Switch$2,{defaultChecked:!!Lt,onChange:(Zt,Qt)=>Ut(()=>({"appearance/acrylic":Qt}))})]}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[Kt("Dark Mode"),jsxRuntimeExports.jsx(Space,{flex:1}),jsxRuntimeExports.jsx(Switch$2,{defaultChecked:Bt==="dark",onChange:(Zt,Qt)=>Ut(()=>({"appearance/theme":Qt?"dark":"light"}))})]}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[Kt("Accent"),jsxRuntimeExports.jsx(FeaturePicker,{value:Nt,items:lodashExports$1.map(lodashExports$1.keys(accentColors),Zt=>({id:Zt,name:lodashExports$1.startCase(Zt)})),arrow:!0,onChange:Zt=>Ut(()=>({"appearance/accentColor":Zt}))})]}),Xt("Behaviour"),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[Kt("Show Explore Panel on Start-up"),jsxRuntimeExports.jsx(Switch$2,{defaultChecked:!!jt,onChange:(Zt,Qt)=>Ut(()=>({"behaviour/showOnStart":Qt?"explore":void 0}))})]})]})}),jsxRuntimeExports.jsx(TabPanel$1,{value:"connections",children:jsxRuntimeExports.jsxs(Box$1,{children:[Xt("Solvers"),jsxRuntimeExports.jsx(ServerListEditor,{})]})}),jsxRuntimeExports.jsx(TabPanel$1,{value:"renderers",children:jsxRuntimeExports.jsxs(Box$1,{children:[Xt("Renderers"),jsxRuntimeExports.jsx(RendererListEditor,{})]})}),jsxRuntimeExports.jsx(TabPanel$1,{value:"map-parsers",children:jsxRuntimeExports.jsxs(Box$1,{children:[Xt("Map Parsers"),jsxRuntimeExports.jsx(MapParserListEditor,{})]})}),jsxRuntimeExports.jsx(TabPanel$1,{value:"about",children:jsxRuntimeExports.jsx(Box$1,{children:jsxRuntimeExports.jsx(AboutContent,{})})})]})})})}),jsxRuntimeExports.jsx(_e.Extras,{children:lt})]})})}function MapParserListEditor(){return jsxRuntimeExports.jsx(List$2,{children:lodashExports$1.keys(mapParsers).map(_e=>jsxRuntimeExports.jsx(ListItem$1,{children:jsxRuntimeExports.jsx(ListItemText$1,{primary:_e,secondary:"Internal"})},_e))})}const PUBLISH=0,SUBSCRIBE=1,RESET=2,VALUE=4;function compose(_e,lt){return Rt=>_e(lt(Rt))}function thrush(_e,lt){return lt(_e)}function curry2to1(_e,lt){return Rt=>_e(lt,Rt)}function curry1to0(_e,lt){return()=>_e(lt)}function tap(_e,lt){return lt(_e),_e}function tup(..._e){return _e}function call(_e){_e()}function always(_e){return()=>_e}function joinProc(..._e){return()=>{_e.map(call)}}function isDefined(_e){return _e!==void 0}function noop(){}function subscribe(_e,lt){return _e(SUBSCRIBE,lt)}function publish(_e,lt){_e(PUBLISH,lt)}function reset(_e){_e(RESET)}function getValue(_e){return _e(VALUE)}function connect(_e,lt){return subscribe(_e,curry2to1(lt,PUBLISH))}function handleNext(_e,lt){const Rt=_e(SUBSCRIBE,At=>{Rt(),lt(At)});return Rt}function stream(){const _e=[];return(lt,Rt)=>{switch(lt){case RESET:_e.splice(0,_e.length);return;case SUBSCRIBE:return _e.push(Rt),()=>{const At=_e.indexOf(Rt);At>-1&&_e.splice(At,1)};case PUBLISH:_e.slice().forEach(At=>{At(Rt)});return;default:throw new Error(`unrecognized action ${lt}`)}}}function statefulStream(_e){let lt=_e;const Rt=stream();return(At,Pt)=>{switch(At){case SUBSCRIBE:Pt(lt);break;case PUBLISH:lt=Pt;break;case VALUE:return lt}return Rt(At,Pt)}}function eventHandler(_e){let lt,Rt;const At=()=>lt&<();return function(Pt,Dt){switch(Pt){case SUBSCRIBE:return Dt?Rt===Dt?void 0:(At(),Rt=Dt,lt=subscribe(_e,Dt),lt):(At(),noop);case RESET:At(),Rt=null;return;default:throw new Error(`unrecognized action ${Pt}`)}}}function streamFromEmitter(_e){return tap(stream(),lt=>connect(_e,lt))}function statefulStreamFromEmitter(_e,lt){return tap(statefulStream(lt),Rt=>connect(_e,Rt))}function combineOperators(..._e){return lt=>_e.reduceRight(thrush,lt)}function pipe(_e,...lt){const Rt=combineOperators(...lt);return(At,Pt)=>{switch(At){case SUBSCRIBE:return subscribe(_e,Rt(Pt));case RESET:reset(_e);return}}}function defaultComparator(_e,lt){return _e===lt}function distinctUntilChanged(_e=defaultComparator){let lt;return Rt=>At=>{_e(lt,At)||(lt=At,Rt(At))}}function filter(_e){return lt=>Rt=>{_e(Rt)&<(Rt)}}function map(_e){return lt=>compose(lt,_e)}function mapTo(_e){return lt=>()=>lt(_e)}function scan(_e,lt){return Rt=>At=>Rt(lt=_e(lt,At))}function skip(_e){return lt=>Rt=>{_e>0?_e--:lt(Rt)}}function throttleTime(_e){let lt=null,Rt;return At=>Pt=>{lt=Pt,!Rt&&(Rt=setTimeout(()=>{Rt=void 0,At(lt)},_e))}}function debounceTime(_e){let lt,Rt;return At=>Pt=>{lt=Pt,Rt&&clearTimeout(Rt),Rt=setTimeout(()=>{At(lt)},_e)}}function withLatestFrom(..._e){const lt=new Array(_e.length);let Rt=0,At=null;const Pt=Math.pow(2,_e.length)-1;return _e.forEach((Dt,Lt)=>{const Bt=Math.pow(2,Lt);subscribe(Dt,Nt=>{const jt=Rt;Rt=Rt|Bt,lt[Lt]=Nt,jt!==Pt&&Rt===Pt&&At&&(At(),At=null)})}),Dt=>Lt=>{const Bt=()=>Dt([Lt].concat(lt));Rt===Pt?Bt():At=Bt}}function merge(..._e){return function(lt,Rt){switch(lt){case SUBSCRIBE:return joinProc(..._e.map(At=>subscribe(At,Rt)));case RESET:return;default:throw new Error(`unrecognized action ${lt}`)}}}function duc(_e,lt=defaultComparator){return pipe(_e,distinctUntilChanged(lt))}function combineLatest(..._e){const lt=stream(),Rt=new Array(_e.length);let At=0;const Pt=Math.pow(2,_e.length)-1;return _e.forEach((Dt,Lt)=>{const Bt=Math.pow(2,Lt);subscribe(Dt,Nt=>{Rt[Lt]=Nt,At=At|Bt,At===Pt&&publish(lt,Rt)})}),function(Dt,Lt){switch(Dt){case SUBSCRIBE:return At===Pt&&Lt(Rt),subscribe(lt,Lt);case RESET:return reset(lt);default:throw new Error(`unrecognized action ${Dt}`)}}}function system(_e,lt=[],{singleton:Rt}={singleton:!0}){return{id:id(),constructor:_e,dependencies:lt,singleton:Rt}}const id=()=>Symbol();function init(_e){const lt=new Map,Rt=({id:At,constructor:Pt,dependencies:Dt,singleton:Lt})=>{if(Lt&<.has(At))return lt.get(At);const Bt=Pt(Dt.map(Nt=>Rt(Nt)));return Lt&<.set(At,Bt),Bt};return Rt(_e)}function omit(_e,lt){const Rt={},At={};let Pt=0;const Dt=_e.length;for(;Pt(en[tn]=an=>{const cn=Jt[lt.methods[tn]];publish(cn,an)},en),{})}function Ut(Jt){return Lt.reduce((en,tn)=>(en[tn]=eventHandler(Jt[lt.events[tn]]),en),{})}const Gt=React.forwardRef((Jt,en)=>{const{children:tn,...an}=Jt,[cn]=React.useState(()=>tap(init(_e),rn=>Nt(rn,an))),[un]=React.useState(curry1to0(Ut,cn));return useIsomorphicLayoutEffect$2(()=>{for(const rn of Lt)rn in an&&subscribe(un[rn],an[rn]);return()=>{Object.values(un).map(reset)}},[an,un,cn]),useIsomorphicLayoutEffect$2(()=>{Nt(cn,an)}),React.useImperativeHandle(en,always(jt(cn))),React.createElement(Bt.Provider,{value:cn},Rt?React.createElement(Rt,omit([...At,...Pt,...Lt],an),tn):tn)}),qt=Jt=>React.useCallback(curry2to1(publish,React.useContext(Bt)[Jt]),[Jt]),Xt=Jt=>{const tn=React.useContext(Bt)[Jt],an=React.useCallback(cn=>subscribe(tn,cn),[tn]);return React.useSyncExternalStore(an,()=>getValue(tn),()=>getValue(tn))},Kt=Jt=>{const tn=React.useContext(Bt)[Jt],[an,cn]=React.useState(curry1to0(getValue,tn));return useIsomorphicLayoutEffect$2(()=>subscribe(tn,un=>{un!==an&&cn(always(un))}),[tn,an]),an},Zt=React.version.startsWith("18")?Xt:Kt;return{Component:Gt,usePublisher:qt,useEmitterValue:Zt,useEmitter:(Jt,en)=>{const an=React.useContext(Bt)[Jt];useIsomorphicLayoutEffect$2(()=>subscribe(an,en),[en,an])}}}const useIsomorphicLayoutEffect=typeof document<"u"?React.useLayoutEffect:React.useEffect,useIsomorphicLayoutEffect$1=useIsomorphicLayoutEffect;var LogLevel=(_e=>(_e[_e.DEBUG=0]="DEBUG",_e[_e.INFO=1]="INFO",_e[_e.WARN=2]="WARN",_e[_e.ERROR=3]="ERROR",_e))(LogLevel||{});const CONSOLE_METHOD_MAP={0:"debug",1:"log",2:"warn",3:"error"},getGlobalThis=()=>typeof globalThis>"u"?window:globalThis,loggerSystem=system(()=>{const _e=statefulStream(3);return{log:statefulStream((Rt,At,Pt=1)=>{var Dt;const Lt=(Dt=getGlobalThis().VIRTUOSO_LOG_LEVEL)!=null?Dt:getValue(_e);Pt>=Lt&&console[CONSOLE_METHOD_MAP[Pt]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",Rt,At)}),logLevel:_e}},[],{singleton:!0});function useSizeWithElRef(_e,lt=!0){const Rt=React.useRef(null);let At=Pt=>{};if(typeof ResizeObserver<"u"){const Pt=React.useMemo(()=>new ResizeObserver(Dt=>{const Lt=Dt[0].target;Lt.offsetParent!==null&&_e(Lt)}),[_e]);At=Dt=>{Dt&<?(Pt.observe(Dt),Rt.current=Dt):(Rt.current&&Pt.unobserve(Rt.current),Rt.current=null)}}return{ref:Rt,callbackRef:At}}function useSize(_e,lt=!0){return useSizeWithElRef(_e,lt).callbackRef}function useChangedListContentsSizes(_e,lt,Rt,At,Pt,Dt,Lt){const Bt=React.useCallback(Nt=>{const jt=getChangedChildSizes(Nt.children,lt,"offsetHeight",Pt);let Ut=Nt.parentElement;for(;!Ut.dataset.virtuosoScroller;)Ut=Ut.parentElement;const Gt=Ut.lastElementChild.dataset.viewportType==="window",qt=Lt?Lt.scrollTop:Gt?window.pageYOffset||document.documentElement.scrollTop:Ut.scrollTop,Xt=Lt?Lt.scrollHeight:Gt?document.documentElement.scrollHeight:Ut.scrollHeight,Kt=Lt?Lt.offsetHeight:Gt?window.innerHeight:Ut.offsetHeight;At({scrollTop:Math.max(qt,0),scrollHeight:Xt,viewportHeight:Kt}),Dt==null||Dt(resolveGapValue$1("row-gap",getComputedStyle(Nt).rowGap,Pt)),jt!==null&&_e(jt)},[_e,lt,Pt,Dt,Lt,At]);return useSizeWithElRef(Bt,Rt)}function getChangedChildSizes(_e,lt,Rt,At){const Pt=_e.length;if(Pt===0)return null;const Dt=[];for(let Lt=0;Lt{const qt=Gt.target,Xt=qt===window||qt===document,Kt=Xt?window.pageYOffset||document.documentElement.scrollTop:qt.scrollTop,Zt=Xt?document.documentElement.scrollHeight:qt.scrollHeight,Qt=Xt?window.innerHeight:qt.offsetHeight,Jt=()=>{_e({scrollTop:Math.max(Kt,0),scrollHeight:Zt,viewportHeight:Qt})};Gt.suppressFlushSync?Jt():ReactDOM.flushSync(Jt),Lt.current!==null&&(Kt===Lt.current||Kt<=0||Kt===Zt-Qt)&&(Lt.current=null,lt(!0),Bt.current&&(clearTimeout(Bt.current),Bt.current=null))},[_e,lt]);React.useEffect(()=>{const Gt=Pt||Dt.current;return At(Pt||Dt.current),Nt({target:Gt,suppressFlushSync:!0}),Gt.addEventListener("scroll",Nt,{passive:!0}),()=>{At(null),Gt.removeEventListener("scroll",Nt)}},[Dt,Nt,Rt,At,Pt]);function jt(Gt){const qt=Dt.current;if(!qt||"offsetHeight"in qt&&qt.offsetHeight===0)return;const Xt=Gt.behavior==="smooth";let Kt,Zt,Qt;qt===window?(Zt=Math.max(correctItemSize(document.documentElement,"height"),document.documentElement.scrollHeight),Kt=window.innerHeight,Qt=document.documentElement.scrollTop):(Zt=qt.scrollHeight,Kt=correctItemSize(qt,"height"),Qt=qt.scrollTop);const Jt=Zt-Kt;if(Gt.top=Math.ceil(Math.max(Math.min(Jt,Gt.top),0)),approximatelyEqual(Kt,Zt)||Gt.top===Qt){_e({scrollTop:Qt,scrollHeight:Zt,viewportHeight:Kt}),Xt&<(!0);return}Xt?(Lt.current=Gt.top,Bt.current&&clearTimeout(Bt.current),Bt.current=setTimeout(()=>{Bt.current=null,Lt.current=null,lt(!0)},1e3)):Lt.current=null,qt.scrollTo(Gt)}function Ut(Gt){Dt.current.scrollBy(Gt)}return{scrollerRef:Dt,scrollByCallback:Ut,scrollToCallback:jt}}const domIOSystem=system(()=>{const _e=stream(),lt=stream(),Rt=statefulStream(0),At=stream(),Pt=statefulStream(0),Dt=stream(),Lt=stream(),Bt=statefulStream(0),Nt=statefulStream(0),jt=statefulStream(0),Ut=statefulStream(0),Gt=stream(),qt=stream(),Xt=statefulStream(!1);return connect(pipe(_e,map(({scrollTop:Kt})=>Kt)),lt),connect(pipe(_e,map(({scrollHeight:Kt})=>Kt)),Lt),connect(lt,Pt),{scrollContainerState:_e,scrollTop:lt,viewportHeight:Dt,headerHeight:Bt,fixedHeaderHeight:Nt,fixedFooterHeight:jt,footerHeight:Ut,scrollHeight:Lt,smoothScrollTargetReached:At,scrollTo:Gt,scrollBy:qt,statefulScrollTop:Pt,deviation:Rt,scrollingInProgress:Xt}},[],{singleton:!0}),NIL_NODE={lvl:0};function newAANode(_e,lt,Rt,At=NIL_NODE,Pt=NIL_NODE){return{k:_e,v:lt,lvl:Rt,l:At,r:Pt}}function empty(_e){return _e===NIL_NODE}function newTree(){return NIL_NODE}function remove(_e,lt){if(empty(_e))return NIL_NODE;const{k:Rt,l:At,r:Pt}=_e;if(lt===Rt){if(empty(At))return Pt;if(empty(Pt))return At;{const[Dt,Lt]=last(At);return adjust(clone(_e,{k:Dt,v:Lt,l:deleteLast(At)}))}}else return ltlt&&(Bt=Bt.concat(walkWithin(Dt,lt,Rt))),At>=lt&&At<=Rt&&Bt.push({k:At,v:Pt}),At<=Rt&&(Bt=Bt.concat(walkWithin(Lt,lt,Rt))),Bt}function walk(_e){return empty(_e)?[]:[...walk(_e.l),{k:_e.k,v:_e.v},...walk(_e.r)]}function last(_e){return empty(_e.r)?[_e.k,_e.v]:last(_e.r)}function deleteLast(_e){return empty(_e.r)?_e.l:adjust(clone(_e,{r:deleteLast(_e.r)}))}function clone(_e,lt){return newAANode(lt.k!==void 0?lt.k:_e.k,lt.v!==void 0?lt.v:_e.v,lt.lvl!==void 0?lt.lvl:_e.lvl,lt.l!==void 0?lt.l:_e.l,lt.r!==void 0?lt.r:_e.r)}function isSingle(_e){return empty(_e)||_e.lvl>_e.r.lvl}function rebalance(_e){return split(skew(_e))}function adjust(_e){const{l:lt,r:Rt,lvl:At}=_e;if(Rt.lvl>=At-1&<.lvl>=At-1)return _e;if(At>Rt.lvl+1){if(isSingle(lt))return skew(clone(_e,{lvl:At-1}));if(!empty(lt)&&!empty(lt.r))return clone(lt.r,{l:clone(lt,{r:lt.r.l}),r:clone(_e,{l:lt.r.r,lvl:At-1}),lvl:At});throw new Error("Unexpected empty nodes")}else{if(isSingle(_e))return split(clone(_e,{lvl:At-1}));if(!empty(Rt)&&!empty(Rt.l)){const Pt=Rt.l,Dt=isSingle(Pt)?Rt.lvl-1:Rt.lvl;return clone(Pt,{l:clone(_e,{r:Pt.l,lvl:At-1}),r:split(clone(Rt,{l:Pt.r,lvl:Dt})),lvl:Pt.lvl+1})}else throw new Error("Unexpected empty nodes")}}function rangesWithin(_e,lt,Rt){if(empty(_e))return[];const At=findMaxKeyValue(_e,lt)[0];return toRanges(walkWithin(_e,At,Rt))}function arrayToRanges(_e,lt){const Rt=_e.length;if(Rt===0)return[];let{index:At,value:Pt}=lt(_e[0]);const Dt=[];for(let Lt=1;Lt({index:lt,value:Rt}))}function split(_e){const{r:lt,lvl:Rt}=_e;return!empty(lt)&&!empty(lt.r)&<.lvl===Rt&<.r.lvl===Rt?clone(lt,{l:clone(_e,{r:lt.l}),lvl:Rt+1}):_e}function skew(_e){const{l:lt}=_e;return!empty(lt)&<.lvl===_e.lvl?clone(lt,{r:clone(_e,{l:lt.r})}):_e}function findIndexOfClosestSmallerOrEqual(_e,lt,Rt,At=0){let Pt=_e.length-1;for(;At<=Pt;){const Dt=Math.floor((At+Pt)/2),Lt=_e[Dt],Bt=Rt(Lt,lt);if(Bt===0)return Dt;if(Bt===-1){if(Pt-At<2)return Dt-1;Pt=Dt-1}else{if(Pt===At)return Dt;At=Dt+1}}throw new Error(`Failed binary finding record in array - ${_e.join(",")}, searched for ${lt}`)}function findClosestSmallerOrEqual(_e,lt,Rt){return _e[findIndexOfClosestSmallerOrEqual(_e,lt,Rt)]}function findRange(_e,lt,Rt,At){const Pt=findIndexOfClosestSmallerOrEqual(_e,lt,At),Dt=findIndexOfClosestSmallerOrEqual(_e,Rt,At,Pt);return _e.slice(Pt,Dt+1)}const recalcSystem=system(()=>({recalcInProgress:statefulStream(!1)}),[],{singleton:!0});function rangeIncludes(_e){const{size:lt,startIndex:Rt,endIndex:At}=_e;return Pt=>Pt.start===Rt&&(Pt.end===At||Pt.end===1/0)&&Pt.value===lt}function affectedGroupCount(_e,lt){let Rt=0,At=0;for(;Rt<_e;)Rt+=lt[At+1]-lt[At]-1,At++;return At-(Rt===_e?0:1)}function insertRanges(_e,lt){let Rt=empty(_e)?0:1/0;for(const At of lt){const{size:Pt,startIndex:Dt,endIndex:Lt}=At;if(Rt=Math.min(Rt,Dt),empty(_e)){_e=insert(_e,0,Pt);continue}const Bt=rangesWithin(_e,Dt-1,Lt+1);if(Bt.some(rangeIncludes(At)))continue;let Nt=!1,jt=!1;for(const{start:Ut,end:Gt,value:qt}of Bt)Nt?(Lt>=Ut||Pt===qt)&&(_e=remove(_e,Ut)):(jt=qt!==Pt,Nt=!0),Gt>Lt&&Lt>=Ut&&qt!==Pt&&(_e=insert(_e,Lt+1,qt));jt&&(_e=insert(_e,Dt,Pt))}return[_e,Rt]}function initialSizeState(){return{offsetTree:[],sizeTree:newTree(),groupOffsetTree:newTree(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function indexComparator({index:_e},lt){return lt===_e?0:lt<_e?-1:1}function offsetComparator({offset:_e},lt){return lt===_e?0:lt<_e?-1:1}function offsetPointParser(_e){return{index:_e.index,value:_e}}function rangesWithinOffsets(_e,lt,Rt,At=0){return At>0&&(lt=Math.max(lt,findClosestSmallerOrEqual(_e,At,indexComparator).offset)),arrayToRanges(findRange(_e,lt,Rt,offsetComparator),offsetPointParser)}function createOffsetTree(_e,lt,Rt,At){let Pt=_e,Dt=0,Lt=0,Bt=0,Nt=0;if(lt!==0){Nt=findIndexOfClosestSmallerOrEqual(Pt,lt-1,indexComparator),Bt=Pt[Nt].offset;const Ut=findMaxKeyValue(Rt,lt-1);Dt=Ut[0],Lt=Ut[1],Pt.length&&Pt[Nt].size===findMaxKeyValue(Rt,lt)[1]&&(Nt-=1),Pt=Pt.slice(0,Nt+1)}else Pt=[];for(const{start:jt,value:Ut}of rangesWithin(Rt,lt,1/0)){const Gt=jt-Dt,qt=Gt*Lt+Bt+Gt*At;Pt.push({offset:qt,size:Ut,index:jt}),Dt=jt,Bt=qt,Lt=Ut}return{offsetTree:Pt,lastIndex:Dt,lastOffset:Bt,lastSize:Lt}}function sizeStateReducer(_e,[lt,Rt,At,Pt]){lt.length>0&&At("received item sizes",lt,LogLevel.DEBUG);const Dt=_e.sizeTree;let Lt=Dt,Bt=0;if(Rt.length>0&&empty(Dt)&<.length===2){const qt=lt[0].size,Xt=lt[1].size;Lt=Rt.reduce((Kt,Zt)=>insert(insert(Kt,Zt,qt),Zt+1,Xt),Lt)}else[Lt,Bt]=insertRanges(Lt,lt);if(Lt===Dt)return _e;const{offsetTree:Nt,lastIndex:jt,lastSize:Ut,lastOffset:Gt}=createOffsetTree(_e.offsetTree,Bt,Lt,Pt);return{sizeTree:Lt,offsetTree:Nt,lastIndex:jt,lastOffset:Gt,lastSize:Ut,groupOffsetTree:Rt.reduce((qt,Xt)=>insert(qt,Xt,offsetOf(Xt,Nt,Pt)),newTree()),groupIndices:Rt}}function offsetOf(_e,lt,Rt){if(lt.length===0)return 0;const{offset:At,index:Pt,size:Dt}=findClosestSmallerOrEqual(lt,_e,indexComparator),Lt=_e-Pt,Bt=Dt*Lt+(Lt-1)*Rt+At;return Bt>0?Bt+Rt:Bt}function isGroupLocation(_e){return typeof _e.groupIndex<"u"}function originalIndexFromLocation(_e,lt,Rt){if(isGroupLocation(_e))return lt.groupIndices[_e.groupIndex]+1;{const At=_e.index==="LAST"?Rt:_e.index;let Pt=originalIndexFromItemIndex(At,lt);return Pt=Math.max(0,Pt,Math.min(Rt,Pt)),Pt}}function originalIndexFromItemIndex(_e,lt){if(!hasGroups(lt))return _e;let Rt=0;for(;lt.groupIndices[Rt]<=_e+Rt;)Rt++;return _e+Rt}function hasGroups(_e){return!empty(_e.groupOffsetTree)}function sizeTreeToRanges(_e){return walk(_e).map(({k:lt,v:Rt},At,Pt)=>{const Dt=Pt[At+1],Lt=Dt?Dt.k-1:1/0;return{startIndex:lt,endIndex:Lt,size:Rt}})}const SIZE_MAP={offsetHeight:"height",offsetWidth:"width"},sizeSystem=system(([{log:_e},{recalcInProgress:lt}])=>{const Rt=stream(),At=stream(),Pt=statefulStreamFromEmitter(At,0),Dt=stream(),Lt=stream(),Bt=statefulStream(0),Nt=statefulStream([]),jt=statefulStream(void 0),Ut=statefulStream(void 0),Gt=statefulStream((cn,un)=>correctItemSize(cn,SIZE_MAP[un])),qt=statefulStream(void 0),Xt=statefulStream(0),Kt=initialSizeState(),Zt=statefulStreamFromEmitter(pipe(Rt,withLatestFrom(Nt,_e,Xt),scan(sizeStateReducer,Kt),distinctUntilChanged()),Kt),Qt=statefulStreamFromEmitter(pipe(Nt,distinctUntilChanged(),scan((cn,un)=>({prev:cn.current,current:un}),{prev:[],current:[]}),map(({prev:cn})=>cn)),[]);connect(pipe(Nt,filter(cn=>cn.length>0),withLatestFrom(Zt,Xt),map(([cn,un,rn])=>{const sn=cn.reduce((pn,bn,gn)=>insert(pn,bn,offsetOf(bn,un.offsetTree,rn)||gn),newTree());return{...un,groupIndices:cn,groupOffsetTree:sn}})),Zt),connect(pipe(At,withLatestFrom(Zt),filter(([cn,{lastIndex:un}])=>cn[{startIndex:cn,endIndex:un,size:rn}])),Rt),connect(jt,Ut);const Jt=statefulStreamFromEmitter(pipe(jt,map(cn=>cn===void 0)),!0);connect(pipe(Ut,filter(cn=>cn!==void 0&&empty(getValue(Zt).sizeTree)),map(cn=>[{startIndex:0,endIndex:0,size:cn}])),Rt);const en=streamFromEmitter(pipe(Rt,withLatestFrom(Zt),scan(({sizes:cn},[un,rn])=>({changed:rn!==cn,sizes:rn}),{changed:!1,sizes:Kt}),map(cn=>cn.changed)));subscribe(pipe(Bt,scan((cn,un)=>({diff:cn.prev-un,prev:un}),{diff:0,prev:0}),map(cn=>cn.diff)),cn=>{const{groupIndices:un}=getValue(Zt);if(cn>0)publish(lt,!0),publish(Dt,cn+affectedGroupCount(cn,un));else if(cn<0){const rn=getValue(Qt);rn.length>0&&(cn-=affectedGroupCount(-cn,rn)),publish(Lt,cn)}}),subscribe(pipe(Bt,withLatestFrom(_e)),([cn,un])=>{cn<0&&un("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:Bt},LogLevel.ERROR)});const tn=streamFromEmitter(Dt);connect(pipe(Dt,withLatestFrom(Zt),map(([cn,un])=>{const rn=un.groupIndices.length>0,sn=[],pn=un.lastSize;if(rn){const bn=find(un.sizeTree,0);let gn=0,_n=0;for(;gn{let Cn=Mn.ranges;return Mn.prevSize!==0&&(Cn=[...Mn.ranges,{startIndex:Mn.prevIndex,endIndex:Tn+cn-1,size:Mn.prevSize}]),{ranges:Cn,prevIndex:Tn+cn,prevSize:An}},{ranges:sn,prevIndex:cn,prevSize:0}).ranges}return walk(un.sizeTree).reduce((bn,{k:gn,v:_n})=>({ranges:[...bn.ranges,{startIndex:bn.prevIndex,endIndex:gn+cn-1,size:bn.prevSize}],prevIndex:gn+cn,prevSize:_n}),{ranges:[],prevIndex:0,prevSize:pn}).ranges})),Rt);const an=streamFromEmitter(pipe(Lt,withLatestFrom(Zt,Xt),map(([cn,{offsetTree:un},rn])=>{const sn=-cn;return offsetOf(sn,un,rn)})));return connect(pipe(Lt,withLatestFrom(Zt,Xt),map(([cn,un,rn])=>{if(un.groupIndices.length>0){if(empty(un.sizeTree))return un;let pn=newTree();const bn=getValue(Qt);let gn=0,_n=0,xn=0;for(;gn<-cn;){xn=bn[_n];const Mn=bn[_n+1]-xn-1;_n++,gn+=Mn+1}if(pn=walk(un.sizeTree).reduce((Mn,{k:Tn,v:An})=>insert(Mn,Math.max(0,Tn+cn),An),pn),gn!==-cn){const Mn=find(un.sizeTree,xn);pn=insert(pn,0,Mn);const Tn=findMaxKeyValue(un.sizeTree,-cn+1)[1];pn=insert(pn,1,Tn)}return{...un,sizeTree:pn,...createOffsetTree(un.offsetTree,0,pn,rn)}}else{const pn=walk(un.sizeTree).reduce((bn,{k:gn,v:_n})=>insert(bn,Math.max(0,gn+cn),_n),newTree());return{...un,sizeTree:pn,...createOffsetTree(un.offsetTree,0,pn,rn)}}})),Zt),{data:qt,totalCount:At,sizeRanges:Rt,groupIndices:Nt,defaultItemSize:Ut,fixedItemSize:jt,unshiftWith:Dt,shiftWith:Lt,shiftWithOffset:an,beforeUnshiftWith:tn,firstItemIndex:Bt,gap:Xt,sizes:Zt,listRefresh:en,statefulTotalCount:Pt,trackItemSizes:Jt,itemSize:Gt}},tup(loggerSystem,recalcSystem),{singleton:!0}),SUPPORTS_SCROLL_TO_OPTIONS=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function normalizeIndexLocation(_e){const lt=typeof _e=="number"?{index:_e}:_e;return lt.align||(lt.align="start"),(!lt.behavior||!SUPPORTS_SCROLL_TO_OPTIONS)&&(lt.behavior="auto"),lt.offset||(lt.offset=0),lt}const scrollToIndexSystem=system(([{sizes:_e,totalCount:lt,listRefresh:Rt,gap:At},{scrollingInProgress:Pt,viewportHeight:Dt,scrollTo:Lt,smoothScrollTargetReached:Bt,headerHeight:Nt,footerHeight:jt,fixedHeaderHeight:Ut,fixedFooterHeight:Gt},{log:qt}])=>{const Xt=stream(),Kt=statefulStream(0);let Zt=null,Qt=null,Jt=null;function en(){Zt&&(Zt(),Zt=null),Jt&&(Jt(),Jt=null),Qt&&(clearTimeout(Qt),Qt=null),publish(Pt,!1)}return connect(pipe(Xt,withLatestFrom(_e,Dt,lt,Kt,Nt,jt,qt),withLatestFrom(At,Ut,Gt),map(([[tn,an,cn,un,rn,sn,pn,bn],gn,_n,xn])=>{const ln=normalizeIndexLocation(tn),{align:Mn,behavior:Tn,offset:An}=ln,Cn=un-1,wn=originalIndexFromLocation(ln,an,Cn);let Fn=offsetOf(wn,an.offsetTree,gn)+sn;Mn==="end"?(Fn+=_n+findMaxKeyValue(an.sizeTree,wn)[1]-cn+xn,wn===Cn&&(Fn+=pn)):Mn==="center"?Fn+=(_n+findMaxKeyValue(an.sizeTree,wn)[1]-cn+xn)/2:Fn-=rn,An&&(Fn+=An);const $n=Pn=>{en(),Pn?(bn("retrying to scroll to",{location:tn},LogLevel.DEBUG),publish(Xt,tn)):bn("list did not change, scroll successful",{},LogLevel.DEBUG)};if(en(),Tn==="smooth"){let Pn=!1;Jt=subscribe(Rt,Vn=>{Pn=Pn||Vn}),Zt=handleNext(Bt,()=>{$n(Pn)})}else Zt=handleNext(pipe(Rt,watchChangesFor(150)),$n);return Qt=setTimeout(()=>{en()},1200),publish(Pt,!0),bn("scrolling from index to",{index:wn,top:Fn,behavior:Tn},LogLevel.DEBUG),{top:Fn,behavior:Tn}})),Lt),{scrollToIndex:Xt,topListHeight:Kt}},tup(sizeSystem,domIOSystem,loggerSystem),{singleton:!0});function watchChangesFor(_e){return lt=>{const Rt=setTimeout(()=>{lt(!1)},_e);return At=>{At&&(lt(!0),clearTimeout(Rt))}}}const UP="up",DOWN="down",NONE$1="none",INITIAL_BOTTOM_STATE={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},DEFAULT_AT_TOP_THRESHOLD=0,stateFlagsSystem=system(([{scrollContainerState:_e,scrollTop:lt,viewportHeight:Rt,headerHeight:At,footerHeight:Pt,scrollBy:Dt}])=>{const Lt=statefulStream(!1),Bt=statefulStream(!0),Nt=stream(),jt=stream(),Ut=statefulStream(4),Gt=statefulStream(DEFAULT_AT_TOP_THRESHOLD),qt=statefulStreamFromEmitter(pipe(merge(pipe(duc(lt),skip(1),mapTo(!0)),pipe(duc(lt),skip(1),mapTo(!1),debounceTime(100))),distinctUntilChanged()),!1),Xt=statefulStreamFromEmitter(pipe(merge(pipe(Dt,mapTo(!0)),pipe(Dt,mapTo(!1),debounceTime(200))),distinctUntilChanged()),!1);connect(pipe(combineLatest(duc(lt),duc(Gt)),map(([en,tn])=>en<=tn),distinctUntilChanged()),Bt),connect(pipe(Bt,throttleTime(50)),jt);const Kt=streamFromEmitter(pipe(combineLatest(_e,duc(Rt),duc(At),duc(Pt),duc(Ut)),scan((en,[{scrollTop:tn,scrollHeight:an},cn,un,rn,sn])=>{const pn=tn+cn-an>-sn,bn={viewportHeight:cn,scrollTop:tn,scrollHeight:an};if(pn){let _n,xn;return tn>en.state.scrollTop?(_n="SCROLLED_DOWN",xn=en.state.scrollTop-tn):(_n="SIZE_DECREASED",xn=en.state.scrollTop-tn||en.scrollTopDelta),{atBottom:!0,state:bn,atBottomBecause:_n,scrollTopDelta:xn}}let gn;return bn.scrollHeight>en.state.scrollHeight?gn="SIZE_INCREASED":cnen&&en.atBottom===tn.atBottom))),Zt=statefulStreamFromEmitter(pipe(_e,scan((en,{scrollTop:tn,scrollHeight:an,viewportHeight:cn})=>{if(approximatelyEqual(en.scrollHeight,an))return{scrollTop:tn,scrollHeight:an,jump:0,changed:!1};{const un=an-(tn+cn)<1;return en.scrollTop!==tn&&un?{scrollHeight:an,scrollTop:tn,jump:en.scrollTop-tn,changed:!0}:{scrollHeight:an,scrollTop:tn,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),filter(en=>en.changed),map(en=>en.jump)),0);connect(pipe(Kt,map(en=>en.atBottom)),Lt),connect(pipe(Lt,throttleTime(50)),Nt);const Qt=statefulStream(DOWN);connect(pipe(_e,map(({scrollTop:en})=>en),distinctUntilChanged(),scan((en,tn)=>getValue(Xt)?{direction:en.direction,prevScrollTop:tn}:{direction:tnen.direction)),Qt),connect(pipe(_e,throttleTime(50),mapTo(NONE$1)),Qt);const Jt=statefulStream(0);return connect(pipe(qt,filter(en=>!en),mapTo(0)),Jt),connect(pipe(lt,throttleTime(100),withLatestFrom(qt),filter(([en,tn])=>!!tn),scan(([en,tn],[an])=>[tn,an],[0,0]),map(([en,tn])=>tn-en)),Jt),{isScrolling:qt,isAtTop:Bt,isAtBottom:Lt,atBottomState:Kt,atTopStateChange:jt,atBottomStateChange:Nt,scrollDirection:Qt,atBottomThreshold:Ut,atTopThreshold:Gt,scrollVelocity:Jt,lastJumpDueToItemResize:Zt}},tup(domIOSystem)),propsReadySystem=system(([{log:_e}])=>{const lt=statefulStream(!1),Rt=streamFromEmitter(pipe(lt,filter(At=>At),distinctUntilChanged()));return subscribe(lt,At=>{At&&getValue(_e)("props updated",{},LogLevel.DEBUG)}),{propsReady:lt,didMount:Rt}},tup(loggerSystem),{singleton:!0});function skipFrames(_e,lt){_e==0?lt():requestAnimationFrame(()=>skipFrames(_e-1,lt))}function getInitialTopMostItemIndexNumber(_e,lt){const Rt=lt-1;return typeof _e=="number"?_e:_e.index==="LAST"?Rt:_e.index}const initialTopMostItemIndexSystem=system(([{sizes:_e,listRefresh:lt,defaultItemSize:Rt},{scrollTop:At},{scrollToIndex:Pt},{didMount:Dt}])=>{const Lt=statefulStream(!0),Bt=statefulStream(0),Nt=statefulStream(!1);return connect(pipe(Dt,withLatestFrom(Bt),filter(([jt,Ut])=>!!Ut),mapTo(!1)),Lt),subscribe(pipe(combineLatest(lt,Dt),withLatestFrom(Lt,_e,Rt,Nt),filter(([[,jt],Ut,{sizeTree:Gt},qt,Xt])=>jt&&(!empty(Gt)||isDefined(qt))&&!Ut&&!Xt),withLatestFrom(Bt)),([,jt])=>{publish(Nt,!0),skipFrames(3,()=>{handleNext(At,()=>publish(Lt,!0)),publish(Pt,jt)})}),{scrolledToInitialItem:Lt,initialTopMostItemIndex:Bt}},tup(sizeSystem,domIOSystem,scrollToIndexSystem,propsReadySystem),{singleton:!0});function normalizeFollowOutput(_e){return _e?_e==="smooth"?"smooth":"auto":!1}const behaviorFromFollowOutput=(_e,lt)=>typeof _e=="function"?normalizeFollowOutput(_e(lt)):lt&&normalizeFollowOutput(_e),followOutputSystem=system(([{totalCount:_e,listRefresh:lt},{isAtBottom:Rt,atBottomState:At},{scrollToIndex:Pt},{scrolledToInitialItem:Dt},{propsReady:Lt,didMount:Bt},{log:Nt},{scrollingInProgress:jt}])=>{const Ut=statefulStream(!1),Gt=stream();let qt=null;function Xt(Zt){publish(Pt,{index:"LAST",align:"end",behavior:Zt})}subscribe(pipe(combineLatest(pipe(duc(_e),skip(1)),Bt),withLatestFrom(duc(Ut),Rt,Dt,jt),map(([[Zt,Qt],Jt,en,tn,an])=>{let cn=Qt&&tn,un="auto";return cn&&(un=behaviorFromFollowOutput(Jt,en||an),cn=cn&&!!un),{totalCount:Zt,shouldFollow:cn,followOutputBehavior:un}}),filter(({shouldFollow:Zt})=>Zt)),({totalCount:Zt,followOutputBehavior:Qt})=>{qt&&(qt(),qt=null),qt=handleNext(lt,()=>{getValue(Nt)("following output to ",{totalCount:Zt},LogLevel.DEBUG),Xt(Qt),qt=null})});function Kt(Zt){const Qt=handleNext(At,Jt=>{Zt&&!Jt.atBottom&&Jt.notAtBottomBecause==="SIZE_INCREASED"&&!qt&&(getValue(Nt)("scrolling to bottom due to increased size",{},LogLevel.DEBUG),Xt("auto"))});setTimeout(Qt,100)}return subscribe(pipe(combineLatest(duc(Ut),_e,Lt),filter(([Zt,,Qt])=>Zt&&Qt),scan(({value:Zt},[,Qt])=>({refreshed:Zt===Qt,value:Qt}),{refreshed:!1,value:0}),filter(({refreshed:Zt})=>Zt),withLatestFrom(Ut,_e)),([,Zt])=>{Kt(Zt!==!1)}),subscribe(Gt,()=>{Kt(getValue(Ut)!==!1)}),subscribe(combineLatest(duc(Ut),At),([Zt,Qt])=>{Zt&&!Qt.atBottom&&Qt.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&Xt("auto")}),{followOutput:Ut,autoscrollToBottom:Gt}},tup(sizeSystem,stateFlagsSystem,scrollToIndexSystem,initialTopMostItemIndexSystem,propsReadySystem,loggerSystem,domIOSystem));function groupCountsToIndicesAndCount(_e){return _e.reduce((lt,Rt)=>(lt.groupIndices.push(lt.totalCount),lt.totalCount+=Rt+1,lt),{totalCount:0,groupIndices:[]})}const groupedListSystem=system(([{totalCount:_e,groupIndices:lt,sizes:Rt},{scrollTop:At,headerHeight:Pt}])=>{const Dt=stream(),Lt=stream(),Bt=streamFromEmitter(pipe(Dt,map(groupCountsToIndicesAndCount)));return connect(pipe(Bt,map(Nt=>Nt.totalCount)),_e),connect(pipe(Bt,map(Nt=>Nt.groupIndices)),lt),connect(pipe(combineLatest(At,Rt,Pt),filter(([Nt,jt])=>hasGroups(jt)),map(([Nt,jt,Ut])=>findMaxKeyValue(jt.groupOffsetTree,Math.max(Nt-Ut,0),"v")[0]),distinctUntilChanged(),map(Nt=>[Nt])),Lt),{groupCounts:Dt,topItemsIndexes:Lt}},tup(sizeSystem,domIOSystem));function tupleComparator(_e,lt){return!!(_e&&_e[0]===lt[0]&&_e[1]===lt[1])}function rangeComparator(_e,lt){return!!(_e&&_e.startIndex===lt.startIndex&&_e.endIndex===lt.endIndex)}const TOP="top",BOTTOM="bottom",NONE="none";function getOverscan(_e,lt,Rt){return typeof _e=="number"?Rt===UP&<===TOP||Rt===DOWN&<===BOTTOM?_e:0:Rt===UP?lt===TOP?_e.main:_e.reverse:lt===BOTTOM?_e.main:_e.reverse}function getViewportIncrease(_e,lt){return typeof _e=="number"?_e:_e[lt]||0}const sizeRangeSystem=system(([{scrollTop:_e,viewportHeight:lt,deviation:Rt,headerHeight:At,fixedHeaderHeight:Pt}])=>{const Dt=stream(),Lt=statefulStream(0),Bt=statefulStream(0),Nt=statefulStream(0),jt=statefulStreamFromEmitter(pipe(combineLatest(duc(_e),duc(lt),duc(At),duc(Dt,tupleComparator),duc(Nt),duc(Lt),duc(Pt),duc(Rt),duc(Bt)),map(([Ut,Gt,qt,[Xt,Kt],Zt,Qt,Jt,en,tn])=>{const an=Ut-en,cn=Qt+Jt,un=Math.max(qt-an,0);let rn=NONE;const sn=getViewportIncrease(tn,TOP),pn=getViewportIncrease(tn,BOTTOM);return Xt-=en,Xt+=qt+Jt,Kt+=qt+Jt,Kt-=en,Xt>Ut+cn-sn&&(rn=UP),KtUt!=null),distinctUntilChanged(tupleComparator)),[0,0]);return{listBoundary:Dt,overscan:Nt,topListHeight:Lt,increaseViewportBy:Bt,visibleRange:jt}},tup(domIOSystem),{singleton:!0});function probeItemSet(_e,lt,Rt){if(hasGroups(lt)){const At=originalIndexFromItemIndex(_e,lt);return[{index:findMaxKeyValue(lt.groupOffsetTree,At)[0],size:0,offset:0},{index:At,size:0,offset:0,data:Rt&&Rt[0]}]}return[{index:_e,size:0,offset:0,data:Rt&&Rt[0]}]}const EMPTY_LIST_STATE={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function transposeItems(_e,lt,Rt){if(_e.length===0)return[];if(!hasGroups(lt))return _e.map(jt=>({...jt,index:jt.index+Rt,originalIndex:jt.index}));const At=_e[0].index,Pt=_e[_e.length-1].index,Dt=[],Lt=rangesWithin(lt.groupOffsetTree,At,Pt);let Bt,Nt=0;for(const jt of _e){(!Bt||Bt.end0){jt=_e[0].offset;const Zt=_e[_e.length-1];Ut=Zt.offset+Zt.size}const Gt=Rt-Nt,qt=Bt+Gt*Lt+(Gt-1)*At,Xt=jt,Kt=qt-Ut;return{items:transposeItems(_e,Pt,Dt),topItems:transposeItems(lt,Pt,Dt),topListHeight:lt.reduce((Zt,Qt)=>Qt.size+Zt,0),offsetTop:jt,offsetBottom:Kt,top:Xt,bottom:Ut,totalCount:Rt,firstItemIndex:Dt}}function buildListStateFromItemCount(_e,lt,Rt,At,Pt,Dt){let Lt=0;if(Rt.groupIndices.length>0)for(const Ut of Rt.groupIndices){if(Ut-Lt>=_e)break;Lt++}const Bt=_e+Lt,Nt=getInitialTopMostItemIndexNumber(lt,Bt),jt=Array.from({length:Bt}).map((Ut,Gt)=>({index:Gt+Nt,size:0,offset:0,data:Dt[Gt+Nt]}));return buildListState(jt,[],Bt,Pt,Rt,At)}const listStateSystem=system(([{sizes:_e,totalCount:lt,data:Rt,firstItemIndex:At,gap:Pt},Dt,{visibleRange:Lt,listBoundary:Bt,topListHeight:Nt},{scrolledToInitialItem:jt,initialTopMostItemIndex:Ut},{topListHeight:Gt},qt,{didMount:Xt},{recalcInProgress:Kt}])=>{const Zt=statefulStream([]),Qt=statefulStream(0),Jt=stream();connect(Dt.topItemsIndexes,Zt);const en=statefulStreamFromEmitter(pipe(combineLatest(Xt,Kt,duc(Lt,tupleComparator),duc(lt),duc(_e),duc(Ut),jt,duc(Zt),duc(At),duc(Pt),Rt),filter(([un,rn,,sn,,,,,,,pn])=>{const bn=pn&&pn.length!==sn;return un&&!rn&&!bn}),map(([,,[un,rn],sn,pn,bn,gn,_n,xn,ln,Mn])=>{const Tn=pn,{sizeTree:An,offsetTree:Cn}=Tn,wn=getValue(Qt);if(sn===0)return{...EMPTY_LIST_STATE,totalCount:sn};if(un===0&&rn===0)return wn===0?{...EMPTY_LIST_STATE,totalCount:sn}:buildListStateFromItemCount(wn,bn,pn,xn,ln,Mn||[]);if(empty(An))return wn>0?null:buildListState(probeItemSet(getInitialTopMostItemIndexNumber(bn,sn),Tn,Mn),[],sn,ln,Tn,xn);const Fn=[];if(_n.length>0){const tr=_n[0],yn=_n[_n.length-1];let En=0;for(const kn of rangesWithin(An,tr,yn)){const zn=kn.value,dn=Math.max(kn.start,tr),hn=Math.min(kn.end,yn);for(let vn=dn;vn<=hn;vn++)Fn.push({index:vn,size:zn,offset:En,data:Mn&&Mn[vn]}),En+=zn}}if(!gn)return buildListState([],Fn,sn,ln,Tn,xn);const $n=_n.length>0?_n[_n.length-1]+1:0,Pn=rangesWithinOffsets(Cn,un,rn,$n);if(Pn.length===0)return null;const Vn=sn-1,Zn=tap([],tr=>{for(const yn of Pn){const En=yn.value;let kn=En.offset,zn=yn.start;const dn=En.size;if(En.offset=rn);vn++)tr.push({index:vn,size:dn,offset:kn,data:Mn&&Mn[vn]}),kn+=dn+ln}});return buildListState(Zn,Fn,sn,ln,Tn,xn)}),filter(un=>un!==null),distinctUntilChanged()),EMPTY_LIST_STATE);connect(pipe(Rt,filter(isDefined),map(un=>un==null?void 0:un.length)),lt),connect(pipe(en,map(un=>un.topListHeight)),Gt),connect(Gt,Nt),connect(pipe(en,map(un=>[un.top,un.bottom])),Bt),connect(pipe(en,map(un=>un.items)),Jt);const tn=streamFromEmitter(pipe(en,filter(({items:un})=>un.length>0),withLatestFrom(lt,Rt),filter(([{items:un},rn])=>un[un.length-1].originalIndex===rn-1),map(([,un,rn])=>[un-1,rn]),distinctUntilChanged(tupleComparator),map(([un])=>un))),an=streamFromEmitter(pipe(en,throttleTime(200),filter(({items:un,topItems:rn})=>un.length>0&&un[0].originalIndex===rn.length),map(({items:un})=>un[0].index),distinctUntilChanged())),cn=streamFromEmitter(pipe(en,filter(({items:un})=>un.length>0),map(({items:un})=>{let rn=0,sn=un.length-1;for(;un[rn].type==="group"&&rnrn;)sn--;return{startIndex:un[rn].index,endIndex:un[sn].index}}),distinctUntilChanged(rangeComparator)));return{listState:en,topItemsIndexes:Zt,endReached:tn,startReached:an,rangeChanged:cn,itemsRendered:Jt,initialItemCount:Qt,...qt}},tup(sizeSystem,groupedListSystem,sizeRangeSystem,initialTopMostItemIndexSystem,scrollToIndexSystem,stateFlagsSystem,propsReadySystem,recalcSystem),{singleton:!0}),initialItemCountSystem=system(([{sizes:_e,firstItemIndex:lt,data:Rt,gap:At},{initialTopMostItemIndex:Pt},{initialItemCount:Dt,listState:Lt},{didMount:Bt}])=>(connect(pipe(Bt,withLatestFrom(Dt),filter(([,Nt])=>Nt!==0),withLatestFrom(Pt,_e,lt,At,Rt),map(([[,Nt],jt,Ut,Gt,qt,Xt=[]])=>buildListStateFromItemCount(Nt,jt,Ut,Gt,qt,Xt))),Lt),{}),tup(sizeSystem,initialTopMostItemIndexSystem,listStateSystem,propsReadySystem),{singleton:!0}),scrollSeekSystem=system(([{scrollVelocity:_e}])=>{const lt=statefulStream(!1),Rt=stream(),At=statefulStream(!1);return connect(pipe(_e,withLatestFrom(At,lt,Rt),filter(([Pt,Dt])=>!!Dt),map(([Pt,Dt,Lt,Bt])=>{const{exit:Nt,enter:jt}=Dt;if(Lt){if(Nt(Pt,Bt))return!1}else if(jt(Pt,Bt))return!0;return Lt}),distinctUntilChanged()),lt),subscribe(pipe(combineLatest(lt,_e,Rt),withLatestFrom(At)),([[Pt,Dt,Lt],Bt])=>Pt&&Bt&&Bt.change&&Bt.change(Dt,Lt)),{isSeeking:lt,scrollSeekConfiguration:At,scrollVelocity:_e,scrollSeekRangeChanged:Rt}},tup(stateFlagsSystem),{singleton:!0}),topItemCountSystem=system(([{topItemsIndexes:_e}])=>{const lt=statefulStream(0);return connect(pipe(lt,filter(Rt=>Rt>0),map(Rt=>Array.from({length:Rt}).map((At,Pt)=>Pt))),_e),{topItemCount:lt}},tup(listStateSystem)),totalListHeightSystem=system(([{footerHeight:_e,headerHeight:lt,fixedHeaderHeight:Rt,fixedFooterHeight:At},{listState:Pt}])=>{const Dt=stream(),Lt=statefulStreamFromEmitter(pipe(combineLatest(_e,At,lt,Rt,Pt),map(([Bt,Nt,jt,Ut,Gt])=>Bt+Nt+jt+Ut+Gt.offsetBottom+Gt.bottom)),0);return connect(duc(Lt),Dt),{totalListHeight:Lt,totalListHeightChanged:Dt}},tup(domIOSystem,listStateSystem),{singleton:!0});function simpleMemoize(_e){let lt=!1,Rt;return()=>(lt||(lt=!0,Rt=_e()),Rt)}const isMobileSafari=simpleMemoize(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),upwardScrollFixSystem=system(([{scrollBy:_e,scrollTop:lt,deviation:Rt,scrollingInProgress:At},{isScrolling:Pt,isAtBottom:Dt,scrollDirection:Lt,lastJumpDueToItemResize:Bt},{listState:Nt},{beforeUnshiftWith:jt,shiftWithOffset:Ut,sizes:Gt,gap:qt},{log:Xt},{recalcInProgress:Kt}])=>{const Zt=streamFromEmitter(pipe(Nt,withLatestFrom(Bt),scan(([,Jt,en,tn],[{items:an,totalCount:cn,bottom:un,offsetBottom:rn},sn])=>{const pn=un+rn;let bn=0;return en===cn&&Jt.length>0&&an.length>0&&(an[0].originalIndex===0&&Jt[0].originalIndex===0||(bn=pn-tn,bn!==0&&(bn+=sn))),[bn,an,cn,pn]},[0,[],0,0]),filter(([Jt])=>Jt!==0),withLatestFrom(lt,Lt,At,Dt,Xt,Kt),filter(([,Jt,en,tn,,,an])=>!an&&!tn&&Jt!==0&&en===UP),map(([[Jt],,,,,en])=>(en("Upward scrolling compensation",{amount:Jt},LogLevel.DEBUG),Jt))));function Qt(Jt){Jt>0?(publish(_e,{top:-Jt,behavior:"auto"}),publish(Rt,0)):(publish(Rt,0),publish(_e,{top:-Jt,behavior:"auto"}))}return subscribe(pipe(Zt,withLatestFrom(Rt,Pt)),([Jt,en,tn])=>{tn&&isMobileSafari()?publish(Rt,en-Jt):Qt(-Jt)}),subscribe(pipe(combineLatest(statefulStreamFromEmitter(Pt,!1),Rt,Kt),filter(([Jt,en,tn])=>!Jt&&!tn&&en!==0),map(([Jt,en])=>en),throttleTime(1)),Qt),connect(pipe(Ut,map(Jt=>({top:-Jt}))),_e),subscribe(pipe(jt,withLatestFrom(Gt,qt),map(([Jt,{lastSize:en,groupIndices:tn,sizeTree:an},cn])=>{function un(rn){return rn*(en+cn)}if(tn.length===0)return un(Jt);{let rn=0;const sn=find(an,0);let pn=0,bn=0;for(;pnJt&&(rn-=sn,gn=Jt-pn+1),pn+=gn,rn+=un(gn),bn++}return rn}})),Jt=>{publish(Rt,Jt),requestAnimationFrame(()=>{publish(_e,{top:Jt}),requestAnimationFrame(()=>{publish(Rt,0),publish(Kt,!1)})})}),{deviation:Rt}},tup(domIOSystem,stateFlagsSystem,listStateSystem,sizeSystem,loggerSystem,recalcSystem)),initialScrollTopSystem=system(([{didMount:_e},{scrollTo:lt},{listState:Rt}])=>{const At=statefulStream(0);return subscribe(pipe(_e,withLatestFrom(At),filter(([,Pt])=>Pt!==0),map(([,Pt])=>({top:Pt}))),Pt=>{handleNext(pipe(Rt,skip(1),filter(Dt=>Dt.items.length>1)),()=>{requestAnimationFrame(()=>{publish(lt,Pt)})})}),{initialScrollTop:At}},tup(propsReadySystem,domIOSystem,listStateSystem),{singleton:!0}),alignToBottomSystem=system(([{viewportHeight:_e},{totalListHeight:lt}])=>{const Rt=statefulStream(!1),At=statefulStreamFromEmitter(pipe(combineLatest(Rt,_e,lt),filter(([Pt])=>Pt),map(([,Pt,Dt])=>Math.max(0,Pt-Dt)),throttleTime(0),distinctUntilChanged()),0);return{alignToBottom:Rt,paddingTopAddition:At}},tup(domIOSystem,totalListHeightSystem),{singleton:!0}),windowScrollerSystem=system(([{scrollTo:_e,scrollContainerState:lt}])=>{const Rt=stream(),At=stream(),Pt=stream(),Dt=statefulStream(!1),Lt=statefulStream(void 0);return connect(pipe(combineLatest(Rt,At),map(([{viewportHeight:Bt,scrollTop:Nt,scrollHeight:jt},{offsetTop:Ut}])=>({scrollTop:Math.max(0,Nt-Ut),scrollHeight:jt,viewportHeight:Bt}))),lt),connect(pipe(_e,withLatestFrom(At),map(([Bt,{offsetTop:Nt}])=>({...Bt,top:Bt.top+Nt}))),Pt),{useWindowScroll:Dt,customScrollParent:Lt,windowScrollContainerState:Rt,windowViewportRect:At,windowScrollTo:Pt}},tup(domIOSystem)),defaultCalculateViewLocation=({itemTop:_e,itemBottom:lt,viewportTop:Rt,viewportBottom:At,locationParams:{behavior:Pt,align:Dt,...Lt}})=>_eAt?{...Lt,behavior:Pt,align:Dt??"end"}:null,scrollIntoViewSystem=system(([{sizes:_e,totalCount:lt,gap:Rt},{scrollTop:At,viewportHeight:Pt,headerHeight:Dt,fixedHeaderHeight:Lt,fixedFooterHeight:Bt,scrollingInProgress:Nt},{scrollToIndex:jt}])=>{const Ut=stream();return connect(pipe(Ut,withLatestFrom(_e,Pt,lt,Dt,Lt,Bt,At),withLatestFrom(Rt),map(([[Gt,qt,Xt,Kt,Zt,Qt,Jt,en],tn])=>{const{done:an,behavior:cn,align:un,calculateViewLocation:rn=defaultCalculateViewLocation,...sn}=Gt,pn=originalIndexFromLocation(Gt,qt,Kt-1),bn=offsetOf(pn,qt.offsetTree,tn)+Zt+Qt,gn=bn+findMaxKeyValue(qt.sizeTree,pn)[1],_n=en+Qt,xn=en+Xt-Jt,ln=rn({itemTop:bn,itemBottom:gn,viewportTop:_n,viewportBottom:xn,locationParams:{behavior:cn,align:un,...sn}});return ln?an&&handleNext(pipe(Nt,filter(Mn=>Mn===!1),skip(getValue(Nt)?1:2)),an):an&&an(),ln}),filter(Gt=>Gt!==null)),jt),{scrollIntoView:Ut}},tup(sizeSystem,domIOSystem,scrollToIndexSystem,listStateSystem,loggerSystem),{singleton:!0}),stateLoadSystem=system(([{sizes:_e,sizeRanges:lt},{scrollTop:Rt},{initialTopMostItemIndex:At},{didMount:Pt},{useWindowScroll:Dt,windowScrollContainerState:Lt,windowViewportRect:Bt}])=>{const Nt=stream(),jt=statefulStream(void 0),Ut=statefulStream(null),Gt=statefulStream(null);return connect(Lt,Ut),connect(Bt,Gt),subscribe(pipe(Nt,withLatestFrom(_e,Rt,Dt,Ut,Gt)),([qt,Xt,Kt,Zt,Qt,Jt])=>{const en=sizeTreeToRanges(Xt.sizeTree);Zt&&Qt!==null&&Jt!==null&&(Kt=Qt.scrollTop-Jt.offsetTop),qt({ranges:en,scrollTop:Kt})}),connect(pipe(jt,filter(isDefined),map(locationFromSnapshot)),At),connect(pipe(Pt,withLatestFrom(jt),filter(([,qt])=>qt!==void 0),distinctUntilChanged(),map(([,qt])=>qt.ranges)),lt),{getState:Nt,restoreStateFrom:jt}},tup(sizeSystem,domIOSystem,initialTopMostItemIndexSystem,propsReadySystem,windowScrollerSystem));function locationFromSnapshot(_e){return{offset:_e.scrollTop,index:0,align:"start"}}const featureGroup1System=system(([_e,lt,Rt,At,Pt,Dt,Lt,Bt,Nt,jt])=>({..._e,...lt,...Rt,...At,...Pt,...Dt,...Lt,...Bt,...Nt,...jt}),tup(sizeRangeSystem,initialItemCountSystem,propsReadySystem,scrollSeekSystem,totalListHeightSystem,initialScrollTopSystem,alignToBottomSystem,windowScrollerSystem,scrollIntoViewSystem,loggerSystem)),listSystem=system(([{totalCount:_e,sizeRanges:lt,fixedItemSize:Rt,defaultItemSize:At,trackItemSizes:Pt,itemSize:Dt,data:Lt,firstItemIndex:Bt,groupIndices:Nt,statefulTotalCount:jt,gap:Ut,sizes:Gt},{initialTopMostItemIndex:qt,scrolledToInitialItem:Xt},Kt,Zt,Qt,{listState:Jt,topItemsIndexes:en,...tn},{scrollToIndex:an},cn,{topItemCount:un},{groupCounts:rn},sn])=>(connect(tn.rangeChanged,sn.scrollSeekRangeChanged),connect(pipe(sn.windowViewportRect,map(pn=>pn.visibleHeight)),Kt.viewportHeight),{totalCount:_e,data:Lt,firstItemIndex:Bt,sizeRanges:lt,initialTopMostItemIndex:qt,scrolledToInitialItem:Xt,topItemsIndexes:en,topItemCount:un,groupCounts:rn,fixedItemHeight:Rt,defaultItemHeight:At,gap:Ut,...Qt,statefulTotalCount:jt,listState:Jt,scrollToIndex:an,trackItemSizes:Pt,itemSize:Dt,groupIndices:Nt,...tn,...sn,...Kt,sizes:Gt,...Zt}),tup(sizeSystem,initialTopMostItemIndexSystem,domIOSystem,stateLoadSystem,followOutputSystem,listStateSystem,scrollToIndexSystem,upwardScrollFixSystem,topItemCountSystem,groupedListSystem,featureGroup1System)),WEBKIT_STICKY="-webkit-sticky",STICKY="sticky",positionStickyCssValue=simpleMemoize(()=>{if(typeof document>"u")return STICKY;const _e=document.createElement("div");return _e.style.position=WEBKIT_STICKY,_e.style.position===WEBKIT_STICKY?WEBKIT_STICKY:STICKY});function useWindowViewportRectRef(_e,lt){const Rt=React.useRef(null),At=React.useCallback(Bt=>{if(Bt===null||!Bt.offsetParent)return;const Nt=Bt.getBoundingClientRect(),jt=Nt.width;let Ut,Gt;if(lt){const qt=lt.getBoundingClientRect(),Xt=Nt.top-qt.top;Ut=qt.height-Math.max(0,Xt),Gt=Xt+lt.scrollTop}else Ut=window.innerHeight-Math.max(0,Nt.top),Gt=Nt.top+window.pageYOffset;Rt.current={offsetTop:Gt,visibleHeight:Ut,visibleWidth:jt},_e(Rt.current)},[_e,lt]),{callbackRef:Pt,ref:Dt}=useSizeWithElRef(At),Lt=React.useCallback(()=>{At(Dt.current)},[At,Dt]);return React.useEffect(()=>{if(lt){lt.addEventListener("scroll",Lt);const Bt=new ResizeObserver(Lt);return Bt.observe(lt),()=>{lt.removeEventListener("scroll",Lt),Bt.unobserve(lt)}}else return window.addEventListener("scroll",Lt),window.addEventListener("resize",Lt),()=>{window.removeEventListener("scroll",Lt),window.removeEventListener("resize",Lt)}},[Lt,lt]),Pt}const VirtuosoMockContext=React.createContext(void 0),VirtuosoGridMockContext=React.createContext(void 0);function identity(_e){return _e}const listComponentPropsSystem=system(()=>{const _e=statefulStream(Nt=>`Item ${Nt}`),lt=statefulStream(null),Rt=statefulStream(Nt=>`Group ${Nt}`),At=statefulStream({}),Pt=statefulStream(identity),Dt=statefulStream("div"),Lt=statefulStream(noop),Bt=(Nt,jt=null)=>statefulStreamFromEmitter(pipe(At,map(Ut=>Ut[Nt]),distinctUntilChanged()),jt);return{context:lt,itemContent:_e,groupContent:Rt,components:At,computeItemKey:Pt,headerFooterTag:Dt,scrollerRef:Lt,FooterComponent:Bt("Footer"),HeaderComponent:Bt("Header"),TopItemListComponent:Bt("TopItemList"),ListComponent:Bt("List","div"),ItemComponent:Bt("Item","div"),GroupComponent:Bt("Group","div"),ScrollerComponent:Bt("Scroller","div"),EmptyPlaceholder:Bt("EmptyPlaceholder"),ScrollSeekPlaceholder:Bt("ScrollSeekPlaceholder")}}),combinedSystem$2=system(([_e,lt])=>({..._e,...lt}),tup(listSystem,listComponentPropsSystem)),DefaultScrollSeekPlaceholder$1=({height:_e})=>React.createElement("div",{style:{height:_e}}),GROUP_STYLE={position:positionStickyCssValue(),zIndex:1,overflowAnchor:"none"},ITEM_STYLE$1={overflowAnchor:"none"},Items$1=React.memo(function _e({showTopList:lt=!1}){const Rt=useEmitterValue$2("listState"),At=usePublisher$2("sizeRanges"),Pt=useEmitterValue$2("useWindowScroll"),Dt=useEmitterValue$2("customScrollParent"),Lt=usePublisher$2("windowScrollContainerState"),Bt=usePublisher$2("scrollContainerState"),Nt=Dt||Pt?Lt:Bt,jt=useEmitterValue$2("itemContent"),Ut=useEmitterValue$2("context"),Gt=useEmitterValue$2("groupContent"),qt=useEmitterValue$2("trackItemSizes"),Xt=useEmitterValue$2("itemSize"),Kt=useEmitterValue$2("log"),Zt=usePublisher$2("gap"),{callbackRef:Qt}=useChangedListContentsSizes(At,Xt,qt,lt?noop:Nt,Kt,Zt,Dt),[Jt,en]=React.useState(0);useEmitter$2("deviation",ln=>{Jt!==ln&&en(ln)});const tn=useEmitterValue$2("EmptyPlaceholder"),an=useEmitterValue$2("ScrollSeekPlaceholder")||DefaultScrollSeekPlaceholder$1,cn=useEmitterValue$2("ListComponent"),un=useEmitterValue$2("ItemComponent"),rn=useEmitterValue$2("GroupComponent"),sn=useEmitterValue$2("computeItemKey"),pn=useEmitterValue$2("isSeeking"),bn=useEmitterValue$2("groupIndices").length>0,gn=useEmitterValue$2("paddingTopAddition"),_n=useEmitterValue$2("scrolledToInitialItem"),xn=lt?{}:{boxSizing:"border-box",paddingTop:Rt.offsetTop+gn,paddingBottom:Rt.offsetBottom,marginTop:Jt,..._n?{}:{visibility:"hidden"}};return!lt&&Rt.totalCount===0&&tn?React.createElement(tn,contextPropIfNotDomElement(tn,Ut)):React.createElement(cn,{...contextPropIfNotDomElement(cn,Ut),ref:Qt,style:xn,"data-test-id":lt?"virtuoso-top-item-list":"virtuoso-item-list"},(lt?Rt.topItems:Rt.items).map(ln=>{const Mn=ln.originalIndex,Tn=sn(Mn+Rt.firstItemIndex,ln.data,Ut);return pn?React.createElement(an,{...contextPropIfNotDomElement(an,Ut),key:Tn,index:ln.index,height:ln.size,type:ln.type||"item",...ln.type==="group"?{}:{groupIndex:ln.groupIndex}}):ln.type==="group"?React.createElement(rn,{...contextPropIfNotDomElement(rn,Ut),key:Tn,"data-index":Mn,"data-known-size":ln.size,"data-item-index":ln.index,style:GROUP_STYLE},Gt(ln.index,Ut)):React.createElement(un,{...contextPropIfNotDomElement(un,Ut),...itemPropIfNotDomElement(un,ln.data),key:Tn,"data-index":Mn,"data-known-size":ln.size,"data-item-index":ln.index,"data-item-group-index":ln.groupIndex,style:ITEM_STYLE$1},bn?jt(ln.index,ln.groupIndex,ln.data,Ut):jt(ln.index,ln.data,Ut))}))}),scrollerStyle={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},viewportStyle={width:"100%",height:"100%",position:"absolute",top:0},topItemListStyle={width:"100%",position:positionStickyCssValue(),top:0,zIndex:1};function contextPropIfNotDomElement(_e,lt){if(typeof _e!="string")return{context:lt}}function itemPropIfNotDomElement(_e,lt){return{item:typeof _e=="string"?void 0:lt}}const Header$1=React.memo(function _e(){const lt=useEmitterValue$2("HeaderComponent"),Rt=usePublisher$2("headerHeight"),At=useEmitterValue$2("headerFooterTag"),Pt=useSize(Lt=>Rt(correctItemSize(Lt,"height"))),Dt=useEmitterValue$2("context");return lt?React.createElement(At,{ref:Pt},React.createElement(lt,contextPropIfNotDomElement(lt,Dt))):null}),Footer$1=React.memo(function _e(){const lt=useEmitterValue$2("FooterComponent"),Rt=usePublisher$2("footerHeight"),At=useEmitterValue$2("headerFooterTag"),Pt=useSize(Lt=>Rt(correctItemSize(Lt,"height"))),Dt=useEmitterValue$2("context");return lt?React.createElement(At,{ref:Pt},React.createElement(lt,contextPropIfNotDomElement(lt,Dt))):null});function buildScroller({usePublisher:_e,useEmitter:lt,useEmitterValue:Rt}){return React.memo(function({style:Dt,children:Lt,...Bt}){const Nt=_e("scrollContainerState"),jt=Rt("ScrollerComponent"),Ut=_e("smoothScrollTargetReached"),Gt=Rt("scrollerRef"),qt=Rt("context"),{scrollerRef:Xt,scrollByCallback:Kt,scrollToCallback:Zt}=useScrollTop(Nt,Ut,jt,Gt);return lt("scrollTo",Zt),lt("scrollBy",Kt),React.createElement(jt,{ref:Xt,style:{...scrollerStyle,...Dt},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...Bt,...contextPropIfNotDomElement(jt,qt)},Lt)})}function buildWindowScroller({usePublisher:_e,useEmitter:lt,useEmitterValue:Rt}){return React.memo(function({style:Dt,children:Lt,...Bt}){const Nt=_e("windowScrollContainerState"),jt=Rt("ScrollerComponent"),Ut=_e("smoothScrollTargetReached"),Gt=Rt("totalListHeight"),qt=Rt("deviation"),Xt=Rt("customScrollParent"),Kt=Rt("context"),{scrollerRef:Zt,scrollByCallback:Qt,scrollToCallback:Jt}=useScrollTop(Nt,Ut,jt,noop,Xt);return useIsomorphicLayoutEffect$1(()=>(Zt.current=Xt||window,()=>{Zt.current=null}),[Zt,Xt]),lt("windowScrollTo",Jt),lt("scrollBy",Qt),React.createElement(jt,{style:{position:"relative",...Dt,...Gt!==0?{height:Gt+qt}:{}},"data-virtuoso-scroller":!0,...Bt,...contextPropIfNotDomElement(jt,Kt)},Lt)})}const Viewport$2=({children:_e})=>{const lt=React.useContext(VirtuosoMockContext),Rt=usePublisher$2("viewportHeight"),At=usePublisher$2("fixedItemHeight"),Pt=useSize(compose(Rt,Dt=>correctItemSize(Dt,"height")));return React.useEffect(()=>{lt&&(Rt(lt.viewportHeight),At(lt.itemHeight))},[lt,Rt,At]),React.createElement("div",{style:viewportStyle,ref:Pt,"data-viewport-type":"element"},_e)},WindowViewport$2=({children:_e})=>{const lt=React.useContext(VirtuosoMockContext),Rt=usePublisher$2("windowViewportRect"),At=usePublisher$2("fixedItemHeight"),Pt=useEmitterValue$2("customScrollParent"),Dt=useWindowViewportRectRef(Rt,Pt);return React.useEffect(()=>{lt&&(At(lt.itemHeight),Rt({offsetTop:0,visibleHeight:lt.viewportHeight,visibleWidth:100}))},[lt,Rt,At]),React.createElement("div",{ref:Dt,style:viewportStyle,"data-viewport-type":"window"},_e)},TopItemListContainer=({children:_e})=>{const lt=useEmitterValue$2("TopItemListComponent")||"div",Rt=useEmitterValue$2("headerHeight"),At={...topItemListStyle,marginTop:`${Rt}px`},Pt=useEmitterValue$2("context");return React.createElement(lt,{style:At,...contextPropIfNotDomElement(lt,Pt)},_e)},ListRoot=React.memo(function _e(lt){const Rt=useEmitterValue$2("useWindowScroll"),At=useEmitterValue$2("topItemsIndexes").length>0,Pt=useEmitterValue$2("customScrollParent"),Dt=Pt||Rt?WindowScroller$2:Scroller$2,Lt=Pt||Rt?WindowViewport$2:Viewport$2;return React.createElement(Dt,{...lt},At&&React.createElement(TopItemListContainer,null,React.createElement(Items$1,{showTopList:!0})),React.createElement(Lt,null,React.createElement(Header$1,null),React.createElement(Items$1,null),React.createElement(Footer$1,null)))}),{Component:List,usePublisher:usePublisher$2,useEmitterValue:useEmitterValue$2,useEmitter:useEmitter$2}=systemToComponent(combinedSystem$2,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},ListRoot),Scroller$2=buildScroller({usePublisher:usePublisher$2,useEmitterValue:useEmitterValue$2,useEmitter:useEmitter$2}),WindowScroller$2=buildWindowScroller({usePublisher:usePublisher$2,useEmitterValue:useEmitterValue$2,useEmitter:useEmitter$2}),Virtuoso=List,INITIAL_GRID_STATE={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},PROBE_GRID_STATE={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round,ceil,floor,min,max}=Math;function buildProbeGridState(_e){return{...PROBE_GRID_STATE,items:_e}}function buildItems(_e,lt,Rt){return Array.from({length:lt-_e+1}).map((At,Pt)=>{const Dt=Rt===null?null:Rt[Pt+_e];return{index:Pt+_e,data:Dt}})}function gapComparator(_e,lt){return _e&&_e.column===lt.column&&_e.row===lt.row}function dimensionComparator(_e,lt){return _e&&_e.width===lt.width&&_e.height===lt.height}const gridSystem=system(([{overscan:_e,visibleRange:lt,listBoundary:Rt},{scrollTop:At,viewportHeight:Pt,scrollBy:Dt,scrollTo:Lt,smoothScrollTargetReached:Bt,scrollContainerState:Nt,footerHeight:jt,headerHeight:Ut},Gt,qt,{propsReady:Xt,didMount:Kt},{windowViewportRect:Zt,useWindowScroll:Qt,customScrollParent:Jt,windowScrollContainerState:en,windowScrollTo:tn},an])=>{const cn=statefulStream(0),un=statefulStream(0),rn=statefulStream(INITIAL_GRID_STATE),sn=statefulStream({height:0,width:0}),pn=statefulStream({height:0,width:0}),bn=stream(),gn=stream(),_n=statefulStream(0),xn=statefulStream(null),ln=statefulStream({row:0,column:0}),Mn=stream(),Tn=stream(),An=statefulStream(!1),Cn=statefulStream(0),wn=statefulStream(!0),Fn=statefulStream(!1);subscribe(pipe(Kt,withLatestFrom(Cn),filter(([yn,En])=>!!En)),()=>{publish(wn,!1),publish(un,0)}),subscribe(pipe(combineLatest(Kt,wn,pn,sn,Cn,Fn),filter(([yn,En,kn,zn,,dn])=>yn&&!En&&kn.height!==0&&zn.height!==0&&!dn)),([,,,,yn])=>{publish(Fn,!0),skipFrames(1,()=>{publish(bn,yn)}),handleNext(pipe(At),()=>{publish(Rt,[0,0]),publish(wn,!0)})}),connect(pipe(Tn,filter(yn=>yn!=null&&yn.scrollTop>0),mapTo(0)),un),subscribe(pipe(Kt,withLatestFrom(Tn),filter(([,yn])=>yn!=null)),([,yn])=>{yn&&(publish(sn,yn.viewport),publish(pn,yn==null?void 0:yn.item),publish(ln,yn.gap),yn.scrollTop>0&&(publish(An,!0),handleNext(pipe(At,skip(1)),En=>{publish(An,!1)}),publish(Lt,{top:yn.scrollTop})))}),connect(pipe(sn,map(({height:yn})=>yn)),Pt),connect(pipe(combineLatest(duc(sn,dimensionComparator),duc(pn,dimensionComparator),duc(ln,(yn,En)=>yn&&yn.column===En.column&&yn.row===En.row),duc(At)),map(([yn,En,kn,zn])=>({viewport:yn,item:En,gap:kn,scrollTop:zn}))),Mn),connect(pipe(combineLatest(duc(cn),lt,duc(ln,gapComparator),duc(pn,dimensionComparator),duc(sn,dimensionComparator),duc(xn),duc(un),duc(An),duc(wn),duc(Cn)),filter(([,,,,,,,yn])=>!yn),map(([yn,[En,kn],zn,dn,hn,vn,Bn,,Gn,Sn])=>{const{row:Kn,column:er}=zn,{height:Yn,width:dr}=dn,{width:yr}=hn;if(Bn===0&&(yn===0||yr===0))return INITIAL_GRID_STATE;if(dr===0){const Jn=getInitialTopMostItemIndexNumber(Sn,yn),ur=Jn===0?Math.max(Bn-1,0):Jn;return buildProbeGridState(buildItems(Jn,ur,vn))}const br=itemsPerRow(yr,dr,er);let Er,nr;Gn?En===0&&kn===0&&Bn>0?(Er=0,nr=Bn-1):(Er=br*floor((En+Kn)/(Yn+Kn)),nr=br*ceil((kn+Kn)/(Yn+Kn))-1,nr=min(yn-1,max(nr,br-1)),Er=min(nr,max(0,Er))):(Er=0,nr=-1);const sr=buildItems(Er,nr,vn),{top:_r,bottom:Rr}=gridLayout(hn,zn,dn,sr),Un=ceil(yn/br),Dn=Un*Yn+(Un-1)*Kn-Rr;return{items:sr,offsetTop:_r,offsetBottom:Dn,top:_r,bottom:Rr,itemHeight:Yn,itemWidth:dr}})),rn),connect(pipe(xn,filter(yn=>yn!==null),map(yn=>yn.length)),cn),connect(pipe(combineLatest(sn,pn,rn,ln),filter(([yn,En,{items:kn}])=>kn.length>0&&En.height!==0&&yn.height!==0),map(([yn,En,{items:kn},zn])=>{const{top:dn,bottom:hn}=gridLayout(yn,zn,En,kn);return[dn,hn]}),distinctUntilChanged(tupleComparator)),Rt);const $n=statefulStream(!1);connect(pipe(At,withLatestFrom($n),map(([yn,En])=>En||yn!==0)),$n);const Pn=streamFromEmitter(pipe(duc(rn),filter(({items:yn})=>yn.length>0),withLatestFrom(cn,$n),filter(([{items:yn},En,kn])=>kn&&yn[yn.length-1].index===En-1),map(([,yn])=>yn-1),distinctUntilChanged())),Vn=streamFromEmitter(pipe(duc(rn),filter(({items:yn})=>yn.length>0&&yn[0].index===0),mapTo(0),distinctUntilChanged())),Zn=streamFromEmitter(pipe(duc(rn),withLatestFrom(An),filter(([{items:yn},En])=>yn.length>0&&!En),map(([{items:yn}])=>({startIndex:yn[0].index,endIndex:yn[yn.length-1].index})),distinctUntilChanged(rangeComparator),throttleTime(0)));connect(Zn,qt.scrollSeekRangeChanged),connect(pipe(bn,withLatestFrom(sn,pn,cn,ln),map(([yn,En,kn,zn,dn])=>{const hn=normalizeIndexLocation(yn),{align:vn,behavior:Bn,offset:Gn}=hn;let Sn=hn.index;Sn==="LAST"&&(Sn=zn-1),Sn=max(0,Sn,min(zn-1,Sn));let Kn=itemTop(En,dn,kn,Sn);return vn==="end"?Kn=round(Kn-En.height+kn.height):vn==="center"&&(Kn=round(Kn-En.height/2+kn.height/2)),Gn&&(Kn+=Gn),{top:Kn,behavior:Bn}})),Lt);const tr=statefulStreamFromEmitter(pipe(rn,map(yn=>yn.offsetBottom+yn.bottom)),0);return connect(pipe(Zt,map(yn=>({width:yn.visibleWidth,height:yn.visibleHeight}))),sn),{data:xn,totalCount:cn,viewportDimensions:sn,itemDimensions:pn,scrollTop:At,scrollHeight:gn,overscan:_e,scrollBy:Dt,scrollTo:Lt,scrollToIndex:bn,smoothScrollTargetReached:Bt,windowViewportRect:Zt,windowScrollTo:tn,useWindowScroll:Qt,customScrollParent:Jt,windowScrollContainerState:en,deviation:_n,scrollContainerState:Nt,footerHeight:jt,headerHeight:Ut,initialItemCount:un,gap:ln,restoreStateFrom:Tn,...qt,initialTopMostItemIndex:Cn,gridState:rn,totalListHeight:tr,...Gt,startReached:Vn,endReached:Pn,rangeChanged:Zn,stateChanged:Mn,propsReady:Xt,stateRestoreInProgress:An,...an}},tup(sizeRangeSystem,domIOSystem,stateFlagsSystem,scrollSeekSystem,propsReadySystem,windowScrollerSystem,loggerSystem));function gridLayout(_e,lt,Rt,At){const{height:Pt}=Rt;if(Pt===void 0||At.length===0)return{top:0,bottom:0};const Dt=itemTop(_e,lt,Rt,At[0].index),Lt=itemTop(_e,lt,Rt,At[At.length-1].index)+Pt;return{top:Dt,bottom:Lt}}function itemTop(_e,lt,Rt,At){const Pt=itemsPerRow(_e.width,Rt.width,lt.column),Dt=floor(At/Pt),Lt=Dt*Rt.height+max(0,Dt-1)*lt.row;return Lt>0?Lt+lt.row:Lt}function itemsPerRow(_e,lt,Rt){return max(1,floor((_e+Rt)/(floor(lt)+Rt)))}const gridComponentPropsSystem=system(()=>{const _e=statefulStream(jt=>`Item ${jt}`),lt=statefulStream({}),Rt=statefulStream(null),At=statefulStream("virtuoso-grid-item"),Pt=statefulStream("virtuoso-grid-list"),Dt=statefulStream(identity),Lt=statefulStream("div"),Bt=statefulStream(noop),Nt=(jt,Ut=null)=>statefulStreamFromEmitter(pipe(lt,map(Gt=>Gt[jt]),distinctUntilChanged()),Ut);return{context:Rt,itemContent:_e,components:lt,computeItemKey:Dt,itemClassName:At,listClassName:Pt,headerFooterTag:Lt,scrollerRef:Bt,FooterComponent:Nt("Footer"),HeaderComponent:Nt("Header"),ListComponent:Nt("List","div"),ItemComponent:Nt("Item","div"),ScrollerComponent:Nt("Scroller","div"),ScrollSeekPlaceholder:Nt("ScrollSeekPlaceholder","div")}}),combinedSystem$1=system(([_e,lt])=>({..._e,...lt}),tup(gridSystem,gridComponentPropsSystem)),GridItems=React.memo(function _e(){const lt=useEmitterValue$1("gridState"),Rt=useEmitterValue$1("listClassName"),At=useEmitterValue$1("itemClassName"),Pt=useEmitterValue$1("itemContent"),Dt=useEmitterValue$1("computeItemKey"),Lt=useEmitterValue$1("isSeeking"),Bt=usePublisher$1("scrollHeight"),Nt=useEmitterValue$1("ItemComponent"),jt=useEmitterValue$1("ListComponent"),Ut=useEmitterValue$1("ScrollSeekPlaceholder"),Gt=useEmitterValue$1("context"),qt=usePublisher$1("itemDimensions"),Xt=usePublisher$1("gap"),Kt=useEmitterValue$1("log"),Zt=useEmitterValue$1("stateRestoreInProgress"),Qt=useSize(Jt=>{const en=Jt.parentElement.parentElement.scrollHeight;Bt(en);const tn=Jt.firstChild;if(tn){const{width:an,height:cn}=tn.getBoundingClientRect();qt({width:an,height:cn})}Xt({row:resolveGapValue("row-gap",getComputedStyle(Jt).rowGap,Kt),column:resolveGapValue("column-gap",getComputedStyle(Jt).columnGap,Kt)})});return Zt?null:React.createElement(jt,{ref:Qt,className:Rt,...contextPropIfNotDomElement(jt,Gt),style:{paddingTop:lt.offsetTop,paddingBottom:lt.offsetBottom},"data-test-id":"virtuoso-item-list"},lt.items.map(Jt=>{const en=Dt(Jt.index,Jt.data,Gt);return Lt?React.createElement(Ut,{key:en,...contextPropIfNotDomElement(Ut,Gt),index:Jt.index,height:lt.itemHeight,width:lt.itemWidth}):React.createElement(Nt,{...contextPropIfNotDomElement(Nt,Gt),className:At,"data-index":Jt.index,key:en},Pt(Jt.index,Jt.data,Gt))}))}),Header=React.memo(function _e(){const lt=useEmitterValue$1("HeaderComponent"),Rt=usePublisher$1("headerHeight"),At=useEmitterValue$1("headerFooterTag"),Pt=useSize(Lt=>Rt(correctItemSize(Lt,"height"))),Dt=useEmitterValue$1("context");return lt?React.createElement(At,{ref:Pt},React.createElement(lt,contextPropIfNotDomElement(lt,Dt))):null}),Footer=React.memo(function _e(){const lt=useEmitterValue$1("FooterComponent"),Rt=usePublisher$1("footerHeight"),At=useEmitterValue$1("headerFooterTag"),Pt=useSize(Lt=>Rt(correctItemSize(Lt,"height"))),Dt=useEmitterValue$1("context");return lt?React.createElement(At,{ref:Pt},React.createElement(lt,contextPropIfNotDomElement(lt,Dt))):null}),Viewport$1=({children:_e})=>{const lt=React.useContext(VirtuosoGridMockContext),Rt=usePublisher$1("itemDimensions"),At=usePublisher$1("viewportDimensions"),Pt=useSize(Dt=>{At(Dt.getBoundingClientRect())});return React.useEffect(()=>{lt&&(At({height:lt.viewportHeight,width:lt.viewportWidth}),Rt({height:lt.itemHeight,width:lt.itemWidth}))},[lt,At,Rt]),React.createElement("div",{style:viewportStyle,ref:Pt},_e)},WindowViewport$1=({children:_e})=>{const lt=React.useContext(VirtuosoGridMockContext),Rt=usePublisher$1("windowViewportRect"),At=usePublisher$1("itemDimensions"),Pt=useEmitterValue$1("customScrollParent"),Dt=useWindowViewportRectRef(Rt,Pt);return React.useEffect(()=>{lt&&(At({height:lt.itemHeight,width:lt.itemWidth}),Rt({offsetTop:0,visibleHeight:lt.viewportHeight,visibleWidth:lt.viewportWidth}))},[lt,Rt,At]),React.createElement("div",{ref:Dt,style:viewportStyle},_e)},GridRoot=React.memo(function _e({...lt}){const Rt=useEmitterValue$1("useWindowScroll"),At=useEmitterValue$1("customScrollParent"),Pt=At||Rt?WindowScroller$1:Scroller$1,Dt=At||Rt?WindowViewport$1:Viewport$1;return React.createElement(Pt,{...lt},React.createElement(Dt,null,React.createElement(Header,null),React.createElement(GridItems,null),React.createElement(Footer,null)))}),{Component:Grid,usePublisher:usePublisher$1,useEmitterValue:useEmitterValue$1,useEmitter:useEmitter$1}=systemToComponent(combinedSystem$1,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged"}},GridRoot),Scroller$1=buildScroller({usePublisher:usePublisher$1,useEmitterValue:useEmitterValue$1,useEmitter:useEmitter$1}),WindowScroller$1=buildWindowScroller({usePublisher:usePublisher$1,useEmitterValue:useEmitterValue$1,useEmitter:useEmitter$1});function resolveGapValue(_e,lt,Rt){return lt!=="normal"&&!(lt!=null&<.endsWith("px"))&&Rt(`${_e} was not resolved to pixel value correctly`,lt,LogLevel.WARN),lt==="normal"?0:parseInt(lt??"0",10)}const Scroller=reactExports.forwardRef(({style:_e,children:lt,...Rt},At)=>{const Pt=reactExports.useRef(null),{palette:Dt,spacing:Lt}=useTheme(),Bt=useCss$1({"--os-padding-perpendicular":"2px",".os-scrollbar":{visibility:"visible",opacity:1},".os-scrollbar-vertical > .os-scrollbar-track > .os-scrollbar-handle":{"min-height":Lt(12)},"div.os-scrollbar-vertical > div.os-scrollbar-track":{height:`calc(100% - ${Lt(6)})`,marginTop:Lt(6)},"div > div.os-scrollbar-track":{"--os-handle-perpendicular-size":"2px","--os-handle-perpendicular-size-hover":"6px","--os-handle-perpendicular-size-active":"6px","> div.os-scrollbar-handle":{borderRadius:0,opacity:.5,"&:hover":{opacity:.8}}}}),[Nt]=S$3({options:{overflow:{x:"hidden",y:"scroll"},scrollbars:{autoHide:"move",theme:Dt.mode==="dark"?"os-theme-light":"os-theme-dark"}}});reactExports.useEffect(()=>{typeof At!="function"&&(At!=null&&At.current)&&(Pt!=null&&Pt.current)&&Nt({target:Pt.current,elements:{viewport:At.current}})},[Nt]);const jt=reactExports.useCallback(Ut=>{Ut&&At&&(typeof At=="function"?At(Ut):At.current=Ut)},[At]);return jsxRuntimeExports.jsx("div",{ref:Pt,style:_e,className:Bt,children:jsxRuntimeExports.jsx("div",{ref:jt,...Rt,children:lt})})});function LazyList({items:_e=[],renderItem:lt,listOptions:Rt,placeholder:At,...Pt}){return jsxRuntimeExports.jsx(Box$1,{...Pt,children:jsxRuntimeExports.jsx(Virtuoso,{components:{Scroller},totalCount:_e.length,itemContent:Dt=>lt==null?void 0:lt(_e[Dt],Dt),...Rt})})}function Dot({label:_e}){return jsxRuntimeExports.jsx(Tooltip$1,{title:_e,children:jsxRuntimeExports.jsx(FiberManualRecord,{sx:{color:"error.main",transform:"scale(0.5)",pl:.5,mr:2},fontSize:"small"})})}function EventInspector({event:_e,index:lt,selected:Rt,label:At,...Pt}){const{spacing:Dt}=useTheme(),Lt=useCss$1({}),Bt=useCss$1({}),Nt=lodashExports$1.omit(_e,...OMIT_PROPS),jt=lodashExports$1.pick(Nt,...ESSENTIAL_PROPS),Ut=lodashExports$1.omit(Nt,...ESSENTIAL_PROPS);return jsxRuntimeExports.jsxs(Box$1,{sx:{position:"relative",[`> .${Bt}`]:{opacity:0},[`&:hover > .${Bt}`]:{opacity:1},[`&:hover > .${Lt}`]:{pr:8}},children:[jsxRuntimeExports.jsxs(ListItemButton$1,{className:Lt,selected:Rt,...Pt,sx:{borderLeft:`${Dt(.5)} solid ${getColorHex(_e==null?void 0:_e.type)}`,...Pt.sx},children:[jsxRuntimeExports.jsxs(ListItemIcon$1,{sx:{alignItems:"center"},children:[jsxRuntimeExports.jsx(Type$1,{variant:"body2",children:lt}),At&&jsxRuntimeExports.jsx(Dot,{label:At})]}),jsxRuntimeExports.jsx(ListItemText$1,{sx:{overflow:"hidden"},primary:jsxRuntimeExports.jsxs(Box$1,{sx:{overflow:"hidden",whiteSpace:"nowrap",display:"block",textOverflow:"ellipsis",my:.5},children:[lodashExports$1.startCase(`${(_e==null?void 0:_e.type)??"unsupported"} ${(_e==null?void 0:_e.id)??"-"}`)," "]}),secondaryTypographyProps:{component:"div",whiteSpace:"nowrap",overflow:"hidden"},secondary:jsxRuntimeExports.jsxs(Stack$1,{direction:"row",justifyContent:"flex-start",sx:{"> *":{flex:0}},children:[jsxRuntimeExports.jsx(PropertyList,{event:jt,simple:!0}),jsxRuntimeExports.jsx(PropertyList,{event:Ut,simple:!0})]})})]}),jsxRuntimeExports.jsx(Stack$1,{className:Bt,direction:"row",sx:{p:1,justifyContent:"center",position:"absolute",right:0,alignItems:"center",top:0,height:"100%"},children:jsxRuntimeExports.jsx(PropertyDialog,{event:_e,trigger:Gt=>jsxRuntimeExports.jsx(IconButtonWithTooltip,{onClick:Gt,sx:{p:1.5,color:"text.secondary"},label:"See All Properties",icon:jsxRuntimeExports.jsx(DataObjectOutlined,{fontSize:"small"})})})})]})}function Skeleton({event:_e}){const{spacing:lt}=useTheme();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ListItem$1,{sx:{height:80,borderLeft:`${lt(.5)} solid ${getColorHex(_e==null?void 0:_e.type)}`},children:jsxRuntimeExports.jsx(ListItemIcon$1,{children:jsxRuntimeExports.jsx(Placeholder$3,{animation:!1,width:lt(4)})})}),jsxRuntimeExports.jsx(Divider$1,{variant:"inset"})]})}function lerp(_e,lt,Rt){return _e+lodashExports$1.clamp(Rt,0,1)*(lt-_e)}const ITEM_HEIGHT=80,PADDING_TOP=8,divider$2=jsxRuntimeExports.jsx(Divider$1,{orientation:"vertical",flexItem:!0,sx:{m:1}}),pxToInt=_e=>Number(_e.replace(/px$/,"")),SYMBOL_ALL=nanoid$1(),stepsLayerGuard=_e=>!!getLayerHandler(_e).steps;function useStepsPageState(_e,lt){const{key:Rt,setKey:At,layers:Pt,layer:Dt,allLayers:Lt}=useLayer(_e==null?void 0:_e.layer,stepsLayerGuard),[Bt,Nt]=reactExports.useState(_e==null?void 0:_e.selectedType);function jt(Gt){lt==null||lt({layer:Gt}),At(Gt)}function Ut(Gt){lt==null||lt({selectedType:Gt}),Nt(Gt)}return{setSelectedType:Ut,setKey:jt,selectedType:Bt,layers:Pt,allLayers:Lt,key:Rt,layer:Dt}}const getStepsPageDescription=_e=>_e?`${_e} contains 0 steps.`:"When you load a trace, you'll see its steps here.";function StepsPage({template:_e}){const{spacing:lt}=useTheme(),Rt=usePaper(),At=useAcrylic(),Pt=reactExports.useRef(null),[Dt,Lt]=reactExports.useState(null),{controls:Bt,onChange:Nt,state:jt,dragHandle:Ut}=useViewTreeContext(),{allLayers:Gt,key:qt,layers:Xt,selectedType:Kt,setKey:Zt,setSelectedType:Qt,layer:Jt}=useStepsPageState(jt,Nt),{step:en,playing:tn,stepTo:an}=usePlaybackState(qt),cn=reactExports.useMemo(()=>{if(Jt){const{steps:gn}=getLayerHandler(Jt);return gn(Jt)}},[Jt]),{steps:un,types:rn,stepToFilteredStep:sn,selectedType:pn}=reactExports.useMemo(()=>{if(cn){const gn=cn.map((Tn,An)=>[Tn,An]),_n=lodashExports$1.chain(gn).map(([Tn])=>Tn.type).filter().uniq().value(),xn=!_n.includes(Kt),ln=xn?gn:gn.filter(([Tn])=>Tn.type===Kt),{stepMap:Mn}=lodashExports$1.reduce(gn,(Tn,[,An])=>{const Cn=lodashExports$1.findIndex(ln,([,Fn])=>Fn>=An,Tn.from),wn=Cn===-1?ln.length:Cn;return Tn.from=wn,Tn.stepMap.push(wn),Tn},{from:0,stepMap:[]});return{steps:ln,types:_n,stepToFilteredStep:Tn=>Mn[Tn],selectedType:xn?SYMBOL_ALL:Kt}}return{}},[cn,Kt]),bn=useBreakpoints(qt);return reactExports.useEffect(()=>{if(sn&&Dt&&Pt.current){const gn=sn(en);if(tn){let _n=!1;const xn=ln=>{var Mn;if(!_n&&"scrollTop"in Dt&&!lodashExports$1.isUndefined(en)){const{scrollTop:Tn}=Dt,An=gn*ITEM_HEIGHT;(Mn=Pt.current)==null||Mn.scrollTo({top:lerp(Tn,An,1e-6*ln)}),requestAnimationFrame(xn)}};return requestAnimationFrame(xn),()=>{_n=!0}}else Pt.current.scrollToIndex({index:gn,behavior:"smooth",offset:-pxToInt(lt(12+PADDING_TOP))})}},[en,Pt,Dt,sn,tn]),jsxRuntimeExports.jsxs(_e,{onChange:Nt,stack:jt,children:[jsxRuntimeExports.jsx(_e.Title,{children:"Steps"}),jsxRuntimeExports.jsx(_e.Handle,{children:Ut}),jsxRuntimeExports.jsxs(_e.Content,{children:[jsxRuntimeExports.jsx(Flex,{vertical:!0,alignItems:"center",children:un?un.length?jsxRuntimeExports.jsx(LazyList,{sx:{width:"100%",height:"100%"},items:un,listOptions:{scrollerRef:Lt,ref:Pt,defaultItemHeight:ITEM_HEIGHT,overscan:0},renderItem:([gn,_n],xn)=>{var ln;return tn?jsxRuntimeExports.jsx(Box$1,{sx:{pt:xn?0:lt(6+PADDING_TOP)},children:jsxRuntimeExports.jsx(Skeleton,{event:gn})},xn):jsxRuntimeExports.jsxs(Box$1,{sx:{height:pxToInt(lt(xn?0:6+PADDING_TOP))+ITEM_HEIGHT,pt:xn?0:lt(6+PADDING_TOP)},children:[jsxRuntimeExports.jsx(EventInspector,{event:gn,index:_n,selected:_n===en,sx:{height:"100%"},label:(ln=bn(_n))==null?void 0:ln.result,onClick:()=>an(_n)}),jsxRuntimeExports.jsx(Divider$1,{variant:"inset"})]},xn)}}):jsxRuntimeExports.jsx(Placeholder$2,{icon:jsxRuntimeExports.jsx(StepsIcon,{}),label:"Steps",secondary:getStepsPageDescription(inferLayerName(Jt))}):jsxRuntimeExports.jsx(Placeholder$2,{icon:jsxRuntimeExports.jsx(StepsIcon,{}),label:"Steps",secondary:getStepsPageDescription()})}),!!(un!=null&&un.length)&&jsxRuntimeExports.jsxs(Stack$1,{direction:"row",sx:{...Rt(1),...At,alignItems:"center",position:"absolute",top:gn=>gn.spacing(6),height:gn=>gn.spacing(6),borderRadius:1,px:1,m:1},children:[jsxRuntimeExports.jsx(Playback,{layer:Jt}),divider$2,jsxRuntimeExports.jsx(Type$1,{component:"div",variant:"body2",color:"text.secondary",sx:{px:1,py:.25,textAlign:"center",...Rt(0),borderRadius:1},children:en})]})]}),jsxRuntimeExports.jsxs(_e.Options,{children:[jsxRuntimeExports.jsx(FeaturePicker,{icon:jsxRuntimeExports.jsx(LayersIcon,{}),label:"Layer",value:qt,items:lodashExports$1.map(Gt,gn=>({id:gn.key,hidden:!lodashExports$1.find(Xt,{key:gn.key}),name:inferLayerName(gn)})),onChange:Zt,arrow:!0,ellipsis:12}),divider$2,jsxRuntimeExports.jsx(FeaturePicker,{icon:jsxRuntimeExports.jsx(FiberManualRecordOutlined,{sx:{color:getColorHex(pn)}}),label:"Event Type",value:pn,items:[{id:SYMBOL_ALL,name:"All Events"},...lodashExports$1.map(rn,gn=>({id:`${gn}`,name:lodashExports$1.startCase(gn)}))],onChange:Qt,arrow:!0,ellipsis:12})]}),jsxRuntimeExports.jsx(_e.Extras,{children:Bt})]})}const itemHeight=_e=>_e?48:36,padding=8;function SelectMulti({trigger:_e,items:lt,value:Rt,onChange:At,placeholder:Pt="Select Options",defaultChecked:Dt}){const Lt=useSmallDisplay(),Bt=lodashExports$1.max([lodashExports$1.findIndex(lt,({value:Nt})=>!!(Rt!=null&&Rt[Nt])),0])??0;return jsxRuntimeExports.jsx(PopupState,{variant:"popover",children:Nt=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Tooltip$1,{title:Pt,children:jsxRuntimeExports.jsx("span",{children:_e==null?void 0:_e(bindTrigger(Nt))})}),jsxRuntimeExports.jsx(Menu$1,{...bindMenu(Nt),anchorOrigin:{horizontal:"center",vertical:-itemHeight(Lt)*Bt-padding},transformOrigin:{vertical:"top",horizontal:"center"},children:lodashExports$1.map(lt,({value:jt,label:Ut,disabled:Gt})=>jsxRuntimeExports.jsxs(MenuItem$1,{disabled:Gt,onClick:()=>{At==null||At({...Rt,[jt]:!((Rt==null?void 0:Rt[jt])??Dt)})},children:[jsxRuntimeExports.jsx(ListItemIcon$1,{children:jsxRuntimeExports.jsx(Checkbox$1,{sx:{p:0},checked:!!((Rt==null?void 0:Rt[jt])??Dt)})}),Ut]},jt))})]})})}function FeaturePickerMulti({label:_e,value:lt,onChange:Rt,items:At,icon:Pt,showArrow:Dt,defaultChecked:Lt,ellipsis:Bt=1/0}){var Ut;const Nt=lodashExports$1.filter(At,({id:Gt})=>!!((lt==null?void 0:lt[Gt])??Lt)),jt=Nt.length?Nt.length===1?(Ut=lodashExports$1.head(Nt))==null?void 0:Ut.name:`${Nt.length} Selected`:_e;return jsxRuntimeExports.jsx(SelectMulti,{defaultChecked:!0,placeholder:lodashExports$1.startCase(_e),trigger:Gt=>jsxRuntimeExports.jsx(FeaturePickerButton,{...Gt,disabled:!(At!=null&&At.length),icon:Pt,arrow:Dt,children:lodashExports$1.truncate(jt,{length:Bt})}),items:lodashExports$1.map(At,({id:Gt,name:qt,description:Xt,hidden:Kt})=>({value:Gt,label:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Type$1,{children:qt}),jsxRuntimeExports.jsx(Space,{}),jsxRuntimeExports.jsx(Type$1,{variant:"body2",color:"text.secondary",children:Xt})]}),disabled:Kt})),value:lt,onChange:Rt})}const divider$1=jsxRuntimeExports.jsx(Divider$1,{orientation:"vertical",flexItem:!0,sx:{m:1}});function ViewportPage({template:_e}){var Kt,Zt,Qt,Jt;const{controls:lt,onChange:Rt,state:At,dragHandle:Pt}=useViewTreeContext(),[Dt]=useRenderers(),[{layers:Lt}]=useLayers(),[Bt,Nt]=reactExports.useState({}),jt=reactExports.useMemo(()=>lodashExports$1.filter(Lt,en=>(Bt==null?void 0:Bt[en.key])??!0),[Bt,Lt]),[Ut,Gt]=reactExports.useState(),qt=reactExports.useMemo(()=>lodashExports$1.head(Dt),[Dt]),Xt=At!=null&&At.renderer&&At.renderer!=="internal:auto"?At.renderer:(Zt=(Kt=qt==null?void 0:qt.renderer)==null?void 0:Kt.meta)==null?void 0:Zt.id;return reactExports.useEffect(()=>{lodashExports$1.delay(()=>{var en;(en=Ut==null?void 0:Ut.fitCamera)==null||en.call(Ut,tn=>{var an;return lodashExports$1.chain(jt).filter("viewKey").map("key").includes(((an=tn.meta)==null?void 0:an.sourceLayer)??"").value()})},150)},[Ut,lodashExports$1.chain(jt).map("viewKey").sort().join(".").value()]),jsxRuntimeExports.jsxs(_e,{onChange:Rt,stack:At,children:[jsxRuntimeExports.jsx(_e.Title,{children:"Viewport"}),jsxRuntimeExports.jsx(_e.Handle,{children:Pt}),jsxRuntimeExports.jsx(_e.Content,{children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(AutoSizer,{children:en=>jsxRuntimeExports.jsx(Box$1,{children:jsxRuntimeExports.jsx(TraceRenderer,{...en,layers:jt,renderer:Xt,rendererRef:Gt})})})})}),jsxRuntimeExports.jsx(_e.Options,{children:jsxRuntimeExports.jsxs(Stack$1,{direction:"row",children:[jsxRuntimeExports.jsx(FeaturePicker,{label:"Renderer",icon:jsxRuntimeExports.jsx(BlurCircularOutlined,{}),value:(At==null?void 0:At.renderer)??"internal:auto",onChange:en=>Rt==null?void 0:Rt({renderer:en}),items:[{id:"internal:auto",name:`Auto (${((Jt=(Qt=qt==null?void 0:qt.renderer)==null?void 0:Qt.meta)==null?void 0:Jt.name)??"None"})`},...lodashExports$1.map(Dt,({renderer:en})=>({id:en.meta.id,name:en.meta.name,description:en.meta.id}))],arrow:!0}),divider$1,jsxRuntimeExports.jsx(FeaturePickerMulti,{defaultChecked:!0,label:"Layers",icon:jsxRuntimeExports.jsx(LayersIcon,{}),value:Bt,onChange:Nt,items:lodashExports$1.map(Lt,en=>({id:en.key,name:inferLayerName(en)})),showArrow:!0,ellipsis:12}),divider$1,jsxRuntimeExports.jsx(FeaturePickerButton,{disabled:!Ut,onClick:()=>{Ut==null||Ut.fitCamera()},icon:jsxRuntimeExports.jsx(CenterFocusStrongOutlined,{}),children:"Fit"}),jsxRuntimeExports.jsx(FeaturePickerButton,{disabled:!Ut,onClick:()=>{Ut==null||Ut.initialCamera()},icon:jsxRuntimeExports.jsx(CropFreeOutlined,{}),children:"1:1"})]})}),jsxRuntimeExports.jsx(_e.Extras,{children:lt})]})}const pages={explore:{id:"explore",name:"Explore",color:"pink",description:"Browse a library of examples and guides",icon:jsxRuntimeExports.jsx(RocketIcon,{}),content:ExplorePage,allowFullscreen:!0},viewport:{id:"viewport",name:"Viewport",description:"",color:"deepPurple",icon:jsxRuntimeExports.jsx(ViewportIcon,{}),content:ViewportPage,allowFullscreen:!0},layers:{id:"layers",name:"Layers",description:"",color:"deepPurple",icon:jsxRuntimeExports.jsx(LayersIcon,{}),content:LayersPage,allowFullscreen:!0},steps:{id:"steps",name:"Steps",description:"",color:"deepPurple",icon:jsxRuntimeExports.jsx(StepsIcon,{}),content:StepsPage,allowFullscreen:!0},tree:{id:"tree",name:"Tree",description:"",color:"deepPurple",icon:jsxRuntimeExports.jsx(TreeIcon,{}),content:TreePage,allowFullscreen:!0},debug:{id:"debug",name:"Debugger",description:"",color:"indigo",icon:jsxRuntimeExports.jsx(DebuggerIcon,{}),content:DebugPage,allowFullscreen:!0},info:{id:"info",name:"Logs",description:"",color:"grey",icon:jsxRuntimeExports.jsx(LogsIcon,{}),content:InfoPage,allowFullscreen:!0},settings:{id:"settings",name:"Settings",description:"",color:"grey",icon:jsxRuntimeExports.jsx(SettingsIcon,{}),content:SettingsPage,allowFullscreen:!0}},ErrorBoundaryContext=reactExports.createContext(null),initialState={didCatch:!1,error:null};class ErrorBoundary extends reactExports.Component{constructor(lt){super(lt),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=initialState}static getDerivedStateFromError(lt){return{didCatch:!0,error:lt}}resetErrorBoundary(){const{error:lt}=this.state;if(lt!==null){for(var Rt,At,Pt=arguments.length,Dt=new Array(Pt),Lt=0;Lt0&&arguments[0]!==void 0?arguments[0]:[],lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return _e.length!==lt.length||_e.some((Rt,At)=>!Object.is(Rt,lt[At]))}function _extends(){return _extends=Object.assign||function(_e){for(var lt=1;lt=0)&&(Rt[Pt]=_e[Pt]);return Rt}var EXCLUDED_NAMES=["PropTypes"],getSlotProps=function _e(lt,Rt){return reactExports.Children.toArray(lt).reduce(function(At,Pt){if(reactExports.isValidElement(Pt)){var Dt=Pt.type.displayName;Rt!=null&&Rt.includes(Dt)&&(At[Dt]=Pt.props)}return At},{})},getCleanChildren=function _e(lt,Rt){var At=reactExports.Children.toArray(lt).filter(function(Pt){if(reactExports.isValidElement(Pt)){var Dt=Pt.type.displayName;return!(Rt!=null&&Rt.includes(Dt))}return!0});return At.length>0?At:void 0},isComponentName=function _e(lt){return typeof lt=="string"&&!EXCLUDED_NAMES.includes(lt)&<.match(/^[A-Z0-9]/)},createResultComponent=function _e(lt){var Rt=reactExports.memo(function(At){var Pt=At.children,Dt=At.propagateSlotProps,Lt=At.slotKeys,Bt=Lt===void 0?[]:Lt,Nt=_objectWithoutPropertiesLoose(At,["children","propagateSlotProps","slotKeys"]),jt=reactExports.useMemo(function(){return getSlotProps(Pt,Bt)},[Bt,Pt]),Ut=reactExports.useMemo(function(){return getCleanChildren(Pt,Bt)},[Bt,Pt]),Gt=reactExports.useMemo(function(){return _extends({},Nt,{slotProps:_extends({},Dt,jt)})},[Nt,jt,Dt]);return reactExports.createElement(lt,Gt,Ut)});return Rt},withSlots=function _e(lt){var Rt=reactExports.memo(createResultComponent(lt));Rt.displayName="WithSlots("+(lt.displayName||lt.name)+")";var At=new Proxy(Rt,{get:function(Dt,Lt,Bt){var Nt;if(Lt in Dt||typeof Lt=="symbol"||!isComponentName(Lt))return Reflect.get(Dt,Lt,Bt);var jt=((Nt=Reflect.get(Dt,"defaultProps"))==null?void 0:Nt.slotKeys)||[],Ut=Reflect.get(Dt,Lt);if(!Ut){var Gt=function(){return null};Gt.displayName=Lt,Reflect.set(Dt,Lt,Gt)}return Reflect.set(Dt,"defaultProps",_extends({},Dt.defaultProps,{slotKeys:[].concat(jt,[Lt])})),Reflect.get(Dt,Lt,Bt)}});return At};const divider=jsxRuntimeExports.jsx(Divider$1,{orientation:"vertical",flexItem:!0,sx:{m:1,height:_e=>_e.spacing(3),alignSelf:"auto"}}),Page=withSlots(({slotProps:_e,onChange:lt,stack:Rt})=>{var Pt,Dt,Lt,Bt;const At=useAcrylic();return jsxRuntimeExports.jsx(ErrorBoundary,{fallback:jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:"This page encountered an error."}),children:jsxRuntimeExports.jsxs(Flex,{vertical:!0,children:[jsxRuntimeExports.jsx(Flex,{sx:{position:"absolute",top:0,left:0,width:"100%"},children:jsxRuntimeExports.jsx(Box$1,{sx:{width:"100%",height:"100%",bgcolor:"background.paper"},children:(Pt=_e.Content)==null?void 0:Pt.children})}),jsxRuntimeExports.jsxs(Flex,{sx:{height:Nt=>Nt.spacing(6)},children:[jsxRuntimeExports.jsx(Flex,{sx:{p:0,position:"absolute",top:0,left:0,width:"100%",borderBottom:1,borderColor:"divider",alignItems:"center",pr:6,...At},children:jsxRuntimeExports.jsx(Scroll,{x:!0,children:jsxRuntimeExports.jsxs(Flex,{sx:{width:"max-content",height:Nt=>Nt.spacing(6),alignItems:"center",p:1},children:[(Dt=_e.Handle)==null?void 0:Dt.children,jsxRuntimeExports.jsx(FeaturePicker,{icon:jsxRuntimeExports.jsx(WidgetsOutlined,{}),label:"Choose View",onChange:Nt=>lt==null?void 0:lt({...Rt,type:Nt}),value:Rt==null?void 0:Rt.type,items:lodashExports$1.values(pages),itemOrientation:"vertical"}),((Lt=_e.Options)==null?void 0:Lt.children)&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[divider,_e.Options.children]})]})})}),jsxRuntimeExports.jsx(Space,{sx:{mx:"auto"}}),(Bt=_e.Extras)==null?void 0:Bt.children]})]})})}),SidebarPage=withSlots(({slotProps:_e})=>{var At,Pt,Dt;const lt=useSidebarBackground(),Rt=useAcrylic(lt);return jsxRuntimeExports.jsx(ErrorBoundary,{fallback:jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:"This page encountered an error."}),children:jsxRuntimeExports.jsxs(Flex,{vertical:!0,children:[jsxRuntimeExports.jsx(Flex,{sx:{position:"absolute",top:0,left:0,width:"100%"},children:jsxRuntimeExports.jsx(Box$1,{sx:{width:"100%",height:"100%",bgcolor:lt},children:(At=_e.Content)==null?void 0:At.children})}),jsxRuntimeExports.jsx(Flex,{sx:{height:Lt=>Lt.spacing(6)},children:jsxRuntimeExports.jsx(Flex,{sx:{p:0,position:"absolute",top:0,left:0,width:"100%",borderBottom:1,borderColor:"divider",alignItems:"center",...Rt},children:jsxRuntimeExports.jsx(Scroll,{x:!0,children:jsxRuntimeExports.jsxs(Flex,{sx:{width:"max-content",height:Lt=>Lt.spacing(6),alignItems:"center",p:1},children:[jsxRuntimeExports.jsx(Type$1,{sx:{p:1,color:"text.secondary"},children:(Pt=_e.Title)==null?void 0:Pt.children}),((Dt=_e.Options)==null?void 0:Dt.children)&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[divider,_e.Options.children]})]})})})})]})})}),defaultRoot={type:"branch",orientation:"horizontal",key:nanoid$1(),children:[{type:"leaf",content:{type:"explore"},key:nanoid$1(),size:30},{type:"leaf",content:void 0,key:nanoid$1(),size:70}]},LEFT=0,RIGHT=1;function useSidebarState(){const[_e,lt]=reactExports.useState(!1),[Rt,At]=reactExports.useState(defaultRoot),Pt=Nt=>At(produce(Rt,Nt)),{Content:Dt,derivedRoot:Lt,tab:Bt}=reactExports.useMemo(()=>{var qt;const Nt=lodashExports$1.get(Rt,`children[${LEFT}].content.type`)??"",jt=(qt=pages[Nt])==null?void 0:qt.content,Ut=_e?Rt:lodashExports$1.get(Rt,`children[${RIGHT}]`);return{Content:jt,derivedRoot:Ut,tab:_e?Nt:""}},[Rt,_e]);return{Content:Dt,tab:Bt,root:Lt,open:_e,setOpen:lt,produceRoot:Pt,setRoot:At}}function useSidebarBackground(){const{palette:_e}=useTheme();return reactExports.useMemo(()=>interpolate$2([_e.background.paper,_e.text.primary])(_e.mode==="dark"?.0125:.025),[_e])}function Sidebar({children:_e}){const{Content:lt,produceRoot:Rt,root:At,setRoot:Pt,setOpen:Dt,tab:Lt}=useSidebarState(),Bt=useSidebarBackground();return jsxRuntimeExports.jsx(TabContext,{value:Lt,children:jsxRuntimeExports.jsxs(Stack$1,{direction:"row",sx:{width:"100%"},children:[jsxRuntimeExports.jsx(Stack$1,{sx:{width:64,bgcolor:Bt,alignItems:"center",p:1,gap:1,borderRight:Nt=>`1px solid ${Nt.palette.mode==="dark"?Nt.palette.background.default:Nt.palette.divider}`},children:jsxRuntimeExports.jsx(TabList$1,{TabIndicatorProps:{sx:{left:0,right:"auto"}},onChange:(Nt,jt)=>{Rt(Ut=>void lodashExports$1.set(Ut,`children[${LEFT}].content.type`,jt)),Dt(!0)},orientation:"vertical",sx:{width:64},children:lodashExports$1.values(pages).flatMap((Nt,jt,Ut)=>[!!jt&&Nt.color!==Ut[jt-1].color&&jsxRuntimeExports.jsx(Divider$1,{sx:{mx:2,my:1}}),jsxRuntimeExports.jsx(Tab$1,{onClick:()=>Lt===Nt.id?Dt(!1):Dt(!0),value:Nt.id,sx:{minWidth:0,alignItems:"center",justifyContent:"center"},label:jsxRuntimeExports.jsx(Tooltip$1,{title:Nt.name,placement:"right",children:jsxRuntimeExports.jsx(Box$1,{sx:{alignItems:"center",display:"flex","> svg > path":{strokeWidth:.5,stroke:Bt}},children:Nt.icon})},Nt.id)},Nt.id)])})}),jsxRuntimeExports.jsx(Box$1,{sx:{flex:1},children:jsxRuntimeExports.jsx(ViewTree,{onChange:Pt,root:At,renderLeaf:Nt=>Nt.content?jsxRuntimeExports.jsx(Stack$1,{direction:"row",sx:{width:"100%",bgcolor:Bt},children:!!lt&&jsxRuntimeExports.jsx(Box$1,{sx:{flex:1,height:"100%"},children:jsxRuntimeExports.jsx(lt,{template:SidebarPage})})}):jsxRuntimeExports.jsx(Fade$1,{in:!0,children:jsxRuntimeExports.jsx(Flex,{children:_e})})})})]})})}function PlaceholderPage({template:_e}){const{controls:lt,onChange:Rt,state:At,dragHandle:Pt}=useViewTreeContext();return jsxRuntimeExports.jsxs(_e,{onChange:Rt,stack:At,children:[jsxRuntimeExports.jsx(_e.Handle,{children:Pt}),jsxRuntimeExports.jsx(_e.Content,{children:jsxRuntimeExports.jsx(Placeholder$2,{label:"Empty Panel",secondary:"Choose a view to populate this panel."})}),jsxRuntimeExports.jsx(_e.Extras,{children:lt})]})}var FileDrop$1={},__extends=commonjsGlobal&&commonjsGlobal.__extends||function(){var _e=function(lt,Rt){return _e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(At,Pt){At.__proto__=Pt}||function(At,Pt){for(var Dt in Pt)Pt.hasOwnProperty(Dt)&&(At[Dt]=Pt[Dt])},_e(lt,Rt)};return function(lt,Rt){_e(lt,Rt);function At(){this.constructor=lt}lt.prototype=Rt===null?Object.create(Rt):(At.prototype=Rt.prototype,new At)}}(),__importDefault=commonjsGlobal&&commonjsGlobal.__importDefault||function(_e){return _e&&_e.__esModule?_e:{default:_e}};Object.defineProperty(FileDrop$1,"__esModule",{value:!0});var prop_types_1=__importDefault(propTypesExports),react_1=__importDefault(reactExports),FileDrop=function(_e){__extends(lt,_e);function lt(Rt){var At=_e.call(this,Rt)||this;return At.resetDragging=function(){At.frameDragCounter=0,At.setState({draggingOverFrame:!1,draggingOverTarget:!1})},At.handleWindowDragOverOrDrop=function(Pt){Pt.preventDefault()},At.handleFrameDrag=function(Pt){if(lt.eventHasFiles(Pt)){if(At.frameDragCounter+=Pt.type==="dragenter"?1:-1,At.frameDragCounter===1){At.setState({draggingOverFrame:!0}),At.props.onFrameDragEnter&&At.props.onFrameDragEnter(Pt);return}if(At.frameDragCounter===0){At.setState({draggingOverFrame:!1}),At.props.onFrameDragLeave&&At.props.onFrameDragLeave(Pt);return}}},At.handleFrameDrop=function(Pt){At.state.draggingOverTarget||(At.resetDragging(),At.props.onFrameDrop&&At.props.onFrameDrop(Pt))},At.handleDragOver=function(Pt){lt.eventHasFiles(Pt)&&(At.setState({draggingOverTarget:!0}),!lt.isIE()&&At.props.dropEffect&&(Pt.dataTransfer.dropEffect=At.props.dropEffect),At.props.onDragOver&&At.props.onDragOver(Pt))},At.handleDragLeave=function(Pt){At.setState({draggingOverTarget:!1}),At.props.onDragLeave&&At.props.onDragLeave(Pt)},At.handleDrop=function(Pt){if(At.props.onDrop&<.eventHasFiles(Pt)){var Dt=Pt.dataTransfer?Pt.dataTransfer.files:null;At.props.onDrop(Dt,Pt)}At.resetDragging()},At.handleTargetClick=function(Pt){At.props.onTargetClick&&At.props.onTargetClick(Pt),At.resetDragging()},At.stopFrameListeners=function(Pt){Pt&&(Pt.removeEventListener("dragenter",At.handleFrameDrag),Pt.removeEventListener("dragleave",At.handleFrameDrag),Pt.removeEventListener("drop",At.handleFrameDrop))},At.startFrameListeners=function(Pt){Pt&&(Pt.addEventListener("dragenter",At.handleFrameDrag),Pt.addEventListener("dragleave",At.handleFrameDrag),Pt.addEventListener("drop",At.handleFrameDrop))},At.frameDragCounter=0,At.state={draggingOverFrame:!1,draggingOverTarget:!1},At}return lt.prototype.componentDidMount=function(){this.startFrameListeners(this.props.frame),this.resetDragging(),window.addEventListener("dragover",this.handleWindowDragOverOrDrop),window.addEventListener("drop",this.handleWindowDragOverOrDrop)},lt.prototype.componentDidUpdate=function(Rt){Rt.frame!==this.props.frame&&(this.resetDragging(),this.stopFrameListeners(Rt.frame),this.startFrameListeners(this.props.frame))},lt.prototype.componentWillUnmount=function(){this.stopFrameListeners(this.props.frame),window.removeEventListener("dragover",this.handleWindowDragOverOrDrop),window.removeEventListener("drop",this.handleWindowDragOverOrDrop)},lt.prototype.render=function(){var Rt=this.props,At=Rt.children,Pt=Rt.className,Dt=Rt.targetClassName,Lt=Rt.draggingOverFrameClassName,Bt=Rt.draggingOverTargetClassName,Nt=this.state,jt=Nt.draggingOverTarget,Ut=Nt.draggingOverFrame,Gt=Dt;return Ut&&(Gt+=" "+Lt),jt&&(Gt+=" "+Bt),react_1.default.createElement("div",{className:Pt,onDragOver:this.handleDragOver,onDragLeave:this.handleDragLeave,onDrop:this.handleDrop},react_1.default.createElement("div",{className:Gt,onClick:this.handleTargetClick},At))},lt.isIE=function(){return typeof window<"u"&&(window.navigator.userAgent.indexOf("MSIE")!==-1||window.navigator.appVersion.indexOf("Trident/")>0)},lt.eventHasFiles=function(Rt){var At=!1;if(Rt.dataTransfer){var Pt=Rt.dataTransfer.types;for(var Dt in Pt)if(Pt[Dt]==="Files"){At=!0;break}}return At},lt.propTypes={className:prop_types_1.default.string,targetClassName:prop_types_1.default.string,draggingOverFrameClassName:prop_types_1.default.string,draggingOverTargetClassName:prop_types_1.default.string,onDragOver:prop_types_1.default.func,onDragLeave:prop_types_1.default.func,onDrop:prop_types_1.default.func,onTargetClick:prop_types_1.default.func,dropEffect:prop_types_1.default.oneOf(["copy","move","link","none"]),frame:function(Rt,At,Pt){var Dt=Rt[At];if(Dt==null)return new Error("Warning: Required prop `"+At+"` was not specified in `"+Pt+"`");if(Dt!==document&&!(Dt instanceof HTMLElement))return new Error("Warning: Prop `"+At+"` must be one of the following: document, HTMLElement!")},onFrameDragEnter:prop_types_1.default.func,onFrameDragLeave:prop_types_1.default.func,onFrameDrop:prop_types_1.default.func},lt.defaultProps={dropEffect:"copy",frame:typeof window>"u"?void 0:window.document,className:"file-drop",targetClassName:"file-drop-target",draggingOverFrameClassName:"file-drop-dragging-over-frame",draggingOverTargetClassName:"file-drop-dragging-over-target"},lt}(react_1.default.PureComponent),FileDrop_2=FileDrop$1.FileDrop=FileDrop;function FileDropZone(){const _e=useAcrylic(),{load:lt}=useWorkspace(),[Rt,At]=reactExports.useState(0),[,Pt]=useLayers(),Dt=useBusyState("file-drop-import"),Lt=useSnackbar();async function Bt(Nt){let jt=0;for(const[Ut,Gt]of Nt.map((...qt)=>qt))for(const[qt,{claimImportedFile:Xt}]of lodashExports$1.entries(layerHandlers)){const Kt=await(Xt==null?void 0:Xt(Ut));if(Kt!=null&&Kt.claimed){await Dt(async()=>{const Zt=await Kt.layer(Lt);Pt(producify(Qt=>Qt.layers.push({key:nanoid$1(),source:{type:qt,...Zt}})))},`${Gt+1} of ${Nt.length}: Importing ${qt} (${formatByte(Ut.size)})`),jt+=1;continue}}!jt&&await lt(lodashExports$1.head(Nt))||Lt(`Couldn't open ${Nt.length} of ${pluralize("file",Nt.length,!0)}`)}return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(FileDrop_2,{onFrameDragLeave:()=>At(0),onFrameDragEnter:Nt=>{var jt;return At(((jt=Nt==null?void 0:Nt.dataTransfer)==null?void 0:jt.items.length)??0)},onFrameDrop:()=>At(0),onDragLeave:()=>At(0),onDrop:Nt=>Nt&&Bt(Array.from(Nt)),children:jsxRuntimeExports.jsx(Backdrop$1,{sx:{..._e,zIndex:Nt=>Nt.zIndex.tooltip+1},open:!!Rt,children:jsxRuntimeExports.jsxs(Stack$1,{alignItems:"center",spacing:4,children:[jsxRuntimeExports.jsx(WorkspacesOutlined,{}),jsxRuntimeExports.jsx(Type$1,{variant:"body2",color:"text.secondary",children:Rt?`Import ${pluralize("item",Rt,!0)}`:""})]})})})})}function wait(_e){return new Promise(lt=>lodashExports$1.delay(lt,_e))}async function timed(_e,lt=2500){const Rt=lodashExports$1.now();return{result:await Promise.any([_e(),wait(lt)]),delta:lodashExports$1.now()-Rt}}const FullscreenPage=withSlots(({slotProps:_e})=>{var Rt,At,Pt,Dt;const lt=useSmallDisplay();return jsxRuntimeExports.jsxs(Box$1,{sx:{height:"100%"},children:[!!((Rt=_e.Options)!=null&&Rt.children)&&jsxRuntimeExports.jsx(Flex,{sx:{height:Lt=>Lt.spacing(6)},children:jsxRuntimeExports.jsxs(Flex,{sx:{p:0,zIndex:1,position:"absolute",top:0,left:0,width:"100%",borderBottom:1,borderColor:"divider",alignItems:"center",pr:6,background:Lt=>Lt.palette.background.paper},children:[jsxRuntimeExports.jsx(Scroll,{x:!0,children:jsxRuntimeExports.jsx(Flex,{sx:{width:"max-content",height:Lt=>Lt.spacing(6),alignItems:"center",p:1},children:((At=_e.Options)==null?void 0:At.children)&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:_e.Options.children})})}),(Pt=_e.Extras)==null?void 0:Pt.children]})}),jsxRuntimeExports.jsx(Box$1,{sx:{bgcolor:"background.paper",mt:-6,height:"100%"},children:jsxRuntimeExports.jsx(Scroll,{y:!0,style:{height:lt?"100%":"70vh"},children:(Dt=_e.Content)==null?void 0:Dt.children})})]})});function FullscreenModalHost(){const[{fullscreenModal:_e},lt]=useUIState(),[Rt,At]=reactExports.useState(!1);async function Pt(){At(!0),await wait(300),lt(()=>({fullscreenModal:void 0})),At(!1)}const Dt=_e?pages[_e]:void 0,Lt=reactExports.useMemo(()=>{if(Dt){const Bt=Dt.content,Nt=withSlots(({slotProps:jt,...Ut})=>{var Gt,qt,Xt;return jsxRuntimeExports.jsxs(FullscreenPage,{...Ut,children:[jsxRuntimeExports.jsx(FullscreenPage.Content,{children:(Gt=jt.Content)==null?void 0:Gt.children}),jsxRuntimeExports.jsx(FullscreenPage.Options,{children:(qt=jt.Options)==null?void 0:qt.children}),jsxRuntimeExports.jsx(FullscreenPage.Extras,{children:(Xt=jt.Extras)==null?void 0:Xt.children})]})});return jsxRuntimeExports.jsx(Bt,{template:Nt})}},[_e,Dt]);return!!Dt&&jsxRuntimeExports.jsxs(Modal,{open:!Rt,onClose:Pt,width:"70vw",children:[jsxRuntimeExports.jsx(ModalAppBar,{onClose:Pt,children:jsxRuntimeExports.jsx(Type$1,{variant:"h6",children:Dt.name})}),Lt]})}function FullscreenProgress(){const[_e]=useBusy(),lt=useAcrylic(),Rt=lodashExports$1.values(_e);return jsxRuntimeExports.jsx(Backdrop$1,{sx:{...lt,zIndex:At=>At.zIndex.tooltip+1,WebkitAppRegion:"drag"},open:!!Rt.length,children:jsxRuntimeExports.jsxs(Stack$1,{alignItems:"center",spacing:4,children:[jsxRuntimeExports.jsx(CircularProgress$1,{}),Rt.map((At,Pt)=>jsxRuntimeExports.jsx(Type$1,{variant:"body2",color:"textSecondary",children:At},Pt))]})})}function Inspector(_e){const lt=useAnyLoading(),[{view:Rt},At]=useView(),[,Pt]=useUIState();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Flex,{..._e,children:jsxRuntimeExports.jsx(Sidebar,{children:jsxRuntimeExports.jsx(ViewTree,{onPopOut:Dt=>Pt(()=>{var Lt;return{fullscreenModal:(Lt=Dt.content)==null?void 0:Lt.type}}),canPopOut:Dt=>{var Lt;return!!((Lt=pages[Dt.content.type])!=null&&Lt.allowFullscreen)},root:Rt,onChange:Dt=>At(()=>({view:Dt})),renderLeaf:({content:Dt})=>{var Bt;const Lt=((Bt=pages[(Dt==null?void 0:Dt.type)??""])==null?void 0:Bt.content)??PlaceholderPage;return jsxRuntimeExports.jsx(Box$1,{sx:{width:"100%",height:"100%"},children:jsxRuntimeExports.jsx(Lt,{template:Page})})}})})}),jsxRuntimeExports.jsx(Fade$1,{in:lt,children:jsxRuntimeExports.jsx(LinearProgress$1,{variant:"indeterminate",sx:{position:"absolute",bottom:0,width:"100%",zIndex:1}})}),jsxRuntimeExports.jsx(FullscreenModalHost,{}),jsxRuntimeExports.jsx(FullscreenProgress,{}),jsxRuntimeExports.jsx(FileDropZone,{})]})}const getForegroundColor=_e=>getContrastRatio(_e,"#ffffff")>getContrastRatio(_e,"#000000")?"#ffffff":"#000000";function useTitleBar(_e){reactExports.useEffect(()=>{lodashExports$1.defer(()=>document.querySelector('meta[name="theme-color"]').setAttribute("content",_e)),document.title=name,"electron"in window&&window.electron.invoke("title-bar","#00000000",getForegroundColor(_e))},[_e])}function ConnectionsService(){const _e=useSnackbar(),[{remote:lt}]=useSettings(),[,Rt]=useConnections(),At=useLoadingState("connections");return reactExports.useEffect(()=>{let Pt=!1,Dt=[];return At(async()=>{if(lt!=null&<.length){for(const{transport:Lt,url:Bt,disabled:Nt}of lt){if(Nt!==!0){_e(`Connecting to ${Bt}...`);const jt=new(getTransport(Lt))({url:Bt});await jt.connect();const{result:Ut,delta:Gt}=await timed(()=>jt.call("about"));Ut?(_e(`Connected to ${Ut.name}`),Dt=[...Dt,{...Ut,url:Bt,ping:Gt,transport:()=>jt}]):await jt.disconnect()}Pt||Rt(()=>Dt)}Pt||_e(`Connected to ${Dt.length} of ${lt.length} solvers`)}}),()=>{Pt=!0,Dt.map(Lt=>Lt.transport().disconnect())}},[lt,Rt,_e,At]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}function withSource(_e){return lt=>({...lt,source:_e})}const getFeatures=async({transport:_e,url:lt})=>lodashExports$1.chain(await map$6(["algorithms","formats","maps","traces"],async Rt=>{const{result:At}=await timed(()=>_e().call(`features/${Rt}`),1e3);return{prop:Rt,result:lodashExports$1.map(At,withSource(lt))}})).keyBy("prop").mapValues("result").value();function FeaturesService(){const[_e]=useConnections(),[,lt]=useFeatures(),[{connections:Rt}]=useLoading();return useAsyncAbortable(async At=>{if(!Rt){const Pt={default:{algorithms:[],formats:lodashExports$1.keys(mapParsers).map(Lt=>({id:Lt,source:"internal"})),traces:[],maps:[]}},Dt=()=>{if(!At.aborted){const Lt=lodashExports$1.chain(Pt).values().reduce((Bt,Nt)=>lodashExports$1.mergeWith({},Bt,Nt,(jt,Ut)=>lodashExports$1.isArray(jt)?lodashExports$1.uniqBy([...jt,...Ut],"id"):void 0)).value();lt(()=>Lt)}};for(const Lt of _e){const Bt=async()=>{Pt[Lt.url]=await getFeatures(Lt),Dt()};Lt.transport().on("features/changed",Bt),Bt()}}},[_e,getFeatures,lt,Rt]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}function useLayerServices(){const[{layers:_e},lt]=useLayers();return reactExports.useMemo(()=>lodashExports$1.map(_e,Rt=>{const At=getLayerHandler(Rt).service;if(At)return reactExports.createElement(At,{key:Rt.key,value:Rt,onChange:Pt=>lt(({layers:Dt})=>({layers:lodashExports$1.map(Dt,Lt=>Lt.key===Rt.key?Pt(Lt):Lt)}))})}),[_e,lt])}function LayerService(){const _e=useLayerServices();return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:_e})}var dist={},ConsoleCapture$1={},logs={};Object.defineProperty(logs,"__esModule",{value:!0});logs.overridableFunctionNames=void 0;logs.overridableFunctionNames=["log","warn","info","debug","error"];Object.defineProperty(ConsoleCapture$1,"__esModule",{value:!0});ConsoleCapture$1.ConsoleCapture=void 0;var logs_1=logs;console.original={};var ConsoleCapture=function(){function _e(){_e.captures=[]}return _e.saveLog=function(lt,Rt){var At=Rt.map(function(Pt){return typeof Pt=="object"?Pt instanceof Error?JSON.stringify(Pt,Object.getOwnPropertyNames(Pt)):JSON.stringify(Pt):Pt});_e.captures.push({function:lt,args:At,ts:Date.now()})},_e.setNewFunctions=function(lt){lt===void 0&&(lt=!1);var Rt={apply:function(At,Pt,Dt){if(_e.saveLog(At.name,Dt),At.bind(Pt),lt)return At.apply(void 0,Dt)}};logs_1.overridableFunctionNames.forEach(function(At){_e.consoleOverriden||(console.original[At]=console[At]),console[At]=new Proxy(console[At],Rt)}),_e.consoleOverriden=!0},_e.resetToOriginalFunctions=function(){_e.consoleOverriden&&logs_1.overridableFunctionNames.forEach(function(lt){console[lt]=console.original[lt]}),_e.consoleOverriden=!1},_e.prototype.start=function(lt){lt===void 0&&(lt=!1),_e.captures=[],_e.setNewFunctions(lt)},_e.prototype.stop=function(){_e.resetToOriginalFunctions()},_e.prototype.flush=function(){_e.captures=[]},_e.prototype.getCaptures=function(){return _e.captures},_e.makeOriginalLog=function(lt){if(_e.resetToOriginalFunctions(),logs_1.overridableFunctionNames.includes(lt.function)){var Rt=lt.args.map(function(At){if(typeof At=="string")try{var Pt=JSON.parse(At);return Pt.stack?Pt.stack:Pt}catch{return At}return At});console[lt.function].apply(console,Rt)}else throw Error("Invalid Log type")},_e.consoleOverriden=!1,_e}();ConsoleCapture$1.ConsoleCapture=ConsoleCapture;Object.defineProperty(dist,"__esModule",{value:!0});var ConsoleCapture_1=ConsoleCapture$1;dist.default=ConsoleCapture_1.ConsoleCapture;function LogCaptureService(){return useSnackbar(),reactExports.useEffect(()=>{},[]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}function SettingsService(){const[{"behaviour/showOnStart":_e},,lt]=useSettings(),[,Rt]=useUIState();return reactExports.useEffect(()=>{_e&<&&Rt(()=>({fullscreenModal:_e}))},[lt]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}function SliceProvider({slices:_e,children:lt,services:Rt}){return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:lodashExports$1.reduce(lodashExports$1.map(_e,At=>reactExports.createElement(At)),(At,Pt)=>reactExports.cloneElement(Pt,{},At),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[lt,lodashExports$1.map(Rt,(At,Pt)=>reactExports.createElement(At,{key:Pt}))]}))})}const services=[ConnectionsService,FeaturesService,RendererService,LayerService,LogCaptureService,SettingsService];function App(){const{palette:_e}=useTheme(),lt=_e.background.default;return useTitleBar(lt),jsxRuntimeExports.jsxs(Flex,{vertical:!0,sx:{bgcolor:lt,color:"text.primary"},children:[jsxRuntimeExports.jsx(TitleBar,{}),jsxRuntimeExports.jsx(Flex,{flex:1,children:jsxRuntimeExports.jsx(Inspector,{flex:1})})]})}function ThemedApp(){const[{"appearance/theme":_e="light","appearance/accentColor":lt="teal"}]=useSettings(),Rt=reactExports.useMemo(()=>makeTheme(_e,lt),[_e,lt]);return jsxRuntimeExports.jsx(ThemeProvider,{theme:Rt,children:jsxRuntimeExports.jsx(SnackbarProvider,{children:jsxRuntimeExports.jsx(SliceProvider,{services,children:jsxRuntimeExports.jsx(App,{})})})})}const index="",overlayscrollbars="";var createRoot,m=reactDomExports;createRoot=m.createRoot,m.hydrateRoot;const root=createRoot(document.getElementById("root")),slices=[BusyProvider,SettingsProvider,ConnectionsProvider,FeaturesProvider,UIStateProvider,LoadingProvider,RendererProvider,LogProvider,ViewProvider,LayersProvider,ScreenshotsProvider];root.render(jsxRuntimeExports.jsx(CssBaseline,{children:jsxRuntimeExports.jsx(SliceProvider,{slices,children:jsxRuntimeExports.jsx(ThemedApp,{})})})); + }`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(_e){this._stylesheet!==_e&&(this._stylesheet=_e,this.styleID++)}normalizeColor(_e){return Array.isArray(_e)&&(_e=rgb2hex(_e)),typeof _e=="number"?hex2string(_e):_e}dropShadowToCSS(){let _e=this.normalizeColor(this.dropShadowColor);const lt=this.dropShadowAlpha,Rt=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),At=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);_e.startsWith("#")&<<1&&(_e+=(lt*255|0).toString(16).padStart(2,"0"));const Pt=`${Rt}px ${At}px`;return this.dropShadowBlur>0?`text-shadow: ${Pt} ${this.dropShadowBlur}px ${_e}`:`text-shadow: ${Pt} ${_e}`}reset(){Object.assign(this,_HTMLTextStyle.defaultOptions)}onBeforeDraw(){const{fontsDirty:_e}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&_e?new Promise(lt=>setTimeout(lt,100)):Promise.resolve()}get isSafari(){const{userAgent:_e}=settings.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(_e)}set fillGradientStops(_e){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(_e){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(_e){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(_e){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(_e){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(_e){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(_e){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};let HTMLTextStyle=_HTMLTextStyle;HTMLTextStyle.availableFonts={};HTMLTextStyle.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};const _HTMLText=class extends Sprite{constructor(_e="",lt={}){super(Texture.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this._loading=!1,this.localStyleID=-1,this.dirty=!1,this.ownsStyle=!1;const Rt=new Image,At=Texture.from(Rt,{scaleMode:settings.SCALE_MODE,resourceOptions:{autoLoad:!1}});At.orig=new Rectangle,At.trim=new Rectangle,this.texture=At;const Pt="http://www.w3.org/2000/svg",Dt="http://www.w3.org/1999/xhtml",Lt=document.createElementNS(Pt,"svg"),Bt=document.createElementNS(Pt,"foreignObject"),Nt=document.createElementNS(Dt,"div"),jt=document.createElementNS(Dt,"style");Bt.setAttribute("width","10000"),Bt.setAttribute("height","10000"),Bt.style.overflow="hidden",Lt.appendChild(Bt),this.maxWidth=_HTMLText.defaultMaxWidth,this.maxHeight=_HTMLText.defaultMaxHeight,this._domElement=Nt,this._styleElement=jt,this._svgRoot=Lt,this._foreignObject=Bt,this._foreignObject.appendChild(jt),this._foreignObject.appendChild(Nt),this._image=Rt,this._loadImage=new Image,this._autoResolution=_HTMLText.defaultAutoResolution,this._resolution=_HTMLText.defaultResolution??settings.RESOLUTION,this.text=_e,this.style=lt}measureText(_e){var Bt,Nt;const{text:lt,style:Rt,resolution:At}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},_e);Object.assign(this._domElement,{innerHTML:lt,style:Rt.toCSS(At)}),this._styleElement.textContent=Rt.toGlobalCSS(),document.body.appendChild(this._svgRoot);const Pt=this._domElement.getBoundingClientRect();this._svgRoot.remove();const Dt=Math.min(this.maxWidth,Math.ceil(Pt.width)),Lt=Math.min(this.maxHeight,Math.ceil(Pt.height));return this._svgRoot.setAttribute("width",Dt.toString()),this._svgRoot.setAttribute("height",Lt.toString()),lt!==this._text&&(this._domElement.innerHTML=this._text),Rt!==this._style&&(Object.assign(this._domElement,{style:(Bt=this._style)==null?void 0:Bt.toCSS(At)}),this._styleElement.textContent=(Nt=this._style)==null?void 0:Nt.toGlobalCSS()),{width:Dt+Rt.padding*2,height:Lt+Rt.padding*2}}async updateText(_e=!0){const{style:lt,_image:Rt,_loadImage:At}=this;if(this.localStyleID!==lt.styleID&&(this.dirty=!0,this.localStyleID=lt.styleID),!this.dirty&&_e)return;const{width:Pt,height:Dt}=this.measureText();Rt.width=At.width=Math.ceil(Math.max(1,Pt)),Rt.height=At.height=Math.ceil(Math.max(1,Dt)),this._loading||(this._loading=!0,await new Promise(Lt=>{At.onload=async()=>{await lt.onBeforeDraw(),this._loading=!1,Rt.src=At.src,At.onload=null,At.src="",this.updateTexture(),Lt()};const Bt=new XMLSerializer().serializeToString(this._svgRoot);At.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(Bt)}`}))}get source(){return this._image}updateTexture(){const{style:_e,texture:lt,_image:Rt,resolution:At}=this,{padding:Pt}=_e,{baseTexture:Dt}=lt;lt.trim.width=lt._frame.width=Rt.width/At,lt.trim.height=lt._frame.height=Rt.height/At,lt.trim.x=-Pt,lt.trim.y=-Pt,lt.orig.width=lt._frame.width-Pt*2,lt.orig.height=lt._frame.height-Pt*2,this._onTextureUpdate(),Dt.setRealSize(Rt.width,Rt.height,At),this.dirty=!1}_render(_e){this._autoResolution&&this._resolution!==_e.resolution&&(this._resolution=_e.resolution,this.dirty=!0),this.updateText(!0),super._render(_e)}_renderCanvas(_e){this._autoResolution&&this._resolution!==_e.resolution&&(this._resolution=_e.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(_e)}getLocalBounds(_e){return this.updateText(!0),super.getLocalBounds(_e)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(_e){var Rt,At,Pt,Dt,Lt;typeof _e=="boolean"&&(_e={children:_e}),_e=Object.assign({},_HTMLText.defaultDestroyOptions,_e),super.destroy(_e);const lt=null;this.ownsStyle&&((Rt=this._style)==null||Rt.cleanFonts()),this._style=lt,(At=this._svgRoot)==null||At.remove(),this._svgRoot=lt,(Pt=this._domElement)==null||Pt.remove(),this._domElement=lt,(Dt=this._foreignObject)==null||Dt.remove(),this._foreignObject=lt,(Lt=this._styleElement)==null||Lt.remove(),this._styleElement=lt,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=lt,this._image.src="",this._image=lt}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(_e){this.updateText(!0);const lt=sign$2(this.scale.x)||1;this.scale.x=lt*_e/this._image.width/this.resolution,this._width=_e}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(_e){this.updateText(!0);const lt=sign$2(this.scale.y)||1;this.scale.y=lt*_e/this._image.height/this.resolution,this._height=_e}get style(){return this._style}set style(_e){this._style!==_e&&(_e=_e||{},_e instanceof HTMLTextStyle?(this.ownsStyle=!1,this._style=_e):_e instanceof TextStyle?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=HTMLTextStyle.from(_e)):(this.ownsStyle=!0,this._style=new HTMLTextStyle(_e)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(_e){_e=String(_e===""||_e===null||_e===void 0?" ":_e),_e=this.sanitiseText(_e),this._text!==_e&&(this._text=_e,this.dirty=!0)}get resolution(){return this._resolution}set resolution(_e){this._autoResolution=!1,this._resolution!==_e&&(this._resolution=_e,this.dirty=!0)}sanitiseText(_e){return _e.replace(/
/gi,"
").replace(/
/gi,"
").replace(/ /gi," ")}};let HTMLText=_HTMLText;HTMLText.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0};HTMLText.defaultMaxWidth=2024;HTMLText.defaultMaxHeight=2024;HTMLText.defaultAutoResolution=!0;function makeRenderer(_e,lt){return{constructor:_e,meta:lt}}function quickselect(_e,lt,Rt,At,Pt){quickselectStep(_e,lt,Rt||0,At||_e.length-1,Pt||defaultCompare)}function quickselectStep(_e,lt,Rt,At,Pt){for(;At>Rt;){if(At-Rt>600){var Dt=At-Rt+1,Lt=lt-Rt+1,Bt=Math.log(Dt),Nt=.5*Math.exp(2*Bt/3),jt=.5*Math.sqrt(Bt*Nt*(Dt-Nt)/Dt)*(Lt-Dt/2<0?-1:1),Ut=Math.max(Rt,Math.floor(lt-Lt*Nt/Dt+jt)),Gt=Math.min(At,Math.floor(lt+(Dt-Lt)*Nt/Dt+jt));quickselectStep(_e,lt,Ut,Gt,Pt)}var qt=_e[lt],Xt=Rt,Kt=At;for(swap(_e,Rt,lt),Pt(_e[At],qt)>0&&swap(_e,Rt,At);Xt0;)Kt--}Pt(_e[Rt],qt)===0?swap(_e,Rt,Kt):(Kt++,swap(_e,Kt,At)),Kt<=lt&&(Rt=Kt+1),lt<=Kt&&(At=Kt-1)}}function swap(_e,lt,Rt){var At=_e[lt];_e[lt]=_e[Rt],_e[Rt]=At}function defaultCompare(_e,lt){return _elt?1:0}class RBush{constructor(lt=9){this._maxEntries=Math.max(4,lt),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(lt){let Rt=this.data;const At=[];if(!intersects(lt,Rt))return At;const Pt=this.toBBox,Dt=[];for(;Rt;){for(let Lt=0;Lt=0&&Dt[Rt].children.length>this._maxEntries;)this._split(Dt,Rt),Rt--;this._adjustParentBBoxes(Pt,Dt,Rt)}_split(lt,Rt){const At=lt[Rt],Pt=At.children.length,Dt=this._minEntries;this._chooseSplitAxis(At,Dt,Pt);const Lt=this._chooseSplitIndex(At,Dt,Pt),Bt=createNode(At.children.splice(Lt,At.children.length-Lt));Bt.height=At.height,Bt.leaf=At.leaf,calcBBox(At,this.toBBox),calcBBox(Bt,this.toBBox),Rt?lt[Rt-1].children.push(Bt):this._splitRoot(At,Bt)}_splitRoot(lt,Rt){this.data=createNode([lt,Rt]),this.data.height=lt.height+1,this.data.leaf=!1,calcBBox(this.data,this.toBBox)}_chooseSplitIndex(lt,Rt,At){let Pt,Dt=1/0,Lt=1/0;for(let Bt=Rt;Bt<=At-Rt;Bt++){const Nt=distBBox(lt,0,Bt,this.toBBox),jt=distBBox(lt,Bt,At,this.toBBox),Ut=intersectionArea(Nt,jt),Gt=bboxArea(Nt)+bboxArea(jt);Ut=Rt;jt--){const Ut=lt.children[jt];extend(Bt,lt.leaf?Dt(Ut):Ut),Nt+=bboxMargin(Bt)}return Nt}_adjustParentBBoxes(lt,Rt,At){for(let Pt=At;Pt>=0;Pt--)extend(Rt[Pt],lt)}_condense(lt){for(let Rt=lt.length-1,At;Rt>=0;Rt--)lt[Rt].children.length===0?Rt>0?(At=lt[Rt-1].children,At.splice(At.indexOf(lt[Rt]),1)):this.clear():calcBBox(lt[Rt],this.toBBox)}}function findItem(_e,lt,Rt){if(!Rt)return lt.indexOf(_e);for(let At=0;At=_e.minX&<.maxY>=_e.minY}function createNode(_e){return{children:_e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function multiSelect(_e,lt,Rt,At,Pt){const Dt=[lt,Rt];for(;Dt.length;){if(Rt=Dt.pop(),lt=Dt.pop(),Rt-lt<=At)continue;const Lt=lt+Math.ceil((Rt-lt)/At/2)*At;quickselect(_e,Lt,lt,Rt,Pt),Dt.push(lt,Lt,Lt,Rt)}}class Bush extends RBush{toBBox(lt){return{minX:lt.left,minY:lt.top,maxX:lt.right,maxY:lt.bottom}}compareMinX(lt,Rt){return lt.left-Rt.left}compareMinY(lt,Rt){return lt.top-Rt.top}}const defaultD2RendererOptions={screenSize:{width:1,height:1},workerCount:4,workerIndex:0,tileResolution:{width:64,height:64},tileSubdivision:0,refreshInterval:1e3/60,animationDuration:150,debounceInterval:1e3/60,errorColor:"#f44336",backgroundColor:"#ffffff",accentColor:"#333333",dynamicResolution:{intervalMs:5e3,increment:.25,maxScale:1.5,minScale:1,dtMax:1.5,dtMin:1.1}};var dist$1={},__assign=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign=Object.assign||function(_e){for(var lt,Rt=1,At=arguments.length;Rt0?1:-1}),shim$4}var sign$1=isImplemented$6()?Math.sign:requireShim$4(),sign=sign$1,abs=Math.abs,floor$1=Math.floor,toInteger$1=function(_e){return isNaN(_e)?0:(_e=Number(_e),_e===0||!isFinite(_e)?_e:sign(_e)*floor$1(abs(_e)))},toInteger=toInteger$1,max$3=Math.max,toPosInteger=function(_e){return max$3(0,toInteger(_e))},validCallable=function(_e){if(typeof _e!="function")throw new TypeError(_e+" is not a function");return _e},isValue$4=isValue$6,validValue=function(_e){if(!isValue$4(_e))throw new TypeError("Cannot use null or undefined");return _e},custom={exports:{}},isImplemented$5=function(){var _e=Object.assign,lt;return typeof _e!="function"?!1:(lt={foo:"raz"},_e(lt,{bar:"dwa"},{trzy:"trzy"}),lt.foo+lt.bar+lt.trzy==="razdwatrzy")},isImplemented$4,hasRequiredIsImplemented$3;function requireIsImplemented$3(){return hasRequiredIsImplemented$3||(hasRequiredIsImplemented$3=1,isImplemented$4=function(){try{return Object.keys("primitive"),!0}catch{return!1}}),isImplemented$4}var shim$3,hasRequiredShim$3;function requireShim$3(){if(hasRequiredShim$3)return shim$3;hasRequiredShim$3=1;var _e=isValue$6,lt=Object.keys;return shim$3=function(Rt){return lt(_e(Rt)?Object(Rt):Rt)},shim$3}var keys,hasRequiredKeys;function requireKeys(){return hasRequiredKeys||(hasRequiredKeys=1,keys=requireIsImplemented$3()()?Object.keys:requireShim$3()),keys}var shim$2,hasRequiredShim$2;function requireShim$2(){if(hasRequiredShim$2)return shim$2;hasRequiredShim$2=1;var _e=requireKeys(),lt=validValue,Rt=Math.max;return shim$2=function(At,Pt){var Dt,Lt,Bt=Rt(arguments.length,2),Nt;for(At=Object(lt(At)),Nt=function(jt){try{At[jt]=Pt[jt]}catch(Ut){Dt||(Dt=Ut)}},Lt=1;Lt-1},shim$1}var contains$1=isImplemented$3()?String.prototype.contains:requireShim$1(),isValue$1=is$4,isPlainFunction=is,assign=assign$1,normalizeOpts=normalizeOptions,contains=contains$1,d$1=d$2.exports=function(_e,lt){var Rt,At,Pt,Dt,Lt;return arguments.length<2||typeof _e!="string"?(Dt=lt,lt=_e,_e=null):Dt=arguments[2],isValue$1(_e)?(Rt=contains.call(_e,"c"),At=contains.call(_e,"e"),Pt=contains.call(_e,"w")):(Rt=Pt=!0,At=!1),Lt={value:lt,configurable:Rt,enumerable:At,writable:Pt},Dt?assign(normalizeOpts(Dt),Lt):Lt};d$1.gs=function(_e,lt,Rt){var At,Pt,Dt,Lt;return typeof _e!="string"?(Dt=Rt,Rt=lt,lt=_e,_e=null):Dt=arguments[3],isValue$1(lt)?isPlainFunction(lt)?isValue$1(Rt)?isPlainFunction(Rt)||(Dt=Rt,Rt=void 0):Rt=void 0:(Dt=lt,lt=Rt=void 0):lt=void 0,isValue$1(_e)?(At=contains.call(_e,"c"),Pt=contains.call(_e,"e")):(At=!0,Pt=!1),Lt={get:lt,set:Rt,configurable:At,enumerable:Pt},Dt?assign(normalizeOpts(Dt),Lt):Lt};var dExports=d$2.exports,eventEmitter={exports:{}};(function(_e,lt){var Rt=dExports,At=validCallable,Pt=Function.prototype.apply,Dt=Function.prototype.call,Lt=Object.create,Bt=Object.defineProperty,Nt=Object.defineProperties,jt=Object.prototype.hasOwnProperty,Ut={configurable:!0,enumerable:!1,writable:!0},Gt,qt,Xt,Kt,Zt,Qt,Jt;Gt=function(en,tn){var an;return At(tn),jt.call(this,"__ee__")?an=this.__ee__:(an=Ut.value=Lt(null),Bt(this,"__ee__",Ut),Ut.value=null),an[en]?typeof an[en]=="object"?an[en].push(tn):an[en]=[an[en],tn]:an[en]=tn,this},qt=function(en,tn){var an,cn;return At(tn),cn=this,Gt.call(this,en,an=function(){Xt.call(cn,en,an),Pt.call(tn,this,arguments)}),an.__eeOnceListener__=tn,this},Xt=function(en,tn){var an,cn,un,rn;if(At(tn),!jt.call(this,"__ee__"))return this;if(an=this.__ee__,!an[en])return this;if(cn=an[en],typeof cn=="object")for(rn=0;un=cn[rn];++rn)(un===tn||un.__eeOnceListener__===tn)&&(cn.length===2?an[en]=cn[rn?0:1]:cn.splice(rn,1));else(cn===tn||cn.__eeOnceListener__===tn)&&delete an[en];return this},Kt=function(en){var tn,an,cn,un,rn;if(jt.call(this,"__ee__")&&(un=this.__ee__[en],!!un))if(typeof un=="object"){for(an=arguments.length,rn=new Array(an-1),tn=1;tn=55296&&an<=56319&&(sn+=qt[++Qt])),sn=Xt?jt.call(Xt,Kt,sn,Jt):sn,Zt?(Ut.value=sn,Gt(en,Jt,Ut)):en[Jt]=sn,++Jt;tn=Jt}}if(tn===void 0)for(tn=At(qt.length),Zt&&(en=new Zt(tn)),Qt=0;Qt=6&&(Rt-=6),G(Rt<1?255*((lt-_e)*Rt+_e):Rt<3?255*lt:Rt<4?255*((lt-_e)*(4-Rt)+_e):255*_e)},X=function(_e,lt,Rt){lt/=100;var At=(Rt/=100)<=.5?Rt*(lt+1):Rt+lt-Rt*lt,Pt=2*Rt-At;return{r:O(Pt,At,(_e/=60)+2),g:O(Pt,At,_e),b:O(Pt,At,_e-2)}},Y=function(_e,lt,Rt,At){return{r:G(255*(1-_e)*(At=1-At)),g:G(255*(1-lt)*At),b:G(255*(1-Rt)*At)}},j=function(_e,lt,Rt){_e/=255,lt/=255,Rt/=255;var At=1-Math.max(_e,lt,Rt),Pt=1-At,Dt=Pt&&(Pt-lt)/Pt,Lt=Pt&&(Pt-Rt)/Pt;return{c:G(100*(Pt&&(Pt-_e)/Pt)),m:G(100*Dt),y:G(100*Lt),k:G(100*At)}},K=function(_e,lt,Rt,At){At===void 0&&(At=1),_e/=255,lt/=255,Rt/=255,At=Math.min(At,1);var Pt=Math.max(_e,lt,Rt),Dt=Math.min(_e,lt,Rt),Lt=Pt-Dt,Bt=0,Nt=0,jt=(Pt+Dt)/2;if(Lt!==0){switch(Pt){case _e:Bt=(lt-Rt)/Lt%6;break;case lt:Bt=(Rt-_e)/Lt+2;break;case Rt:Bt=(_e-lt)/Lt+4}(Bt=G(60*Bt))<0&&(Bt+=360),Nt=Lt/(1-Math.abs(2*jt-1))}return{h:Bt,s:G(100*Nt),l:G(100*jt),a:At}},I=function(_e,lt){if(_e<0&&(_e+=360),_e>360&&(_e-=360),_e===360||_e===0)return _e;var Rt=[[0,120],[120,180],[180,240],[240,360]],At=[[0,60],[60,120],[120,240],[240,360]],Pt=lt?At:Rt,Dt=0,Lt=0,Bt=0,Nt=0;return(lt?Rt:At).find(function(jt,Ut){return _e>=jt[0]&&_e360||_e<0)&&(_e-=360*Math.floor(_e/360)),_e},N=function(_e){return typeof _e=="string"&&(_e=m$1.test(_e)?B(_e)/100:+_e),isNaN(+_e)||_e>1?1:G(_e)},V=function(_e,lt,Rt){return lt.reduce(function(At,Pt){return e(e([],At,!0),[t(t({},_e),{h:Rt===i.ADDITIVE?x(_e.h+Pt):x(I(I(_e.h,!1)+Pt,!0))})],!1)},[t({},_e)])},U=function(_e,lt){return V(_e,[30,-30],lt)},q=function(_e,lt){return V(_e,[180],lt)},$=function(_e,lt){return V(_e,[150,-150],lt)},_=function(_e,lt){return V(_e,[120,-120],lt)},Q=function(_e,lt){return V(_e,[60,-120,180],lt)},z$1=function(_e,lt){return V(_e,[90,-90,180],lt)},J=function(_e){return typeof _e=="string"?function(lt){var Rt;if(Object.keys(r).some(function(At){if(b[At].test(lt))return Rt=At,!0}),!Rt&&~f.indexOf(lt)&&(Rt=r.HEX),!Rt)throw new Error(E);return Rt}(_e):function(lt){var Rt,At=!1,Pt=L(Object.keys(lt));if(p[Pt]&&(Rt=p[Pt]),Rt&&Rt===r.RGB){var Dt=Object.entries(lt).some(function(Bt){return!y.test("".concat(Bt[1]))}),Lt=Object.entries(lt).some(function(Bt){return!(m$1.test("".concat(Bt[1]))||!y.test("".concat(Bt[1]))&&!isNaN(+Bt[1])&&+Bt[1]<=255)});Dt&&Lt&&(At=!0),Dt||(Rt=r.HEX)}if(!Rt||At)throw new Error(v);return Rt}(_e)},W=((c={})[r.HEX]=function(_e){var lt=(~f.indexOf(_e)?o[_e]:_e).match(b.HEX),Rt={r:M(lt[1]||lt[5]),g:M(lt[2]||lt[6]),b:M(lt[3]||lt[7])},At=lt[4]||lt[8];return At!==void 0&&(Rt.a=M(At)/255),Rt},c[r.RGB]=function(_e){var lt=_e.match(b.RGB),Rt=D(lt[1]||lt[5]),At=D(lt[2]||lt[6]),Pt=D(lt[3]||lt[7]),Dt=lt[4]||lt[8],Lt={r:Math.min(Rt,255),g:Math.min(At,255),b:Math.min(Pt,255)};return Dt!==void 0&&(Lt.a=N(Dt)),Lt},c[r.HSL]=function(_e){var lt=_e.match(b.HSL),Rt=x(lt[1]||lt[5]),At=C(lt[2]||lt[6]),Pt=C(lt[3]||lt[7]),Dt=lt[4]||lt[8],Lt=X(Rt,At,Pt);return Dt!==void 0&&(Lt.a=N(Dt)),Lt},c[r.CMYK]=function(_e){var lt=_e.match(b.CMYK),Rt=S(lt[1]||lt[6]),At=S(lt[2]||lt[7]),Pt=S(lt[3]||lt[8]),Dt=S(lt[4]||lt[9]),Lt=lt[5]||lt[10],Bt=Y(Rt,At,Pt,Dt);return Lt!==void 0&&(Bt.a=N(Lt)),Bt},c),Z=((s={})[r.HEX]=function(_e){var lt={r:D("".concat(_e.r)),g:D("".concat(_e.g)),b:D("".concat(_e.b))};return H(_e,"a")&&(lt.a=Math.min(D("".concat(_e.a),!0),1)),lt},s[r.RGB]=function(_e){return this.HEX(_e)},s[r.HSL]=function(_e){var lt=C("".concat(_e.s)),Rt=C("".concat(_e.l)),At=X(x(_e.h),lt,Rt);return H(_e,"a")&&(At.a=N(_e.a)),At},s[r.CMYK]=function(_e){var lt=S("".concat(_e.c)),Rt=S("".concat(_e.m)),At=S("".concat(_e.y)),Pt=S("".concat(_e.k)),Dt=Y(lt,Rt,At,Pt);return H(_e,"a")&&(Dt.a=N(_e.a)),Dt},s),tt=function(_e,lt){return lt===void 0&&(lt=J(_e)),typeof _e=="string"?W[lt](_e):Z[lt](_e)},et=((d={})[r.HEX]=function(_e){return{r:R(_e.r),g:R(_e.g),b:R(_e.b)}},d.HEXA=function(_e){var lt=et.HEX(_e);return lt.a=H(_e,"a")?R(255*_e.a):"0xFF",lt},d[r.RGB]=function(_e,lt){return H(_e,"a")&&delete _e.a,ot(_e,lt)},d.RGBA=function(_e,lt){return _e.a=H(_e,"a")?G(_e.a):1,ot(_e,lt)},d[r.HSL]=function(_e,lt){var Rt=K(_e.r,_e.g,_e.b);return delete Rt.a,at(Rt,lt)},d.HSLA=function(_e,lt){var Rt=et.HSL(_e,lt);return Rt.a=H(_e,"a")?G(_e.a,lt):1,Rt},d[r.CMYK]=function(_e,lt){return ut(j(_e.r,_e.g,_e.b),lt)},d.CMYKA=function(_e,lt){var Rt=et.CMYK(_e,lt);return Rt.a=H(_e,"a")?G(_e.a,lt):1,Rt},d),rt=function(_e,lt,Rt,At){var Pt=J(_e),Dt=typeof _e=="string",Lt=tt(_e,Pt),Bt=typeof _e=="string"&&H(Lt,"a")||typeof _e!="string"&&H(_e,"a"),Nt=K(Lt.r,Lt.g,Lt.b,Lt.a);Bt||delete Nt.a;var jt=Rt?Nt.l/(lt+1):(100-Nt.l)/(lt+1),Ut=Array(lt).fill(null).map(function(Gt,qt){return t(t({},Nt),{l:Nt.l+jt*(qt+1)*(1-2*+Rt)})});switch(Pt){case r.HEX:default:return Ut.map(function(Gt){var qt=X(Gt.h,Gt.s,Gt.l);return Bt&&(qt.a=Gt.a),Dt?Bt?w.HEX(ot(t(t({},qt),{a:G(255*qt.a)}),At)):w.HEX(ot(qt,At)):Bt?et.HEXA(qt):et.HEX(qt)});case r.RGB:return Ut.map(function(Gt){var qt=X(Gt.h,Gt.s,Gt.l);return Bt&&(qt.a=Gt.a),Dt?w.RGB(ot(qt,At)):Bt?et.RGBA(qt,At):et.RGB(qt,At)});case r.HSL:return Ut.map(function(Gt){return Dt?w.HSL(at(Gt,At)):Bt?et.HSLA(t(t({},X(Gt.h,Gt.s,Gt.l)),{a:Gt.a}),At):et.HSL(X(Gt.h,Gt.s,Gt.l),At)})}},nt=((h={buildHarmony:function(_e,lt,Rt,At){var Pt=J(_e),Dt=tt(_e,Pt),Lt=K(Dt.r,Dt.g,Dt.b,Dt.a),Bt=typeof _e=="string"&&H(Dt,"a")||typeof _e!="string"&&H(_e,"a"),Nt=typeof _e=="string";switch(Pt){case r.HEX:default:return Bt?this.HEXA(at(Lt,0),lt,Rt,Nt):this.HEX(at(Lt,0),lt,Rt,Nt);case r.HSL:return Bt?this.HSLA(Lt,lt,Rt,Nt,At):this.HSL(Lt,lt,Rt,Nt,At);case r.RGB:return Bt?this.RGBA(Lt,lt,Rt,Nt,At):this.RGB(Lt,lt,Rt,Nt,At)}}})[r.HEX]=function(_e,lt,Rt,At){return lt(_e,Rt).map(function(Pt){return At?w.HEX(X(Pt.h,Pt.s,Pt.l)):et.HEX(X(Pt.h,Pt.s,Pt.l))})},h.HEXA=function(_e,lt,Rt,At){return lt(_e,Rt).map(function(Pt){return At?w.HEX(t(t({},X(Pt.h,Pt.s,Pt.l)),{a:255*N(Pt.a)})):et.HEXA(t(t({},X(Pt.h,Pt.s,Pt.l)),{a:N(Pt.a)}))})},h[r.RGB]=function(_e,lt,Rt,At,Pt){return lt(_e,Rt).map(function(Dt){return At?w.RGB(ot(X(Dt.h,Dt.s,Dt.l),Pt)):et.RGB(X(Dt.h,Dt.s,Dt.l),Pt)})},h.RGBA=function(_e,lt,Rt,At,Pt){return lt(_e,Rt).map(function(Dt){return At?w.RGB(ot(t(t({},X(Dt.h,Dt.s,Dt.l)),{a:N(Dt.a)}),Pt)):et.RGBA(t(t({},X(Dt.h,Dt.s,Dt.l)),{a:N(Dt.a)}),Pt)})},h[r.HSL]=function(_e,lt,Rt,At,Pt){return lt(_e,Rt).map(function(Dt){return At?w.HSL(at({h:Dt.h,s:Dt.s,l:Dt.l},Pt)):et.HSL(X(Dt.h,Dt.s,Dt.l),Pt)})},h.HSLA=function(_e,lt,Rt,At,Pt){return lt(_e,Rt).map(function(Dt){return At?w.HSL(at(t(t({},Dt),{a:N(Dt.a)}),Pt)):et.HSLA(t(t({},X(Dt.h,Dt.s,Dt.l)),{a:N(Dt.a)}),Pt)})},h),it=((l={mix:function(_e,lt){var Rt,At,Pt,Dt,Lt,Bt,Nt,jt,Ut,Gt,qt,Xt,Kt,Zt,Qt,Jt=_e.map(function(cn){var un=J(cn);return tt(cn,un)}),en=lt===i.SUBTRACTIVE?Jt.map(function(cn){var un,rn,sn,pn,bn,gn,_n,xn,ln,Mn,Tn,An,Cn,wn,Fn=(un=cn.r,rn=cn.g,sn=cn.b,pn=Math.min(un,rn,sn),bn=Math.min(255-un,255-rn,255-sn),gn=un-pn,_n=rn-pn,xn=sn-pn,ln=Math.min(gn,_n),Mn=gn-ln,Tn=(_n+ln)/2,An=(xn+_n-ln)/2,Cn=Math.max(Mn,Tn,An)/Math.max(gn,_n,xn),wn=isNaN(Cn)||Cn===1/0||Cn<=0?1:Cn,{r:Mn/wn+bn,y:Tn/wn+bn,b:An/wn+bn});return H(cn,"a")&&(Fn.a=cn.a),Fn}):null;function tn(cn){var un=lt===i.ADDITIVE?{r:0,g:0,b:0,a:0}:{r:0,y:0,b:0,a:0};return cn.reduce(function(rn,sn){var pn=H(sn,"a")?sn.a:1,bn={r:Math.min(rn.r+sn.r*pn,255),b:Math.min(rn.b+sn.b*pn,255),a:1-(1-pn)*(1-rn.a)},gn="g"in rn?rn.g:rn.y,_n="g"in sn?sn.g:sn.y;return t(t({},bn),lt===i.ADDITIVE?{g:Math.min(gn+_n*pn,255)}:{y:Math.min(gn+_n*pn,255)})},un)}if(lt===i.ADDITIVE)Rt=tn(Jt);else{var an=tn(en);At=an.r,Pt=an.y,Dt=an.b,Lt=Math.min(At,Pt,Dt),Bt=Math.min(255-At,255-Pt,255-Dt),Nt=At-Lt,jt=Pt-Lt,Ut=Dt-Lt,Gt=Math.min(jt,Ut),qt=Nt+jt-Gt,Xt=jt+Gt,Kt=2*(Ut-Gt),Zt=Math.max(qt,Xt,Kt)/Math.max(Nt,jt,Ut),Qt=isNaN(Zt)||Zt===1/0||Zt<=0?1:Zt,(Rt={r:qt/Qt+Bt,g:Xt/Qt+Bt,b:Kt/Qt+Bt}).a=an.a}return{r:G(Rt.r),g:G(Rt.g),b:G(Rt.b),a:k(Rt.a,0,1)}}})[r.HEX]=function(_e,lt,Rt){var At=this.mix(_e,lt);return delete At.a,Rt?w.HEX(At):et.HEX(At)},l.HEXA=function(_e,lt,Rt){var At=this.mix(_e,lt);return At.a=Rt?255*N(At.a):N(At.a),Rt?w.HEX(At):et.HEXA(At)},l[r.RGB]=function(_e,lt,Rt,At){var Pt=this.mix(_e,lt);return delete Pt.a,Rt?w.RGB(Pt):et.RGB(Pt,At)},l.RGBA=function(_e,lt,Rt,At){var Pt=this.mix(_e,lt);return Rt?w.RGB(Pt):et.RGBA(Pt,At)},l[r.HSL]=function(_e,lt,Rt,At){var Pt=this.mix(_e,lt),Dt=K(Pt.r,Pt.g,Pt.b);return delete Pt.a,delete Dt.a,Rt?w.HSL(Dt):et.HSL(Pt,At)},l.HSLA=function(_e,lt,Rt,At){var Pt=this.mix(_e,lt),Dt=K(Pt.r,Pt.g,Pt.b,Pt.a);return Rt?w.HSL(Dt):et.HSLA(Pt,At)},l),ot=function(_e,lt){return t({r:G(_e.r,lt),g:G(_e.g,lt),b:G(_e.b,lt)},H(_e,"a")?{a:G(_e.a,lt)}:{})},at=function(_e,lt){return t({h:G(_e.h,lt),s:G(_e.s,lt),l:G(_e.l,lt)},H(_e,"a")?{a:G(_e.a,lt)}:{})},ut=function(_e,lt){return{c:G(_e.c,lt),m:G(_e.m,lt),y:G(_e.y,lt),k:G(_e.k,lt)}},ct=function(_e,lt,Rt,At,Pt,Dt){var Lt=Pt(tt(_e,lt),At);return Rt?Dt(Lt):Lt},st=function(_e,lt,Rt,At,Pt,Dt,Lt){Rt<1&&(Rt=5);var Bt=function(Nt,jt,Ut){var Gt=Ut-1,qt=(jt.r-Nt.r)/Gt,Xt=(jt.g-Nt.g)/Gt,Kt=(jt.b-Nt.b)/Gt,Zt=N(Nt.a),Qt=(N(jt.a)-Zt)/Gt;return Array(Ut).fill(null).map(function(Jt,en){return en===0?Nt:en===Gt?jt:{r:G(Nt.r+qt*en),g:G(Nt.g+Xt*en),b:G(Nt.b+Kt*en),a:G(Zt+Qt*en)}})}(tt(_e),tt(lt),Rt);return Bt.map(function(Nt){var jt=Dt(Nt,Pt);return At?Lt(jt):jt})},dt=function(){function _e(lt,Rt){Rt===void 0&&(Rt=6),this.rgb=tt(lt),this._decimals=Rt,this.updateHSL(),this.updateCMYK()}return _e.prototype.updateRGB=function(){this.rgb=t(t({},X(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},_e.prototype.updateRGBFromCMYK=function(){this.rgb=t(t({},Y(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},_e.prototype.updateHSL=function(){this.hsl=K(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},_e.prototype.updateCMYK=function(){this.cmyk=j(this.rgb.r,this.rgb.g,this.rgb.b)},_e.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},_e.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},_e.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},_e.prototype.setDecimals=function(lt){return this._decimals=lt,this},_e.prototype.setH=function(lt){return this.hsl.h=x(lt),this.updateRGBAndCMYK()},_e.prototype.setS=function(lt){return this.hsl.s=k(lt,0,100),this.updateRGBAndCMYK()},_e.prototype.setL=function(lt){return this.hsl.l=k(lt,0,100),this.updateRGBAndCMYK()},_e.prototype.setR=function(lt){return this.rgb.r=k(lt,0,255),this.updateHSLAndCMYK()},_e.prototype.setG=function(lt){return this.rgb.g=k(lt,0,255),this.updateHSLAndCMYK()},_e.prototype.setB=function(lt){return this.rgb.b=k(lt,0,255),this.updateHSLAndCMYK()},_e.prototype.setA=function(lt){return this.hsl.a=this.rgb.a=k(lt,0,1),this},_e.prototype.setC=function(lt){return this.cmyk.c=k(lt,0,100),this.updateRGBAndHSL()},_e.prototype.setM=function(lt){return this.cmyk.m=k(lt,0,100),this.updateRGBAndHSL()},_e.prototype.setY=function(lt){return this.cmyk.y=k(lt,0,100),this.updateRGBAndHSL()},_e.prototype.setK=function(lt){return this.cmyk.k=k(lt,0,100),this.updateRGBAndHSL()},Object.defineProperty(_e.prototype,"decimals",{get:function(){return this._decimals},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"H",{get:function(){return G(this.hsl.h,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"S",{get:function(){return G(this.hsl.s,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"L",{get:function(){return G(this.hsl.l,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"R",{get:function(){return G(this.rgb.r,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"G",{get:function(){return G(this.rgb.g,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"B",{get:function(){return G(this.rgb.b,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"A",{get:function(){return G(this.hsl.a,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"C",{get:function(){return G(this.cmyk.c,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"M",{get:function(){return G(this.cmyk.m,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"Y",{get:function(){return G(this.cmyk.y,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"K",{get:function(){return G(this.cmyk.k,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"HEXObject",{get:function(){return et.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"HEXAObject",{get:function(){return et.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"RGBAObject",{get:function(){return t(t({},this.RGBObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"HSLAObject",{get:function(){return t(t({},this.HSLObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"CMYKAObject",{get:function(){return t(t({},this.CMYKObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"HEX",{get:function(){return w.HEX({r:this.R,g:this.G,b:this.B})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"HEXA",{get:function(){return w.HEX({r:this.R,g:this.G,b:this.B,a:255*this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"RGB",{get:function(){return w.RGB({r:this.R,g:this.G,b:this.B})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"RGBA",{get:function(){return w.RGB({r:this.R,g:this.G,b:this.B,a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"HSL",{get:function(){return w.HSL({h:this.H,s:this.S,l:this.L})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"HSLA",{get:function(){return w.HSL({h:this.H,s:this.S,l:this.L,a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"CMYK",{get:function(){return w.CMYK({c:this.C,m:this.M,y:this.Y,k:this.K})},enumerable:!1,configurable:!0}),Object.defineProperty(_e.prototype,"CMYKA",{get:function(){return w.CMYK({c:this.C,m:this.M,y:this.Y,k:this.K,a:this.A})},enumerable:!1,configurable:!0}),_e.toHEX=function(lt,Rt){Rt===void 0&&(Rt=!0);var At=J(lt);return ct(lt,At,Rt,0,et.HEX,w.HEX)},_e.toHEXA=function(lt,Rt){Rt===void 0&&(Rt=!0);var At=J(lt);return ct(lt,At,Rt,0,et.HEXA,w.HEX)},_e.toRGB=function(lt,Rt,At){Rt===void 0&&(Rt=!0),At===void 0&&(At=6);var Pt=J(lt);return ct(lt,Pt,Rt,At,et.RGB,w.RGB)},_e.toRGBA=function(lt,Rt,At){Rt===void 0&&(Rt=!0),At===void 0&&(At=6);var Pt=J(lt);return ct(lt,Pt,Rt,At,et.RGBA,w.RGB)},_e.toHSL=function(lt,Rt,At){Rt===void 0&&(Rt=!0),At===void 0&&(At=6);var Pt=J(lt);return ct(lt,Pt,Rt,At,et.HSL,w.HSL)},_e.toHSLA=function(lt,Rt,At){Rt===void 0&&(Rt=!0),At===void 0&&(At=6);var Pt=J(lt);return ct(lt,Pt,Rt,At,et.HSLA,w.HSL)},_e.toCMYK=function(lt,Rt,At){Rt===void 0&&(Rt=!0),At===void 0&&(At=6);var Pt=J(lt);return ct(lt,Pt,Rt,At,et.CMYK,w.CMYK)},_e.toCMYKA=function(lt,Rt,At){Rt===void 0&&(Rt=!0),At===void 0&&(At=6);var Pt=J(lt);return ct(lt,Pt,Rt,At,et.CMYKA,w.CMYK)},_e.getBlendHEX=function(lt,Rt,At,Pt,Dt){return At===void 0&&(At=5),Pt===void 0&&(Pt=!0),Dt===void 0&&(Dt=6),st(lt,Rt,At,Pt,Dt,et.HEX,w.HEX)},_e.getBlendHEXA=function(lt,Rt,At,Pt,Dt){return At===void 0&&(At=5),Pt===void 0&&(Pt=!0),Dt===void 0&&(Dt=6),st(lt,Rt,At,Pt,Dt,et.HEXA,w.HEX)},_e.getBlendRGB=function(lt,Rt,At,Pt,Dt){return At===void 0&&(At=5),Pt===void 0&&(Pt=!0),Dt===void 0&&(Dt=6),st(lt,Rt,At,Pt,Dt,et.RGB,w.RGB)},_e.getBlendRGBA=function(lt,Rt,At,Pt,Dt){return At===void 0&&(At=5),Pt===void 0&&(Pt=!0),Dt===void 0&&(Dt=6),st(lt,Rt,At,Pt,Dt,et.RGBA,w.RGB)},_e.getBlendHSL=function(lt,Rt,At,Pt,Dt){return At===void 0&&(At=5),Pt===void 0&&(Pt=!0),Dt===void 0&&(Dt=6),st(lt,Rt,At,Pt,Dt,et.HSL,w.HSL)},_e.getBlendHSLA=function(lt,Rt,At,Pt,Dt){return At===void 0&&(At=5),Pt===void 0&&(Pt=!0),Dt===void 0&&(Dt=6),st(lt,Rt,At,Pt,Dt,et.HSLA,w.HSL)},_e.getMixHEX=function(lt,Rt,At){return Rt===void 0&&(Rt=i.ADDITIVE),At===void 0&&(At=!0),it.HEX(lt,Rt,At)},_e.getMixHEXA=function(lt,Rt,At){return Rt===void 0&&(Rt=i.ADDITIVE),At===void 0&&(At=!0),it.HEXA(lt,Rt,At)},_e.getMixRGB=function(lt,Rt,At,Pt){return Rt===void 0&&(Rt=i.ADDITIVE),At===void 0&&(At=!0),Pt===void 0&&(Pt=6),it.RGB(lt,Rt,At,Pt)},_e.getMixRGBA=function(lt,Rt,At,Pt){return Rt===void 0&&(Rt=i.ADDITIVE),At===void 0&&(At=!0),Pt===void 0&&(Pt=6),it.RGBA(lt,Rt,At,Pt)},_e.getMixHSL=function(lt,Rt,At,Pt){return Rt===void 0&&(Rt=i.ADDITIVE),At===void 0&&(At=!0),Pt===void 0&&(Pt=6),it.HSL(lt,Rt,At,Pt)},_e.getMixHSLA=function(lt,Rt,At,Pt){return Rt===void 0&&(Rt=i.ADDITIVE),At===void 0&&(At=!0),Pt===void 0&&(Pt=6),it.HSLA(lt,Rt,At,Pt)},_e.getShades=function(lt,Rt,At){return At===void 0&&(At=6),rt(lt,Rt,!0,At)},_e.getTints=function(lt,Rt,At){return At===void 0&&(At=6),rt(lt,Rt,!1,At)},_e.getHarmony=function(lt,Rt,At,Pt){return Rt===void 0&&(Rt=n.COMPLEMENTARY),At===void 0&&(At=i.ADDITIVE),Pt===void 0&&(Pt=6),function(Dt,Lt,Bt,Nt){var jt;return(jt={},jt[n.ANALOGOUS]=nt.buildHarmony(Lt,U,Nt,Bt),jt[n.COMPLEMENTARY]=nt.buildHarmony(Lt,q,Nt,Bt),jt[n.SPLIT_COMPLEMENTARY]=nt.buildHarmony(Lt,$,Nt,Bt),jt[n.TRIADIC]=nt.buildHarmony(Lt,_,Nt,Bt),jt[n.TETRADIC]=nt.buildHarmony(Lt,Q,Nt,Bt),jt[n.SQUARE]=nt.buildHarmony(Lt,z$1,Nt,Bt),jt)[Dt]}(Rt,lt,Pt,At)},_e}();const defaultContext={current:void 0,parent:void 0,events:void 0,color:{source:2533018,destination:15753874,expanding:16733986,updating:16733986,generating:16771899,closing:11583173,end:15483002},scale:10,fill:"#000000",alpha:1},{ceil:ceil$1,PI}=Math,getFillStyle=(_e,lt)=>new dt(_e).setA(lt??defaultContext.alpha).RGBA,getStrokeStyle=(_e,lt)=>getFillStyle(_e,lt);function transform(_e,lt){return{width:_e.width*lt.scale.x,height:_e.height*lt.scale.y,x:_e.x*lt.scale.x+lt.x,y:_e.y*lt.scale.y+lt.y}}const text={draw(_e,lt,Rt){if(_e.text){const At=transform(_e,{x:_e.textX,y:_e.textY,scale:{x:1,y:1}}),Pt=transform(At,Rt);lt.font=`${_e.fontSize*Rt.scale.x}px Arial`,lt.fillStyle=getFillStyle(_e.fontColor,_e.alpha),lt.fillText(_e.text,Pt.x,Pt.y)}},test(_e){return{left:-1/0,right:1/0,top:-1/0,bottom:1/0}}},rect={draw(_e,lt,Rt){const{x:At,y:Pt,width:Dt,height:Lt}=transform(_e,Rt);lt.fillStyle=getFillStyle(_e.fill,_e.alpha),lt.fillRect(ceil$1(At),ceil$1(Pt),ceil$1(Dt)||1,ceil$1(Lt)||1)},test(_e){return{left:_e.x,right:_e.x+_e.width,top:_e.y,bottom:_e.y+_e.height}}},circle={draw(_e,lt,Rt){lt.fillStyle=getFillStyle(_e.fill,_e.alpha),lt.beginPath();const At=transform({..._e,width:_e.radius,height:_e.radius},Rt);lt.ellipse(ceil$1(At.x),ceil$1(At.y),ceil$1(At.width),ceil$1(At.height),0,0,2*PI),lt.fill()},test(_e){return{left:_e.x-_e.radius,right:_e.x+_e.radius,top:_e.y-_e.radius,bottom:_e.y+_e.radius}}},polygon={draw(_e,lt,Rt){const[At,...Pt]=_e.points;lt.beginPath(),lt.fillStyle=getFillStyle(_e.fill,_e.alpha);const{x:Dt,y:Lt}=transform({...At,width:0,height:0},Rt);lt.moveTo(ceil$1(Dt),ceil$1(Lt));for(const Bt of Pt){const{x:Nt,y:jt}=transform({...Bt,width:0,height:0},Rt);lt.lineTo(ceil$1(Nt),ceil$1(jt))}lt.closePath(),lt.fill()},test(_e){var lt,Rt,At,Pt;return{left:((lt=lodashExports.minBy(_e.points,"x"))==null?void 0:lt.x)??0,right:((Rt=lodashExports.maxBy(_e.points,"x"))==null?void 0:Rt.x)??0,top:((At=lodashExports.minBy(_e.points,"y"))==null?void 0:At.y)??0,bottom:((Pt=lodashExports.maxBy(_e.points,"y"))==null?void 0:Pt.y)??0}}},path={draw(_e,lt,Rt){const[At,...Pt]=_e.points;lt.beginPath(),lt.lineCap="round",lt.lineJoin="round",lt.strokeStyle=getStrokeStyle(_e.fill,_e.alpha);const{x:Dt,y:Lt,width:Bt}=transform({...At,width:_e.lineWidth,height:0},Rt);lt.lineWidth=ceil$1(Bt),lt.moveTo(ceil$1(Dt),ceil$1(Lt));for(const Nt of Pt){const{x:jt,y:Ut}=transform({...Nt,width:0,height:0},Rt);lt.lineTo(ceil$1(jt),ceil$1(Ut))}lt.stroke()},test(_e){var lt,Rt,At,Pt;return{left:((lt=lodashExports.minBy(_e.points,"x"))==null?void 0:lt.x)??0-_e.lineWidth??0,right:((Rt=lodashExports.maxBy(_e.points,"x"))==null?void 0:Rt.x)??0+_e.lineWidth??0,top:((At=lodashExports.minBy(_e.points,"y"))==null?void 0:At.y)??0-_e.lineWidth??0,bottom:((Pt=lodashExports.maxBy(_e.points,"y"))==null?void 0:Pt.y)??0+_e.lineWidth??0}}},primitives={text,path,rect,polygon,circle};var rgb$1={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]},rgb=rgb$1;rgb.hsl=function(_e){var lt=_e[0]/255,Rt=_e[1]/255,At=_e[2]/255,Pt=Math.min(lt,Rt,At),Dt=Math.max(lt,Rt,At),Lt=Dt-Pt,Bt,Nt,jt;return Dt===Pt?Bt=0:lt===Dt?Bt=(Rt-At)/Lt:Rt===Dt?Bt=2+(At-lt)/Lt:At===Dt&&(Bt=4+(lt-Rt)/Lt),Bt=Math.min(Bt*60,360),Bt<0&&(Bt+=360),jt=(Pt+Dt)/2,Dt===Pt?Nt=0:jt<=.5?Nt=Lt/(Dt+Pt):Nt=Lt/(2-Dt-Pt),[Bt,Nt*100,jt*100]};const{log2,max:max$2}=Math,z=_e=>lodashExports.floor(log2(_e+1));function getTiles({right:_e,left:lt,bottom:Rt,top:At},Pt){const Dt=max$2(z(_e-lt),z(Rt-At))-Pt,Lt=2**Dt,Bt={left:lodashExports.floor(lt/Lt),right:lodashExports.ceil((_e+1)/Lt),top:lodashExports.floor(At/Lt),bottom:lodashExports.ceil((Rt+1)/Lt)};return{zoom:Dt,order:Lt,tiles:lodashExports.shuffle(_default({x:lodashExports.range(Bt.left,Bt.right+1),y:lodashExports.range(Bt.top,Bt.bottom+1)}).map(Nt=>{const jt=Nt.x*Lt,Ut=Nt.y*Lt;return{tile:Nt,bounds:{left:jt-Lt/2,right:jt+Lt/2,top:Ut-Lt/2,bottom:Ut+Lt/2}}}))}}const defaultBounds={top:0,left:0,right:1,bottom:1},isValue=_e=>lodashExports.isNumber(_e)&&!isNaN(_e),d2RendererWorkerUrl=""+new URL("D2Renderer.worker-67a71515.js",import.meta.url).href;class D2RendererWorkerAdapter extends Worker{constructor(){super(d2RendererWorkerUrl,{type:"module"})}call(lt,Rt,At=[]){return this.postMessage({action:lt,payload:Rt},At)}on(lt,Rt){const At=Pt=>{const{action:Dt,payload:Lt}=Pt.data;Dt===lt&&Rt(Lt)};return this.addEventListener("message",At),()=>this.removeEventListener("message",At)}}function intersect(_e,lt){return!(lt.left>=_e.right||lt.right<=_e.left||lt.top>=_e.bottom||lt.bottom<=_e.top)}const{max:max$1,min:min$1}=Math,_Tile=class BE extends Sprite{constructor(lt,Rt){super(lt),this.bounds=Rt,this.destroying=!1,this.age=BE.age++}};_Tile.age=0;let Tile=_Tile;function handleNaN(_e,lt){return lodashExports.isNaN(_e)?lt:_e}var Zl,Vs,$p,wp,Tl,Bu,Tp,Cp,G0,V0,NE,q0,FE,jm,z0,Y0,X0,jE,K0,zE,Z0,UE,Q0,HE,U0,PE,H0,ME,J0,WE,W0,OE,ev,GE,tv,VE,nv,qE;class D2Renderer extends EventEmitter{constructor(){super(...arguments);Ps(this,V0);Ps(this,q0);Ps(this,X0);Ps(this,K0);Ps(this,Z0);Ps(this,Q0);Ps(this,U0);Ps(this,H0);Ps(this,J0);Ps(this,W0);Ps(this,ev);Ps(this,tv);Ps(this,nv);Ps(this,Zl,void 0);Ps(this,Vs,void 0);Ps(this,$p,void 0);Ps(this,wp,void 0);Ps(this,Tl,defaultD2RendererOptions);Ps(this,Bu,[]);Ps(this,Tp,new Bush(16));Ps(this,Cp,void 0);Ps(this,G0,0);Ps(this,jm,lodashExports.once(()=>lodashExports.debounce(()=>Fl(this,U0,PE).call(this),_o(this,Tl).debounceInterval)));Ps(this,z0,lodashExports.once(()=>lodashExports.throttle(()=>Fl(this,H0,ME).call(this),_o(this,Tl).refreshInterval)));Ps(this,Y0,lodashExports.once(()=>lodashExports.throttle(Rt=>Fl(this,J0,WE).call(this,Rt),_o(this,Tl).refreshInterval)))}getInstance(){return{app:_o(this,Zl),viewport:_o(this,Vs)}}fitCamera(Rt=lodashExports.constant(!0)){var Pt,Dt,Lt,Bt;const At=lodashExports.values(_o(this,Tp).all()).flat().filter(Rt);if(At.length){const Nt=lodashExports.reduce(At,(jt,Ut)=>({top:handleNaN(min$1(jt.top,Ut.top),jt.top),left:handleNaN(min$1(jt.left,Ut.left),jt.left),bottom:handleNaN(max$1(jt.bottom,Ut.bottom),jt.bottom),right:handleNaN(max$1(jt.right,Ut.right),jt.right)}),{bottom:-1/0,top:1/0,left:1/0,right:-1/0});(Bt=(Pt=_o(this,Vs))==null?void 0:Pt.animate)==null||Bt.call(Pt,{position:new Point((Nt.left+Nt.right)/2,(Nt.top+Nt.bottom)/2),scale:((Lt=(Dt=_o(this,Vs))==null?void 0:Dt.findFit)==null?void 0:Lt.call(Dt,Nt.right-Nt.left,Nt.bottom-Nt.top))*.8,ease:"easeOutExpo",time:_o(this,Tl).animationDuration*1.5,callbackOnComplete:()=>_o(this,jm).call(this)()})}}initialCamera(){var Rt,At;(At=(Rt=_o(this,Vs))==null?void 0:Rt.animate)==null||At.call(Rt,{scale:1,ease:"easeOutExpo",time:_o(this,Tl).animationDuration*1.5,callbackOnComplete:()=>_o(this,jm).call(this)()})}getView(){var Rt;return(Rt=_o(this,Zl))==null?void 0:Rt.view}async toDataUrl(){var Rt,At,Pt,Dt,Lt;return(At=(Rt=_o(this,Zl))==null?void 0:Rt.render)==null||At.call(Rt),(Lt=(Dt=(Pt=_o(this,Zl))==null?void 0:Pt.view)==null?void 0:Dt.toDataURL)==null?void 0:Lt.call(Dt)}setup(Rt){const At={...defaultD2RendererOptions,...Rt};Fl(this,q0,FE).call(this,At),this.setOptions(At),Fl(this,K0,zE).call(this,At)}destroy(){lodashExports.map(_o(this,Bu),Rt=>Rt.terminate()),_o(this,Zl).destroy()}add(Rt){const At=nanoid();lodashExports.map(_o(this,Bu),Dt=>Dt.call("add",[Rt,At]));const Pt=lodashExports.map(Rt,({component:Dt,meta:Lt})=>({...defaultBounds,...lodashExports.pickBy(primitives[Dt.$].test(Dt),isValue),component:Dt,meta:Lt,index:Fl(this,V0,NE).call(this)}));return _o(this,Tp).load(Pt),()=>lodashExports.defer(()=>{for(const Dt of Pt)_o(this,Tp).remove(Dt);lodashExports.map(_o(this,Bu),Dt=>Dt.call("remove",[At]))})}setOptions(Rt){const At={..._o(this,Tl),...Rt};Fl(this,Z0,UE).call(this,At),_p(this,Tl,At),Fl(this,U0,PE).call(this),Fl(this,H0,ME).call(this)}}Zl=new WeakMap,Vs=new WeakMap,$p=new WeakMap,wp=new WeakMap,Tl=new WeakMap,Bu=new WeakMap,Tp=new WeakMap,Cp=new WeakMap,G0=new WeakMap,V0=new WeakSet,NE=function(){return DE(this,G0)._++},q0=new WeakSet,FE=function(Rt){_p(this,Zl,new Application({backgroundAlpha:0,width:Rt.screenSize.width,height:Rt.screenSize.height,autoDensity:!0,resolution:2})),_p(this,Vs,new ht({stopPropagation:!0,screenWidth:Rt.screenSize.width,screenHeight:Rt.screenSize.height,events:_o(this,Zl).renderer.events,passiveWheel:!1})),_o(this,Vs).on("clicked",At=>{const{x:Pt,y:Dt}=At.world,Lt=_o(this,Tp).search({minX:Pt,minY:Dt,maxX:Pt+Number.MIN_VALUE,maxY:Dt+Number.MIN_VALUE});this.emit("click",At.event,{world:At.world,components:Lt})}),_o(this,Zl).stage.addChild(_o(this,Vs)),_o(this,Vs).drag().pinch().wheel().decelerate({friction:.98}).clampZoom({maxScale:300,minScale:1e-5}),_o(this,Vs).on("moved",()=>{_o(this,jm).call(this)(),_o(this,z0).call(this)()}),_o(this,Vs).on("mousemove",At=>_o(this,Y0).call(this)(At)),_p(this,$p,new Container),_o(this,Vs).addChild(_o(this,$p)),_p(this,wp,new Graphics),_o(this,Vs).addChild(_o(this,wp)),_p(this,Cp,new Graphics),_o(this,Vs).addChild(_o(this,Cp)),Fl(this,X0,jE).call(this)},jm=new WeakMap,z0=new WeakMap,Y0=new WeakMap,X0=new WeakSet,jE=function(){const{dynamicResolution:Rt}=_o(this,Tl),{dtMax:At,dtMin:Pt,increment:Dt,intervalMs:Lt,maxScale:Bt,minScale:Nt}=Rt,jt=lodashExports.floor(Ticker.targetFPMS*Lt);let Ut=0,Gt=0,qt=1;_o(this,Zl).ticker.add(Xt=>{const{tileResolution:Kt}=_o(this,Tl);if(!(Ut%jt)){const Zt=Gt/jt;qt=lodashExports.clamp(Zt>=At?qt+Dt:Zt<=Pt?qt-Dt:qt,Nt,Bt),lodashExports.map(_o(this,Bu),Qt=>{Qt.call("setTileResolution",[{width:lodashExports.ceil(Kt.width/qt),height:lodashExports.ceil(Kt.height/qt)}])}),Gt=0}Gt+=Xt,Ut++})},K0=new WeakSet,zE=function(Rt){lodashExports.map(_o(this,Bu),At=>At.terminate()),_p(this,Bu,lodashExports.times(Rt.workerCount,At=>{const Pt=new D2RendererWorkerAdapter;return Pt.on("update",Dt=>Fl(this,Q0,HE).call(this,Dt)),Pt.onerror=Dt=>{throw Dt},Pt.call("setup",[{...Rt,workerIndex:At}]),Pt}))},Z0=new WeakSet,UE=function(Rt){var Dt,Lt,Bt,Nt;const{width:At,height:Pt}=Rt.screenSize;(Bt=(Lt=(Dt=_o(this,Zl))==null?void 0:Dt.renderer)==null?void 0:Lt.resize)==null||Bt.call(Lt,At,Pt),(Nt=_o(this,Vs))==null||Nt.resize(At,Pt),lodashExports.map(_o(this,Bu),jt=>{jt.call("setTileResolution",[{width:lodashExports.ceil(Rt.tileResolution.width),height:lodashExports.ceil(Rt.tileResolution.height)}])})},Q0=new WeakSet,HE=function({bounds:Rt,bitmap:At}){const Pt=Texture.from(At);Fl(this,ev,GE).call(this,Pt,Rt)},U0=new WeakSet,PE=function(){const{top:Rt,bottom:At,left:Pt,right:Dt}=_o(this,Vs);lodashExports.map(_o(this,Bu),Lt=>Lt.call("setFrustum",[{top:Rt,bottom:At,left:Pt,right:Dt}]))},H0=new WeakSet,ME=function(){var Lt,Bt,Nt,jt,Ut;const{tileSubdivision:Rt,accentColor:At}=_o(this,Tl),{tiles:Pt}=getTiles(_o(this,Vs),Rt),Dt=Fl(this,W0,OE).call(this);(Lt=_o(this,wp))==null||Lt.clear(),(Bt=_o(this,wp))==null||Bt.lineStyle(1*Dt,At,.5),(Nt=_o(this,wp))==null||Nt.beginFill(At,.05);for(const{bounds:Gt}of Pt)lodashExports.find((jt=_o(this,$p))==null?void 0:jt.children,qt=>lodashExports.isEqual(qt.bounds,Gt))||(Ut=_o(this,wp))==null||Ut.drawRect(Gt.left,Gt.top,Gt.right-Gt.left,Gt.bottom-Gt.top)},J0=new WeakSet,WE=function(Rt){var Nt;const{accentColor:At}=_o(this,Tl),Pt=Fl(this,W0,OE).call(this),{x:Dt,y:Lt}=_o(this,Vs).toWorld(Rt.globalX,Rt.globalY),Bt=_o(this,Tp).search({minX:Dt,minY:Lt,maxX:Dt+Number.MIN_VALUE,maxY:Lt+Number.MIN_VALUE});_o(this,Cp).clear(),_o(this,Cp).lineStyle(2*Pt,At,1);for(const jt of Bt)(Nt=_o(this,Cp))==null||Nt.drawRect(jt.left,jt.top,jt.right-jt.left,jt.bottom-jt.top)},W0=new WeakSet,OE=function(){const{right:Rt,left:At}=_o(this,Vs),{width:Pt}=_o(this,Tl).screenSize;return(Rt-At)/Pt},ev=new WeakSet,GE=async function(Rt,At){var Lt,Bt;const{tileSubdivision:Pt}=_o(this,Tl),{tiles:Dt}=getTiles(_o(this,Vs),Pt);if(lodashExports.find(Dt,Nt=>lodashExports.isEqual(Nt.bounds,At))){const Nt={x:(At.right-At.left)/Rt.width,y:(At.bottom-At.top)/Rt.height},jt=new Tile(Rt,At);(Lt=_o(this,$p))==null||Lt.addChild(jt).setTransform(At.left,At.top,Nt.x,Nt.y),_o(this,z0).call(this)(),await Fl(this,tv,VE).call(this,jt),lodashExports.forEach((Bt=_o(this,$p))==null?void 0:Bt.children,async Ut=>{intersect(Ut.bounds,At)&&Ut.age{const Dt=Lt=>{Rt.alpha+=Lt/Ticker.targetFPMS/_o(this,Tl).animationDuration,Rt.alpha>1&&(At.remove(Dt),Pt())};Rt.alpha=0,At.add(Dt)})},nv=new WeakSet,qE=function(Rt){const At=_o(this,Zl).ticker;return new Promise(Pt=>{const Dt=Lt=>{Rt.alpha-=Lt/Ticker.targetFPMS/_o(this,Tl).animationDuration,Rt.alpha<0&&(At.remove(Dt),Pt())};Rt.alpha=1,At.add(Dt)})};const D2Renderer$1=makeRenderer(D2Renderer,{components:["rect","circle","path","polygon"],id:"d2-renderer",name:"Pixi",description:"Provides 2D Visualisation Support",version:"1.0.0"}),renderers={"d2-renderer":D2Renderer$1};class NativeRendererTransport{constructor(lt){this.options=lt}async get(){const{hostname:lt}=url$2(this.options.url);return renderers[lt]}}const transports={native:{name:"Internal",constructor:NativeRendererTransport}};function RendererService(){const[{renderer:_e}]=useSettings(),[,lt]=useRenderers();return useAsync(async()=>{const Rt=[];for(const{transport:At,url:Pt,key:Dt,disabled:Lt}of _e??[])if(!Lt){const Bt=new transports[At].constructor({url:Pt});Rt.push({key:Dt,url:Pt,renderer:await Bt.get()})}lt(()=>Rt)},[_e,lt]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}const statusColor$1={connected:"success.light",connecting:"warning.light",error:"error.light",disabled:"text.disabled"};function RendererEditor({value:_e,onValueChange:lt}){const[Rt]=useRenderers(),At=usePaper(),Pt=lodashExports$1.find(Rt,{key:_e.key});function Dt(Bt){lt==null||lt(merge$3(_e,Bt))}const Lt=_e!=null&&_e.disabled?"disabled":Pt?"connected":"error";return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",py:1,children:[jsxRuntimeExports.jsxs(Box$1,{flex:1,sx:{width:0,overflow:"hidden","> *":{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},children:[jsxRuntimeExports.jsx(Type$1,{children:Pt?`${Pt.renderer.meta.name} ${Pt.renderer.meta.version}`:lodashExports$1.startCase(Lt)}),jsxRuntimeExports.jsx(Type$1,{variant:"body2",color:"text.secondary",children:Pt?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("span",{children:Pt.renderer.meta.description}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsxs("span",{children:["Contributes: ",lodashExports$1.join(Pt.renderer.meta.components,", ")]})]}):(_e==null?void 0:_e.url)||"No URL"})]}),jsxRuntimeExports.jsx(Chip$1,{sx:{mx:1,color:statusColor$1[Lt],...lodashExports$1.omit(At(1),"borderRadius")},size:"small",label:lodashExports$1.startCase(Lt)}),jsxRuntimeExports.jsx(Tooltip$1,{title:`${_e.disabled?"Enable":"Disable"} Renderer`,children:jsxRuntimeExports.jsx(Box$1,{children:jsxRuntimeExports.jsx(Switch$2,{checked:!_e.disabled,onChange:(Bt,Nt)=>Dt({disabled:!Nt})})})}),jsxRuntimeExports.jsx(ManagedModal,{trigger:Bt=>jsxRuntimeExports.jsx(IconButtonWithTooltip,{icon:jsxRuntimeExports.jsx(EditIcon,{}),label:"Edit Renderer",sx:{mr:-3},onClick:Bt}),appBar:{children:jsxRuntimeExports.jsx(AppBarTitle,{children:"Edit Renderer"})},children:jsxRuntimeExports.jsxs(Box$1,{p:2.5,children:[jsxRuntimeExports.jsx(TextField$1,{defaultValue:_e.url,onChange:Bt=>Dt({url:Bt.target.value}),fullWidth:!0,variant:"filled",label:"URL",sx:{mb:2}}),jsxRuntimeExports.jsx(SelectField,{placeholder:"Renderer Type",items:lodashExports$1.entries(transports).map(([Bt,{name:Nt}])=>({value:Bt,label:Nt})),fullWidth:!0,value:_e.transport,onChange:Bt=>Dt({transport:Bt})})]})})]})})}function RendererListEditor(){const[{renderer:_e},lt]=useSettings();return jsxRuntimeExports.jsx(Box$1,{sx:{mx:-2},children:jsxRuntimeExports.jsx(ListEditor,{sortable:!0,button:!1,editor:Rt=>jsxRuntimeExports.jsx(RendererEditor,{value:Rt}),icon:null,value:_e,onChange:lodashExports$1.debounce(Rt=>lt(()=>({renderer:Rt})),300),addItemLabel:"Add Renderer",create:()=>({transport:defaultTransport,url:"",disabled:!0}),addItemExtras:jsxRuntimeExports.jsx(FeaturePickerButton,{icon:jsxRuntimeExports.jsx(ResetIcon,{}),onClick:()=>lt(()=>({renderer:defaultRenderers})),children:"Reset to Defaults"})})})}function useConnectionStatus(_e){const[{connections:lt}]=useLoading(),Rt=useConnectionResolver(),[{remote:At}]=useSettings(),Pt=lodashExports$1.find(At,{url:_e});return Pt&&!(Pt!=null&&Pt.disabled)?Rt({url:_e})?"connected":lt?"connecting":_e?"error":"not-connected":"not-connected"}const statusColor={connected:"success.light",connecting:"warning.light",error:"error.light","not-connected":"text.disabled"};function ServerEditor({value:_e,onValueChange:lt}){const Rt=useConnection(_e.url),At=usePaper(),Pt=useConnectionStatus(_e.url),Dt=reactExports.useMemo(()=>debounce$2(Lt=>{lt==null||lt(merge$3(_e,Lt))},300),[lt,_e]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",py:.5,children:[jsxRuntimeExports.jsxs(Box$1,{flex:1,sx:{width:0,overflow:"hidden","> *":{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},children:[jsxRuntimeExports.jsx(Type$1,{children:Rt?`${Rt.name} ${Rt.version}`:lodashExports$1.startCase(Pt)}),jsxRuntimeExports.jsx(Type$1,{variant:"body2",color:"text.secondary",children:(Rt==null?void 0:Rt.description)??((_e==null?void 0:_e.url)||"No URL")})]}),jsxRuntimeExports.jsx(Chip$1,{sx:{mx:1,color:statusColor[Pt],...lodashExports$1.omit(At(1),"borderRadius")},size:"small",label:lodashExports$1.startCase(Pt)}),jsxRuntimeExports.jsx(Tooltip$1,{title:`${_e.disabled?"Enable":"Disable"} Connection`,children:jsxRuntimeExports.jsx(Box$1,{children:jsxRuntimeExports.jsx(Switch$2,{defaultChecked:!_e.disabled,onChange:(Lt,Bt)=>Dt({disabled:!Bt})})})}),jsxRuntimeExports.jsx(ManagedModal,{trigger:Lt=>jsxRuntimeExports.jsx(IconButtonWithTooltip,{icon:jsxRuntimeExports.jsx(EditIcon,{}),label:"Edit Connection",sx:{mr:-3},onClick:Lt}),appBar:{children:jsxRuntimeExports.jsx(AppBarTitle,{children:"Edit Connection"})},children:jsxRuntimeExports.jsxs(Box$1,{p:2.5,children:[jsxRuntimeExports.jsx(TextField$1,{defaultValue:_e.url,onChange:Lt=>Dt({url:Lt.target.value}),fullWidth:!0,variant:"filled",label:"URL",sx:{mb:2}}),jsxRuntimeExports.jsx(SelectField,{placeholder:"Connection Type",items:lodashExports$1.entries(transports$1).map(([Lt,{name:Bt}])=>({value:Lt,label:Bt})),fullWidth:!0,value:_e.transport,onChange:Lt=>Dt({transport:Lt})})]})})]})})}function ServerListEditor(){const[{remote:_e},lt]=useSettings();return jsxRuntimeExports.jsx(Box$1,{sx:{mx:-2},children:jsxRuntimeExports.jsx(ListEditor,{sortable:!0,button:!1,editor:Rt=>jsxRuntimeExports.jsx(ServerEditor,{value:Rt}),icon:null,value:_e,onChange:lodashExports$1.debounce(Rt=>lt(()=>({remote:Rt})),300),addItemLabel:"Add Solver",create:()=>({transport:defaultTransport,url:"",disabled:!0}),addItemExtras:jsxRuntimeExports.jsx(FeaturePickerButton,{icon:jsxRuntimeExports.jsx(ResetIcon,{}),onClick:()=>lt(()=>({remote:defaultRemotes})),children:"Reset to Defaults"})})})}const contacts=[{name:"Dr Daniel Harabor",email:"daniel.harabor@monash.edu"},{name:"Dr Michael Wybrow",email:"michael.wybrow@monash.edu"},{name:"Kevin Zheng",email:"kevin.zheng@monash.edu"},{name:"Francis Anthony",email:"fant0003@student.monash.edu"},{name:"Karan Batta",email:"krnbatta@gmail.com"},{name:"Jay Wingate",email:"jaypeterwingate@gmail.com"},{name:"Leo Whitehead",email:"leo@whiteheadsoftware.dev"},{name:"Can Wang",email:"camwang@outlook.com"},{name:"Rory Tobin-Underwood",email:"rorytu@gmail.com"}];function AboutContent(){function _e(lt,Rt){return jsxRuntimeExports.jsxs(Box$1,{sx:{pt:2},children:[jsxRuntimeExports.jsx(Type$1,{variant:"overline",color:"text.secondary",children:lt}),jsxRuntimeExports.jsx(Type$1,{variant:"body2",children:Rt})]})}return jsxRuntimeExports.jsxs(Box$1,{children:[jsxRuntimeExports.jsx(Box$1,{sx:{pt:0,pb:2},children:jsxRuntimeExports.jsx("img",{src:logo,height:"64"})}),jsxRuntimeExports.jsx(Type$1,{variant:"h6",children:name}),_e("Build Info",jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:version_name})),_e("Team",jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(List$2,{sx:{mx:-2},children:contacts.map(({name:lt,email:Rt},At)=>jsxRuntimeExports.jsxs(ListItemButton$1,{href:`mailto:${Rt}`,children:[jsxRuntimeExports.jsx(ListItemAvatar$1,{children:jsxRuntimeExports.jsx(Avatar$1,{children:lodashExports$1.head(lt)})}),jsxRuntimeExports.jsx(ListItemText$1,{primary:lt,secondary:Rt})]},At))})})),_e("Resources",jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(List$2,{sx:{mx:-2},children:jsxRuntimeExports.jsxs(ListItemButton$1,{target:"_blank",href:"https://github.com/path-visualiser",children:[jsxRuntimeExports.jsx(ListItemIcon$1,{children:jsxRuntimeExports.jsx(GitHub,{})}),jsxRuntimeExports.jsx(ListItemText$1,{primary:"Repository",secondary:"https://github.com/path-visualiser"})]})})}))]})}const formatLabel=_e=>`${_e}x`;function SettingsPage({template:_e}){const{controls:lt,onChange:Rt,state:At,dragHandle:Pt}=useViewTreeContext(),[{"playback/playbackRate":Dt=1,"appearance/acrylic":Lt,"appearance/theme":Bt="light","appearance/accentColor":Nt="teal","behaviour/showOnStart":jt},Ut]=useSettings(),[Gt,qt]=reactExports.useState("general");function Xt(Zt){return jsxRuntimeExports.jsx(Type$1,{variant:"overline",color:"text.secondary",children:Zt})}function Kt(Zt){return jsxRuntimeExports.jsx(Type$1,{variant:"body1",sx:{mr:4,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:Zt})}return jsxRuntimeExports.jsx(TabContext,{value:Gt,children:jsxRuntimeExports.jsxs(_e,{onChange:Rt,stack:At,children:[jsxRuntimeExports.jsx(_e.Title,{children:"Settings"}),jsxRuntimeExports.jsx(_e.Handle,{children:Pt}),jsxRuntimeExports.jsx(_e.Options,{children:jsxRuntimeExports.jsxs(TabList$1,{onChange:(Zt,Qt)=>qt(Qt),children:[jsxRuntimeExports.jsx(Tab$1,{label:"General",value:"general"}),jsxRuntimeExports.jsx(Tab$1,{label:"Connections",value:"connections"}),jsxRuntimeExports.jsx(Tab$1,{label:"Renderers",value:"renderers"}),jsxRuntimeExports.jsx(Tab$1,{label:"Map Parsers",value:"map-parsers"}),jsxRuntimeExports.jsx(Tab$1,{label:"About",value:"about"})]})}),jsxRuntimeExports.jsx(_e.Content,{children:jsxRuntimeExports.jsx(Flex,{vertical:!0,children:jsxRuntimeExports.jsx(Scroll,{y:!0,children:jsxRuntimeExports.jsxs(Flex,{vertical:!0,pt:6,children:[jsxRuntimeExports.jsx(TabPanel$1,{value:"general",sx:{p:2},children:jsxRuntimeExports.jsxs(Box$1,{children:[Xt("Playback"),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[Kt("Playback Rate"),jsxRuntimeExports.jsx(Slider$1,{sx:{maxWidth:320,mr:2},marks:[1,2,5,10].map(Zt=>({value:Zt*defaultPlaybackRate,label:formatLabel(Zt)})),step:1*defaultPlaybackRate,min:1*defaultPlaybackRate,max:10*defaultPlaybackRate,valueLabelFormat:Zt=>formatLabel(Zt/defaultPlaybackRate),valueLabelDisplay:"auto",defaultValue:Dt,onChangeCommitted:(Zt,Qt)=>Ut(()=>({"playback/playbackRate":Qt}))})]}),Xt("Appearance"),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[Kt("Acrylic"),jsxRuntimeExports.jsx(Switch$2,{defaultChecked:!!Lt,onChange:(Zt,Qt)=>Ut(()=>({"appearance/acrylic":Qt}))})]}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[Kt("Dark Mode"),jsxRuntimeExports.jsx(Space,{flex:1}),jsxRuntimeExports.jsx(Switch$2,{defaultChecked:Bt==="dark",onChange:(Zt,Qt)=>Ut(()=>({"appearance/theme":Qt?"dark":"light"}))})]}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[Kt("Accent"),jsxRuntimeExports.jsx(FeaturePicker,{value:Nt,items:lodashExports$1.map(lodashExports$1.keys(accentColors),Zt=>({id:Zt,name:lodashExports$1.startCase(Zt)})),arrow:!0,onChange:Zt=>Ut(()=>({"appearance/accentColor":Zt}))})]}),Xt("Behaviour"),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[Kt("Show Explore Panel on Start-up"),jsxRuntimeExports.jsx(Switch$2,{defaultChecked:!!jt,onChange:(Zt,Qt)=>Ut(()=>({"behaviour/showOnStart":Qt?"explore":void 0}))})]})]})}),jsxRuntimeExports.jsx(TabPanel$1,{value:"connections",sx:{p:2},children:jsxRuntimeExports.jsxs(Box$1,{children:[Xt("Solvers"),jsxRuntimeExports.jsx(ServerListEditor,{})]})}),jsxRuntimeExports.jsx(TabPanel$1,{value:"renderers",sx:{p:2},children:jsxRuntimeExports.jsxs(Box$1,{children:[Xt("Renderers"),jsxRuntimeExports.jsx(RendererListEditor,{})]})}),jsxRuntimeExports.jsx(TabPanel$1,{value:"map-parsers",sx:{p:2},children:jsxRuntimeExports.jsxs(Box$1,{children:[Xt("Map Parsers"),jsxRuntimeExports.jsx(MapParserListEditor,{})]})}),jsxRuntimeExports.jsx(TabPanel$1,{value:"about",sx:{p:2},children:jsxRuntimeExports.jsx(Box$1,{children:jsxRuntimeExports.jsx(AboutContent,{})})})]})})})}),jsxRuntimeExports.jsx(_e.Extras,{children:lt})]})})}function MapParserListEditor(){return jsxRuntimeExports.jsx(List$2,{children:lodashExports$1.keys(mapParsers).map(_e=>jsxRuntimeExports.jsx(ListItem$1,{children:jsxRuntimeExports.jsx(ListItemText$1,{primary:_e,secondary:"Internal"})},_e))})}const PUBLISH=0,SUBSCRIBE=1,RESET=2,VALUE=4;function compose(_e,lt){return Rt=>_e(lt(Rt))}function thrush(_e,lt){return lt(_e)}function curry2to1(_e,lt){return Rt=>_e(lt,Rt)}function curry1to0(_e,lt){return()=>_e(lt)}function tap(_e,lt){return lt(_e),_e}function tup(..._e){return _e}function call(_e){_e()}function always(_e){return()=>_e}function joinProc(..._e){return()=>{_e.map(call)}}function isDefined(_e){return _e!==void 0}function noop(){}function subscribe(_e,lt){return _e(SUBSCRIBE,lt)}function publish(_e,lt){_e(PUBLISH,lt)}function reset(_e){_e(RESET)}function getValue(_e){return _e(VALUE)}function connect(_e,lt){return subscribe(_e,curry2to1(lt,PUBLISH))}function handleNext(_e,lt){const Rt=_e(SUBSCRIBE,At=>{Rt(),lt(At)});return Rt}function stream(){const _e=[];return(lt,Rt)=>{switch(lt){case RESET:_e.splice(0,_e.length);return;case SUBSCRIBE:return _e.push(Rt),()=>{const At=_e.indexOf(Rt);At>-1&&_e.splice(At,1)};case PUBLISH:_e.slice().forEach(At=>{At(Rt)});return;default:throw new Error(`unrecognized action ${lt}`)}}}function statefulStream(_e){let lt=_e;const Rt=stream();return(At,Pt)=>{switch(At){case SUBSCRIBE:Pt(lt);break;case PUBLISH:lt=Pt;break;case VALUE:return lt}return Rt(At,Pt)}}function eventHandler(_e){let lt,Rt;const At=()=>lt&<();return function(Pt,Dt){switch(Pt){case SUBSCRIBE:return Dt?Rt===Dt?void 0:(At(),Rt=Dt,lt=subscribe(_e,Dt),lt):(At(),noop);case RESET:At(),Rt=null;return;default:throw new Error(`unrecognized action ${Pt}`)}}}function streamFromEmitter(_e){return tap(stream(),lt=>connect(_e,lt))}function statefulStreamFromEmitter(_e,lt){return tap(statefulStream(lt),Rt=>connect(_e,Rt))}function combineOperators(..._e){return lt=>_e.reduceRight(thrush,lt)}function pipe(_e,...lt){const Rt=combineOperators(...lt);return(At,Pt)=>{switch(At){case SUBSCRIBE:return subscribe(_e,Rt(Pt));case RESET:reset(_e);return}}}function defaultComparator(_e,lt){return _e===lt}function distinctUntilChanged(_e=defaultComparator){let lt;return Rt=>At=>{_e(lt,At)||(lt=At,Rt(At))}}function filter(_e){return lt=>Rt=>{_e(Rt)&<(Rt)}}function map(_e){return lt=>compose(lt,_e)}function mapTo(_e){return lt=>()=>lt(_e)}function scan(_e,lt){return Rt=>At=>Rt(lt=_e(lt,At))}function skip(_e){return lt=>Rt=>{_e>0?_e--:lt(Rt)}}function throttleTime(_e){let lt=null,Rt;return At=>Pt=>{lt=Pt,!Rt&&(Rt=setTimeout(()=>{Rt=void 0,At(lt)},_e))}}function debounceTime(_e){let lt,Rt;return At=>Pt=>{lt=Pt,Rt&&clearTimeout(Rt),Rt=setTimeout(()=>{At(lt)},_e)}}function withLatestFrom(..._e){const lt=new Array(_e.length);let Rt=0,At=null;const Pt=Math.pow(2,_e.length)-1;return _e.forEach((Dt,Lt)=>{const Bt=Math.pow(2,Lt);subscribe(Dt,Nt=>{const jt=Rt;Rt=Rt|Bt,lt[Lt]=Nt,jt!==Pt&&Rt===Pt&&At&&(At(),At=null)})}),Dt=>Lt=>{const Bt=()=>Dt([Lt].concat(lt));Rt===Pt?Bt():At=Bt}}function merge(..._e){return function(lt,Rt){switch(lt){case SUBSCRIBE:return joinProc(..._e.map(At=>subscribe(At,Rt)));case RESET:return;default:throw new Error(`unrecognized action ${lt}`)}}}function duc(_e,lt=defaultComparator){return pipe(_e,distinctUntilChanged(lt))}function combineLatest(..._e){const lt=stream(),Rt=new Array(_e.length);let At=0;const Pt=Math.pow(2,_e.length)-1;return _e.forEach((Dt,Lt)=>{const Bt=Math.pow(2,Lt);subscribe(Dt,Nt=>{Rt[Lt]=Nt,At=At|Bt,At===Pt&&publish(lt,Rt)})}),function(Dt,Lt){switch(Dt){case SUBSCRIBE:return At===Pt&&Lt(Rt),subscribe(lt,Lt);case RESET:return reset(lt);default:throw new Error(`unrecognized action ${Dt}`)}}}function system(_e,lt=[],{singleton:Rt}={singleton:!0}){return{id:id(),constructor:_e,dependencies:lt,singleton:Rt}}const id=()=>Symbol();function init(_e){const lt=new Map,Rt=({id:At,constructor:Pt,dependencies:Dt,singleton:Lt})=>{if(Lt&<.has(At))return lt.get(At);const Bt=Pt(Dt.map(Nt=>Rt(Nt)));return Lt&<.set(At,Bt),Bt};return Rt(_e)}function omit(_e,lt){const Rt={},At={};let Pt=0;const Dt=_e.length;for(;Pt(en[tn]=an=>{const cn=Jt[lt.methods[tn]];publish(cn,an)},en),{})}function Ut(Jt){return Lt.reduce((en,tn)=>(en[tn]=eventHandler(Jt[lt.events[tn]]),en),{})}const Gt=React.forwardRef((Jt,en)=>{const{children:tn,...an}=Jt,[cn]=React.useState(()=>tap(init(_e),rn=>Nt(rn,an))),[un]=React.useState(curry1to0(Ut,cn));return useIsomorphicLayoutEffect$2(()=>{for(const rn of Lt)rn in an&&subscribe(un[rn],an[rn]);return()=>{Object.values(un).map(reset)}},[an,un,cn]),useIsomorphicLayoutEffect$2(()=>{Nt(cn,an)}),React.useImperativeHandle(en,always(jt(cn))),React.createElement(Bt.Provider,{value:cn},Rt?React.createElement(Rt,omit([...At,...Pt,...Lt],an),tn):tn)}),qt=Jt=>React.useCallback(curry2to1(publish,React.useContext(Bt)[Jt]),[Jt]),Xt=Jt=>{const tn=React.useContext(Bt)[Jt],an=React.useCallback(cn=>subscribe(tn,cn),[tn]);return React.useSyncExternalStore(an,()=>getValue(tn),()=>getValue(tn))},Kt=Jt=>{const tn=React.useContext(Bt)[Jt],[an,cn]=React.useState(curry1to0(getValue,tn));return useIsomorphicLayoutEffect$2(()=>subscribe(tn,un=>{un!==an&&cn(always(un))}),[tn,an]),an},Zt=React.version.startsWith("18")?Xt:Kt;return{Component:Gt,usePublisher:qt,useEmitterValue:Zt,useEmitter:(Jt,en)=>{const an=React.useContext(Bt)[Jt];useIsomorphicLayoutEffect$2(()=>subscribe(an,en),[en,an])}}}const useIsomorphicLayoutEffect=typeof document<"u"?React.useLayoutEffect:React.useEffect,useIsomorphicLayoutEffect$1=useIsomorphicLayoutEffect;var LogLevel=(_e=>(_e[_e.DEBUG=0]="DEBUG",_e[_e.INFO=1]="INFO",_e[_e.WARN=2]="WARN",_e[_e.ERROR=3]="ERROR",_e))(LogLevel||{});const CONSOLE_METHOD_MAP={0:"debug",1:"log",2:"warn",3:"error"},getGlobalThis=()=>typeof globalThis>"u"?window:globalThis,loggerSystem=system(()=>{const _e=statefulStream(3);return{log:statefulStream((Rt,At,Pt=1)=>{var Dt;const Lt=(Dt=getGlobalThis().VIRTUOSO_LOG_LEVEL)!=null?Dt:getValue(_e);Pt>=Lt&&console[CONSOLE_METHOD_MAP[Pt]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",Rt,At)}),logLevel:_e}},[],{singleton:!0});function useSizeWithElRef(_e,lt=!0){const Rt=React.useRef(null);let At=Pt=>{};if(typeof ResizeObserver<"u"){const Pt=React.useMemo(()=>new ResizeObserver(Dt=>{const Lt=Dt[0].target;Lt.offsetParent!==null&&_e(Lt)}),[_e]);At=Dt=>{Dt&<?(Pt.observe(Dt),Rt.current=Dt):(Rt.current&&Pt.unobserve(Rt.current),Rt.current=null)}}return{ref:Rt,callbackRef:At}}function useSize(_e,lt=!0){return useSizeWithElRef(_e,lt).callbackRef}function useChangedListContentsSizes(_e,lt,Rt,At,Pt,Dt,Lt){const Bt=React.useCallback(Nt=>{const jt=getChangedChildSizes(Nt.children,lt,"offsetHeight",Pt);let Ut=Nt.parentElement;for(;!Ut.dataset.virtuosoScroller;)Ut=Ut.parentElement;const Gt=Ut.lastElementChild.dataset.viewportType==="window",qt=Lt?Lt.scrollTop:Gt?window.pageYOffset||document.documentElement.scrollTop:Ut.scrollTop,Xt=Lt?Lt.scrollHeight:Gt?document.documentElement.scrollHeight:Ut.scrollHeight,Kt=Lt?Lt.offsetHeight:Gt?window.innerHeight:Ut.offsetHeight;At({scrollTop:Math.max(qt,0),scrollHeight:Xt,viewportHeight:Kt}),Dt==null||Dt(resolveGapValue$1("row-gap",getComputedStyle(Nt).rowGap,Pt)),jt!==null&&_e(jt)},[_e,lt,Pt,Dt,Lt,At]);return useSizeWithElRef(Bt,Rt)}function getChangedChildSizes(_e,lt,Rt,At){const Pt=_e.length;if(Pt===0)return null;const Dt=[];for(let Lt=0;Lt{const qt=Gt.target,Xt=qt===window||qt===document,Kt=Xt?window.pageYOffset||document.documentElement.scrollTop:qt.scrollTop,Zt=Xt?document.documentElement.scrollHeight:qt.scrollHeight,Qt=Xt?window.innerHeight:qt.offsetHeight,Jt=()=>{_e({scrollTop:Math.max(Kt,0),scrollHeight:Zt,viewportHeight:Qt})};Gt.suppressFlushSync?Jt():ReactDOM.flushSync(Jt),Lt.current!==null&&(Kt===Lt.current||Kt<=0||Kt===Zt-Qt)&&(Lt.current=null,lt(!0),Bt.current&&(clearTimeout(Bt.current),Bt.current=null))},[_e,lt]);React.useEffect(()=>{const Gt=Pt||Dt.current;return At(Pt||Dt.current),Nt({target:Gt,suppressFlushSync:!0}),Gt.addEventListener("scroll",Nt,{passive:!0}),()=>{At(null),Gt.removeEventListener("scroll",Nt)}},[Dt,Nt,Rt,At,Pt]);function jt(Gt){const qt=Dt.current;if(!qt||"offsetHeight"in qt&&qt.offsetHeight===0)return;const Xt=Gt.behavior==="smooth";let Kt,Zt,Qt;qt===window?(Zt=Math.max(correctItemSize(document.documentElement,"height"),document.documentElement.scrollHeight),Kt=window.innerHeight,Qt=document.documentElement.scrollTop):(Zt=qt.scrollHeight,Kt=correctItemSize(qt,"height"),Qt=qt.scrollTop);const Jt=Zt-Kt;if(Gt.top=Math.ceil(Math.max(Math.min(Jt,Gt.top),0)),approximatelyEqual(Kt,Zt)||Gt.top===Qt){_e({scrollTop:Qt,scrollHeight:Zt,viewportHeight:Kt}),Xt&<(!0);return}Xt?(Lt.current=Gt.top,Bt.current&&clearTimeout(Bt.current),Bt.current=setTimeout(()=>{Bt.current=null,Lt.current=null,lt(!0)},1e3)):Lt.current=null,qt.scrollTo(Gt)}function Ut(Gt){Dt.current.scrollBy(Gt)}return{scrollerRef:Dt,scrollByCallback:Ut,scrollToCallback:jt}}const domIOSystem=system(()=>{const _e=stream(),lt=stream(),Rt=statefulStream(0),At=stream(),Pt=statefulStream(0),Dt=stream(),Lt=stream(),Bt=statefulStream(0),Nt=statefulStream(0),jt=statefulStream(0),Ut=statefulStream(0),Gt=stream(),qt=stream(),Xt=statefulStream(!1);return connect(pipe(_e,map(({scrollTop:Kt})=>Kt)),lt),connect(pipe(_e,map(({scrollHeight:Kt})=>Kt)),Lt),connect(lt,Pt),{scrollContainerState:_e,scrollTop:lt,viewportHeight:Dt,headerHeight:Bt,fixedHeaderHeight:Nt,fixedFooterHeight:jt,footerHeight:Ut,scrollHeight:Lt,smoothScrollTargetReached:At,scrollTo:Gt,scrollBy:qt,statefulScrollTop:Pt,deviation:Rt,scrollingInProgress:Xt}},[],{singleton:!0}),NIL_NODE={lvl:0};function newAANode(_e,lt,Rt,At=NIL_NODE,Pt=NIL_NODE){return{k:_e,v:lt,lvl:Rt,l:At,r:Pt}}function empty(_e){return _e===NIL_NODE}function newTree(){return NIL_NODE}function remove(_e,lt){if(empty(_e))return NIL_NODE;const{k:Rt,l:At,r:Pt}=_e;if(lt===Rt){if(empty(At))return Pt;if(empty(Pt))return At;{const[Dt,Lt]=last(At);return adjust(clone(_e,{k:Dt,v:Lt,l:deleteLast(At)}))}}else return ltlt&&(Bt=Bt.concat(walkWithin(Dt,lt,Rt))),At>=lt&&At<=Rt&&Bt.push({k:At,v:Pt}),At<=Rt&&(Bt=Bt.concat(walkWithin(Lt,lt,Rt))),Bt}function walk(_e){return empty(_e)?[]:[...walk(_e.l),{k:_e.k,v:_e.v},...walk(_e.r)]}function last(_e){return empty(_e.r)?[_e.k,_e.v]:last(_e.r)}function deleteLast(_e){return empty(_e.r)?_e.l:adjust(clone(_e,{r:deleteLast(_e.r)}))}function clone(_e,lt){return newAANode(lt.k!==void 0?lt.k:_e.k,lt.v!==void 0?lt.v:_e.v,lt.lvl!==void 0?lt.lvl:_e.lvl,lt.l!==void 0?lt.l:_e.l,lt.r!==void 0?lt.r:_e.r)}function isSingle(_e){return empty(_e)||_e.lvl>_e.r.lvl}function rebalance(_e){return split(skew(_e))}function adjust(_e){const{l:lt,r:Rt,lvl:At}=_e;if(Rt.lvl>=At-1&<.lvl>=At-1)return _e;if(At>Rt.lvl+1){if(isSingle(lt))return skew(clone(_e,{lvl:At-1}));if(!empty(lt)&&!empty(lt.r))return clone(lt.r,{l:clone(lt,{r:lt.r.l}),r:clone(_e,{l:lt.r.r,lvl:At-1}),lvl:At});throw new Error("Unexpected empty nodes")}else{if(isSingle(_e))return split(clone(_e,{lvl:At-1}));if(!empty(Rt)&&!empty(Rt.l)){const Pt=Rt.l,Dt=isSingle(Pt)?Rt.lvl-1:Rt.lvl;return clone(Pt,{l:clone(_e,{r:Pt.l,lvl:At-1}),r:split(clone(Rt,{l:Pt.r,lvl:Dt})),lvl:Pt.lvl+1})}else throw new Error("Unexpected empty nodes")}}function rangesWithin(_e,lt,Rt){if(empty(_e))return[];const At=findMaxKeyValue(_e,lt)[0];return toRanges(walkWithin(_e,At,Rt))}function arrayToRanges(_e,lt){const Rt=_e.length;if(Rt===0)return[];let{index:At,value:Pt}=lt(_e[0]);const Dt=[];for(let Lt=1;Lt({index:lt,value:Rt}))}function split(_e){const{r:lt,lvl:Rt}=_e;return!empty(lt)&&!empty(lt.r)&<.lvl===Rt&<.r.lvl===Rt?clone(lt,{l:clone(_e,{r:lt.l}),lvl:Rt+1}):_e}function skew(_e){const{l:lt}=_e;return!empty(lt)&<.lvl===_e.lvl?clone(lt,{r:clone(_e,{l:lt.r})}):_e}function findIndexOfClosestSmallerOrEqual(_e,lt,Rt,At=0){let Pt=_e.length-1;for(;At<=Pt;){const Dt=Math.floor((At+Pt)/2),Lt=_e[Dt],Bt=Rt(Lt,lt);if(Bt===0)return Dt;if(Bt===-1){if(Pt-At<2)return Dt-1;Pt=Dt-1}else{if(Pt===At)return Dt;At=Dt+1}}throw new Error(`Failed binary finding record in array - ${_e.join(",")}, searched for ${lt}`)}function findClosestSmallerOrEqual(_e,lt,Rt){return _e[findIndexOfClosestSmallerOrEqual(_e,lt,Rt)]}function findRange(_e,lt,Rt,At){const Pt=findIndexOfClosestSmallerOrEqual(_e,lt,At),Dt=findIndexOfClosestSmallerOrEqual(_e,Rt,At,Pt);return _e.slice(Pt,Dt+1)}const recalcSystem=system(()=>({recalcInProgress:statefulStream(!1)}),[],{singleton:!0});function rangeIncludes(_e){const{size:lt,startIndex:Rt,endIndex:At}=_e;return Pt=>Pt.start===Rt&&(Pt.end===At||Pt.end===1/0)&&Pt.value===lt}function affectedGroupCount(_e,lt){let Rt=0,At=0;for(;Rt<_e;)Rt+=lt[At+1]-lt[At]-1,At++;return At-(Rt===_e?0:1)}function insertRanges(_e,lt){let Rt=empty(_e)?0:1/0;for(const At of lt){const{size:Pt,startIndex:Dt,endIndex:Lt}=At;if(Rt=Math.min(Rt,Dt),empty(_e)){_e=insert(_e,0,Pt);continue}const Bt=rangesWithin(_e,Dt-1,Lt+1);if(Bt.some(rangeIncludes(At)))continue;let Nt=!1,jt=!1;for(const{start:Ut,end:Gt,value:qt}of Bt)Nt?(Lt>=Ut||Pt===qt)&&(_e=remove(_e,Ut)):(jt=qt!==Pt,Nt=!0),Gt>Lt&&Lt>=Ut&&qt!==Pt&&(_e=insert(_e,Lt+1,qt));jt&&(_e=insert(_e,Dt,Pt))}return[_e,Rt]}function initialSizeState(){return{offsetTree:[],sizeTree:newTree(),groupOffsetTree:newTree(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function indexComparator({index:_e},lt){return lt===_e?0:lt<_e?-1:1}function offsetComparator({offset:_e},lt){return lt===_e?0:lt<_e?-1:1}function offsetPointParser(_e){return{index:_e.index,value:_e}}function rangesWithinOffsets(_e,lt,Rt,At=0){return At>0&&(lt=Math.max(lt,findClosestSmallerOrEqual(_e,At,indexComparator).offset)),arrayToRanges(findRange(_e,lt,Rt,offsetComparator),offsetPointParser)}function createOffsetTree(_e,lt,Rt,At){let Pt=_e,Dt=0,Lt=0,Bt=0,Nt=0;if(lt!==0){Nt=findIndexOfClosestSmallerOrEqual(Pt,lt-1,indexComparator),Bt=Pt[Nt].offset;const Ut=findMaxKeyValue(Rt,lt-1);Dt=Ut[0],Lt=Ut[1],Pt.length&&Pt[Nt].size===findMaxKeyValue(Rt,lt)[1]&&(Nt-=1),Pt=Pt.slice(0,Nt+1)}else Pt=[];for(const{start:jt,value:Ut}of rangesWithin(Rt,lt,1/0)){const Gt=jt-Dt,qt=Gt*Lt+Bt+Gt*At;Pt.push({offset:qt,size:Ut,index:jt}),Dt=jt,Bt=qt,Lt=Ut}return{offsetTree:Pt,lastIndex:Dt,lastOffset:Bt,lastSize:Lt}}function sizeStateReducer(_e,[lt,Rt,At,Pt]){lt.length>0&&At("received item sizes",lt,LogLevel.DEBUG);const Dt=_e.sizeTree;let Lt=Dt,Bt=0;if(Rt.length>0&&empty(Dt)&<.length===2){const qt=lt[0].size,Xt=lt[1].size;Lt=Rt.reduce((Kt,Zt)=>insert(insert(Kt,Zt,qt),Zt+1,Xt),Lt)}else[Lt,Bt]=insertRanges(Lt,lt);if(Lt===Dt)return _e;const{offsetTree:Nt,lastIndex:jt,lastSize:Ut,lastOffset:Gt}=createOffsetTree(_e.offsetTree,Bt,Lt,Pt);return{sizeTree:Lt,offsetTree:Nt,lastIndex:jt,lastOffset:Gt,lastSize:Ut,groupOffsetTree:Rt.reduce((qt,Xt)=>insert(qt,Xt,offsetOf(Xt,Nt,Pt)),newTree()),groupIndices:Rt}}function offsetOf(_e,lt,Rt){if(lt.length===0)return 0;const{offset:At,index:Pt,size:Dt}=findClosestSmallerOrEqual(lt,_e,indexComparator),Lt=_e-Pt,Bt=Dt*Lt+(Lt-1)*Rt+At;return Bt>0?Bt+Rt:Bt}function isGroupLocation(_e){return typeof _e.groupIndex<"u"}function originalIndexFromLocation(_e,lt,Rt){if(isGroupLocation(_e))return lt.groupIndices[_e.groupIndex]+1;{const At=_e.index==="LAST"?Rt:_e.index;let Pt=originalIndexFromItemIndex(At,lt);return Pt=Math.max(0,Pt,Math.min(Rt,Pt)),Pt}}function originalIndexFromItemIndex(_e,lt){if(!hasGroups(lt))return _e;let Rt=0;for(;lt.groupIndices[Rt]<=_e+Rt;)Rt++;return _e+Rt}function hasGroups(_e){return!empty(_e.groupOffsetTree)}function sizeTreeToRanges(_e){return walk(_e).map(({k:lt,v:Rt},At,Pt)=>{const Dt=Pt[At+1],Lt=Dt?Dt.k-1:1/0;return{startIndex:lt,endIndex:Lt,size:Rt}})}const SIZE_MAP={offsetHeight:"height",offsetWidth:"width"},sizeSystem=system(([{log:_e},{recalcInProgress:lt}])=>{const Rt=stream(),At=stream(),Pt=statefulStreamFromEmitter(At,0),Dt=stream(),Lt=stream(),Bt=statefulStream(0),Nt=statefulStream([]),jt=statefulStream(void 0),Ut=statefulStream(void 0),Gt=statefulStream((cn,un)=>correctItemSize(cn,SIZE_MAP[un])),qt=statefulStream(void 0),Xt=statefulStream(0),Kt=initialSizeState(),Zt=statefulStreamFromEmitter(pipe(Rt,withLatestFrom(Nt,_e,Xt),scan(sizeStateReducer,Kt),distinctUntilChanged()),Kt),Qt=statefulStreamFromEmitter(pipe(Nt,distinctUntilChanged(),scan((cn,un)=>({prev:cn.current,current:un}),{prev:[],current:[]}),map(({prev:cn})=>cn)),[]);connect(pipe(Nt,filter(cn=>cn.length>0),withLatestFrom(Zt,Xt),map(([cn,un,rn])=>{const sn=cn.reduce((pn,bn,gn)=>insert(pn,bn,offsetOf(bn,un.offsetTree,rn)||gn),newTree());return{...un,groupIndices:cn,groupOffsetTree:sn}})),Zt),connect(pipe(At,withLatestFrom(Zt),filter(([cn,{lastIndex:un}])=>cn[{startIndex:cn,endIndex:un,size:rn}])),Rt),connect(jt,Ut);const Jt=statefulStreamFromEmitter(pipe(jt,map(cn=>cn===void 0)),!0);connect(pipe(Ut,filter(cn=>cn!==void 0&&empty(getValue(Zt).sizeTree)),map(cn=>[{startIndex:0,endIndex:0,size:cn}])),Rt);const en=streamFromEmitter(pipe(Rt,withLatestFrom(Zt),scan(({sizes:cn},[un,rn])=>({changed:rn!==cn,sizes:rn}),{changed:!1,sizes:Kt}),map(cn=>cn.changed)));subscribe(pipe(Bt,scan((cn,un)=>({diff:cn.prev-un,prev:un}),{diff:0,prev:0}),map(cn=>cn.diff)),cn=>{const{groupIndices:un}=getValue(Zt);if(cn>0)publish(lt,!0),publish(Dt,cn+affectedGroupCount(cn,un));else if(cn<0){const rn=getValue(Qt);rn.length>0&&(cn-=affectedGroupCount(-cn,rn)),publish(Lt,cn)}}),subscribe(pipe(Bt,withLatestFrom(_e)),([cn,un])=>{cn<0&&un("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:Bt},LogLevel.ERROR)});const tn=streamFromEmitter(Dt);connect(pipe(Dt,withLatestFrom(Zt),map(([cn,un])=>{const rn=un.groupIndices.length>0,sn=[],pn=un.lastSize;if(rn){const bn=find(un.sizeTree,0);let gn=0,_n=0;for(;gn{let Cn=Mn.ranges;return Mn.prevSize!==0&&(Cn=[...Mn.ranges,{startIndex:Mn.prevIndex,endIndex:Tn+cn-1,size:Mn.prevSize}]),{ranges:Cn,prevIndex:Tn+cn,prevSize:An}},{ranges:sn,prevIndex:cn,prevSize:0}).ranges}return walk(un.sizeTree).reduce((bn,{k:gn,v:_n})=>({ranges:[...bn.ranges,{startIndex:bn.prevIndex,endIndex:gn+cn-1,size:bn.prevSize}],prevIndex:gn+cn,prevSize:_n}),{ranges:[],prevIndex:0,prevSize:pn}).ranges})),Rt);const an=streamFromEmitter(pipe(Lt,withLatestFrom(Zt,Xt),map(([cn,{offsetTree:un},rn])=>{const sn=-cn;return offsetOf(sn,un,rn)})));return connect(pipe(Lt,withLatestFrom(Zt,Xt),map(([cn,un,rn])=>{if(un.groupIndices.length>0){if(empty(un.sizeTree))return un;let pn=newTree();const bn=getValue(Qt);let gn=0,_n=0,xn=0;for(;gn<-cn;){xn=bn[_n];const Mn=bn[_n+1]-xn-1;_n++,gn+=Mn+1}if(pn=walk(un.sizeTree).reduce((Mn,{k:Tn,v:An})=>insert(Mn,Math.max(0,Tn+cn),An),pn),gn!==-cn){const Mn=find(un.sizeTree,xn);pn=insert(pn,0,Mn);const Tn=findMaxKeyValue(un.sizeTree,-cn+1)[1];pn=insert(pn,1,Tn)}return{...un,sizeTree:pn,...createOffsetTree(un.offsetTree,0,pn,rn)}}else{const pn=walk(un.sizeTree).reduce((bn,{k:gn,v:_n})=>insert(bn,Math.max(0,gn+cn),_n),newTree());return{...un,sizeTree:pn,...createOffsetTree(un.offsetTree,0,pn,rn)}}})),Zt),{data:qt,totalCount:At,sizeRanges:Rt,groupIndices:Nt,defaultItemSize:Ut,fixedItemSize:jt,unshiftWith:Dt,shiftWith:Lt,shiftWithOffset:an,beforeUnshiftWith:tn,firstItemIndex:Bt,gap:Xt,sizes:Zt,listRefresh:en,statefulTotalCount:Pt,trackItemSizes:Jt,itemSize:Gt}},tup(loggerSystem,recalcSystem),{singleton:!0}),SUPPORTS_SCROLL_TO_OPTIONS=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function normalizeIndexLocation(_e){const lt=typeof _e=="number"?{index:_e}:_e;return lt.align||(lt.align="start"),(!lt.behavior||!SUPPORTS_SCROLL_TO_OPTIONS)&&(lt.behavior="auto"),lt.offset||(lt.offset=0),lt}const scrollToIndexSystem=system(([{sizes:_e,totalCount:lt,listRefresh:Rt,gap:At},{scrollingInProgress:Pt,viewportHeight:Dt,scrollTo:Lt,smoothScrollTargetReached:Bt,headerHeight:Nt,footerHeight:jt,fixedHeaderHeight:Ut,fixedFooterHeight:Gt},{log:qt}])=>{const Xt=stream(),Kt=statefulStream(0);let Zt=null,Qt=null,Jt=null;function en(){Zt&&(Zt(),Zt=null),Jt&&(Jt(),Jt=null),Qt&&(clearTimeout(Qt),Qt=null),publish(Pt,!1)}return connect(pipe(Xt,withLatestFrom(_e,Dt,lt,Kt,Nt,jt,qt),withLatestFrom(At,Ut,Gt),map(([[tn,an,cn,un,rn,sn,pn,bn],gn,_n,xn])=>{const ln=normalizeIndexLocation(tn),{align:Mn,behavior:Tn,offset:An}=ln,Cn=un-1,wn=originalIndexFromLocation(ln,an,Cn);let Fn=offsetOf(wn,an.offsetTree,gn)+sn;Mn==="end"?(Fn+=_n+findMaxKeyValue(an.sizeTree,wn)[1]-cn+xn,wn===Cn&&(Fn+=pn)):Mn==="center"?Fn+=(_n+findMaxKeyValue(an.sizeTree,wn)[1]-cn+xn)/2:Fn-=rn,An&&(Fn+=An);const $n=Pn=>{en(),Pn?(bn("retrying to scroll to",{location:tn},LogLevel.DEBUG),publish(Xt,tn)):bn("list did not change, scroll successful",{},LogLevel.DEBUG)};if(en(),Tn==="smooth"){let Pn=!1;Jt=subscribe(Rt,Vn=>{Pn=Pn||Vn}),Zt=handleNext(Bt,()=>{$n(Pn)})}else Zt=handleNext(pipe(Rt,watchChangesFor(150)),$n);return Qt=setTimeout(()=>{en()},1200),publish(Pt,!0),bn("scrolling from index to",{index:wn,top:Fn,behavior:Tn},LogLevel.DEBUG),{top:Fn,behavior:Tn}})),Lt),{scrollToIndex:Xt,topListHeight:Kt}},tup(sizeSystem,domIOSystem,loggerSystem),{singleton:!0});function watchChangesFor(_e){return lt=>{const Rt=setTimeout(()=>{lt(!1)},_e);return At=>{At&&(lt(!0),clearTimeout(Rt))}}}const UP="up",DOWN="down",NONE$1="none",INITIAL_BOTTOM_STATE={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},DEFAULT_AT_TOP_THRESHOLD=0,stateFlagsSystem=system(([{scrollContainerState:_e,scrollTop:lt,viewportHeight:Rt,headerHeight:At,footerHeight:Pt,scrollBy:Dt}])=>{const Lt=statefulStream(!1),Bt=statefulStream(!0),Nt=stream(),jt=stream(),Ut=statefulStream(4),Gt=statefulStream(DEFAULT_AT_TOP_THRESHOLD),qt=statefulStreamFromEmitter(pipe(merge(pipe(duc(lt),skip(1),mapTo(!0)),pipe(duc(lt),skip(1),mapTo(!1),debounceTime(100))),distinctUntilChanged()),!1),Xt=statefulStreamFromEmitter(pipe(merge(pipe(Dt,mapTo(!0)),pipe(Dt,mapTo(!1),debounceTime(200))),distinctUntilChanged()),!1);connect(pipe(combineLatest(duc(lt),duc(Gt)),map(([en,tn])=>en<=tn),distinctUntilChanged()),Bt),connect(pipe(Bt,throttleTime(50)),jt);const Kt=streamFromEmitter(pipe(combineLatest(_e,duc(Rt),duc(At),duc(Pt),duc(Ut)),scan((en,[{scrollTop:tn,scrollHeight:an},cn,un,rn,sn])=>{const pn=tn+cn-an>-sn,bn={viewportHeight:cn,scrollTop:tn,scrollHeight:an};if(pn){let _n,xn;return tn>en.state.scrollTop?(_n="SCROLLED_DOWN",xn=en.state.scrollTop-tn):(_n="SIZE_DECREASED",xn=en.state.scrollTop-tn||en.scrollTopDelta),{atBottom:!0,state:bn,atBottomBecause:_n,scrollTopDelta:xn}}let gn;return bn.scrollHeight>en.state.scrollHeight?gn="SIZE_INCREASED":cnen&&en.atBottom===tn.atBottom))),Zt=statefulStreamFromEmitter(pipe(_e,scan((en,{scrollTop:tn,scrollHeight:an,viewportHeight:cn})=>{if(approximatelyEqual(en.scrollHeight,an))return{scrollTop:tn,scrollHeight:an,jump:0,changed:!1};{const un=an-(tn+cn)<1;return en.scrollTop!==tn&&un?{scrollHeight:an,scrollTop:tn,jump:en.scrollTop-tn,changed:!0}:{scrollHeight:an,scrollTop:tn,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),filter(en=>en.changed),map(en=>en.jump)),0);connect(pipe(Kt,map(en=>en.atBottom)),Lt),connect(pipe(Lt,throttleTime(50)),Nt);const Qt=statefulStream(DOWN);connect(pipe(_e,map(({scrollTop:en})=>en),distinctUntilChanged(),scan((en,tn)=>getValue(Xt)?{direction:en.direction,prevScrollTop:tn}:{direction:tnen.direction)),Qt),connect(pipe(_e,throttleTime(50),mapTo(NONE$1)),Qt);const Jt=statefulStream(0);return connect(pipe(qt,filter(en=>!en),mapTo(0)),Jt),connect(pipe(lt,throttleTime(100),withLatestFrom(qt),filter(([en,tn])=>!!tn),scan(([en,tn],[an])=>[tn,an],[0,0]),map(([en,tn])=>tn-en)),Jt),{isScrolling:qt,isAtTop:Bt,isAtBottom:Lt,atBottomState:Kt,atTopStateChange:jt,atBottomStateChange:Nt,scrollDirection:Qt,atBottomThreshold:Ut,atTopThreshold:Gt,scrollVelocity:Jt,lastJumpDueToItemResize:Zt}},tup(domIOSystem)),propsReadySystem=system(([{log:_e}])=>{const lt=statefulStream(!1),Rt=streamFromEmitter(pipe(lt,filter(At=>At),distinctUntilChanged()));return subscribe(lt,At=>{At&&getValue(_e)("props updated",{},LogLevel.DEBUG)}),{propsReady:lt,didMount:Rt}},tup(loggerSystem),{singleton:!0});function skipFrames(_e,lt){_e==0?lt():requestAnimationFrame(()=>skipFrames(_e-1,lt))}function getInitialTopMostItemIndexNumber(_e,lt){const Rt=lt-1;return typeof _e=="number"?_e:_e.index==="LAST"?Rt:_e.index}const initialTopMostItemIndexSystem=system(([{sizes:_e,listRefresh:lt,defaultItemSize:Rt},{scrollTop:At},{scrollToIndex:Pt},{didMount:Dt}])=>{const Lt=statefulStream(!0),Bt=statefulStream(0),Nt=statefulStream(!1);return connect(pipe(Dt,withLatestFrom(Bt),filter(([jt,Ut])=>!!Ut),mapTo(!1)),Lt),subscribe(pipe(combineLatest(lt,Dt),withLatestFrom(Lt,_e,Rt,Nt),filter(([[,jt],Ut,{sizeTree:Gt},qt,Xt])=>jt&&(!empty(Gt)||isDefined(qt))&&!Ut&&!Xt),withLatestFrom(Bt)),([,jt])=>{publish(Nt,!0),skipFrames(3,()=>{handleNext(At,()=>publish(Lt,!0)),publish(Pt,jt)})}),{scrolledToInitialItem:Lt,initialTopMostItemIndex:Bt}},tup(sizeSystem,domIOSystem,scrollToIndexSystem,propsReadySystem),{singleton:!0});function normalizeFollowOutput(_e){return _e?_e==="smooth"?"smooth":"auto":!1}const behaviorFromFollowOutput=(_e,lt)=>typeof _e=="function"?normalizeFollowOutput(_e(lt)):lt&&normalizeFollowOutput(_e),followOutputSystem=system(([{totalCount:_e,listRefresh:lt},{isAtBottom:Rt,atBottomState:At},{scrollToIndex:Pt},{scrolledToInitialItem:Dt},{propsReady:Lt,didMount:Bt},{log:Nt},{scrollingInProgress:jt}])=>{const Ut=statefulStream(!1),Gt=stream();let qt=null;function Xt(Zt){publish(Pt,{index:"LAST",align:"end",behavior:Zt})}subscribe(pipe(combineLatest(pipe(duc(_e),skip(1)),Bt),withLatestFrom(duc(Ut),Rt,Dt,jt),map(([[Zt,Qt],Jt,en,tn,an])=>{let cn=Qt&&tn,un="auto";return cn&&(un=behaviorFromFollowOutput(Jt,en||an),cn=cn&&!!un),{totalCount:Zt,shouldFollow:cn,followOutputBehavior:un}}),filter(({shouldFollow:Zt})=>Zt)),({totalCount:Zt,followOutputBehavior:Qt})=>{qt&&(qt(),qt=null),qt=handleNext(lt,()=>{getValue(Nt)("following output to ",{totalCount:Zt},LogLevel.DEBUG),Xt(Qt),qt=null})});function Kt(Zt){const Qt=handleNext(At,Jt=>{Zt&&!Jt.atBottom&&Jt.notAtBottomBecause==="SIZE_INCREASED"&&!qt&&(getValue(Nt)("scrolling to bottom due to increased size",{},LogLevel.DEBUG),Xt("auto"))});setTimeout(Qt,100)}return subscribe(pipe(combineLatest(duc(Ut),_e,Lt),filter(([Zt,,Qt])=>Zt&&Qt),scan(({value:Zt},[,Qt])=>({refreshed:Zt===Qt,value:Qt}),{refreshed:!1,value:0}),filter(({refreshed:Zt})=>Zt),withLatestFrom(Ut,_e)),([,Zt])=>{Kt(Zt!==!1)}),subscribe(Gt,()=>{Kt(getValue(Ut)!==!1)}),subscribe(combineLatest(duc(Ut),At),([Zt,Qt])=>{Zt&&!Qt.atBottom&&Qt.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&Xt("auto")}),{followOutput:Ut,autoscrollToBottom:Gt}},tup(sizeSystem,stateFlagsSystem,scrollToIndexSystem,initialTopMostItemIndexSystem,propsReadySystem,loggerSystem,domIOSystem));function groupCountsToIndicesAndCount(_e){return _e.reduce((lt,Rt)=>(lt.groupIndices.push(lt.totalCount),lt.totalCount+=Rt+1,lt),{totalCount:0,groupIndices:[]})}const groupedListSystem=system(([{totalCount:_e,groupIndices:lt,sizes:Rt},{scrollTop:At,headerHeight:Pt}])=>{const Dt=stream(),Lt=stream(),Bt=streamFromEmitter(pipe(Dt,map(groupCountsToIndicesAndCount)));return connect(pipe(Bt,map(Nt=>Nt.totalCount)),_e),connect(pipe(Bt,map(Nt=>Nt.groupIndices)),lt),connect(pipe(combineLatest(At,Rt,Pt),filter(([Nt,jt])=>hasGroups(jt)),map(([Nt,jt,Ut])=>findMaxKeyValue(jt.groupOffsetTree,Math.max(Nt-Ut,0),"v")[0]),distinctUntilChanged(),map(Nt=>[Nt])),Lt),{groupCounts:Dt,topItemsIndexes:Lt}},tup(sizeSystem,domIOSystem));function tupleComparator(_e,lt){return!!(_e&&_e[0]===lt[0]&&_e[1]===lt[1])}function rangeComparator(_e,lt){return!!(_e&&_e.startIndex===lt.startIndex&&_e.endIndex===lt.endIndex)}const TOP="top",BOTTOM="bottom",NONE="none";function getOverscan(_e,lt,Rt){return typeof _e=="number"?Rt===UP&<===TOP||Rt===DOWN&<===BOTTOM?_e:0:Rt===UP?lt===TOP?_e.main:_e.reverse:lt===BOTTOM?_e.main:_e.reverse}function getViewportIncrease(_e,lt){return typeof _e=="number"?_e:_e[lt]||0}const sizeRangeSystem=system(([{scrollTop:_e,viewportHeight:lt,deviation:Rt,headerHeight:At,fixedHeaderHeight:Pt}])=>{const Dt=stream(),Lt=statefulStream(0),Bt=statefulStream(0),Nt=statefulStream(0),jt=statefulStreamFromEmitter(pipe(combineLatest(duc(_e),duc(lt),duc(At),duc(Dt,tupleComparator),duc(Nt),duc(Lt),duc(Pt),duc(Rt),duc(Bt)),map(([Ut,Gt,qt,[Xt,Kt],Zt,Qt,Jt,en,tn])=>{const an=Ut-en,cn=Qt+Jt,un=Math.max(qt-an,0);let rn=NONE;const sn=getViewportIncrease(tn,TOP),pn=getViewportIncrease(tn,BOTTOM);return Xt-=en,Xt+=qt+Jt,Kt+=qt+Jt,Kt-=en,Xt>Ut+cn-sn&&(rn=UP),KtUt!=null),distinctUntilChanged(tupleComparator)),[0,0]);return{listBoundary:Dt,overscan:Nt,topListHeight:Lt,increaseViewportBy:Bt,visibleRange:jt}},tup(domIOSystem),{singleton:!0});function probeItemSet(_e,lt,Rt){if(hasGroups(lt)){const At=originalIndexFromItemIndex(_e,lt);return[{index:findMaxKeyValue(lt.groupOffsetTree,At)[0],size:0,offset:0},{index:At,size:0,offset:0,data:Rt&&Rt[0]}]}return[{index:_e,size:0,offset:0,data:Rt&&Rt[0]}]}const EMPTY_LIST_STATE={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function transposeItems(_e,lt,Rt){if(_e.length===0)return[];if(!hasGroups(lt))return _e.map(jt=>({...jt,index:jt.index+Rt,originalIndex:jt.index}));const At=_e[0].index,Pt=_e[_e.length-1].index,Dt=[],Lt=rangesWithin(lt.groupOffsetTree,At,Pt);let Bt,Nt=0;for(const jt of _e){(!Bt||Bt.end0){jt=_e[0].offset;const Zt=_e[_e.length-1];Ut=Zt.offset+Zt.size}const Gt=Rt-Nt,qt=Bt+Gt*Lt+(Gt-1)*At,Xt=jt,Kt=qt-Ut;return{items:transposeItems(_e,Pt,Dt),topItems:transposeItems(lt,Pt,Dt),topListHeight:lt.reduce((Zt,Qt)=>Qt.size+Zt,0),offsetTop:jt,offsetBottom:Kt,top:Xt,bottom:Ut,totalCount:Rt,firstItemIndex:Dt}}function buildListStateFromItemCount(_e,lt,Rt,At,Pt,Dt){let Lt=0;if(Rt.groupIndices.length>0)for(const Ut of Rt.groupIndices){if(Ut-Lt>=_e)break;Lt++}const Bt=_e+Lt,Nt=getInitialTopMostItemIndexNumber(lt,Bt),jt=Array.from({length:Bt}).map((Ut,Gt)=>({index:Gt+Nt,size:0,offset:0,data:Dt[Gt+Nt]}));return buildListState(jt,[],Bt,Pt,Rt,At)}const listStateSystem=system(([{sizes:_e,totalCount:lt,data:Rt,firstItemIndex:At,gap:Pt},Dt,{visibleRange:Lt,listBoundary:Bt,topListHeight:Nt},{scrolledToInitialItem:jt,initialTopMostItemIndex:Ut},{topListHeight:Gt},qt,{didMount:Xt},{recalcInProgress:Kt}])=>{const Zt=statefulStream([]),Qt=statefulStream(0),Jt=stream();connect(Dt.topItemsIndexes,Zt);const en=statefulStreamFromEmitter(pipe(combineLatest(Xt,Kt,duc(Lt,tupleComparator),duc(lt),duc(_e),duc(Ut),jt,duc(Zt),duc(At),duc(Pt),Rt),filter(([un,rn,,sn,,,,,,,pn])=>{const bn=pn&&pn.length!==sn;return un&&!rn&&!bn}),map(([,,[un,rn],sn,pn,bn,gn,_n,xn,ln,Mn])=>{const Tn=pn,{sizeTree:An,offsetTree:Cn}=Tn,wn=getValue(Qt);if(sn===0)return{...EMPTY_LIST_STATE,totalCount:sn};if(un===0&&rn===0)return wn===0?{...EMPTY_LIST_STATE,totalCount:sn}:buildListStateFromItemCount(wn,bn,pn,xn,ln,Mn||[]);if(empty(An))return wn>0?null:buildListState(probeItemSet(getInitialTopMostItemIndexNumber(bn,sn),Tn,Mn),[],sn,ln,Tn,xn);const Fn=[];if(_n.length>0){const tr=_n[0],yn=_n[_n.length-1];let En=0;for(const kn of rangesWithin(An,tr,yn)){const zn=kn.value,dn=Math.max(kn.start,tr),hn=Math.min(kn.end,yn);for(let vn=dn;vn<=hn;vn++)Fn.push({index:vn,size:zn,offset:En,data:Mn&&Mn[vn]}),En+=zn}}if(!gn)return buildListState([],Fn,sn,ln,Tn,xn);const $n=_n.length>0?_n[_n.length-1]+1:0,Pn=rangesWithinOffsets(Cn,un,rn,$n);if(Pn.length===0)return null;const Vn=sn-1,Zn=tap([],tr=>{for(const yn of Pn){const En=yn.value;let kn=En.offset,zn=yn.start;const dn=En.size;if(En.offset=rn);vn++)tr.push({index:vn,size:dn,offset:kn,data:Mn&&Mn[vn]}),kn+=dn+ln}});return buildListState(Zn,Fn,sn,ln,Tn,xn)}),filter(un=>un!==null),distinctUntilChanged()),EMPTY_LIST_STATE);connect(pipe(Rt,filter(isDefined),map(un=>un==null?void 0:un.length)),lt),connect(pipe(en,map(un=>un.topListHeight)),Gt),connect(Gt,Nt),connect(pipe(en,map(un=>[un.top,un.bottom])),Bt),connect(pipe(en,map(un=>un.items)),Jt);const tn=streamFromEmitter(pipe(en,filter(({items:un})=>un.length>0),withLatestFrom(lt,Rt),filter(([{items:un},rn])=>un[un.length-1].originalIndex===rn-1),map(([,un,rn])=>[un-1,rn]),distinctUntilChanged(tupleComparator),map(([un])=>un))),an=streamFromEmitter(pipe(en,throttleTime(200),filter(({items:un,topItems:rn})=>un.length>0&&un[0].originalIndex===rn.length),map(({items:un})=>un[0].index),distinctUntilChanged())),cn=streamFromEmitter(pipe(en,filter(({items:un})=>un.length>0),map(({items:un})=>{let rn=0,sn=un.length-1;for(;un[rn].type==="group"&&rnrn;)sn--;return{startIndex:un[rn].index,endIndex:un[sn].index}}),distinctUntilChanged(rangeComparator)));return{listState:en,topItemsIndexes:Zt,endReached:tn,startReached:an,rangeChanged:cn,itemsRendered:Jt,initialItemCount:Qt,...qt}},tup(sizeSystem,groupedListSystem,sizeRangeSystem,initialTopMostItemIndexSystem,scrollToIndexSystem,stateFlagsSystem,propsReadySystem,recalcSystem),{singleton:!0}),initialItemCountSystem=system(([{sizes:_e,firstItemIndex:lt,data:Rt,gap:At},{initialTopMostItemIndex:Pt},{initialItemCount:Dt,listState:Lt},{didMount:Bt}])=>(connect(pipe(Bt,withLatestFrom(Dt),filter(([,Nt])=>Nt!==0),withLatestFrom(Pt,_e,lt,At,Rt),map(([[,Nt],jt,Ut,Gt,qt,Xt=[]])=>buildListStateFromItemCount(Nt,jt,Ut,Gt,qt,Xt))),Lt),{}),tup(sizeSystem,initialTopMostItemIndexSystem,listStateSystem,propsReadySystem),{singleton:!0}),scrollSeekSystem=system(([{scrollVelocity:_e}])=>{const lt=statefulStream(!1),Rt=stream(),At=statefulStream(!1);return connect(pipe(_e,withLatestFrom(At,lt,Rt),filter(([Pt,Dt])=>!!Dt),map(([Pt,Dt,Lt,Bt])=>{const{exit:Nt,enter:jt}=Dt;if(Lt){if(Nt(Pt,Bt))return!1}else if(jt(Pt,Bt))return!0;return Lt}),distinctUntilChanged()),lt),subscribe(pipe(combineLatest(lt,_e,Rt),withLatestFrom(At)),([[Pt,Dt,Lt],Bt])=>Pt&&Bt&&Bt.change&&Bt.change(Dt,Lt)),{isSeeking:lt,scrollSeekConfiguration:At,scrollVelocity:_e,scrollSeekRangeChanged:Rt}},tup(stateFlagsSystem),{singleton:!0}),topItemCountSystem=system(([{topItemsIndexes:_e}])=>{const lt=statefulStream(0);return connect(pipe(lt,filter(Rt=>Rt>0),map(Rt=>Array.from({length:Rt}).map((At,Pt)=>Pt))),_e),{topItemCount:lt}},tup(listStateSystem)),totalListHeightSystem=system(([{footerHeight:_e,headerHeight:lt,fixedHeaderHeight:Rt,fixedFooterHeight:At},{listState:Pt}])=>{const Dt=stream(),Lt=statefulStreamFromEmitter(pipe(combineLatest(_e,At,lt,Rt,Pt),map(([Bt,Nt,jt,Ut,Gt])=>Bt+Nt+jt+Ut+Gt.offsetBottom+Gt.bottom)),0);return connect(duc(Lt),Dt),{totalListHeight:Lt,totalListHeightChanged:Dt}},tup(domIOSystem,listStateSystem),{singleton:!0});function simpleMemoize(_e){let lt=!1,Rt;return()=>(lt||(lt=!0,Rt=_e()),Rt)}const isMobileSafari=simpleMemoize(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),upwardScrollFixSystem=system(([{scrollBy:_e,scrollTop:lt,deviation:Rt,scrollingInProgress:At},{isScrolling:Pt,isAtBottom:Dt,scrollDirection:Lt,lastJumpDueToItemResize:Bt},{listState:Nt},{beforeUnshiftWith:jt,shiftWithOffset:Ut,sizes:Gt,gap:qt},{log:Xt},{recalcInProgress:Kt}])=>{const Zt=streamFromEmitter(pipe(Nt,withLatestFrom(Bt),scan(([,Jt,en,tn],[{items:an,totalCount:cn,bottom:un,offsetBottom:rn},sn])=>{const pn=un+rn;let bn=0;return en===cn&&Jt.length>0&&an.length>0&&(an[0].originalIndex===0&&Jt[0].originalIndex===0||(bn=pn-tn,bn!==0&&(bn+=sn))),[bn,an,cn,pn]},[0,[],0,0]),filter(([Jt])=>Jt!==0),withLatestFrom(lt,Lt,At,Dt,Xt,Kt),filter(([,Jt,en,tn,,,an])=>!an&&!tn&&Jt!==0&&en===UP),map(([[Jt],,,,,en])=>(en("Upward scrolling compensation",{amount:Jt},LogLevel.DEBUG),Jt))));function Qt(Jt){Jt>0?(publish(_e,{top:-Jt,behavior:"auto"}),publish(Rt,0)):(publish(Rt,0),publish(_e,{top:-Jt,behavior:"auto"}))}return subscribe(pipe(Zt,withLatestFrom(Rt,Pt)),([Jt,en,tn])=>{tn&&isMobileSafari()?publish(Rt,en-Jt):Qt(-Jt)}),subscribe(pipe(combineLatest(statefulStreamFromEmitter(Pt,!1),Rt,Kt),filter(([Jt,en,tn])=>!Jt&&!tn&&en!==0),map(([Jt,en])=>en),throttleTime(1)),Qt),connect(pipe(Ut,map(Jt=>({top:-Jt}))),_e),subscribe(pipe(jt,withLatestFrom(Gt,qt),map(([Jt,{lastSize:en,groupIndices:tn,sizeTree:an},cn])=>{function un(rn){return rn*(en+cn)}if(tn.length===0)return un(Jt);{let rn=0;const sn=find(an,0);let pn=0,bn=0;for(;pnJt&&(rn-=sn,gn=Jt-pn+1),pn+=gn,rn+=un(gn),bn++}return rn}})),Jt=>{publish(Rt,Jt),requestAnimationFrame(()=>{publish(_e,{top:Jt}),requestAnimationFrame(()=>{publish(Rt,0),publish(Kt,!1)})})}),{deviation:Rt}},tup(domIOSystem,stateFlagsSystem,listStateSystem,sizeSystem,loggerSystem,recalcSystem)),initialScrollTopSystem=system(([{didMount:_e},{scrollTo:lt},{listState:Rt}])=>{const At=statefulStream(0);return subscribe(pipe(_e,withLatestFrom(At),filter(([,Pt])=>Pt!==0),map(([,Pt])=>({top:Pt}))),Pt=>{handleNext(pipe(Rt,skip(1),filter(Dt=>Dt.items.length>1)),()=>{requestAnimationFrame(()=>{publish(lt,Pt)})})}),{initialScrollTop:At}},tup(propsReadySystem,domIOSystem,listStateSystem),{singleton:!0}),alignToBottomSystem=system(([{viewportHeight:_e},{totalListHeight:lt}])=>{const Rt=statefulStream(!1),At=statefulStreamFromEmitter(pipe(combineLatest(Rt,_e,lt),filter(([Pt])=>Pt),map(([,Pt,Dt])=>Math.max(0,Pt-Dt)),throttleTime(0),distinctUntilChanged()),0);return{alignToBottom:Rt,paddingTopAddition:At}},tup(domIOSystem,totalListHeightSystem),{singleton:!0}),windowScrollerSystem=system(([{scrollTo:_e,scrollContainerState:lt}])=>{const Rt=stream(),At=stream(),Pt=stream(),Dt=statefulStream(!1),Lt=statefulStream(void 0);return connect(pipe(combineLatest(Rt,At),map(([{viewportHeight:Bt,scrollTop:Nt,scrollHeight:jt},{offsetTop:Ut}])=>({scrollTop:Math.max(0,Nt-Ut),scrollHeight:jt,viewportHeight:Bt}))),lt),connect(pipe(_e,withLatestFrom(At),map(([Bt,{offsetTop:Nt}])=>({...Bt,top:Bt.top+Nt}))),Pt),{useWindowScroll:Dt,customScrollParent:Lt,windowScrollContainerState:Rt,windowViewportRect:At,windowScrollTo:Pt}},tup(domIOSystem)),defaultCalculateViewLocation=({itemTop:_e,itemBottom:lt,viewportTop:Rt,viewportBottom:At,locationParams:{behavior:Pt,align:Dt,...Lt}})=>_eAt?{...Lt,behavior:Pt,align:Dt??"end"}:null,scrollIntoViewSystem=system(([{sizes:_e,totalCount:lt,gap:Rt},{scrollTop:At,viewportHeight:Pt,headerHeight:Dt,fixedHeaderHeight:Lt,fixedFooterHeight:Bt,scrollingInProgress:Nt},{scrollToIndex:jt}])=>{const Ut=stream();return connect(pipe(Ut,withLatestFrom(_e,Pt,lt,Dt,Lt,Bt,At),withLatestFrom(Rt),map(([[Gt,qt,Xt,Kt,Zt,Qt,Jt,en],tn])=>{const{done:an,behavior:cn,align:un,calculateViewLocation:rn=defaultCalculateViewLocation,...sn}=Gt,pn=originalIndexFromLocation(Gt,qt,Kt-1),bn=offsetOf(pn,qt.offsetTree,tn)+Zt+Qt,gn=bn+findMaxKeyValue(qt.sizeTree,pn)[1],_n=en+Qt,xn=en+Xt-Jt,ln=rn({itemTop:bn,itemBottom:gn,viewportTop:_n,viewportBottom:xn,locationParams:{behavior:cn,align:un,...sn}});return ln?an&&handleNext(pipe(Nt,filter(Mn=>Mn===!1),skip(getValue(Nt)?1:2)),an):an&&an(),ln}),filter(Gt=>Gt!==null)),jt),{scrollIntoView:Ut}},tup(sizeSystem,domIOSystem,scrollToIndexSystem,listStateSystem,loggerSystem),{singleton:!0}),stateLoadSystem=system(([{sizes:_e,sizeRanges:lt},{scrollTop:Rt},{initialTopMostItemIndex:At},{didMount:Pt},{useWindowScroll:Dt,windowScrollContainerState:Lt,windowViewportRect:Bt}])=>{const Nt=stream(),jt=statefulStream(void 0),Ut=statefulStream(null),Gt=statefulStream(null);return connect(Lt,Ut),connect(Bt,Gt),subscribe(pipe(Nt,withLatestFrom(_e,Rt,Dt,Ut,Gt)),([qt,Xt,Kt,Zt,Qt,Jt])=>{const en=sizeTreeToRanges(Xt.sizeTree);Zt&&Qt!==null&&Jt!==null&&(Kt=Qt.scrollTop-Jt.offsetTop),qt({ranges:en,scrollTop:Kt})}),connect(pipe(jt,filter(isDefined),map(locationFromSnapshot)),At),connect(pipe(Pt,withLatestFrom(jt),filter(([,qt])=>qt!==void 0),distinctUntilChanged(),map(([,qt])=>qt.ranges)),lt),{getState:Nt,restoreStateFrom:jt}},tup(sizeSystem,domIOSystem,initialTopMostItemIndexSystem,propsReadySystem,windowScrollerSystem));function locationFromSnapshot(_e){return{offset:_e.scrollTop,index:0,align:"start"}}const featureGroup1System=system(([_e,lt,Rt,At,Pt,Dt,Lt,Bt,Nt,jt])=>({..._e,...lt,...Rt,...At,...Pt,...Dt,...Lt,...Bt,...Nt,...jt}),tup(sizeRangeSystem,initialItemCountSystem,propsReadySystem,scrollSeekSystem,totalListHeightSystem,initialScrollTopSystem,alignToBottomSystem,windowScrollerSystem,scrollIntoViewSystem,loggerSystem)),listSystem=system(([{totalCount:_e,sizeRanges:lt,fixedItemSize:Rt,defaultItemSize:At,trackItemSizes:Pt,itemSize:Dt,data:Lt,firstItemIndex:Bt,groupIndices:Nt,statefulTotalCount:jt,gap:Ut,sizes:Gt},{initialTopMostItemIndex:qt,scrolledToInitialItem:Xt},Kt,Zt,Qt,{listState:Jt,topItemsIndexes:en,...tn},{scrollToIndex:an},cn,{topItemCount:un},{groupCounts:rn},sn])=>(connect(tn.rangeChanged,sn.scrollSeekRangeChanged),connect(pipe(sn.windowViewportRect,map(pn=>pn.visibleHeight)),Kt.viewportHeight),{totalCount:_e,data:Lt,firstItemIndex:Bt,sizeRanges:lt,initialTopMostItemIndex:qt,scrolledToInitialItem:Xt,topItemsIndexes:en,topItemCount:un,groupCounts:rn,fixedItemHeight:Rt,defaultItemHeight:At,gap:Ut,...Qt,statefulTotalCount:jt,listState:Jt,scrollToIndex:an,trackItemSizes:Pt,itemSize:Dt,groupIndices:Nt,...tn,...sn,...Kt,sizes:Gt,...Zt}),tup(sizeSystem,initialTopMostItemIndexSystem,domIOSystem,stateLoadSystem,followOutputSystem,listStateSystem,scrollToIndexSystem,upwardScrollFixSystem,topItemCountSystem,groupedListSystem,featureGroup1System)),WEBKIT_STICKY="-webkit-sticky",STICKY="sticky",positionStickyCssValue=simpleMemoize(()=>{if(typeof document>"u")return STICKY;const _e=document.createElement("div");return _e.style.position=WEBKIT_STICKY,_e.style.position===WEBKIT_STICKY?WEBKIT_STICKY:STICKY});function useWindowViewportRectRef(_e,lt){const Rt=React.useRef(null),At=React.useCallback(Bt=>{if(Bt===null||!Bt.offsetParent)return;const Nt=Bt.getBoundingClientRect(),jt=Nt.width;let Ut,Gt;if(lt){const qt=lt.getBoundingClientRect(),Xt=Nt.top-qt.top;Ut=qt.height-Math.max(0,Xt),Gt=Xt+lt.scrollTop}else Ut=window.innerHeight-Math.max(0,Nt.top),Gt=Nt.top+window.pageYOffset;Rt.current={offsetTop:Gt,visibleHeight:Ut,visibleWidth:jt},_e(Rt.current)},[_e,lt]),{callbackRef:Pt,ref:Dt}=useSizeWithElRef(At),Lt=React.useCallback(()=>{At(Dt.current)},[At,Dt]);return React.useEffect(()=>{if(lt){lt.addEventListener("scroll",Lt);const Bt=new ResizeObserver(Lt);return Bt.observe(lt),()=>{lt.removeEventListener("scroll",Lt),Bt.unobserve(lt)}}else return window.addEventListener("scroll",Lt),window.addEventListener("resize",Lt),()=>{window.removeEventListener("scroll",Lt),window.removeEventListener("resize",Lt)}},[Lt,lt]),Pt}const VirtuosoMockContext=React.createContext(void 0),VirtuosoGridMockContext=React.createContext(void 0);function identity(_e){return _e}const listComponentPropsSystem=system(()=>{const _e=statefulStream(Nt=>`Item ${Nt}`),lt=statefulStream(null),Rt=statefulStream(Nt=>`Group ${Nt}`),At=statefulStream({}),Pt=statefulStream(identity),Dt=statefulStream("div"),Lt=statefulStream(noop),Bt=(Nt,jt=null)=>statefulStreamFromEmitter(pipe(At,map(Ut=>Ut[Nt]),distinctUntilChanged()),jt);return{context:lt,itemContent:_e,groupContent:Rt,components:At,computeItemKey:Pt,headerFooterTag:Dt,scrollerRef:Lt,FooterComponent:Bt("Footer"),HeaderComponent:Bt("Header"),TopItemListComponent:Bt("TopItemList"),ListComponent:Bt("List","div"),ItemComponent:Bt("Item","div"),GroupComponent:Bt("Group","div"),ScrollerComponent:Bt("Scroller","div"),EmptyPlaceholder:Bt("EmptyPlaceholder"),ScrollSeekPlaceholder:Bt("ScrollSeekPlaceholder")}}),combinedSystem$2=system(([_e,lt])=>({..._e,...lt}),tup(listSystem,listComponentPropsSystem)),DefaultScrollSeekPlaceholder$1=({height:_e})=>React.createElement("div",{style:{height:_e}}),GROUP_STYLE={position:positionStickyCssValue(),zIndex:1,overflowAnchor:"none"},ITEM_STYLE$1={overflowAnchor:"none"},Items$1=React.memo(function _e({showTopList:lt=!1}){const Rt=useEmitterValue$2("listState"),At=usePublisher$2("sizeRanges"),Pt=useEmitterValue$2("useWindowScroll"),Dt=useEmitterValue$2("customScrollParent"),Lt=usePublisher$2("windowScrollContainerState"),Bt=usePublisher$2("scrollContainerState"),Nt=Dt||Pt?Lt:Bt,jt=useEmitterValue$2("itemContent"),Ut=useEmitterValue$2("context"),Gt=useEmitterValue$2("groupContent"),qt=useEmitterValue$2("trackItemSizes"),Xt=useEmitterValue$2("itemSize"),Kt=useEmitterValue$2("log"),Zt=usePublisher$2("gap"),{callbackRef:Qt}=useChangedListContentsSizes(At,Xt,qt,lt?noop:Nt,Kt,Zt,Dt),[Jt,en]=React.useState(0);useEmitter$2("deviation",ln=>{Jt!==ln&&en(ln)});const tn=useEmitterValue$2("EmptyPlaceholder"),an=useEmitterValue$2("ScrollSeekPlaceholder")||DefaultScrollSeekPlaceholder$1,cn=useEmitterValue$2("ListComponent"),un=useEmitterValue$2("ItemComponent"),rn=useEmitterValue$2("GroupComponent"),sn=useEmitterValue$2("computeItemKey"),pn=useEmitterValue$2("isSeeking"),bn=useEmitterValue$2("groupIndices").length>0,gn=useEmitterValue$2("paddingTopAddition"),_n=useEmitterValue$2("scrolledToInitialItem"),xn=lt?{}:{boxSizing:"border-box",paddingTop:Rt.offsetTop+gn,paddingBottom:Rt.offsetBottom,marginTop:Jt,..._n?{}:{visibility:"hidden"}};return!lt&&Rt.totalCount===0&&tn?React.createElement(tn,contextPropIfNotDomElement(tn,Ut)):React.createElement(cn,{...contextPropIfNotDomElement(cn,Ut),ref:Qt,style:xn,"data-test-id":lt?"virtuoso-top-item-list":"virtuoso-item-list"},(lt?Rt.topItems:Rt.items).map(ln=>{const Mn=ln.originalIndex,Tn=sn(Mn+Rt.firstItemIndex,ln.data,Ut);return pn?React.createElement(an,{...contextPropIfNotDomElement(an,Ut),key:Tn,index:ln.index,height:ln.size,type:ln.type||"item",...ln.type==="group"?{}:{groupIndex:ln.groupIndex}}):ln.type==="group"?React.createElement(rn,{...contextPropIfNotDomElement(rn,Ut),key:Tn,"data-index":Mn,"data-known-size":ln.size,"data-item-index":ln.index,style:GROUP_STYLE},Gt(ln.index,Ut)):React.createElement(un,{...contextPropIfNotDomElement(un,Ut),...itemPropIfNotDomElement(un,ln.data),key:Tn,"data-index":Mn,"data-known-size":ln.size,"data-item-index":ln.index,"data-item-group-index":ln.groupIndex,style:ITEM_STYLE$1},bn?jt(ln.index,ln.groupIndex,ln.data,Ut):jt(ln.index,ln.data,Ut))}))}),scrollerStyle={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},viewportStyle={width:"100%",height:"100%",position:"absolute",top:0},topItemListStyle={width:"100%",position:positionStickyCssValue(),top:0,zIndex:1};function contextPropIfNotDomElement(_e,lt){if(typeof _e!="string")return{context:lt}}function itemPropIfNotDomElement(_e,lt){return{item:typeof _e=="string"?void 0:lt}}const Header$1=React.memo(function _e(){const lt=useEmitterValue$2("HeaderComponent"),Rt=usePublisher$2("headerHeight"),At=useEmitterValue$2("headerFooterTag"),Pt=useSize(Lt=>Rt(correctItemSize(Lt,"height"))),Dt=useEmitterValue$2("context");return lt?React.createElement(At,{ref:Pt},React.createElement(lt,contextPropIfNotDomElement(lt,Dt))):null}),Footer$1=React.memo(function _e(){const lt=useEmitterValue$2("FooterComponent"),Rt=usePublisher$2("footerHeight"),At=useEmitterValue$2("headerFooterTag"),Pt=useSize(Lt=>Rt(correctItemSize(Lt,"height"))),Dt=useEmitterValue$2("context");return lt?React.createElement(At,{ref:Pt},React.createElement(lt,contextPropIfNotDomElement(lt,Dt))):null});function buildScroller({usePublisher:_e,useEmitter:lt,useEmitterValue:Rt}){return React.memo(function({style:Dt,children:Lt,...Bt}){const Nt=_e("scrollContainerState"),jt=Rt("ScrollerComponent"),Ut=_e("smoothScrollTargetReached"),Gt=Rt("scrollerRef"),qt=Rt("context"),{scrollerRef:Xt,scrollByCallback:Kt,scrollToCallback:Zt}=useScrollTop(Nt,Ut,jt,Gt);return lt("scrollTo",Zt),lt("scrollBy",Kt),React.createElement(jt,{ref:Xt,style:{...scrollerStyle,...Dt},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...Bt,...contextPropIfNotDomElement(jt,qt)},Lt)})}function buildWindowScroller({usePublisher:_e,useEmitter:lt,useEmitterValue:Rt}){return React.memo(function({style:Dt,children:Lt,...Bt}){const Nt=_e("windowScrollContainerState"),jt=Rt("ScrollerComponent"),Ut=_e("smoothScrollTargetReached"),Gt=Rt("totalListHeight"),qt=Rt("deviation"),Xt=Rt("customScrollParent"),Kt=Rt("context"),{scrollerRef:Zt,scrollByCallback:Qt,scrollToCallback:Jt}=useScrollTop(Nt,Ut,jt,noop,Xt);return useIsomorphicLayoutEffect$1(()=>(Zt.current=Xt||window,()=>{Zt.current=null}),[Zt,Xt]),lt("windowScrollTo",Jt),lt("scrollBy",Qt),React.createElement(jt,{style:{position:"relative",...Dt,...Gt!==0?{height:Gt+qt}:{}},"data-virtuoso-scroller":!0,...Bt,...contextPropIfNotDomElement(jt,Kt)},Lt)})}const Viewport$2=({children:_e})=>{const lt=React.useContext(VirtuosoMockContext),Rt=usePublisher$2("viewportHeight"),At=usePublisher$2("fixedItemHeight"),Pt=useSize(compose(Rt,Dt=>correctItemSize(Dt,"height")));return React.useEffect(()=>{lt&&(Rt(lt.viewportHeight),At(lt.itemHeight))},[lt,Rt,At]),React.createElement("div",{style:viewportStyle,ref:Pt,"data-viewport-type":"element"},_e)},WindowViewport$2=({children:_e})=>{const lt=React.useContext(VirtuosoMockContext),Rt=usePublisher$2("windowViewportRect"),At=usePublisher$2("fixedItemHeight"),Pt=useEmitterValue$2("customScrollParent"),Dt=useWindowViewportRectRef(Rt,Pt);return React.useEffect(()=>{lt&&(At(lt.itemHeight),Rt({offsetTop:0,visibleHeight:lt.viewportHeight,visibleWidth:100}))},[lt,Rt,At]),React.createElement("div",{ref:Dt,style:viewportStyle,"data-viewport-type":"window"},_e)},TopItemListContainer=({children:_e})=>{const lt=useEmitterValue$2("TopItemListComponent")||"div",Rt=useEmitterValue$2("headerHeight"),At={...topItemListStyle,marginTop:`${Rt}px`},Pt=useEmitterValue$2("context");return React.createElement(lt,{style:At,...contextPropIfNotDomElement(lt,Pt)},_e)},ListRoot=React.memo(function _e(lt){const Rt=useEmitterValue$2("useWindowScroll"),At=useEmitterValue$2("topItemsIndexes").length>0,Pt=useEmitterValue$2("customScrollParent"),Dt=Pt||Rt?WindowScroller$2:Scroller$2,Lt=Pt||Rt?WindowViewport$2:Viewport$2;return React.createElement(Dt,{...lt},At&&React.createElement(TopItemListContainer,null,React.createElement(Items$1,{showTopList:!0})),React.createElement(Lt,null,React.createElement(Header$1,null),React.createElement(Items$1,null),React.createElement(Footer$1,null)))}),{Component:List,usePublisher:usePublisher$2,useEmitterValue:useEmitterValue$2,useEmitter:useEmitter$2}=systemToComponent(combinedSystem$2,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},ListRoot),Scroller$2=buildScroller({usePublisher:usePublisher$2,useEmitterValue:useEmitterValue$2,useEmitter:useEmitter$2}),WindowScroller$2=buildWindowScroller({usePublisher:usePublisher$2,useEmitterValue:useEmitterValue$2,useEmitter:useEmitter$2}),Virtuoso=List,INITIAL_GRID_STATE={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},PROBE_GRID_STATE={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round,ceil,floor,min,max}=Math;function buildProbeGridState(_e){return{...PROBE_GRID_STATE,items:_e}}function buildItems(_e,lt,Rt){return Array.from({length:lt-_e+1}).map((At,Pt)=>{const Dt=Rt===null?null:Rt[Pt+_e];return{index:Pt+_e,data:Dt}})}function gapComparator(_e,lt){return _e&&_e.column===lt.column&&_e.row===lt.row}function dimensionComparator(_e,lt){return _e&&_e.width===lt.width&&_e.height===lt.height}const gridSystem=system(([{overscan:_e,visibleRange:lt,listBoundary:Rt},{scrollTop:At,viewportHeight:Pt,scrollBy:Dt,scrollTo:Lt,smoothScrollTargetReached:Bt,scrollContainerState:Nt,footerHeight:jt,headerHeight:Ut},Gt,qt,{propsReady:Xt,didMount:Kt},{windowViewportRect:Zt,useWindowScroll:Qt,customScrollParent:Jt,windowScrollContainerState:en,windowScrollTo:tn},an])=>{const cn=statefulStream(0),un=statefulStream(0),rn=statefulStream(INITIAL_GRID_STATE),sn=statefulStream({height:0,width:0}),pn=statefulStream({height:0,width:0}),bn=stream(),gn=stream(),_n=statefulStream(0),xn=statefulStream(null),ln=statefulStream({row:0,column:0}),Mn=stream(),Tn=stream(),An=statefulStream(!1),Cn=statefulStream(0),wn=statefulStream(!0),Fn=statefulStream(!1);subscribe(pipe(Kt,withLatestFrom(Cn),filter(([yn,En])=>!!En)),()=>{publish(wn,!1),publish(un,0)}),subscribe(pipe(combineLatest(Kt,wn,pn,sn,Cn,Fn),filter(([yn,En,kn,zn,,dn])=>yn&&!En&&kn.height!==0&&zn.height!==0&&!dn)),([,,,,yn])=>{publish(Fn,!0),skipFrames(1,()=>{publish(bn,yn)}),handleNext(pipe(At),()=>{publish(Rt,[0,0]),publish(wn,!0)})}),connect(pipe(Tn,filter(yn=>yn!=null&&yn.scrollTop>0),mapTo(0)),un),subscribe(pipe(Kt,withLatestFrom(Tn),filter(([,yn])=>yn!=null)),([,yn])=>{yn&&(publish(sn,yn.viewport),publish(pn,yn==null?void 0:yn.item),publish(ln,yn.gap),yn.scrollTop>0&&(publish(An,!0),handleNext(pipe(At,skip(1)),En=>{publish(An,!1)}),publish(Lt,{top:yn.scrollTop})))}),connect(pipe(sn,map(({height:yn})=>yn)),Pt),connect(pipe(combineLatest(duc(sn,dimensionComparator),duc(pn,dimensionComparator),duc(ln,(yn,En)=>yn&&yn.column===En.column&&yn.row===En.row),duc(At)),map(([yn,En,kn,zn])=>({viewport:yn,item:En,gap:kn,scrollTop:zn}))),Mn),connect(pipe(combineLatest(duc(cn),lt,duc(ln,gapComparator),duc(pn,dimensionComparator),duc(sn,dimensionComparator),duc(xn),duc(un),duc(An),duc(wn),duc(Cn)),filter(([,,,,,,,yn])=>!yn),map(([yn,[En,kn],zn,dn,hn,vn,Bn,,Gn,Sn])=>{const{row:Kn,column:er}=zn,{height:Yn,width:dr}=dn,{width:yr}=hn;if(Bn===0&&(yn===0||yr===0))return INITIAL_GRID_STATE;if(dr===0){const Jn=getInitialTopMostItemIndexNumber(Sn,yn),ur=Jn===0?Math.max(Bn-1,0):Jn;return buildProbeGridState(buildItems(Jn,ur,vn))}const br=itemsPerRow(yr,dr,er);let Er,nr;Gn?En===0&&kn===0&&Bn>0?(Er=0,nr=Bn-1):(Er=br*floor((En+Kn)/(Yn+Kn)),nr=br*ceil((kn+Kn)/(Yn+Kn))-1,nr=min(yn-1,max(nr,br-1)),Er=min(nr,max(0,Er))):(Er=0,nr=-1);const sr=buildItems(Er,nr,vn),{top:_r,bottom:Rr}=gridLayout(hn,zn,dn,sr),Un=ceil(yn/br),Dn=Un*Yn+(Un-1)*Kn-Rr;return{items:sr,offsetTop:_r,offsetBottom:Dn,top:_r,bottom:Rr,itemHeight:Yn,itemWidth:dr}})),rn),connect(pipe(xn,filter(yn=>yn!==null),map(yn=>yn.length)),cn),connect(pipe(combineLatest(sn,pn,rn,ln),filter(([yn,En,{items:kn}])=>kn.length>0&&En.height!==0&&yn.height!==0),map(([yn,En,{items:kn},zn])=>{const{top:dn,bottom:hn}=gridLayout(yn,zn,En,kn);return[dn,hn]}),distinctUntilChanged(tupleComparator)),Rt);const $n=statefulStream(!1);connect(pipe(At,withLatestFrom($n),map(([yn,En])=>En||yn!==0)),$n);const Pn=streamFromEmitter(pipe(duc(rn),filter(({items:yn})=>yn.length>0),withLatestFrom(cn,$n),filter(([{items:yn},En,kn])=>kn&&yn[yn.length-1].index===En-1),map(([,yn])=>yn-1),distinctUntilChanged())),Vn=streamFromEmitter(pipe(duc(rn),filter(({items:yn})=>yn.length>0&&yn[0].index===0),mapTo(0),distinctUntilChanged())),Zn=streamFromEmitter(pipe(duc(rn),withLatestFrom(An),filter(([{items:yn},En])=>yn.length>0&&!En),map(([{items:yn}])=>({startIndex:yn[0].index,endIndex:yn[yn.length-1].index})),distinctUntilChanged(rangeComparator),throttleTime(0)));connect(Zn,qt.scrollSeekRangeChanged),connect(pipe(bn,withLatestFrom(sn,pn,cn,ln),map(([yn,En,kn,zn,dn])=>{const hn=normalizeIndexLocation(yn),{align:vn,behavior:Bn,offset:Gn}=hn;let Sn=hn.index;Sn==="LAST"&&(Sn=zn-1),Sn=max(0,Sn,min(zn-1,Sn));let Kn=itemTop(En,dn,kn,Sn);return vn==="end"?Kn=round(Kn-En.height+kn.height):vn==="center"&&(Kn=round(Kn-En.height/2+kn.height/2)),Gn&&(Kn+=Gn),{top:Kn,behavior:Bn}})),Lt);const tr=statefulStreamFromEmitter(pipe(rn,map(yn=>yn.offsetBottom+yn.bottom)),0);return connect(pipe(Zt,map(yn=>({width:yn.visibleWidth,height:yn.visibleHeight}))),sn),{data:xn,totalCount:cn,viewportDimensions:sn,itemDimensions:pn,scrollTop:At,scrollHeight:gn,overscan:_e,scrollBy:Dt,scrollTo:Lt,scrollToIndex:bn,smoothScrollTargetReached:Bt,windowViewportRect:Zt,windowScrollTo:tn,useWindowScroll:Qt,customScrollParent:Jt,windowScrollContainerState:en,deviation:_n,scrollContainerState:Nt,footerHeight:jt,headerHeight:Ut,initialItemCount:un,gap:ln,restoreStateFrom:Tn,...qt,initialTopMostItemIndex:Cn,gridState:rn,totalListHeight:tr,...Gt,startReached:Vn,endReached:Pn,rangeChanged:Zn,stateChanged:Mn,propsReady:Xt,stateRestoreInProgress:An,...an}},tup(sizeRangeSystem,domIOSystem,stateFlagsSystem,scrollSeekSystem,propsReadySystem,windowScrollerSystem,loggerSystem));function gridLayout(_e,lt,Rt,At){const{height:Pt}=Rt;if(Pt===void 0||At.length===0)return{top:0,bottom:0};const Dt=itemTop(_e,lt,Rt,At[0].index),Lt=itemTop(_e,lt,Rt,At[At.length-1].index)+Pt;return{top:Dt,bottom:Lt}}function itemTop(_e,lt,Rt,At){const Pt=itemsPerRow(_e.width,Rt.width,lt.column),Dt=floor(At/Pt),Lt=Dt*Rt.height+max(0,Dt-1)*lt.row;return Lt>0?Lt+lt.row:Lt}function itemsPerRow(_e,lt,Rt){return max(1,floor((_e+Rt)/(floor(lt)+Rt)))}const gridComponentPropsSystem=system(()=>{const _e=statefulStream(jt=>`Item ${jt}`),lt=statefulStream({}),Rt=statefulStream(null),At=statefulStream("virtuoso-grid-item"),Pt=statefulStream("virtuoso-grid-list"),Dt=statefulStream(identity),Lt=statefulStream("div"),Bt=statefulStream(noop),Nt=(jt,Ut=null)=>statefulStreamFromEmitter(pipe(lt,map(Gt=>Gt[jt]),distinctUntilChanged()),Ut);return{context:Rt,itemContent:_e,components:lt,computeItemKey:Dt,itemClassName:At,listClassName:Pt,headerFooterTag:Lt,scrollerRef:Bt,FooterComponent:Nt("Footer"),HeaderComponent:Nt("Header"),ListComponent:Nt("List","div"),ItemComponent:Nt("Item","div"),ScrollerComponent:Nt("Scroller","div"),ScrollSeekPlaceholder:Nt("ScrollSeekPlaceholder","div")}}),combinedSystem$1=system(([_e,lt])=>({..._e,...lt}),tup(gridSystem,gridComponentPropsSystem)),GridItems=React.memo(function _e(){const lt=useEmitterValue$1("gridState"),Rt=useEmitterValue$1("listClassName"),At=useEmitterValue$1("itemClassName"),Pt=useEmitterValue$1("itemContent"),Dt=useEmitterValue$1("computeItemKey"),Lt=useEmitterValue$1("isSeeking"),Bt=usePublisher$1("scrollHeight"),Nt=useEmitterValue$1("ItemComponent"),jt=useEmitterValue$1("ListComponent"),Ut=useEmitterValue$1("ScrollSeekPlaceholder"),Gt=useEmitterValue$1("context"),qt=usePublisher$1("itemDimensions"),Xt=usePublisher$1("gap"),Kt=useEmitterValue$1("log"),Zt=useEmitterValue$1("stateRestoreInProgress"),Qt=useSize(Jt=>{const en=Jt.parentElement.parentElement.scrollHeight;Bt(en);const tn=Jt.firstChild;if(tn){const{width:an,height:cn}=tn.getBoundingClientRect();qt({width:an,height:cn})}Xt({row:resolveGapValue("row-gap",getComputedStyle(Jt).rowGap,Kt),column:resolveGapValue("column-gap",getComputedStyle(Jt).columnGap,Kt)})});return Zt?null:React.createElement(jt,{ref:Qt,className:Rt,...contextPropIfNotDomElement(jt,Gt),style:{paddingTop:lt.offsetTop,paddingBottom:lt.offsetBottom},"data-test-id":"virtuoso-item-list"},lt.items.map(Jt=>{const en=Dt(Jt.index,Jt.data,Gt);return Lt?React.createElement(Ut,{key:en,...contextPropIfNotDomElement(Ut,Gt),index:Jt.index,height:lt.itemHeight,width:lt.itemWidth}):React.createElement(Nt,{...contextPropIfNotDomElement(Nt,Gt),className:At,"data-index":Jt.index,key:en},Pt(Jt.index,Jt.data,Gt))}))}),Header=React.memo(function _e(){const lt=useEmitterValue$1("HeaderComponent"),Rt=usePublisher$1("headerHeight"),At=useEmitterValue$1("headerFooterTag"),Pt=useSize(Lt=>Rt(correctItemSize(Lt,"height"))),Dt=useEmitterValue$1("context");return lt?React.createElement(At,{ref:Pt},React.createElement(lt,contextPropIfNotDomElement(lt,Dt))):null}),Footer=React.memo(function _e(){const lt=useEmitterValue$1("FooterComponent"),Rt=usePublisher$1("footerHeight"),At=useEmitterValue$1("headerFooterTag"),Pt=useSize(Lt=>Rt(correctItemSize(Lt,"height"))),Dt=useEmitterValue$1("context");return lt?React.createElement(At,{ref:Pt},React.createElement(lt,contextPropIfNotDomElement(lt,Dt))):null}),Viewport$1=({children:_e})=>{const lt=React.useContext(VirtuosoGridMockContext),Rt=usePublisher$1("itemDimensions"),At=usePublisher$1("viewportDimensions"),Pt=useSize(Dt=>{At(Dt.getBoundingClientRect())});return React.useEffect(()=>{lt&&(At({height:lt.viewportHeight,width:lt.viewportWidth}),Rt({height:lt.itemHeight,width:lt.itemWidth}))},[lt,At,Rt]),React.createElement("div",{style:viewportStyle,ref:Pt},_e)},WindowViewport$1=({children:_e})=>{const lt=React.useContext(VirtuosoGridMockContext),Rt=usePublisher$1("windowViewportRect"),At=usePublisher$1("itemDimensions"),Pt=useEmitterValue$1("customScrollParent"),Dt=useWindowViewportRectRef(Rt,Pt);return React.useEffect(()=>{lt&&(At({height:lt.itemHeight,width:lt.itemWidth}),Rt({offsetTop:0,visibleHeight:lt.viewportHeight,visibleWidth:lt.viewportWidth}))},[lt,Rt,At]),React.createElement("div",{ref:Dt,style:viewportStyle},_e)},GridRoot=React.memo(function _e({...lt}){const Rt=useEmitterValue$1("useWindowScroll"),At=useEmitterValue$1("customScrollParent"),Pt=At||Rt?WindowScroller$1:Scroller$1,Dt=At||Rt?WindowViewport$1:Viewport$1;return React.createElement(Pt,{...lt},React.createElement(Dt,null,React.createElement(Header,null),React.createElement(GridItems,null),React.createElement(Footer,null)))}),{Component:Grid,usePublisher:usePublisher$1,useEmitterValue:useEmitterValue$1,useEmitter:useEmitter$1}=systemToComponent(combinedSystem$1,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged"}},GridRoot),Scroller$1=buildScroller({usePublisher:usePublisher$1,useEmitterValue:useEmitterValue$1,useEmitter:useEmitter$1}),WindowScroller$1=buildWindowScroller({usePublisher:usePublisher$1,useEmitterValue:useEmitterValue$1,useEmitter:useEmitter$1});function resolveGapValue(_e,lt,Rt){return lt!=="normal"&&!(lt!=null&<.endsWith("px"))&&Rt(`${_e} was not resolved to pixel value correctly`,lt,LogLevel.WARN),lt==="normal"?0:parseInt(lt??"0",10)}const Scroller=reactExports.forwardRef(({style:_e,children:lt,...Rt},At)=>{const Pt=reactExports.useRef(null),{palette:Dt,spacing:Lt}=useTheme(),Bt=useCss$1({"--os-padding-perpendicular":"2px",".os-scrollbar":{visibility:"visible",opacity:1},".os-scrollbar-vertical > .os-scrollbar-track > .os-scrollbar-handle":{"min-height":Lt(12)},"div.os-scrollbar-vertical > div.os-scrollbar-track":{height:`calc(100% - ${Lt(6)})`,marginTop:Lt(6)},"div > div.os-scrollbar-track":{"--os-handle-perpendicular-size":"2px","--os-handle-perpendicular-size-hover":"6px","--os-handle-perpendicular-size-active":"6px","> div.os-scrollbar-handle":{borderRadius:0,opacity:.5,"&:hover":{opacity:.8}}}}),[Nt]=S$3({options:{overflow:{x:"hidden",y:"scroll"},scrollbars:{autoHide:"move",theme:Dt.mode==="dark"?"os-theme-light":"os-theme-dark"}}});reactExports.useEffect(()=>{typeof At!="function"&&(At!=null&&At.current)&&(Pt!=null&&Pt.current)&&Nt({target:Pt.current,elements:{viewport:At.current}})},[Nt]);const jt=reactExports.useCallback(Ut=>{Ut&&At&&(typeof At=="function"?At(Ut):At.current=Ut)},[At]);return jsxRuntimeExports.jsx("div",{ref:Pt,style:_e,className:Bt,children:jsxRuntimeExports.jsx("div",{ref:jt,...Rt,children:lt})})});function LazyList({items:_e=[],renderItem:lt,listOptions:Rt,placeholder:At,...Pt}){return jsxRuntimeExports.jsx(Box$1,{...Pt,children:jsxRuntimeExports.jsx(Virtuoso,{components:{Scroller},totalCount:_e.length,itemContent:Dt=>lt==null?void 0:lt(_e[Dt],Dt),...Rt})})}function Dot({label:_e}){return jsxRuntimeExports.jsx(Tooltip$1,{title:_e,children:jsxRuntimeExports.jsx(FiberManualRecord,{sx:{color:"error.main",transform:"scale(0.5)",pl:.5,mr:2},fontSize:"small"})})}function EventInspector({event:_e,index:lt,selected:Rt,label:At,...Pt}){const{spacing:Dt}=useTheme(),Lt=useCss$1({}),Bt=useCss$1({}),Nt=lodashExports$1.omit(_e,...OMIT_PROPS),jt=lodashExports$1.pick(Nt,...ESSENTIAL_PROPS),Ut=lodashExports$1.omit(Nt,...ESSENTIAL_PROPS);return jsxRuntimeExports.jsxs(Box$1,{sx:{position:"relative",[`> .${Bt}`]:{opacity:0},[`&:hover > .${Bt}`]:{opacity:1},[`&:hover > .${Lt}`]:{pr:8}},children:[jsxRuntimeExports.jsxs(ListItemButton$1,{className:Lt,selected:Rt,...Pt,sx:{borderLeft:`${Dt(.5)} solid ${getColorHex(_e==null?void 0:_e.type)}`,...Pt.sx},children:[jsxRuntimeExports.jsxs(ListItemIcon$1,{sx:{alignItems:"center"},children:[jsxRuntimeExports.jsx(Type$1,{variant:"body2",children:lt}),At&&jsxRuntimeExports.jsx(Dot,{label:At})]}),jsxRuntimeExports.jsx(ListItemText$1,{sx:{overflow:"hidden"},primary:jsxRuntimeExports.jsxs(Box$1,{sx:{overflow:"hidden",whiteSpace:"nowrap",display:"block",textOverflow:"ellipsis",my:.5},children:[lodashExports$1.startCase(`${(_e==null?void 0:_e.type)??"unsupported"} ${(_e==null?void 0:_e.id)??"-"}`)," "]}),secondaryTypographyProps:{component:"div",whiteSpace:"nowrap",overflow:"hidden"},secondary:jsxRuntimeExports.jsxs(Stack$1,{direction:"row",justifyContent:"flex-start",sx:{"> *":{flex:0}},children:[jsxRuntimeExports.jsx(PropertyList,{event:jt,simple:!0}),jsxRuntimeExports.jsx(PropertyList,{event:Ut,simple:!0})]})})]}),jsxRuntimeExports.jsx(Stack$1,{className:Bt,direction:"row",sx:{p:1,justifyContent:"center",position:"absolute",right:0,alignItems:"center",top:0,height:"100%"},children:jsxRuntimeExports.jsx(PropertyDialog,{event:_e,trigger:Gt=>jsxRuntimeExports.jsx(IconButtonWithTooltip,{onClick:Gt,sx:{p:1.5,color:"text.secondary"},label:"See All Properties",icon:jsxRuntimeExports.jsx(DataObjectOutlined,{fontSize:"small"})})})})]})}function Skeleton({event:_e}){const{spacing:lt}=useTheme();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ListItem$1,{sx:{height:80,borderLeft:`${lt(.5)} solid ${getColorHex(_e==null?void 0:_e.type)}`},children:jsxRuntimeExports.jsx(ListItemIcon$1,{children:jsxRuntimeExports.jsx(Placeholder$3,{animation:!1,width:lt(4)})})}),jsxRuntimeExports.jsx(Divider$1,{variant:"inset"})]})}function lerp(_e,lt,Rt){return _e+lodashExports$1.clamp(Rt,0,1)*(lt-_e)}const ITEM_HEIGHT=80,PADDING_TOP=8,divider$2=jsxRuntimeExports.jsx(Divider$1,{orientation:"vertical",flexItem:!0,sx:{m:1}}),pxToInt=_e=>Number(_e.replace(/px$/,"")),SYMBOL_ALL=nanoid$1(),stepsLayerGuard=_e=>!!getLayerHandler(_e).steps;function useStepsPageState(_e,lt){const{key:Rt,setKey:At,layers:Pt,layer:Dt,allLayers:Lt}=useLayer(_e==null?void 0:_e.layer,stepsLayerGuard),[Bt,Nt]=reactExports.useState(_e==null?void 0:_e.selectedType);function jt(Gt){lt==null||lt({layer:Gt}),At(Gt)}function Ut(Gt){lt==null||lt({selectedType:Gt}),Nt(Gt)}return{setSelectedType:Ut,setKey:jt,selectedType:Bt,layers:Pt,allLayers:Lt,key:Rt,layer:Dt}}const getStepsPageDescription=_e=>_e?`${_e} contains 0 steps.`:"When you load a trace, you'll see its steps here.";function StepsPage({template:_e}){const{spacing:lt}=useTheme(),Rt=usePaper(),At=useAcrylic(),Pt=reactExports.useRef(null),[Dt,Lt]=reactExports.useState(null),{controls:Bt,onChange:Nt,state:jt,dragHandle:Ut}=useViewTreeContext(),{allLayers:Gt,key:qt,layers:Xt,selectedType:Kt,setKey:Zt,setSelectedType:Qt,layer:Jt}=useStepsPageState(jt,Nt),{step:en,playing:tn,stepTo:an}=usePlaybackState(qt),cn=reactExports.useMemo(()=>{if(Jt){const{steps:gn}=getLayerHandler(Jt);return gn(Jt)}},[Jt]),{steps:un,types:rn,stepToFilteredStep:sn,selectedType:pn}=reactExports.useMemo(()=>{if(cn){const gn=cn.map((Tn,An)=>[Tn,An]),_n=lodashExports$1.chain(gn).map(([Tn])=>Tn.type).filter().uniq().value(),xn=!_n.includes(Kt),ln=xn?gn:gn.filter(([Tn])=>Tn.type===Kt),{stepMap:Mn}=lodashExports$1.reduce(gn,(Tn,[,An])=>{const Cn=lodashExports$1.findIndex(ln,([,Fn])=>Fn>=An,Tn.from),wn=Cn===-1?ln.length:Cn;return Tn.from=wn,Tn.stepMap.push(wn),Tn},{from:0,stepMap:[]});return{steps:ln,types:_n,stepToFilteredStep:Tn=>Mn[Tn],selectedType:xn?SYMBOL_ALL:Kt}}return{}},[cn,Kt]),bn=useBreakpoints(qt);return reactExports.useEffect(()=>{if(sn&&Dt&&Pt.current){const gn=sn(en);if(tn){let _n=!1;const xn=ln=>{var Mn;if(!_n&&"scrollTop"in Dt&&!lodashExports$1.isUndefined(en)){const{scrollTop:Tn}=Dt,An=gn*ITEM_HEIGHT;(Mn=Pt.current)==null||Mn.scrollTo({top:lerp(Tn,An,1e-6*ln)}),requestAnimationFrame(xn)}};return requestAnimationFrame(xn),()=>{_n=!0}}else Pt.current.scrollToIndex({index:gn,behavior:"smooth",offset:-pxToInt(lt(12+PADDING_TOP))})}},[en,Pt,Dt,sn,tn]),jsxRuntimeExports.jsxs(_e,{onChange:Nt,stack:jt,children:[jsxRuntimeExports.jsx(_e.Title,{children:"Steps"}),jsxRuntimeExports.jsx(_e.Handle,{children:Ut}),jsxRuntimeExports.jsxs(_e.Content,{children:[jsxRuntimeExports.jsx(Flex,{vertical:!0,alignItems:"center",children:un?un.length?jsxRuntimeExports.jsx(LazyList,{sx:{width:"100%",height:"100%"},items:un,listOptions:{scrollerRef:Lt,ref:Pt,defaultItemHeight:ITEM_HEIGHT,overscan:0},renderItem:([gn,_n],xn)=>{var ln;return tn?jsxRuntimeExports.jsx(Box$1,{sx:{pt:xn?0:lt(6+PADDING_TOP)},children:jsxRuntimeExports.jsx(Skeleton,{event:gn})},xn):jsxRuntimeExports.jsxs(Box$1,{sx:{height:pxToInt(lt(xn?0:6+PADDING_TOP))+ITEM_HEIGHT,pt:xn?0:lt(6+PADDING_TOP)},children:[jsxRuntimeExports.jsx(EventInspector,{event:gn,index:_n,selected:_n===en,sx:{height:"100%"},label:(ln=bn(_n))==null?void 0:ln.result,onClick:()=>an(_n)}),jsxRuntimeExports.jsx(Divider$1,{variant:"inset"})]},xn)}}):jsxRuntimeExports.jsx(Placeholder$2,{icon:jsxRuntimeExports.jsx(StepsIcon,{}),label:"Steps",secondary:getStepsPageDescription(inferLayerName(Jt))}):jsxRuntimeExports.jsx(Placeholder$2,{icon:jsxRuntimeExports.jsx(StepsIcon,{}),label:"Steps",secondary:getStepsPageDescription()})}),!!(un!=null&&un.length)&&jsxRuntimeExports.jsxs(Stack$1,{direction:"row",sx:{...Rt(1),...At,alignItems:"center",position:"absolute",top:gn=>gn.spacing(6),height:gn=>gn.spacing(6),borderRadius:1,px:1,m:1},children:[jsxRuntimeExports.jsx(Playback,{layer:Jt}),divider$2,jsxRuntimeExports.jsx(Type$1,{component:"div",variant:"body2",color:"text.secondary",sx:{px:1,py:.25,textAlign:"center",...Rt(0),borderRadius:1},children:en})]})]}),jsxRuntimeExports.jsxs(_e.Options,{children:[jsxRuntimeExports.jsx(FeaturePicker,{icon:jsxRuntimeExports.jsx(LayersIcon,{}),label:"Layer",value:qt,items:lodashExports$1.map(Gt,gn=>({id:gn.key,hidden:!lodashExports$1.find(Xt,{key:gn.key}),name:inferLayerName(gn)})),onChange:Zt,arrow:!0,ellipsis:12}),divider$2,jsxRuntimeExports.jsx(FeaturePicker,{icon:jsxRuntimeExports.jsx(FiberManualRecordOutlined,{sx:{color:getColorHex(pn)}}),label:"Event Type",value:pn,items:[{id:SYMBOL_ALL,name:"All Events"},...lodashExports$1.map(rn,gn=>({id:`${gn}`,name:lodashExports$1.startCase(gn)}))],onChange:Qt,arrow:!0,ellipsis:12})]}),jsxRuntimeExports.jsx(_e.Extras,{children:Bt})]})}const itemHeight=_e=>_e?48:36,padding=8;function SelectMulti({trigger:_e,items:lt,value:Rt,onChange:At,placeholder:Pt="Select Options",defaultChecked:Dt}){const Lt=useSmallDisplay(),Bt=lodashExports$1.max([lodashExports$1.findIndex(lt,({value:Nt})=>!!(Rt!=null&&Rt[Nt])),0])??0;return jsxRuntimeExports.jsx(PopupState,{variant:"popover",children:Nt=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Tooltip$1,{title:Pt,children:jsxRuntimeExports.jsx("span",{children:_e==null?void 0:_e(bindTrigger(Nt))})}),jsxRuntimeExports.jsx(Menu$1,{...bindMenu(Nt),anchorOrigin:{horizontal:"center",vertical:-itemHeight(Lt)*Bt-padding},transformOrigin:{vertical:"top",horizontal:"center"},children:lodashExports$1.map(lt,({value:jt,label:Ut,disabled:Gt})=>jsxRuntimeExports.jsxs(MenuItem$1,{disabled:Gt,onClick:()=>{At==null||At({...Rt,[jt]:!((Rt==null?void 0:Rt[jt])??Dt)})},children:[jsxRuntimeExports.jsx(ListItemIcon$1,{children:jsxRuntimeExports.jsx(Checkbox$1,{sx:{p:0},checked:!!((Rt==null?void 0:Rt[jt])??Dt)})}),Ut]},jt))})]})})}function FeaturePickerMulti({label:_e,value:lt,onChange:Rt,items:At,icon:Pt,showArrow:Dt,defaultChecked:Lt,ellipsis:Bt=1/0}){var Ut;const Nt=lodashExports$1.filter(At,({id:Gt})=>!!((lt==null?void 0:lt[Gt])??Lt)),jt=Nt.length?Nt.length===1?(Ut=lodashExports$1.head(Nt))==null?void 0:Ut.name:`${Nt.length} Selected`:_e;return jsxRuntimeExports.jsx(SelectMulti,{defaultChecked:!0,placeholder:lodashExports$1.startCase(_e),trigger:Gt=>jsxRuntimeExports.jsx(FeaturePickerButton,{...Gt,disabled:!(At!=null&&At.length),icon:Pt,arrow:Dt,children:lodashExports$1.truncate(jt,{length:Bt})}),items:lodashExports$1.map(At,({id:Gt,name:qt,description:Xt,hidden:Kt})=>({value:Gt,label:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Type$1,{children:qt}),jsxRuntimeExports.jsx(Space,{}),jsxRuntimeExports.jsx(Type$1,{variant:"body2",color:"text.secondary",children:Xt})]}),disabled:Kt})),value:lt,onChange:Rt})}const divider$1=jsxRuntimeExports.jsx(Divider$1,{orientation:"vertical",flexItem:!0,sx:{m:1}});function ViewportPage({template:_e}){var Kt,Zt,Qt,Jt;const{controls:lt,onChange:Rt,state:At,dragHandle:Pt}=useViewTreeContext(),[Dt]=useRenderers(),[{layers:Lt}]=useLayers(),[Bt,Nt]=reactExports.useState({}),jt=reactExports.useMemo(()=>lodashExports$1.filter(Lt,en=>(Bt==null?void 0:Bt[en.key])??!0),[Bt,Lt]),[Ut,Gt]=reactExports.useState(),qt=reactExports.useMemo(()=>lodashExports$1.head(Dt),[Dt]),Xt=At!=null&&At.renderer&&At.renderer!=="internal:auto"?At.renderer:(Zt=(Kt=qt==null?void 0:qt.renderer)==null?void 0:Kt.meta)==null?void 0:Zt.id;return reactExports.useEffect(()=>{lodashExports$1.delay(()=>{var en;(en=Ut==null?void 0:Ut.fitCamera)==null||en.call(Ut,tn=>{var an;return lodashExports$1.chain(jt).filter("viewKey").map("key").includes(((an=tn.meta)==null?void 0:an.sourceLayer)??"").value()})},150)},[Ut,lodashExports$1.chain(jt).map("viewKey").sort().join(".").value()]),jsxRuntimeExports.jsxs(_e,{onChange:Rt,stack:At,children:[jsxRuntimeExports.jsx(_e.Title,{children:"Viewport"}),jsxRuntimeExports.jsx(_e.Handle,{children:Pt}),jsxRuntimeExports.jsx(_e.Content,{children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(AutoSizer,{children:en=>jsxRuntimeExports.jsx(Box$1,{children:jsxRuntimeExports.jsx(TraceRenderer,{...en,layers:jt,renderer:Xt,rendererRef:Gt})})})})}),jsxRuntimeExports.jsx(_e.Options,{children:jsxRuntimeExports.jsxs(Stack$1,{direction:"row",children:[jsxRuntimeExports.jsx(FeaturePicker,{label:"Renderer",icon:jsxRuntimeExports.jsx(BlurCircularOutlined,{}),value:(At==null?void 0:At.renderer)??"internal:auto",onChange:en=>Rt==null?void 0:Rt({renderer:en}),items:[{id:"internal:auto",name:`Auto (${((Jt=(Qt=qt==null?void 0:qt.renderer)==null?void 0:Qt.meta)==null?void 0:Jt.name)??"None"})`},...lodashExports$1.map(Dt,({renderer:en})=>({id:en.meta.id,name:en.meta.name,description:en.meta.id}))],arrow:!0}),divider$1,jsxRuntimeExports.jsx(FeaturePickerMulti,{defaultChecked:!0,label:"Layers",icon:jsxRuntimeExports.jsx(LayersIcon,{}),value:Bt,onChange:Nt,items:lodashExports$1.map(Lt,en=>({id:en.key,name:inferLayerName(en)})),showArrow:!0,ellipsis:12}),divider$1,jsxRuntimeExports.jsx(FeaturePickerButton,{disabled:!Ut,onClick:()=>{Ut==null||Ut.fitCamera()},icon:jsxRuntimeExports.jsx(CenterFocusStrongOutlined,{}),children:"Fit"}),jsxRuntimeExports.jsx(FeaturePickerButton,{disabled:!Ut,onClick:()=>{Ut==null||Ut.initialCamera()},icon:jsxRuntimeExports.jsx(CropFreeOutlined,{}),children:"1:1"})]})}),jsxRuntimeExports.jsx(_e.Extras,{children:lt})]})}const pages={explore:{id:"explore",name:"Explore",color:"pink",description:"Browse a library of examples and guides",icon:jsxRuntimeExports.jsx(RocketIcon,{}),content:ExplorePage,allowFullscreen:!0},viewport:{id:"viewport",name:"Viewport",description:"",color:"deepPurple",icon:jsxRuntimeExports.jsx(ViewportIcon,{}),content:ViewportPage,allowFullscreen:!0},layers:{id:"layers",name:"Layers",description:"",color:"deepPurple",icon:jsxRuntimeExports.jsx(LayersIcon,{}),content:LayersPage,allowFullscreen:!0},steps:{id:"steps",name:"Steps",description:"",color:"deepPurple",icon:jsxRuntimeExports.jsx(StepsIcon,{}),content:StepsPage,allowFullscreen:!0},tree:{id:"tree",name:"Tree",description:"",color:"deepPurple",icon:jsxRuntimeExports.jsx(TreeIcon,{}),content:TreePage,allowFullscreen:!0},debug:{id:"debug",name:"Debugger",description:"",color:"indigo",icon:jsxRuntimeExports.jsx(DebuggerIcon,{}),content:DebugPage,allowFullscreen:!0},info:{id:"info",name:"Logs",description:"",color:"grey",icon:jsxRuntimeExports.jsx(LogsIcon,{}),content:InfoPage,allowFullscreen:!0},settings:{id:"settings",name:"Settings",description:"",color:"grey",icon:jsxRuntimeExports.jsx(SettingsIcon,{}),content:SettingsPage,allowFullscreen:!0}},ErrorBoundaryContext=reactExports.createContext(null),initialState={didCatch:!1,error:null};class ErrorBoundary extends reactExports.Component{constructor(lt){super(lt),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=initialState}static getDerivedStateFromError(lt){return{didCatch:!0,error:lt}}resetErrorBoundary(){const{error:lt}=this.state;if(lt!==null){for(var Rt,At,Pt=arguments.length,Dt=new Array(Pt),Lt=0;Lt0&&arguments[0]!==void 0?arguments[0]:[],lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return _e.length!==lt.length||_e.some((Rt,At)=>!Object.is(Rt,lt[At]))}function _extends(){return _extends=Object.assign||function(_e){for(var lt=1;lt=0)&&(Rt[Pt]=_e[Pt]);return Rt}var EXCLUDED_NAMES=["PropTypes"],getSlotProps=function _e(lt,Rt){return reactExports.Children.toArray(lt).reduce(function(At,Pt){if(reactExports.isValidElement(Pt)){var Dt=Pt.type.displayName;Rt!=null&&Rt.includes(Dt)&&(At[Dt]=Pt.props)}return At},{})},getCleanChildren=function _e(lt,Rt){var At=reactExports.Children.toArray(lt).filter(function(Pt){if(reactExports.isValidElement(Pt)){var Dt=Pt.type.displayName;return!(Rt!=null&&Rt.includes(Dt))}return!0});return At.length>0?At:void 0},isComponentName=function _e(lt){return typeof lt=="string"&&!EXCLUDED_NAMES.includes(lt)&<.match(/^[A-Z0-9]/)},createResultComponent=function _e(lt){var Rt=reactExports.memo(function(At){var Pt=At.children,Dt=At.propagateSlotProps,Lt=At.slotKeys,Bt=Lt===void 0?[]:Lt,Nt=_objectWithoutPropertiesLoose(At,["children","propagateSlotProps","slotKeys"]),jt=reactExports.useMemo(function(){return getSlotProps(Pt,Bt)},[Bt,Pt]),Ut=reactExports.useMemo(function(){return getCleanChildren(Pt,Bt)},[Bt,Pt]),Gt=reactExports.useMemo(function(){return _extends({},Nt,{slotProps:_extends({},Dt,jt)})},[Nt,jt,Dt]);return reactExports.createElement(lt,Gt,Ut)});return Rt},withSlots=function _e(lt){var Rt=reactExports.memo(createResultComponent(lt));Rt.displayName="WithSlots("+(lt.displayName||lt.name)+")";var At=new Proxy(Rt,{get:function(Dt,Lt,Bt){var Nt;if(Lt in Dt||typeof Lt=="symbol"||!isComponentName(Lt))return Reflect.get(Dt,Lt,Bt);var jt=((Nt=Reflect.get(Dt,"defaultProps"))==null?void 0:Nt.slotKeys)||[],Ut=Reflect.get(Dt,Lt);if(!Ut){var Gt=function(){return null};Gt.displayName=Lt,Reflect.set(Dt,Lt,Gt)}return Reflect.set(Dt,"defaultProps",_extends({},Dt.defaultProps,{slotKeys:[].concat(jt,[Lt])})),Reflect.get(Dt,Lt,Bt)}});return At};const divider=jsxRuntimeExports.jsx(Divider$1,{orientation:"vertical",flexItem:!0,sx:{m:1,height:_e=>_e.spacing(3),alignSelf:"auto"}}),Page=withSlots(({slotProps:_e,onChange:lt,stack:Rt})=>{var Pt,Dt,Lt,Bt;const At=useAcrylic();return jsxRuntimeExports.jsx(ErrorBoundary,{fallback:jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:"This page encountered an error."}),children:jsxRuntimeExports.jsxs(Flex,{vertical:!0,children:[jsxRuntimeExports.jsx(Flex,{sx:{position:"absolute",top:0,left:0,width:"100%"},children:jsxRuntimeExports.jsx(Box$1,{sx:{width:"100%",height:"100%",bgcolor:"background.paper"},children:(Pt=_e.Content)==null?void 0:Pt.children})}),jsxRuntimeExports.jsxs(Flex,{sx:{height:Nt=>Nt.spacing(6)},children:[jsxRuntimeExports.jsx(Flex,{sx:{p:0,position:"absolute",top:0,left:0,width:"100%",borderBottom:1,borderColor:"divider",alignItems:"center",pr:6,...At},children:jsxRuntimeExports.jsx(Scroll,{x:!0,children:jsxRuntimeExports.jsxs(Flex,{sx:{width:"max-content",height:Nt=>Nt.spacing(6),alignItems:"center",p:1},children:[(Dt=_e.Handle)==null?void 0:Dt.children,jsxRuntimeExports.jsx(FeaturePicker,{icon:jsxRuntimeExports.jsx(WidgetsOutlined,{}),label:"Choose View",onChange:Nt=>lt==null?void 0:lt({...Rt,type:Nt}),value:Rt==null?void 0:Rt.type,items:lodashExports$1.values(pages),itemOrientation:"vertical"}),((Lt=_e.Options)==null?void 0:Lt.children)&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[divider,_e.Options.children]})]})})}),jsxRuntimeExports.jsx(Space,{sx:{mx:"auto"}}),(Bt=_e.Extras)==null?void 0:Bt.children]})]})})}),SidebarPage=withSlots(({slotProps:_e})=>{var At,Pt,Dt;const lt=useSidebarBackground(),Rt=useAcrylic(lt);return jsxRuntimeExports.jsx(ErrorBoundary,{fallback:jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:"This page encountered an error."}),children:jsxRuntimeExports.jsxs(Flex,{vertical:!0,children:[jsxRuntimeExports.jsx(Flex,{sx:{position:"absolute",top:0,left:0,width:"100%"},children:jsxRuntimeExports.jsx(Box$1,{sx:{width:"100%",height:"100%",bgcolor:lt},children:(At=_e.Content)==null?void 0:At.children})}),jsxRuntimeExports.jsx(Flex,{sx:{height:Lt=>Lt.spacing(6)},children:jsxRuntimeExports.jsx(Flex,{sx:{p:0,position:"absolute",top:0,left:0,width:"100%",borderBottom:1,borderColor:"divider",alignItems:"center",...Rt},children:jsxRuntimeExports.jsx(Scroll,{x:!0,children:jsxRuntimeExports.jsxs(Flex,{sx:{width:"max-content",height:Lt=>Lt.spacing(6),alignItems:"center",p:1},children:[jsxRuntimeExports.jsx(Type$1,{sx:{p:1,color:"text.secondary"},children:(Pt=_e.Title)==null?void 0:Pt.children}),((Dt=_e.Options)==null?void 0:Dt.children)&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[divider,_e.Options.children]})]})})})})]})})}),defaultRoot={type:"branch",orientation:"horizontal",key:nanoid$1(),children:[{type:"leaf",content:{type:"explore"},key:nanoid$1(),size:20},{type:"leaf",content:void 0,key:nanoid$1(),size:80}]},LEFT=0,RIGHT=1;function useSidebarState(){const[_e,lt]=reactExports.useState(!1),[Rt,At]=reactExports.useState(defaultRoot),Pt=Nt=>At(produce(Rt,Nt)),{Content:Dt,derivedRoot:Lt,tab:Bt}=reactExports.useMemo(()=>{var qt;const Nt=lodashExports$1.get(Rt,`children[${LEFT}].content.type`)??"",jt=(qt=pages[Nt])==null?void 0:qt.content,Ut=produce(Rt,Xt=>{if(Xt.type==="branch"){Xt.locked=!_e,Xt.children[LEFT].hidden=!_e;const Kt=_e?Xt.children[LEFT].size===0?20:Xt.children[LEFT].size??20:0;Xt.children[LEFT].size=Kt,Xt.children[RIGHT].size=100-Kt}});return{Content:jt,derivedRoot:Ut,tab:_e?Nt:""}},[Rt,_e]);return{Content:Dt,tab:Bt,root:Lt,open:_e,setOpen:lt,produceRoot:Pt,setRoot:At}}function useSidebarBackground(){const{palette:_e}=useTheme();return reactExports.useMemo(()=>interpolate$2([_e.background.paper,_e.text.primary])(_e.mode==="dark"?.0125:.025),[_e])}function Sidebar({children:_e}){const{Content:lt,produceRoot:Rt,root:At,setRoot:Pt,setOpen:Dt,tab:Lt,open:Bt}=useSidebarState(),Nt=useSidebarBackground();return jsxRuntimeExports.jsx(TabContext,{value:Lt,children:jsxRuntimeExports.jsxs(Stack$1,{direction:"row",sx:{width:"100%"},children:[jsxRuntimeExports.jsx(Stack$1,{sx:{width:64,alignItems:"center",p:1,gap:1,bgcolor:Nt,borderRight:Bt?jt=>`1px solid ${jt.palette.mode==="dark"?jt.palette.background.default:jt.palette.divider}`:"none"},children:jsxRuntimeExports.jsx(TabList$1,{TabIndicatorProps:{sx:{left:0,right:"auto"}},onChange:(jt,Ut)=>{Rt(Gt=>void lodashExports$1.set(Gt,`children[${LEFT}].content.type`,Ut)),Dt(!0)},orientation:"vertical",sx:{width:64},children:lodashExports$1.values(pages).flatMap((jt,Ut,Gt)=>[!!Ut&&jt.color!==Gt[Ut-1].color&&jsxRuntimeExports.jsx(Divider$1,{sx:{mx:2,my:1}}),jsxRuntimeExports.jsx(Tab$1,{onClick:()=>Lt===jt.id?Dt(!1):Dt(!0),value:jt.id,sx:{minWidth:0,alignItems:"center",justifyContent:"center"},label:jsxRuntimeExports.jsx(Tooltip$1,{title:jt.name,placement:"right",children:jsxRuntimeExports.jsx(Box$1,{sx:{alignItems:"center",display:"flex","> svg > path":{strokeWidth:.5,stroke:Nt}},children:jt.icon})},jt.id)},jt.id)])})}),jsxRuntimeExports.jsx(Box$1,{sx:{flex:1},children:jsxRuntimeExports.jsx(ViewTree,{onChange:Pt,root:At,renderLeaf:jt=>jt.content?jsxRuntimeExports.jsx(Stack$1,{direction:"row",sx:{width:"100%",bgcolor:Nt},children:!!lt&&jsxRuntimeExports.jsx(Fade$1,{in:!0,children:jsxRuntimeExports.jsx(Box$1,{sx:{flex:1,height:"100%"},children:jsxRuntimeExports.jsx(lt,{template:SidebarPage})})})}):_e})})]})})}function PlaceholderPage({template:_e}){const{controls:lt,onChange:Rt,state:At,dragHandle:Pt}=useViewTreeContext();return jsxRuntimeExports.jsxs(_e,{onChange:Rt,stack:At,children:[jsxRuntimeExports.jsx(_e.Handle,{children:Pt}),jsxRuntimeExports.jsx(_e.Content,{children:jsxRuntimeExports.jsx(Placeholder$2,{label:"Empty Panel",secondary:"Choose a view to populate this panel."})}),jsxRuntimeExports.jsx(_e.Extras,{children:lt})]})}var FileDrop$1={},__extends=commonjsGlobal&&commonjsGlobal.__extends||function(){var _e=function(lt,Rt){return _e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(At,Pt){At.__proto__=Pt}||function(At,Pt){for(var Dt in Pt)Pt.hasOwnProperty(Dt)&&(At[Dt]=Pt[Dt])},_e(lt,Rt)};return function(lt,Rt){_e(lt,Rt);function At(){this.constructor=lt}lt.prototype=Rt===null?Object.create(Rt):(At.prototype=Rt.prototype,new At)}}(),__importDefault=commonjsGlobal&&commonjsGlobal.__importDefault||function(_e){return _e&&_e.__esModule?_e:{default:_e}};Object.defineProperty(FileDrop$1,"__esModule",{value:!0});var prop_types_1=__importDefault(propTypesExports),react_1=__importDefault(reactExports),FileDrop=function(_e){__extends(lt,_e);function lt(Rt){var At=_e.call(this,Rt)||this;return At.resetDragging=function(){At.frameDragCounter=0,At.setState({draggingOverFrame:!1,draggingOverTarget:!1})},At.handleWindowDragOverOrDrop=function(Pt){Pt.preventDefault()},At.handleFrameDrag=function(Pt){if(lt.eventHasFiles(Pt)){if(At.frameDragCounter+=Pt.type==="dragenter"?1:-1,At.frameDragCounter===1){At.setState({draggingOverFrame:!0}),At.props.onFrameDragEnter&&At.props.onFrameDragEnter(Pt);return}if(At.frameDragCounter===0){At.setState({draggingOverFrame:!1}),At.props.onFrameDragLeave&&At.props.onFrameDragLeave(Pt);return}}},At.handleFrameDrop=function(Pt){At.state.draggingOverTarget||(At.resetDragging(),At.props.onFrameDrop&&At.props.onFrameDrop(Pt))},At.handleDragOver=function(Pt){lt.eventHasFiles(Pt)&&(At.setState({draggingOverTarget:!0}),!lt.isIE()&&At.props.dropEffect&&(Pt.dataTransfer.dropEffect=At.props.dropEffect),At.props.onDragOver&&At.props.onDragOver(Pt))},At.handleDragLeave=function(Pt){At.setState({draggingOverTarget:!1}),At.props.onDragLeave&&At.props.onDragLeave(Pt)},At.handleDrop=function(Pt){if(At.props.onDrop&<.eventHasFiles(Pt)){var Dt=Pt.dataTransfer?Pt.dataTransfer.files:null;At.props.onDrop(Dt,Pt)}At.resetDragging()},At.handleTargetClick=function(Pt){At.props.onTargetClick&&At.props.onTargetClick(Pt),At.resetDragging()},At.stopFrameListeners=function(Pt){Pt&&(Pt.removeEventListener("dragenter",At.handleFrameDrag),Pt.removeEventListener("dragleave",At.handleFrameDrag),Pt.removeEventListener("drop",At.handleFrameDrop))},At.startFrameListeners=function(Pt){Pt&&(Pt.addEventListener("dragenter",At.handleFrameDrag),Pt.addEventListener("dragleave",At.handleFrameDrag),Pt.addEventListener("drop",At.handleFrameDrop))},At.frameDragCounter=0,At.state={draggingOverFrame:!1,draggingOverTarget:!1},At}return lt.prototype.componentDidMount=function(){this.startFrameListeners(this.props.frame),this.resetDragging(),window.addEventListener("dragover",this.handleWindowDragOverOrDrop),window.addEventListener("drop",this.handleWindowDragOverOrDrop)},lt.prototype.componentDidUpdate=function(Rt){Rt.frame!==this.props.frame&&(this.resetDragging(),this.stopFrameListeners(Rt.frame),this.startFrameListeners(this.props.frame))},lt.prototype.componentWillUnmount=function(){this.stopFrameListeners(this.props.frame),window.removeEventListener("dragover",this.handleWindowDragOverOrDrop),window.removeEventListener("drop",this.handleWindowDragOverOrDrop)},lt.prototype.render=function(){var Rt=this.props,At=Rt.children,Pt=Rt.className,Dt=Rt.targetClassName,Lt=Rt.draggingOverFrameClassName,Bt=Rt.draggingOverTargetClassName,Nt=this.state,jt=Nt.draggingOverTarget,Ut=Nt.draggingOverFrame,Gt=Dt;return Ut&&(Gt+=" "+Lt),jt&&(Gt+=" "+Bt),react_1.default.createElement("div",{className:Pt,onDragOver:this.handleDragOver,onDragLeave:this.handleDragLeave,onDrop:this.handleDrop},react_1.default.createElement("div",{className:Gt,onClick:this.handleTargetClick},At))},lt.isIE=function(){return typeof window<"u"&&(window.navigator.userAgent.indexOf("MSIE")!==-1||window.navigator.appVersion.indexOf("Trident/")>0)},lt.eventHasFiles=function(Rt){var At=!1;if(Rt.dataTransfer){var Pt=Rt.dataTransfer.types;for(var Dt in Pt)if(Pt[Dt]==="Files"){At=!0;break}}return At},lt.propTypes={className:prop_types_1.default.string,targetClassName:prop_types_1.default.string,draggingOverFrameClassName:prop_types_1.default.string,draggingOverTargetClassName:prop_types_1.default.string,onDragOver:prop_types_1.default.func,onDragLeave:prop_types_1.default.func,onDrop:prop_types_1.default.func,onTargetClick:prop_types_1.default.func,dropEffect:prop_types_1.default.oneOf(["copy","move","link","none"]),frame:function(Rt,At,Pt){var Dt=Rt[At];if(Dt==null)return new Error("Warning: Required prop `"+At+"` was not specified in `"+Pt+"`");if(Dt!==document&&!(Dt instanceof HTMLElement))return new Error("Warning: Prop `"+At+"` must be one of the following: document, HTMLElement!")},onFrameDragEnter:prop_types_1.default.func,onFrameDragLeave:prop_types_1.default.func,onFrameDrop:prop_types_1.default.func},lt.defaultProps={dropEffect:"copy",frame:typeof window>"u"?void 0:window.document,className:"file-drop",targetClassName:"file-drop-target",draggingOverFrameClassName:"file-drop-dragging-over-frame",draggingOverTargetClassName:"file-drop-dragging-over-target"},lt}(react_1.default.PureComponent),FileDrop_2=FileDrop$1.FileDrop=FileDrop;function FileDropZone(){const _e=useAcrylic(),{load:lt}=useWorkspace(),[Rt,At]=reactExports.useState(0),[,Pt]=useLayers(),Dt=useBusyState("file-drop-import"),Lt=useSnackbar();async function Bt(Nt){let jt=0;for(const[Ut,Gt]of Nt.map((...qt)=>qt))for(const[qt,{claimImportedFile:Xt}]of lodashExports$1.entries(layerHandlers)){const Kt=await(Xt==null?void 0:Xt(Ut));if(Kt!=null&&Kt.claimed){await Dt(async()=>{const Zt=await Kt.layer(Lt);Pt(producify(Qt=>Qt.layers.push({key:nanoid$1(),source:{type:qt,...Zt}})))},`${Gt+1} of ${Nt.length}: Importing ${qt} (${formatByte(Ut.size)})`),jt+=1;continue}}!jt&&await lt(lodashExports$1.head(Nt))||Lt(`Couldn't open ${Nt.length} of ${pluralize("file",Nt.length,!0)}`)}return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(FileDrop_2,{onFrameDragLeave:()=>At(0),onFrameDragEnter:Nt=>{var jt;return At(((jt=Nt==null?void 0:Nt.dataTransfer)==null?void 0:jt.items.length)??0)},onFrameDrop:()=>At(0),onDragLeave:()=>At(0),onDrop:Nt=>Nt&&Bt(Array.from(Nt)),children:jsxRuntimeExports.jsx(Backdrop$1,{sx:{..._e,zIndex:Nt=>Nt.zIndex.tooltip+1},open:!!Rt,children:jsxRuntimeExports.jsxs(Stack$1,{alignItems:"center",spacing:4,children:[jsxRuntimeExports.jsx(WorkspacesOutlined,{}),jsxRuntimeExports.jsx(Type$1,{variant:"body2",color:"text.secondary",children:Rt?`Import ${pluralize("item",Rt,!0)}`:""})]})})})})}function wait(_e){return new Promise(lt=>lodashExports$1.delay(lt,_e))}async function timed(_e,lt=2500){const Rt=lodashExports$1.now();return{result:await Promise.any([_e(),wait(lt)]),delta:lodashExports$1.now()-Rt}}const FullscreenPage=withSlots(({slotProps:_e})=>{var Rt,At,Pt,Dt;const lt=useSmallDisplay();return jsxRuntimeExports.jsxs(Box$1,{sx:{height:"100%"},children:[!!((Rt=_e.Options)!=null&&Rt.children)&&jsxRuntimeExports.jsx(Flex,{sx:{height:Lt=>Lt.spacing(6)},children:jsxRuntimeExports.jsxs(Flex,{sx:{p:0,zIndex:1,position:"absolute",top:0,left:0,width:"100%",borderBottom:1,borderColor:"divider",alignItems:"center",pr:6,background:Lt=>Lt.palette.background.paper},children:[jsxRuntimeExports.jsx(Scroll,{x:!0,children:jsxRuntimeExports.jsx(Flex,{sx:{width:"max-content",height:Lt=>Lt.spacing(6),alignItems:"center",p:1},children:((At=_e.Options)==null?void 0:At.children)&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:_e.Options.children})})}),(Pt=_e.Extras)==null?void 0:Pt.children]})}),jsxRuntimeExports.jsx(Box$1,{sx:{bgcolor:"background.paper",mt:-6,height:"100%"},children:jsxRuntimeExports.jsx(Scroll,{y:!0,style:{height:lt?"100%":"70vh"},children:(Dt=_e.Content)==null?void 0:Dt.children})})]})});function FullscreenModalHost(){const[{fullscreenModal:_e},lt]=useUIState(),[Rt,At]=reactExports.useState(!1);async function Pt(){At(!0),await wait(300),lt(()=>({fullscreenModal:void 0})),At(!1)}const Dt=_e?pages[_e]:void 0,Lt=reactExports.useMemo(()=>{if(Dt){const Bt=Dt.content,Nt=withSlots(({slotProps:jt,...Ut})=>{var Gt,qt,Xt;return jsxRuntimeExports.jsxs(FullscreenPage,{...Ut,children:[jsxRuntimeExports.jsx(FullscreenPage.Content,{children:(Gt=jt.Content)==null?void 0:Gt.children}),jsxRuntimeExports.jsx(FullscreenPage.Options,{children:(qt=jt.Options)==null?void 0:qt.children}),jsxRuntimeExports.jsx(FullscreenPage.Extras,{children:(Xt=jt.Extras)==null?void 0:Xt.children})]})});return jsxRuntimeExports.jsx(Bt,{template:Nt})}},[_e,Dt]);return!!Dt&&jsxRuntimeExports.jsxs(Modal,{open:!Rt,onClose:Pt,width:"70vw",children:[jsxRuntimeExports.jsx(ModalAppBar,{onClose:Pt,children:jsxRuntimeExports.jsx(Type$1,{variant:"h6",children:Dt.name})}),Lt]})}function FullscreenProgress(){const[_e]=useBusy(),lt=useAcrylic(),Rt=lodashExports$1.values(_e);return jsxRuntimeExports.jsx(Backdrop$1,{sx:{...lt,zIndex:At=>At.zIndex.tooltip+1,WebkitAppRegion:"drag"},open:!!Rt.length,children:jsxRuntimeExports.jsxs(Stack$1,{alignItems:"center",spacing:4,children:[jsxRuntimeExports.jsx(CircularProgress$1,{}),Rt.map((At,Pt)=>jsxRuntimeExports.jsx(Type$1,{variant:"body2",color:"textSecondary",children:At},Pt))]})})}function Inspector(_e){const lt=useAnyLoading(),[{view:Rt},At]=useView(),[,Pt]=useUIState();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Flex,{..._e,children:jsxRuntimeExports.jsx(Sidebar,{children:jsxRuntimeExports.jsx(ViewTree,{onPopOut:Dt=>Pt(()=>{var Lt;return{fullscreenModal:(Lt=Dt.content)==null?void 0:Lt.type}}),canPopOut:Dt=>{var Lt;return!!((Lt=pages[Dt.content.type])!=null&&Lt.allowFullscreen)},root:Rt,onChange:Dt=>At(()=>({view:Dt})),renderLeaf:({content:Dt})=>{var Bt;const Lt=((Bt=pages[(Dt==null?void 0:Dt.type)??""])==null?void 0:Bt.content)??PlaceholderPage;return jsxRuntimeExports.jsx(Box$1,{sx:{width:"100%",height:"100%"},children:jsxRuntimeExports.jsx(Lt,{template:Page})})}})})}),jsxRuntimeExports.jsx(Fade$1,{in:lt,children:jsxRuntimeExports.jsx(LinearProgress$1,{variant:"indeterminate",sx:{position:"absolute",bottom:0,width:"100%",zIndex:1}})}),jsxRuntimeExports.jsx(FullscreenModalHost,{}),jsxRuntimeExports.jsx(FullscreenProgress,{}),jsxRuntimeExports.jsx(FileDropZone,{})]})}const getForegroundColor=_e=>getContrastRatio(_e,"#ffffff")>getContrastRatio(_e,"#000000")?"#ffffff":"#000000";function useTitleBar(_e){reactExports.useEffect(()=>{lodashExports$1.defer(()=>document.querySelector('meta[name="theme-color"]').setAttribute("content",_e)),document.title=name,"electron"in window&&window.electron.invoke("title-bar","#00000000",getForegroundColor(_e))},[_e])}function ConnectionsService(){const _e=useSnackbar(),[{remote:lt}]=useSettings(),[,Rt]=useConnections(),At=useLoadingState("connections");return reactExports.useEffect(()=>{let Pt=!1,Dt=[];return At(async()=>{if(lt!=null&<.length){for(const{transport:Lt,url:Bt,disabled:Nt}of lt){if(Nt!==!0){_e(`Connecting to ${Bt}...`);const jt=new(getTransport(Lt))({url:Bt});await jt.connect();const{result:Ut,delta:Gt}=await timed(()=>jt.call("about"));Ut?(_e(`Connected to ${Ut.name}`),Dt=[...Dt,{...Ut,url:Bt,ping:Gt,transport:()=>jt}]):await jt.disconnect()}Pt||Rt(()=>Dt)}Pt||_e(`Connected to ${Dt.length} of ${lt.length} solvers`)}}),()=>{Pt=!0,Dt.map(Lt=>Lt.transport().disconnect())}},[lt,Rt,_e,At]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}function withSource(_e){return lt=>({...lt,source:_e})}const getFeatures=async({transport:_e,url:lt})=>lodashExports$1.chain(await map$6(["algorithms","formats","maps","traces"],async Rt=>{const{result:At}=await timed(()=>_e().call(`features/${Rt}`),1e3);return{prop:Rt,result:lodashExports$1.map(At,withSource(lt))}})).keyBy("prop").mapValues("result").value();function FeaturesService(){const[_e]=useConnections(),[,lt]=useFeatures(),[{connections:Rt}]=useLoading();return useAsyncAbortable(async At=>{if(!Rt){const Pt={default:{algorithms:[],formats:lodashExports$1.keys(mapParsers).map(Lt=>({id:Lt,source:"internal"})),traces:[],maps:[]}},Dt=()=>{if(!At.aborted){const Lt=lodashExports$1.chain(Pt).values().reduce((Bt,Nt)=>lodashExports$1.mergeWith({},Bt,Nt,(jt,Ut)=>lodashExports$1.isArray(jt)?lodashExports$1.uniqBy([...jt,...Ut],"id"):void 0)).value();lt(()=>Lt)}};for(const Lt of _e){const Bt=async()=>{Pt[Lt.url]=await getFeatures(Lt),Dt()};Lt.transport().on("features/changed",Bt),Bt()}}},[_e,getFeatures,lt,Rt]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}function useLayerServices(){const[{layers:_e},lt]=useLayers();return reactExports.useMemo(()=>lodashExports$1.map(_e,Rt=>{const At=getLayerHandler(Rt).service;if(At)return reactExports.createElement(At,{key:Rt.key,value:Rt,onChange:Pt=>lt(({layers:Dt})=>({layers:lodashExports$1.map(Dt,Lt=>Lt.key===Rt.key?Pt(Lt):Lt)}))})}),[_e,lt])}function LayerService(){const _e=useLayerServices();return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:_e})}var dist={},ConsoleCapture$1={},logs={};Object.defineProperty(logs,"__esModule",{value:!0});logs.overridableFunctionNames=void 0;logs.overridableFunctionNames=["log","warn","info","debug","error"];Object.defineProperty(ConsoleCapture$1,"__esModule",{value:!0});ConsoleCapture$1.ConsoleCapture=void 0;var logs_1=logs;console.original={};var ConsoleCapture=function(){function _e(){_e.captures=[]}return _e.saveLog=function(lt,Rt){var At=Rt.map(function(Pt){return typeof Pt=="object"?Pt instanceof Error?JSON.stringify(Pt,Object.getOwnPropertyNames(Pt)):JSON.stringify(Pt):Pt});_e.captures.push({function:lt,args:At,ts:Date.now()})},_e.setNewFunctions=function(lt){lt===void 0&&(lt=!1);var Rt={apply:function(At,Pt,Dt){if(_e.saveLog(At.name,Dt),At.bind(Pt),lt)return At.apply(void 0,Dt)}};logs_1.overridableFunctionNames.forEach(function(At){_e.consoleOverriden||(console.original[At]=console[At]),console[At]=new Proxy(console[At],Rt)}),_e.consoleOverriden=!0},_e.resetToOriginalFunctions=function(){_e.consoleOverriden&&logs_1.overridableFunctionNames.forEach(function(lt){console[lt]=console.original[lt]}),_e.consoleOverriden=!1},_e.prototype.start=function(lt){lt===void 0&&(lt=!1),_e.captures=[],_e.setNewFunctions(lt)},_e.prototype.stop=function(){_e.resetToOriginalFunctions()},_e.prototype.flush=function(){_e.captures=[]},_e.prototype.getCaptures=function(){return _e.captures},_e.makeOriginalLog=function(lt){if(_e.resetToOriginalFunctions(),logs_1.overridableFunctionNames.includes(lt.function)){var Rt=lt.args.map(function(At){if(typeof At=="string")try{var Pt=JSON.parse(At);return Pt.stack?Pt.stack:Pt}catch{return At}return At});console[lt.function].apply(console,Rt)}else throw Error("Invalid Log type")},_e.consoleOverriden=!1,_e}();ConsoleCapture$1.ConsoleCapture=ConsoleCapture;Object.defineProperty(dist,"__esModule",{value:!0});var ConsoleCapture_1=ConsoleCapture$1;dist.default=ConsoleCapture_1.ConsoleCapture;function LogCaptureService(){return useSnackbar(),reactExports.useEffect(()=>{},[]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}function SettingsService(){const[{"behaviour/showOnStart":_e},,lt]=useSettings(),[,Rt]=useUIState();return reactExports.useEffect(()=>{_e&<&&Rt(()=>({fullscreenModal:_e}))},[lt]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}function SliceProvider({slices:_e,children:lt,services:Rt}){return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:lodashExports$1.reduce(lodashExports$1.map(_e,At=>reactExports.createElement(At)),(At,Pt)=>reactExports.cloneElement(Pt,{},At),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[lt,lodashExports$1.map(Rt,(At,Pt)=>reactExports.createElement(At,{key:Pt}))]}))})}const services=[ConnectionsService,FeaturesService,RendererService,LayerService,LogCaptureService,SettingsService];function App(){const{palette:_e}=useTheme(),lt=_e.background.default;return useTitleBar(lt),jsxRuntimeExports.jsxs(Flex,{vertical:!0,sx:{bgcolor:lt,color:"text.primary"},children:[jsxRuntimeExports.jsx(TitleBar,{}),jsxRuntimeExports.jsx(Flex,{flex:1,children:jsxRuntimeExports.jsx(Inspector,{flex:1})})]})}function ThemedApp(){const[{"appearance/theme":_e="light","appearance/accentColor":lt="teal"}]=useSettings(),Rt=reactExports.useMemo(()=>makeTheme(_e,lt),[_e,lt]);return jsxRuntimeExports.jsx(ThemeProvider,{theme:Rt,children:jsxRuntimeExports.jsx(SnackbarProvider,{children:jsxRuntimeExports.jsx(SliceProvider,{services,children:jsxRuntimeExports.jsx(App,{})})})})}const index="",overlayscrollbars="";var createRoot,m=reactDomExports;createRoot=m.createRoot,m.hydrateRoot;const root=createRoot(document.getElementById("root")),slices=[BusyProvider,SettingsProvider,ConnectionsProvider,FeaturesProvider,UIStateProvider,LoadingProvider,RendererProvider,LogProvider,ViewProvider,LayersProvider,ScreenshotsProvider];root.render(jsxRuntimeExports.jsx(CssBaseline,{children:jsxRuntimeExports.jsx(SliceProvider,{slices,children:jsxRuntimeExports.jsx(ThemedApp,{})})})); diff --git a/index.html b/index.html index a7a50739..efda0ca2 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@ - +