@marimo-team/frontend 0.24.1-dev96 → 0.24.1-dev98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{CellStatus-BAfpiaJr.js → CellStatus-wvvZkEPY.js} +1 -1
- package/dist/assets/{JsonOutput-Bu92ihyf.js → JsonOutput-CRLQQVKf.js} +1 -1
- package/dist/assets/{MarimoErrorOutput-B6VFcCOD.js → MarimoErrorOutput-CeUo5oka.js} +1 -1
- package/dist/assets/{RenderHTML-Cqn8OKqJ.js → RenderHTML-YkwVPe9V.js} +1 -1
- package/dist/assets/{RunButton-CjlJVYRU.js → RunButton-BaV8A-z4.js} +1 -1
- package/dist/assets/{add-cell-with-ai-CoNAy8Wk.js → add-cell-with-ai-DoLkfzYn.js} +1 -1
- package/dist/assets/add-connection-dialog-C1IF1nR0.js +166 -0
- package/dist/assets/{agent-panel-BsUX99c5.js → agent-panel-CG154QrU.js} +1 -1
- package/dist/assets/{ai-model-dropdown-jajg9hms.js → ai-model-dropdown-CrSrb8Zz.js} +1 -1
- package/dist/assets/{app-config-button-CHcCBh-B.js → app-config-button-ktBH1pEB.js} +1 -1
- package/dist/assets/{blob-kift6pGB.js → blob-DVtvZmWH.js} +1 -1
- package/dist/assets/{cell-editor-ByVa98Tu.js → cell-editor-DoDqaCZp.js} +1 -1
- package/dist/assets/{cell-link-CnfnwA6v.js → cell-link-Dqqt6Rgs.js} +1 -1
- package/dist/assets/{cells-BEcungGa.js → cells-D4RwofRx.js} +1 -1
- package/dist/assets/{chat-display-CL_JFB9v.js → chat-display-COmzHgx5.js} +1 -1
- package/dist/assets/{chat-panel-CSzekzAv.js → chat-panel-B2tyEfGW.js} +1 -1
- package/dist/assets/{chat-ui-C1eAy9FG.js → chat-ui-B5bsr-7V.js} +1 -1
- package/dist/assets/{column-preview-BZX77DV6.js → column-preview-CW5DPFvy.js} +1 -1
- package/dist/assets/{command-palette-56SvxMFF.js → command-palette-B9dyvMvJ.js} +1 -1
- package/dist/assets/{common-fL5LEOMt.js → common-CC3tuCpi.js} +1 -1
- package/dist/assets/{components-BtTyGydI.js → components-D02ZZZMP.js} +1 -1
- package/dist/assets/{datasource-uyI476er.js → datasource-Do8f2hFf.js} +1 -1
- package/dist/assets/{dependency-graph-panel-DQ6IwmNu.js → dependency-graph-panel-Dg-tUB9T.js} +1 -1
- package/dist/assets/{documentation-panel-ChxeMQDj.js → documentation-panel-DvHjxlli.js} +1 -1
- package/dist/assets/{download-Dv0iO8M_.js → download-BP8MrprC.js} +1 -1
- package/dist/assets/{edit-page-B1Vy-UvZ.js → edit-page-71cK-Nhe.js} +4 -4
- package/dist/assets/{error-entries-B5GaQ2cq.js → error-entries-DOZ1u97X.js} +1 -1
- package/dist/assets/{error-panel-D_YO8QtX.js → error-panel-CINcf76Z.js} +1 -1
- package/dist/assets/{file-explorer-panel-1JRkBA_A.js → file-explorer-panel-cflxW8a7.js} +1 -1
- package/dist/assets/{file-icons-D18ZIT8U.js → file-icons-DgKj9mrV.js} +1 -1
- package/dist/assets/{file-name-input-Dp8aYmEH.js → file-name-input-CQF4Ovwx.js} +1 -1
- package/dist/assets/{floating-outline-B14J6Uv7.js → floating-outline-CRXIsrPm.js} +1 -1
- package/dist/assets/{home-page-CoMZwM0i.js → home-page-DPRHPAQM.js} +1 -1
- package/dist/assets/{index-BTUbA8tU.js → index-p49fbIlR.js} +3 -3
- package/dist/assets/{layout-FSOVn_sw.js → layout-KJMQADEj.js} +3 -3
- package/dist/assets/{logs-panel-BwA2j1LD.js → logs-panel-DFibPeCT.js} +1 -1
- package/dist/assets/{markdown-renderer-IN72oVfj.js → markdown-renderer-CdZX2MvM.js} +1 -1
- package/dist/assets/{name-cell-input-BOFMaTa1.js → name-cell-input-B-d5Jwh4.js} +1 -1
- package/dist/assets/{outline-panel-xZQU-sfs.js → outline-panel-D2Wk10hY.js} +1 -1
- package/dist/assets/{packages-panel-gfl3Dnuj.js → packages-panel-CQsbxIlG.js} +1 -1
- package/dist/assets/{panel-accordion-state-BBB6Kqr-.js → panel-accordion-state-D6-FMXE2.js} +1 -1
- package/dist/assets/{panels-mouc5Y1Z.js → panels-BgcK_4M7.js} +1 -1
- package/dist/assets/{process-output-C-rOBNl7.js → process-output-DvTtgoMs.js} +1 -1
- package/dist/assets/{readonly-code-display-fUSnJEhE.js → readonly-code-display-BvqLeUsJ.js} +1 -1
- package/dist/assets/{readonly-python-code-C2BktOKY.js → readonly-python-code-GSN4D4sb.js} +1 -1
- package/dist/assets/{reveal-component-CsovRN4m.js → reveal-component-u9ED2diI.js} +1 -1
- package/dist/assets/{run-page-CRcnkzFj.js → run-page-U5iuhyz8.js} +1 -1
- package/dist/assets/{scratchpad-panel-BkqXEAfy.js → scratchpad-panel--YOR0kUB.js} +1 -1
- package/dist/assets/{session-panel-CnIUsX9O.js → session-panel-C_N3WGWQ.js} +1 -1
- package/dist/assets/{skeleton-7uu6KXmn.js → skeleton-CsceCAjw.js} +1 -1
- package/dist/assets/{snippets-panel-BoziU8SV.js → snippets-panel-BxwHsPmW.js} +1 -1
- package/dist/assets/{state-DNIOp9vd.js → state-BqrF--O0.js} +1 -1
- package/dist/assets/{state-DaMe_1Uy.js → state-CHplO0zn.js} +1 -1
- package/dist/assets/{tracing-COpxb-Up.js → tracing-Dhq121dR.js} +1 -1
- package/dist/assets/{tracing-panel-DnNQLsh8.js → tracing-panel-IKt1933_.js} +2 -2
- package/dist/assets/{tree-actions-CjTwlxy1.js → tree-actions-DIfWonCA.js} +1 -1
- package/dist/assets/{useAddCell-ZP7MPBcM.js → useAddCell-BYrVaYfZ.js} +1 -1
- package/dist/assets/{useCellActionButton-va5-Bjgq.js → useCellActionButton-DbXDs0MA.js} +1 -1
- package/dist/assets/{useDeleteCell-CuEKdiht.js → useDeleteCell-Wgcl3CRG.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-DDQx4yD6.js → useDependencyPanelTab-C5AU8GKL.js} +1 -1
- package/dist/assets/useNotebookActions-FuMERtHq.js +10 -0
- package/dist/assets/{useRunCells-DccIcaY0.js → useRunCells-DTdMRbkE.js} +1 -1
- package/dist/assets/{useSplitCell-CoAAhbPs.js → useSplitCell-2z0zEB8X.js} +1 -1
- package/dist/index.html +19 -19
- package/package.json +2 -2
- package/src/components/editor/actions/__tests__/types.test.ts +44 -0
- package/src/components/editor/actions/useNotebookActions.tsx +16 -0
- package/src/components/editor/chrome/types.ts +1 -1
- package/src/components/editor/connections/database/add-database-form.tsx +4 -0
- package/src/components/editor/connections/storage/add-storage-form.tsx +6 -0
- package/dist/assets/add-connection-dialog-D28GcLwH.js +0 -166
- package/dist/assets/useNotebookActions-DEBmnVAR.js +0 -10
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as e,r as t,t as n}from"./rolldown-runtime-B0Z9INg1.js";import{t as r}from"./useEvent-xfs0Sn4r.js";import{t as i}from"./react-CBDbhulC.js";import{t as a}from"./compiler-runtime-CYIjoINj.js";import{_ as o}from"./useEventListener-D27Dii_l.js";import{t as s}from"./jsx-runtime-B74pBk57.js";import{o as c}from"./alert-dialog-BVi_GyOB.js";import{a as l}from"./tabs-c6mpccpH.js";import{a as u,p as d,r as f,t as p}from"./dropdown-menu-CqNabM1f.js";import{r as m}from"./requests-C6_IaFh7.js";import{t as h}from"./createLucideIcon-B7HeEoG2.js";import{n as g,t as _}from"./tree-actions-CjTwlxy1.js";import{t as v}from"./copy-BMXKNElG.js";import{b as ee}from"./write-secret-modal-lNU_7c2x.js";import{t as y}from"./trash-2-D_HX-0qx.js";import{t as b}from"./use-toast-DpWHUGuF.js";import{t as x}from"./paths-zcL04qUW.js";import{a as te}from"./errors-DzO-nXy-.js";import{t as ne}from"./extends-CvVTau-c.js";import{i as re,n as ie,r as S}from"./pathUtils-Cryrlpma.js";import{n as ae}from"./semaphore-BjoL5P0h.js";var oe=h(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),C=e(i(),1),w=s(),se=l();function ce(e,t){return ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ce(e,t)}function le(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ce(e,t)}function ue(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}var de=n(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),fe=(0,C.createContext)({dragDropManager:void 0});function T(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 pe=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})(),me=function(){return Math.random().toString(36).substring(7).split(``).join(`.`)},he={INIT:`@@redux/INIT`+me(),REPLACE:`@@redux/REPLACE`+me(),PROBE_UNKNOWN_ACTION:function(){return`@@redux/PROBE_UNKNOWN_ACTION`+me()}};function ge(e){if(typeof e!=`object`||!e)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function _e(e,t,n){var r;if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(T(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(T(1));return n(_e)(e,t)}if(typeof e!=`function`)throw Error(T(2));var i=e,a=t,o=[],s=o,c=!1;function l(){s===o&&(s=o.slice())}function u(){if(c)throw Error(T(3));return a}function d(e){if(typeof e!=`function`)throw Error(T(4));if(c)throw Error(T(5));var t=!0;return l(),s.push(e),function(){if(t){if(c)throw Error(T(6));t=!1,l();var n=s.indexOf(e);s.splice(n,1),o=null}}}function f(e){if(!ge(e))throw Error(T(7));if(e.type===void 0)throw Error(T(8));if(c)throw Error(T(9));try{c=!0,a=i(a,e)}finally{c=!1}for(var t=o=s,n=0;n<t.length;n++){var r=t[n];r()}return e}function p(e){if(typeof e!=`function`)throw Error(T(10));i=e,f({type:he.REPLACE})}function m(){var e,t=d;return e={subscribe:function(e){if(typeof e!=`object`||!e)throw Error(T(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}},e[pe]=function(){return this},e}return f({type:he.INIT}),r={dispatch:f,subscribe:d,getState:u,replaceReducer:p},r[pe]=m,r}function E(e,t,...n){if(ve()&&t===void 0)throw Error(`invariant requires an error message argument`);if(!e){let e;if(t===void 0)e=Error(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{let r=0;e=Error(t.replace(/%s/g,function(){return n[r++]})),e.name=`Invariant Violation`}throw e.framesToPop=1,e}}function ve(){return typeof process<`u`&&!0}function ye(e,t,n){return t.split(`.`).reduce((e,t)=>e&&e[t]?e[t]:n||null,e)}function be(e,t){return e.filter(e=>e!==t)}function xe(e){return typeof e==`object`}function Se(e,t){let n=new Map,r=e=>{n.set(e,n.has(e)?n.get(e)+1:1)};e.forEach(r),t.forEach(r);let i=[];return n.forEach((e,t)=>{e===1&&i.push(t)}),i}function Ce(e,t){return e.filter(e=>t.indexOf(e)>-1)}var we=`dnd-core/INIT_COORDS`,D=`dnd-core/BEGIN_DRAG`,Te=`dnd-core/PUBLISH_DRAG_SOURCE`,Ee=`dnd-core/HOVER`,De=`dnd-core/DROP`,Oe=`dnd-core/END_DRAG`;function ke(e,t){return{type:we,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}var Ae={type:we,payload:{clientOffset:null,sourceClientOffset:null}};function je(e){return function(t=[],n={publishSource:!0}){let{publishSource:r=!0,clientOffset:i,getSourceClientOffset:a}=n,o=e.getMonitor(),s=e.getRegistry();e.dispatch(ke(i)),Me(t,o,s);let c=Fe(t,o);if(c==null){e.dispatch(Ae);return}let l=null;if(i){if(!a)throw Error(`getSourceClientOffset must be defined`);Ne(a),l=a(c)}e.dispatch(ke(i,l));let u=s.getSource(c).beginDrag(o,c);return u==null?void 0:(Pe(u),s.pinSource(c),{type:D,payload:{itemType:s.getSourceType(c),item:u,sourceId:c,clientOffset:i||null,sourceClientOffset:l||null,isSourcePublic:!!r}})}}function Me(e,t,n){E(!t.isDragging(),`Cannot call beginDrag while dragging.`),e.forEach(function(e){E(n.getSource(e),`Expected sourceIds to be registered.`)})}function Ne(e){E(typeof e==`function`,`When clientOffset is provided, getSourceClientOffset must be a function.`)}function Pe(e){E(xe(e),`Item must be an object.`)}function Fe(e,t){let n=null;for(let r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}function Ie(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Le(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Ie(e,t,n[t])})}return e}function Re(e){return function(t={}){let n=e.getMonitor(),r=e.getRegistry();ze(n),He(n).forEach((i,a)=>{let o={type:De,payload:{dropResult:Le({},t,Be(i,a,r,n))}};e.dispatch(o)})}}function ze(e){E(e.isDragging(),`Cannot call drop while not dragging.`),E(!e.didDrop(),`Cannot call drop twice during one drag operation.`)}function Be(e,t,n,r){let i=n.getTarget(e),a=i?i.drop(r,e):void 0;return Ve(a),a===void 0&&(a=t===0?{}:r.getDropResult()),a}function Ve(e){E(e===void 0||xe(e),`Drop result must either be an object or undefined.`)}function He(e){let t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Ue(e){return function(){let t=e.getMonitor(),n=e.getRegistry();We(t);let r=t.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource()),{type:Oe}}}function We(e){E(e.isDragging(),`Cannot call endDrag while not dragging.`)}function Ge(e,t){return t===null?e===null:Array.isArray(e)?e.some(e=>e===t):e===t}function Ke(e){return function(t,{clientOffset:n}={}){qe(t);let r=t.slice(0),i=e.getMonitor(),a=e.getRegistry();return Ye(r,a,i.getItemType()),Je(r,i,a),Xe(r,i,a),{type:Ee,payload:{targetIds:r,clientOffset:n||null}}}}function qe(e){E(Array.isArray(e),`Expected targetIds to be an array.`)}function Je(e,t,n){E(t.isDragging(),`Cannot call hover while not dragging.`),E(!t.didDrop(),`Cannot call hover after drop.`);for(let t=0;t<e.length;t++){let r=e[t];E(e.lastIndexOf(r)===t,`Expected targetIds to be unique in the passed array.`),E(n.getTarget(r),`Expected targetIds to be registered.`)}}function Ye(e,t,n){for(let r=e.length-1;r>=0;r--){let i=e[r];Ge(t.getTargetType(i),n)||e.splice(r,1)}}function Xe(e,t,n){e.forEach(function(e){n.getTarget(e).hover(t,e)})}function Ze(e){return function(){if(e.getMonitor().isDragging())return{type:Te}}}function Qe(e){return{beginDrag:je(e),publishDragSource:Ze(e),hover:Ke(e),drop:Re(e),endDrag:Ue(e)}}var $e=class{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){let e=this,{dispatch:t}=this.store;function n(n){return(...r)=>{let i=n.apply(e,r);i!==void 0&&t(i)}}let r=Qe(this);return Object.keys(r).reduce((e,t)=>{let i=r[t];return e[t]=n(i),e},{})}dispatch(e){this.store.dispatch(e)}constructor(e,t){this.isSetUp=!1,this.handleRefCountChange=()=>{let e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}};function et(e,t){return{x:e.x+t.x,y:e.y+t.y}}function tt(e,t){return{x:e.x-t.x,y:e.y-t.y}}function nt(e){let{clientOffset:t,initialClientOffset:n,initialSourceClientOffset:r}=e;return!t||!n||!r?null:tt(et(t,r),n)}function rt(e){let{clientOffset:t,initialClientOffset:n}=e;return!t||!n?null:tt(t,n)}var O=[],it=[];O.__IS_NONE__=!0,it.__IS_ALL__=!0;function at(e,t){return e===O?!1:e===it||t===void 0||Ce(t,e).length>0}var ot=class{subscribeToStateChange(e,t={}){let{handlerIds:n}=t;E(typeof e==`function`,`listener must be a function.`),E(n===void 0||Array.isArray(n),`handlerIds, when specified, must be an array of strings.`);let r=this.store.getState().stateId;return this.store.subscribe(()=>{let t=this.store.getState(),i=t.stateId;try{i===r||i===r+1&&!at(t.dirtyHandlerIds,n)||e()}finally{r=i}})}subscribeToOffsetChange(e){E(typeof e==`function`,`listener must be a function.`);let t=this.store.getState().dragOffset;return this.store.subscribe(()=>{let n=this.store.getState().dragOffset;n!==t&&(t=n,e())})}canDragSource(e){if(!e)return!1;let t=this.registry.getSource(e);return E(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()&&t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;let t=this.registry.getTarget(e);return E(t,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop()?!1:Ge(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e)}isDragging(){return!!this.getItemType()}isDraggingSource(e){if(!e)return!1;let t=this.registry.getSource(e,!0);return E(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic()||this.registry.getSourceType(e)!==this.getItemType()?!1:t.isDragging(this,e)}isOverTarget(e,t={shallow:!1}){if(!e)return!1;let{shallow:n}=t;if(!this.isDragging())return!1;let r=this.registry.getTargetType(e),i=this.getItemType();if(i&&!Ge(r,i))return!1;let a=this.getTargetIds();if(!a.length)return!1;let o=a.indexOf(e);return n?o===a.length-1:o>-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 nt(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return rt(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}},st=typeof global<`u`?global:self,ct=st.MutationObserver||st.WebKitMutationObserver;function lt(e){return function(){let t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}function ut(e){let t=1,n=new ct(e),r=document.createTextNode(``);return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}var dt=typeof ct==`function`?ut:lt,ft=class{enqueueTask(e){let{queue:t,requestFlush:n}=this;t.length||(n(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{let{queue:e}=this;for(;this.index<e.length;){let t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,n=e.length-this.index;t<n;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=dt(this.flush),this.requestErrorThrow=lt(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},pt=class{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}},mt=class{create(e){let t=this.freeTasks,n=t.length?t.pop():new pt(this.onError,e=>t[t.length]=e);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}},ht=new ft,gt=new mt(ht.registerPendingError);function _t(e){ht.enqueueTask(gt.create(e))}var vt=`dnd-core/ADD_SOURCE`,yt=`dnd-core/ADD_TARGET`,bt=`dnd-core/REMOVE_SOURCE`,xt=`dnd-core/REMOVE_TARGET`;function St(e){return{type:vt,payload:{sourceId:e}}}function Ct(e){return{type:yt,payload:{targetId:e}}}function wt(e){return{type:bt,payload:{sourceId:e}}}function Tt(e){return{type:xt,payload:{targetId:e}}}function Et(e){E(typeof e.canDrag==`function`,`Expected canDrag to be a function.`),E(typeof e.beginDrag==`function`,`Expected beginDrag to be a function.`),E(typeof e.endDrag==`function`,`Expected endDrag to be a function.`)}function Dt(e){E(typeof e.canDrop==`function`,`Expected canDrop to be a function.`),E(typeof e.hover==`function`,`Expected hover to be a function.`),E(typeof e.drop==`function`,`Expected beginDrag to be a function.`)}function Ot(e,t){if(t&&Array.isArray(e)){e.forEach(e=>Ot(e,!1));return}E(typeof e==`string`||typeof e==`symbol`,t?`Type can only be a string, a symbol, or an array of either.`:`Type can only be a string or a symbol.`)}var k;(function(e){e.SOURCE=`SOURCE`,e.TARGET=`TARGET`})(k||={});var kt=0;function At(){return kt++}function jt(e){let t=At().toString();switch(e){case k.SOURCE:return`S${t}`;case k.TARGET:return`T${t}`;default:throw Error(`Unknown Handler Role: ${e}`)}}function Mt(e){switch(e[0]){case`S`:return k.SOURCE;case`T`:return k.TARGET;default:throw Error(`Cannot parse handler ID: ${e}`)}}function Nt(e,t){let n=e.entries(),r=!1;do{let{done:e,value:[,i]}=n.next();if(i===t)return!0;r=!!e}while(!r);return!1}var Pt=class{addSource(e,t){Ot(e),Et(t);let n=this.addHandler(k.SOURCE,e,t);return this.store.dispatch(St(n)),n}addTarget(e,t){Ot(e,!0),Dt(t);let n=this.addHandler(k.TARGET,e,t);return this.store.dispatch(Ct(n)),n}containsHandler(e){return Nt(this.dragSources,e)||Nt(this.dropTargets,e)}getSource(e,t=!1){return E(this.isSourceId(e),`Expected a valid source ID.`),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return E(this.isTargetId(e),`Expected a valid target ID.`),this.dropTargets.get(e)}getSourceType(e){return E(this.isSourceId(e),`Expected a valid source ID.`),this.types.get(e)}getTargetType(e){return E(this.isTargetId(e),`Expected a valid target ID.`),this.types.get(e)}isSourceId(e){return Mt(e)===k.SOURCE}isTargetId(e){return Mt(e)===k.TARGET}removeSource(e){E(this.getSource(e),`Expected an existing source.`),this.store.dispatch(wt(e)),_t(()=>{this.dragSources.delete(e),this.types.delete(e)})}removeTarget(e){E(this.getTarget(e),`Expected an existing target.`),this.store.dispatch(Tt(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){let t=this.getSource(e);E(t,`Expected an existing source.`),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){E(this.pinnedSource,`No source is pinned at the time.`),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,n){let r=jt(e);return this.types.set(r,t),e===k.SOURCE?this.dragSources.set(r,n):e===k.TARGET&&this.dropTargets.set(r,n),r}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}},Ft=(e,t)=>e===t;function It(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Lt(e,t,n=Ft){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!n(e[r],t[r]))return!1;return!0}function Rt(e=O,t){switch(t.type){case Ee:break;case vt:case yt:case xt:case bt:return O;case D:case Te:case Oe:case De:default:return it}let{targetIds:n=[],prevTargetIds:r=[]}=t.payload,i=Se(n,r);if(!(i.length>0||!Lt(n,r)))return O;let a=r[r.length-1],o=n[n.length-1];return a!==o&&(a&&i.push(a),o&&i.push(o)),i}function zt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){zt(e,t,n[t])})}return e}var Vt={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Ht(e=Vt,t){let{payload:n}=t;switch(t.type){case we:case D:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case Ee:return It(e.clientOffset,n.clientOffset)?e:Bt({},e,{clientOffset:n.clientOffset});case Oe:case De:return Vt;default:return e}}function Ut(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Ut(e,t,n[t])})}return e}var Wt={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Gt(e=Wt,t){let{payload:n}=t;switch(t.type){case D:return A({},e,{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case Te:return A({},e,{isSourcePublic:!0});case Ee:return A({},e,{targetIds:n.targetIds});case xt:return e.targetIds.indexOf(n.targetId)===-1?e:A({},e,{targetIds:be(e.targetIds,n.targetId)});case De:return A({},e,{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case Oe:return A({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Kt(e=0,t){switch(t.type){case vt:case yt:return e+1;case bt:case xt:return e-1;default:return e}}function qt(e=0){return e+1}function Jt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Jt(e,t,n[t])})}return e}function Xt(e={},t){return{dirtyHandlerIds:Rt(e.dirtyHandlerIds,{type:t.type,payload:Yt({},t.payload,{prevTargetIds:ye(e,`dragOperation.targetIds`,[])})}),dragOffset:Ht(e.dragOffset,t),refCount:Kt(e.refCount,t),dragOperation:Gt(e.dragOperation,t),stateId:qt(e.stateId)}}function Zt(e,t=void 0,n={},r=!1){let i=Qt(r),a=new $e(i,new ot(i,new Pt(i))),o=e(a,t,n);return a.receiveBackend(o),a}function Qt(e){let t=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__;return _e(Xt,e&&t&&t({name:`dnd-core`,instanceId:`dnd-core`}))}function $t(e,t){if(e==null)return{};var n=en(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function en(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var tn=0,j=Symbol.for(`__REACT_DND_CONTEXT_INSTANCE__`),nn=(0,C.memo)(function(e){var{children:t}=e;let[n,r]=rn($t(e,[`children`]));return(0,C.useEffect)(()=>{if(r){let e=on();return++tn,()=>{--tn===0&&(e[j]=null)}}},[]),(0,w.jsx)(fe.Provider,{value:n,children:t})});function rn(e){return`manager`in e?[{dragDropManager:e.manager},!1]:[an(e.backend,e.context,e.options,e.debugMode),!e.context]}function an(e,t=on(),n,r){let i=t;return i[j]||(i[j]={dragDropManager:Zt(e,t,n,r)}),i[j]}function on(){return typeof global<`u`?global:window}var sn=e(de(),1),M=typeof window<`u`?C.useLayoutEffect:C.useEffect;function cn(e,t,n){let[r,i]=(0,C.useState)(()=>t(e)),a=(0,C.useCallback)(()=>{let a=t(e);(0,sn.default)(r,a)||(i(a),n&&n())},[r,e,n]);return M(a),[r,a]}function ln(e,t,n){let[r,i]=cn(e,t,n);return M(function(){let t=e.getHandlerId();if(t!=null)return e.subscribeToStateChange(i,{handlerIds:[t]})},[e,i]),r}function un(e,t,n){return ln(t,e||(()=>({})),()=>n.reconnect())}function dn(e,t){let n=[...t||[]];return t==null&&typeof e!=`function`&&n.push(e),(0,C.useMemo)(()=>typeof e==`function`?e():e,n)}function fn(e){return(0,C.useMemo)(()=>e.hooks.dragSource(),[e])}function pn(e){return(0,C.useMemo)(()=>e.hooks.dragPreview(),[e])}var mn=!1,hn=!1,gn=class{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){E(!mn,`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 mn=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{mn=!1}}isDragging(){if(!this.sourceId)return!1;E(!hn,`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 hn=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{hn=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}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(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}},_n=!1,vn=class{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;E(!_n,`You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor`);try{return _n=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{_n=!1}}isOver(e){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,e):!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(e){this.targetId=null,this.internalMonitor=e.getMonitor()}};function yn(e,t,n){let r=n.getRegistry(),i=r.addTarget(e,t);return[i,()=>r.removeTarget(i)]}function bn(e,t,n){let r=n.getRegistry(),i=r.addSource(e,t);return[i,()=>r.removeSource(i)]}function xn(e,t,n,r){let i=n?n.call(r,e,t):void 0;if(i!==void 0)return!!i;if(e===t)return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;let s=Object.prototype.hasOwnProperty.bind(t);for(let o=0;o<a.length;o++){let c=a[o];if(!s(c))return!1;let l=e[c],u=t[c];if(i=n?n.call(r,l,u,c):void 0,i===!1||i===void 0&&l!==u)return!1}return!0}function Sn(e){return typeof e==`object`&&!!e&&Object.prototype.hasOwnProperty.call(e,`current`)}function Cn(e){if(typeof e.type==`string`)return;let t=e.type.displayName||e.type.name||`the component`;throw Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}function wn(e){return(t=null,n=null)=>{if(!(0,C.isValidElement)(t)){let r=t;return e(r,n),r}let r=t;return Cn(r),Dn(r,n?t=>e(t,n):e)}}function Tn(e){let t={};return Object.keys(e).forEach(n=>{let r=e[n];if(n.endsWith(`Ref`))t[n]=e[n];else{let e=wn(r);t[n]=()=>e}}),t}function En(e,t){typeof e==`function`?e(t):e.current=t}function Dn(e,t){let n=e.ref;return E(typeof n!=`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 <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs`),n?(0,C.cloneElement)(e,{ref:e=>{En(n,e),En(t,e)}}):(0,C.cloneElement)(e,{ref:t})}var On=class{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){let e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){let e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){let t=this.dragPreview,n=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(n&&this.disconnectDragPreview(),this.handlerId){if(!t){this.lastConnectedDragPreview=t;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!xn(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!xn(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){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(e){this.hooks=Tn({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,Sn(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,Sn(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,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=e}},kn=class{get connectTarget(){return this.dropTarget}reconnect(){let e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();let t=this.dropTarget;if(this.handlerId){if(!t){this.lastConnectedDropTarget=t;return}e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions))}}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!xn(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&=(this.unsubscribeDropTarget(),void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=Tn({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,Sn(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}};function N(){let{dragDropManager:e}=(0,C.useContext)(fe);return E(e!=null,`Expected drag drop context`),e}function An(e,t){let n=N(),r=(0,C.useMemo)(()=>new On(n.getBackend()),[n]);return M(()=>(r.dragSourceOptions=e||null,r.reconnect(),()=>r.disconnectDragSource()),[r,e]),M(()=>(r.dragPreviewOptions=t||null,r.reconnect(),()=>r.disconnectDragPreview()),[r,t]),r}function jn(){let e=N();return(0,C.useMemo)(()=>new gn(e),[e])}var Mn=class{beginDrag(){let e=this.spec,t=this.monitor,n=null;return n=typeof e.item==`object`?e.item:typeof e.item==`function`?e.item(t):{},n??null}canDrag(){let e=this.spec,t=this.monitor;return typeof e.canDrag==`boolean`?e.canDrag:typeof e.canDrag!=`function`||e.canDrag(t)}isDragging(e,t){let n=this.spec,r=this.monitor,{isDragging:i}=n;return i?i(r):t===e.getSourceId()}endDrag(){let e=this.spec,t=this.monitor,n=this.connector,{end:r}=e;r&&r(t.getItem(),t),n.reconnect()}constructor(e,t,n){this.spec=e,this.monitor=t,this.connector=n}};function Nn(e,t,n){let r=(0,C.useMemo)(()=>new Mn(e,t,n),[t,n]);return(0,C.useEffect)(()=>{r.spec=e},[e]),r}function Pn(e){return(0,C.useMemo)(()=>{let t=e.type;return E(t!=null,`spec.type must be defined`),t},[e])}function Fn(e,t,n){let r=N(),i=Nn(e,t,n),a=Pn(e);M(function(){if(a!=null){let[e,o]=bn(a,i,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),o}},[r,t,n,i,a])}function In(e,t){let n=dn(e,t);E(!n.begin,`useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)`);let r=jn(),i=An(n.options,n.previewOptions);return Fn(n,r,i),[un(n.collect,r,i),fn(i),pn(i)]}function Ln(e){let t=N().getMonitor(),[n,r]=cn(t,e);return(0,C.useEffect)(()=>t.subscribeToOffsetChange(r)),(0,C.useEffect)(()=>t.subscribeToStateChange(r)),n}function Rn(e){return(0,C.useMemo)(()=>e.hooks.dropTarget(),[e])}function zn(e){let t=N(),n=(0,C.useMemo)(()=>new kn(t.getBackend()),[t]);return M(()=>(n.dropTargetOptions=e||null,n.reconnect(),()=>n.disconnectDropTarget()),[e]),n}function Bn(){let e=N();return(0,C.useMemo)(()=>new vn(e),[e])}function Vn(e){let{accept:t}=e;return(0,C.useMemo)(()=>(E(e.accept!=null,`accept must be defined`),Array.isArray(t)?t:[t]),[t])}var Hn=class{canDrop(){let e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){let e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){let e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}};function Un(e,t){let n=(0,C.useMemo)(()=>new Hn(e,t),[t]);return(0,C.useEffect)(()=>{n.spec=e},[e]),n}function Wn(e,t,n){let r=N(),i=Un(e,t),a=Vn(e);M(function(){let[e,o]=yn(a,i,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),o},[r,t,i,n,a.map(e=>e.toString()).join(`|`)])}function Gn(e,t){let n=dn(e,t),r=Bn(),i=zn(n.options);return Wn(n,r,i),[un(n.collect,r,i),Rn(i)]}function Kn(e){let t=null;return()=>(t??=e(),t)}function qn(e,t){return e.filter(e=>e!==t)}function Jn(e,t){let n=new Set,r=e=>n.add(e);e.forEach(r),t.forEach(r);let i=[];return n.forEach(e=>i.push(e)),i}var Yn=class{enter(e){let t=this.entered.length,n=t=>this.isNodeInDocument(t)&&(!t.contains||t.contains(e));return this.entered=Jn(this.entered.filter(n),[e]),t===0&&this.entered.length>0}leave(e){let t=this.entered.length;return this.entered=qn(this.entered.filter(this.isNodeInDocument),e),t>0&&this.entered.length===0}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}},Xn=class{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null}})})}loadDataTransfer(e){if(e){let t={};Object.keys(this.config.exposeProperties).forEach(n=>{let r=this.config.exposeProperties[n];r!=null&&(t[n]={value:r(e,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,t)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,t){return t===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}},Zn=t({FILE:()=>Qn,HTML:()=>tr,TEXT:()=>er,URL:()=>$n}),Qn=`__NATIVE_FILE__`,$n=`__NATIVE_URL__`,er=`__NATIVE_TEXT__`,tr=`__NATIVE_HTML__`;function nr(e,t,n){return t.reduce((t,n)=>t||e.getData(n),``)??n}var rr={[Qn]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:[`Files`]},[tr]:{exposeProperties:{html:(e,t)=>nr(e,t,``),dataTransfer:e=>e},matchesTypes:[`Html`,`text/html`]},[$n]:{exposeProperties:{urls:(e,t)=>nr(e,t,``).split(`
|
|
1
|
+
import{a as e,r as t,t as n}from"./rolldown-runtime-B0Z9INg1.js";import{t as r}from"./useEvent-xfs0Sn4r.js";import{t as i}from"./react-CBDbhulC.js";import{t as a}from"./compiler-runtime-CYIjoINj.js";import{_ as o}from"./useEventListener-D27Dii_l.js";import{t as s}from"./jsx-runtime-B74pBk57.js";import{o as c}from"./alert-dialog-BVi_GyOB.js";import{a as l}from"./tabs-c6mpccpH.js";import{a as u,p as d,r as f,t as p}from"./dropdown-menu-CqNabM1f.js";import{r as m}from"./requests-C6_IaFh7.js";import{t as h}from"./createLucideIcon-B7HeEoG2.js";import{n as g,t as _}from"./tree-actions-DIfWonCA.js";import{t as v}from"./copy-BMXKNElG.js";import{b as ee}from"./write-secret-modal-lNU_7c2x.js";import{t as y}from"./trash-2-D_HX-0qx.js";import{t as b}from"./use-toast-DpWHUGuF.js";import{t as x}from"./paths-zcL04qUW.js";import{a as te}from"./errors-DzO-nXy-.js";import{t as ne}from"./extends-CvVTau-c.js";import{i as re,n as ie,r as S}from"./pathUtils-Cryrlpma.js";import{n as ae}from"./semaphore-BjoL5P0h.js";var oe=h(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),C=e(i(),1),w=s(),se=l();function ce(e,t){return ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ce(e,t)}function le(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ce(e,t)}function ue(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}var de=n(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),fe=(0,C.createContext)({dragDropManager:void 0});function T(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 pe=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})(),me=function(){return Math.random().toString(36).substring(7).split(``).join(`.`)},he={INIT:`@@redux/INIT`+me(),REPLACE:`@@redux/REPLACE`+me(),PROBE_UNKNOWN_ACTION:function(){return`@@redux/PROBE_UNKNOWN_ACTION`+me()}};function ge(e){if(typeof e!=`object`||!e)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function _e(e,t,n){var r;if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(T(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(T(1));return n(_e)(e,t)}if(typeof e!=`function`)throw Error(T(2));var i=e,a=t,o=[],s=o,c=!1;function l(){s===o&&(s=o.slice())}function u(){if(c)throw Error(T(3));return a}function d(e){if(typeof e!=`function`)throw Error(T(4));if(c)throw Error(T(5));var t=!0;return l(),s.push(e),function(){if(t){if(c)throw Error(T(6));t=!1,l();var n=s.indexOf(e);s.splice(n,1),o=null}}}function f(e){if(!ge(e))throw Error(T(7));if(e.type===void 0)throw Error(T(8));if(c)throw Error(T(9));try{c=!0,a=i(a,e)}finally{c=!1}for(var t=o=s,n=0;n<t.length;n++){var r=t[n];r()}return e}function p(e){if(typeof e!=`function`)throw Error(T(10));i=e,f({type:he.REPLACE})}function m(){var e,t=d;return e={subscribe:function(e){if(typeof e!=`object`||!e)throw Error(T(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}},e[pe]=function(){return this},e}return f({type:he.INIT}),r={dispatch:f,subscribe:d,getState:u,replaceReducer:p},r[pe]=m,r}function E(e,t,...n){if(ve()&&t===void 0)throw Error(`invariant requires an error message argument`);if(!e){let e;if(t===void 0)e=Error(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{let r=0;e=Error(t.replace(/%s/g,function(){return n[r++]})),e.name=`Invariant Violation`}throw e.framesToPop=1,e}}function ve(){return typeof process<`u`&&!0}function ye(e,t,n){return t.split(`.`).reduce((e,t)=>e&&e[t]?e[t]:n||null,e)}function be(e,t){return e.filter(e=>e!==t)}function xe(e){return typeof e==`object`}function Se(e,t){let n=new Map,r=e=>{n.set(e,n.has(e)?n.get(e)+1:1)};e.forEach(r),t.forEach(r);let i=[];return n.forEach((e,t)=>{e===1&&i.push(t)}),i}function Ce(e,t){return e.filter(e=>t.indexOf(e)>-1)}var we=`dnd-core/INIT_COORDS`,D=`dnd-core/BEGIN_DRAG`,Te=`dnd-core/PUBLISH_DRAG_SOURCE`,Ee=`dnd-core/HOVER`,De=`dnd-core/DROP`,Oe=`dnd-core/END_DRAG`;function ke(e,t){return{type:we,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}var Ae={type:we,payload:{clientOffset:null,sourceClientOffset:null}};function je(e){return function(t=[],n={publishSource:!0}){let{publishSource:r=!0,clientOffset:i,getSourceClientOffset:a}=n,o=e.getMonitor(),s=e.getRegistry();e.dispatch(ke(i)),Me(t,o,s);let c=Fe(t,o);if(c==null){e.dispatch(Ae);return}let l=null;if(i){if(!a)throw Error(`getSourceClientOffset must be defined`);Ne(a),l=a(c)}e.dispatch(ke(i,l));let u=s.getSource(c).beginDrag(o,c);return u==null?void 0:(Pe(u),s.pinSource(c),{type:D,payload:{itemType:s.getSourceType(c),item:u,sourceId:c,clientOffset:i||null,sourceClientOffset:l||null,isSourcePublic:!!r}})}}function Me(e,t,n){E(!t.isDragging(),`Cannot call beginDrag while dragging.`),e.forEach(function(e){E(n.getSource(e),`Expected sourceIds to be registered.`)})}function Ne(e){E(typeof e==`function`,`When clientOffset is provided, getSourceClientOffset must be a function.`)}function Pe(e){E(xe(e),`Item must be an object.`)}function Fe(e,t){let n=null;for(let r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}function Ie(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Le(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Ie(e,t,n[t])})}return e}function Re(e){return function(t={}){let n=e.getMonitor(),r=e.getRegistry();ze(n),He(n).forEach((i,a)=>{let o={type:De,payload:{dropResult:Le({},t,Be(i,a,r,n))}};e.dispatch(o)})}}function ze(e){E(e.isDragging(),`Cannot call drop while not dragging.`),E(!e.didDrop(),`Cannot call drop twice during one drag operation.`)}function Be(e,t,n,r){let i=n.getTarget(e),a=i?i.drop(r,e):void 0;return Ve(a),a===void 0&&(a=t===0?{}:r.getDropResult()),a}function Ve(e){E(e===void 0||xe(e),`Drop result must either be an object or undefined.`)}function He(e){let t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Ue(e){return function(){let t=e.getMonitor(),n=e.getRegistry();We(t);let r=t.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource()),{type:Oe}}}function We(e){E(e.isDragging(),`Cannot call endDrag while not dragging.`)}function Ge(e,t){return t===null?e===null:Array.isArray(e)?e.some(e=>e===t):e===t}function Ke(e){return function(t,{clientOffset:n}={}){qe(t);let r=t.slice(0),i=e.getMonitor(),a=e.getRegistry();return Ye(r,a,i.getItemType()),Je(r,i,a),Xe(r,i,a),{type:Ee,payload:{targetIds:r,clientOffset:n||null}}}}function qe(e){E(Array.isArray(e),`Expected targetIds to be an array.`)}function Je(e,t,n){E(t.isDragging(),`Cannot call hover while not dragging.`),E(!t.didDrop(),`Cannot call hover after drop.`);for(let t=0;t<e.length;t++){let r=e[t];E(e.lastIndexOf(r)===t,`Expected targetIds to be unique in the passed array.`),E(n.getTarget(r),`Expected targetIds to be registered.`)}}function Ye(e,t,n){for(let r=e.length-1;r>=0;r--){let i=e[r];Ge(t.getTargetType(i),n)||e.splice(r,1)}}function Xe(e,t,n){e.forEach(function(e){n.getTarget(e).hover(t,e)})}function Ze(e){return function(){if(e.getMonitor().isDragging())return{type:Te}}}function Qe(e){return{beginDrag:je(e),publishDragSource:Ze(e),hover:Ke(e),drop:Re(e),endDrag:Ue(e)}}var $e=class{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){let e=this,{dispatch:t}=this.store;function n(n){return(...r)=>{let i=n.apply(e,r);i!==void 0&&t(i)}}let r=Qe(this);return Object.keys(r).reduce((e,t)=>{let i=r[t];return e[t]=n(i),e},{})}dispatch(e){this.store.dispatch(e)}constructor(e,t){this.isSetUp=!1,this.handleRefCountChange=()=>{let e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}};function et(e,t){return{x:e.x+t.x,y:e.y+t.y}}function tt(e,t){return{x:e.x-t.x,y:e.y-t.y}}function nt(e){let{clientOffset:t,initialClientOffset:n,initialSourceClientOffset:r}=e;return!t||!n||!r?null:tt(et(t,r),n)}function rt(e){let{clientOffset:t,initialClientOffset:n}=e;return!t||!n?null:tt(t,n)}var O=[],it=[];O.__IS_NONE__=!0,it.__IS_ALL__=!0;function at(e,t){return e===O?!1:e===it||t===void 0||Ce(t,e).length>0}var ot=class{subscribeToStateChange(e,t={}){let{handlerIds:n}=t;E(typeof e==`function`,`listener must be a function.`),E(n===void 0||Array.isArray(n),`handlerIds, when specified, must be an array of strings.`);let r=this.store.getState().stateId;return this.store.subscribe(()=>{let t=this.store.getState(),i=t.stateId;try{i===r||i===r+1&&!at(t.dirtyHandlerIds,n)||e()}finally{r=i}})}subscribeToOffsetChange(e){E(typeof e==`function`,`listener must be a function.`);let t=this.store.getState().dragOffset;return this.store.subscribe(()=>{let n=this.store.getState().dragOffset;n!==t&&(t=n,e())})}canDragSource(e){if(!e)return!1;let t=this.registry.getSource(e);return E(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()&&t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;let t=this.registry.getTarget(e);return E(t,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop()?!1:Ge(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e)}isDragging(){return!!this.getItemType()}isDraggingSource(e){if(!e)return!1;let t=this.registry.getSource(e,!0);return E(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic()||this.registry.getSourceType(e)!==this.getItemType()?!1:t.isDragging(this,e)}isOverTarget(e,t={shallow:!1}){if(!e)return!1;let{shallow:n}=t;if(!this.isDragging())return!1;let r=this.registry.getTargetType(e),i=this.getItemType();if(i&&!Ge(r,i))return!1;let a=this.getTargetIds();if(!a.length)return!1;let o=a.indexOf(e);return n?o===a.length-1:o>-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 nt(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return rt(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}},st=typeof global<`u`?global:self,ct=st.MutationObserver||st.WebKitMutationObserver;function lt(e){return function(){let t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}function ut(e){let t=1,n=new ct(e),r=document.createTextNode(``);return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}var dt=typeof ct==`function`?ut:lt,ft=class{enqueueTask(e){let{queue:t,requestFlush:n}=this;t.length||(n(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{let{queue:e}=this;for(;this.index<e.length;){let t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,n=e.length-this.index;t<n;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=dt(this.flush),this.requestErrorThrow=lt(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},pt=class{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}},mt=class{create(e){let t=this.freeTasks,n=t.length?t.pop():new pt(this.onError,e=>t[t.length]=e);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}},ht=new ft,gt=new mt(ht.registerPendingError);function _t(e){ht.enqueueTask(gt.create(e))}var vt=`dnd-core/ADD_SOURCE`,yt=`dnd-core/ADD_TARGET`,bt=`dnd-core/REMOVE_SOURCE`,xt=`dnd-core/REMOVE_TARGET`;function St(e){return{type:vt,payload:{sourceId:e}}}function Ct(e){return{type:yt,payload:{targetId:e}}}function wt(e){return{type:bt,payload:{sourceId:e}}}function Tt(e){return{type:xt,payload:{targetId:e}}}function Et(e){E(typeof e.canDrag==`function`,`Expected canDrag to be a function.`),E(typeof e.beginDrag==`function`,`Expected beginDrag to be a function.`),E(typeof e.endDrag==`function`,`Expected endDrag to be a function.`)}function Dt(e){E(typeof e.canDrop==`function`,`Expected canDrop to be a function.`),E(typeof e.hover==`function`,`Expected hover to be a function.`),E(typeof e.drop==`function`,`Expected beginDrag to be a function.`)}function Ot(e,t){if(t&&Array.isArray(e)){e.forEach(e=>Ot(e,!1));return}E(typeof e==`string`||typeof e==`symbol`,t?`Type can only be a string, a symbol, or an array of either.`:`Type can only be a string or a symbol.`)}var k;(function(e){e.SOURCE=`SOURCE`,e.TARGET=`TARGET`})(k||={});var kt=0;function At(){return kt++}function jt(e){let t=At().toString();switch(e){case k.SOURCE:return`S${t}`;case k.TARGET:return`T${t}`;default:throw Error(`Unknown Handler Role: ${e}`)}}function Mt(e){switch(e[0]){case`S`:return k.SOURCE;case`T`:return k.TARGET;default:throw Error(`Cannot parse handler ID: ${e}`)}}function Nt(e,t){let n=e.entries(),r=!1;do{let{done:e,value:[,i]}=n.next();if(i===t)return!0;r=!!e}while(!r);return!1}var Pt=class{addSource(e,t){Ot(e),Et(t);let n=this.addHandler(k.SOURCE,e,t);return this.store.dispatch(St(n)),n}addTarget(e,t){Ot(e,!0),Dt(t);let n=this.addHandler(k.TARGET,e,t);return this.store.dispatch(Ct(n)),n}containsHandler(e){return Nt(this.dragSources,e)||Nt(this.dropTargets,e)}getSource(e,t=!1){return E(this.isSourceId(e),`Expected a valid source ID.`),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return E(this.isTargetId(e),`Expected a valid target ID.`),this.dropTargets.get(e)}getSourceType(e){return E(this.isSourceId(e),`Expected a valid source ID.`),this.types.get(e)}getTargetType(e){return E(this.isTargetId(e),`Expected a valid target ID.`),this.types.get(e)}isSourceId(e){return Mt(e)===k.SOURCE}isTargetId(e){return Mt(e)===k.TARGET}removeSource(e){E(this.getSource(e),`Expected an existing source.`),this.store.dispatch(wt(e)),_t(()=>{this.dragSources.delete(e),this.types.delete(e)})}removeTarget(e){E(this.getTarget(e),`Expected an existing target.`),this.store.dispatch(Tt(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){let t=this.getSource(e);E(t,`Expected an existing source.`),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){E(this.pinnedSource,`No source is pinned at the time.`),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,n){let r=jt(e);return this.types.set(r,t),e===k.SOURCE?this.dragSources.set(r,n):e===k.TARGET&&this.dropTargets.set(r,n),r}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}},Ft=(e,t)=>e===t;function It(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Lt(e,t,n=Ft){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!n(e[r],t[r]))return!1;return!0}function Rt(e=O,t){switch(t.type){case Ee:break;case vt:case yt:case xt:case bt:return O;case D:case Te:case Oe:case De:default:return it}let{targetIds:n=[],prevTargetIds:r=[]}=t.payload,i=Se(n,r);if(!(i.length>0||!Lt(n,r)))return O;let a=r[r.length-1],o=n[n.length-1];return a!==o&&(a&&i.push(a),o&&i.push(o)),i}function zt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){zt(e,t,n[t])})}return e}var Vt={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Ht(e=Vt,t){let{payload:n}=t;switch(t.type){case we:case D:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case Ee:return It(e.clientOffset,n.clientOffset)?e:Bt({},e,{clientOffset:n.clientOffset});case Oe:case De:return Vt;default:return e}}function Ut(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Ut(e,t,n[t])})}return e}var Wt={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Gt(e=Wt,t){let{payload:n}=t;switch(t.type){case D:return A({},e,{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case Te:return A({},e,{isSourcePublic:!0});case Ee:return A({},e,{targetIds:n.targetIds});case xt:return e.targetIds.indexOf(n.targetId)===-1?e:A({},e,{targetIds:be(e.targetIds,n.targetId)});case De:return A({},e,{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case Oe:return A({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Kt(e=0,t){switch(t.type){case vt:case yt:return e+1;case bt:case xt:return e-1;default:return e}}function qt(e=0){return e+1}function Jt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Jt(e,t,n[t])})}return e}function Xt(e={},t){return{dirtyHandlerIds:Rt(e.dirtyHandlerIds,{type:t.type,payload:Yt({},t.payload,{prevTargetIds:ye(e,`dragOperation.targetIds`,[])})}),dragOffset:Ht(e.dragOffset,t),refCount:Kt(e.refCount,t),dragOperation:Gt(e.dragOperation,t),stateId:qt(e.stateId)}}function Zt(e,t=void 0,n={},r=!1){let i=Qt(r),a=new $e(i,new ot(i,new Pt(i))),o=e(a,t,n);return a.receiveBackend(o),a}function Qt(e){let t=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__;return _e(Xt,e&&t&&t({name:`dnd-core`,instanceId:`dnd-core`}))}function $t(e,t){if(e==null)return{};var n=en(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function en(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var tn=0,j=Symbol.for(`__REACT_DND_CONTEXT_INSTANCE__`),nn=(0,C.memo)(function(e){var{children:t}=e;let[n,r]=rn($t(e,[`children`]));return(0,C.useEffect)(()=>{if(r){let e=on();return++tn,()=>{--tn===0&&(e[j]=null)}}},[]),(0,w.jsx)(fe.Provider,{value:n,children:t})});function rn(e){return`manager`in e?[{dragDropManager:e.manager},!1]:[an(e.backend,e.context,e.options,e.debugMode),!e.context]}function an(e,t=on(),n,r){let i=t;return i[j]||(i[j]={dragDropManager:Zt(e,t,n,r)}),i[j]}function on(){return typeof global<`u`?global:window}var sn=e(de(),1),M=typeof window<`u`?C.useLayoutEffect:C.useEffect;function cn(e,t,n){let[r,i]=(0,C.useState)(()=>t(e)),a=(0,C.useCallback)(()=>{let a=t(e);(0,sn.default)(r,a)||(i(a),n&&n())},[r,e,n]);return M(a),[r,a]}function ln(e,t,n){let[r,i]=cn(e,t,n);return M(function(){let t=e.getHandlerId();if(t!=null)return e.subscribeToStateChange(i,{handlerIds:[t]})},[e,i]),r}function un(e,t,n){return ln(t,e||(()=>({})),()=>n.reconnect())}function dn(e,t){let n=[...t||[]];return t==null&&typeof e!=`function`&&n.push(e),(0,C.useMemo)(()=>typeof e==`function`?e():e,n)}function fn(e){return(0,C.useMemo)(()=>e.hooks.dragSource(),[e])}function pn(e){return(0,C.useMemo)(()=>e.hooks.dragPreview(),[e])}var mn=!1,hn=!1,gn=class{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){E(!mn,`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 mn=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{mn=!1}}isDragging(){if(!this.sourceId)return!1;E(!hn,`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 hn=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{hn=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}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(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}},_n=!1,vn=class{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;E(!_n,`You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor`);try{return _n=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{_n=!1}}isOver(e){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,e):!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(e){this.targetId=null,this.internalMonitor=e.getMonitor()}};function yn(e,t,n){let r=n.getRegistry(),i=r.addTarget(e,t);return[i,()=>r.removeTarget(i)]}function bn(e,t,n){let r=n.getRegistry(),i=r.addSource(e,t);return[i,()=>r.removeSource(i)]}function xn(e,t,n,r){let i=n?n.call(r,e,t):void 0;if(i!==void 0)return!!i;if(e===t)return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;let s=Object.prototype.hasOwnProperty.bind(t);for(let o=0;o<a.length;o++){let c=a[o];if(!s(c))return!1;let l=e[c],u=t[c];if(i=n?n.call(r,l,u,c):void 0,i===!1||i===void 0&&l!==u)return!1}return!0}function Sn(e){return typeof e==`object`&&!!e&&Object.prototype.hasOwnProperty.call(e,`current`)}function Cn(e){if(typeof e.type==`string`)return;let t=e.type.displayName||e.type.name||`the component`;throw Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}function wn(e){return(t=null,n=null)=>{if(!(0,C.isValidElement)(t)){let r=t;return e(r,n),r}let r=t;return Cn(r),Dn(r,n?t=>e(t,n):e)}}function Tn(e){let t={};return Object.keys(e).forEach(n=>{let r=e[n];if(n.endsWith(`Ref`))t[n]=e[n];else{let e=wn(r);t[n]=()=>e}}),t}function En(e,t){typeof e==`function`?e(t):e.current=t}function Dn(e,t){let n=e.ref;return E(typeof n!=`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 <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs`),n?(0,C.cloneElement)(e,{ref:e=>{En(n,e),En(t,e)}}):(0,C.cloneElement)(e,{ref:t})}var On=class{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){let e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){let e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){let t=this.dragPreview,n=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(n&&this.disconnectDragPreview(),this.handlerId){if(!t){this.lastConnectedDragPreview=t;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!xn(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!xn(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){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(e){this.hooks=Tn({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,Sn(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,Sn(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,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=e}},kn=class{get connectTarget(){return this.dropTarget}reconnect(){let e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();let t=this.dropTarget;if(this.handlerId){if(!t){this.lastConnectedDropTarget=t;return}e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions))}}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!xn(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&=(this.unsubscribeDropTarget(),void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=Tn({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,Sn(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}};function N(){let{dragDropManager:e}=(0,C.useContext)(fe);return E(e!=null,`Expected drag drop context`),e}function An(e,t){let n=N(),r=(0,C.useMemo)(()=>new On(n.getBackend()),[n]);return M(()=>(r.dragSourceOptions=e||null,r.reconnect(),()=>r.disconnectDragSource()),[r,e]),M(()=>(r.dragPreviewOptions=t||null,r.reconnect(),()=>r.disconnectDragPreview()),[r,t]),r}function jn(){let e=N();return(0,C.useMemo)(()=>new gn(e),[e])}var Mn=class{beginDrag(){let e=this.spec,t=this.monitor,n=null;return n=typeof e.item==`object`?e.item:typeof e.item==`function`?e.item(t):{},n??null}canDrag(){let e=this.spec,t=this.monitor;return typeof e.canDrag==`boolean`?e.canDrag:typeof e.canDrag!=`function`||e.canDrag(t)}isDragging(e,t){let n=this.spec,r=this.monitor,{isDragging:i}=n;return i?i(r):t===e.getSourceId()}endDrag(){let e=this.spec,t=this.monitor,n=this.connector,{end:r}=e;r&&r(t.getItem(),t),n.reconnect()}constructor(e,t,n){this.spec=e,this.monitor=t,this.connector=n}};function Nn(e,t,n){let r=(0,C.useMemo)(()=>new Mn(e,t,n),[t,n]);return(0,C.useEffect)(()=>{r.spec=e},[e]),r}function Pn(e){return(0,C.useMemo)(()=>{let t=e.type;return E(t!=null,`spec.type must be defined`),t},[e])}function Fn(e,t,n){let r=N(),i=Nn(e,t,n),a=Pn(e);M(function(){if(a!=null){let[e,o]=bn(a,i,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),o}},[r,t,n,i,a])}function In(e,t){let n=dn(e,t);E(!n.begin,`useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)`);let r=jn(),i=An(n.options,n.previewOptions);return Fn(n,r,i),[un(n.collect,r,i),fn(i),pn(i)]}function Ln(e){let t=N().getMonitor(),[n,r]=cn(t,e);return(0,C.useEffect)(()=>t.subscribeToOffsetChange(r)),(0,C.useEffect)(()=>t.subscribeToStateChange(r)),n}function Rn(e){return(0,C.useMemo)(()=>e.hooks.dropTarget(),[e])}function zn(e){let t=N(),n=(0,C.useMemo)(()=>new kn(t.getBackend()),[t]);return M(()=>(n.dropTargetOptions=e||null,n.reconnect(),()=>n.disconnectDropTarget()),[e]),n}function Bn(){let e=N();return(0,C.useMemo)(()=>new vn(e),[e])}function Vn(e){let{accept:t}=e;return(0,C.useMemo)(()=>(E(e.accept!=null,`accept must be defined`),Array.isArray(t)?t:[t]),[t])}var Hn=class{canDrop(){let e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){let e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){let e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}};function Un(e,t){let n=(0,C.useMemo)(()=>new Hn(e,t),[t]);return(0,C.useEffect)(()=>{n.spec=e},[e]),n}function Wn(e,t,n){let r=N(),i=Un(e,t),a=Vn(e);M(function(){let[e,o]=yn(a,i,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),o},[r,t,i,n,a.map(e=>e.toString()).join(`|`)])}function Gn(e,t){let n=dn(e,t),r=Bn(),i=zn(n.options);return Wn(n,r,i),[un(n.collect,r,i),Rn(i)]}function Kn(e){let t=null;return()=>(t??=e(),t)}function qn(e,t){return e.filter(e=>e!==t)}function Jn(e,t){let n=new Set,r=e=>n.add(e);e.forEach(r),t.forEach(r);let i=[];return n.forEach(e=>i.push(e)),i}var Yn=class{enter(e){let t=this.entered.length,n=t=>this.isNodeInDocument(t)&&(!t.contains||t.contains(e));return this.entered=Jn(this.entered.filter(n),[e]),t===0&&this.entered.length>0}leave(e){let t=this.entered.length;return this.entered=qn(this.entered.filter(this.isNodeInDocument),e),t>0&&this.entered.length===0}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}},Xn=class{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null}})})}loadDataTransfer(e){if(e){let t={};Object.keys(this.config.exposeProperties).forEach(n=>{let r=this.config.exposeProperties[n];r!=null&&(t[n]={value:r(e,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,t)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,t){return t===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}},Zn=t({FILE:()=>Qn,HTML:()=>tr,TEXT:()=>er,URL:()=>$n}),Qn=`__NATIVE_FILE__`,$n=`__NATIVE_URL__`,er=`__NATIVE_TEXT__`,tr=`__NATIVE_HTML__`;function nr(e,t,n){return t.reduce((t,n)=>t||e.getData(n),``)??n}var rr={[Qn]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:[`Files`]},[tr]:{exposeProperties:{html:(e,t)=>nr(e,t,``),dataTransfer:e=>e},matchesTypes:[`Html`,`text/html`]},[$n]:{exposeProperties:{urls:(e,t)=>nr(e,t,``).split(`
|
|
2
2
|
`),dataTransfer:e=>e},matchesTypes:[`Url`,`text/uri-list`]},[er]:{exposeProperties:{text:(e,t)=>nr(e,t,``),dataTransfer:e=>e},matchesTypes:[`Text`,`text/plain`]}};function ir(e,t){let n=rr[e];if(!n)throw Error(`native type ${e} has no configuration`);let r=new Xn(n);return r.loadDataTransfer(t),r}function ar(e){if(!e)return null;let t=Array.prototype.slice.call(e.types||[]);return Object.keys(rr).filter(e=>{let n=rr[e];return n?.matchesTypes?n.matchesTypes.some(e=>t.indexOf(e)>-1):!1})[0]||null}var or=Kn(()=>/firefox/i.test(navigator.userAgent)),sr=Kn(()=>!!window.safari),cr=class{interpolate(e){let{xs:t,ys:n,c1s:r,c2s:i,c3s:a}=this,o=t.length-1;if(e===t[o])return n[o];let s=0,c=a.length-1,l;for(;s<=c;){l=Math.floor(.5*(s+c));let r=t[l];if(r<e)s=l+1;else if(r>e)c=l-1;else return n[l]}o=Math.max(0,c);let u=e-t[o],d=u*u;return n[o]+r[o]*u+i[o]*d+a[o]*u*d}constructor(e,t){let{length:n}=e,r=[];for(let e=0;e<n;e++)r.push(e);r.sort((t,n)=>e[t]<e[n]?-1:1);let i=[],a=[],o=[],s,c;for(let r=0;r<n-1;r++)s=e[r+1]-e[r],c=t[r+1]-t[r],a.push(s),i.push(c),o.push(c/s);let l=[o[0]];for(let e=0;e<a.length-1;e++){let t=o[e],n=o[e+1];if(t*n<=0)l.push(0);else{s=a[e];let r=a[e+1],i=s+r;l.push(3*i/((i+r)/t+(i+s)/n))}}l.push(o[o.length-1]);let u=[],d=[],f;for(let e=0;e<l.length-1;e++){f=o[e];let t=l[e],n=1/a[e],r=t+l[e+1]-f-f;u.push((f-t-r)*n),d.push(r*n*n)}this.xs=e,this.ys=t,this.c1s=l,this.c2s=u,this.c3s=d}},lr=1;function ur(e){let t=e.nodeType===lr?e:e.parentElement;if(!t)return null;let{top:n,left:r}=t.getBoundingClientRect();return{x:r,y:n}}function P(e){return{x:e.clientX,y:e.clientY}}function dr(e){return e.nodeName===`IMG`&&(or()||!document.documentElement?.contains(e))}function fr(e,t,n,r){let i=e?t.width:n,a=e?t.height:r;return sr()&&e&&(a/=window.devicePixelRatio,i/=window.devicePixelRatio),{dragPreviewWidth:i,dragPreviewHeight:a}}function pr(e,t,n,r,i){let a=dr(t),o=ur(a?e:t),s={x:n.x-o.x,y:n.y-o.y},{offsetWidth:c,offsetHeight:l}=e,{anchorX:u,anchorY:d}=r,{dragPreviewWidth:f,dragPreviewHeight:p}=fr(a,t,c,l),m=()=>{let e=new cr([0,.5,1],[s.y,s.y/l*p,s.y+p-l]).interpolate(d);return sr()&&a&&(e+=(window.devicePixelRatio-1)*p),e},h=()=>new cr([0,.5,1],[s.x,s.x/c*f,s.x+f-c]).interpolate(u),{offsetX:g,offsetY:_}=i,v=g===0||g,ee=_===0||_;return{x:v?g:h(),y:ee?_:m()}}var mr=class{get window(){if(this.globalContext)return this.globalContext;if(typeof window<`u`)return window}get document(){if(this.globalContext?.document)return this.globalContext.document;if(this.window)return this.window.document}get rootElement(){return this.optionsArgs?.rootElement||this.window}constructor(e,t){this.ownerDocument=null,this.globalContext=e,this.optionsArgs=t}};function hr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){hr(e,t,n[t])})}return e}var _r=class{profile(){return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:this.dragStartSourceIds?.length||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:this.dragOverTargetIds?.length||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){let e=this.rootElement;if(e!==void 0){if(e.__isReactDndBackendSetUp)throw Error(`Cannot have two HTML5 backends at the same time.`);e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}teardown(){let e=this.rootElement;if(e!==void 0&&(e.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var t;(t=this.window)==null||t.cancelAnimationFrame(this.asyncEndDragFrameId)}}connectDragPreview(e,t,n){return this.sourcePreviewNodeOptions.set(e,n),this.sourcePreviewNodes.set(e,t),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDragSource(e,t,n){this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,n);let r=t=>this.handleDragStart(t,e),i=e=>this.handleSelectStart(e);return t.setAttribute(`draggable`,`true`),t.addEventListener(`dragstart`,r),t.addEventListener(`selectstart`,i),()=>{this.sourceNodes.delete(e),this.sourceNodeOptions.delete(e),t.removeEventListener(`dragstart`,r),t.removeEventListener(`selectstart`,i),t.setAttribute(`draggable`,`false`)}}connectDropTarget(e,t){let n=t=>this.handleDragEnter(t,e),r=t=>this.handleDragOver(t,e),i=t=>this.handleDrop(t,e);return t.addEventListener(`dragenter`,n),t.addEventListener(`dragover`,r),t.addEventListener(`drop`,i),()=>{t.removeEventListener(`dragenter`,n),t.removeEventListener(`dragover`,r),t.removeEventListener(`drop`,i)}}addEventListeners(e){e.addEventListener&&(e.addEventListener(`dragstart`,this.handleTopDragStart),e.addEventListener(`dragstart`,this.handleTopDragStartCapture,!0),e.addEventListener(`dragend`,this.handleTopDragEndCapture,!0),e.addEventListener(`dragenter`,this.handleTopDragEnter),e.addEventListener(`dragenter`,this.handleTopDragEnterCapture,!0),e.addEventListener(`dragleave`,this.handleTopDragLeaveCapture,!0),e.addEventListener(`dragover`,this.handleTopDragOver),e.addEventListener(`dragover`,this.handleTopDragOverCapture,!0),e.addEventListener(`drop`,this.handleTopDrop),e.addEventListener(`drop`,this.handleTopDropCapture,!0))}removeEventListeners(e){e.removeEventListener&&(e.removeEventListener(`dragstart`,this.handleTopDragStart),e.removeEventListener(`dragstart`,this.handleTopDragStartCapture,!0),e.removeEventListener(`dragend`,this.handleTopDragEndCapture,!0),e.removeEventListener(`dragenter`,this.handleTopDragEnter),e.removeEventListener(`dragenter`,this.handleTopDragEnterCapture,!0),e.removeEventListener(`dragleave`,this.handleTopDragLeaveCapture,!0),e.removeEventListener(`dragover`,this.handleTopDragOver),e.removeEventListener(`dragover`,this.handleTopDragOverCapture,!0),e.removeEventListener(`drop`,this.handleTopDrop),e.removeEventListener(`drop`,this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){let e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return gr({dropEffect:this.altKeyPressed?`copy`:`move`},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?`copy`:this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){let e=this.monitor.getSourceId();return gr({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){let e=this.monitor.getItemType();return Object.keys(Zn).some(t=>Zn[t]===e)}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=ir(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(e){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(()=>this.rootElement?.addEventListener(`mousemove`,this.endDragIfSourceWasRemovedFromDOM,!0),1e3)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var e;(e=this.window)==null||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener(`mousemove`,this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(e,t){e.defaultPrevented||(this.dragStartSourceIds||=[],this.dragStartSourceIds.unshift(t))}handleDragEnter(e,t){this.dragEnterTargetIds.unshift(t)}handleDragOver(e,t){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}handleDrop(e,t){this.dropTargetIds.unshift(t)}constructor(e,t,n){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=e=>{let t=this.sourceNodes.get(e);return t&&ur(t)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=e=>!!(e&&this.document&&this.document.body&&this.document.body.contains(e)),this.endDragIfSourceWasRemovedFromDOM=()=>{let e=this.currentDragSourceNode;e==null||this.isNodeInDocument(e)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=e=>{this.hoverRafId===null&&typeof requestAnimationFrame<`u`&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(e||[],{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=e=>{if(e.defaultPrevented)return;let{dragStartSourceIds:t}=this;this.dragStartSourceIds=null;let n=P(e);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:n});let{dataTransfer:r}=e,i=ar(r);if(this.monitor.isDragging()){if(r&&typeof r.setDragImage==`function`){let e=this.monitor.getSourceId(),t=this.sourceNodes.get(e),i=this.sourcePreviewNodes.get(e)||t;if(i){let{anchorX:e,anchorY:a,offsetX:o,offsetY:s}=this.getCurrentSourcePreviewNodeOptions(),c=pr(t,i,n,{anchorX:e,anchorY:a},{offsetX:o,offsetY:s});r.setDragImage(i,c.x,c.y)}}try{r?.setData(`application/json`,{})}catch{}this.setCurrentDragSourceNode(e.target);let{captureDraggingState:t}=this.getCurrentSourcePreviewNodeOptions();t?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(i)this.beginDragNativeItem(i);else if(r&&!r.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute(`draggable`)))return;else e.preventDefault()},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=e=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var t;(t=this.currentNativeSource)==null||t.loadDataTransfer(e.dataTransfer)}if(!this.enterLeaveCounter.enter(e.target)||this.monitor.isDragging())return;let{dataTransfer:n}=e,r=ar(n);r&&this.beginDragNativeItem(r,n)},this.handleTopDragEnter=e=>{let{dragEnterTargetIds:t}=this;this.dragEnterTargetIds=[],this.monitor.isDragging()&&(this.altKeyPressed=e.altKey,t.length>0&&this.actions.hover(t,{clientOffset:P(e)}),t.some(e=>this.monitor.canDropOnTarget(e))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())))},this.handleTopDragOverCapture=e=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var t;(t=this.currentNativeSource)==null||t.loadDataTransfer(e.dataTransfer)}},this.handleTopDragOver=e=>{let{dragOverTargetIds:t}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`none`);return}this.altKeyPressed=e.altKey,this.lastClientOffset=P(e),this.scheduleHover(t),(t||[]).some(e=>this.monitor.canDropOnTarget(e))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`none`))},this.handleTopDragLeaveCapture=e=>{this.isDraggingNativeItem()&&e.preventDefault(),this.enterLeaveCounter.leave(e.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=e=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var t;e.preventDefault(),(t=this.currentNativeSource)==null||t.loadDataTransfer(e.dataTransfer)}else ar(e.dataTransfer)&&e.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{let{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:P(e)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=e=>{let t=e.target;typeof t.dragDrop==`function`&&(t.tagName===`INPUT`||t.tagName===`SELECT`||t.tagName===`TEXTAREA`||t.isContentEditable||(e.preventDefault(),t.dragDrop()))},this.options=new mr(t,n),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new Yn(this.isNodeInDocument)}},F;function vr(){return F||(F=new Image,F.src=`data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==`),F}var yr=function(e,t,n){return new _r(e,t,n)},br=(0,C.createContext)(null);function I(){let e=(0,C.useContext)(br);if(e===null)throw Error(`No Tree Api Provided`);return e}var xr=(0,C.createContext)(null);function Sr(){let e=(0,C.useContext)(xr);if(e===null)throw Error(`Provide a NodesContext`);return e}var Cr=(0,C.createContext)(null);function wr(){let e=(0,C.useContext)(Cr);if(e===null)throw Error(`Provide a DnDContext`);return e}var Tr=(0,C.createContext)(0);function Er(){(0,C.useContext)(Tr)}var Dr=t({access:()=>z,bound:()=>L,dfs:()=>Pr,focusNextElement:()=>Fr,focusPrevElement:()=>Ir,getInsertIndex:()=>Wr,getInsertParentId:()=>Gr,identify:()=>B,identifyNull:()=>Br,indexOf:()=>Mr,isClosed:()=>kr,isDescendant:()=>jr,isItem:()=>Or,isOpenWithEmptyChildren:()=>Ar,mergeRefs:()=>Vr,noop:()=>Nr,safeRun:()=>Hr,waitFor:()=>Ur,walk:()=>R});function L(e,t,n){return Math.max(Math.min(e,n),t)}function Or(e){return e&&e.isLeaf}function kr(e){return e&&e.isInternal&&!e.isOpen}function Ar(e){return e&&e.isOpen&&!e.children?.length}var jr=(e,t)=>{let n=e;for(;n;){if(n.id===t.id)return!0;n=n.parent}return!1},Mr=e=>{if(!e.parent)throw Error(`Node does not have a parent`);return e.parent.children.findIndex(t=>t.id===e.id)};function Nr(){}function Pr(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let n of e.children){let e=Pr(n,t);if(e)return e}return null}function R(e,t){if(t(e),e.children)for(let n of e.children)R(n,t)}function Fr(e){let t=zr(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=Lr(t,r);break}n?.focus()}function Ir(e){let t=zr(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=Rr(t,r);break}n?.focus()}function Lr(e,t){return t+1<e.length?e[t+1]:e[0]}function Rr(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function zr(e){return Array.from(document.querySelectorAll(`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)`)).filter(t=>t===e||!e.contains(t))}function z(e,t){return typeof t==`boolean`?t:typeof t==`string`?e[t]:t(e)}function Br(e){return e===null?null:B(e)}function B(e){return typeof e==`string`?e:e.id}function Vr(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}function Hr(e,...t){if(e)return e(...t)}function Ur(e){return new Promise((t,n)=>{let r=0;function i(){r+=1,r===100&&n(),e()?t():setTimeout(i,10)}i()})}function Wr(e){let t=e.focusedNode;return t?t.isOpen?0:t.parent?t.childIndex+1:0:e.root.children?.length??0}function Gr(e){let t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}var Kr={display:`flex`,alignItems:`center`,zIndex:1},qr={flex:1,height:`2px`,background:`#4B91E2`,borderRadius:`1px`},Jr={width:`4px`,height:`4px`,boxShadow:`0 0 0 3px #4B91E2`,borderRadius:`50%`},Yr=C.memo(function({top:e,left:t,indent:n}){let r={position:`absolute`,pointerEvents:`none`,top:e-2+`px`,left:t+`px`,right:n+`px`};return(0,w.jsxs)(`div`,{style:Object.assign(Object.assign({},Kr),r),children:[(0,w.jsx)(`div`,{style:Object.assign({},Jr)}),(0,w.jsx)(`div`,{style:Object.assign({},qr)})]})});function Xr({node:e,attrs:t,innerRef:n,children:r}){return(0,w.jsx)(`div`,Object.assign({},t,{ref:n,onFocus:e=>e.stopPropagation(),onClick:e.handleClick,children:r}))}function Zr(e){return(0,w.jsxs)(`div`,{ref:e.dragHandle,style:e.style,children:[(0,w.jsx)(`span`,{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?`🌳`:e.node.isOpen?`🗁`:`🗀`}),` `,e.node.isEditing?(0,w.jsx)($r,Object.assign({},e)):(0,w.jsx)(Qr,Object.assign({},e))]})}function Qr(e){return(0,w.jsx)(w.Fragment,{children:(0,w.jsx)(`span`,{children:e.node.data.name})})}function $r({node:e}){let t=(0,C.useRef)();return(0,C.useEffect)(()=>{var e,n;(e=t.current)==null||e.focus(),(n=t.current)==null||n.select()},[]),(0,w.jsx)(`input`,{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:n=>{n.key===`Escape`&&e.reset(),n.key===`Enter`&&e.submit(t.current?.value||``)}})}function ei(e){return{type:`EDIT`,id:e}}function ti(e={id:null},t){return t.type===`EDIT`?Object.assign(Object.assign({},e),{id:t.id}):e}function V(e){return{type:`FOCUS`,id:e}}function ni(){return{type:`TREE_BLUR`}}function ri(e={id:null,treeFocused:!1},t){return t.type===`FOCUS`?Object.assign(Object.assign({},e),{id:t.id,treeFocused:!0}):t.type===`TREE_BLUR`?Object.assign(Object.assign({},e),{treeFocused:!1}):e}var ii=class e{constructor(e){this.handleClick=e=>{e.metaKey&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():e.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=e.tree,this.id=e.id,this.data=e.data,this.level=e.level,this.children=e.children,this.parent=e.parent,this.isDraggable=e.isDraggable,this.rowIndex=e.rowIndex}get isRoot(){return this.id===ai}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return!this.isLeaf&&this.tree.isOpen(this.id)}get isClosed(){return!this.isLeaf&&!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){return this.isSelected&&!this.prev?.isSelected}get isSelectedEnd(){return this.isSelected&&!this.next?.isSelected}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(e=>e.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){let e=this.childIndex;return this.parent?.children[e+1]??null}isAncestorOf(e){if(!e)return!1;let t=e;for(;t;){if(t.id===this.id)return!0;t=t.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(e){this.tree.submit(this,e)}reset(){this.tree.reset()}clone(){return new e(Object.assign({},this))}edit(){return this.tree.edit(this)}},ai=`__REACT_ARBORIST_INTERNAL_ROOT__`;function oi(e){function t(n,r,i){let a=new ii({tree:e,data:n,level:r,parent:i,id:e.accessId(n),children:null,isDraggable:e.isDraggable(n),rowIndex:null}),o=e.accessChildren(n);return o&&(a.children=o.map(e=>t(e,r+1,a))),a}let n=new ii({tree:e,id:ai,data:{id:ai},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null});return n.children=(e.props.data??[]).map(e=>t(e,0,n)),n}var si={open(e,t){return{type:`VISIBILITY_OPEN`,id:e,filtered:t}},close(e,t){return{type:`VISIBILITY_CLOSE`,id:e,filtered:t}},toggle(e,t){return{type:`VISIBILITY_TOGGLE`,id:e,filtered:t}},clear(e){return{type:`VISIBILITY_CLEAR`,filtered:e}}};function ci(e={},t){if(t.type===`VISIBILITY_OPEN`)return Object.assign(Object.assign({},e),{[t.id]:!0});if(t.type===`VISIBILITY_CLOSE`)return Object.assign(Object.assign({},e),{[t.id]:!1});if(t.type===`VISIBILITY_TOGGLE`){let n=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!n})}return t.type===`VISIBILITY_CLEAR`?{}:e}function li(e={filtered:{},unfiltered:{}},t){return t.type.startsWith(`VISIBILITY`)?t.filtered?Object.assign(Object.assign({},e),{filtered:ci(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:ci(e.unfiltered,t)}):e}var H=e=>({nodes:{open:{filtered:{},unfiltered:e?.initialOpenState??{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:`none`},dragId:null,dragIds:[],parentId:null,index:-1}}),U={clear:()=>({type:`SELECTION_CLEAR`}),only:e=>({type:`SELECTION_ONLY`,id:B(e)}),add:e=>({type:`SELECTION_ADD`,ids:(Array.isArray(e)?e:[e]).map(B)}),remove:e=>({type:`SELECTION_REMOVE`,ids:(Array.isArray(e)?e:[e]).map(B)}),set:e=>Object.assign({type:`SELECTION_SET`},e),mostRecent:e=>({type:`SELECTION_MOST_RECENT`,id:e===null?null:B(e)}),anchor:e=>({type:`SELECTION_ANCHOR`,id:e===null?null:B(e)})};function ui(e=H().nodes.selection,t){let n=e.ids;switch(t.type){case`SELECTION_CLEAR`:return Object.assign(Object.assign({},e),{ids:new Set});case`SELECTION_ONLY`:return Object.assign(Object.assign({},e),{ids:new Set([t.id])});case`SELECTION_ADD`:return t.ids.length===0?e:(t.ids.forEach(e=>n.add(e)),Object.assign(Object.assign({},e),{ids:new Set(n)}));case`SELECTION_REMOVE`:return t.ids.length===0?e:(t.ids.forEach(e=>n.delete(e)),Object.assign(Object.assign({},e),{ids:new Set(n)}));case`SELECTION_SET`:return Object.assign(Object.assign({},e),{ids:t.ids,mostRecent:t.mostRecent,anchor:t.anchor});case`SELECTION_MOST_RECENT`:return Object.assign(Object.assign({},e),{mostRecent:t.id});case`SELECTION_ANCHOR`:return Object.assign(Object.assign({},e),{anchor:t.id});default:return e}}var W={cursor(e){return{type:`DND_CURSOR`,cursor:e}},dragStart(e,t){return{type:`DND_DRAG_START`,id:e,dragIds:t}},dragEnd(){return{type:`DND_DRAG_END`}},hovering(e,t){return{type:`DND_HOVERING`,parentId:e,index:t}}};function di(e=H().dnd,t){switch(t.type){case`DND_CURSOR`:return Object.assign(Object.assign({},e),{cursor:t.cursor});case`DND_DRAG_START`:return Object.assign(Object.assign({},e),{dragId:t.id,dragIds:t.dragIds});case`DND_DRAG_END`:return H().dnd;case`DND_HOVERING`:return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}var fi={position:`fixed`,pointerEvents:`none`,zIndex:100,left:0,top:0,width:`100%`,height:`100%`},pi=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t}px, ${n}px)`}},mi=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t+10}px, ${n+10}px)`}};function hi({offset:e,mouse:t,id:n,dragIds:r,isDragging:i}){return(0,w.jsxs)(gi,{isDragging:i,children:[(0,w.jsx)(_i,{offset:e,children:(0,w.jsx)(yi,{id:n,dragIds:r})}),(0,w.jsx)(vi,{mouse:t,count:r.length})]})}var gi=(0,C.memo)(function(e){return e.isDragging?(0,w.jsx)(`div`,{style:fi,children:e.children}):null});function _i(e){return(0,w.jsx)(`div`,{className:`row preview`,style:pi(e.offset),children:e.children})}function vi(e){let{count:t,mouse:n}=e;return t>1?(0,w.jsx)(`div`,{className:`selected-count`,style:mi(n),children:t}):null}var yi=(0,C.memo)(function(e){let t=I(),n=t.get(e.id);return n?(0,w.jsx)(t.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*t.indent,opacity:.2,background:`transparent`},tree:t}):null}),bi=Number.isNaN||function(e){return typeof e==`number`&&e!==e};function xi(e,t){return!!(e===t||bi(e)&&bi(t))}function Si(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!xi(e[n],t[n]))return!1;return!0}function Ci(e,t){t===void 0&&(t=Si);var n,r=[],i,a=!1;function o(){var o=[...arguments];return a&&n===this&&t(o,r)?i:(i=e.apply(this,o),a=!0,n=this,r=o,i)}return o}var wi=typeof performance==`object`&&typeof performance.now==`function`?function(){return performance.now()}:function(){return Date.now()};function Ti(e){cancelAnimationFrame(e.id)}function Ei(e,t){var n=wi();function r(){wi()-n>=t?e.call(null):i.id=requestAnimationFrame(r)}var i={id:requestAnimationFrame(r)};return i}var Di=-1;function Oi(e){if(e===void 0&&(e=!1),Di===-1||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,document.body.appendChild(t),Di=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Di}var G=null;function ki(e){if(e===void 0&&(e=!1),G===null||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,n.direction=`rtl`;var r=document.createElement(`div`),i=r.style;return i.width=`100px`,i.height=`100px`,t.appendChild(r),document.body.appendChild(t),t.scrollLeft>0?G=`positive-descending`:(t.scrollLeft=1,G=t.scrollLeft===0?`negative`:`positive-ascending`),document.body.removeChild(t),G}return G}var Ai=150,ji=function(e,t){return e};function Mi(e){var t,n=e.getItemOffset,r=e.getEstimatedTotalSize,i=e.getItemSize,a=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,s=e.getStopIndexForStartIndex,c=e.initInstanceProps,l=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(e){le(t,e);function t(t){var r=e.call(this,t)||this;return r._instanceProps=c(r.props,ue(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:ue(r),isScrolling:!1,scrollDirection:`forward`,scrollOffset:typeof r.props.initialScrollOffset==`number`?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=Ci(function(e,t,n,i){return r.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:n,visibleStopIndex:i})}),r._callOnScroll=void 0,r._callOnScroll=Ci(function(e,t,n){return r.props.onScroll({scrollDirection:e,scrollOffset:t,scrollUpdateWasRequested:n})}),r._getItemStyle=void 0,r._getItemStyle=function(e){var t=r.props,a=t.direction,o=t.itemSize,s=t.layout,c=r._getItemStyleCache(l&&o,l&&s,l&&a),u;if(c.hasOwnProperty(e))u=c[e];else{var d=n(r.props,e,r._instanceProps),f=i(r.props,e,r._instanceProps),p=a===`horizontal`||s===`horizontal`,m=a===`rtl`,h=p?d:0;c[e]=u={position:`absolute`,left:m?void 0:h,right:m?h:void 0,top:p?0:d,height:p?`100%`:f,width:p?f:`100%`}}return u},r._getItemStyleCache=void 0,r._getItemStyleCache=Ci(function(e,t,n){return{}}),r._onScrollHorizontal=function(e){var t=e.currentTarget,n=t.clientWidth,i=t.scrollLeft,a=t.scrollWidth;r.setState(function(e){if(e.scrollOffset===i)return null;var t=r.props.direction,o=i;if(t===`rtl`)switch(ki()){case`negative`:o=-i;break;case`positive-descending`:o=a-n-i}return o=Math.max(0,Math.min(o,a-n)),{isScrolling:!0,scrollDirection:e.scrollOffset<o?`forward`:`backward`,scrollOffset:o,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._onScrollVertical=function(e){var t=e.currentTarget,n=t.clientHeight,i=t.scrollHeight,a=t.scrollTop;r.setState(function(e){if(e.scrollOffset===a)return null;var t=Math.max(0,Math.min(a,i-n));return{isScrolling:!0,scrollDirection:e.scrollOffset<t?`forward`:`backward`,scrollOffset:t,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._outerRefSetter=function(e){var t=r.props.outerRef;r._outerRef=e,typeof t==`function`?t(e):typeof t==`object`&&t&&t.hasOwnProperty(`current`)&&(t.current=e)},r._resetIsScrollingDebounced=function(){r._resetIsScrollingTimeoutId!==null&&Ti(r._resetIsScrollingTimeoutId),r._resetIsScrollingTimeoutId=Ei(r._resetIsScrolling,Ai)},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},function(){r._getItemStyleCache(-1,null)})},r}t.getDerivedStateFromProps=function(e,t){return Ni(e,t),u(e),null};var d=t.prototype;return d.scrollTo=function(e){e=Math.max(0,e),this.setState(function(t){return t.scrollOffset===e?null:{scrollDirection:t.scrollOffset<e?`forward`:`backward`,scrollOffset:e,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},d.scrollToItem=function(e,t){t===void 0&&(t=`auto`);var n=this.props,r=n.itemCount,i=n.layout,o=this.state.scrollOffset;e=Math.max(0,Math.min(e,r-1));var s=0;if(this._outerRef){var c=this._outerRef;s=i===`vertical`?c.scrollWidth>c.clientWidth?Oi():0:c.scrollHeight>c.clientHeight?Oi():0}this.scrollTo(a(this.props,e,t,o,this._instanceProps,s))},d.componentDidMount=function(){var e=this.props,t=e.direction,n=e.initialScrollOffset,r=e.layout;if(typeof n==`number`&&this._outerRef!=null){var i=this._outerRef;t===`horizontal`||r===`horizontal`?i.scrollLeft=n:i.scrollTop=n}this._callPropsCallbacks()},d.componentDidUpdate=function(){var e=this.props,t=e.direction,n=e.layout,r=this.state,i=r.scrollOffset;if(r.scrollUpdateWasRequested&&this._outerRef!=null){var a=this._outerRef;if(t===`horizontal`||n===`horizontal`){if(t===`rtl`)switch(ki()){case`negative`:a.scrollLeft=-i;break;case`positive-ascending`:a.scrollLeft=i;break;default:var o=a.clientWidth;a.scrollLeft=a.scrollWidth-o-i}else a.scrollLeft=i}else a.scrollTop=i}this._callPropsCallbacks()},d.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Ti(this._resetIsScrollingTimeoutId)},d.render=function(){var e=this.props,t=e.children,n=e.className,i=e.direction,a=e.height,o=e.innerRef,s=e.innerElementType,c=e.innerTagName,l=e.itemCount,u=e.itemData,d=e.itemKey,f=d===void 0?ji:d,p=e.layout,m=e.outerElementType,h=e.outerTagName,g=e.style,_=e.useIsScrolling,v=e.width,ee=this.state.isScrolling,y=i===`horizontal`||p===`horizontal`,b=y?this._onScrollHorizontal:this._onScrollVertical,x=this._getRangeToRender(),te=x[0],re=x[1],ie=[];if(l>0)for(var S=te;S<=re;S++)ie.push((0,C.createElement)(t,{data:u,key:f(S,u),index:S,isScrolling:_?ee:void 0,style:this._getItemStyle(S)}));var ae=r(this.props,this._instanceProps);return(0,C.createElement)(m||h||`div`,{className:n,onScroll:b,ref:this._outerRefSetter,style:ne({position:`relative`,height:a,width:v,overflow:`auto`,WebkitOverflowScrolling:`touch`,willChange:`transform`,direction:i},g)},(0,C.createElement)(s||c||`div`,{children:ie,ref:o,style:{height:y?`100%`:ae,pointerEvents:ee?`none`:void 0,width:y?ae:`100%`}}))},d._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered==`function`&&this.props.itemCount>0){var e=this._getRangeToRender(),t=e[0],n=e[1],r=e[2],i=e[3];this._callOnItemsRendered(t,n,r,i)}if(typeof this.props.onScroll==`function`){var a=this.state,o=a.scrollDirection,s=a.scrollOffset,c=a.scrollUpdateWasRequested;this._callOnScroll(o,s,c)}},d._getRangeToRender=function(){var e=this.props,t=e.itemCount,n=e.overscanCount,r=this.state,i=r.isScrolling,a=r.scrollDirection,c=r.scrollOffset;if(t===0)return[0,0,0,0];var l=o(this.props,c,this._instanceProps),u=s(this.props,l,c,this._instanceProps),d=!i||a===`backward`?Math.max(1,n):1,f=!i||a===`forward`?Math.max(1,n):1;return[Math.max(0,l-d),Math.max(0,Math.min(t-1,u+f)),l,u]},t}(C.PureComponent),t.defaultProps={direction:`ltr`,itemData:void 0,layout:`vertical`,overscanCount:2,useIsScrolling:!1},t}var Ni=function(e,t){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,t.instance},Pi=Mi({getItemOffset:function(e,t){return t*e.itemSize},getItemSize:function(e,t){return e.itemSize},getEstimatedTotalSize:function(e){var t=e.itemCount;return e.itemSize*t},getOffsetForIndexAndAlignment:function(e,t,n,r,i,a){var o=e.direction,s=e.height,c=e.itemCount,l=e.itemSize,u=e.layout,d=e.width,f=o===`horizontal`||u===`horizontal`?d:s,p=Math.max(0,c*l-f),m=Math.min(p,t*l),h=Math.max(0,t*l-f+l+a);switch(n===`smart`&&(n=r>=h-f&&r<=m+f?`auto`:`center`),n){case`start`:return m;case`end`:return h;case`center`:var g=Math.round(h+(m-h)/2);return g<Math.ceil(f/2)?0:g>p+Math.floor(f/2)?p:g;default:return r>=h&&r<=m?r:r<h?h:m}},getStartIndexForOffset:function(e,t){var n=e.itemCount,r=e.itemSize;return Math.max(0,Math.min(n-1,Math.floor(t/r)))},getStopIndexForStartIndex:function(e,t,n){var r=e.direction,i=e.height,a=e.itemCount,o=e.itemSize,s=e.layout,c=e.width,l=r===`horizontal`||s===`horizontal`,u=t*o,d=Math.ceil(((l?c:i)+n-u)/o);return Math.max(0,Math.min(a-1,t+d-1))},initInstanceProps:function(e){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(e){e.itemSize}});function Fi(){let e=I(),t=wr().cursor;if(!t||t.type!==`line`)return null;let n=e.indent,r=e.rowHeight*t.index+(e.props.padding??e.props.paddingTop??0),i=n*t.level,a=e.renderCursor;return(0,w.jsx)(a,{top:r,left:i,indent:n})}var Ii=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Li=(0,C.forwardRef)(function(e,t){let{children:n}=e,r=Ii(e,[`children`]),i=I();return(0,w.jsxs)(`div`,Object.assign({ref:t},r,{onClick:e=>{e.currentTarget===e.target&&i.deselectAll()},children:[(0,w.jsx)(Ri,{}),n]}))}),Ri=()=>{let e=I();return(0,w.jsx)(`div`,{style:{height:e.visibleNodes.length*e.rowHeight,width:`100%`,position:`absolute`,left:`0`,right:`0`},children:(0,w.jsx)(Fi,{})})},zi=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Bi=(0,C.forwardRef)(function(e,t){var{style:n}=e,r=zi(e,[`style`]);let i=I(),a=i.props.padding??i.props.paddingTop??0,o=i.props.padding??i.props.paddingBottom??0;return(0,w.jsx)(`div`,Object.assign({ref:t,style:Object.assign(Object.assign({},n),{height:`${parseFloat(n.height)+a+o}px`})},r))});function Vi(e){let t=I(),n=t.selectedIds,[r,i,a]=In(()=>({canDrag:()=>e.isDraggable,type:`NODE`,item:()=>{let r=t.isSelected(e.id)?Array.from(n):[e.id];return t.dispatch(W.dragStart(e.id,r)),{id:e.id,dragIds:r}},end:()=>{t.hideCursor(),t.dispatch(W.dragEnd())}}),[n,e]);return(0,C.useEffect)(()=>{a(vr())},[a]),i}function Hi(e,t){let n=e.getBoundingClientRect(),r=t.x-Math.round(n.x),i=t.y-Math.round(n.y),a=n.height,o=i<a/2,s=!o,c=a/4,l=i>c&&i<a-c;return{x:r,inTopHalf:o,inBottomHalf:s,inMiddle:l,atTop:!l&&o,atBottom:!l&&s}}function Ui(e,t,n,r){return e?e.isInternal?r.atTop?[t,e]:r.inMiddle?[e,e]:[e,n]:r.inTopHalf?[t,e]:[e,n]:[t,null]}function Wi(e,t){return{parentId:e||null,index:t}}function K(e,t){return{type:`line`,index:e,level:t}}function Gi(e){return{type:`highlight`,id:e}}function Ki(e,t){let n=e;for(;n.parent&&n.level>t;)n=n.parent;return{parentId:n.parent?.id||null,index:Mr(n)+1}}function qi(e){let t=Hi(e.element,e.offset),n=e.indent,r=Math.round(Math.max(0,t.x-n)/n),{node:i,nextNode:a,prevNode:o}=e,[s,c]=Ui(i,o,a,t);if(i&&i.isInternal&&t.inMiddle)return{drop:Wi(i.id,null),cursor:Gi(i.id)};if(!s)return{drop:Wi(c?.parent?.id,0),cursor:K(0,0)};if(Or(s)){let e=L(r,c?.level||0,s.level);return{drop:Ki(s,e),cursor:K(s.rowIndex+1,e)}}if(kr(s)){let e=L(r,c?.level||0,s.level);return{drop:Ki(s,e),cursor:K(s.rowIndex+1,e)}}if(Ar(s)){let e=L(r,0,s.level+1);return e>s.level?{drop:Wi(s.id,0),cursor:K(s.rowIndex+1,e)}:{drop:Ki(s,e),cursor:K(s.rowIndex+1,e)}}return{drop:Wi(s?.id,0),cursor:K(s.rowIndex+1,s.level+1)}}function Ji(e,t){let n=I(),[r,i]=Gn(()=>({accept:`NODE`,canDrop:()=>n.canDrop(),hover:(r,i)=>{let a=i.getClientOffset();if(!e.current||!a)return;let{cursor:o,drop:s}=qi({element:e.current,offset:a,indent:n.indent,node:t,prevNode:t.prev,nextNode:t.next});s&&n.dispatch(W.hovering(s.parentId,s.index)),i.canDrop()?o&&n.showCursor(o):n.hideCursor()},drop:(e,t)=>{if(!t.canDrop())return null;let{parentId:r,index:i,dragIds:a}=n.state.dnd;Hr(n.props.onMove,{dragIds:a,parentId:r===`__REACT_ARBORIST_INTERNAL_ROOT__`?null:r,index:i===null?0:i,dragNodes:n.dragNodes,parentNode:n.get(r)}),n.open(r)}}),[t,e.current,n.props]);return i}function Yi(e){let t=I(),n=t.at(e);if(!n)throw Error(`Could not find node for index: ${e}`);return(0,C.useMemo)(()=>{let r=n.clone();return t.visibleNodes[e]=r,r},[...Object.values(n.state),n])}var Xi=C.memo(function({index:e,style:t}){Er(),Sr();let n=I(),r=Yi(e),i=(0,C.useRef)(null),a=Vi(r),o=Ji(i,r),s=(0,C.useCallback)(e=>{i.current=e,o(e)},[o]),c=n.indent*r.level,l=(0,C.useMemo)(()=>({paddingLeft:c}),[c]),u=(0,C.useMemo)(()=>Object.assign(Object.assign({},t),{top:parseFloat(t.top)+(n.props.padding??n.props.paddingTop??0)}),[t,n.props.padding,n.props.paddingTop]),d={role:`treeitem`,"aria-level":r.level+1,"aria-selected":r.isSelected,"aria-expanded":r.isOpen,style:u,tabIndex:-1,className:n.props.rowClassName};(0,C.useEffect)(()=>{var e;!r.isEditing&&r.isFocused&&((e=i.current)==null||e.focus({preventScroll:!0}))},[r.isEditing,r.isFocused,i.current]);let f=n.renderNode,p=n.renderRow;return(0,w.jsx)(p,{node:r,innerRef:s,attrs:d,children:(0,w.jsx)(f,{node:r,tree:n,style:l,dragHandle:a})})}),Zi=``,Qi=null;function $i(){Er();let e=I();return(0,w.jsx)(`div`,{role:`tree`,style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:t=>{t.currentTarget.contains(t.relatedTarget)||e.onFocus()},onBlur:t=>{t.currentTarget.contains(t.relatedTarget)||e.onBlur()},onKeyDown:t=>{if(e.isEditing)return;if(t.key===`Backspace`){if(!e.props.onDelete)return;let t=Array.from(e.selectedIds);if(t.length>1){let n=e.mostRecentNode;for(;n&&n.isSelected;)n=n.nextSibling;n||=e.lastNode,e.focus(n,{scroll:!1}),e.delete(Array.from(t))}else{let t=e.focusedNode;if(t){let n=t.nextSibling,r=t.parent;e.focus(n||r,{scroll:!1}),e.delete(t)}}return}if(t.key===`Tab`&&!t.shiftKey){t.preventDefault(),Fr(t.currentTarget);return}if(t.key===`Tab`&&t.shiftKey){t.preventDefault(),Ir(t.currentTarget);return}if(t.key===`ArrowDown`){t.preventDefault();let n=e.nextNode;if(t.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}if(!t.shiftKey||e.props.disableMultiSelection){e.focus(n);return}{if(!n)return;let t=e.focusedNode;t?t.isSelected?e.selectContiguous(n):e.selectMulti(n):e.focus(e.firstNode);return}}if(t.key===`ArrowUp`){t.preventDefault();let n=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection){e.focus(n);return}{if(!n)return;let t=e.focusedNode;t?t.isSelected?e.selectContiguous(n):e.selectMulti(n):e.focus(e.lastNode);return}}if(t.key===`ArrowRight`){let t=e.focusedNode;if(!t)return;t.isInternal&&t.isOpen?e.focus(e.nextNode):t.isInternal&&e.open(t.id);return}if(t.key===`ArrowLeft`){let t=e.focusedNode;if(!t||t.isRoot)return;t.isInternal&&t.isOpen?e.close(t.id):t.parent?.isRoot||e.focus(t.parent);return}if(t.key===`a`&&t.metaKey&&!e.props.disableMultiSelection){t.preventDefault(),e.selectAll();return}if(t.key===`a`&&!t.metaKey&&e.props.onCreate){e.createLeaf();return}if(t.key===`A`&&!t.metaKey){if(!e.props.onCreate)return;e.createInternal();return}if(t.key===`Home`){t.preventDefault(),e.focus(e.firstNode);return}if(t.key===`End`){t.preventDefault(),e.focus(e.lastNode);return}if(t.key===`Enter`){let t=e.focusedNode;if(!t||!t.isEditable||!e.props.onRename)return;setTimeout(()=>{t&&e.edit(t)});return}if(t.key===` `){t.preventDefault();let n=e.focusedNode;if(!n)return;n.isLeaf?(n.select(),n.activate()):n.toggle();return}if(t.key===`*`){let t=e.focusedNode;if(!t)return;e.openSiblings(t);return}if(t.key===`PageUp`){t.preventDefault(),e.pageUp();return}t.key===`PageDown`&&(t.preventDefault(),e.pageDown()),clearTimeout(Qi),Zi+=t.key,Qi=setTimeout(()=>{Zi=``},600);let n=e.visibleNodes.find(e=>{let t=e.data.name;return typeof t==`string`&&t.toLowerCase().startsWith(Zi)});n&&e.focus(n.id)},children:(0,w.jsx)(Pi,{className:e.props.className,outerRef:e.listEl,itemCount:e.visibleNodes.length,height:e.height,width:e.width,itemSize:e.rowHeight,overscanCount:e.overscanCount,itemKey:t=>e.visibleNodes[t]?.id||t,outerElementType:Li,innerElementType:Bi,onScroll:e.props.onScroll,onItemsRendered:e.onItemsRendered.bind(e),ref:e.list,children:Xi})})}function ea(e){return e.isFiltered?na(e.root,e.isMatch.bind(e)):ta(e.root)}function ta(e){let t=[];function n(e){var r;e.level>=0&&t.push(e),e.isOpen&&((r=e.children)==null||r.forEach(n))}return n(e),t.forEach(ra),t}function na(e,t){let n={},r=[];function i(e){if(!e.isRoot&&t(e)){n[e.id]=!0;let t=e.parent;for(;t;)n[t.id]=!0,t=t.parent}if(e.children)for(let t of e.children)i(t)}function a(e){var t;e.level>=0&&n[e.id]&&r.push(e),e.isOpen&&((t=e.children)==null||t.forEach(a))}return i(e),a(e),r.forEach(ra),r}function ra(e,t){e.rowIndex=t}var ia=e=>e.reduce((e,t,n)=>(e[t.id]=n,e),{}),aa=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},{safeRun:q,identify:J,identifyNull:Y}=Dr,oa=class e{constructor(e,t,n,r){this.store=e,this.props=t,this.list=n,this.listEl=r,this.visibleStartIndex=0,this.visibleStopIndex=0,this.root=oi(this),this.visibleNodes=ea(this),this.idToIndex=ia(this.visibleNodes)}update(e){this.props=e,this.root=oi(this),this.visibleNodes=ea(this),this.idToIndex=ia(this.visibleNodes)}dispatch(e){return this.store.dispatch(e)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){return this.props.width??300}get height(){return this.props.height??500}get indent(){return this.props.indent??24}get rowHeight(){return this.props.rowHeight??24}get overscanCount(){return this.props.overscanCount??1}get searchTerm(){return(this.props.searchTerm||``).trim()}get matchFn(){let e=this.props.searchMatch??((e,t)=>JSON.stringify(Object.values(e.data)).toLocaleLowerCase().includes(t.toLocaleLowerCase()));return t=>e(t,this.searchTerm)}accessChildren(e){return z(e,this.props.childrenAccessor||`children`)??null}accessId(e){let t=z(e,this.props.idAccessor||`id`);if(!t)throw Error(`Data must contain an 'id' property or props.idAccessor must return a string`);return t}get firstNode(){return this.visibleNodes[0]??null}get lastNode(){return this.visibleNodes[this.visibleNodes.length-1]??null}get focusedNode(){return this.get(this.state.nodes.focus.id)??null}get mostRecentNode(){return this.get(this.state.nodes.selection.mostRecent)??null}get nextNode(){let e=this.indexOf(this.focusedNode);return e===null?null:this.at(e+1)}get prevNode(){let e=this.indexOf(this.focusedNode);return e===null?null:this.at(e-1)}get(e){return e&&e in this.idToIndex&&this.visibleNodes[this.idToIndex[e]]||null}at(e){return this.visibleNodes[e]||null}nodesBetween(e,t){if(e===null||t===null)return[];let n=this.indexOf(e)??0,r=this.indexOf(t);if(r===null)return[];let i=Math.min(n,r),a=Math.max(n,r);return this.visibleNodes.slice(i,a+1)}indexOf(e){let t=Br(e);return t?this.idToIndex[t]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:`internal`})}createLeaf(){return this.create({type:`leaf`})}create(){return aa(this,arguments,void 0,function*(e={}){let t=e.parentId===void 0?Gr(this):e.parentId,n=e.index??Wr(this),r=e.type??`leaf`,i=yield q(this.props.onCreate,{type:r,parentId:t,index:n,parentNode:this.get(t)});i&&(this.focus(i),setTimeout(()=>{this.edit(i).then(()=>{this.select(i),this.activate(i)})}))})}delete(e){return aa(this,void 0,void 0,function*(){if(!e)return;let t=(Array.isArray(e)?e:[e]).map(J),n=t.map(e=>this.get(e)).filter(e=>!!e);yield q(this.props.onDelete,{nodes:n,ids:t})})}edit(t){let n=J(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(n),this.dispatch(ei(n)),new Promise(t=>{e.editPromise=t})}submit(e,t){return aa(this,void 0,void 0,function*(){if(!e)return;let n=J(e);yield q(this.props.onRename,{id:n,name:t,node:this.get(n)}),this.dispatch(ei(null)),this.resolveEdit({cancelled:!1,value:t}),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(ei(null)),this.resolveEdit({cancelled:!0}),setTimeout(()=>this.onFocus())}activate(e){let t=this.get(Y(e));t&&q(this.props.onActivate,t)}resolveEdit(t){let n=e.editPromise;n&&n(t),e.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let e=[];for(let t of Array.from(this.selectedIds)){let n=this.get(t);n&&e.push(n)}return e}focus(e,t={}){e&&(this.props.selectionFollowsFocus?this.select(e):(this.dispatch(V(J(e))),t.scroll!==!1&&this.scrollTo(e),this.focusedNode&&q(this.props.onFocus,this.focusedNode)))}pageUp(){let e=this.visibleStartIndex,t=this.visibleStopIndex-e,n=this.focusedNode?.rowIndex??0;n=n>e?e:Math.max(e-t,0),this.focus(this.at(n))}pageDown(){let e=this.visibleStartIndex,t=this.visibleStopIndex,n=t-e,r=this.focusedNode?.rowIndex??0;r=r<t?t:Math.min(r+n,this.visibleNodes.length-1),this.focus(this.at(r))}select(e,t={}){if(!e)return;let n=t.focus!==!1,r=J(e);n&&this.dispatch(V(r)),this.dispatch(U.only(r)),this.dispatch(U.anchor(r)),this.dispatch(U.mostRecent(r)),this.scrollTo(r,t.align),this.focusedNode&&n&&q(this.props.onFocus,this.focusedNode),q(this.props.onSelect,this.selectedNodes)}deselect(e){if(!e)return;let t=J(e);this.dispatch(U.remove(t)),q(this.props.onSelect,this.selectedNodes)}selectMulti(e){let t=this.get(Y(e));t&&(this.dispatch(V(t.id)),this.dispatch(U.add(t.id)),this.dispatch(U.anchor(t.id)),this.dispatch(U.mostRecent(t.id)),this.scrollTo(t),this.focusedNode&&q(this.props.onFocus,this.focusedNode),q(this.props.onSelect,this.selectedNodes))}selectContiguous(e){if(!e)return;let t=J(e),{anchor:n,mostRecent:r}=this.state.nodes.selection;this.dispatch(V(t)),this.dispatch(U.remove(this.nodesBetween(n,r))),this.dispatch(U.add(this.nodesBetween(n,Y(t)))),this.dispatch(U.mostRecent(t)),this.scrollTo(t),this.focusedNode&&q(this.props.onFocus,this.focusedNode),q(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null}),q(this.props.onSelect,this.selectedNodes)}selectAll(){this.setSelection({ids:Object.keys(this.idToIndex),anchor:this.firstNode,mostRecent:this.lastNode}),this.dispatch(V(this.lastNode?.id)),this.focusedNode&&q(this.props.onFocus,this.focusedNode),q(this.props.onSelect,this.selectedNodes)}setSelection(e){let t=new Set(e.ids?.map(J)),n=Y(e.anchor),r=Y(e.mostRecent);this.dispatch(U.set({ids:t,anchor:n,mostRecent:r})),q(this.props.onSelect,this.selectedNodes)}get cursorParentId(){let{cursor:e}=this.state.dnd;switch(e.type){case`highlight`:return e.id;default:return null}}get cursorOverFolder(){return this.state.dnd.cursor.type===`highlight`}get dragNodes(){return this.state.dnd.dragIds.map(e=>this.get(e)).filter(e=>!!e)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){if(this.isFiltered)return!1;let e=this.get(this.state.dnd.parentId)??this.root,t=this.dragNodes,n=this.props.disableDrop;for(let n of t)if(!n||!e||n.isInternal&&jr(e,n))return!1;return typeof n==`function`?!n({parentNode:e,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof n==`string`?!e.data[n]:typeof n!=`boolean`||!n}hideCursor(){this.dispatch(W.cursor({type:`none`}))}showCursor(e){this.dispatch(W.cursor(e))}open(e){let t=Y(e);t&&(this.isOpen(t)||(this.dispatch(si.open(t,this.isFiltered)),q(this.props.onToggle,t)))}close(e){let t=Y(e);t&&this.isOpen(t)&&(this.dispatch(si.close(t,this.isFiltered)),q(this.props.onToggle,t))}toggle(e){let t=Y(e);if(t)return this.isOpen(t)?this.close(t):this.open(t)}openParents(e){let t=Y(e);if(!t)return;let n=Pr(this.root,t)?.parent;for(;n;)this.open(n.id),n=n.parent}openSiblings(e){let t=e.parent;if(!t)this.toggle(e.id);else if(t.children){let n=e.isOpen;for(let e of t.children)e.isInternal&&(n?this.close(e.id):this.open(e.id));this.scrollTo(this.focusedNode)}}openAll(){R(this.root,e=>{e.isInternal&&e.open()})}closeAll(){R(this.root,e=>{e.isInternal&&e.close()})}scrollTo(e,t=`smart`){if(!e)return;let n=J(e);return this.openParents(n),Ur(()=>n in this.idToIndex).then(()=>{var e;let r=this.idToIndex[n];r!==void 0&&((e=this.list.current)==null||e.scrollToItem(r,t))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){return!!this.props.searchTerm?.trim()}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(e){return e?this.state.nodes.selection.ids.has(e):!1}isOpen(e){if(!e)return!1;if(e===`__REACT_ARBORIST_INTERNAL_ROOT__`)return!0;let t=this.props.openByDefault??!0;return this.isFiltered?this.state.nodes.open.filtered[e]??!0:this.state.nodes.open.unfiltered[e]??t}isEditable(e){return!z(e,this.props.disableEdit||(()=>!1))}isDraggable(e){return!z(e,this.props.disableDrag||(()=>!1))}isDragging(e){let t=Y(e);return t?this.state.nodes.drag.id===t:!1}isFocused(e){return this.hasFocus&&this.state.nodes.focus.id===e}isMatch(e){return this.matchFn(e)}willReceiveDrop(e){let t=Y(e);if(!t)return!1;let{destinationParentId:n,destinationIndex:r}=this.state.nodes.drag;return t===n&&r===null}onFocus(){let e=this.focusedNode||this.firstNode;e&&this.dispatch(V(e.id))}onBlur(){this.dispatch(ni())}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||$i}get renderRow(){return this.props.renderRow||Xr}get renderNode(){return this.props.children||Zr}get renderDragPreview(){return this.props.renderDragPreview||hi}get renderCursor(){return this.props.renderCursor||Yr}};function X(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 sa=typeof Symbol==`function`&&Symbol.observable||`@@observable`,ca=()=>Math.random().toString(36).substring(7).split(``).join(`.`),la={INIT:`@@redux/INIT${ca()}`,REPLACE:`@@redux/REPLACE${ca()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ca()}`};function ua(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function da(e,t,n){if(typeof e!=`function`)throw Error(X(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(X(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(X(1));return n(da)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(X(3));return i}function d(e){if(typeof e!=`function`)throw Error(X(4));if(c)throw Error(X(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(X(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!ua(e))throw Error(X(7));if(e.type===void 0)throw Error(X(8));if(typeof e.type!=`string`)throw Error(X(17));if(c)throw Error(X(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(X(10));r=e,f({type:la.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(X(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[sa](){return this}}}return f({type:la.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[sa]:m}}function fa(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:la.INIT})===void 0)throw Error(X(12));if(n(void 0,{type:la.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(X(13))})}function pa(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let i=t[r];typeof e[i]==`function`&&(n[i]=e[i])}let r=Object.keys(n),i;try{fa(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1,o={};for(let i=0;i<r.length;i++){let s=r[i],c=n[s],l=e[s],u=c(l,t);if(u===void 0)throw t&&t.type,Error(X(14));o[s]=u,a||=u!==l}return a||=r.length!==Object.keys(e).length,a?o:e}}function ma(e=H().nodes.drag,t){switch(t.type){case`DND_DRAG_START`:return Object.assign(Object.assign({},e),{id:t.id,selectedIds:t.dragIds});case`DND_DRAG_END`:return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case`DND_HOVERING`:return t.parentId!==e.destinationParentId||t.index!=e.destinationIndex?Object.assign(Object.assign({},e),{destinationParentId:t.parentId,destinationIndex:t.index}):e;default:return e}}var ha=pa({nodes:pa({focus:ri,edit:ti,open:li,selection:ui,drag:ma}),dnd:di}),ga=H();function _a({treeProps:e,imperativeHandle:t,children:n}){let r=(0,C.useRef)(null),i=(0,C.useRef)(null),a=(0,C.useRef)(da(ha,H(e))),o=(0,se.useSyncExternalStore)(a.current.subscribe,a.current.getState,()=>ga),s=(0,C.useMemo)(()=>new oa(a.current,e,r,i),[]),c=(0,C.useRef)(0);return(0,C.useMemo)(()=>{c.current+=1,s.update(e)},[...Object.values(e),o.nodes.open]),(0,C.useImperativeHandle)(t,()=>s),(0,C.useEffect)(()=>{s.props.selection?s.select(s.props.selection,{focus:!1}):s.deselectAll()},[s.props.selection]),(0,C.useEffect)(()=>{s.props.searchTerm||a.current.dispatch(si.clear(!0))},[s.props.searchTerm]),(0,w.jsx)(br.Provider,{value:s,children:(0,w.jsx)(Tr.Provider,{value:c.current,children:(0,w.jsx)(xr.Provider,{value:o.nodes,children:(0,w.jsx)(Cr.Provider,{value:o.dnd,children:(0,w.jsx)(nn,Object.assign({backend:yr,options:{rootElement:s.props.dndRootElement||void 0}},e.dndManager&&{manager:e.dndManager},{children:n}))})})})})}function va(){let e=I(),[,t]=Gn(()=>({accept:`NODE`,canDrop:(t,n)=>n.isOver({shallow:!0})?e.canDrop():!1,hover:(t,n)=>{if(!n.isOver({shallow:!0}))return;let r=n.getClientOffset();if(!e.listEl.current||!r)return;let{cursor:i,drop:a}=qi({element:e.listEl.current,offset:r,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});a&&e.dispatch(W.hovering(a.parentId,a.index)),n.canDrop()?i&&e.showCursor(i):e.hideCursor()}}),[e]);t(e.listEl)}function ya(e){return va(),e.children}function ba(){let e=I().props.renderContainer||$i;return(0,w.jsx)(w.Fragment,{children:(0,w.jsx)(e,{})})}function xa(){let e=I(),{offset:t,mouse:n,item:r,isDragging:i}=Ln(e=>({offset:e.getSourceClientOffset(),mouse:e.getClientOffset(),item:e.getItem(),isDragging:e.isDragging()})),a=e.props.renderDragPreview||hi;return(0,w.jsx)(a,{offset:t,mouse:n,id:r?.id||null,dragIds:r?.dragIds||[],isDragging:i})}var Sa=class{constructor(e){this.root=Ca(e)}get data(){return this.root.children?.map(e=>e.data)??[]}create(e){let t=e.parentId?this.find(e.parentId):this.root;if(!t)return null;t.addChild(e.data,e.index)}move(e){let t=this.find(e.id),n=e.parentId?this.find(e.parentId):this.root;!t||!n||(n.addChild(t.data,e.index),t.drop())}update(e){let t=this.find(e.id);t&&t.update(e.changes)}drop(e){let t=this.find(e.id);t&&t.drop()}find(e,t=this.root){if(!t)return null;if(t.id===e)return t;if(t.children){for(let n of t.children){let t=this.find(e,n);if(t)return t}return null}return null}};function Ca(e){let t=new Ta({id:`ROOT`},null);return t.children=e.map(e=>wa(e,t)),t}function wa(e,t){let n=new Ta(e,t);return e.children&&(n.children=e.children.map(e=>wa(e,n))),n}var Ta=class{constructor(e,t){this.data=e,this.parent=t,this.id=e.id}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(e,t){let n=wa(e,this);this.children=this.children??[],this.children.splice(t,0,n),this.data.children=this.data.children??[],this.data.children.splice(t,0,e)}removeChild(e){var t,n;(t=this.children)==null||t.splice(e,1),(n=this.data.children)==null||n.splice(e,1)}update(e){if(this.hasParent()){let t=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),e),t),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}},Ea=0;function Da(e){let[t,n]=(0,C.useState)(e),r=(0,C.useMemo)(()=>new Sa(t),[t]);return[t,{onMove:e=>{for(let t of e.dragIds)r.move({id:t,parentId:e.parentId,index:e.index});n(r.data)},onRename:({name:e,id:t})=>{r.update({id:t,changes:{name:e}}),n(r.data)},onCreate:({parentId:e,index:t,type:i})=>{let a={id:`simple-tree-id-${Ea++}`,name:``};return i===`internal`&&(a.children=[]),r.create({parentId:e,index:t,data:a}),n(r.data),a},onDelete:e=>{e.ids.forEach(e=>r.drop({id:e})),n(r.data)}}]}function Oa(e){if(e.initialData&&e.data)throw Error(`React Arborist Tree => Provide either a data or initialData prop, but not both.`);if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
|
|
3
3
|
Use the data prop if you want to provide your own handlers.`);if(e.initialData){let[t,n]=Da(e.initialData);return Object.assign(Object.assign(Object.assign({},e),n),{data:t})}return e}function ka(e,t){let n=Oa(e);return(0,w.jsxs)(_a,{treeProps:n,imperativeHandle:t,children:[(0,w.jsx)(ya,{children:(0,w.jsx)(ba,{})}),(0,w.jsx)(xa,{})]})}var Aa=(0,C.forwardRef)(ka),Z=a(),ja=5,Ma=/^[A-Za-z]:[/\\]/,Na=/^\\\\/;function Q(e){return e.success?e:(b({title:`Failed`,description:e.message}),null)}var Pa=class{delegate=new Sa([]);callbacks;constructor(e){this.callbacks=e}roots=[];onChange=o.NOOP;path=new x(`/`);initialize=async e=>{if(this.onChange=e,this.delegate.data.length===0)try{let{roots:e}=await this.callbacks.getRoots(),t=e.find(e=>e.isPrimary);if(!t)throw Error(`File browser response is missing a primary root`);if(this.roots=e,this.path=x.guessDeliminator(t.path),this.delegate=new Sa(e.map(Fa)),e.length===1){let e=await this.callbacks.listFiles({path:t.path});this.delegate.update({id:this.getPrimaryRootId(),changes:{children:$(e.files,t)}})}}catch(e){b({title:`Failed`,description:te(e)})}this.emitChange()};async expand(e){let t=this.delegate.find(e);if(!t?.data.isDirectory)return!1;if(t.children&&t.children.length>0)return!0;let n=await this.callbacks.listFiles({path:t.data.path});return this.delegate.update({id:e,changes:{children:$(n.files,this.getRootForNode(t.data))}}),this.emitChange(),!0}async copy(e,t){let n=this.getMutableNode(e);if(!n)return;let r=n.data.path,i=this.getParentPath(n.data),a=za(i,t);await this.callbacks.copyFileOrFolder({path:r,newPath:a}).then(Q)&&await this.refreshPath(i)}async rename(e,t){let n=this.getMutableNode(e);if(!n)return;let r=n.data.path,i=this.getParentPath(n.data),a=za(i,t);await this.callbacks.renameFileOrFolder({path:r,newPath:a}).then(Q)&&await this.refreshPath(i)}async move(e,t){let n=t??this.getPrimaryRootId(),r=this.delegate.find(n);if(!r?.data.isDirectory)return;let i=new Set;await ae(e,ja,async e=>{let t=this.getMutableNode(e,!1);if(!t)return;let n=t.data.path,a=this.getParentPath(t.data),o=za(r.data.path,this.path.basename(n));await this.callbacks.renameFileOrFolder({path:n,newPath:o}).then(Q)&&(i.add(r.data.path),i.add(a))}),await this.refreshPaths([...i])}async createFile({name:e,parentId:t,type:n=`file`}){let r=this.getParentNode(t);r&&await this.callbacks.createFileOrFolder({path:r.data.path,type:n,name:e}).then(Q)&&await this.refreshPath(r.data.path)}async createFolder(e,t){let n=this.getParentNode(t);n&&await this.callbacks.createFileOrFolder({path:n.data.path,type:`directory`,name:e}).then(Q)&&await this.refreshPath(n.data.path)}async delete(e){let t=this.getMutableNode(e);if(!t)return;let n=this.getParentPath(t.data);await this.callbacks.deleteFileOrFolder({path:t.data.path}).then(Q)&&await this.refreshPath(n)}refreshAll=async e=>{let t=[...this.roots.map(e=>e.path),...e.map(e=>this.delegate.find(e)?.data.path).filter(e=>!!e)];await this.refreshPaths(t)};refreshPath=async e=>{await this.refreshPaths([e])};getPrimaryRelativePath=e=>{let t=this.getPrimaryRoot();return t?La(e,t.path):null};getPrimaryRootPath=()=>this.getPrimaryRoot()?.path??``;getPrimaryRootId=()=>{let e=this.getPrimaryRoot()?.path??``;return Ia(e,e)};isPrimaryNode=e=>e.isPrimaryRoot;getDisplayPath=e=>{let t=this.getRootForPath(e);if(!t)return e;let n=La(e,t.path);return n?t.isPrimary?n:`${t.name}/${n}`:t.name};isRootPath=e=>this.roots.some(t=>Ra(e,t.path));getPrimaryRoot(){return this.roots.find(e=>e.isPrimary)}getRootForNode(e){return this.roots.find(t=>Ra(t.path,e.rootPath))??this.getPrimaryRoot()??{path:e.rootPath,name:e.rootPath,isPrimary:e.isPrimaryRoot}}getRootForPath(e){return this.roots.filter(t=>La(e,t.path)!==null).toSorted((e,t)=>t.path.length-e.path.length)[0]}getParentNode(e){let t=e??this.getPrimaryRootId(),n=this.delegate.find(t);return n?.data.isDirectory?n:null}getParentPath(e){return(this.delegate.find(e.id)?.parent)?.data.path??e.rootPath}getMutableNode(e,t=!0){let n=this.delegate.find(e);return!n||n.data.isRoot?(t&&b({title:`Failed`,description:n?`File browser roots cannot be modified`:`Node with id ${e} not found in the tree`}),null):n}refreshPaths=async e=>{let t=[...new Set(e)];if(t.length===0)return;let n=await ae(t,ja,e=>this.callbacks.listFiles({path:e}).catch(()=>null));for(let[e,r]of t.entries()){let t=n[e];if(t)for(let e of this.roots){let n=this.delegate.find(Ia(e.path,r));n?.data.isDirectory&&this.delegate.update({id:n.id,changes:{children:$(t.files,e)}})}}this.emitChange()};emitChange(){let e=this.delegate.data;this.onChange(this.roots.length===1?e[0]?.children??[]:e)}};function Fa(e){return{id:Ia(e.path,e.path),path:e.path,name:e.name,isDirectory:!0,isMarimoFile:!1,children:[],isRoot:!0,rootPath:e.path,isPrimaryRoot:e.isPrimary}}function $(e,t){return e.map(e=>({...e,id:Ia(t.path,e.path),children:$(e.children??[],t),isRoot:!1,rootPath:t.path,isPrimaryRoot:t.isPrimary}))}function Ia(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function La(e,t){let n=Ba(t),r=e=>n?e.toLowerCase():e,i=r(e);if(i===r(t))return``;let a=Va(t),o=t.endsWith(a)?t:`${t}${a}`,s=r(o);return i.startsWith(s)?e.slice(o.length):null}function Ra(e,t){return La(e,t)===``}function za(e,t){let n=Va(e);return`${e}${e.endsWith(n)?``:n}${t}`}function Ba(e){return Ma.test(e)||Na.test(e)}function Va(e){return Na.test(e)||/^[A-Za-z]:\\/.test(e)?`\\`:`/`}function Ha(e){let t=(0,Z.c)(13),{root:n}=e,{sendRenameFileOrFolder:r,sendCopyFileOrFolder:i,sendDeleteFileOrFolder:a}=m(),o;t[0]!==n||t[1]!==r?(o=async(e,t)=>{let{path:i,newPath:a}=S({path:e.path,name:t,root:n});return Q(await r({path:i,newPath:a}))},t[0]=n,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]!==n||t[4]!==i?(c=async e=>{let{path:t,newPath:r}=S({path:e.path,name:ie(e.name),root:n});return Q(await i({path:t,newPath:r}))},t[3]=n,t[4]=i,t[5]=c):c=t[5];let l=c,u;t[6]!==n||t[7]!==a?(u=async e=>Q(await a({path:re(e.path,n)})),t[6]=n,t[7]=a,t[8]=u):u=t[8];let d=u,f;return t[9]!==d||t[10]!==l||t[11]!==s?(f={renameFile:s,duplicateFile:l,deleteFile:d},t[9]=d,t[10]=l,t[11]=s,t[12]=f):f=t[12],f}var Ua={file:`Delete file`,folder:`Delete folder`,notebook:`Delete notebook`};function Wa(){let e=(0,Z.c)(2),{openConfirm:t}=ee(),n;return e[0]===t?n=e[1]:(n=(e,n)=>{let r=e.kind??`file`;t({title:Ua[r],description:`Are you sure you want to delete ${e.name}?`,confirmAction:(0,w.jsx)(c,{onClick:async()=>{await n()},"aria-label":`Confirm`,children:`Delete`})})},e[0]=t,e[1]=n),n}function Ga(e){let t=(0,Z.c)(17),{node:n,root:i,onAfterChange:a}=e,o;t[0]===i?o=t[1]:(o={root:i},t[0]=i,t[1]=o);let{duplicateFile:s,deleteFile:c}=Ha(o),l=Wa(),u;t[2]===n?u=t[3]:(u=()=>{n.edit()},t[2]=n,t[3]=u);let d=r(u),f;t[4]!==s||t[5]!==n.data||t[6]!==a?(f=async()=>{await s(n.data)&&a?.()},t[4]=s,t[5]=n.data,t[6]=a,t[7]=f):f=t[7];let p=r(f),m;t[8]!==l||t[9]!==c||t[10]!==n.data||t[11]!==a?(m=()=>{let e=n.data.isDirectory?`folder`:n.data.isMarimoFile?`notebook`:`file`;l({name:n.data.name,kind:e},async()=>{await c(n.data)&&a?.()})},t[8]=l,t[9]=c,t[10]=n.data,t[11]=a,t[12]=m):m=t[12];let h=r(m),g;return t[13]!==h||t[14]!==p||t[15]!==d?(g={handleRename:d,handleDuplicate:p,handleDelete:h},t[13]=h,t[14]=p,t[15]=d,t[16]=g):g=t[16],g}var Ka=e=>{let t=(0,Z.c)(15),{testId:n,buttonClassName:r,iconClassName:i,contentClassName:a,preventDefaultOnTrigger:o,children:s}=e,c=o!==void 0&&o,l;t[0]===c?l=t[1]:(l=e=>{e.stopPropagation(),c&&e.preventDefault()},t[0]=c,t[1]=l);let u;t[2]!==r||t[3]!==i||t[4]!==n?(u=(0,w.jsx)(g,{"data-testid":n,className:r,iconClassName:i}),t[2]=r,t[3]=i,t[4]=n,t[5]=u):u=t[5];let m;t[6]!==l||t[7]!==u?(m=(0,w.jsx)(d,{asChild:!0,tabIndex:-1,onClick:l,children:u}),t[6]=l,t[7]=u,t[8]=m):m=t[8];let h=a??`print:hidden w-[220px]`,_;t[9]!==s||t[10]!==h?(_=(0,w.jsx)(f,{align:`end`,className:h,onClick:Xa,onCloseAutoFocus:Za,children:s}),t[9]=s,t[10]=h,t[11]=_):_=t[11];let v;return t[12]!==m||t[13]!==_?(v=(0,w.jsxs)(p,{modal:!1,children:[m,_]}),t[12]=m,t[13]=_,t[14]=v):v=t[14],v},qa=e=>{let t=(0,Z.c)(6),{onSelect:n,disabled:r,title:i,testId:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,w.jsx)(oe,{className:_}),t[0]=o):o=t[0];let s;return t[1]!==r||t[2]!==n||t[3]!==a||t[4]!==i?(s=(0,w.jsxs)(u,{onSelect:n,disabled:r,title:i,"data-testid":a,children:[o,`Rename`]}),t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=s):s=t[5],s},Ja=e=>{let t=(0,Z.c)(6),{onSelect:n,disabled:r,title:i,testId:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,w.jsx)(v,{className:_}),t[0]=o):o=t[0];let s;return t[1]!==r||t[2]!==n||t[3]!==a||t[4]!==i?(s=(0,w.jsxs)(u,{onSelect:n,disabled:r,title:i,"data-testid":a,children:[o,`Duplicate`]}),t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=s):s=t[5],s},Ya=e=>{let t=(0,Z.c)(6),{onSelect:n,disabled:r,title:i,testId:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,w.jsx)(y,{className:_}),t[0]=o):o=t[0];let s;return t[1]!==r||t[2]!==n||t[3]!==a||t[4]!==i?(s=(0,w.jsxs)(u,{onSelect:n,variant:`danger`,disabled:r,title:i,"data-testid":a,children:[o,`Delete`]}),t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=s):s=t[5],s};function Xa(e){return e.stopPropagation()}function Za(e){return e.preventDefault()}var Qa=e=>{let t=(0,Z.c)(10),{node:n}=e,r=(0,C.useRef)(null),i,a;t[0]===n.data.name?(i=t[1],a=t[2]):(i=()=>{r.current?.focus();let e=n.data.name,t=e.lastIndexOf(`.`),i=t>0?t:e.length;r.current?.setSelectionRange(0,i)},a=[n.data.name],t[0]=n.data.name,t[1]=i,t[2]=a),(0,C.useEffect)(i,a);let o,s;t[3]===n?(o=t[4],s=t[5]):(o=()=>n.reset(),s=e=>{e.key===`Escape`&&n.reset(),e.key===`Enter`&&n.submit(e.currentTarget.value)},t[3]=n,t[4]=o,t[5]=s);let c;return t[6]!==n.data.name||t[7]!==o||t[8]!==s?(c=(0,w.jsx)(`input`,{ref:r,className:`flex-1 bg-transparent border border-border text-muted-foreground`,defaultValue:n.data.name,onClick:$a,onBlur:o,onKeyDown:s}),t[6]=n.data.name,t[7]=o,t[8]=s,t[9]=c):c=t[9],c};function $a(e){return e.stopPropagation()}export{qa as a,Pa as c,N as d,nn as f,Ka as i,Aa as l,Ya as n,Ha as o,Ja as r,Ga as s,Qa as t,yr as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t}from"./useEvent-xfs0Sn4r.js";import{t as n}from"./react-CBDbhulC.js";import{S as r,mt as i}from"./cells-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t}from"./useEvent-xfs0Sn4r.js";import{t as n}from"./react-CBDbhulC.js";import{S as r,mt as i}from"./cells-D4RwofRx.js";import{t as a}from"./compiler-runtime-CYIjoINj.js";import{g as o}from"./useEventListener-D27Dii_l.js";import{E as s}from"./config-D4frVGQ4.js";import{t as c}from"./cn-ldLVeaqm.js";import{t as l}from"./jsx-runtime-B74pBk57.js";var u=a(),d=e(n(),1);function f(){return s()===`edit`?document.getElementById(`App`):void 0}function p(e){let t=(0,u.c)(7),[n,r]=(0,d.useState)(void 0),[a,o]=(0,d.useState)(void 0),s=(0,d.useRef)(null),c=(0,d.useRef)(null),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=new Map,t[0]=l):l=t[0];let p=(0,d.useRef)(l),h,g;t[1]===e?(h=t[2],g=t[3]):(h=()=>e.length===0?void 0:(s.current=new IntersectionObserver(e=>{let t=!1;if(e.forEach(e=>{let n=e.target;e.isIntersecting?(!c.current||n.getBoundingClientRect().top<c.current.getBoundingClientRect().top)&&(c.current=n,t=!0):n===c.current&&(c.current=null,t=!0)}),t&&c.current){let e=i(c.current),t=`id`in e?e.id:e.path;r(t),o(p.current.get(c.current))}},{root:f(),rootMargin:`0px`,threshold:0}),e.forEach(t=>{if(t){let n=i(t[0]),r=e.map(m).filter(e=>`id`in n?e.id===n.id:e.textContent===t[0].textContent).indexOf(t[0]);p.current.set(t[0],r),s.current?.observe(t[0])}}),()=>{s.current&&s.current.disconnect(),c.current=null}),g=[e],t[1]=e,t[2]=h,t[3]=g),(0,d.useEffect)(h,g);let _;return t[4]!==n||t[5]!==a?(_={activeHeaderId:n,activeOccurrences:a},t[4]=n,t[5]=a,t[6]=_):_=t[6],_}function m(e){let[t]=e;return t}function h(e){if(e.length===0)return[];let t=new Map;return e.map(e=>{let n=`id`in e.by?e.by.id:e.by.path,r=t.get(n)??0;t.set(n,r+1);let i=_(e,r);return i?[i,n]:null}).filter(Boolean)}function g(e,t){let n=_(e,t);if(!n){o.warn(`Could not find element for outline item`,e);return}n.scrollIntoView({behavior:`smooth`,block:`start`}),n.classList.add(`outline-item-highlight`),setTimeout(()=>{n.classList.remove(`outline-item-highlight`)},3e3)}function _(e,t){return`id`in e.by?document.querySelectorAll(`[id="${CSS.escape(e.by.id)}"]`)[t]:document.evaluate(e.by.path,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}var v=l(),y=()=>{let e=(0,u.c)(19),{items:n}=t(r),i;e[0]===n?i=e[1]:(i=h(n),e[0]=n,e[1]=i);let{activeHeaderId:a,activeOccurrences:o}=p(i),[s,l]=d.useState(!1);if(n.length<2)return null;let f,m,g;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>l(!0),m=()=>l(!1),g=c(`fixed top-[25vh] right-8 z-10000 print:hidden`,`hidden md:block`),e[2]=f,e[3]=m,e[4]=g):(f=e[2],m=e[3],g=e[4]);let _=s?`left-[-280px] opacity-100`:`left-[300px] opacity-0`,y;e[5]===_?y=e[6]:(y=c(`-top-4 max-h-[70vh] bg-background rounded-lg shadow-lg absolute overflow-auto transition-all duration-300 w-[300px] border`,_),e[5]=_,e[6]=y);let S;e[7]!==a||e[8]!==o||e[9]!==n||e[10]!==y?(S=(0,v.jsx)(x,{className:y,items:n,activeHeaderId:a,activeOccurrences:o}),e[7]=a,e[8]=o,e[9]=n,e[10]=y,e[11]=S):S=e[11];let C;e[12]!==a||e[13]!==o||e[14]!==n?(C=(0,v.jsx)(b,{items:n,activeHeaderId:a,activeOccurrences:o}),e[12]=a,e[13]=o,e[14]=n,e[15]=C):C=e[15];let w;return e[16]!==S||e[17]!==C?(w=(0,v.jsxs)(`div`,{onMouseEnter:f,onMouseLeave:m,className:g,children:[S,C]}),e[16]=S,e[17]=C,e[18]=w):w=e[18],w},b=e=>{let t=(0,u.c)(8),{items:n,activeHeaderId:r,activeOccurrences:i}=e,a,o;if(t[0]!==r||t[1]!==i||t[2]!==n){let e=new Map;a=`flex flex-col gap-4 items-end max-h-[70vh] overflow-hidden`,o=n.map((t,n)=>{let a=`id`in t.by?t.by.id:t.by.path,o=e.get(a)??0;return e.set(a,o+1),(0,v.jsx)(`div`,{className:c(`h-[2px] bg-muted-foreground/60`,t.level===1&&`w-5`,t.level===2&&`w-4`,t.level===3&&`w-3`,t.level===4&&`w-2`,o===i&&r===a&&`bg-foreground`),onClick:()=>g(t,o)},`${a}-${n}`)}),t[0]=r,t[1]=i,t[2]=n,t[3]=a,t[4]=o}else a=t[3],o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,v.jsx)(`div`,{className:a,children:o}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s},x=e=>{let t=(0,u.c)(11),{items:n,activeHeaderId:r,activeOccurrences:i,className:a}=e,o,s;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==n){let e=new Map;t[6]===a?o=t[7]:(o=c(`flex flex-col overflow-auto py-4 pl-2`,a),t[6]=a,t[7]=o),s=n.map((t,n)=>{let a=`id`in t.by?t.by.id:t.by.path,o=e.get(a)??0;e.set(a,o+1);let s=`${a}-${n}`,l={className:c(`px-2 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l`,t.level===1&&`font-semibold`,t.level===2&&`ml-3`,t.level===3&&`ml-6`,t.level===4&&`ml-9`,o===i&&r===a&&`text-accent-foreground`),onClick:()=>g(t,o)};return t.html?(0,v.jsx)(`div`,{...l,dangerouslySetInnerHTML:{__html:t.html}},s):(0,v.jsx)(`div`,{...l,children:t.name},s)}),t[0]=r,t[1]=i,t[2]=a,t[3]=n,t[4]=o,t[5]=s}else o=t[4],s=t[5];let l;return t[8]!==o||t[9]!==s?(l=(0,v.jsx)(`div`,{className:o,children:s}),t[8]=o,t[9]=s,t[10]=l):l=t[10],l};export{p as i,x as n,h as r,y as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,t as n,u as r}from"./useEvent-xfs0Sn4r.js";import{t as i}from"./react-CBDbhulC.js";import{Co as a,Kn as o,Qi as s,Wi as c,ea as l,ii as u,la as d,na as f,ua as p}from"./cells-BEcungGa.js";import{t as m}from"./compiler-runtime-CYIjoINj.js";import{_ as h}from"./useEventListener-D27Dii_l.js";import{t as g}from"./objects-snlMn4yk.js";import{n as _}from"./constants-BDbGiS7O.js";import{P as v}from"./config-D4frVGQ4.js";import{t as y}from"./ErrorBoundary-npvnLp9x.js";import{t as b}from"./cn-ldLVeaqm.js";import{t as x}from"./jsx-runtime-B74pBk57.js";import{o as S}from"./alert-dialog-BVi_GyOB.js";import{d as C}from"./select-czJLm6jf.js";import{a as w,c as T,p as E,r as D,t as O}from"./dropdown-menu-CqNabM1f.js";import{t as k}from"./tooltip-D7dq6bnc.js";import{t as A}from"./button-Btj6GXNy.js";import{r as j}from"./requests-C6_IaFh7.js";import{t as M}from"./createLucideIcon-B7HeEoG2.js";import{t as N}from"./chart-no-axes-column-ChZdjJhj.js";import{a as P}from"./useNumberFormatter-DHJ9s6Vk.js";import{t as F}from"./chevron-right-CKA5zVsM.js";import{o as I,s as L}from"./tree-actions-CjTwlxy1.js";import{t as R}from"./circle-play-CQiat61_.js";import{t as z}from"./external-link-Bp3BxyRA.js";import{r as B,t as V}from"./file-icons-D18ZIT8U.js";import{t as H}from"./file-DF8n85RA.js";import{n as U,r as ee,t as te}from"./youtube-DCJ-ihUU.js";import{b as ne}from"./write-secret-modal-lNU_7c2x.js";import{t as re}from"./link-Cap-MZiw.js";import{t as W}from"./spinner-Ck-Hgfvj.js";import{t as ie}from"./package-DPlscLzt.js";import{a as ae,i as oe,l as se,n as ce,o as le,r as ue,s as de,t as fe}from"./file-name-input-Dp8aYmEH.js";import{n as pe,r as me,t as he}from"./app-config-button-CHcCBh-B.js";import{Wt as ge,r as _e}from"./input-Daz6sk8l.js";import{t as G}from"./use-toast-DpWHUGuF.js";import{n as ve}from"./paths-zcL04qUW.js";import{c as ye,n as be,o as xe,t as Se}from"./session-CEdta5_Q.js";import{t as Ce}from"./context-Do8M9TDF.js";import{n as K,t as we}from"./useAsyncData-Buhk-UgR.js";import{s as Te}from"./dates-DK5JikJo.js";import{a as Ee}from"./errors-DzO-nXy-.js";import{n as De}from"./react-icons.esm-hr79-MCS.js";import{t as Oe}from"./error-banner-BYN8YUMe.js";import{t as q}from"./icons-CjLa9BiH.js";import{t as ke}from"./github-YRgb6LMu.js";import{n as Ae}from"./marimo-icons-C3KxMV9A.js";import{t as je}from"./links-DPh7yoP-.js";import{t as Me}from"./useInterval-B1_J4wdT.js";var Ne=M(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Pe=M(`book-text`,[[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}],[`path`,{d:`M8 11h8`,key:`vwpz6n`}],[`path`,{d:`M8 7h6`,key:`1f0q6e`}]]),Fe=M(`graduation-cap`,[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]),Ie=M(`orbit`,[[`path`,{d:`M20.341 6.484A10 10 0 0 1 10.266 21.85`,key:`1enhxb`}],[`path`,{d:`M3.659 17.516A10 10 0 0 1 13.74 2.152`,key:`1crzgf`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`circle`,{cx:`19`,cy:`5`,r:`2`,key:`mhkx31`}],[`circle`,{cx:`5`,cy:`19`,r:`2`,key:`v8kfzx`}]]),Le=M(`panels-top-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]]),J=e(i(),1),Y=m(),X=x(),Re={intro:[`Introduction`,Ne,`Get started with marimo basics`],dataflow:[`Dataflow`,p,`Learn how cells interact with each other`],ui:[`UI Elements`,Le,`Create interactive UI components`],markdown:[`Markdown`,s,`Format text with parameterized markdown`],plots:[`Plots`,N,`Create interactive visualizations`],sql:[`SQL`,l,`Query databases directly in marimo`],layout:[`Layout`,ee,`Customize the layout of your cells' output`],fileformat:[`File format`,H,`Understand marimo's pure-Python file format`],"external-dependencies":[`External dependencies`,ie,`Declare dependencies with Python script metadata`],"for-jupyter-users":[`For Jupyter users`,Ie,`Transiting from Jupyter to marimo`],"markdown-format":[`Markdown format`,q,`Using marimo to edit markdown files`]},ze=()=>{let e=(0,Y.c)(6),{openTutorial:t}=j(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(Fe,{className:`w-4 h-4 mr-2`}),e[0]=n):n=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(E,{asChild:!0,children:(0,X.jsxs)(A,{"data-testid":`open-tutorial-button`,size:`xs`,variant:`outline`,children:[n,`Tutorials`,(0,X.jsx)(De,{className:`w-3 h-3 ml-1`})]})}),e[1]=r):r=e[1];let i;e[2]===t?i=e[3]:(i=g.entries(Re).map(e=>{let[n,r]=e,[i,a,o]=r;return(0,X.jsxs)(w,{onSelect:async()=>{let e=await t({tutorialId:n});e&&je(e.path)},children:[(0,X.jsx)(a,{strokeWidth:1.5,className:`w-4 h-4 mr-3 self-start mt-1.5 text-muted-foreground`}),(0,X.jsx)(`div`,{className:`flex items-center`,children:(0,X.jsxs)(`div`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{children:i}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground pr-1`,children:o})]})})]},n)}),e[2]=t,e[3]=i);let a;return e[4]===i?a=e[5]:(a=(0,X.jsxs)(O,{children:[r,(0,X.jsx)(D,{side:`bottom`,align:`end`,className:`print:hidden`,children:i})]}),e[4]=i,e[5]=a),a},Be=[{title:`Documentation`,description:`Official marimo documentation and API reference`,icon:d,url:_.docsPage},{title:`GitHub`,description:`View source code, report issues, or contribute`,icon:ke,url:_.githubPage},{title:`Community`,description:`Join the marimo Discord community`,icon:U,url:_.discordLink},{title:`molab`,description:`Run marimo notebooks in the cloud`,icon:Ae,url:_.molab},{title:`YouTube`,description:`Watch tutorials and demos`,icon:te,url:_.youtube},{title:`Changelog`,description:`See what's new in marimo`,icon:s,url:_.releasesPage}],Ve=()=>{let e=(0,Y.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(Z,{Icon:re,children:`Resources`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[t,(0,X.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:Be.map(He)})]}),e[1]=n):n=e[1],n},Z=e=>{let t=(0,Y.c)(8),{Icon:n,control:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,X.jsx)(n,{className:`h-5 w-5`}),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==a?(o=(0,X.jsxs)(`h2`,{className:`flex items-center gap-2 text-xl font-semibold text-muted-foreground select-none`,children:[a,i]}),t[2]=i,t[3]=a,t[4]=o):o=t[4];let s;return t[5]!==r||t[6]!==o?(s=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[o,r]}),t[5]=r,t[6]=o,t[7]=s):s=t[7],s};function He(e){return(0,X.jsxs)(`a`,{href:e.url,target:`_blank`,className:`flex items-start gap-3 py-3 px-3 rounded-lg border hover:bg-accent/20 transition-colors shadow-xs`,children:[(0,X.jsx)(e.icon,{className:`w-5 h-5 mt-1.5 text-primary`}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`font-medium`,children:e.title}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description})]})]},e.title)}var Q=J.createContext({runningNotebooks:new Map,setRunningNotebooks:h.NOOP}),$=J.createContext({root:``,refreshWorkspace:h.NOOP}),Ue=a(`marimo:home:include-markdown`,!1,u,{getOnInit:!0}),We=a(`marimo:home:expanded-folders`,{},u,{getOnInit:!0});function Ge(e){return`${Se()}-${encodeURIComponent(e)}`}var Ke=()=>{let e=(0,Y.c)(58),[t,n]=(0,J.useState)(0),{getRecentFiles:r,getRunningNotebooks:i}=j(),a;e[0]===r?a=e[1]:(a=()=>r(),e[0]=r,e[1]=a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],e[2]=o):o=e[2];let s=K(a,o),c,l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{n(rt)},l={delayMs:1e4,whenVisible:!0},e[3]=c,e[4]=l):(c=e[3],l=e[4]),Me(c,l);let u;e[5]===i?u=e[6]:(u=async()=>{let e=await i();return I.keyBy(e.files,it)},e[5]=i,e[6]=u);let d;e[7]===t?d=e[8]:(d=[t],e[7]=t,e[8]=d);let p=K(u,d),m,h,g,_,v,b,x,S,C,w,T,E,D;if(e[9]!==s||e[10]!==p){C=Symbol.for(`react.early_return_sentinel`);bb0:{let t=we(s,p);if(t.error)throw t.error;let n=t.data;if(!n){let t;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(W,{centered:!0,size:`xlarge`}),e[24]=t):t=e[24],C=t;break bb0}let[r,i]=n;_=r,g=J.Suspense,h=Q,x={runningNotebooks:i,setRunningNotebooks:p.setData};let a,o;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(ze,{}),o=(0,X.jsx)(he,{showAppConfig:!1}),e[25]=a,e[26]=o):(a=e[25],o=e[26]);let c=`This will shutdown the notebook server and terminate all running notebooks (${i.size}). You'll lose all data that's in memory.`;e[27]===c?S=e[28]:(S=(0,X.jsxs)(`div`,{className:`absolute top-3 right-5 flex gap-3 z-50`,children:[a,o,(0,X.jsx)(pe,{description:c})]}),e[27]=c,e[28]=S),E=`flex flex-col gap-6 max-w-6xl container pt-5 pb-20 z-10`,e[29]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,X.jsx)(`img`,{src:`logo.png`,alt:`marimo logo`,className:`w-48 mb-2`}),v=(0,X.jsx)(nt,{}),b=(0,X.jsx)(Ve,{}),e[29]=v,e[30]=b,e[31]=D):(v=e[29],b=e[30],D=e[31]),m=$e,e[32]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,X.jsx)(Z,{Icon:R,children:`Running notebooks`}),e[32]=w):w=e[32],T=[...i.values()]}e[9]=s,e[10]=p,e[11]=m,e[12]=h,e[13]=g,e[14]=_,e[15]=v,e[16]=b,e[17]=x,e[18]=S,e[19]=C,e[20]=w,e[21]=T,e[22]=E,e[23]=D}else m=e[11],h=e[12],g=e[13],_=e[14],v=e[15],b=e[16],x=e[17],S=e[18],C=e[19],w=e[20],T=e[21],E=e[22],D=e[23];if(C!==Symbol.for(`react.early_return_sentinel`))return C;let O;e[33]!==m||e[34]!==w||e[35]!==T?(O=(0,X.jsx)(m,{header:w,files:T}),e[33]=m,e[34]=w,e[35]=T,e[36]=O):O=e[36];let k;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsx)(Z,{Icon:f,children:`Recent notebooks`}),e[37]=k):k=e[37];let A;e[38]===_.files?A=e[39]:(A=(0,X.jsx)($e,{header:k,files:_.files}),e[38]=_.files,e[39]=A);let M;e[40]===s.refetch?M=e[41]:(M=(0,X.jsx)(y,{children:(0,X.jsx)(qe,{onRefreshRecents:s.refetch})}),e[40]=s.refetch,e[41]=M);let N;e[42]!==v||e[43]!==b||e[44]!==O||e[45]!==A||e[46]!==M||e[47]!==E||e[48]!==D?(N=(0,X.jsxs)(`div`,{className:E,children:[D,v,b,O,A,M]}),e[42]=v,e[43]=b,e[44]=O,e[45]=A,e[46]=M,e[47]=E,e[48]=D,e[49]=N):N=e[49];let P;e[50]!==h||e[51]!==x||e[52]!==S||e[53]!==N?(P=(0,X.jsxs)(h,{value:x,children:[S,N]}),e[50]=h,e[51]=x,e[52]=S,e[53]=N,e[54]=P):P=e[54];let F;return e[55]!==g||e[56]!==P?(F=(0,X.jsx)(g,{children:P}),e[55]=g,e[56]=P,e[57]=F):F=e[57],F},qe=e=>{let r=(0,Y.c)(54),{onRefreshRecents:i}=e,{getWorkspaceFiles:a}=j(),[s,l]=t(Ue),[u,d]=(0,J.useState)(``),f;r[0]!==a||r[1]!==s?(f=()=>a({includeMarkdown:s}),r[0]=a,r[1]=s,r[2]=f):f=r[2];let p;r[3]===s?p=r[4]:(p=[s],r[3]=s,r[4]=p);let{isPending:m,data:h,error:g,isFetching:_,refetch:v}=K(f,p),y;r[5]!==i||r[6]!==v?(y=()=>{v(),i()},r[5]=i,r[6]=v,r[7]=y):y=r[7];let b=n(y);h?.root;let x=h?.root??``,S;r[8]!==b||r[9]!==x?(S={root:x,refreshWorkspace:b},r[8]=b,r[9]=x,r[10]=S):S=r[10];let w=S;if(m){let e;return r[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(W,{centered:!0,size:`xlarge`,className:`mt-6`}),r[11]=e):e=r[11],e}if(g){let e;r[12]===g?e=r[13]:(e=Ee(g),r[12]=g,r[13]=e);let t;return r[14]===e?t=r[15]:(t=(0,X.jsx)(Oe,{kind:`danger`,className:`rounded p-4`,children:e}),r[14]=e,r[15]=t),t}let T;r[16]!==h.fileCount||r[17]!==h.hasMore?(T=h.hasMore&&(0,X.jsxs)(Oe,{kind:`warn`,className:`rounded p-4`,children:[`Showing first `,h.fileCount,` files. Your workspace has more files.`]}),r[16]=h.fileCount,r[17]=h.hasMore,r[18]=T):T=r[18];let E,D;r[19]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(ge,{size:13}),D=e=>d(e.target.value),r[19]=E,r[20]=D):(E=r[19],D=r[20]);let O;r[21]===u?O=r[22]:(O=(0,X.jsx)(_e,{id:`search`,value:u,icon:E,onChange:D,placeholder:`Search`,className:`mb-0 border-border`}),r[21]=u,r[22]=O);let k;r[23]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsx)(Je,{}),r[23]=k):k=r[23];let M;r[24]===l?M=r[25]:(M=e=>l(!!e),r[24]=l,r[25]=M);let N;r[26]!==s||r[27]!==M?(N=(0,X.jsx)(o,{"data-testid":`include-markdown-checkbox`,id:`include-markdown`,checked:s,onCheckedChange:M}),r[26]=s,r[27]=M,r[28]=N):N=r[28];let P;r[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,X.jsx)(C,{htmlFor:`include-markdown`,children:`Include markdown`}),r[29]=P):P=r[29];let F;r[30]!==N||r[31]!==O?(F=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[O,k,N,P]}),r[30]=N,r[31]=O,r[32]=F):F=r[32];let I;r[33]===v?I=r[34]:(I=()=>v(),r[33]=v,r[34]=I);let L;r[35]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsx)(c,{className:`w-4 h-4`}),r[35]=L):L=r[35];let R;r[36]===I?R=r[37]:(R=(0,X.jsx)(A,{variant:`text`,size:`icon`,className:`w-4 h-4 ml-1 p-0 opacity-70 hover:opacity-100`,onClick:I,"aria-label":`Refresh workspace`,children:L}),r[36]=I,r[37]=R);let z;r[38]===_?z=r[39]:(z=_&&(0,X.jsx)(W,{size:`small`}),r[38]=_,r[39]=z);let B;r[40]!==F||r[41]!==R||r[42]!==z?(B=(0,X.jsxs)(Z,{Icon:Pe,control:F,children:[`Workspace`,R,z]}),r[40]=F,r[41]=R,r[42]=z,r[43]=B):B=r[43];let V;r[44]!==u||r[45]!==h.files?(V=(0,X.jsx)(`div`,{className:`flex flex-col divide-y divide-(--slate-3) border rounded overflow-hidden max-h-192 overflow-y-auto shadow-sm bg-background`,children:(0,X.jsx)(Ye,{searchText:u,files:h.files})}),r[44]=u,r[45]=h.files,r[46]=V):V=r[46];let H;r[47]!==B||r[48]!==V||r[49]!==T?(H=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[T,B,V]}),r[47]=B,r[48]=V,r[49]=T,r[50]=H):H=r[50];let U;return r[51]!==H||r[52]!==w?(U=(0,X.jsx)($,{value:w,children:H}),r[51]=H,r[52]=w,r[53]=U):U=r[53],U},Je=()=>{let e=(0,Y.c)(5),t=r(We),n;e[0]===t?n=e[1]:(n=()=>{t({})},e[0]=t,e[1]=n);let i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(L,{className:`w-4 h-4 mr-1`}),e[2]=i):i=e[2];let a;return e[3]===n?a=e[4]:(a=(0,X.jsxs)(A,{variant:`text`,size:`sm`,className:`h-fit hidden sm:flex`,onClick:n,children:[i,`Collapse all`]}),e[3]=n,e[4]=a),a},Ye=e=>{let r=(0,Y.c)(22),{files:i,searchText:a}=e,[o,s]=t(We),c;r[0]===o?c=r[1]:(c=Object.keys(o),r[0]=o,r[1]=c);let l=c.length===0,u=(0,J.useRef)(void 0),{root:d,refreshWorkspace:f}=(0,J.use)($),p;r[2]===d?p=r[3]:(p={root:d},r[2]=d,r[3]=p);let{renameFile:m}=le(p),h,g;r[4]===l?(h=r[5],g=r[6]):(h=()=>{l&&u.current?.closeAll()},g=[l],r[4]=l,r[5]=h,r[6]=g),(0,J.useEffect)(h,g);let _;r[7]!==f||r[8]!==m?(_=async(e,t)=>{let n=u.current?.get(e);if(!n){G({title:`Failed`,description:`Node with id ${e} not found in the tree`});return}await m(n.data,t)&&f()},r[7]=f,r[8]=m,r[9]=_):_=r[9];let v=n(_);if(i.length===0){let e;return r[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`flex flex-col px-5 py-10 items-center justify-center`,children:(0,X.jsx)(`p`,{className:`text-center text-muted-foreground`,children:`No files in this workspace`})}),r[10]=e):e=r[10],e}let y;r[11]!==o||r[12]!==s?(y=async e=>{let t=o[e]??!1;s({...o,[e]:!t})},r[11]=o,r[12]=s,r[13]=y):y=r[13];let b;r[14]===v?b=r[15]:(b=async e=>{let{id:t,name:n}=e;await v(t,n)},r[14]=v,r[15]=b);let x;return r[16]!==i||r[17]!==o||r[18]!==a||r[19]!==y||r[20]!==b?(x=(0,X.jsx)(se,{ref:u,width:`100%`,height:500,searchTerm:a,className:`h-full`,idAccessor:at,data:i,openByDefault:!1,initialOpenState:o,onToggle:y,onRename:b,padding:5,rowHeight:35,indent:15,overscanCount:1e3,renderCursor:ot,disableDrop:!0,disableDrag:!0,disableMultiSelection:!0,children:Xe}),r[16]=i,r[17]=o,r[18]=a,r[19]=y,r[20]=b,r[21]=x):x=r[21],x},Xe=e=>{let t=(0,Y.c)(18),{node:n,style:r}=e,i=n.data.isDirectory?`directory`:B(n.data.name),a=V[i],o;t[0]===a?o=t[1]:(o=(0,X.jsx)(a,{className:`w-5 h-5 shrink-0`,strokeWidth:1.5}),t[0]=a,t[1]=o);let s=o,{root:c}=(0,J.use)($),{runningNotebooks:l}=(0,J.use)(Q),u;t[2]!==s||t[3]!==n||t[4]!==c||t[5]!==l?(u=()=>{if(n.isEditing)return(0,X.jsxs)(`div`,{className:`flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2`,children:[s,(0,X.jsx)(fe,{node:n})]});if(n.data.isDirectory)return(0,X.jsxs)(`span`,{className:`flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2`,children:[s,n.data.name]});let e=n.data.path.startsWith(c)&&ve.isAbsolute(n.data.path)?ve.rest(n.data.path,c):n.data.path,t=e.endsWith(`.md`)||e.endsWith(`.qmd`),r=l.has(e);return(0,X.jsxs)(`a`,{className:`flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2`,href:ye(`?file=${encodeURIComponent(e)}`).toString(),target:Ge(e),children:[s,(0,X.jsxs)(`span`,{className:`flex-1 overflow-hidden text-ellipsis`,children:[n.data.name,t&&(0,X.jsx)(q,{className:`ml-2 inline opacity-80`})]}),(0,X.jsx)(Ze,{node:n,isRunning:r}),(0,X.jsx)(`div`,{className:`w-8 h-8 flex items-center justify-center shrink-0`,children:(0,X.jsx)(tt,{filePath:e})}),(0,X.jsx)(z,{size:20,className:`group-hover:opacity-100 opacity-0 text-primary shrink-0`})]})},t[2]=s,t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d=u,f;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=b(`flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group h-full`),t[7]=f):f=t[7];let p,m;t[8]===n?(p=t[9],m=t[10]):(p=e=>{e.stopPropagation(),n.data.isDirectory&&n.toggle()},m=(0,X.jsx)(Qe,{node:n}),t[8]=n,t[9]=p,t[10]=m);let h;t[11]===d?h=t[12]:(h=d(),t[11]=d,t[12]=h);let g;return t[13]!==r||t[14]!==p||t[15]!==m||t[16]!==h?(g=(0,X.jsxs)(`div`,{style:r,className:f,onClick:p,children:[m,h]}),t[13]=r,t[14]=p,t[15]=m,t[16]=h,t[17]=g):g=t[17],g},Ze=e=>{let t=(0,Y.c)(19),{node:n,isRunning:r}=e,{root:i,refreshWorkspace:a}=(0,J.use)($),o;t[0]!==n||t[1]!==a||t[2]!==i?(o={node:n,root:i,onAfterChange:a},t[0]=n,t[1]=a,t[2]=i,t[3]=o):o=t[3];let{handleRename:s,handleDuplicate:c,handleDelete:l}=de(o),u=r?`Stop the notebook's kernel before renaming or deleting.`:void 0,d;t[4]!==s||t[5]!==r||t[6]!==u?(d=(0,X.jsx)(ae,{onSelect:s,disabled:r,title:u}),t[4]=s,t[5]=r,t[6]=u,t[7]=d):d=t[7];let f;t[8]===c?f=t[9]:(f=(0,X.jsx)(ue,{onSelect:c}),t[8]=c,t[9]=f);let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(T,{}),t[10]=p):p=t[10];let m;t[11]!==l||t[12]!==r||t[13]!==u?(m=(0,X.jsx)(ce,{onSelect:l,disabled:r,title:u}),t[11]=l,t[12]=r,t[13]=u,t[14]=m):m=t[14];let h;return t[15]!==d||t[16]!==f||t[17]!==m?(h=(0,X.jsxs)(oe,{testId:`workspace-more-button`,buttonClassName:`w-8 h-8 p-0 shrink-0`,contentClassName:`print:hidden w-fit min-w-[140px]`,preventDefaultOnTrigger:!0,children:[d,f,p,m]}),t[15]=d,t[16]=f,t[17]=m,t[18]=h):h=t[18],h},Qe=e=>{let t=(0,Y.c)(3),{node:n}=e;if(!n.data.isDirectory){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`span`,{className:`w-5 h-5 shrink-0`}),t[0]=e):e=t[0],e}let r;return t[1]===n.isOpen?r=t[2]:(r=n.isOpen?(0,X.jsx)(P,{className:`w-5 h-5 shrink-0`}):(0,X.jsx)(F,{className:`w-5 h-5 shrink-0`}),t[1]=n.isOpen,t[2]=r),r},$e=e=>{let t=(0,Y.c)(7),{header:n,files:r}=e;if(r.length===0)return null;let i;t[0]===r?i=t[1]:(i=r.map(st),t[0]=r,t[1]=i);let a;t[2]===i?a=t[3]:(a=(0,X.jsx)(`div`,{className:`flex flex-col divide-y divide-(--slate-3) border rounded overflow-hidden max-h-192 overflow-y-auto shadow-sm bg-background`,children:i}),t[2]=i,t[3]=a);let o;return t[4]!==n||t[5]!==a?(o=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[n,a]}),t[4]=n,t[5]=a,t[6]=o):o=t[6],o},et=e=>{let t=(0,Y.c)(41),{file:n}=e,{locale:r}=Ce(),i;t[0]===n.path?i=t[1]:(i=be(n.path),t[0]=n.path,t[1]=i);let a=i,o,s,c,l;if(t[2]!==n.initializationId||t[3]!==n.path||t[4]!==a){let e=ye(a?`?file=${encodeURIComponent(n.initializationId??n.path)}&session_id=${n.path}`:`?file=${encodeURIComponent(n.path)}`),r;t[9]===n.path?r=t[10]:(r=n.path.endsWith(`.md`),t[9]=n.path,t[10]=r),o=r,s=`py-1.5 px-4 hover:bg-(--blue-2) hover:text-primary transition-all duration-300 cursor-pointer group relative flex gap-4 items-center`,c=n.path,l=e.toString(),t[2]=n.initializationId,t[3]=n.path,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l}else o=t[5],s=t[6],c=t[7],l=t[8];let u=n.initializationId||n.path,d;t[11]===u?d=t[12]:(d=Ge(u),t[11]=u,t[12]=d);let f;t[13]===o?f=t[14]:(f=o&&(0,X.jsx)(`span`,{className:`opacity-80`,children:(0,X.jsx)(q,{})}),t[13]=o,t[14]=f);let p;t[15]!==n.name||t[16]!==f?(p=(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[n.name,f]}),t[15]=n.name,t[16]=f,t[17]=p):p=t[17];let m;t[18]===n.path?m=t[19]:(m=(0,X.jsx)(`p`,{title:n.path,className:`text-sm text-muted-foreground overflow-hidden whitespace-nowrap text-ellipsis`,children:n.path}),t[18]=n.path,t[19]=m);let h;t[20]!==p||t[21]!==m?(h=(0,X.jsxs)(`div`,{className:`flex flex-col justify-between flex-1`,children:[p,m]}),t[20]=p,t[21]=m,t[22]=h):h=t[22];let g;t[23]===n.path?g=t[24]:(g=(0,X.jsx)(`div`,{children:(0,X.jsx)(tt,{filePath:n.path})}),t[23]=n.path,t[24]=g);let _;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(z,{size:20,className:`group-hover:opacity-100 opacity-0 transition-all duration-300 text-primary`}),t[25]=_):_=t[25];let v;t[26]===g?v=t[27]:(v=(0,X.jsxs)(`div`,{className:`flex gap-3 items-center`,children:[g,_]}),t[26]=g,t[27]=v);let y;t[28]!==n.lastModified||t[29]!==r?(y=!!n.lastModified&&(0,X.jsx)(`div`,{className:`text-xs text-muted-foreground opacity-80`,children:Te(n.lastModified*1e3,r)}),t[28]=n.lastModified,t[29]=r,t[30]=y):y=t[30];let b;t[31]!==v||t[32]!==y?(b=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1 items-end`,children:[v,y]}),t[31]=v,t[32]=y,t[33]=b):b=t[33];let x;return t[34]!==h||t[35]!==b||t[36]!==s||t[37]!==c||t[38]!==l||t[39]!==d?(x=(0,X.jsxs)(`a`,{className:s,href:l,target:d,children:[h,b]},c),t[34]=h,t[35]=b,t[36]=s,t[37]=c,t[38]=l,t[39]=d,t[40]=x):x=t[40],x},tt=e=>{let t=(0,Y.c)(10),{filePath:n}=e,{openConfirm:r,closeModal:i}=ne(),{shutdownSession:a}=j(),{runningNotebooks:o,setRunningNotebooks:s}=(0,J.use)(Q);if(!o.has(n))return null;let c;t[0]!==i||t[1]!==n||t[2]!==r||t[3]!==o||t[4]!==s||t[5]!==a?(c=e=>{e.stopPropagation(),e.preventDefault(),r({title:`Shutdown`,description:`This will terminate the Python kernel. You'll lose all data that's in memory.`,variant:`destructive`,confirmAction:(0,X.jsx)(S,{onClick:()=>{let e=o.get(n);v(e?.sessionId),a({sessionId:e.sessionId}).then(e=>{s(I.keyBy(e.files,ct))}),i(),G({description:`Notebook has been shutdown.`})},"aria-label":`Confirm Shutdown`,children:`Shutdown`})})},t[0]=i,t[1]=n,t[2]=r,t[3]=o,t[4]=s,t[5]=a,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(me,{size:14}),t[7]=l):l=t[7];let u;return t[8]===c?u=t[9]:(u=(0,X.jsx)(k,{content:`Shutdown`,children:(0,X.jsx)(A,{size:`icon`,variant:`outline`,className:`opacity-80 hover:opacity-100 hover:bg-accent text-destructive border-destructive hover:border-destructive hover:text-destructive bg-background hover:bg-(--red-1)`,onClick:c,children:l})}),t[8]=c,t[9]=u),u},nt=()=>{let e=(0,Y.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=xe(),e[0]=t):t=e[0];let n=t,r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Create a new notebook`}),e[1]=r):r=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsxs)(`a`,{className:`relative rounded-lg p-6 group
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,t as n,u as r}from"./useEvent-xfs0Sn4r.js";import{t as i}from"./react-CBDbhulC.js";import{Co as a,Kn as o,Qi as s,Wi as c,ea as l,ii as u,la as d,na as f,ua as p}from"./cells-D4RwofRx.js";import{t as m}from"./compiler-runtime-CYIjoINj.js";import{_ as h}from"./useEventListener-D27Dii_l.js";import{t as g}from"./objects-snlMn4yk.js";import{n as _}from"./constants-BDbGiS7O.js";import{P as v}from"./config-D4frVGQ4.js";import{t as y}from"./ErrorBoundary-npvnLp9x.js";import{t as b}from"./cn-ldLVeaqm.js";import{t as x}from"./jsx-runtime-B74pBk57.js";import{o as S}from"./alert-dialog-BVi_GyOB.js";import{d as C}from"./select-czJLm6jf.js";import{a as w,c as T,p as E,r as D,t as O}from"./dropdown-menu-CqNabM1f.js";import{t as k}from"./tooltip-D7dq6bnc.js";import{t as A}from"./button-Btj6GXNy.js";import{r as j}from"./requests-C6_IaFh7.js";import{t as M}from"./createLucideIcon-B7HeEoG2.js";import{t as N}from"./chart-no-axes-column-ChZdjJhj.js";import{a as P}from"./useNumberFormatter-DHJ9s6Vk.js";import{t as F}from"./chevron-right-CKA5zVsM.js";import{o as I,s as L}from"./tree-actions-DIfWonCA.js";import{t as R}from"./circle-play-CQiat61_.js";import{t as z}from"./external-link-Bp3BxyRA.js";import{r as B,t as V}from"./file-icons-DgKj9mrV.js";import{t as H}from"./file-DF8n85RA.js";import{n as U,r as ee,t as te}from"./youtube-DCJ-ihUU.js";import{b as ne}from"./write-secret-modal-lNU_7c2x.js";import{t as re}from"./link-Cap-MZiw.js";import{t as W}from"./spinner-Ck-Hgfvj.js";import{t as ie}from"./package-DPlscLzt.js";import{a as ae,i as oe,l as se,n as ce,o as le,r as ue,s as de,t as fe}from"./file-name-input-CQF4Ovwx.js";import{n as pe,r as me,t as he}from"./app-config-button-ktBH1pEB.js";import{Wt as ge,r as _e}from"./input-Daz6sk8l.js";import{t as G}from"./use-toast-DpWHUGuF.js";import{n as ve}from"./paths-zcL04qUW.js";import{c as ye,n as be,o as xe,t as Se}from"./session-CEdta5_Q.js";import{t as Ce}from"./context-Do8M9TDF.js";import{n as K,t as we}from"./useAsyncData-Buhk-UgR.js";import{s as Te}from"./dates-DK5JikJo.js";import{a as Ee}from"./errors-DzO-nXy-.js";import{n as De}from"./react-icons.esm-hr79-MCS.js";import{t as Oe}from"./error-banner-BYN8YUMe.js";import{t as q}from"./icons-CjLa9BiH.js";import{t as ke}from"./github-YRgb6LMu.js";import{n as Ae}from"./marimo-icons-C3KxMV9A.js";import{t as je}from"./links-DPh7yoP-.js";import{t as Me}from"./useInterval-B1_J4wdT.js";var Ne=M(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Pe=M(`book-text`,[[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}],[`path`,{d:`M8 11h8`,key:`vwpz6n`}],[`path`,{d:`M8 7h6`,key:`1f0q6e`}]]),Fe=M(`graduation-cap`,[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]),Ie=M(`orbit`,[[`path`,{d:`M20.341 6.484A10 10 0 0 1 10.266 21.85`,key:`1enhxb`}],[`path`,{d:`M3.659 17.516A10 10 0 0 1 13.74 2.152`,key:`1crzgf`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`circle`,{cx:`19`,cy:`5`,r:`2`,key:`mhkx31`}],[`circle`,{cx:`5`,cy:`19`,r:`2`,key:`v8kfzx`}]]),Le=M(`panels-top-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]]),J=e(i(),1),Y=m(),X=x(),Re={intro:[`Introduction`,Ne,`Get started with marimo basics`],dataflow:[`Dataflow`,p,`Learn how cells interact with each other`],ui:[`UI Elements`,Le,`Create interactive UI components`],markdown:[`Markdown`,s,`Format text with parameterized markdown`],plots:[`Plots`,N,`Create interactive visualizations`],sql:[`SQL`,l,`Query databases directly in marimo`],layout:[`Layout`,ee,`Customize the layout of your cells' output`],fileformat:[`File format`,H,`Understand marimo's pure-Python file format`],"external-dependencies":[`External dependencies`,ie,`Declare dependencies with Python script metadata`],"for-jupyter-users":[`For Jupyter users`,Ie,`Transiting from Jupyter to marimo`],"markdown-format":[`Markdown format`,q,`Using marimo to edit markdown files`]},ze=()=>{let e=(0,Y.c)(6),{openTutorial:t}=j(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(Fe,{className:`w-4 h-4 mr-2`}),e[0]=n):n=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(E,{asChild:!0,children:(0,X.jsxs)(A,{"data-testid":`open-tutorial-button`,size:`xs`,variant:`outline`,children:[n,`Tutorials`,(0,X.jsx)(De,{className:`w-3 h-3 ml-1`})]})}),e[1]=r):r=e[1];let i;e[2]===t?i=e[3]:(i=g.entries(Re).map(e=>{let[n,r]=e,[i,a,o]=r;return(0,X.jsxs)(w,{onSelect:async()=>{let e=await t({tutorialId:n});e&&je(e.path)},children:[(0,X.jsx)(a,{strokeWidth:1.5,className:`w-4 h-4 mr-3 self-start mt-1.5 text-muted-foreground`}),(0,X.jsx)(`div`,{className:`flex items-center`,children:(0,X.jsxs)(`div`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{children:i}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground pr-1`,children:o})]})})]},n)}),e[2]=t,e[3]=i);let a;return e[4]===i?a=e[5]:(a=(0,X.jsxs)(O,{children:[r,(0,X.jsx)(D,{side:`bottom`,align:`end`,className:`print:hidden`,children:i})]}),e[4]=i,e[5]=a),a},Be=[{title:`Documentation`,description:`Official marimo documentation and API reference`,icon:d,url:_.docsPage},{title:`GitHub`,description:`View source code, report issues, or contribute`,icon:ke,url:_.githubPage},{title:`Community`,description:`Join the marimo Discord community`,icon:U,url:_.discordLink},{title:`molab`,description:`Run marimo notebooks in the cloud`,icon:Ae,url:_.molab},{title:`YouTube`,description:`Watch tutorials and demos`,icon:te,url:_.youtube},{title:`Changelog`,description:`See what's new in marimo`,icon:s,url:_.releasesPage}],Ve=()=>{let e=(0,Y.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(Z,{Icon:re,children:`Resources`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[t,(0,X.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:Be.map(He)})]}),e[1]=n):n=e[1],n},Z=e=>{let t=(0,Y.c)(8),{Icon:n,control:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,X.jsx)(n,{className:`h-5 w-5`}),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==a?(o=(0,X.jsxs)(`h2`,{className:`flex items-center gap-2 text-xl font-semibold text-muted-foreground select-none`,children:[a,i]}),t[2]=i,t[3]=a,t[4]=o):o=t[4];let s;return t[5]!==r||t[6]!==o?(s=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[o,r]}),t[5]=r,t[6]=o,t[7]=s):s=t[7],s};function He(e){return(0,X.jsxs)(`a`,{href:e.url,target:`_blank`,className:`flex items-start gap-3 py-3 px-3 rounded-lg border hover:bg-accent/20 transition-colors shadow-xs`,children:[(0,X.jsx)(e.icon,{className:`w-5 h-5 mt-1.5 text-primary`}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`font-medium`,children:e.title}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description})]})]},e.title)}var Q=J.createContext({runningNotebooks:new Map,setRunningNotebooks:h.NOOP}),$=J.createContext({root:``,refreshWorkspace:h.NOOP}),Ue=a(`marimo:home:include-markdown`,!1,u,{getOnInit:!0}),We=a(`marimo:home:expanded-folders`,{},u,{getOnInit:!0});function Ge(e){return`${Se()}-${encodeURIComponent(e)}`}var Ke=()=>{let e=(0,Y.c)(58),[t,n]=(0,J.useState)(0),{getRecentFiles:r,getRunningNotebooks:i}=j(),a;e[0]===r?a=e[1]:(a=()=>r(),e[0]=r,e[1]=a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],e[2]=o):o=e[2];let s=K(a,o),c,l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{n(rt)},l={delayMs:1e4,whenVisible:!0},e[3]=c,e[4]=l):(c=e[3],l=e[4]),Me(c,l);let u;e[5]===i?u=e[6]:(u=async()=>{let e=await i();return I.keyBy(e.files,it)},e[5]=i,e[6]=u);let d;e[7]===t?d=e[8]:(d=[t],e[7]=t,e[8]=d);let p=K(u,d),m,h,g,_,v,b,x,S,C,w,T,E,D;if(e[9]!==s||e[10]!==p){C=Symbol.for(`react.early_return_sentinel`);bb0:{let t=we(s,p);if(t.error)throw t.error;let n=t.data;if(!n){let t;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(W,{centered:!0,size:`xlarge`}),e[24]=t):t=e[24],C=t;break bb0}let[r,i]=n;_=r,g=J.Suspense,h=Q,x={runningNotebooks:i,setRunningNotebooks:p.setData};let a,o;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(ze,{}),o=(0,X.jsx)(he,{showAppConfig:!1}),e[25]=a,e[26]=o):(a=e[25],o=e[26]);let c=`This will shutdown the notebook server and terminate all running notebooks (${i.size}). You'll lose all data that's in memory.`;e[27]===c?S=e[28]:(S=(0,X.jsxs)(`div`,{className:`absolute top-3 right-5 flex gap-3 z-50`,children:[a,o,(0,X.jsx)(pe,{description:c})]}),e[27]=c,e[28]=S),E=`flex flex-col gap-6 max-w-6xl container pt-5 pb-20 z-10`,e[29]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,X.jsx)(`img`,{src:`logo.png`,alt:`marimo logo`,className:`w-48 mb-2`}),v=(0,X.jsx)(nt,{}),b=(0,X.jsx)(Ve,{}),e[29]=v,e[30]=b,e[31]=D):(v=e[29],b=e[30],D=e[31]),m=$e,e[32]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,X.jsx)(Z,{Icon:R,children:`Running notebooks`}),e[32]=w):w=e[32],T=[...i.values()]}e[9]=s,e[10]=p,e[11]=m,e[12]=h,e[13]=g,e[14]=_,e[15]=v,e[16]=b,e[17]=x,e[18]=S,e[19]=C,e[20]=w,e[21]=T,e[22]=E,e[23]=D}else m=e[11],h=e[12],g=e[13],_=e[14],v=e[15],b=e[16],x=e[17],S=e[18],C=e[19],w=e[20],T=e[21],E=e[22],D=e[23];if(C!==Symbol.for(`react.early_return_sentinel`))return C;let O;e[33]!==m||e[34]!==w||e[35]!==T?(O=(0,X.jsx)(m,{header:w,files:T}),e[33]=m,e[34]=w,e[35]=T,e[36]=O):O=e[36];let k;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsx)(Z,{Icon:f,children:`Recent notebooks`}),e[37]=k):k=e[37];let A;e[38]===_.files?A=e[39]:(A=(0,X.jsx)($e,{header:k,files:_.files}),e[38]=_.files,e[39]=A);let M;e[40]===s.refetch?M=e[41]:(M=(0,X.jsx)(y,{children:(0,X.jsx)(qe,{onRefreshRecents:s.refetch})}),e[40]=s.refetch,e[41]=M);let N;e[42]!==v||e[43]!==b||e[44]!==O||e[45]!==A||e[46]!==M||e[47]!==E||e[48]!==D?(N=(0,X.jsxs)(`div`,{className:E,children:[D,v,b,O,A,M]}),e[42]=v,e[43]=b,e[44]=O,e[45]=A,e[46]=M,e[47]=E,e[48]=D,e[49]=N):N=e[49];let P;e[50]!==h||e[51]!==x||e[52]!==S||e[53]!==N?(P=(0,X.jsxs)(h,{value:x,children:[S,N]}),e[50]=h,e[51]=x,e[52]=S,e[53]=N,e[54]=P):P=e[54];let F;return e[55]!==g||e[56]!==P?(F=(0,X.jsx)(g,{children:P}),e[55]=g,e[56]=P,e[57]=F):F=e[57],F},qe=e=>{let r=(0,Y.c)(54),{onRefreshRecents:i}=e,{getWorkspaceFiles:a}=j(),[s,l]=t(Ue),[u,d]=(0,J.useState)(``),f;r[0]!==a||r[1]!==s?(f=()=>a({includeMarkdown:s}),r[0]=a,r[1]=s,r[2]=f):f=r[2];let p;r[3]===s?p=r[4]:(p=[s],r[3]=s,r[4]=p);let{isPending:m,data:h,error:g,isFetching:_,refetch:v}=K(f,p),y;r[5]!==i||r[6]!==v?(y=()=>{v(),i()},r[5]=i,r[6]=v,r[7]=y):y=r[7];let b=n(y);h?.root;let x=h?.root??``,S;r[8]!==b||r[9]!==x?(S={root:x,refreshWorkspace:b},r[8]=b,r[9]=x,r[10]=S):S=r[10];let w=S;if(m){let e;return r[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(W,{centered:!0,size:`xlarge`,className:`mt-6`}),r[11]=e):e=r[11],e}if(g){let e;r[12]===g?e=r[13]:(e=Ee(g),r[12]=g,r[13]=e);let t;return r[14]===e?t=r[15]:(t=(0,X.jsx)(Oe,{kind:`danger`,className:`rounded p-4`,children:e}),r[14]=e,r[15]=t),t}let T;r[16]!==h.fileCount||r[17]!==h.hasMore?(T=h.hasMore&&(0,X.jsxs)(Oe,{kind:`warn`,className:`rounded p-4`,children:[`Showing first `,h.fileCount,` files. Your workspace has more files.`]}),r[16]=h.fileCount,r[17]=h.hasMore,r[18]=T):T=r[18];let E,D;r[19]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(ge,{size:13}),D=e=>d(e.target.value),r[19]=E,r[20]=D):(E=r[19],D=r[20]);let O;r[21]===u?O=r[22]:(O=(0,X.jsx)(_e,{id:`search`,value:u,icon:E,onChange:D,placeholder:`Search`,className:`mb-0 border-border`}),r[21]=u,r[22]=O);let k;r[23]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsx)(Je,{}),r[23]=k):k=r[23];let M;r[24]===l?M=r[25]:(M=e=>l(!!e),r[24]=l,r[25]=M);let N;r[26]!==s||r[27]!==M?(N=(0,X.jsx)(o,{"data-testid":`include-markdown-checkbox`,id:`include-markdown`,checked:s,onCheckedChange:M}),r[26]=s,r[27]=M,r[28]=N):N=r[28];let P;r[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,X.jsx)(C,{htmlFor:`include-markdown`,children:`Include markdown`}),r[29]=P):P=r[29];let F;r[30]!==N||r[31]!==O?(F=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[O,k,N,P]}),r[30]=N,r[31]=O,r[32]=F):F=r[32];let I;r[33]===v?I=r[34]:(I=()=>v(),r[33]=v,r[34]=I);let L;r[35]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsx)(c,{className:`w-4 h-4`}),r[35]=L):L=r[35];let R;r[36]===I?R=r[37]:(R=(0,X.jsx)(A,{variant:`text`,size:`icon`,className:`w-4 h-4 ml-1 p-0 opacity-70 hover:opacity-100`,onClick:I,"aria-label":`Refresh workspace`,children:L}),r[36]=I,r[37]=R);let z;r[38]===_?z=r[39]:(z=_&&(0,X.jsx)(W,{size:`small`}),r[38]=_,r[39]=z);let B;r[40]!==F||r[41]!==R||r[42]!==z?(B=(0,X.jsxs)(Z,{Icon:Pe,control:F,children:[`Workspace`,R,z]}),r[40]=F,r[41]=R,r[42]=z,r[43]=B):B=r[43];let V;r[44]!==u||r[45]!==h.files?(V=(0,X.jsx)(`div`,{className:`flex flex-col divide-y divide-(--slate-3) border rounded overflow-hidden max-h-192 overflow-y-auto shadow-sm bg-background`,children:(0,X.jsx)(Ye,{searchText:u,files:h.files})}),r[44]=u,r[45]=h.files,r[46]=V):V=r[46];let H;r[47]!==B||r[48]!==V||r[49]!==T?(H=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[T,B,V]}),r[47]=B,r[48]=V,r[49]=T,r[50]=H):H=r[50];let U;return r[51]!==H||r[52]!==w?(U=(0,X.jsx)($,{value:w,children:H}),r[51]=H,r[52]=w,r[53]=U):U=r[53],U},Je=()=>{let e=(0,Y.c)(5),t=r(We),n;e[0]===t?n=e[1]:(n=()=>{t({})},e[0]=t,e[1]=n);let i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(L,{className:`w-4 h-4 mr-1`}),e[2]=i):i=e[2];let a;return e[3]===n?a=e[4]:(a=(0,X.jsxs)(A,{variant:`text`,size:`sm`,className:`h-fit hidden sm:flex`,onClick:n,children:[i,`Collapse all`]}),e[3]=n,e[4]=a),a},Ye=e=>{let r=(0,Y.c)(22),{files:i,searchText:a}=e,[o,s]=t(We),c;r[0]===o?c=r[1]:(c=Object.keys(o),r[0]=o,r[1]=c);let l=c.length===0,u=(0,J.useRef)(void 0),{root:d,refreshWorkspace:f}=(0,J.use)($),p;r[2]===d?p=r[3]:(p={root:d},r[2]=d,r[3]=p);let{renameFile:m}=le(p),h,g;r[4]===l?(h=r[5],g=r[6]):(h=()=>{l&&u.current?.closeAll()},g=[l],r[4]=l,r[5]=h,r[6]=g),(0,J.useEffect)(h,g);let _;r[7]!==f||r[8]!==m?(_=async(e,t)=>{let n=u.current?.get(e);if(!n){G({title:`Failed`,description:`Node with id ${e} not found in the tree`});return}await m(n.data,t)&&f()},r[7]=f,r[8]=m,r[9]=_):_=r[9];let v=n(_);if(i.length===0){let e;return r[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`flex flex-col px-5 py-10 items-center justify-center`,children:(0,X.jsx)(`p`,{className:`text-center text-muted-foreground`,children:`No files in this workspace`})}),r[10]=e):e=r[10],e}let y;r[11]!==o||r[12]!==s?(y=async e=>{let t=o[e]??!1;s({...o,[e]:!t})},r[11]=o,r[12]=s,r[13]=y):y=r[13];let b;r[14]===v?b=r[15]:(b=async e=>{let{id:t,name:n}=e;await v(t,n)},r[14]=v,r[15]=b);let x;return r[16]!==i||r[17]!==o||r[18]!==a||r[19]!==y||r[20]!==b?(x=(0,X.jsx)(se,{ref:u,width:`100%`,height:500,searchTerm:a,className:`h-full`,idAccessor:at,data:i,openByDefault:!1,initialOpenState:o,onToggle:y,onRename:b,padding:5,rowHeight:35,indent:15,overscanCount:1e3,renderCursor:ot,disableDrop:!0,disableDrag:!0,disableMultiSelection:!0,children:Xe}),r[16]=i,r[17]=o,r[18]=a,r[19]=y,r[20]=b,r[21]=x):x=r[21],x},Xe=e=>{let t=(0,Y.c)(18),{node:n,style:r}=e,i=n.data.isDirectory?`directory`:B(n.data.name),a=V[i],o;t[0]===a?o=t[1]:(o=(0,X.jsx)(a,{className:`w-5 h-5 shrink-0`,strokeWidth:1.5}),t[0]=a,t[1]=o);let s=o,{root:c}=(0,J.use)($),{runningNotebooks:l}=(0,J.use)(Q),u;t[2]!==s||t[3]!==n||t[4]!==c||t[5]!==l?(u=()=>{if(n.isEditing)return(0,X.jsxs)(`div`,{className:`flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2`,children:[s,(0,X.jsx)(fe,{node:n})]});if(n.data.isDirectory)return(0,X.jsxs)(`span`,{className:`flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2`,children:[s,n.data.name]});let e=n.data.path.startsWith(c)&&ve.isAbsolute(n.data.path)?ve.rest(n.data.path,c):n.data.path,t=e.endsWith(`.md`)||e.endsWith(`.qmd`),r=l.has(e);return(0,X.jsxs)(`a`,{className:`flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2`,href:ye(`?file=${encodeURIComponent(e)}`).toString(),target:Ge(e),children:[s,(0,X.jsxs)(`span`,{className:`flex-1 overflow-hidden text-ellipsis`,children:[n.data.name,t&&(0,X.jsx)(q,{className:`ml-2 inline opacity-80`})]}),(0,X.jsx)(Ze,{node:n,isRunning:r}),(0,X.jsx)(`div`,{className:`w-8 h-8 flex items-center justify-center shrink-0`,children:(0,X.jsx)(tt,{filePath:e})}),(0,X.jsx)(z,{size:20,className:`group-hover:opacity-100 opacity-0 text-primary shrink-0`})]})},t[2]=s,t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d=u,f;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=b(`flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group h-full`),t[7]=f):f=t[7];let p,m;t[8]===n?(p=t[9],m=t[10]):(p=e=>{e.stopPropagation(),n.data.isDirectory&&n.toggle()},m=(0,X.jsx)(Qe,{node:n}),t[8]=n,t[9]=p,t[10]=m);let h;t[11]===d?h=t[12]:(h=d(),t[11]=d,t[12]=h);let g;return t[13]!==r||t[14]!==p||t[15]!==m||t[16]!==h?(g=(0,X.jsxs)(`div`,{style:r,className:f,onClick:p,children:[m,h]}),t[13]=r,t[14]=p,t[15]=m,t[16]=h,t[17]=g):g=t[17],g},Ze=e=>{let t=(0,Y.c)(19),{node:n,isRunning:r}=e,{root:i,refreshWorkspace:a}=(0,J.use)($),o;t[0]!==n||t[1]!==a||t[2]!==i?(o={node:n,root:i,onAfterChange:a},t[0]=n,t[1]=a,t[2]=i,t[3]=o):o=t[3];let{handleRename:s,handleDuplicate:c,handleDelete:l}=de(o),u=r?`Stop the notebook's kernel before renaming or deleting.`:void 0,d;t[4]!==s||t[5]!==r||t[6]!==u?(d=(0,X.jsx)(ae,{onSelect:s,disabled:r,title:u}),t[4]=s,t[5]=r,t[6]=u,t[7]=d):d=t[7];let f;t[8]===c?f=t[9]:(f=(0,X.jsx)(ue,{onSelect:c}),t[8]=c,t[9]=f);let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(T,{}),t[10]=p):p=t[10];let m;t[11]!==l||t[12]!==r||t[13]!==u?(m=(0,X.jsx)(ce,{onSelect:l,disabled:r,title:u}),t[11]=l,t[12]=r,t[13]=u,t[14]=m):m=t[14];let h;return t[15]!==d||t[16]!==f||t[17]!==m?(h=(0,X.jsxs)(oe,{testId:`workspace-more-button`,buttonClassName:`w-8 h-8 p-0 shrink-0`,contentClassName:`print:hidden w-fit min-w-[140px]`,preventDefaultOnTrigger:!0,children:[d,f,p,m]}),t[15]=d,t[16]=f,t[17]=m,t[18]=h):h=t[18],h},Qe=e=>{let t=(0,Y.c)(3),{node:n}=e;if(!n.data.isDirectory){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`span`,{className:`w-5 h-5 shrink-0`}),t[0]=e):e=t[0],e}let r;return t[1]===n.isOpen?r=t[2]:(r=n.isOpen?(0,X.jsx)(P,{className:`w-5 h-5 shrink-0`}):(0,X.jsx)(F,{className:`w-5 h-5 shrink-0`}),t[1]=n.isOpen,t[2]=r),r},$e=e=>{let t=(0,Y.c)(7),{header:n,files:r}=e;if(r.length===0)return null;let i;t[0]===r?i=t[1]:(i=r.map(st),t[0]=r,t[1]=i);let a;t[2]===i?a=t[3]:(a=(0,X.jsx)(`div`,{className:`flex flex-col divide-y divide-(--slate-3) border rounded overflow-hidden max-h-192 overflow-y-auto shadow-sm bg-background`,children:i}),t[2]=i,t[3]=a);let o;return t[4]!==n||t[5]!==a?(o=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[n,a]}),t[4]=n,t[5]=a,t[6]=o):o=t[6],o},et=e=>{let t=(0,Y.c)(41),{file:n}=e,{locale:r}=Ce(),i;t[0]===n.path?i=t[1]:(i=be(n.path),t[0]=n.path,t[1]=i);let a=i,o,s,c,l;if(t[2]!==n.initializationId||t[3]!==n.path||t[4]!==a){let e=ye(a?`?file=${encodeURIComponent(n.initializationId??n.path)}&session_id=${n.path}`:`?file=${encodeURIComponent(n.path)}`),r;t[9]===n.path?r=t[10]:(r=n.path.endsWith(`.md`),t[9]=n.path,t[10]=r),o=r,s=`py-1.5 px-4 hover:bg-(--blue-2) hover:text-primary transition-all duration-300 cursor-pointer group relative flex gap-4 items-center`,c=n.path,l=e.toString(),t[2]=n.initializationId,t[3]=n.path,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l}else o=t[5],s=t[6],c=t[7],l=t[8];let u=n.initializationId||n.path,d;t[11]===u?d=t[12]:(d=Ge(u),t[11]=u,t[12]=d);let f;t[13]===o?f=t[14]:(f=o&&(0,X.jsx)(`span`,{className:`opacity-80`,children:(0,X.jsx)(q,{})}),t[13]=o,t[14]=f);let p;t[15]!==n.name||t[16]!==f?(p=(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[n.name,f]}),t[15]=n.name,t[16]=f,t[17]=p):p=t[17];let m;t[18]===n.path?m=t[19]:(m=(0,X.jsx)(`p`,{title:n.path,className:`text-sm text-muted-foreground overflow-hidden whitespace-nowrap text-ellipsis`,children:n.path}),t[18]=n.path,t[19]=m);let h;t[20]!==p||t[21]!==m?(h=(0,X.jsxs)(`div`,{className:`flex flex-col justify-between flex-1`,children:[p,m]}),t[20]=p,t[21]=m,t[22]=h):h=t[22];let g;t[23]===n.path?g=t[24]:(g=(0,X.jsx)(`div`,{children:(0,X.jsx)(tt,{filePath:n.path})}),t[23]=n.path,t[24]=g);let _;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(z,{size:20,className:`group-hover:opacity-100 opacity-0 transition-all duration-300 text-primary`}),t[25]=_):_=t[25];let v;t[26]===g?v=t[27]:(v=(0,X.jsxs)(`div`,{className:`flex gap-3 items-center`,children:[g,_]}),t[26]=g,t[27]=v);let y;t[28]!==n.lastModified||t[29]!==r?(y=!!n.lastModified&&(0,X.jsx)(`div`,{className:`text-xs text-muted-foreground opacity-80`,children:Te(n.lastModified*1e3,r)}),t[28]=n.lastModified,t[29]=r,t[30]=y):y=t[30];let b;t[31]!==v||t[32]!==y?(b=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1 items-end`,children:[v,y]}),t[31]=v,t[32]=y,t[33]=b):b=t[33];let x;return t[34]!==h||t[35]!==b||t[36]!==s||t[37]!==c||t[38]!==l||t[39]!==d?(x=(0,X.jsxs)(`a`,{className:s,href:l,target:d,children:[h,b]},c),t[34]=h,t[35]=b,t[36]=s,t[37]=c,t[38]=l,t[39]=d,t[40]=x):x=t[40],x},tt=e=>{let t=(0,Y.c)(10),{filePath:n}=e,{openConfirm:r,closeModal:i}=ne(),{shutdownSession:a}=j(),{runningNotebooks:o,setRunningNotebooks:s}=(0,J.use)(Q);if(!o.has(n))return null;let c;t[0]!==i||t[1]!==n||t[2]!==r||t[3]!==o||t[4]!==s||t[5]!==a?(c=e=>{e.stopPropagation(),e.preventDefault(),r({title:`Shutdown`,description:`This will terminate the Python kernel. You'll lose all data that's in memory.`,variant:`destructive`,confirmAction:(0,X.jsx)(S,{onClick:()=>{let e=o.get(n);v(e?.sessionId),a({sessionId:e.sessionId}).then(e=>{s(I.keyBy(e.files,ct))}),i(),G({description:`Notebook has been shutdown.`})},"aria-label":`Confirm Shutdown`,children:`Shutdown`})})},t[0]=i,t[1]=n,t[2]=r,t[3]=o,t[4]=s,t[5]=a,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(me,{size:14}),t[7]=l):l=t[7];let u;return t[8]===c?u=t[9]:(u=(0,X.jsx)(k,{content:`Shutdown`,children:(0,X.jsx)(A,{size:`icon`,variant:`outline`,className:`opacity-80 hover:opacity-100 hover:bg-accent text-destructive border-destructive hover:border-destructive hover:text-destructive bg-background hover:bg-(--red-1)`,onClick:c,children:l})}),t[8]=c,t[9]=u),u},nt=()=>{let e=(0,Y.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=xe(),e[0]=t):t=e[0];let n=t,r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Create a new notebook`}),e[1]=r):r=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsxs)(`a`,{className:`relative rounded-lg p-6 group
|
|
2
2
|
text-primary hover:bg-(--blue-2) shadow-md-solid shadow-accent border bg-(--blue-1)
|
|
3
3
|
transition-all duration-300 cursor-pointer
|
|
4
4
|
`,href:n,target:`_blank`,rel:`noreferrer`,children:[r,(0,X.jsx)(`div`,{className:`group-hover:opacity-100 opacity-0 absolute right-5 top-0 bottom-0 rounded-lg flex items-center justify-center transition-all duration-300`,children:(0,X.jsx)(z,{size:24})})]}),e[2]=i):i=e[2],i};function rt(e){return e+1}function it(e){return e.path}function at(e){return e.path}function ot(){return null}function st(e){return(0,X.jsx)(et,{file:e},e.path)}function ct(e){return e.path}export{Ke as default};
|