const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./slides-component-mW8ihitn.js","./index-CqPQBOGX.js","./index-D2VeYVNV.css","./slides-component-CD4qq_xs.css"])))=>i.map(i=>d[i]);
var e,t=Object.defineProperty,n=(e,n,r)=>((e,n,r)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r)(e,"symbol"!=typeof n?n+"":n,r);import{aD as r,d3 as o,ax as a,d4 as s,aC as i,J as l,d5 as c,am as u,aa as d,bZ as p,d6 as f,G as h,ac as m,ad as g,P as y,c4 as b,R as v,aV as w,d7 as x,d8 as S,ay as _,aW as O,d9 as j,da as D,db as E,b1 as C,dc as k,dd as N,bd as P,aS as R,aR as M,de as z,df as T,dg as L,dh as I,a$ as H,av as A,H as W,di as q,dj as B,dk as G,dl as F,az as V,dm as U,dn as Y,dp as X,dq as $,b5 as K,a7 as Q,dr as Z,ds as J,dt as ee,M as te,du as ne,dv as re,dw as oe,dx as ae,dy as se,dz as ie,dA as le,dB as ce,dC as ue,K as de,U as pe,a9 as fe,$ as he,dD as me,dE as ge,dF as ye,d1 as be,dG as ve,dH as we,dI as xe,dJ as Se,dK as _e,dL as Oe,dM as je,dN as De,dO as Ee,dP as Ce,dQ as ke,dR as Ne,dS as Pe,dT as Re,dU as Me,dV as ze,dW as Te,dX as Le,dY as Ie,dZ as He,d_ as Ae,d$ as We,e0 as qe,e1 as Be,aJ as Ge,e2 as Fe,e3 as Ve,e4 as Ue,e5 as Ye,ap as Xe,e6 as $e,e7 as Ke,e8 as Qe,e9 as Ze,ea as Je,eb as et,cm as tt,aZ as nt,ec as rt,ed as ot,a5 as at,aK as st,ee as it,ef as lt,eg as ct,eh as ut,ei as dt,ej as pt,ek as ft,el as ht,em as mt,en as gt,aM as yt,eo as bt,ep as vt,eq as wt,er as xt,es as St,et as _t,eu as Ot,ev as jt}from"./index-CqPQBOGX.js";import{c as Dt}from"./createWsUrl-CNvVvu6j.js";
/**
 * @license lucide-react v0.428.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Et=r("AlignEndVertical",[["rect",{width:"16",height:"6",x:"2",y:"4",rx:"2",key:"10wcwx"}],["rect",{width:"9",height:"6",x:"9",y:"14",rx:"2",key:"4p5bwg"}],["path",{d:"M22 22V2",key:"12ipfv"}]]),Ct=r("AlignHorizontalSpaceAround",[["rect",{width:"6",height:"10",x:"9",y:"7",rx:"2",key:"yn7j0q"}],["path",{d:"M4 22V2",key:"tsjzd3"}],["path",{d:"M20 22V2",key:"1bnhr8"}]]),kt=r("AlignStartVertical",[["rect",{width:"9",height:"6",x:"6",y:"14",rx:"2",key:"lpm2y7"}],["rect",{width:"16",height:"6",x:"6",y:"4",rx:"2",key:"rdj6ps"}],["path",{d:"M2 2v20",key:"1ivd8o"}]]),Nt=r("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]),Pt=r("FolderDown",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m15 13-3 3-3-3",key:"6j2sf0"}]]),Rt=r("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]),Mt=r("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]),zt=r("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),Tt=r("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]),Lt=r("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),It=r("SquareArrowRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]),Ht=r("Unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]);
/**
 * @license lucide-react v0.428.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */class At{static get INSTANCE(){const e="_marimo_private_RuntimeState";return window[e]||(window[e]=new At(o)),window[e]}constructor(e){this.uiElementRegistry=e,this.hasStarted=!1,this._sendComponentValues=void 0,this.handleReadyEvent=e=>{const t=e.detail.objectId;if(!this.uiElementRegistry.has(t))return;const n=this.uiElementRegistry.lookupValue(t);void 0!==n&&this.sendComponentValues({objectIds:[t],values:[n]}).catch((e=>{a.warn(e)}))}}get sendComponentValues(){if(!this._sendComponentValues)throw new Error("sendComponentValues is not set");return this._sendComponentValues}start(e){this.hasStarted?a.warn("RuntimeState already started"):(this._sendComponentValues=e,document.addEventListener(s.TYPE,this.handleReadyEvent),this.hasStarted=!0)}stop(){this.hasStarted?(document.removeEventListener(s.TYPE,this.handleReadyEvent),this.hasStarted=!1):a.warn("RuntimeState already stopped")}}var Wt={exports:{}},qt={},Bt={exports:{}};!function(e){function t(e){return function(t,n,r,o,a,s,i){return e(t,n,i)}}function n(e){return function(t,n,r,o){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r,o);var a=o.get(t),s=o.get(n);if(a&&s)return a===n&&s===t;o.set(t,n),o.set(n,t);var i=e(t,n,r,o);return o.delete(t),o.delete(n),i}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function o(e){return e.constructor===Object||null==e.constructor}function a(e){return"function"==typeof e.then}function s(e,t){return e===t||e!=e&&t!=t}var i="[object Arguments]",l="[object Boolean]",c="[object Date]",u="[object RegExp]",d="[object Map]",p="[object Number]",f="[object Object]",h="[object Set]",m="[object String]",g=Object.prototype.toString;function y(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,y=e.areObjectsEqual,b=e.areRegExpsEqual,v=e.areSetsEqual,w=(0,e.createIsNestedEqual)(x);function x(e,x,S){if(e===x)return!0;if(!e||!x||"object"!=typeof e||"object"!=typeof x)return e!=e&&x!=x;if(o(e)&&o(x))return y(e,x,w,S);var _=Array.isArray(e),O=Array.isArray(x);if(_||O)return _===O&&t(e,x,w,S);var j=g.call(e);return j===g.call(x)&&(j===c?n(e,x,w,S):j===u?b(e,x,w,S):j===d?r(e,x,w,S):j===h?v(e,x,w,S):j===f||j===i?!a(e)&&!a(x)&&y(e,x,w,S):(j===l||j===p||j===m)&&s(e.valueOf(),x.valueOf()))}return x}function b(e,t,n,r){var o=e.length;if(t.length!==o)return!1;for(;o-- >0;)if(!n(e[o],t[o],o,o,e,t,r))return!1;return!0}var v=n(b);function w(e,t){return s(e.valueOf(),t.valueOf())}function x(e,t,n,r){var o=e.size===t.size;if(!o)return!1;if(!e.size)return!0;var a={},s=0;return e.forEach((function(i,l){if(o){var c=!1,u=0;t.forEach((function(o,d){c||a[u]||!(c=n(l,d,s,u,e,t,r)&&n(i,o,l,d,e,t,r))||(a[u]=!0),u++})),s++,o=c}})),o}var S=n(x),_="_owner",O=Object.prototype.hasOwnProperty;function j(e,t,n,r){var o,a=Object.keys(e),s=a.length;if(Object.keys(t).length!==s)return!1;for(;s-- >0;){if((o=a[s])===_){var i=!!e.$$typeof,l=!!t.$$typeof;if((i||l)&&i!==l)return!1}if(!O.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var D=n(j);function E(e,t){return e.source===t.source&&e.flags===t.flags}function C(e,t,n,r){var o=e.size===t.size;if(!o)return!1;if(!e.size)return!0;var a={};return e.forEach((function(s,i){if(o){var l=!1,c=0;t.forEach((function(o,u){l||a[c]||!(l=n(s,o,i,u,e,t,r))||(a[c]=!0),c++})),o=l}})),o}var k=n(C),N=Object.freeze({areArraysEqual:b,areDatesEqual:w,areMapsEqual:x,areObjectsEqual:j,areRegExpsEqual:E,areSetsEqual:C,createIsNestedEqual:t}),P=Object.freeze({areArraysEqual:v,areDatesEqual:w,areMapsEqual:S,areObjectsEqual:D,areRegExpsEqual:E,areSetsEqual:k,createIsNestedEqual:t}),R=y(N);function M(e,t){return R(e,t,void 0)}var z=y(r(N,{createIsNestedEqual:function(){return s}}));function T(e,t){return z(e,t,void 0)}var L=y(P);function I(e,t){return L(e,t,new WeakMap)}var H=y(r(P,{createIsNestedEqual:function(){return s}}));function A(e,t){return H(e,t,new WeakMap)}function W(e){return y(r(N,e(N)))}function q(e){var t=y(r(P,e(P)));return function(e,n,r){return void 0===r&&(r=new WeakMap),t(e,n,r)}}e.circularDeepEqual=I,e.circularShallowEqual=A,e.createCustomCircularEqual=q,e.createCustomEqual=W,e.deepEqual=M,e.sameValueZeroEqual=s,e.shallowEqual=T,Object.defineProperty(e,"__esModule",{value:!0})}(Bt.exports);var Gt=Bt.exports,Ft={exports:{}};function Vt(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Vt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ut(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Vt(e))&&(r&&(r+=" "),r+=t);return r}Ft.exports=Ut,Ft.exports.clsx=Ut;var Yt=Ft.exports,Xt={};Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.bottom=Zt,Xt.childrenEqual=function(e,t){return(0,Kt.deepEqual)(Qt.default.Children.map(e,(e=>null==e?void 0:e.key)),Qt.default.Children.map(t,(e=>null==e?void 0:e.key)))&&(0,Kt.deepEqual)(Qt.default.Children.map(e,(e=>null==e?void 0:e.props["data-grid"])),Qt.default.Children.map(t,(e=>null==e?void 0:e.props["data-grid"])))},Xt.cloneLayout=Jt,Xt.cloneLayoutItem=tn,Xt.collides=nn,Xt.compact=rn,Xt.compactItem=sn,Xt.compactType=function(e){const{verticalCompact:t,compactType:n}=e||{};return!1===t?null:n},Xt.correctBounds=ln,Xt.fastPositionEqual=function(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height},Xt.fastRGLPropsEqual=void 0,Xt.getAllCollisions=dn,Xt.getFirstCollision=un,Xt.getLayoutItem=cn,Xt.getStatics=pn,Xt.modifyLayout=en,Xt.moveElement=fn,Xt.moveElementAwayFromCollision=hn,Xt.noop=void 0,Xt.perc=function(e){return 100*e+"%"},Xt.resizeItemInDirection=function(e,t,n,r){const o=_n[e];return o?o(t,{...t,...n},r):n},Xt.setTopLeft=function(e){let{top:t,left:n,width:r,height:o}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${o}px`,position:"absolute"}},Xt.setTransform=function(e){let{top:t,left:n,width:r,height:o}=e;const a=`translate(${n}px,${t}px)`;return{transform:a,WebkitTransform:a,MozTransform:a,msTransform:a,OTransform:a,width:`${r}px`,height:`${o}px`,position:"absolute"}},Xt.sortLayoutItems=On,Xt.sortLayoutItemsByColRow=Dn,Xt.sortLayoutItemsByRowCol=jn,Xt.synchronizeLayoutWithChildren=function(e,t,n,r,o){e=e||[];const a=[];Qt.default.Children.forEach(t,(t=>{if(null==(null==t?void 0:t.key))return;const n=cn(e,String(t.key)),r=t.props["data-grid"];n&&null==r?a.push(tn(n)):r?a.push(tn({...r,i:t.key})):a.push(tn({w:1,h:1,x:0,y:Zt(a),i:String(t.key)}))}));const s=ln(a,{cols:n});return o?s:rn(s,r,n)},Xt.validateLayout=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,o=e.length;r<o;r++){const o=e[r];for(let e=0;e<n.length;e++)if("number"!=typeof o[n[e]])throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[e]+" must be a number!")}},Xt.withLayoutItem=function(e,t,n){let r=cn(e,t);return r?(r=n(tn(r)),[e=en(e,r),r]):[e,null]};var $t,Kt=Gt,Qt=($t=l)&&$t.__esModule?$t:{default:$t};function Zt(e){let t,n=0;for(let r=0,o=e.length;r<o;r++)t=e[r].y+e[r].h,t>n&&(n=t);return n}function Jt(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=tn(e[n]);return t}function en(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function tn(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:Boolean(e.moved),static:Boolean(e.static),isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function nn(e,t){return e.i!==t.i&&(!(e.x+e.w<=t.x)&&(!(e.x>=t.x+t.w)&&(!(e.y+e.h<=t.y)&&!(e.y>=t.y+t.h))))}function rn(e,t,n,r){const o=pn(e),a=On(e,t),s=Array(e.length);for(let i=0,l=a.length;i<l;i++){let l=tn(a[i]);l.static||(l=sn(o,l,t,n,a,r),o.push(l)),s[e.indexOf(a[i])]=l,l.moved=!1}return s}Xt.fastRGLPropsEqual=function(e,t,n){return e===t||e.className===t.className&&n(e.style,t.style)&&e.width===t.width&&e.autoSize===t.autoSize&&e.cols===t.cols&&e.draggableCancel===t.draggableCancel&&e.draggableHandle===t.draggableHandle&&n(e.verticalCompact,t.verticalCompact)&&n(e.compactType,t.compactType)&&n(e.layout,t.layout)&&n(e.margin,t.margin)&&n(e.containerPadding,t.containerPadding)&&e.rowHeight===t.rowHeight&&e.maxRows===t.maxRows&&e.isBounded===t.isBounded&&e.isDraggable===t.isDraggable&&e.isResizable===t.isResizable&&e.allowOverlap===t.allowOverlap&&e.preventCollision===t.preventCollision&&e.useCSSTransforms===t.useCSSTransforms&&e.transformScale===t.transformScale&&e.isDroppable===t.isDroppable&&n(e.resizeHandles,t.resizeHandles)&&n(e.resizeHandle,t.resizeHandle)&&e.onLayoutChange===t.onLayoutChange&&e.onDragStart===t.onDragStart&&e.onDrag===t.onDrag&&e.onDragStop===t.onDragStop&&e.onResizeStart===t.onResizeStart&&e.onResize===t.onResize&&e.onResizeStop===t.onResizeStop&&e.onDrop===t.onDrop&&n(e.droppingItem,t.droppingItem)&&n(e.innerRef,t.innerRef)};const on={x:"w",y:"h"};function an(e,t,n,r){const o=on[r];t[r]+=1;for(let a=e.map((e=>e.i)).indexOf(t.i)+1;a<e.length;a++){const s=e[a];if(!s.static){if(s.y>t.y+t.h)break;nn(t,s)&&an(e,s,n+t[o],r)}}t[r]=n}function sn(e,t,n,r,o,a){const s="horizontal"===n;if("vertical"===n)for(t.y=Math.min(Zt(e),t.y);t.y>0&&!un(e,t);)t.y--;else if(s)for(;t.x>0&&!un(e,t);)t.x--;let i;for(;(i=un(e,t))&&(null!==n||!a);)if(s?an(o,t,i.x+i.w,"x"):an(o,t,i.y+i.h,"y"),s&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!un(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function ln(e,t){const n=pn(e);for(let r=0,o=e.length;r<o;r++){const o=e[r];if(o.x+o.w>t.cols&&(o.x=t.cols-o.w),o.x<0&&(o.x=0,o.w=t.cols),o.static)for(;un(n,o);)o.y++;else n.push(o)}return e}function cn(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function un(e,t){for(let n=0,r=e.length;n<r;n++)if(nn(e[n],t))return e[n]}function dn(e,t){return e.filter((e=>nn(e,t)))}function pn(e){return e.filter((e=>e.static))}function fn(e,t,n,r,o,a,s,i,l){if(t.static&&!0!==t.isDraggable)return e;if(t.y===r&&t.x===n)return e;t.i,String(n),String(r),t.x,t.y;const c=t.x,u=t.y;"number"==typeof n&&(t.x=n),"number"==typeof r&&(t.y=r),t.moved=!0;let d=On(e,s);("vertical"===s&&"number"==typeof r?u>=r:"horizontal"===s&&"number"==typeof n&&c>=n)&&(d=d.reverse());const p=dn(d,t),f=p.length>0;if(f&&l)return Jt(e);if(f&&a)return t.i,t.x=c,t.y=u,t.moved=!1,e;for(let h=0,m=p.length;h<m;h++){const n=p[h];t.i,t.x,t.y,n.i,n.x,n.y,n.moved||(e=n.static?hn(e,n,t,o,s):hn(e,t,n,o,s))}return e}function hn(e,t,n,r,o,a){const s="horizontal"===o,i="vertical"===o,l=t.static;if(r){r=!1;const a={x:s?Math.max(t.x-n.w,0):n.x,y:i?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},c=un(e,a),u=c&&c.y+c.h>t.y,d=c&&t.x+t.w>c.x;if(!c)return n.i,a.x,a.y,fn(e,n,s?a.x:void 0,i?a.y:void 0,r,l,o);if(u&&i)return fn(e,n,void 0,t.y+1,r,l,o);if(u&&null==o)return t.y=n.y,n.y=n.y+n.h,e;if(d&&s)return fn(e,t,n.x,void 0,r,l,o)}const c=s?n.x+1:void 0,u=i?n.y+1:void 0;return null==c&&null==u?e:fn(e,n,s?n.x+1:void 0,i?n.y+1:void 0,r,l,o)}const mn=(e,t,n,r)=>e+n>r?t:n,gn=(e,t,n)=>e<0?t:n,yn=e=>Math.max(0,e),bn=e=>Math.max(0,e),vn=(e,t,n)=>{let{left:r,height:o,width:a}=t;const s=e.top-(o-e.height);return{left:r,width:a,height:gn(s,e.height,o),top:bn(s)}},wn=(e,t,n)=>{let{top:r,left:o,height:a,width:s}=t;return{top:r,height:a,width:mn(e.left,e.width,s,n),left:yn(o)}},xn=(e,t,n)=>{let{top:r,height:o,width:a}=t;const s=e.left-(a-e.width);return{height:o,width:s<0?e.width:mn(e.left,e.width,a,n),top:bn(r),left:yn(s)}},Sn=(e,t,n)=>{let{top:r,left:o,height:a,width:s}=t;return{width:s,left:o,height:gn(r,e.height,a),top:bn(r)}},_n={n:vn,ne:function(){return vn(arguments.length<=0?void 0:arguments[0],wn(...arguments))},e:wn,se:function(){return Sn(arguments.length<=0?void 0:arguments[0],wn(...arguments))},s:Sn,sw:function(){return Sn(arguments.length<=0?void 0:arguments[0],xn(...arguments))},w:xn,nw:function(){return vn(arguments.length<=0?void 0:arguments[0],xn(...arguments))}};function On(e,t){return"horizontal"===t?Dn(e):"vertical"===t?jn(e):e}function jn(e){return e.slice(0).sort((function(e,t){return e.y>t.y||e.y===t.y&&e.x>t.x?1:e.y===t.y&&e.x===t.x?0:-1}))}function Dn(e){return e.slice(0).sort((function(e,t){return e.x>t.x||e.x===t.x&&e.y>t.y?1:-1}))}Xt.noop=()=>{};var En={};function Cn(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-2*n[0])/o}function kn(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function Nn(e,t,n){return Math.max(Math.min(e,n),t)}Object.defineProperty(En,"__esModule",{value:!0}),En.calcGridColWidth=Cn,En.calcGridItemPosition=function(e,t,n,r,o,a){const{margin:s,containerPadding:i,rowHeight:l}=e,c=Cn(e),u={};a&&a.resizing?(u.width=Math.round(a.resizing.width),u.height=Math.round(a.resizing.height)):(u.width=kn(r,c,s[0]),u.height=kn(o,l,s[1]));a&&a.dragging?(u.top=Math.round(a.dragging.top),u.left=Math.round(a.dragging.left)):a&&a.resizing&&"number"==typeof a.resizing.top&&"number"==typeof a.resizing.left?(u.top=Math.round(a.resizing.top),u.left=Math.round(a.resizing.left)):(u.top=Math.round((l+s[1])*n+i[1]),u.left=Math.round((c+s[0])*t+i[0]));return u},En.calcGridItemWHPx=kn,En.calcWH=function(e,t,n,r,o,a){const{margin:s,maxRows:i,cols:l,rowHeight:c}=e,u=Cn(e);let d=Math.round((t+s[0])/(u+s[0])),p=Math.round((n+s[1])/(c+s[1])),f=Nn(d,0,l-r),h=Nn(p,0,i-o);-1!==["sw","w","nw"].indexOf(a)&&(f=Nn(d,0,l));-1!==["nw","n","ne"].indexOf(a)&&(h=Nn(p,0,i));return{w:f,h:h}},En.calcXY=function(e,t,n,r,o){const{margin:a,cols:s,rowHeight:i,maxRows:l}=e,c=Cn(e);let u=Math.round((n-a[0])/(c+a[0])),d=Math.round((t-a[1])/(i+a[1]));return u=Nn(u,0,s-r),d=Nn(d,0,l-o),{x:u,y:d}},En.clamp=Nn;var Pn={},Rn={exports:{}},Mn={};function zn(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=zn(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Tn(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=zn(e))&&(r&&(r+=" "),r+=t);return r}const Ln=c(Object.freeze(Object.defineProperty({__proto__:null,clsx:Tn,default:Tn},Symbol.toStringTag,{value:"Module"})));var In={},Hn={};Object.defineProperty(Hn,"__esModule",{value:!0}),Hn.dontSetMe=function(e,t,n){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(n," - do not set this, set it on the child."))},Hn.findInArray=function(e,t){for(var n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]},Hn.int=function(e){return parseInt(e,10)},Hn.isFunction=function(e){return"function"==typeof e||"[object Function]"===Object.prototype.toString.call(e)},Hn.isNum=function(e){return"number"==typeof e&&!isNaN(e)};var An={};Object.defineProperty(An,"__esModule",{value:!0}),An.browserPrefixToKey=Bn,An.browserPrefixToStyle=function(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e},An.default=void 0,An.getPrefix=qn;var Wn=["Moz","Webkit","O","ms"];function qn(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"transform";if("undefined"==typeof window)return"";var r=null===(e=window.document)||void 0===e||null===(t=e.documentElement)||void 0===t?void 0:t.style;if(!r)return"";if(n in r)return"";for(var o=0;o<Wn.length;o++)if(Bn(n,Wn[o])in r)return Wn[o];return""}function Bn(e,t){return t?"".concat(t).concat(function(e){for(var t="",n=!0,r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):"-"===e[r]?n=!0:t+=e[r];return t}(e)):e}var Gn=qn();function Fn(e){return(Fn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}An.default=Gn,Object.defineProperty(In,"__esModule",{value:!0}),In.addClassName=er,In.addEvent=function(e,t,n,r){if(!e)return;var o=$n({capture:!0},r);e.addEventListener?e.addEventListener(t,n,o):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n},In.addUserSelectStyles=function(e){if(!e)return;var t=e.getElementById("react-draggable-style-el");t||((t=e.createElement("style")).type="text/css",t.id="react-draggable-style-el",t.innerHTML=".react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n",t.innerHTML+=".react-draggable-transparent-selection *::selection {all: inherit;}\n",e.getElementsByTagName("head")[0].appendChild(t));e.body&&er(e.body,"react-draggable-transparent-selection")},In.createCSSTransform=function(e,t){var n=Jn(e,t,"px");return Kn({},(0,Un.browserPrefixToKey)("transform",Un.default),n)},In.createSVGTransform=function(e,t){return Jn(e,t,"")},In.getTouch=function(e,t){return e.targetTouches&&(0,Vn.findInArray)(e.targetTouches,(function(e){return t===e.identifier}))||e.changedTouches&&(0,Vn.findInArray)(e.changedTouches,(function(e){return t===e.identifier}))},In.getTouchIdentifier=function(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier},In.getTranslation=Jn,In.innerHeight=function(e){var t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,Vn.int)(n.paddingTop),t-=(0,Vn.int)(n.paddingBottom)},In.innerWidth=function(e){var t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,Vn.int)(n.paddingLeft),t-=(0,Vn.int)(n.paddingRight)},In.matchesSelector=Zn,In.matchesSelectorAndParentsTo=function(e,t,n){var r=e;do{if(Zn(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1},In.offsetXYFromParent=function(e,t,n){var r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),o=(e.clientX+t.scrollLeft-r.left)/n,a=(e.clientY+t.scrollTop-r.top)/n;return{x:o,y:a}},In.outerHeight=function(e){var t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,Vn.int)(n.borderTopWidth),t+=(0,Vn.int)(n.borderBottomWidth)},In.outerWidth=function(e){var t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,Vn.int)(n.borderLeftWidth),t+=(0,Vn.int)(n.borderRightWidth)},In.removeClassName=tr,In.removeEvent=function(e,t,n,r){if(!e)return;var o=$n({capture:!0},r);e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},In.removeUserSelectStyles=function(e){if(!e)return;try{if(e.body&&tr(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{var t=(e.defaultView||window).getSelection();t&&"Caret"!==t.type&&t.removeAllRanges()}}catch(n){}};var Vn=Hn,Un=function(e,t){if(e.__esModule)return e;if(null===e||"object"!==Fn(e)&&"function"!=typeof e)return{default:e};var n=Yn(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var s=o?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(r,a,s):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(An);function Yn(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(Yn=function(e){return e?n:t})(e)}function Xn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xn(Object(n),!0).forEach((function(t){Kn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Kn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qn="";function Zn(e,t){return Qn||(Qn=(0,Vn.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],(function(t){return(0,Vn.isFunction)(e[t])}))),!!(0,Vn.isFunction)(e[Qn])&&e[Qn](t)}function Jn(e,t,n){var r=e.x,o=e.y,a="translate(".concat(r).concat(n,",").concat(o).concat(n,")");if(t){var s="".concat("string"==typeof t.x?t.x:t.x+n),i="".concat("string"==typeof t.y?t.y:t.y+n);a="translate(".concat(s,", ").concat(i,")")+a}return a}function er(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function tr(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var nr={};Object.defineProperty(nr,"__esModule",{value:!0}),nr.canDragX=function(e){return"both"===e.props.axis||"x"===e.props.axis},nr.canDragY=function(e){return"both"===e.props.axis||"y"===e.props.axis},nr.createCoreData=function(e,t,n){var r=e.state,o=!(0,rr.isNum)(r.lastX),a=ar(e);return o?{node:a,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:a,deltaX:t-r.lastX,deltaY:n-r.lastY,lastX:r.lastX,lastY:r.lastY,x:t,y:n}},nr.createDraggableData=function(e,t){var n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}},nr.getBoundPosition=function(e,t,n){if(!e.props.bounds)return[t,n];var r=e.props.bounds;r="string"==typeof r?r:function(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}(r);var o=ar(e);if("string"==typeof r){var a,s=o.ownerDocument,i=s.defaultView;if(!((a="parent"===r?o.parentNode:s.querySelector(r))instanceof i.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');var l=a,c=i.getComputedStyle(o),u=i.getComputedStyle(l);r={left:-o.offsetLeft+(0,rr.int)(u.paddingLeft)+(0,rr.int)(c.marginLeft),top:-o.offsetTop+(0,rr.int)(u.paddingTop)+(0,rr.int)(c.marginTop),right:(0,or.innerWidth)(l)-(0,or.outerWidth)(o)-o.offsetLeft+(0,rr.int)(u.paddingRight)-(0,rr.int)(c.marginRight),bottom:(0,or.innerHeight)(l)-(0,or.outerHeight)(o)-o.offsetTop+(0,rr.int)(u.paddingBottom)-(0,rr.int)(c.marginBottom)}}(0,rr.isNum)(r.right)&&(t=Math.min(t,r.right));(0,rr.isNum)(r.bottom)&&(n=Math.min(n,r.bottom));(0,rr.isNum)(r.left)&&(t=Math.max(t,r.left));(0,rr.isNum)(r.top)&&(n=Math.max(n,r.top));return[t,n]},nr.getControlPosition=function(e,t,n){var r="number"==typeof t?(0,or.getTouch)(e,t):null;if("number"==typeof t&&!r)return null;var o=ar(n),a=n.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,or.offsetXYFromParent)(r||e,a,n.props.scale)},nr.snapToGrid=function(e,t,n){var r=Math.round(t/e[0])*e[0],o=Math.round(n/e[1])*e[1];return[r,o]};var rr=Hn,or=In;function ar(e){var t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var sr={},ir={};function lr(e){return(lr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(ir,"__esModule",{value:!0}),ir.default=function(){},Object.defineProperty(sr,"__esModule",{value:!0}),sr.default=void 0;var cr=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==lr(e)&&"function"!=typeof e)return{default:e};var n=yr(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var s=o?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(r,a,s):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(l),ur=gr(u),dr=gr(d),pr=In,fr=nr,hr=Hn,mr=gr(ir);function gr(e){return e&&e.__esModule?e:{default:e}}function yr(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(yr=function(e){return e?n:t})(e)}function br(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,a=[],s=!0,i=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);s=!0);}catch(l){i=!0,o=l}finally{try{s||null==n.return||n.return()}finally{if(i)throw o}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return vr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vr(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function wr(e,t,n){return function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function xr(e,t){return(xr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Sr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Or(e);if(t){var o=Or(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===lr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _r(e)}(this,n)}}function _r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Or(e){return(Or=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function jr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Dr={start:"touchstart",move:"touchmove",stop:"touchend"},Er={start:"mousedown",move:"mousemove",stop:"mouseup"},Cr=Er,kr=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xr(e,t)}(t,cr.Component);var e=Sr(t);function t(){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return jr(_r(n=e.call.apply(e,[this].concat(o))),"state",{dragging:!1,lastX:NaN,lastY:NaN,touchIdentifier:null}),jr(_r(n),"mounted",!1),jr(_r(n),"handleDragStart",(function(e){if(n.props.onMouseDown(e),!n.props.allowAnyClick&&"number"==typeof e.button&&0!==e.button)return!1;var t=n.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");var r=t.ownerDocument;if(!(n.props.disabled||!(e.target instanceof r.defaultView.Node)||n.props.handle&&!(0,pr.matchesSelectorAndParentsTo)(e.target,n.props.handle,t)||n.props.cancel&&(0,pr.matchesSelectorAndParentsTo)(e.target,n.props.cancel,t))){"touchstart"===e.type&&e.preventDefault();var o=(0,pr.getTouchIdentifier)(e);n.setState({touchIdentifier:o});var a=(0,fr.getControlPosition)(e,o,_r(n));if(null!=a){var s=a.x,i=a.y,l=(0,fr.createCoreData)(_r(n),s,i);(0,mr.default)("DraggableCore: handleDragStart: %j",l),(0,mr.default)("calling",n.props.onStart),!1!==n.props.onStart(e,l)&&!1!==n.mounted&&(n.props.enableUserSelectHack&&(0,pr.addUserSelectStyles)(r),n.setState({dragging:!0,lastX:s,lastY:i}),(0,pr.addEvent)(r,Cr.move,n.handleDrag),(0,pr.addEvent)(r,Cr.stop,n.handleDragStop))}}})),jr(_r(n),"handleDrag",(function(e){var t=(0,fr.getControlPosition)(e,n.state.touchIdentifier,_r(n));if(null!=t){var r=t.x,o=t.y;if(Array.isArray(n.props.grid)){var a=r-n.state.lastX,s=o-n.state.lastY,i=br((0,fr.snapToGrid)(n.props.grid,a,s),2);if(a=i[0],s=i[1],!a&&!s)return;r=n.state.lastX+a,o=n.state.lastY+s}var l=(0,fr.createCoreData)(_r(n),r,o);if((0,mr.default)("DraggableCore: handleDrag: %j",l),!1!==n.props.onDrag(e,l)&&!1!==n.mounted)n.setState({lastX:r,lastY:o});else try{n.handleDragStop(new MouseEvent("mouseup"))}catch(u){var c=document.createEvent("MouseEvents");c.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),n.handleDragStop(c)}}})),jr(_r(n),"handleDragStop",(function(e){if(n.state.dragging){var t=(0,fr.getControlPosition)(e,n.state.touchIdentifier,_r(n));if(null!=t){var r=t.x,o=t.y;if(Array.isArray(n.props.grid)){var a=r-n.state.lastX||0,s=o-n.state.lastY||0,i=br((0,fr.snapToGrid)(n.props.grid,a,s),2);a=i[0],s=i[1],r=n.state.lastX+a,o=n.state.lastY+s}var l=(0,fr.createCoreData)(_r(n),r,o);if(!1===n.props.onStop(e,l)||!1===n.mounted)return!1;var c=n.findDOMNode();c&&n.props.enableUserSelectHack&&(0,pr.removeUserSelectStyles)(c.ownerDocument),(0,mr.default)("DraggableCore: handleDragStop: %j",l),n.setState({dragging:!1,lastX:NaN,lastY:NaN}),c&&((0,mr.default)("DraggableCore: Removing handlers"),(0,pr.removeEvent)(c.ownerDocument,Cr.move,n.handleDrag),(0,pr.removeEvent)(c.ownerDocument,Cr.stop,n.handleDragStop))}}})),jr(_r(n),"onMouseDown",(function(e){return Cr=Er,n.handleDragStart(e)})),jr(_r(n),"onMouseUp",(function(e){return Cr=Er,n.handleDragStop(e)})),jr(_r(n),"onTouchStart",(function(e){return Cr=Dr,n.handleDragStart(e)})),jr(_r(n),"onTouchEnd",(function(e){return Cr=Dr,n.handleDragStop(e)})),n}return wr(t,[{key:"componentDidMount",value:function(){this.mounted=!0;var e=this.findDOMNode();e&&(0,pr.addEvent)(e,Dr.start,this.onTouchStart,{passive:!1})}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var e=this.findDOMNode();if(e){var t=e.ownerDocument;(0,pr.removeEvent)(t,Er.move,this.handleDrag),(0,pr.removeEvent)(t,Dr.move,this.handleDrag),(0,pr.removeEvent)(t,Er.stop,this.handleDragStop),(0,pr.removeEvent)(t,Dr.stop,this.handleDragStop),(0,pr.removeEvent)(e,Dr.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,pr.removeUserSelectStyles)(t)}}},{key:"findDOMNode",value:function(){var e,t,n;return null!==(e=this.props)&&void 0!==e&&e.nodeRef?null===(t=this.props)||void 0===t||null===(n=t.nodeRef)||void 0===n?void 0:n.current:dr.default.findDOMNode(this)}},{key:"render",value:function(){return cr.cloneElement(cr.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}]),t}();sr.default=kr,jr(kr,"displayName","DraggableCore"),jr(kr,"propTypes",{allowAnyClick:ur.default.bool,disabled:ur.default.bool,enableUserSelectHack:ur.default.bool,offsetParent:function(e,t){if(e[t]&&1!==e[t].nodeType)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:ur.default.arrayOf(ur.default.number),handle:ur.default.string,cancel:ur.default.string,nodeRef:ur.default.object,onStart:ur.default.func,onDrag:ur.default.func,onStop:ur.default.func,onMouseDown:ur.default.func,scale:ur.default.number,className:hr.dontSetMe,style:hr.dontSetMe,transform:hr.dontSetMe}),jr(kr,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return p.default}}),e.default=void 0;var n=function(e,n){if(e&&e.__esModule)return e;if(null===e||"object"!==t(e)&&"function"!=typeof e)return{default:e};var r=g(n);if(r&&r.has(e))return r.get(e);var o={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var i=a?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(o,s,i):o[s]=e[s]}o.default=e,r&&r.set(e,o);return o}(l),r=m(u),o=m(d),a=m(Ln),s=In,i=nr,c=Hn,p=m(sr),f=m(ir),h=["axis","bounds","children","defaultPosition","defaultClassName","defaultClassNameDragging","defaultClassNameDragged","position","positionOffset","scale"];function m(e){return e&&e.__esModule?e:{default:e}}function g(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(g=function(e){return e?n:t})(e)}function y(){return y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},y.apply(this,arguments)}function b(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach((function(t){C(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function x(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,a=[],s=!0,i=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);s=!0);}catch(l){i=!0,o=l}finally{try{s||null==n.return||n.return()}finally{if(i)throw o}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function j(e){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,o=E(e);if(n){var a=E(this).constructor;r=Reflect.construct(o,arguments,a)}else r=o.apply(this,arguments);return function(e,n){if(n&&("object"===t(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return D(e)}(this,r)}}function D(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var k=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&O(e,t)}(u,e);var t,r,l,c=j(u);function u(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),C(D(t=c.call(this,e)),"onDragStart",(function(e,n){if((0,f.default)("Draggable: onDragStart: %j",n),!1===t.props.onStart(e,(0,i.createDraggableData)(D(t),n)))return!1;t.setState({dragging:!0,dragged:!0})})),C(D(t),"onDrag",(function(e,n){if(!t.state.dragging)return!1;(0,f.default)("Draggable: onDrag: %j",n);var r=(0,i.createDraggableData)(D(t),n),o={x:r.x,y:r.y};if(t.props.bounds){var a=o.x,s=o.y;o.x+=t.state.slackX,o.y+=t.state.slackY;var l=x((0,i.getBoundPosition)(D(t),o.x,o.y),2),c=l[0],u=l[1];o.x=c,o.y=u,o.slackX=t.state.slackX+(a-o.x),o.slackY=t.state.slackY+(s-o.y),r.x=o.x,r.y=o.y,r.deltaX=o.x-t.state.x,r.deltaY=o.y-t.state.y}if(!1===t.props.onDrag(e,r))return!1;t.setState(o)})),C(D(t),"onDragStop",(function(e,n){if(!t.state.dragging)return!1;if(!1===t.props.onStop(e,(0,i.createDraggableData)(D(t),n)))return!1;(0,f.default)("Draggable: onDragStop: %j",n);var r={dragging:!1,slackX:0,slackY:0};if(Boolean(t.props.position)){var o=t.props.position,a=o.x,s=o.y;r.x=a,r.y=s}t.setState(r)})),t.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:w({},e.position),slackX:0,slackY:0,isElementSVG:!1},!e.position||e.onDrag||e.onStop||console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element."),t}return r=[{key:"componentDidMount",value:function(){void 0!==window.SVGElement&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}},{key:"componentWillUnmount",value:function(){this.setState({dragging:!1})}},{key:"findDOMNode",value:function(){var e,t,n;return null!==(e=null===(t=this.props)||void 0===t||null===(n=t.nodeRef)||void 0===n?void 0:n.current)&&void 0!==e?e:o.default.findDOMNode(this)}},{key:"render",value:function(){var e,t=this.props;t.axis,t.bounds;var r=t.children,o=t.defaultPosition,l=t.defaultClassName,c=t.defaultClassNameDragging,u=t.defaultClassNameDragged,d=t.position,f=t.positionOffset;t.scale;var m=b(t,h),g={},v=null,x=!Boolean(d)||this.state.dragging,S=d||o,_={x:(0,i.canDragX)(this)&&x?this.state.x:S.x,y:(0,i.canDragY)(this)&&x?this.state.y:S.y};this.state.isElementSVG?v=(0,s.createSVGTransform)(_,f):g=(0,s.createCSSTransform)(_,f);var O=(0,a.default)(r.props.className||"",l,(C(e={},c,this.state.dragging),C(e,u,this.state.dragged),e));return n.createElement(p.default,y({},m,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),n.cloneElement(n.Children.only(r),{className:O,style:w(w({},r.props.style),g),transform:v}))}}],l=[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.position,r=t.prevPropsPosition;return!n||r&&n.x===r.x&&n.y===r.y?null:((0,f.default)("Draggable: getDerivedStateFromProps %j",{position:n,prevPropsPosition:r}),{x:n.x,y:n.y,prevPropsPosition:w({},n)})}}],_((t=u).prototype,r),_(t,l),Object.defineProperty(t,"prototype",{writable:!1}),u}(n.Component);e.default=k,C(k,"displayName","Draggable"),C(k,"propTypes",w(w({},p.default.propTypes),{},{axis:r.default.oneOf(["both","x","y","none"]),bounds:r.default.oneOfType([r.default.shape({left:r.default.number,right:r.default.number,top:r.default.number,bottom:r.default.number}),r.default.string,r.default.oneOf([!1])]),defaultClassName:r.default.string,defaultClassNameDragging:r.default.string,defaultClassNameDragged:r.default.string,defaultPosition:r.default.shape({x:r.default.number,y:r.default.number}),positionOffset:r.default.shape({x:r.default.oneOfType([r.default.number,r.default.string]),y:r.default.oneOfType([r.default.number,r.default.string])}),position:r.default.shape({x:r.default.number,y:r.default.number}),className:c.dontSetMe,style:c.dontSetMe,transform:c.dontSetMe})),C(k,"defaultProps",w(w({},p.default.defaultProps),{},{axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1}))}(Mn);var Nr=Mn.default,Pr=Mn.DraggableCore;Rn.exports=Nr,Rn.exports.default=Nr,Rn.exports.DraggableCore=Pr;var Rr=Rn.exports,Mr={exports:{}},zr={},Tr={__esModule:!0,cloneElement:function(e,t){t.style&&e.props.style&&(t.style=Hr(Hr({},e.props.style),t.style));t.className&&e.props.className&&(t.className=e.props.className+" "+t.className);return Lr.default.cloneElement(e,t)}},Lr=function(e){return e&&e.__esModule?e:{default:e}}(l);function Ir(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Hr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ir(Object(n),!0).forEach((function(t){Ar(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ir(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ar(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Wr={__esModule:!0,resizableProps:void 0},qr=function(e){return e&&e.__esModule?e:{default:e}}(u);var Br={axis:qr.default.oneOf(["both","x","y","none"]),className:qr.default.string,children:qr.default.element.isRequired,draggableOpts:qr.default.shape({allowAnyClick:qr.default.bool,cancel:qr.default.string,children:qr.default.node,disabled:qr.default.bool,enableUserSelectHack:qr.default.bool,offsetParent:qr.default.node,grid:qr.default.arrayOf(qr.default.number),handle:qr.default.string,nodeRef:qr.default.object,onStart:qr.default.func,onDrag:qr.default.func,onStop:qr.default.func,onMouseDown:qr.default.func,scale:qr.default.number}),height:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,o=t[0];return"both"===o.axis||"y"===o.axis?(r=qr.default.number).isRequired.apply(r,t):qr.default.number.apply(qr.default,t)},handle:qr.default.oneOfType([qr.default.node,qr.default.func]),handleSize:qr.default.arrayOf(qr.default.number),lockAspectRatio:qr.default.bool,maxConstraints:qr.default.arrayOf(qr.default.number),minConstraints:qr.default.arrayOf(qr.default.number),onResizeStop:qr.default.func,onResizeStart:qr.default.func,onResize:qr.default.func,resizeHandles:qr.default.arrayOf(qr.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:qr.default.number,width:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,o=t[0];return"both"===o.axis||"x"===o.axis?(r=qr.default.number).isRequired.apply(r,t):qr.default.number.apply(qr.default,t)}};Wr.resizableProps=Br,zr.__esModule=!0,zr.default=void 0;var Gr=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=Xr(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var s=o?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(r,a,s):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(l),Fr=Rr,Vr=Tr,Ur=Wr,Yr=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Xr(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(Xr=function(e){return e?n:t})(e)}function $r(){return $r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$r.apply(this,arguments)}function Kr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Qr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kr(Object(n),!0).forEach((function(t){Zr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Zr(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jr(e,t){return(Jr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var eo=function(e){var t,n;function r(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).handleRefs={},t.lastHandleRect=null,t.slack=null,t}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,Jr(t,n);var o=r.prototype;return o.componentWillUnmount=function(){this.resetData()},o.resetData=function(){this.lastHandleRect=this.slack=null},o.runConstraints=function(e,t){var n=this.props,r=n.minConstraints,o=n.maxConstraints,a=n.lockAspectRatio;if(!r&&!o&&!a)return[e,t];if(a){var s=this.props.width/this.props.height,i=e-this.props.width,l=t-this.props.height;Math.abs(i)>Math.abs(l*s)?t=e/s:e=t*s}var c=e,u=t,d=this.slack||[0,0],p=d[0],f=d[1];return e+=p,t+=f,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),o&&(e=Math.min(o[0],e),t=Math.min(o[1],t)),this.slack=[p+(c-e),f+(u-t)],[e,t]},o.resizeHandler=function(e,t){var n=this;return function(r,o){var a=o.node,s=o.deltaX,i=o.deltaY;"onResizeStart"===e&&n.resetData();var l=("both"===n.props.axis||"x"===n.props.axis)&&"n"!==t&&"s"!==t,c=("both"===n.props.axis||"y"===n.props.axis)&&"e"!==t&&"w"!==t;if(l||c){var u=t[0],d=t[t.length-1],p=a.getBoundingClientRect();if(null!=n.lastHandleRect){if("w"===d)s+=p.left-n.lastHandleRect.left;if("n"===u)i+=p.top-n.lastHandleRect.top}n.lastHandleRect=p,"w"===d&&(s=-s),"n"===u&&(i=-i);var f=n.props.width+(l?s/n.props.transformScale:0),h=n.props.height+(c?i/n.props.transformScale:0),m=n.runConstraints(f,h);f=m[0],h=m[1];var g=f!==n.props.width||h!==n.props.height,y="function"==typeof n.props[e]?n.props[e]:null;y&&!("onResize"===e&&!g)&&(null==r.persist||r.persist(),y(r,{node:a,size:{width:f,height:h},handle:t})),"onResizeStop"===e&&n.resetData()}}},o.renderResizeHandle=function(e,t){var n=this.props.handle;if(!n)return Gr.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+e,ref:t});if("function"==typeof n)return n(e,t);var r=Qr({ref:t},"string"==typeof n.type?{}:{handleAxis:e});return Gr.cloneElement(n,r)},o.render=function(){var e=this,t=this.props,n=t.children,r=t.className,o=t.draggableOpts;t.width,t.height,t.handle,t.handleSize,t.lockAspectRatio,t.axis,t.minConstraints,t.maxConstraints,t.onResize,t.onResizeStop,t.onResizeStart;var a=t.resizeHandles;t.transformScale;var s=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(t,Yr);return(0,Vr.cloneElement)(n,Qr(Qr({},s),{},{className:(r?r+" ":"")+"react-resizable",children:[].concat(n.props.children,a.map((function(t){var n,r=null!=(n=e.handleRefs[t])?n:e.handleRefs[t]=Gr.createRef();return Gr.createElement(Fr.DraggableCore,$r({},o,{nodeRef:r,key:"resizableHandle-"+t,onStop:e.resizeHandler("onResizeStop",t),onStart:e.resizeHandler("onResizeStart",t),onDrag:e.resizeHandler("onResize",t)}),e.renderResizeHandle(t,r))})))}))},r}(Gr.Component);zr.default=eo,eo.propTypes=Ur.resizableProps,eo.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var to={__esModule:!0,default:void 0},no=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=lo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var s=o?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(r,a,s):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(l),ro=io(u),oo=io(zr),ao=Wr,so=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function io(e){return e&&e.__esModule?e:{default:e}}function lo(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(lo=function(e){return e?n:t})(e)}function co(){return co=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},co.apply(this,arguments)}function uo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function po(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?uo(Object(n),!0).forEach((function(t){fo(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uo(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function fo(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ho(e,t){return(ho=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var mo=function(e){var t,n;function r(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).state={width:t.props.width,height:t.props.height,propsWidth:t.props.width,propsHeight:t.props.height},t.onResize=function(e,n){var r=n.size;t.props.onResize?(null==e.persist||e.persist(),t.setState(r,(function(){return t.props.onResize&&t.props.onResize(e,n)}))):t.setState(r)},t}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,ho(t,n),r.getDerivedStateFromProps=function(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null},r.prototype.render=function(){var e=this.props,t=e.handle,n=e.handleSize;e.onResize;var r=e.onResizeStart,o=e.onResizeStop,a=e.draggableOpts,s=e.minConstraints,i=e.maxConstraints,l=e.lockAspectRatio,c=e.axis;e.width,e.height;var u=e.resizeHandles,d=e.style,p=e.transformScale,f=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,so);return no.createElement(oo.default,{axis:c,draggableOpts:a,handle:t,handleSize:n,height:this.state.height,lockAspectRatio:l,maxConstraints:i,minConstraints:s,onResizeStart:r,onResize:this.onResize,onResizeStop:o,resizeHandles:u,transformScale:p,width:this.state.width},no.createElement("div",co({},f,{style:po(po({},d),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},r}(no.Component);to.default=mo,mo.propTypes=po(po({},ao.resizableProps),{},{children:ro.default.element}),Mr.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},Mr.exports.Resizable=zr.default,Mr.exports.ResizableBox=to.default;var go=Mr.exports,yo={};Object.defineProperty(yo,"__esModule",{value:!0}),yo.resizeHandleType=yo.resizeHandleAxesType=yo.default=void 0;var bo=wo(u),vo=wo(l);function wo(e){return e&&e.__esModule?e:{default:e}}const xo=yo.resizeHandleAxesType=bo.default.arrayOf(bo.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),So=yo.resizeHandleType=bo.default.oneOfType([bo.default.node,bo.default.func]);yo.default={className:bo.default.string,style:bo.default.object,width:bo.default.number,autoSize:bo.default.bool,cols:bo.default.number,draggableCancel:bo.default.string,draggableHandle:bo.default.string,verticalCompact:function(e){e.verticalCompact,0},compactType:bo.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;void 0!==t&&Xt.validateLayout(t,"layout")},margin:bo.default.arrayOf(bo.default.number),containerPadding:bo.default.arrayOf(bo.default.number),rowHeight:bo.default.number,maxRows:bo.default.number,isBounded:bo.default.bool,isDraggable:bo.default.bool,isResizable:bo.default.bool,allowOverlap:bo.default.bool,preventCollision:bo.default.bool,useCSSTransforms:bo.default.bool,transformScale:bo.default.number,isDroppable:bo.default.bool,resizeHandles:xo,resizeHandle:So,onLayoutChange:bo.default.func,onDragStart:bo.default.func,onDrag:bo.default.func,onDragStop:bo.default.func,onResizeStart:bo.default.func,onResize:bo.default.func,onResizeStop:bo.default.func,onDrop:bo.default.func,droppingItem:bo.default.shape({i:bo.default.string.isRequired,w:bo.default.number.isRequired,h:bo.default.number.isRequired}),children:function(e,t){const n=e[t],r={};vo.default.Children.forEach(n,(function(e){if(null!=(null==e?void 0:e.key)){if(r[e.key])throw new Error('Duplicate child key "'+e.key+'" found! This will cause problems in ReactGridLayout.');r[e.key]=!0}}))},innerRef:bo.default.any},Object.defineProperty(Pn,"__esModule",{value:!0}),Pn.default=void 0;var _o=Po(l),Oo=Po(u),jo=Rr,Do=go,Eo=Xt,Co=En,ko=yo,No=Po(Yt);function Po(e){return e&&e.__esModule?e:{default:e}}function Ro(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Mo extends _o.default.Component{constructor(){super(...arguments),Ro(this,"state",{resizing:null,dragging:null,className:""}),Ro(this,"elementRef",_o.default.createRef()),Ro(this,"onDragStart",((e,t)=>{let{node:n}=t;const{onDragStart:r,transformScale:o}=this.props;if(!r)return;const a={top:0,left:0},{offsetParent:s}=n;if(!s)return;const i=s.getBoundingClientRect(),l=n.getBoundingClientRect(),c=l.left/o,u=i.left/o,d=l.top/o,p=i.top/o;a.left=c-u+s.scrollLeft,a.top=d-p+s.scrollTop,this.setState({dragging:a});const{x:f,y:h}=(0,Co.calcXY)(this.getPositionParams(),a.top,a.left,this.props.w,this.props.h);return r.call(this,this.props.i,f,h,{e:e,node:n,newPosition:a})})),Ro(this,"onDrag",((e,t)=>{let{node:n,deltaX:r,deltaY:o}=t;const{onDrag:a}=this.props;if(!a)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let s=this.state.dragging.top+o,i=this.state.dragging.left+r;const{isBounded:l,i:c,w:u,h:d,containerWidth:p}=this.props,f=this.getPositionParams();if(l){const{offsetParent:e}=n;if(e){const{margin:t,rowHeight:n,containerPadding:r}=this.props,o=e.clientHeight-(0,Co.calcGridItemWHPx)(d,n,t[1]);s=(0,Co.clamp)(s-r[1],0,o);const a=(0,Co.calcGridColWidth)(f),l=p-(0,Co.calcGridItemWHPx)(u,a,t[0]);i=(0,Co.clamp)(i-r[0],0,l)}}const h={top:s,left:i};this.setState({dragging:h});const{containerPadding:m}=this.props,{x:g,y:y}=(0,Co.calcXY)(f,s-m[1],i-m[0],u,d);return a.call(this,c,g,y,{e:e,node:n,newPosition:h})})),Ro(this,"onDragStop",((e,t)=>{let{node:n}=t;const{onDragStop:r}=this.props;if(!r)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:o,h:a,i:s,containerPadding:i}=this.props,{left:l,top:c}=this.state.dragging,u={top:c,left:l};this.setState({dragging:null});const{x:d,y:p}=(0,Co.calcXY)(this.getPositionParams(),c-i[1],l-i[0],o,a);return r.call(this,s,d,p,{e:e,node:n,newPosition:u})})),Ro(this,"onResizeStop",((e,t,n)=>this.onResizeHandler(e,t,n,"onResizeStop"))),Ro(this,"onResizeStart",((e,t,n)=>this.onResizeHandler(e,t,n,"onResizeStart"))),Ro(this,"onResize",((e,t,n)=>this.onResizeHandler(e,t,n,"onResize")))}shouldComponentUpdate(e,t){if(this.props.children!==e.children)return!0;if(this.props.droppingPosition!==e.droppingPosition)return!0;const n=(0,Co.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),r=(0,Co.calcGridItemPosition)(this.getPositionParams(e),e.x,e.y,e.w,e.h,t);return!(0,Eo.fastPositionEqual)(n,r)||this.props.useCSSTransforms!==e.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(e){this.moveDroppingItem(e)}moveDroppingItem(e){const{droppingPosition:t}=this.props;if(!t)return;const n=this.elementRef.current;if(!n)return;const r=e.droppingPosition||{left:0,top:0},{dragging:o}=this.state,a=o&&t.left!==r.left||t.top!==r.top;if(o){if(a){const e=t.left-o.left,r=t.top-o.top;this.onDrag(t.e,{node:n,deltaX:e,deltaY:r})}}else this.onDragStart(t.e,{node:n,deltaX:t.left,deltaY:t.top})}getPositionParams(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;return{cols:e.cols,containerPadding:e.containerPadding,containerWidth:e.containerWidth,margin:e.margin,maxRows:e.maxRows,rowHeight:e.rowHeight}}createStyle(e){const{usePercentages:t,containerWidth:n,useCSSTransforms:r}=this.props;let o;return r?o=(0,Eo.setTransform)(e):(o=(0,Eo.setTopLeft)(e),t&&(o.left=(0,Eo.perc)(e.left/n),o.width=(0,Eo.perc)(e.width/n))),o}mixinDraggable(e,t){return _o.default.createElement(jo.DraggableCore,{disabled:!t,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},e)}curryResizeHandler(e,t){return(n,r)=>t(n,r,e)}mixinResizable(e,t,n){const{cols:r,minW:o,minH:a,maxW:s,maxH:i,transformScale:l,resizeHandles:c,resizeHandle:u}=this.props,d=this.getPositionParams(),p=(0,Co.calcGridItemPosition)(d,0,0,r,0).width,f=(0,Co.calcGridItemPosition)(d,0,0,o,a),h=(0,Co.calcGridItemPosition)(d,0,0,s,i),m=[f.width,f.height],g=[Math.min(h.width,p),Math.min(h.height,1/0)];return _o.default.createElement(Do.Resizable,{draggableOpts:{disabled:!n},className:n?void 0:"react-resizable-hide",width:t.width,height:t.height,minConstraints:m,maxConstraints:g,onResizeStop:this.curryResizeHandler(t,this.onResizeStop),onResizeStart:this.curryResizeHandler(t,this.onResizeStart),onResize:this.curryResizeHandler(t,this.onResize),transformScale:l,resizeHandles:c,handle:u},e)}onResizeHandler(e,t,n,r){let{node:o,size:a,handle:s}=t;const i=this.props[r];if(!i)return;const{x:l,y:c,i:u,maxH:d,minH:p,containerWidth:f}=this.props,{minW:h,maxW:m}=this.props;let g=a;o&&(g=(0,Eo.resizeItemInDirection)(s,n,a,f),this.setState({resizing:"onResizeStop"===r?null:g}));let{w:y,h:b}=(0,Co.calcWH)(this.getPositionParams(),g.width,g.height,l,c,s);y=(0,Co.clamp)(y,Math.max(h,1),m),b=(0,Co.clamp)(b,p,d),i.call(this,u,y,b,{e:e,node:o,size:g,handle:s})}render(){const{x:e,y:t,w:n,h:r,isDraggable:o,isResizable:a,droppingPosition:s,useCSSTransforms:i}=this.props,l=(0,Co.calcGridItemPosition)(this.getPositionParams(),e,t,n,r,this.state),c=_o.default.Children.only(this.props.children);let u=_o.default.cloneElement(c,{ref:this.elementRef,className:(0,No.default)("react-grid-item",c.props.className,this.props.className,{static:this.props.static,resizing:Boolean(this.state.resizing),"react-draggable":o,"react-draggable-dragging":Boolean(this.state.dragging),dropping:Boolean(s),cssTransforms:i}),style:{...this.props.style,...c.props.style,...this.createStyle(l)}});return u=this.mixinResizable(u,l,a),u=this.mixinDraggable(u,o),u}}Pn.default=Mo,Ro(Mo,"propTypes",{children:Oo.default.element,cols:Oo.default.number.isRequired,containerWidth:Oo.default.number.isRequired,rowHeight:Oo.default.number.isRequired,margin:Oo.default.array.isRequired,maxRows:Oo.default.number.isRequired,containerPadding:Oo.default.array.isRequired,x:Oo.default.number.isRequired,y:Oo.default.number.isRequired,w:Oo.default.number.isRequired,h:Oo.default.number.isRequired,minW:function(e,t){const n=e[t];return"number"!=typeof n?new Error("minWidth not Number"):n>e.w||n>e.maxW?new Error("minWidth larger than item width/maxWidth"):void 0},maxW:function(e,t){const n=e[t];return"number"!=typeof n?new Error("maxWidth not Number"):n<e.w||n<e.minW?new Error("maxWidth smaller than item width/minWidth"):void 0},minH:function(e,t){const n=e[t];return"number"!=typeof n?new Error("minHeight not Number"):n>e.h||n>e.maxH?new Error("minHeight larger than item height/maxHeight"):void 0},maxH:function(e,t){const n=e[t];return"number"!=typeof n?new Error("maxHeight not Number"):n<e.h||n<e.minH?new Error("maxHeight smaller than item height/minHeight"):void 0},i:Oo.default.string.isRequired,resizeHandles:ko.resizeHandleAxesType,resizeHandle:ko.resizeHandleType,onDragStop:Oo.default.func,onDragStart:Oo.default.func,onDrag:Oo.default.func,onResizeStop:Oo.default.func,onResizeStart:Oo.default.func,onResize:Oo.default.func,isDraggable:Oo.default.bool.isRequired,isResizable:Oo.default.bool.isRequired,isBounded:Oo.default.bool.isRequired,static:Oo.default.bool,useCSSTransforms:Oo.default.bool.isRequired,transformScale:Oo.default.number,className:Oo.default.string,handle:Oo.default.string,cancel:Oo.default.string,droppingPosition:Oo.default.shape({e:Oo.default.object.isRequired,left:Oo.default.number.isRequired,top:Oo.default.number.isRequired})}),Ro(Mo,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1}),Object.defineProperty(qt,"__esModule",{value:!0}),qt.default=void 0;var zo=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=Bo(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var s=o?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(r,a,s):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}(l),To=Gt,Lo=qo(Yt),Io=Xt,Ho=En,Ao=qo(Pn),Wo=qo(yo);function qo(e){return e&&e.__esModule?e:{default:e}}function Bo(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(Bo=function(e){return e?n:t})(e)}function Go(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Fo="react-grid-layout";let Vo=!1;try{Vo=/firefox/i.test(navigator.userAgent)}catch(Ji){}let Uo=class extends zo.Component{constructor(){super(...arguments),Go(this,"state",{activeDrag:null,layout:(0,Io.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,Io.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),Go(this,"dragEnterCounter",0),Go(this,"onDragStart",((e,t,n,r)=>{let{e:o,node:a}=r;const{layout:s}=this.state,i=(0,Io.getLayoutItem)(s,e);if(!i)return;const l={w:i.w,h:i.h,x:i.x,y:i.y,placeholder:!0,i:e};return this.setState({oldDragItem:(0,Io.cloneLayoutItem)(i),oldLayout:s,activeDrag:l}),this.props.onDragStart(s,i,i,null,o,a)})),Go(this,"onDrag",((e,t,n,r)=>{let{e:o,node:a}=r;const{oldDragItem:s}=this.state;let{layout:i}=this.state;const{cols:l,allowOverlap:c,preventCollision:u}=this.props,d=(0,Io.getLayoutItem)(i,e);if(!d)return;const p={w:d.w,h:d.h,x:d.x,y:d.y,placeholder:!0,i:e};i=(0,Io.moveElement)(i,d,t,n,!0,u,(0,Io.compactType)(this.props),l,c),this.props.onDrag(i,s,d,p,o,a),this.setState({layout:c?i:(0,Io.compact)(i,(0,Io.compactType)(this.props),l),activeDrag:p})})),Go(this,"onDragStop",((e,t,n,r)=>{let{e:o,node:a}=r;if(!this.state.activeDrag)return;const{oldDragItem:s}=this.state;let{layout:i}=this.state;const{cols:l,preventCollision:c,allowOverlap:u}=this.props,d=(0,Io.getLayoutItem)(i,e);if(!d)return;i=(0,Io.moveElement)(i,d,t,n,!0,c,(0,Io.compactType)(this.props),l,u);const p=u?i:(0,Io.compact)(i,(0,Io.compactType)(this.props),l);this.props.onDragStop(p,s,d,null,o,a);const{oldLayout:f}=this.state;this.setState({activeDrag:null,layout:p,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(p,f)})),Go(this,"onResizeStart",((e,t,n,r)=>{let{e:o,node:a}=r;const{layout:s}=this.state,i=(0,Io.getLayoutItem)(s,e);i&&(this.setState({oldResizeItem:(0,Io.cloneLayoutItem)(i),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(s,i,i,null,o,a))})),Go(this,"onResize",((e,t,n,r)=>{let{e:o,node:a,size:s,handle:i}=r;const{oldResizeItem:l}=this.state,{layout:c}=this.state,{cols:u,preventCollision:d,allowOverlap:p}=this.props;let f,h,m,g=!1;const[y,b]=(0,Io.withLayoutItem)(c,e,(e=>{let r;if(h=e.x,m=e.y,-1!==["sw","w","nw","n","ne"].indexOf(i)&&(-1!==["sw","nw","w"].indexOf(i)&&(h=e.x+(e.w-t),t=e.x!==h&&h<0?e.w:t,h=h<0?0:h),-1!==["ne","n","nw"].indexOf(i)&&(m=e.y+(e.h-n),n=e.y!==m&&m<0?e.h:n,m=m<0?0:m),g=!0),d&&!p){r=(0,Io.getAllCollisions)(c,{...e,w:t,h:n,x:h,y:m}).filter((t=>t.i!==e.i)).length>0,r&&(m=e.y,n=e.h,h=e.x,t=e.w,g=!1)}return e.w=t,e.h=n,e}));if(!b)return;if(f=y,g){const e=!0;f=(0,Io.moveElement)(y,b,h,m,e,this.props.preventCollision,(0,Io.compactType)(this.props),u,p)}const v={w:b.w,h:b.h,x:b.x,y:b.y,static:!0,i:e};this.props.onResize(f,l,b,v,o,a),this.setState({layout:p?f:(0,Io.compact)(f,(0,Io.compactType)(this.props),u),activeDrag:v})})),Go(this,"onResizeStop",((e,t,n,r)=>{let{e:o,node:a}=r;const{layout:s,oldResizeItem:i}=this.state,{cols:l,allowOverlap:c}=this.props,u=(0,Io.getLayoutItem)(s,e),d=c?s:(0,Io.compact)(s,(0,Io.compactType)(this.props),l);this.props.onResizeStop(d,i,u,null,o,a);const{oldLayout:p}=this.state;this.setState({activeDrag:null,layout:d,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(d,p)})),Go(this,"onDragOver",(e=>{var t;if(e.preventDefault(),e.stopPropagation(),Vo&&!(null==(t=e.nativeEvent.target)?void 0:t.classList.contains(Fo)))return!1;const{droppingItem:n,onDropDragOver:r,margin:o,cols:a,rowHeight:s,maxRows:i,width:l,containerPadding:c,transformScale:u}=this.props,d=null==r?void 0:r(e);if(!1===d)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const p={...n,...d},{layout:f}=this.state,h=e.currentTarget.getBoundingClientRect(),m=e.clientX-h.left,g=e.clientY-h.top,y={left:m/u,top:g/u,e:e};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:e,top:t}=this.state.droppingPosition;(e!=m||t!=g)&&this.setState({droppingPosition:y})}}else{const e={cols:a,margin:o,maxRows:i,rowHeight:s,containerWidth:l,containerPadding:c||o},t=(0,Ho.calcXY)(e,g,m,p.w,p.h);this.setState({droppingDOMNode:zo.createElement("div",{key:p.i}),droppingPosition:y,layout:[...f,{...p,x:t.x,y:t.y,static:!1,isDraggable:!0}]})}})),Go(this,"removeDroppingPlaceholder",(()=>{const{droppingItem:e,cols:t}=this.props,{layout:n}=this.state,r=(0,Io.compact)(n.filter((t=>t.i!==e.i)),(0,Io.compactType)(this.props),t,this.props.allowOverlap);this.setState({layout:r,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})})),Go(this,"onDragLeave",(e=>{e.preventDefault(),e.stopPropagation(),this.dragEnterCounter--,0===this.dragEnterCounter&&this.removeDroppingPlaceholder()})),Go(this,"onDragEnter",(e=>{e.preventDefault(),e.stopPropagation(),this.dragEnterCounter++})),Go(this,"onDrop",(e=>{e.preventDefault(),e.stopPropagation();const{droppingItem:t}=this.props,{layout:n}=this.state,r=n.find((e=>e.i===t.i));this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(n,r,e)}))}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(e,t){let n;if(t.activeDrag)return null;if((0,To.deepEqual)(e.layout,t.propsLayout)&&e.compactType===t.compactType?(0,Io.childrenEqual)(e.children,t.children)||(n=t.layout):n=e.layout,n){return{layout:(0,Io.synchronizeLayoutWithChildren)(n,e.children,e.cols,(0,Io.compactType)(e),e.allowOverlap),compactType:e.compactType,children:e.children,propsLayout:e.layout}}return null}shouldComponentUpdate(e,t){return this.props.children!==e.children||!(0,Io.fastRGLPropsEqual)(this.props,e,To.deepEqual)||this.state.activeDrag!==t.activeDrag||this.state.mounted!==t.mounted||this.state.droppingPosition!==t.droppingPosition}componentDidUpdate(e,t){if(!this.state.activeDrag){const e=this.state.layout,n=t.layout;this.onLayoutMaybeChanged(e,n)}}containerHeight(){if(!this.props.autoSize)return;const e=(0,Io.bottom)(this.state.layout),t=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return e*this.props.rowHeight+(e-1)*this.props.margin[1]+2*t+"px"}onLayoutMaybeChanged(e,t){t||(t=this.state.layout),(0,To.deepEqual)(t,e)||this.props.onLayoutChange(e)}placeholder(){const{activeDrag:e}=this.state;if(!e)return null;const{width:t,cols:n,margin:r,containerPadding:o,rowHeight:a,maxRows:s,useCSSTransforms:i,transformScale:l}=this.props;return zo.createElement(Ao.default,{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,className:"react-grid-placeholder "+(this.state.resizing?"placeholder-resizing":""),containerWidth:t,cols:n,margin:r,containerPadding:o||r,maxRows:s,rowHeight:a,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:i,transformScale:l},zo.createElement("div",null))}processGridItem(e,t){if(!e||!e.key)return;const n=(0,Io.getLayoutItem)(this.state.layout,String(e.key));if(!n)return null;const{width:r,cols:o,margin:a,containerPadding:s,rowHeight:i,maxRows:l,isDraggable:c,isResizable:u,isBounded:d,useCSSTransforms:p,transformScale:f,draggableCancel:h,draggableHandle:m,resizeHandles:g,resizeHandle:y}=this.props,{mounted:b,droppingPosition:v}=this.state,w="boolean"==typeof n.isDraggable?n.isDraggable:!n.static&&c,x="boolean"==typeof n.isResizable?n.isResizable:!n.static&&u,S=n.resizeHandles||g,_=w&&d&&!1!==n.isBounded;return zo.createElement(Ao.default,{containerWidth:r,cols:o,margin:a,containerPadding:s||a,maxRows:l,rowHeight:i,cancel:h,handle:m,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:w,isResizable:x,isBounded:_,useCSSTransforms:p&&b,usePercentages:!b,transformScale:f,w:n.w,h:n.h,x:n.x,y:n.y,i:n.i,minH:n.minH,minW:n.minW,maxH:n.maxH,maxW:n.maxW,static:n.static,droppingPosition:t?v:void 0,resizeHandles:S,resizeHandle:y},e)}render(){const{className:e,style:t,isDroppable:n,innerRef:r}=this.props,o=(0,Lo.default)(Fo,e),a={height:this.containerHeight(),...t};return zo.createElement("div",{ref:r,className:o,style:a,onDrop:n?this.onDrop:Io.noop,onDragLeave:n?this.onDragLeave:Io.noop,onDragEnter:n?this.onDragEnter:Io.noop,onDragOver:n?this.onDragOver:Io.noop},zo.Children.map(this.props.children,(e=>this.processGridItem(e))),n&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}};qt.default=Uo,Go(Uo,"displayName","ReactGridLayout"),Go(Uo,"propTypes",Wo.default),Go(Uo,"defaultProps",{autoSize:!0,cols:12,className:"",style:{},draggableHandle:"",draggableCancel:"",containerPadding:null,rowHeight:150,maxRows:1/0,layout:[],margin:[10,10],isBounded:!1,isDraggable:!0,isResizable:!0,allowOverlap:!1,isDroppable:!1,useCSSTransforms:!0,transformScale:1,verticalCompact:!0,compactType:"vertical",preventCollision:!1,droppingItem:{i:"__dropping-elem__",h:1,w:1},resizeHandles:["se"],onLayoutChange:Io.noop,onDragStart:Io.noop,onDrag:Io.noop,onDragStop:Io.noop,onResizeStart:Io.noop,onResize:Io.noop,onResizeStop:Io.noop,onDrop:Io.noop,onDropDragOver:Io.noop});var Yo={},Xo={};Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.findOrGenerateResponsiveLayout=function(e,t,n,r,o,a){if(e[n])return(0,$o.cloneLayout)(e[n]);let s=e[r];const i=Ko(t),l=i.slice(i.indexOf(n));for(let c=0,u=l.length;c<u;c++){const t=l[c];if(e[t]){s=e[t];break}}return s=(0,$o.cloneLayout)(s||[]),(0,$o.compact)((0,$o.correctBounds)(s,{cols:o}),a,o)},Xo.getBreakpointFromWidth=function(e,t){const n=Ko(e);let r=n[0];for(let o=1,a=n.length;o<a;o++){const a=n[o];t>e[a]&&(r=a)}return r},Xo.getColsFromBreakpoint=function(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]},Xo.sortBreakpoints=Ko;var $o=Xt;function Ko(e){return Object.keys(e).sort((function(t,n){return e[t]-e[n]}))}Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.default=void 0;var Qo=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=oa(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var s=o?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(r,a,s):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}(l),Zo=ra(u),Jo=Gt,ea=Xt,ta=Xo,na=ra(qt);function ra(e){return e&&e.__esModule?e:{default:e}}function oa(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(oa=function(e){return e?n:t})(e)}function aa(){return aa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},aa.apply(this,arguments)}function sa(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ia=e=>Object.prototype.toString.call(e);function la(e,t){return null==e?null:Array.isArray(e)?e:e[t]}class ca extends Qo.Component{constructor(){super(...arguments),sa(this,"state",this.generateInitialState()),sa(this,"onLayoutChange",(e=>{this.props.onLayoutChange(e,{...this.props.layouts,[this.state.breakpoint]:e})}))}generateInitialState(){const{width:e,breakpoints:t,layouts:n,cols:r}=this.props,o=(0,ta.getBreakpointFromWidth)(t,e),a=(0,ta.getColsFromBreakpoint)(o,r),s=!1===this.props.verticalCompact?null:this.props.compactType;return{layout:(0,ta.findOrGenerateResponsiveLayout)(n,t,o,o,a,s),breakpoint:o,cols:a}}static getDerivedStateFromProps(e,t){if(!(0,Jo.deepEqual)(e.layouts,t.layouts)){const{breakpoint:n,cols:r}=t;return{layout:(0,ta.findOrGenerateResponsiveLayout)(e.layouts,e.breakpoints,n,n,r,e.compactType),layouts:e.layouts}}return null}componentDidUpdate(e){this.props.width==e.width&&this.props.breakpoint===e.breakpoint&&(0,Jo.deepEqual)(this.props.breakpoints,e.breakpoints)&&(0,Jo.deepEqual)(this.props.cols,e.cols)||this.onWidthChange(e)}onWidthChange(e){const{breakpoints:t,cols:n,layouts:r,compactType:o}=this.props,a=this.props.breakpoint||(0,ta.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),s=this.state.breakpoint,i=(0,ta.getColsFromBreakpoint)(a,n),l={...r};if(s!==a||e.breakpoints!==t||e.cols!==n){s in l||(l[s]=(0,ea.cloneLayout)(this.state.layout));let e=(0,ta.findOrGenerateResponsiveLayout)(l,t,a,s,i,o);e=(0,ea.synchronizeLayoutWithChildren)(e,this.props.children,i,o,this.props.allowOverlap),l[a]=e,this.props.onLayoutChange(e,l),this.props.onBreakpointChange(a,i),this.setState({breakpoint:a,layout:e,cols:i})}const c=la(this.props.margin,a),u=la(this.props.containerPadding,a);this.props.onWidthChange(this.props.width,c,i,u)}render(){const{breakpoint:e,breakpoints:t,cols:n,layouts:r,margin:o,containerPadding:a,onBreakpointChange:s,onLayoutChange:i,onWidthChange:l,...c}=this.props;return Qo.createElement(na.default,aa({},c,{margin:la(o,this.state.breakpoint),containerPadding:la(a,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}Yo.default=ca,sa(ca,"propTypes",{breakpoint:Zo.default.string,breakpoints:Zo.default.object,allowOverlap:Zo.default.bool,cols:Zo.default.object,margin:Zo.default.oneOfType([Zo.default.array,Zo.default.object]),containerPadding:Zo.default.oneOfType([Zo.default.array,Zo.default.object]),layouts(e,t){if("[object Object]"!==ia(e[t]))throw new Error("Layout property must be an object. Received: "+ia(e[t]));Object.keys(e[t]).forEach((t=>{if(!(t in e.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,ea.validateLayout)(e.layouts[t],"layouts."+t)}))},width:Zo.default.number.isRequired,onBreakpointChange:Zo.default.func,onLayoutChange:Zo.default.func,onWidthChange:Zo.default.func}),sa(ca,"defaultProps",{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],allowOverlap:!1,onBreakpointChange:ea.noop,onLayoutChange:ea.noop,onWidthChange:ea.noop});var ua={},da=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var n=-1;return e.some((function(e,r){return e[0]===t&&(n=r,!0)})),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var n=e(this.__entries__,t),r=this.__entries__[n];return r&&r[1]},t.prototype.set=function(t,n){var r=e(this.__entries__,t);~r?this.__entries__[r][1]=n:this.__entries__.push([t,n])},t.prototype.delete=function(t){var n=this.__entries__,r=e(n,t);~r&&n.splice(r,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var n=0,r=this.__entries__;n<r.length;n++){var o=r[n];e.call(t,o[1],o[0])}},t}()}(),pa="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,fa="undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),ha="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(fa):function(e){return setTimeout((function(){return e(Date.now())}),1e3/60)};var ma=["top","right","bottom","left","width","height","size","weight"],ga="undefined"!=typeof MutationObserver,ya=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(e,t){var n=!1,r=!1,o=0;function a(){n&&(n=!1,e()),r&&i()}function s(){ha(a)}function i(){var e=Date.now();if(n){if(e-o<2)return;r=!0}else n=!0,r=!1,setTimeout(s,t);o=e}return i}(this.refresh.bind(this),20)}return e.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},e.prototype.removeObserver=function(e){var t=this.observers_,n=t.indexOf(e);~n&&t.splice(n,1),!t.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},e.prototype.updateObservers_=function(){var e=this.observers_.filter((function(e){return e.gatherActive(),e.hasActive()}));return e.forEach((function(e){return e.broadcastActive()})),e.length>0},e.prototype.connect_=function(){pa&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),ga?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){pa&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,n=void 0===t?"":t;ma.some((function(e){return!!~n.indexOf(e)}))&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),ba=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},va=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||fa},wa=Da(0,0,0,0);function xa(e){return parseFloat(e)||0}function Sa(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce((function(t,n){return t+xa(e["border-"+n+"-width"])}),0)}function _a(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return wa;var r=va(e).getComputedStyle(e),o=function(e){for(var t={},n=0,r=["top","right","bottom","left"];n<r.length;n++){var o=r[n],a=e["padding-"+o];t[o]=xa(a)}return t}(r),a=o.left+o.right,s=o.top+o.bottom,i=xa(r.width),l=xa(r.height);if("border-box"===r.boxSizing&&(Math.round(i+a)!==t&&(i-=Sa(r,"left","right")+a),Math.round(l+s)!==n&&(l-=Sa(r,"top","bottom")+s)),!function(e){return e===va(e).document.documentElement}(e)){var c=Math.round(i+a)-t,u=Math.round(l+s)-n;1!==Math.abs(c)&&(i-=c),1!==Math.abs(u)&&(l-=u)}return Da(o.left,o.top,i,l)}var Oa="undefined"!=typeof SVGGraphicsElement?function(e){return e instanceof va(e).SVGGraphicsElement}:function(e){return e instanceof va(e).SVGElement&&"function"==typeof e.getBBox};function ja(e){return pa?Oa(e)?function(e){var t=e.getBBox();return Da(0,0,t.width,t.height)}(e):_a(e):wa}function Da(e,t,n,r){return{x:e,y:t,width:n,height:r}}var Ea=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Da(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e=ja(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},e}(),Ca=function(){return function(e,t){var n,r,o,a,s,i,l,c=(r=(n=t).x,o=n.y,a=n.width,s=n.height,i="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,l=Object.create(i.prototype),ba(l,{x:r,y:o,width:a,height:s,top:o,right:r+a,bottom:s+o,left:r}),l);ba(this,{target:e,contentRect:c})}}(),ka=function(){function e(e,t,n){if(this.activeObservations_=[],this.observations_=new da,"function"!=typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=n}return e.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof va(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new Ea(e)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof va(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach((function(t){t.isActive()&&e.activeObservations_.push(t)}))},e.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map((function(e){return new Ca(e.target,e.broadcastRect())}));this.callback_.call(e,t,e),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),Na="undefined"!=typeof WeakMap?new WeakMap:new da,Pa=function(){return function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=ya.getInstance(),r=new ka(t,n,this);Na.set(this,r)}}();["observe","unobserve","disconnect"].forEach((function(e){Pa.prototype[e]=function(){var t;return(t=Na.get(this))[e].apply(t,arguments)}}));var Ra=void 0!==fa.ResizeObserver?fa.ResizeObserver:Pa;const Ma=c(Object.freeze(Object.defineProperty({__proto__:null,default:Ra},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(ua,"__esModule",{value:!0}),ua.default=function(e){var t;return t=class extends za.Component{constructor(){super(...arguments),qa(this,"state",{width:1280}),qa(this,"elementRef",za.createRef()),qa(this,"mounted",!1),qa(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new La.default((e=>{if(this.elementRef.current instanceof HTMLElement){const t=e[0].contentRect.width;this.setState({width:t})}}));const e=this.elementRef.current;e instanceof HTMLElement&&this.resizeObserver.observe(e)}componentWillUnmount(){this.mounted=!1;const e=this.elementRef.current;e instanceof HTMLElement&&this.resizeObserver.unobserve(e),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:t,...n}=this.props;return t&&!this.mounted?za.createElement("div",{className:(0,Ia.default)(this.props.className,Ba),style:this.props.style,ref:this.elementRef}):za.createElement(e,Wa({innerRef:this.elementRef},n,this.state))}},qa(t,"defaultProps",{measureBeforeMount:!1}),qa(t,"propTypes",{measureBeforeMount:Ta.default.bool}),t};var za=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=Aa(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var s=o?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(r,a,s):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}(l),Ta=Ha(u),La=Ha(Ma),Ia=Ha(Yt);function Ha(e){return e&&e.__esModule?e:{default:e}}function Aa(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(Aa=function(e){return e?n:t})(e)}function Wa(){return Wa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wa.apply(this,arguments)}function qa(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ba="react-grid-layout";var Ga;(Ga=Wt).exports=qt.default,Ga.exports.utils=Xt,Ga.exports.calculateUtils=En,Ga.exports.Responsive=Yo.default,Ga.exports.Responsive.utils=Xo,Ga.exports.WidthProvider=ua.default;var Fa=Wt.exports;const Va=[p(),f({syntaxHighlighting:!0,highlightSpecialChars:!1,history:!1,drawSelection:!1,defaultKeymap:!1,historyKeymap:!1})],Ua=l.memo((e=>{const t=h(8),{code:n,className:r}=e,{theme:o}=m();let a;t[0]!==r?(a=g(r,"text-muted-foreground flex flex-col overflow-hidden"),t[0]=r,t[1]=a):a=t[1];const s="dark"===o?"dark":"light";let i,l;return t[2]!==s||t[3]!==n?(i=y.jsx(b,{minHeight:"10px",theme:s,height:"100%",className:"tiny-code",editable:!1,basicSetup:!1,extensions:Va,value:n}),t[2]=s,t[3]=n,t[4]=i):i=t[4],t[5]!==a||t[6]!==i?(l=y.jsx("div",{className:a,children:i}),t[5]=a,t[6]=i,t[7]=l):l=t[7],l}));Ua.displayName="TinyCode";const Ya=Fa.WidthProvider(Fa.Responsive),Xa=[0,0],$a="grid-drag-handle",Ka=l.memo((e=>{const t=h(18),{output:n,cellId:r,status:o,mode:a,code:s,hidden:i,isScrollable:l,side:c,className:u}=e,d="running"===o||"queued"===o;if((null==n||""===n.data)&&"read"!==a){let e;return t[0]!==u||t[1]!==s?(e=y.jsx(Ua,{className:u,code:s}),t[0]=u,t[1]=s,t[2]=e):e=t[2],e}const p=i&&"invisible",f=l?"overflow-y-auto":"overflow-y-hidden",m="top"===c&&"flex items-start",b="bottom"===c&&"flex items-end",v="left"===c&&"flex justify-start",w="right"===c&&"flex justify-end";let x,S,_;return t[3]!==u||t[4]!==p||t[5]!==f||t[6]!==m||t[7]!==b||t[8]!==v||t[9]!==w?(x=g(u,"h-full w-full p-2 overflow-x-auto",p,f,m,b,v,w),t[3]=u,t[4]=p,t[5]=f,t[6]=m,t[7]=b,t[8]=v,t[9]=w,t[10]=x):x=t[10],t[11]!==n||t[12]!==r||t[13]!==d?(S=y.jsx(E,{allowExpand:!1,output:n,cellId:r,stale:d}),t[11]=n,t[12]=r,t[13]=d,t[14]=S):S=t[14],t[15]!==x||t[16]!==S?(_=y.jsx("div",{className:x,children:S}),t[15]=x,t[16]=S,t[17]=_):_=t[17],_}));Ka.displayName="GridCell";const Qa=e=>{const t=h(38),{layout:n,setLayout:r,isLocked:o,setIsLocked:a}=e;let s,i,l,c,u,d,p,f,m,g,b,v,w,_,O;return t[0]===Symbol.for("react.memo_cache_sentinel")?(s=y.jsx(C,{htmlFor:"columns",children:"Columns"}),t[0]=s):s=t[0],t[1]!==r||t[2]!==n?(i=e=>{r({...n,columns:e})},t[1]=r,t[2]=n,t[3]=i):i=t[3],t[4]!==n.columns||t[5]!==i?(l=y.jsxs("div",{className:"flex flex-row items-center gap-2",children:[s,y.jsx(x,{"data-testid":"grid-columns-input",id:"columns",value:n.columns,className:"w-[60px]",placeholder:"# of Columns",minValue:1,onChange:i})]}),t[4]=n.columns,t[5]=i,t[6]=l):l=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(c=y.jsx(C,{htmlFor:"rowHeight",children:"Row Height (px)"}),t[7]=c):c=t[7],t[8]!==r||t[9]!==n?(u=e=>{r({...n,rowHeight:e})},t[8]=r,t[9]=n,t[10]=u):u=t[10],t[11]!==n.rowHeight||t[12]!==u?(d=y.jsxs("div",{className:"flex flex-row items-center gap-2",children:[c,y.jsx(x,{"data-testid":"grid-row-height-input",id:"rowHeight",value:n.rowHeight,className:"w-[60px]",placeholder:"Row Height (px)",minValue:1,onChange:u})]}),t[11]=n.rowHeight,t[12]=u,t[13]=d):d=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(p=y.jsx(C,{htmlFor:"maxWidth",children:"Max Width (px)"}),t[14]=p):p=t[14],t[15]!==r||t[16]!==n?(f=e=>{r({...n,maxWidth:Number.isNaN(e)?void 0:e})},t[15]=r,t[16]=n,t[17]=f):f=t[17],t[18]!==n.maxWidth||t[19]!==f?(m=y.jsxs("div",{className:"flex flex-row items-center gap-2",children:[p,y.jsx(x,{"data-testid":"grid-max-width-input",id:"maxWidth",value:n.maxWidth,className:"w-[90px]",step:100,placeholder:"Full",onChange:f})]}),t[18]=n.maxWidth,t[19]=f,t[20]=m):m=t[20],t[21]===Symbol.for("react.memo_cache_sentinel")?(g=y.jsxs(C,{className:"flex flex-row items-center gap-1",htmlFor:"lock",children:[y.jsx(k,{className:"h-3 w-3"}),"Bordered"]}),t[21]=g):g=t[21],t[22]!==r||t[23]!==n?(b=e=>{r({...n,bordered:e})},t[22]=r,t[23]=n,t[24]=b):b=t[24],t[25]!==n.bordered||t[26]!==b?(v=y.jsxs("div",{className:"flex flex-row items-center gap-2",children:[g,y.jsx(S,{"data-testid":"grid-bordered-switch",id:"lock",checked:n.bordered,size:"sm",onCheckedChange:b})]}),t[25]=n.bordered,t[26]=b,t[27]=v):v=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(w=y.jsxs(C,{className:"flex flex-row items-center gap-1",htmlFor:"lock",children:[y.jsx(N,{className:"h-3 w-3"}),"Lock Grid"]}),t[28]=w):w=t[28],t[29]!==o||t[30]!==a?(_=y.jsxs("div",{className:"flex flex-row items-center gap-2",children:[w,y.jsx(S,{"data-testid":"grid-lock-switch",id:"lock",checked:o,size:"sm",onCheckedChange:a})]}),t[29]=o,t[30]=a,t[31]=_):_=t[31],t[32]!==l||t[33]!==d||t[34]!==m||t[35]!==v||t[36]!==_?(O=y.jsxs("div",{className:"flex flex-row absolute pl-5 top-8 gap-4 w-full justify-end pr-[350px] pb-3 border-b z-50",children:[l,d,m,v,_]}),t[32]=l,t[33]=d,t[34]=m,t[35]=v,t[36]=_,t[37]=O):O=t[37],O},Za=v.forwardRef(((e,t)=>{const n=h(30);let r,o,a,s,i,c,u,d,p,f;n[0]!==e?(({children:f,isDragging:r,className:o,onDelete:a,isScrollable:s,setIsScrollable:i,side:c,setSide:u,display:d,...p}=e),n[0]=e,n[1]=r,n[2]=o,n[3]=a,n[4]=s,n[5]=i,n[6]=c,n[7]=u,n[8]=d,n[9]=p,n[10]=f):(r=n[1],o=n[2],a=n[3],s=n[4],i=n[5],c=n[6],u=n[7],d=n[8],p=n[9],f=n[10]);const[m,b]=l.useState(),v=m&&"border-[var(--sky-8)] z-20",w=!m&&"hover-actions-parent",x=r&&"bg-[var(--slate-2)] border-border z-20";let S,_,O;return n[11]!==o||n[12]!==v||n[13]!==w||n[14]!==x?(S=g(o,"relative z-10 hover:z-20","bg-background border-transparent hover:border-[var(--sky-8)] border",v,w,x),n[11]=o,n[12]=v,n[13]=w,n[14]=x,n[15]=S):S=n[15],n[16]!==a||n[17]!==s||n[18]!==i||n[19]!==c||n[20]!==u||n[21]!==d||n[22]!==m?(_=y.jsx(Ja,{onDelete:a,isScrollable:s,setIsScrollable:i,side:c,setSide:u,display:d,setPopoverOpened:b,popoverOpened:m}),n[16]=a,n[17]=s,n[18]=i,n[19]=c,n[20]=u,n[21]=d,n[22]=m,n[23]=_):_=n[23],n[24]!==t||n[25]!==p||n[26]!==S||n[27]!==f||n[28]!==_?(O=y.jsxs("div",{ref:t,...p,className:S,children:[f,_]}),n[24]=t,n[25]=p,n[26]=S,n[27]=f,n[28]=_,n[29]=O):O=n[29],O}));Za.displayName="EditableGridCell";const Ja=e=>{const t=h(43),{display:n,onDelete:r,side:o,setSide:a,isScrollable:s,setIsScrollable:i,popoverOpened:l,setPopoverOpened:c}=e,u="left"===o?kt:"right"===o?Et:void 0,d=!l&&"hover-action",p="top"===n&&"-top-6 rounded-t",f="bottom"===n&&"-bottom-6 rounded-b";let m;t[0]!==d||t[1]!==p||t[2]!==f?(m=g("absolute right-0 p-1 bg-[var(--sky-8)] text-white h-6 z-10 flex gap-2",d,p,f),t[0]=d,t[1]=p,t[2]=f,t[3]=m):m=t[3];const b="side"===l;let v,w,x,E,C;t[4]!==c?(v=e=>c(e?"side":void 0),t[4]=c,t[5]=v):v=t[5],t[6]!==u?(w=y.jsx(P,{asChild:!0,children:u?y.jsx(u,{className:"h-4 w-4 opacity-60 hover:opacity-100"}):y.jsx(Ct,{className:"h-4 w-4 opacity-60 hover:opacity-100"})}),t[6]=u,t[7]=w):w=t[7],t[8]!==a||t[9]!==o?(x=_.entries(es).map((e=>{const[t,n]=e;return y.jsxs(O,{onSelect:()=>a(t),children:[y.jsx(n,{className:"h-4 w-3 mr-2"}),y.jsx("span",{className:"flex-1",children:j(t)}),t===o&&y.jsx(D,{className:"h-4 w-4"})]},t)})),t[8]=a,t[9]=o,t[10]=x):x=t[10],t[11]!==x?(E=y.jsx(R,{side:"bottom",children:x}),t[11]=x,t[12]=E):E=t[12],t[13]!==b||t[14]!==v||t[15]!==w||t[16]!==E?(C=y.jsxs(M,{open:b,onOpenChange:v,children:[w,E]}),t[13]=b,t[14]=v,t[15]=w,t[16]=E,t[17]=C):C=t[17];const k="scroll"===l;let N,T,L,I,H,A,W,q,B,G;return t[18]!==c?(N=e=>c(e?"scroll":void 0),t[18]=c,t[19]=N):N=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(T=y.jsx(P,{asChild:!0,children:y.jsx(Lt,{className:"h-4 w-4 opacity-60 hover:opacity-100"})}),t[20]=T):T=t[20],t[21]!==i||t[22]!==s?(L=()=>i(!s),t[21]=i,t[22]=s,t[23]=L):L=t[23],t[24]===Symbol.for("react.memo_cache_sentinel")?(I=y.jsx("span",{className:"flex-1",children:"Scrollable"}),t[24]=I):I=t[24],t[25]!==s||t[26]!==i?(H=y.jsx(S,{"data-testid":"grid-scrollable-switch",checked:s,size:"sm",onCheckedChange:i}),t[25]=s,t[26]=i,t[27]=H):H=t[27],t[28]!==L||t[29]!==H?(A=y.jsx(R,{side:"bottom",children:y.jsxs(O,{onSelect:L,children:[I,H]})}),t[28]=L,t[29]=H,t[30]=A):A=t[30],t[31]!==k||t[32]!==N||t[33]!==A?(W=y.jsxs(M,{open:k,onOpenChange:N,children:[T,A]}),t[31]=k,t[32]=N,t[33]=A,t[34]=W):W=t[34],t[35]===Symbol.for("react.memo_cache_sentinel")?(q=y.jsx(Rt,{className:g($a,"cursor-move","h-4 w-4 opacity-60 hover:opacity-100")}),t[35]=q):q=t[35],t[36]!==r?(B=y.jsx(z,{className:"h-4 w-4 opacity-60 hover:opacity-100",onClick:()=>r()}),t[36]=r,t[37]=B):B=t[37],t[38]!==m||t[39]!==C||t[40]!==W||t[41]!==B?(G=y.jsxs("div",{className:m,children:[C,W,q,B]}),t[38]=m,t[39]=C,t[40]=W,t[41]=B,t[42]=G):G=t[42],G},es={left:kt,right:Et};function ts(e){return e.i}function ns(e){return e.i}function rs(){window.dispatchEvent(new Event("resize"))}const os={type:"grid",name:"Grid",validator:T.object({columns:T.number().min(1),rowHeight:T.number().min(1),maxWidth:T.number().optional(),bordered:T.boolean().optional(),cells:T.array(T.object({position:T.tuple([T.number(),T.number(),T.number(),T.number()]).nullable(),scrollable:T.boolean().optional(),alignment:T.enum(["top","bottom","left","right"]).optional()}))}),deserializeLayout:(e,t)=>{if(0===e.cells.length)return{columns:e.columns,rowHeight:e.rowHeight,scrollableCells:new Set,cellSide:new Map,cells:[]};e.cells.length!==t.length&&a.warn("Number of cells in layout does not match number of cells in notebook");const n=new Set,r=new Map,o=e.cells.flatMap(((e,o)=>{const a=e.position;if(!a)return[];const s=t[o];return s?(e.scrollable&&n.add(s.id),e.side&&r.set(s.id,e.side),{i:s.id,x:a[0],y:a[1],w:a[2],h:a[3]}):[]}));return{columns:e.columns,rowHeight:e.rowHeight,maxWidth:e.maxWidth,bordered:e.bordered,cells:o,cellSide:r,scrollableCells:n}},serializeLayout:(e,t)=>{const n=w.keyBy(e.cells,(e=>e.i)),r=t.map((t=>{const r=n.get(t.id);if(!r)return{position:null};const o={position:[r.x,r.y,r.w,r.h]};return e.scrollableCells.has(t.id)&&(o.scrollable=!0),e.cellSide.has(t.id)&&(o.side=e.cellSide.get(t.id)),o}));return{columns:e.columns,rowHeight:e.rowHeight,maxWidth:e.maxWidth,bordered:e.bordered,cells:r}},Component:e=>{const t=h(61),{layout:n,setLayout:r,cells:o,mode:a}=e,s="read"===a,i=new Set(n.cells.map(ts)),[c,u]=l.useState(null),[d,p]=l.useState(!1);let f,m;t[0]!==n.columns?(m={lg:n.columns},t[0]=n.columns,t[1]=m):m=t[1],f=m;const b=f;let x,S;t[2]!==n.bordered?(x=()=>{const e=document.getElementById("App");return n.bordered?null==e||e.classList.add("grid-bordered"):null==e||e.classList.remove("grid-bordered"),()=>{null==e||e.classList.remove("grid-bordered")}},S=[n.bordered],t[2]=n.bordered,t[3]=x,t[4]=S):(x=t[3],S=t[4]),l.useEffect(x,S);const _=function(){const e=h(10),[t,n]=l.useState(!1);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={x:0,y:0},e[0]=r):r=e[0];const[o,a]=v.useState(r),[s,i]=v.useState(!1);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=e=>{n(!0),a({x:e.clientX,y:e.clientY})},e[1]=c):c=e[1];const u=c;let d;e[2]!==t||e[3]!==o.x||e[4]!==o.y?(d=e=>{if(t){const t=e.clientX-o.x,n=e.clientY-o.y;i(Math.hypot(t,n)>10)}},e[2]=t,e[3]=o.x,e[4]=o.y,e[5]=d):d=e[5];const p=d;let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{n(!1),i(!1)},e[6]=f):f=e[6];const m=f,g=t&&s;let y;return e[7]!==g||e[8]!==p?(y={isDragging:g,onDragStart:u,onDragMove:p,onDragStop:m},e[7]=g,e[8]=p,e[9]=y):y=e[9],y}();let O,j;t[5]!==_?(({isDragging:j,...O}=_),t[5]=_,t[6]=O,t[7]=j):(O=t[6],j=t[7]);const D=!s&&!d,E=w.keyBy(n.cells,ns);let C;t[8]!==n||t[9]!==r?(C=e=>t=>{const o=new Set(n.scrollableCells);t?o.add(e):o.delete(e),r({...n,scrollableCells:o})},t[8]=n,t[9]=r,t[10]=C):C=t[10];const k=C;let N;t[11]!==n||t[12]!==r?(N=e=>t=>{const o=new Map(n.cellSide);t===o.get(e)?o.delete(e):o.set(e,t),r({...n,cellSide:o})},t[11]=n,t[12]=r,t[13]=N):N=t[13];const P=N;let R,M;t[14]!==n||t[15]!==D?(R={},n.maxWidth&&(R.maxWidth=`${n.maxWidth}px`),D&&(R.backgroundImage="repeating-linear-gradient(var(--gray-4) 0 1px, transparent 1px 100%), repeating-linear-gradient(90deg, var(--gray-4) 0 1px, transparent 1px 100%)",R.backgroundSize=`calc((100% / ${n.columns})) ${n.rowHeight}px`),t[14]=n,t[15]=D,t[16]=R):R=t[16],t[17]!==n.cells?(M={lg:n.cells},t[17]=n.cells,t[18]=M):M=t[18];const z=D&&"bg-[var(--slate-2)] border-r",T=s&&"disable-animation",L=!n.maxWidth&&"min-w-[800px]";let I,H,A,W,q,B,G,F;t[19]!==z||t[20]!==T||t[21]!==L?(I=g("w-full mx-auto bg-background flex-1 min-h-full",z,T,L),t[19]=z,t[20]=T,t[21]=L,t[22]=I):I=t[22],t[23]!==s?(H=s?[20,20]:void 0,t[23]=s,t[24]=H):H=t[24],t[25]!==r||t[26]!==n?(A=e=>r({...n,cells:e}),t[25]=r,t[26]=n,t[27]=A):A=t[27],t[28]!==c?(W=c?{i:c.i,w:c.w||2,h:c.h||2}:void 0,t[28]=c,t[29]=W):W=t[29],t[30]!==O||t[31]!==r||t[32]!==n?(q=(e,t,o)=>{O.onDragStop(),t&&r({...n,cells:[...e,t]})},t[30]=O,t[31]=r,t[32]=n,t[33]=q):q=t[33],t[34]!==O?(B=(e,t,n,r,o)=>{O.onDragStart(o)},G=(e,t,n,r,o)=>{O.onDragMove(o)},F=()=>{O.onDragStop()},t[34]=O,t[35]=B,t[36]=G,t[37]=F):(B=t[35],G=t[36],F=t[37]);let V=y.jsx(Ya,{breakpoint:"lg",layouts:M,style:R,cols:b,allowOverlap:!1,className:I,containerPadding:H,margin:Xa,isBounded:!1,compactType:null,preventCollision:!0,rowHeight:n.rowHeight,onLayoutChange:A,droppingItem:W,onDrop:q,onDragStart:B,onDrag:G,onDragStop:F,onResizeStop:rs,isDraggable:D,isDroppable:D,isResizable:D,draggableHandle:D?`.${$a}`:"noop",children:o.filter((e=>i.has(e.id))).map((e=>{const t=E.get(e.id),o=n.scrollableCells.has(e.id)??!1,s=n.cellSide.get(e.id),i=y.jsx(Ka,{code:e.code,mode:a,cellId:e.id,output:e.output,status:e.status,isScrollable:o,side:s,hidden:e.errored||e.interrupted||e.stopped});return D?y.jsx(Za,{id:e.id,isDragging:j,side:s,setSide:P(e.id),isScrollable:o,setIsScrollable:k(e.id),display:0===(null==t?void 0:t.y)?"bottom":"top",onDelete:()=>{r({...n,cells:n.cells.filter((t=>t.i!==e.id))})},children:i},e.id):y.jsx("div",{children:i},e.id)}))});if(s)return n.bordered&&(V=y.jsx("div",{className:"flex flex-1 flex-col items-center",children:y.jsx("div",{style:R,className:"bg-background flex-1 border-t border-x rounded-t shadow-sm w-full overflow-hidden",children:V})})),V;const U=o.filter((e=>!i.has(e.id)));let Y,X,$,K;n.bordered&&(V=y.jsx("div",{style:R,className:"bg-background border-t border-x rounded-t shadow-sm w-full mx-auto mt-4 h-[calc(100%-1rem)] overflow-hidden",children:y.jsx("div",{className:"h-full overflow-auto",children:V})})),t[38]!==n||t[39]!==r||t[40]!==d?(Y=y.jsx(Qa,{layout:n,setLayout:r,isLocked:d,setIsLocked:p}),t[38]=n,t[39]=r,t[40]=d,t[41]=Y):Y=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(X=g("relative flex z-10 flex-1 overflow-hidden"),$=g("flex-grow overflow-auto transparent-when-disconnected"),t[42]=X,t[43]=$):(X=t[42],$=t[43]),t[44]!==V?(K=y.jsx("div",{className:$,children:V}),t[44]=V,t[45]=K):K=t[45];let Q,Z;t[46]===Symbol.for("react.memo_cache_sentinel")?(Q=y.jsx("div",{className:"text font-bold text-[var(--slate-20)] flex-shrink-0",children:"Outputs"}),t[46]=Q):Q=t[46],t[47]!==n.columns||t[48]!==n.rowHeight||t[49]!==a?(Z=e=>y.jsx("div",{draggable:!0,unselectable:"on","data-cell-id":e.id,onDragStart:t=>{const r=t.currentTarget.offsetHeight;u({i:e.id,w:n.columns/4,h:Math.ceil(r/n.rowHeight)||1}),t.dataTransfer.setData("text/plain","")},className:g($a,"droppable-element bg-background border-border border overflow-hidden p-2 rounded flex-shrink-0"),children:y.jsx(Ka,{code:e.code,className:"select-none pointer-events-none",mode:a,cellId:e.id,output:e.output,isScrollable:!1,status:e.status,hidden:!1})},e.id),t[47]=n.columns,t[48]=n.rowHeight,t[49]=a,t[50]=Z):Z=t[50];const J=U.map(Z);let ee,te,ne;return t[51]!==Q||t[52]!==J?(ee=y.jsxs("div",{className:"flex-none flex flex-col w-[300px] p-2 pb-20 gap-2 overflow-auto bg-[var(--slate-2)] border-t border-x rounded-t shadow-sm transparent-when-disconnected mx-2 mt-4",children:[Q,J]}),t[51]=Q,t[52]=J,t[53]=ee):ee=t[53],t[54]!==X||t[55]!==K||t[56]!==ee?(te=y.jsxs("div",{className:X,children:[K,ee]}),t[54]=X,t[55]=K,t[56]=ee,t[57]=te):te=t[57],t[58]!==Y||t[59]!==te?(ne=y.jsxs(y.Fragment,{children:[Y,te]}),t[58]=Y,t[59]=te,t[60]=ne):ne=t[60],ne},getInitialLayout:()=>({columns:24,rowHeight:20,maxWidth:1400,bordered:!0,scrollableCells:new Set,cellSide:new Map,cells:[]})},as=e=>{const t=h(15),{invisible:n,appConfig:r,className:o,children:a,innerClassName:s}=e;let i;t[0]!==o?(i=g("px-1 sm:px-16 md:px-20 xl:px-24 print:px-0 print:pb-0",o),t[0]=o,t[1]=i):i=t[1];const l="compact"===r.width&&"max-w-contentWidth min-w-[400px]",c="medium"===r.width&&"max-w-contentWidthMedium min-w-[400px]",u="columns"===r.width&&"w-fit",d="full"===r.width&&"max-w-full",p=n&&"invisible";let f,m,b;return t[2]!==l||t[3]!==c||t[4]!==u||t[5]!==d||t[6]!==p||t[7]!==s?(f=g("m-auto pb-24 sm:pb-12",l,c,u,d,p,s),t[2]=l,t[3]=c,t[4]=u,t[5]=d,t[6]=p,t[7]=s,t[8]=f):f=t[8],t[9]!==f||t[10]!==a?(m=y.jsx("div",{className:f,children:a}),t[9]=f,t[10]=a,t[11]=m):m=t[11],t[12]!==i||t[13]!==m?(b=y.jsx("div",{className:i,children:m}),t[12]=i,t[13]=m,t[14]=b):b=t[14],b};function ss(e,t){const[n,r]=l.useState(!0);return l.useEffect((()=>{const n=Math.max(Math.min(15*(e-1),100),0),o=setTimeout((()=>{r(!1),"read"!==t&&requestAnimationFrame((()=>{!function(){var e;const{cellIds:t,cellData:n,cellHandles:r}=L();for(const o of t.iterateTopLevelIds){const t=r[o];if(!n[o].config.hide_code&&(null==(e=null==t?void 0:t.current)?void 0:e.editorView))return void t.current.editorView.focus()}}()}))}),n);return()=>clearTimeout(o)}),[]),{invisible:n}}const is=e=>{const t=h(13);let n,r,o,a;t[0]!==e?(({value:n,onChange:r,placeholder:o,...a}=e),t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=a):(n=t[1],r=t[2],o=t[3],a=t[4]);const s=l.useRef(null),i=cs(n,r);let c;t[5]!==i.onBlur?(c=()=>{const e=i.onBlur,t=s.current;if(t)return t.addEventListener("blur",e),()=>{t.removeEventListener("blur",e)}},t[5]=i.onBlur,t[6]=c):c=t[6],I(c);const u=i.value,d=i.onChange;let p,f;return t[7]===Symbol.for("react.memo_cache_sentinel")?(p=A.onEnter(A.stopPropagation()),t[7]=p):p=t[7],t[8]!==i.value||t[9]!==i.onChange||t[10]!==o||t[11]!==a?(f=y.jsx(H,{"data-testid":"cell-name-input",value:u,onChange:d,ref:s,placeholder:o,className:"shadow-none! hover:shadow-none focus:shadow-none focus-visible:shadow-none",onKeyDown:p,...a}),t[8]=i.value,t[9]=i.onChange,t[10]=o,t[11]=a,t[12]=f):f=t[12],f},ls=e=>{const t=h(11),{value:n,cellId:r,className:o}=e,{updateCellName:a}=W();let s;t[0]!==a||t[1]!==r?(s=e=>a({cellId:r,name:e}),t[0]=a,t[1]=r,t[2]=s):s=t[2];const i=cs(n,s);if(q(n))return null;let l;t[3]!==o?(l=g("outline-none border hover:border-cyan-500/40 focus:border-cyan-500/40",o),t[3]=o,t[4]=l):l=t[4];const c=i.onChange,u=i.onBlur;let d,p;return t[5]===Symbol.for("react.memo_cache_sentinel")?(d=A.onEnter(us),t[5]=d):d=t[5],t[6]!==l||t[7]!==i.onChange||t[8]!==i.onBlur||t[9]!==n?(p=y.jsx(V,{content:"Click to rename",children:y.jsx("span",{className:l,contentEditable:!0,suppressContentEditableWarning:!0,onChange:c,onBlur:u,onKeyDown:d,children:n})}),t[6]=l,t[7]=i.onChange,t[8]=i.onBlur,t[9]=n,t[10]=p):p=t[10],p};function cs(e,t){const n=h(11),[r,o]=l.useState(e);let a;n[0]!==e||n[1]!==t?(a=n=>{if(n===e)return;if(!n||q(n))return void t(n);const r=B(n,G());t(r)},n[0]=e,n[1]=t,n[2]=a):a=n[2];const s=a;let i,c,u,d;return n[3]!==r?(i=q(r)?"":r,n[3]=r,n[4]=i):i=n[4],n[5]===Symbol.for("react.memo_cache_sentinel")?(c=e=>{const t=e.target.value,n=F(t);o(n)},n[5]=c):c=n[5],n[6]!==s?(u=e=>{if(e.target instanceof HTMLInputElement){const t=e.target.value;s(F(t))}else if(e.target instanceof HTMLSpanElement){const t=e.target.innerText.trim();s(F(t))}},n[6]=s,n[7]=u):u=n[7],n[8]!==i||n[9]!==u?(d={value:i,onChange:c,onBlur:u},n[8]=i,n[9]=u,n[10]=d):d=n[10],d}function us(e){e.target instanceof HTMLElement&&e.target.blur()}const ds=new U,ps=e=>{const t=h(33),n=v.useRef(null),{consoleOutputs:r,stale:o,cellName:a,cellId:s,onSubmitDebugger:i,onRefactorWithAI:c,className:u}=e,d=r.length>0;let p,f,m,b,w,x,S,_;if(t[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{const e=n.current;if(!e)return;const t=e.scrollHeight-e.clientHeight;t-e.scrollTop<120&&(e.scrollTop=t)},t[0]=p):p=t[0],l.useLayoutEffect(p),!d&&q(a))return null;if(t[1]!==r||t[2]!==o||t[3]!==n||t[4]!==d||t[5]!==u||t[6]!==i||t[7]!==s||t[8]!==c){const e=[...r].reverse();f=o?"This console output is stale":void 0,m="console-output-area",b=n;const a=o&&"marimo-output-stale",l=d?"p-5":"p-3";let p;t[14]!==a||t[15]!==l||t[16]!==u?(w=g("console-output-area overflow-hidden rounded-b-lg flex flex-col-reverse w-full",a,l,u),t[14]=a,t[15]=l,t[16]=u,t[17]=w):w=t[17],t[18]!==r.length||t[19]!==i||t[20]!==s||t[21]!==c?(p=(e,t)=>{if("pdb"===e.channel)return null;if("stdin"===e.channel){Y("string"==typeof e.data,"Expected data to be a string");const n=r.length-t-1;return null==e.response?y.jsx(fs,{output:e.data,onSubmit:e=>i(e,n)},t):y.jsx(hs,{output:e.data,response:e.response},t)}return y.jsx(v.Fragment,{children:y.jsx(X,{cellId:s,onRefactorWithAI:c,message:e})},t)},t[18]=r.length,t[19]=i,t[20]=s,t[21]=c,t[22]=p):p=t[22],x=e.map(p),t[1]=r,t[2]=o,t[3]=n,t[4]=d,t[5]=u,t[6]=i,t[7]=s,t[8]=c,t[9]=f,t[10]=m,t[11]=b,t[12]=w,t[13]=x}else f=t[9],m=t[10],b=t[11],w=t[12],x=t[13];return t[23]!==a||t[24]!==s?(S=y.jsx(ls,{value:a,cellId:s,className:"bg-[var(--slate-4)] border-[var(--slate-4)] hover:bg-[var(--slate-5)] dark:border-[var(--sky-5)] dark:bg-[var(--sky-6)] dark:text-[var(--sky-12)] text-[var(--slate-12)] rounded-tl rounded-br-lg absolute right-0 bottom-0 text-xs px-1.5 py-0.5 font-mono"}),t[23]=a,t[24]=s,t[25]=S):S=t[25],t[26]!==f||t[27]!==m||t[28]!==b||t[29]!==w||t[30]!==x||t[31]!==S?(_=y.jsxs("div",{title:f,"data-testid":m,ref:b,className:w,children:[x,S]}),t[26]=f,t[27]=m,t[28]=b,t[29]=w,t[30]=x,t[31]=S,t[32]=_):_=t[32],_},fs=e=>{const t=h(7);let n,r,o;return t[0]!==e.output?(n=ms(e.output),t[0]=e.output,t[1]=n):n=t[1],t[2]!==e?(r=y.jsx(H,{"data-testid":"console-input",type:"text",autoComplete:"off",autoFocus:!0,className:"m-0",placeholder:"stdin",onKeyDown:t=>{"Enter"!==t.key||t.shiftKey||e.onSubmit(t.currentTarget.value)}}),t[2]=e,t[3]=r):r=t[3],t[4]!==n||t[5]!==r?(o=y.jsxs("div",{className:"flex gap-2 items-center",children:[n,r]}),t[4]=n,t[5]=r,t[6]=o):o=t[6],o},hs=e=>{const t=h(7);let n,r,o;return t[0]!==e.output?(n=ms(e.output),t[0]=e.output,t[1]=n):n=t[1],t[2]!==e.response?(r=y.jsx("span",{className:"text-[var(--sky-11)]",children:e.response}),t[2]=e.response,t[3]=r):r=t[3],t[4]!==n||t[5]!==r?(o=y.jsxs("div",{className:"flex gap-2 items-center",children:[n,r]}),t[4]=n,t[5]=r,t[6]=o):o=t[6],o},ms=e=>y.jsx("span",{dangerouslySetInnerHTML:{__html:ds.ansi_to_html(e)}}),gs=/\/@file\/([^\s/]+)\.([\dA-Za-z]+)/g;class ys{static get INSTANCE(){const e="_marimo_private_VirtualFileTracker";return window[e]||(window[e]=new ys),window[e]}constructor(){this.virtualFiles=new Map}track(e){const t=e.output,n=e.cell_id;if(t)switch(t.mimetype){case"application/json":case"text/html":{const e=this.virtualFiles.get(n),r=function(e){if(!e)return new Set;const t=new Set,n=("string"==typeof e?e:JSON.stringify(e)).match(gs);if(n)for(const r of n)t.add(r);return t}(t.data);return null==e||e.forEach((e=>r.add(e))),void this.virtualFiles.set(n,r)}default:return}}filenames(){const e=new Set;for(const t of this.virtualFiles.values())t.forEach((t=>e.add(t)));return[...e]}removeForCellId(e){this.virtualFiles.delete(e)}}async function bs(e){const{filename:t,includeCode:n}=e,r=await $({download:!0,includeCode:n,files:ys.INSTANCE.filenames()}),o=K.basename(t)??"notebook.py";Q(new Blob([r],{type:"text/html"}),Z.toHTML(o))}function vs(e){const t=h(5),[n,r]=l.useState(void 0),o=l.useRef(null),a=l.useRef(null);let s,i,c;return t[0]!==e?(s=()=>{if(0===e.length)return;return o.current=new IntersectionObserver((e=>{let t;if(t=!1,e.forEach((e=>{const n=e.target;e.isIntersecting?(!a.current||n.getBoundingClientRect().top<a.current.getBoundingClientRect().top)&&(a.current=n,t=!0):n===a.current&&(a.current=null,t=!0)})),t&&a.current){const e=ee(a.current),t="id"in e?e.id:e.path;r(t)}}),{root:"edit"===J?document.getElementById("App"):void 0,rootMargin:"0px",threshold:0}),e.forEach((e=>{var t;e&&(null==(t=o.current)||t.observe(e[0]))})),()=>{o.current&&o.current.disconnect(),a.current=null}},i=[e],t[0]=e,t[1]=s,t[2]=i):(s=t[1],i=t[2]),l.useEffect(s,i),t[3]!==n?(c={activeHeaderId:n},t[3]=n,t[4]=c):c=t[4],c}function ws(e){if(0===e.length)return[];const t=new Map;return e.map((e=>{const n="id"in e.by?e.by.id:e.by.path,r=t.get(n)??0;t.set(n,r+1);const o=Ss(e,r);return o?[o,n]:null})).filter(Boolean)}function xs(e,t){const n=Ss(e,t);n?(n.scrollIntoView({behavior:"smooth",block:"start"}),n.classList.add("outline-item-highlight"),setTimeout((()=>{n.classList.remove("outline-item-highlight")}),3e3)):a.warn("Could not find element for outline item",e)}function Ss(e,t){if("id"in e.by){return document.querySelectorAll(`[id="${CSS.escape(e.by.id)}"]`)[t]}return document.evaluate(e.by.path,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}const _s=()=>{const e=h(17),{items:t}=te(ne);let n;e[0]!==t?(n=ws(t),e[0]=t,e[1]=n):n=e[1];const{activeHeaderId:r}=vs(n),[o,a]=v.useState(!1);if(t.length<2)return null;let s,i,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=()=>a(!0),i=()=>a(!1),l=g("fixed top-[25vh] right-8 z-[10000]","hidden md:block"),e[2]=s,e[3]=i,e[4]=l):(s=e[2],i=e[3],l=e[4]);const c=o?"-left-[280px] opacity-100":"left-[300px] opacity-0";let u,d,p,f;return e[5]!==c?(u=g("-top-4 max-h-[70vh] bg-background rounded-lg shadow-lg absolute overflow-auto transition-all duration-300 w-[300px] border",c),e[5]=c,e[6]=u):u=e[6],e[7]!==u||e[8]!==t||e[9]!==r?(d=y.jsx(js,{className:u,items:t,activeHeaderId:r}),e[7]=u,e[8]=t,e[9]=r,e[10]=d):d=e[10],e[11]!==t||e[12]!==r?(p=y.jsx(Os,{items:t,activeHeaderId:r}),e[11]=t,e[12]=r,e[13]=p):p=e[13],e[14]!==d||e[15]!==p?(f=y.jsxs("div",{onMouseEnter:s,onMouseLeave:i,className:l,children:[d,p]}),e[14]=d,e[15]=p,e[16]=f):f=e[16],f},Os=e=>{const t=h(7),{items:n,activeHeaderId:r}=e;let o,a,s;if(t[0]!==r||t[1]!==n){const e=new Map;o="flex flex-col gap-4 items-end max-h-[70vh] overflow-hidden",a=n.map(((t,n)=>{const o="id"in t.by?t.by.id:t.by.path,a=e.get(o)??0;return e.set(o,a+1),y.jsx("div",{className:g("h-[2px] bg-muted-foreground/60",1===t.level&&"w-5",2===t.level&&"w-4",3===t.level&&"w-3",4===t.level&&"w-2",r===o&&"bg-foreground"),onClick:()=>xs(t,a)},`${o}-${n}`)})),t[0]=r,t[1]=n,t[2]=o,t[3]=a}else o=t[2],a=t[3];return t[4]!==o||t[5]!==a?(s=y.jsx("div",{className:o,children:a}),t[4]=o,t[5]=a,t[6]=s):s=t[6],s},js=e=>{const t=h(10),{items:n,activeHeaderId:r,className:o}=e;let a,s,i;if(t[0]!==o||t[1]!==r||t[2]!==n){const e=new Map;t[5]!==o?(a=g("flex flex-col overflow-auto py-4 pl-2",o),t[5]=o,t[6]=a):a=t[6],s=n.map(((t,n)=>{const o="id"in t.by?t.by.id:t.by.path,a=e.get(o)??0;return e.set(o,a+1),y.jsx("div",{className:g("px-2 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l",1===t.level&&"font-semibold",2===t.level&&"ml-3",3===t.level&&"ml-6",4===t.level&&"ml-9",r===o&&"text-accent-foreground"),onClick:()=>xs(t,a),children:t.name},`${o}-${n}`)})),t[0]=o,t[1]=r,t[2]=n,t[3]=a,t[4]=s}else a=t[3],s=t[4];return t[7]!==a||t[8]!==s?(i=y.jsx("div",{className:a,children:s}),t[7]=a,t[8]=s,t[9]=i):i=t[9],i},Ds=e=>{const t=h(10),{canShowCode:n,showCode:r,onToggleShowCode:o}=e,a=ks,s=Ns;let i,l,c,u,d,p;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=g("right-0 top-0 z-50 m-4 no-print flex gap-2 print:hidden",pe()?"absolute":"fixed"),t[0]=i):i=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(l=y.jsx(P,{asChild:!0,children:y.jsx(he,{variant:"secondary",size:"xs",children:y.jsx(Nt,{className:"w-4 h-4"})})}),t[1]=l):l=t[1],t[2]!==n||t[3]!==r||t[4]!==o?(c=n&&y.jsxs(y.Fragment,{children:[y.jsxs(O,{onSelect:o,id:"notebook-action-show-code",children:[y.jsx(me,{className:"mr-2",size:14,strokeWidth:1.5}),y.jsx("span",{className:"flex-1",children:"Show code"}),r&&y.jsx(D,{className:"h-4 w-4"})]}),y.jsx(ge,{})]}),t[2]=n,t[3]=r,t[4]=o,t[5]=c):c=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(u=y.jsxs(O,{onSelect:s,id:"notebook-action-download-html",children:[y.jsx(Pt,{className:"mr-2",size:14,strokeWidth:1.5}),"Download as HTML"]}),t[6]=u):u=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(d=y.jsxs(O,{onSelect:a,id:"notebook-action-download-png",children:[y.jsx(zt,{className:"mr-2",size:14,strokeWidth:1.5}),"Download as PNG"]}),t[7]=d):d=t[7],t[8]!==c?(p=y.jsx("div",{id:"notebook-actions-dropdown",className:i,children:y.jsxs(M,{modal:!1,children:[l,y.jsxs(R,{align:"end",className:"no-print w-[220px]",children:[c,u,d]})]})}),t[8]=c,t[9]=p):p=t[9],p},Es=l.memo((e=>{const t=h(51),{output:n,consoleOutputs:r,cellOutputArea:o,cellId:a,status:s,stopped:i,errored:c,config:u,interrupted:d,staleInputs:p,runStartTimestamp:f,code:m,showCode:b,mode:v,name:w,kiosk:x}=e,S=l.useRef(null);let _;t[0]!==s||t[1]!==n||t[2]!==d||t[3]!==f||t[4]!==p?(_=re({status:s,output:n,interrupted:d,runStartTimestamp:f,staleInputs:p},!1),t[0]=s,t[1]=n,t[2]=d,t[3]=f,t[4]=p,t[5]=_):_=t[5];const O=_,j=x&&"present"!==v;let D,C;if(t[6]!==m||t[7]!==b||t[8]!==j||t[9]!==v||t[10]!==c||t[11]!==i){C=(new oe).isSupported(m);const e=!b&&!j;D=g("Cell","hover-actions-parent empty:invisible",{published:e,interactive:"edit"===v,"has-error":c,stopped:i,borderless:C&&!e}),t[6]=m,t[7]=b,t[8]=j,t[9]=v,t[10]=c,t[11]=i,t[12]=D,t[13]=C}else D=t[12],C=t[13];const k=D;let N;t[14]!==a?(N=ae.create(a),t[14]=a,t[15]=N):N=t[15];const P=N;if("read"===v&&b||j){let e;t[16]!==n||t[17]!==a||t[18]!==O?(e=y.jsx(E,{allowExpand:!0,output:n,className:"output-area",cellId:a,stale:O}),t[16]=n,t[17]=a,t[18]=O,t[19]=e):e=t[19];const s=e,i=""===m.trim(),l="above"===o&&s;let c;t[20]!==C||t[21]!==i||t[22]!==u||t[23]!==x||t[24]!==m?(c=!C&&!i&&y.jsx("div",{className:"tray",children:y.jsx(se,{initiallyHideCode:u.hide_code||x,code:m})}),t[20]=C,t[21]=i,t[22]=u,t[23]=x,t[24]=m,t[25]=c):c=t[25];const d="below"===o&&s;let p,f;return t[26]!==r||t[27]!==O||t[28]!==w||t[29]!==a?(p=y.jsx(ps,{consoleOutputs:r,stale:O,cellName:w,onSubmitDebugger:Ps,cellId:a,debuggerActive:!1}),t[26]=r,t[27]=O,t[28]=w,t[29]=a,t[30]=p):p=t[30],t[31]!==P||t[32]!==k||t[33]!==a||t[34]!==w||t[35]!==l||t[36]!==c||t[37]!==d||t[38]!==p?(f=y.jsxs("div",{tabIndex:-1,id:P,ref:S,className:k,"data-cell-id":a,"data-cell-name":w,children:[l,c,d,p]}),t[31]=P,t[32]=k,t[33]=a,t[34]=w,t[35]=l,t[36]=c,t[37]=d,t[38]=p,t[39]=f):f=t[39],f}const R=ie(null==n?void 0:n.mimetype);if(c||d||i||R)return null;const M="edit"===v;let z,T;return t[40]!==M||t[41]!==n||t[42]!==a||t[43]!==O?(z=y.jsx(E,{allowExpand:M,output:n,className:"output-area",cellId:a,stale:O}),t[40]=M,t[41]=n,t[42]=a,t[43]=O,t[44]=z):z=t[44],t[45]!==P||t[46]!==k||t[47]!==a||t[48]!==w||t[49]!==z?(T=y.jsx("div",{tabIndex:-1,id:P,ref:S,className:k,"data-cell-id":a,"data-cell-name":w,children:z}),t[45]=P,t[46]=k,t[47]=a,t[48]=w,t[49]=z,t[50]=T):T=t[50],T}));Es.displayName="VerticalCell";const Cs={type:"vertical",name:"Vertical",validator:T.any(),Component:e=>{const t=h(33),{cells:n,appConfig:r,mode:o}=e,{invisible:a}=ss(n.length,o),s=te(le),[i]=ce();let c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=new URLSearchParams(window.location.search),t[0]=c):c=t[0];const u=c;let d;t[1]!==s?(d=()=>{if(!ue())return!1;const e=u.get(de.showCode);return null===e?pe()||fe()||s:"true"===e},t[1]=s,t[2]=d):d=t[2];const[p,f]=l.useState(d);let m;t[3]!==n||t[4]!==s||t[5]!==o?(m=()=>{const e=n.some((e=>Boolean(e.code)));if(s)return!0;const t=u.get(de.includeCode);return"read"===o&&"false"!==t&&e},t[3]=n,t[4]=s,t[5]=o,t[6]=m):m=t[6];const g=m;let b;t[7]!==g?(b=g(),t[7]=g,t[8]=b):b=t[8];const v=b;let w;t[9]!==i.display.cell_output||t[10]!==p||t[11]!==v||t[12]!==o||t[13]!==s?(w=e=>y.jsx(Es,{cellId:e.id,output:e.output,consoleOutputs:e.consoleOutputs,status:e.status,code:e.code,config:e.config,cellOutputArea:i.display.cell_output,stopped:e.stopped,showCode:p&&v,errored:e.errored,mode:o,runStartTimestamp:e.runStartTimestamp,interrupted:e.interrupted,staleInputs:e.staleInputs,name:e.name,kiosk:s},e.id),t[9]=i.display.cell_output,t[10]=p,t[11]=v,t[12]=o,t[13]=s,t[14]=w):w=t[14];const x=w;let S;t[15]!==r.width||t[16]!==n||t[17]!==x?(S=()=>{if("columns"===r.width){const e=function(e){const t=new Map;let n=0;return e.forEach((e=>{var r;const o=e.config.column??n;n=o,t.has(o)||t.set(o,[]),null==(r=t.get(o))||r.push(e)})),[...t.entries()].sort((([e],[t])=>e-t))}(n);return y.jsx("div",{className:"flex flex-row gap-8 w-full",children:e.map((e=>{const[t,n]=e;return y.jsx("div",{className:"flex-1 flex flex-col gap-2 w-contentWidth",children:n.map(x)},t)}))})}return y.jsx(y.Fragment,{children:n.map(x)})},t[15]=r.width,t[16]=n,t[17]=x,t[18]=S):S=t[18];const _=S;let O,j,D,E;return t[19]!==p||t[20]!==v||t[21]!==_?(O=p&&v?y.jsxs("div",{className:"flex flex-col gap-5",children:[" ",_()]}):_(),t[19]=p,t[20]=v,t[21]=_,t[22]=O):O=t[22],t[23]!==o||t[24]!==v||t[25]!==p?(j="read"===o&&y.jsx(Ds,{canShowCode:v,showCode:p,onToggleShowCode:()=>f((e=>!e))}),t[23]=o,t[24]=v,t[25]=p,t[26]=j):j=t[26],t[27]===Symbol.for("react.memo_cache_sentinel")?(D=y.jsx(_s,{}),t[27]=D):D=t[27],t[28]!==a||t[29]!==r||t[30]!==O||t[31]!==j?(E=y.jsxs(as,{invisible:a,appConfig:r,children:[O,j,D]}),t[28]=a,t[29]=r,t[30]=O,t[31]=j,t[32]=E):E=t[32],E},deserializeLayout:e=>e,serializeLayout:e=>e,getInitialLayout:()=>null};async function ks(){const e=document.getElementById("App");e&&await ye(e,document.title)}async function Ns(){document.getElementById("App")&&await bs({filename:document.title,includeCode:!0})}function Ps(){return null}const Rs=v.lazy((()=>be((()=>import("./slides-component-mW8ihitn.js")),__vite__mapDeps([0,1,2,3]),import.meta.url))),Ms=l.memo((e=>{const t=h(4),{output:n,cellId:r,status:o}=e,a="running"===o||"queued"===o;let s;return t[0]!==n||t[1]!==r||t[2]!==a?(s=y.jsx(E,{className:"contents",allowExpand:!1,output:n,cellId:r,stale:a}),t[0]=n,t[1]=r,t[2]=a,t[3]=s):s=t[3],s}));Ms.displayName="Slide";const zs=[os,{type:"slides",name:"Slides",validator:T.object({}),deserializeLayout:(e,t)=>({}),serializeLayout:(e,t)=>({}),Component:e=>{const t=h(11),{cells:n,mode:r}=e,o="read"===r;let a,s;if(t[0]!==r||t[1]!==n){let e;t[3]!==r?(e=e=>null==e.output||""===e.output.data?null:y.jsx(Ms,{cellId:e.id,code:e.code,status:e.status,output:e.output,mode:r},e.id),t[3]=r,t[4]=e):e=t[4],a=n.map(e),t[0]=r,t[1]=n,t[2]=a}else a=t[2];t[5]!==a?(s=y.jsx(Rs,{forceKeyboardNavigation:!0,children:a}),t[5]=a,t[6]=s):s=t[6];const i=s;if(o){let e;return t[7]!==i?(e=y.jsx("div",{className:"p-4",children:i}),t[7]=i,t[8]=e):e=t[8],e}let l;return t[9]!==i?(l=y.jsx("div",{className:"pr-9",children:i}),t[9]=i,t[10]=l):l=t[10],l},getInitialLayout:()=>({})},Cs];function Ts(){return{selectedLayout:"vertical",layoutData:{}}}const{valueAtom:Ls,useActions:Is}=ve(Ts,{setLayoutView:(e,t)=>({...e,selectedLayout:t}),setLayoutData:(e,t)=>({...e,selectedLayout:t.layoutView,layoutData:{...e.layoutData,[t.layoutView]:t.data}}),setCurrentLayoutData:(e,t)=>({...e,layoutData:{...e.layoutData,[e.selectedLayout]:t}})}),Hs=()=>te(Ls),As=()=>Is();function Ws(){const e=L(),{layoutData:t,selectedLayout:n}=we.get(Ls);if("vertical"===n)return;if(void 0===t)return;const r=t[n],o=zs.find((e=>e.type===n));if(void 0!==o)return{type:n,data:o.serializeLayout(r,xe(e))};a.error(`Unknown layout type: ${n}`)}const qs=["vertical","grid","slides"],Bs=["slides"],Gs=l.memo((e=>{const t=h(10),{appConfig:n,mode:r,children:o}=e,{selectedLayout:a,layoutData:s}=Hs(),i=te(le);if("edit"===r&&!i)return o;let l;l=a;const c=new URLSearchParams(window.location.search);if("read"===r&&c.has(de.viewAs)){const e=c.get(de.viewAs);Bs.includes(e)&&(l=e)}let u;if(t[0]!==l){const e=l;let n;t[2]!==e?(n=e=>e.type===l,t[2]=e,t[3]=n):n=t[3],u=zs.find(n),t[0]=l,t[1]=u}else u=t[1];const d=u;if(!d)return o;const p=l;let f;return t[4]!==n||t[5]!==r||t[6]!==d||t[7]!==s||t[8]!==p?(f=y.jsx(Fs,{appConfig:n,mode:r,plugin:d,layoutData:s,finalLayout:p}),t[4]=n,t[5]=r,t[6]=d,t[7]=s,t[8]=p,t[9]=f):f=t[9],f}));Gs.displayName="CellsRenderer";const Fs=e=>{const t=h(18),{appConfig:n,mode:r,plugin:o,layoutData:a,finalLayout:s}=e,i=Se(),{setCurrentLayoutData:l}=As();let c,u,d,p,f,m;if(t[0]!==i||t[1]!==o||t[2]!==n||t[3]!==r||t[4]!==a||t[5]!==s){const e=_e(i);c=o.Component,u=n,d=r,p=e,f=a[s]||o.getInitialLayout(e),t[0]=i,t[1]=o,t[2]=n,t[3]=r,t[4]=a,t[5]=s,t[6]=c,t[7]=u,t[8]=d,t[9]=p,t[10]=f}else c=t[6],u=t[7],d=t[8],p=t[9],f=t[10];t[11]!==c||t[12]!==u||t[13]!==d||t[14]!==p||t[15]!==f||t[16]!==l?(m=y.jsx(c,{appConfig:u,mode:d,cells:p,layout:f,setLayout:l}),t[11]=c,t[12]=u,t[13]=d,t[14]=p,t[15]=f,t[16]=l,t[17]=m):m=t[17];return m};function Vs(){const{cellRuntime:e}=we.get(Oe),t=_.entries(e).find((([e,t])=>"running"===t.status));t&&je(t[0],"focus")}const Us=e=>{const t=h(14),{connection:n,isRunning:r}=e;let o,a,s,i,l;return t[0]!==n.state||t[1]!==r?(o=n.state===De.OPEN&&r&&y.jsx(Ks,{}),t[0]=n.state,t[1]=r,t[2]=o):o=t[2],t[3]!==n?(a=n.state===De.CLOSED&&!n.canTakeover&&y.jsx(Qs,{}),t[3]=n,t[4]=a):a=t[4],t[5]!==n?(s=n.state===De.CLOSED&&!n.canTakeover&&y.jsx(Xs,{}),t[5]=n,t[6]=s):s=t[6],t[7]!==n?(i=n.state===De.CLOSED&&n.canTakeover&&y.jsx($s,{}),t[7]=n,t[8]=i):i=t[8],t[9]!==o||t[10]!==a||t[11]!==s||t[12]!==i?(l=y.jsxs(y.Fragment,{children:[o,a,s,i]}),t[9]=o,t[10]=a,t[11]=s,t[12]=i,t[13]=l):l=t[13],l},Ys="absolute top-4 left-4 m-0 flex items-center space-x-3 min-h-[28px] no-print pointer-events-auto z-50 hover:cursor-pointer",Xs=()=>y.jsx(V,{content:"App disconnected",children:y.jsx("div",{className:Ys,children:y.jsx(Ht,{className:"w-[25px] h-[25px] text-[var(--red-11)]"})})}),$s=()=>y.jsx(V,{content:"Notebook locked",children:y.jsx("div",{className:Ys,children:y.jsx(N,{className:"w-[25px] h-[25px] text-[var(--blue-11)]"})})}),Ks=()=>y.jsx(V,{content:"Jump to running cell",side:"right",children:y.jsx("div",{className:Ys,"data-testid":"loading-indicator",onClick:Vs,children:y.jsx(Mt,{className:"running-app-icon",size:30,strokeWidth:1})})}),Qs=()=>y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"noise"}),y.jsx("div",{className:"disconnected-gradient"})]}),Zs=Ie,Js=He,ei=Ee(Ce),ti=v.forwardRef(((e,t)=>{const n=h(9);let r,o,a,s;return n[0]!==e?(({className:r,...o}=e),n[0]=e,n[1]=r,n[2]=o):(r=n[1],o=n[2]),n[3]!==r?(a=g("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),n[3]=r,n[4]=a):a=n[4],n[5]!==a||n[6]!==o||n[7]!==t?(s=y.jsx(ke,{className:a,...o,ref:t}),n[5]=a,n[6]=o,n[7]=t,n[8]=s):s=n[8],s}));ti.displayName=ke.displayName;const ni=ze("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),ri=v.forwardRef(((e,t)=>{const n=h(15);let r,o,a,s;n[0]!==e?(({side:r,className:o,children:s,...a}=e),n[0]=e,n[1]=r,n[2]=o,n[3]=a,n[4]=s):(r=n[1],o=n[2],a=n[3],s=n[4]);const i=void 0===r?"right":r;let l,c,u,d;return n[5]===Symbol.for("react.memo_cache_sentinel")?(l=y.jsx(ti,{}),n[5]=l):l=n[5],n[6]!==i||n[7]!==o?(c=g(ni({side:i}),o),n[6]=i,n[7]=o,n[8]=c):c=n[8],n[9]===Symbol.for("react.memo_cache_sentinel")?(u=y.jsxs(Te,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[y.jsx(Le,{className:"h-4 w-4"}),y.jsx("span",{className:"sr-only",children:"Close"})]}),n[9]=u):u=n[9],n[10]!==t||n[11]!==c||n[12]!==a||n[13]!==s?(d=y.jsx(ei,{children:y.jsxs(Ne,{children:[l,y.jsxs(Pe,{ref:t,className:c,...a,children:[s,u]})]})}),n[10]=t,n[11]=c,n[12]=a,n[13]=s,n[14]=d):d=n[14],d}));ri.displayName=Pe.displayName;v.forwardRef(((e,t)=>{const n=h(9);let r,o,a,s;return n[0]!==e?(({className:r,...o}=e),n[0]=e,n[1]=r,n[2]=o):(r=n[1],o=n[2]),n[3]!==r?(a=g("text-lg font-semibold text-foreground",r),n[3]=r,n[4]=a):a=n[4],n[5]!==t||n[6]!==a||n[7]!==o?(s=y.jsx(Re,{ref:t,className:a,...o}),n[5]=t,n[6]=a,n[7]=o,n[8]=s):s=n[8],s})).displayName=Re.displayName;v.forwardRef(((e,t)=>{const n=h(9);let r,o,a,s;return n[0]!==e?(({className:r,...o}=e),n[0]=e,n[1]=r,n[2]=o):(r=n[1],o=n[2]),n[3]!==r?(a=g("text-sm text-muted-foreground",r),n[3]=r,n[4]=a):a=n[4],n[5]!==t||n[6]!==a||n[7]!==o?(s=y.jsx(Me,{ref:t,className:a,...o}),n[5]=t,n[6]=a,n[7]=o,n[8]=s):s=n[8],s})).displayName=Me.displayName;const oi=l.memo((()=>{const e=h(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=y.jsx(Ae,{name:We.SIDEBAR}),e[0]=t):t=e[0],t}));oi.displayName="SidebarSlot";const ai=e=>{const t=h(6),{openWidth:n}=e;let r,o,a,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=y.jsx(Js,{className:"lg:hidden",asChild:!0,children:y.jsx(he,{variant:"ghost",className:"bg-background",children:y.jsx(Tt,{className:"w-5 h-5"})})}),t[0]=r):r=t[0],t[1]!==n?(o={maxWidth:n},t[1]=n,t[2]=o):o=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(a=y.jsx(oi,{}),t[3]=a):a=t[3],t[4]!==o?(s=y.jsxs(Zs,{children:[r,y.jsx(ri,{className:"w-full px-3 h-full flex flex-col overflow-y-auto",style:o,side:"left",children:a})]}),t[4]=o,t[5]=s):s=t[5],s},si=e=>{const t=h(7),{isOpen:n,toggle:r}=e,o=n?"rotate-0":"rotate-180";let a,s,i;return t[0]!==o?(a=g("h-5 w-5 transition-transform ease-in-out duration-700",o),t[0]=o,t[1]=a):a=t[1],t[2]!==a?(s=y.jsx(qe,{className:a}),t[2]=a,t[3]=s):s=t[3],t[4]!==r||t[5]!==s?(i=y.jsx("div",{className:"invisible lg:visible absolute top-[12px] right-[16px] z-20",children:y.jsx(he,{onClick:r,className:"w-10 h-8",variant:"ghost",size:"icon",children:s})}),t[4]=r,t[5]=s,t[6]=i):i=t[6],i},ii=e=>{const t=h(11),{isOpen:n,toggle:r,width:o}=e,a=n?o:Be;let s,i,l,c,u;return t[0]!==a?(s={width:a},t[0]=a,t[1]=s):s=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(i=g("app-sidebar auto-collapse-nav","top-0 left-0 z-20 h-full hidden lg:block relative transition-[width] ease-in-out duration-300"),t[2]=i):i=t[2],t[3]!==n||t[4]!==r?(l=y.jsx(si,{isOpen:n,toggle:r}),t[3]=n,t[4]=r,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(c=y.jsx("div",{className:"relative h-full flex flex-col px-3 pb-16 pt-14 overflow-y-auto shadow-sm border-l",children:y.jsx(oi,{})}),t[6]=c):c=t[6],t[7]!==n||t[8]!==s||t[9]!==l?(u=y.jsxs("aside",{"data-expanded":n,style:s,className:i,children:[l,c]}),t[7]=n,t[8]=s,t[9]=l,t[10]=u):u=t[10],u},li=e=>{const t=h(15),{children:n}=e,[r,o]=Ge(Fe),{isOpen:a,width:s}=r;if(0===Ve(We.SIDEBAR).length)return n;let i;t[0]!==s?(i=Ue(s),t[0]=s,t[1]=i):i=t[1];const l=i;let c,u,d,p;return t[2]!==o||t[3]!==a?(c=()=>o({type:"toggle",isOpen:!a}),t[2]=o,t[3]=a,t[4]=c):c=t[4],t[5]!==a||t[6]!==l||t[7]!==c?(u=y.jsx(ii,{isOpen:a,width:l,toggle:c}),t[5]=a,t[6]=l,t[7]=c,t[8]=u):u=t[8],t[9]!==l?(d=y.jsx("div",{className:"absolute top-3 left-4 flex items-center z-50",children:y.jsx(ai,{openWidth:l})}),t[9]=l,t[10]=d):d=t[10],t[11]!==u||t[12]!==d||t[13]!==n?(p=y.jsxs("div",{className:"inset-0 absolute flex",children:[u,d,n]}),t[11]=u,t[12]=d,t[13]=n,t[14]=p):p=t[14],p},ci=e=>{const t=h(10),{title:n}=e,[r,o]=l.useState(n),[a,s]=l.useState(!0);let i,c,u;t[0]!==n||t[1]!==r?(i=()=>{if(n!==r){s(!1);const e=setTimeout((()=>{o(n),s(!0)}),300);return()=>clearTimeout(e)}},c=[n,r],t[0]=n,t[1]=r,t[2]=i,t[3]=c):(i=t[2],c=t[3]),l.useEffect(i,c),t[4]===Symbol.for("react.memo_cache_sentinel")?(u=y.jsx(Ye,{className:"size-20 animate-spin text-primary","data-testid":"large-spinner",strokeWidth:1}),t[4]=u):u=t[4];const d=a?"opacity-100":"opacity-0";let p,f;return t[5]!==d?(p=g("mt-2 text-muted-foreground font-semibold text-lg transition-opacity duration-300",d),t[5]=d,t[6]=p):p=t[6],t[7]!==p||t[8]!==r?(f=y.jsxs("div",{className:"flex flex-col h-full flex-1 items-center justify-center p-4",children:[u,y.jsx("div",{className:p,children:r})]}),t[7]=p,t[8]=r,t[9]=f):f=t[9],f},ui=e=>{const t=h(2),{children:n}=e;if(!fe())return n;let r;return t[0]!==n?(r=y.jsx(di,{children:n}),t[0]=n,t[1]=r):r=t[1],r},di=e=>{const t=h(3),{children:n}=e;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=[],t[0]=r):r=t[0];const{loading:o,error:a}=Xe(fi,r),s=te($e);if(o){let e;return t[1]===Symbol.for("react.memo_cache_sentinel")?(e=y.jsx(pi,{}),t[1]=e):e=t[1],e}if(!s&&"read"===J&&Ke(de.showCode,"false")){let e;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e=y.jsx(pi,{}),t[2]=e):e=t[2],e}if(a)throw a;return n},pi=e=>{const t=h(2),n=te(Ze);let r;return t[0]!==n?(r=y.jsx(ci,{title:n}),t[0]=n,t[1]=r):r=t[1],r};async function fi(){return await Qe.INSTANCE.initialized.promise,!0}const hi="./favicon.ico",mi="./circle-check.ico",gi="./circle-play.ico",yi="./circle-x.ico";const bi=e=>{const t=h(8),{isRunning:n}=e,r=Je();let o;o=document.querySelector("link[rel~='icon']"),o||(o=document.createElement("link"),o.rel="icon",document.getElementsByTagName("head")[0].append(o)),l.useEffect((()=>{if(!n&&o.href.includes("favicon"))return;if(n)return void(o.href=gi);if(o.href=0===r.length?mi:yi,!document.hasFocus())return;const e=setTimeout((()=>{o.href=hi}),3e3);return()=>{o.href=hi,clearTimeout(e)}}),[n,r,o]);const a=et(n)??n;let s,i;return t[0]!==a||t[1]!==n||t[2]!==r.length?(s=()=>{a&&!n&&function(e){if("visible"===document.visibilityState)return;const t=()=>{0===e?new Notification("Execution completed",{body:"Your notebook run completed successfully.",icon:mi}):new Notification("Execution failed",{body:`Your notebook run encountered ${e} error(s).`,icon:yi})};"Notification"in window&&"denied"!==Notification.permission&&("granted"===Notification.permission?t():"default"===Notification.permission&&Notification.requestPermission().then((e=>{"granted"===e&&t()})))}(r.length)},t[0]=a,t[1]=n,t[2]=r.length,t[3]=s):s=t[3],t[4]!==r||t[5]!==a||t[6]!==n?(i=[r,a,n],t[4]=r,t[5]=a,t[6]=n,t[7]=i):i=t[7],l.useEffect(s,i),tt(window,"focus",(e=>{n||(o.href=hi)})),null},vi=e=>{const t=h(18),{width:n,connection:r,isRunning:o,children:a}=e,s=r.state;let i,l;t[0]!==o?(i=y.jsx(bi,{isRunning:o}),t[0]=o,t[1]=i):i=t[1],t[2]!==r||t[3]!==o?(l=y.jsx(Us,{connection:r,isRunning:o}),t[2]=r,t[3]=o,t[4]=l):l=t[4];const c=s===De.CLOSED&&"disconnected",u="full"===n&&"config-width-full",d="columns"===n?"overflow-x-auto":"overflow-x-hidden";let p,f,m;return t[5]!==c||t[6]!==u||t[7]!==d?(p=g(c,"bg-background w-full h-full text-textColor","flex flex-col overflow-y-auto",u,d,"print:height-fit"),t[5]=c,t[6]=u,t[7]=d,t[8]=p):p=t[8],t[9]!==n||t[10]!==s||t[11]!==p||t[12]!==a?(f=y.jsx(ui,{children:y.jsx(li,{children:y.jsx("div",{id:"App","data-config-width":n,"data-connection-state":s,className:p,children:a})})}),t[9]=n,t[10]=s,t[11]=p,t[12]=a,t[13]=f):f=t[13],t[14]!==i||t[15]!==l||t[16]!==f?(m=y.jsxs(y.Fragment,{children:[i,l,f]}),t[14]=i,t[15]=l,t[16]=f,t[17]=m):m=t[17],m},wi=e=>{const t=h(10),{reason:n,canTakeover:r}=e,o=void 0!==r&&r,a=xi;if(o){let e,r,s,i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=y.jsx("div",{className:"flex justify-between",children:y.jsx("span",{className:"font-bold text-xl flex items-center mb-2",children:"Notebook already connected"})}),t[0]=e):e=t[0],t[1]!==n?(r=y.jsx("span",{children:n}),t[1]=n,t[2]=r):r=t[2],t[3]!==o?(s=o&&y.jsxs(he,{onClick:a,variant:"outline","data-testid":"takeover-button",className:"flex-shrink-0",children:[y.jsx(It,{className:"w-4 h-4 mr-2"}),"Take over session"]}),t[3]=o,t[4]=s):s=t[4],t[5]!==r||t[6]!==s?(i=y.jsx("div",{className:"flex justify-center",children:y.jsxs(nt,{kind:"info",className:"mt-10 flex flex-col rounded p-3 max-w-[800px] mx-4",children:[e,y.jsxs("div",{className:"flex justify-between items-end text-base gap-20",children:[r,s]})]})}),t[5]=r,t[6]=s,t[7]=i):i=t[7],i}let s;return t[8]!==n?(s=y.jsx("div",{className:"font-mono text-center text-base text-[var(--red-11)]",children:y.jsx("p",{children:n})}),t[8]=n,t[9]=s):s=t[9],s};async function xi(){try{const e=new URL(window.location.href).searchParams;await rt.post(`/kernel/takeover?${e.toString()}`,{}),ot()}catch(e){at({title:"Failed to take over session",description:st(e),variant:"danger"})}}const Si=e=>{const t=h(6),{connection:n,className:r,children:o}=e;let a,s;return t[0]!==n?(a=n.state===De.CLOSED&&y.jsx(wi,{reason:n.reason,canTakeover:n.canTakeover}),t[0]=n,t[1]=a):a=t[1],t[2]!==r||t[3]!==o||t[4]!==a?(s=y.jsxs("div",{className:r,children:[o,a]}),t[2]=r,t[3]=o,t[4]=a,t[5]=s):s=t[5],s};globalThis.EventTarget&&globalThis.Event||console.error("\n  PartySocket requires a global 'EventTarget' class to be available!\n  You can polyfill this global by adding this to your code before any partysocket imports: \n  \n  ```\n  import 'partysocket/event-target-polyfill';\n  ```\n  Please file an issue at https://github.com/partykit/partykit if you're still having trouble.\n");var _i=class extends Event{constructor(e,t){super("error",t),n(this,"message"),n(this,"error"),this.message=e.message,this.error=e}},Oi=class extends Event{constructor(e=1e3,t="",r){super("close",r),n(this,"code"),n(this,"reason"),n(this,"wasClean",!0),this.code=e,this.reason=t}},ji=(Event,_i),Di=Oi;var Ei="undefined"!=typeof process&&void 0!==(null==(e=process.versions)?void 0:e.node)&&"undefined"==typeof document?function(e){if("data"in e){return new MessageEvent(e.type,e)}if("code"in e||"reason"in e){return new Oi(e.code||1999,e.reason||"unknown reason",e)}if("error"in e){return new _i(e.error,e)}return new Event(e.type,e)}:function(e){return new e.constructor(e.type,e)},Ci={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+4e3*Math.random(),minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0,startClosed:!1,debug:!1},ki=!1,Ni=class e extends EventTarget{constructor(e,t,r={}){super(),n(this,"_ws"),n(this,"_retryCount",-1),n(this,"_uptimeTimeout"),n(this,"_connectTimeout"),n(this,"_shouldReconnect",!0),n(this,"_connectLock",!1),n(this,"_binaryType","blob"),n(this,"_closeCalled",!1),n(this,"_messageQueue",[]),n(this,"_debugLogger",console.log.bind(console)),n(this,"_url"),n(this,"_protocols"),n(this,"_options"),n(this,"onclose",null),n(this,"onerror",null),n(this,"onmessage",null),n(this,"onopen",null),n(this,"_handleOpen",(e=>{this._debug("open event");const{minUptime:t=Ci.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout((()=>this._acceptOpen()),t),function(e,t){if(!e)throw new Error(t)}(this._ws,"WebSocket is not defined"),this._ws.binaryType=this._binaryType,this._messageQueue.forEach((e=>{var t;return null==(t=this._ws)?void 0:t.send(e)})),this._messageQueue=[],this.onopen&&this.onopen(e),this.dispatchEvent(Ei(e))})),n(this,"_handleMessage",(e=>{this._debug("message event"),this.onmessage&&this.onmessage(e),this.dispatchEvent(Ei(e))})),n(this,"_handleError",(e=>{this._debug("error event",e.message),this._disconnect(void 0,"TIMEOUT"===e.message?"timeout":void 0),this.onerror&&this.onerror(e),this._debug("exec error listeners"),this.dispatchEvent(Ei(e)),this._connect()})),n(this,"_handleClose",(e=>{this._debug("close event"),this._clearTimeouts(),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(e),this.dispatchEvent(Ei(e))})),this._url=e,this._protocols=t,this._options=r,this._options.startClosed&&(this._shouldReconnect=!1),this._options.debugLogger&&(this._debugLogger=this._options.debugLogger),this._connect()}static get CONNECTING(){return 0}static get OPEN(){return 1}static get CLOSING(){return 2}static get CLOSED(){return 3}get CONNECTING(){return e.CONNECTING}get OPEN(){return e.OPEN}get CLOSING(){return e.CLOSING}get CLOSED(){return e.CLOSED}get binaryType(){return this._ws?this._ws.binaryType:this._binaryType}set binaryType(e){this._binaryType=e,this._ws&&(this._ws.binaryType=e)}get retryCount(){return Math.max(this._retryCount,0)}get bufferedAmount(){return this._messageQueue.reduce(((e,t)=>("string"==typeof t?e+=t.length:t instanceof Blob?e+=t.size:e+=t.byteLength,e)),0)+(this._ws?this._ws.bufferedAmount:0)}get extensions(){return this._ws?this._ws.extensions:""}get protocol(){return this._ws?this._ws.protocol:""}get readyState(){return this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING}get url(){return this._ws?this._ws.url:""}get shouldReconnect(){return this._shouldReconnect}close(e=1e3,t){this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),this._ws?this._ws.readyState!==this.CLOSED?this._ws.close(e,t):this._debug("close: already closed"):this._debug("close enqueued: no ws instance")}reconnect(e,t){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,this._ws&&this._ws.readyState!==this.CLOSED?(this._disconnect(e,t),this._connect()):this._connect()}send(e){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",e),this._ws.send(e);else{const{maxEnqueuedMessages:t=Ci.maxEnqueuedMessages}=this._options;this._messageQueue.length<t&&(this._debug("enqueue",e),this._messageQueue.push(e))}}_debug(...e){this._options.debug&&this._debugLogger("RWS>",...e)}_getNextDelay(){const{reconnectionDelayGrowFactor:e=Ci.reconnectionDelayGrowFactor,minReconnectionDelay:t=Ci.minReconnectionDelay,maxReconnectionDelay:n=Ci.maxReconnectionDelay}=this._options;let r=0;return this._retryCount>0&&(r=t*Math.pow(e,this._retryCount-1),r>n&&(r=n)),this._debug("next delay",r),r}_wait(){return new Promise((e=>{setTimeout(e,this._getNextDelay())}))}_getNextProtocols(e){if(!e)return Promise.resolve(null);if("string"==typeof e||Array.isArray(e))return Promise.resolve(e);if("function"==typeof e){const t=e();if(!t)return Promise.resolve(null);if("string"==typeof t||Array.isArray(t))return Promise.resolve(t);if(t.then)return t}throw Error("Invalid protocols")}_getNextUrl(e){if("string"==typeof e)return Promise.resolve(e);if("function"==typeof e){const t=e();if("string"==typeof t)return Promise.resolve(t);if(t.then)return t}throw Error("Invalid URL")}_connect(){if(this._connectLock||!this._shouldReconnect)return;this._connectLock=!0;const{maxRetries:e=Ci.maxRetries,connectionTimeout:t=Ci.connectionTimeout}=this._options;this._retryCount>=e?this._debug("max retries reached",this._retryCount,">=",e):(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),this._wait().then((()=>Promise.all([this._getNextUrl(this._url),this._getNextProtocols(this._protocols||null)]))).then((([e,n])=>{if(this._closeCalled)return void(this._connectLock=!1);this._options.WebSocket||"undefined"!=typeof WebSocket||ki||(console.error("‼️ No WebSocket implementation available. You should define options.WebSocket. \n\nFor example, if you're using node.js, run `npm install ws`, and then in your code:\n\nimport PartySocket from 'partysocket';\nimport WS from 'ws';\n\nconst partysocket = new PartySocket({\n  host: \"127.0.0.1:1999\",\n  room: \"test-room\",\n  WebSocket: WS\n});\n\n"),ki=!0);const r=this._options.WebSocket||WebSocket;this._debug("connect",{url:e,protocols:n}),this._ws=n?new r(e,n):new r(e),this._ws.binaryType=this._binaryType,this._connectLock=!1,this._addListeners(),this._connectTimeout=setTimeout((()=>this._handleTimeout()),t)})).catch((e=>{this._connectLock=!1,this._handleError(new ji(Error(e.message),this))})))}_handleTimeout(){this._debug("timeout event"),this._handleError(new ji(Error("TIMEOUT"),this))}_disconnect(e=1e3,t){if(this._clearTimeouts(),this._ws){this._removeListeners();try{this._ws.close(e,t),this._handleClose(new Di(e,t,this))}catch(n){}}}_acceptOpen(){this._debug("accept open"),this._retryCount=0}_removeListeners(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))}_addListeners(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))}_clearTimeouts(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)}};
/*!
 * Reconnecting WebSocket
 * by Pedro Ladaria <pedro.ladaria@gmail.com>
 * https://github.com/pladaria/reconnecting-websocket
 * License MIT
 */
class Pi{constructor(){this.CONNECTING=WebSocket.CONNECTING,this.OPEN=WebSocket.OPEN,this.CLOSING=WebSocket.CLOSING,this.CLOSED=WebSocket.CLOSED,this.binaryType="blob",this.bufferedAmount=0,this.extensions="",this.protocol="",this.url="",this.onclose=null,this.onerror=null,this.onmessage=null,this.onopen=null,this.readyState=WebSocket.OPEN,this.retryCount=0,this.shouldReconnect=!1}addEventListener(e,t,n){}removeEventListener(e,t,n){}dispatchEvent(e){return!1}reconnect(e,t){}send(e){}close(){}}const{valueAtom:Ri,useActions:Mi}=ve((()=>({banners:[]})),{addBanner:(e,t)=>({...e,banners:[...e.banners,{...t,id:lt()}]}),removeBanner:(e,t)=>({...e,banners:e.banners.filter((e=>e.id!==t))}),clearBanners:e=>({...e,banners:[]})}),zi=()=>te(Ri);function Ti(){return Mi()}function Li(e){return"missing"===e.kind}function Ii(e){return"installing"===e.kind}const{valueAtom:Hi,useActions:Ai}=ve((()=>({packageAlert:null})),{addPackageAlert:(e,t)=>({...e,packageAlert:{id:lt(),...t}}),clearPackageAlert:(e,t)=>null!==e.packageAlert&&e.packageAlert.id===t?{...e,packageAlert:null}:e}),Wi=()=>te(Hi);function qi(){return Ai()}function Bi(e,t){const{autoInstantiate:n,setCells:r,setLayoutData:a,onError:s,setAppConfig:i,setCapabilities:l}=t,{codes:c,names:u,layout:d,configs:p,resumed:f,ui_values:h,cell_ids:m,last_executed_code:g,last_execution_time:y={},app_config:b,capabilities:v}=e,w=g||{},x=y||{},S=c.map(((e,t)=>{const n=m[t];let r=!1;const o=w[n];return o&&(r=o!==e),ct({id:n,code:e,edited:r,name:u[t],lastCodeRun:w[n]??null,lastExecutionTime:x[n]??null,config:p[t]})})),O={selectedLayout:"vertical",layoutData:{}};if(d){const e=d.type,t=function(e,t,n){const r=zs.find((t=>t.type===e));if(void 0===r)throw new Error(`Unknown layout type: ${e}`);return r.deserializeLayout(t,n)}(e,d.data,S);O.selectedLayout=e,O.layoutData[e]=t,a({layoutView:e,data:t})}r(S,O);const j=ut.safeParse(b);if(j.success&&i(j.data),l({...v,sql:v.sql||fe()}),f){for(const[e,t]of _.entries(h||{}))o.set(e,t);return}const D=[],E=[];o.entries.forEach(((e,t)=>{D.push(t),E.push(e.value)})),dt({objectIds:D,values:E,autoRun:n}).catch((e=>{s(new Error("Failed to instantiate",{cause:e}))}))}const Gi=e=>{const t=new URL(window.location.href);t.searchParams.append(e.key,e.value),window.history.pushState({},"",`${t.pathname}${t.search}`)},Fi=e=>{const t=new URL(window.location.href);Array.isArray(e.value)?(t.searchParams.delete(e.key),e.value.forEach((n=>t.searchParams.append(e.key,n)))):t.searchParams.set(e.key,e.value),window.history.pushState({},"",`${t.pathname}${t.search}`)},Vi=e=>{const t=new URL(window.location.href);null==e.value?t.searchParams.delete(e.key):t.searchParams.delete(e.key,e.value),window.history.pushState({},"",`${t.pathname}${t.search}`)},Ui=()=>{const e=new URL(window.location.href);e.search="",window.history.pushState({},"",`${e.pathname}${e.search}`)};const{reducer:Yi,createActions:Xi,valueAtom:$i,useActions:Ki}=ve((function(){return{runIds:[],runMap:new Map}}),{addCellOperation:(e,t)=>{const{cellOperation:n,code:r}=t,o=n.run_id;if(!o)return e;const a=e.runMap.get(o);if(!a&&function(e){return e.startsWith("mo.md(")&&Qi.test(e)}(r))return e;const s=n.output&&("marimo-error"===n.output.channel||"stderr"===n.output.channel);let i=s?"error":"queued"===n.status?"queued":"running"===n.status?"running":"success";if(!a){const t={runId:o,cellRuns:new Map([[n.cell_id,{cellId:n.cell_id,code:r.slice(0,200),elapsedTime:0,status:i,startTime:n.timestamp}]]),runStartTime:n.timestamp},a=[o,...e.runIds],s=new Map(e.runMap);if(a.length>50){const e=a.pop();e&&s.delete(e)}return s.set(o,t),{runIds:a,runMap:s}}const l=new Map(a.cellRuns),c=l.get(n.cell_id);if(c&&!s&&"queued"===n.status)return e;if(c){i="error"===c.status||s?"error":i;const e="running"===n.status?n.timestamp:c.startTime,t="success"===i||"error"===i?n.timestamp-c.startTime:void 0;l.set(n.cell_id,{...c,startTime:e,elapsedTime:t,status:i})}else l.set(n.cell_id,{cellId:n.cell_id,code:r.slice(0,200),elapsedTime:0,status:i,startTime:n.timestamp});const u=new Map(e.runMap);return u.set(o,{...a,cellRuns:l}),{...e,runMap:u}},clearRuns:e=>({...e,runIds:[],runMap:new Map}),removeRun:(e,t)=>{const n=e.runIds.filter((e=>e!==t)),r=new Map(e.runMap);return r.delete(t),{...e,runIds:n,runMap:r}}}),Qi=/mo\.md\(\s*r?('''|""")/;function Zi(e){const t=h(23),n=l.useRef(!0),{autoInstantiate:r,sessionId:s,setCells:i}=e,{showBoundary:c}=pt(),{handleCellMessage:u,setCellCodes:d,setCellIds:p}=W(),{addCellOperation:f}=Ki(),m=ft(),{setVariables:g,setMetadata:y}=ht(),{addColumnPreview:b}=mt(),{addDatasets:v,filterDatasetsFromVariables:w}=mt(),{setLayoutData:x}=As(),[S,_]=Ge(gt),{addBanner:O}=Ti(),{addPackageAlert:j}=qi(),D=yt(le),E=yt(bt);let C;t[0]!==r||t[1]!==i||t[2]!==x||t[3]!==m||t[4]!==E||t[5]!==c||t[6]!==D||t[7]!==u||t[8]!==f||t[9]!==g||t[10]!==w||t[11]!==y||t[12]!==O||t[13]!==j||t[14]!==v||t[15]!==b||t[16]!==d||t[17]!==p?(C=e=>{const t=wt(e.data);switch(t.op){case"reload":return void ot();case"kernel-ready":return Bi(t.data,{autoInstantiate:r,setCells:i,setLayoutData:x,setAppConfig:m,setCapabilities:E,onError:c}),void D(t.data.kiosk);case"completed-run":case"interrupted":case"reconnected":return;case"send-ui-element-message":return void o.broadcastMessage(t.data.ui_element,t.data.message,t.data.buffers);case"remove-ui-elements":return void function(e){const t=e.cell_id;o.removeElementsByCell(t),ys.INSTANCE.removeForCellId(t)}(t.data);case"completion-result":return void jt.resolve(t.data.completion_id,t.data);case"function-call-result":return void Ot.resolve(t.data.function_call_id,t.data);case"cell-op":{!function(e,t){t(e),ys.INSTANCE.track(e)}(t.data,u);const e=L().cellData[t.data.cell_id];if(!e)return;return void f({cellOperation:t.data,code:e.code})}case"variables":return g(t.data.variables.map((e=>({name:e.name,declaredBy:e.declared_by,usedBy:e.used_by})))),void w(t.data.variables.map((e=>e.name)));case"variable-values":return void y(t.data.variables.map((e=>({name:e.name,dataType:e.datatype,value:e.value}))));case"alert":return void at({title:t.data.title,description:_t({html:t.data.description}),variant:t.data.variant});case"banner":return void O(t.data);case"missing-package-alert":return void j({...t.data,kind:"missing"});case"installing-package-alert":return void j({...t.data,kind:"installing"});case"query-params-append":return void Gi(t.data);case"query-params-set":return void Fi(t.data);case"query-params-delete":return void Vi(t.data);case"query-params-clear":return void Ui();case"datasets":return void v(t.data);case"data-column-preview":return void b(t.data);case"focus-cell":return void St(t.data.cell_id);case"update-cell-codes":return void d({codes:t.data.codes,ids:t.data.cell_ids,codeIsStale:t.data.code_is_stale});case"update-cell-ids":return void p({cellIds:t.data.cell_ids});default:xt(t)}},t[0]=r,t[1]=i,t[2]=x,t[3]=m,t[4]=E,t[5]=c,t[6]=D,t[7]=u,t[8]=f,t[9]=g,t[10]=w,t[11]=y,t[12]=O,t[13]=j,t[14]=v,t[15]=b,t[16]=d,t[17]=p,t[18]=C):C=t[18];const k=C,N=(e,t)=>{n.current&&(n.current=!1,R.reconnect(e,t))};let P;t[19]!==k?(P=e=>{try{k(e)}catch(t){const e=t;a.error("Failed to handle message",e),at({title:"Failed to handle message",description:st(e),variant:"danger"})}},t[19]=k,t[20]=P):P=t[20];const R=function(e){const{onOpen:t,onMessage:n,onClose:r,onError:o,...s}=e,[i]=l.useState((()=>{const a=fe()?new it(Qe.INSTANCE):e.static?new Pi:new Ni(s.url,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return t&&a.addEventListener("open",t),r&&a.addEventListener("close",r),o&&a.addEventListener("error",o),n&&a.addEventListener("message",n),a}));return l.useEffect((()=>(i.readyState===WebSocket.CLOSED&&i.reconnect(),()=>{a.warn("useWebSocket is unmounting. This likely means there is a bug."),i.close(),t&&i.removeEventListener("open",t),r&&i.removeEventListener("close",r),o&&i.removeEventListener("error",o),n&&i.removeEventListener("message",n)})),[i]),i}({static:pe(),url:Dt(s),onOpen:()=>{n.current=!0,_({state:De.OPEN})},onMessage:P,onClose:e=>{switch(a.warn("WebSocket closed",e.code,e.reason),e.reason){case"MARIMO_ALREADY_CONNECTED":return _({state:De.CLOSED,code:vt.ALREADY_RUNNING,reason:"another browser tab is already connected to the kernel",canTakeover:!0}),void R.close();case"MARIMO_WRONG_KERNEL_ID":case"MARIMO_NO_FILE_KEY":case"MARIMO_NO_SESSION_ID":case"MARIMO_NO_SESSION":case"MARIMO_SHUTDOWN":return _({state:De.CLOSED,code:vt.KERNEL_DISCONNECTED,reason:"kernel not found"}),void R.close();case"MARIMO_MALFORMED_QUERY":return void _({state:De.CLOSED,code:vt.MALFORMED_QUERY,reason:"the kernel did not recognize a request; please file a bug with marimo"});default:_({state:De.CONNECTING}),N(e.code,e.reason)}},onError:e=>{a.warn("WebSocket error",e),_({state:De.CLOSED,code:vt.KERNEL_DISCONNECTED,reason:"kernel not found"}),N()}});let M;return t[21]!==S?(M={connection:S},t[21]=S,t[22]=M):M=t[22],M}export{vi as A,Gs as C,Nt as E,Pt as F,zt as I,qs as L,Tt as M,is as N,js as O,At as R,Ua as T,ys as V,Si as a,Hs as b,As as c,bs as d,ps as e,zi as f,Ws as g,Ti as h,Wi as i,qi as j,Li as k,Ls as l,Ii as m,ss as n,as as o,_s as p,ws as q,vs as r,$i as s,Ki as t,Zi as u};
