(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["9321"],{94697:function(e,t,n){"use strict";n.d(t,{Cj:()=>eW,Dy:()=>N,LB:()=>ej,Lg:()=>ed,O1:()=>eY,VK:()=>U,VT:()=>T,Zj:()=>eU,_8:()=>J,ey:()=>P,g4:()=>m,hI:()=>$,pE:()=>j,we:()=>eg});var r,i,l,o,s,a,u,c,d,f,h,p,m,g,v,y,b,w,x,k=n(98661),E=n(24285),C=n(42617);let R=(0,k.createContext)(null),S={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},M={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function D(e){let{announcements:t=M,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=S}=e,{announce:l,announcement:o}=(0,C.qg)(),s=(0,E.Ld)("DndLiveRegion"),[a,u]=(0,k.useState)(!1);if((0,k.useEffect)(()=>{u(!0)},[]),!function(e){let t=(0,k.useContext)(R);(0,k.useEffect)(()=>{if(!t)throw Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}((0,k.useMemo)(()=>({onDragStart(e){let{active:n}=e;l(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&l(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;l(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;l(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;l(t.onDragCancel({active:n,over:r}))}}),[l,t])),!a)return null;let c=k.default.createElement(k.default.Fragment,null,k.default.createElement(C.Mv,{id:r,value:i.draggable}),k.default.createElement(C.LE,{id:s,announcement:o}));return n?(0,k.createPortal)(c,n):c}function I(){}function T(e,t){return(0,k.useMemo)(()=>({sensor:e,options:null!=t?t:{}}),[e,t])}function N(){for(var e=arguments.length,t=Array(e),n=0;n[...t].filter(e=>null!=e),[...t])}(r=f||(f={})).DragStart="dragStart",r.DragMove="dragMove",r.DragEnd="dragEnd",r.DragCancel="dragCancel",r.DragOver="dragOver",r.RegisterDroppable="registerDroppable",r.SetDroppableDisabled="setDroppableDisabled",r.UnregisterDroppable="unregisterDroppable";let O=Object.freeze({x:0,y:0});function A(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function L(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function F(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function z(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function J(e,t){if(!e||0===e.length)return null;let[n]=e;return t?n[t]:n}function B(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}let j=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=B(t,t.left,t.top),l=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=A(B(r),i);l.push({id:t,data:{droppableContainer:e,value:n}})}}return l.sort(L)},P=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=z(t),l=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=z(r),o=Number((i.reduce((e,t,r)=>e+A(n[r],t),0)/4).toFixed(4));l.push({id:t,data:{droppableContainer:e,value:o}})}}return l.sort(L)},H=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,l=n.get(r);if(l){let n=function(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height);if(r0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(F)};function Y(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:O}let W=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r({...e,top:e.top+ +t.y,bottom:e.bottom+ +t.y,left:e.left+ +t.x,right:e.right+ +t.x}),{...e})},K={ignoreTransform:!1};function U(e,t){void 0===t&&(t=K);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=(0,E.Jj)(e).getComputedStyle(e);t&&(n=function(e,t,n){let r=function(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;let{scaleX:i,scaleY:l,x:o,y:s}=r,a=e.left-o-(1-i)*parseFloat(n),u=e.top-s-(1-l)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,d=l?e.height/l:e.height;return{width:c,height:d,top:u,right:a+c,bottom:u+d,left:a}}(n,t,r))}let{top:r,left:i,width:l,height:o,bottom:s,right:a}=n;return{top:r,left:i,width:l,height:o,bottom:s,right:a}}function X(e){return U(e,{ignoreTransform:!0})}function $(e,t){let n=[];return e?function r(i){var l;if(null!=t&&n.length>=t||!i)return n;if((0,E.qk)(i)&&null!=i.scrollingElement&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!(0,E.Re)(i)||(0,E.vZ)(i)||n.includes(i))return n;let o=(0,E.Jj)(e).getComputedStyle(i);return(i!==e&&function(e,t){void 0===t&&(t=(0,E.Jj)(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{let r=t[e];return"string"==typeof r&&n.test(r)})}(i,o)&&n.push(i),void 0===(l=o)&&(l=(0,E.Jj)(i).getComputedStyle(i)),"fixed"===l.position)?n:r(i.parentNode)}(e):n}function _(e){let[t]=$(e,1);return null!=t?t:null}function q(e){return E.Nq&&e?(0,E.FJ)(e)?e:(0,E.UG)(e)?(0,E.qk)(e)||e===(0,E.r3)(e).scrollingElement?window:(0,E.Re)(e)?e:null:null:null}function Z(e){return(0,E.FJ)(e)?e.scrollX:e.scrollLeft}function G(e){return(0,E.FJ)(e)?e.scrollY:e.scrollTop}function V(e){return{x:Z(e),y:G(e)}}function Q(e){return!!E.Nq&&!!e&&e===document.scrollingElement}function ee(e){let t={x:0,y:0},n=Q(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,l=e.scrollLeft<=t.x;return{isTop:i,isLeft:l,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}(i=h||(h={}))[i.Forward=1]="Forward",i[i.Backward=-1]="Backward";let et={x:.2,y:.2};function en(e){return e.reduce((e,t)=>(0,E.IH)(e,V(t)),O)}let er=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+Z(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+G(t),0)}]];class ei{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=$(t),r=en(n);for(let[t,i,l]of(this.rect={...e},this.width=e.width,this.height=e.height,er))for(let e of i)Object.defineProperty(this,e,{get:()=>{let i=l(n),o=r[t]-i;return this.rect[e]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class el{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function eo(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}function es(e){e.preventDefault()}function ea(e){e.stopPropagation()}(l=p||(p={})).Click="click",l.DragStart="dragstart",l.Keydown="keydown",l.ContextMenu="contextmenu",l.Resize="resize",l.SelectionChange="selectionchange",l.VisibilityChange="visibilitychange",(o=m||(m={})).Space="Space",o.Down="ArrowDown",o.Right="ArrowRight",o.Left="ArrowLeft",o.Up="ArrowUp",o.Esc="Escape",o.Enter="Enter",o.Tab="Tab";let eu={start:[m.Space,m.Enter],cancel:[m.Esc],end:[m.Space,m.Enter,m.Tab]},ec=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case m.Right:return{...n,x:n.x+25};case m.Left:return{...n,x:n.x-25};case m.Down:return{...n,y:n.y+25};case m.Up:return{...n,y:n.y-25}}};class ed{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new el((0,E.r3)(t)),this.windowListeners=new el((0,E.Jj)(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(p.Resize,this.handleCancel),this.windowListeners.add(p.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(p.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=U),!e)return;let{top:n,left:r,bottom:i,right:l}=t(e);_(e)&&(i<=0||l<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(O)}handleKeyDown(e){if((0,E.vd)(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=eu,coordinateGetter:l=ec,scrollBehavior:o="smooth"}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:a}=n.current,u=a?{x:a.left,y:a.top}:O;this.referenceCoordinates||(this.referenceCoordinates=u);let c=l(e,{active:t,context:n.current,currentCoordinates:u});if(c){let t=(0,E.$X)(c,u),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:l,isRight:s,isLeft:a,isBottom:u,maxScroll:d,minScroll:f}=ee(n),h=function(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}(n),p={x:Math.min(i===m.Right?h.right-h.width/2:h.right,Math.max(i===m.Right?h.left:h.left+h.width/2,c.x)),y:Math.min(i===m.Down?h.bottom-h.height/2:h.bottom,Math.max(i===m.Down?h.top:h.top+h.height/2,c.y))},g=i===m.Right&&!s||i===m.Left&&!a,v=i===m.Down&&!u||i===m.Up&&!l;if(g&&p.x!==c.x){let e=n.scrollLeft+t.x,l=i===m.Right&&e<=d.x||i===m.Left&&e>=f.x;if(l&&!t.y){n.scrollTo({left:e,behavior:o});return}l?r.x=n.scrollLeft-e:r.x=i===m.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}if(v&&p.y!==c.y){let e=n.scrollTop+t.y,l=i===m.Down&&e<=d.y||i===m.Up&&e>=f.y;if(l&&!t.x){n.scrollTo({top:e,behavior:o});return}l?r.y=n.scrollTop-e:r.y=i===m.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,(0,E.IH)((0,E.$X)(c,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function ef(e){return!!(e&&"distance"in e)}function eh(e){return!!(e&&"delay"in e)}ed.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=eu,onActivation:i}=t,{active:l}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=l.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==i||i({event:e.nativeEvent}),!0)}return!1}}];class ep{constructor(e,t,n){var r;void 0===n&&(n=function(e){let{EventTarget:t}=(0,E.Jj)(e);return e instanceof t?e:(0,E.r3)(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:i}=e,{target:l}=i;this.props=e,this.events=t,this.document=(0,E.r3)(l),this.documentListeners=new el(this.document),this.listeners=new el(n),this.windowListeners=new el((0,E.Jj)(l)),this.initialCoordinates=null!=(r=(0,E.DC)(i))?r:O,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(p.Resize,this.handleCancel),this.windowListeners.add(p.DragStart,es),this.windowListeners.add(p.VisibilityChange,this.handleCancel),this.windowListeners.add(p.ContextMenu,es),this.documentListeners.add(p.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(eh(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(ef(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(p.Click,ea,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(p.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;let{activated:n,initialCoordinates:r,props:i}=this,{onMove:l,options:{activationConstraint:o}}=i;if(!r)return;let s=null!=(t=(0,E.DC)(e))?t:O,a=(0,E.$X)(r,s);if(!n&&o){if(ef(o)){if(null!=o.tolerance&&eo(a,o.tolerance))return this.handleCancel();if(eo(a,o.distance))return this.handleStart()}return eh(o)&&eo(a,o.tolerance)?this.handleCancel():void this.handlePending(o,a)}e.cancelable&&e.preventDefault(),l(s)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===m.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}let em={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class eg extends ep{constructor(e){let{event:t}=e;super(e,em,(0,E.r3)(t.target))}}eg.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!!n.isPrimary&&0===n.button&&(null==r||r({event:n}),!0)}}];(s=g||(g={}))[s.RightClick=2]="RightClick";(a=v||(v={}))[a.Pointer=0]="Pointer",a[a.DraggableRect=1]="DraggableRect",(u=y||(y={}))[u.TreeOrder=0]="TreeOrder",u[u.ReversedTreeOrder=1]="ReversedTreeOrder";let ev={x:{[h.Backward]:!1,[h.Forward]:!1},y:{[h.Backward]:!1,[h.Forward]:!1}};(c=b||(b={}))[c.Always=0]="Always",c[c.BeforeDragging=1]="BeforeDragging",c[c.WhileDragging=2]="WhileDragging",(w||(w={})).Optimized="optimized";let ey=new Map;function eb(e,t){return(0,E.Gj)(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function ew(e){let{callback:t,disabled:n}=e,r=(0,E.zX)(t),i=(0,k.useMemo)(()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,k.useEffect)(()=>()=>null==i?void 0:i.disconnect(),[i]),i}function ex(e){return new ei(U(e),e)}function ek(e,t,n){void 0===t&&(t=ex);let[r,i]=(0,k.useState)(null);function l(){i(r=>{if(!e)return null;if(!1===e.isConnected){var i;return null!=(i=null!=r?r:n)?i:null}let l=t(e);return JSON.stringify(r)===JSON.stringify(l)?r:l})}let o=function(e){let{callback:t,disabled:n}=e,r=(0,E.zX)(t),i=(0,k.useMemo)(()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,k.useEffect)(()=>()=>null==i?void 0:i.disconnect(),[i]),i}({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){l();break}}}}),s=ew({callback:l});return(0,E.LI)(()=>{l(),e?(null==s||s.observe(e),null==o||o.observe(document.body,{childList:!0,subtree:!0})):(null==s||s.disconnect(),null==o||o.disconnect())},[e]),r}let eE=[];function eC(e,t){void 0===t&&(t=[]);let n=(0,k.useRef)(null);return(0,k.useEffect)(()=>{n.current=null},t),(0,k.useEffect)(()=>{let t=e!==O;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?(0,E.$X)(e,n.current):O}function eR(e){return(0,k.useMemo)(()=>e?function(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null,[e])}let eS=[],eM=[{sensor:eg,options:{}},{sensor:ed,options:{}}],eD={current:{}},eI={draggable:{measure:X},droppable:{measure:X,strategy:b.WhileDragging,frequency:w.Optimized},dragOverlay:{measure:U}};class eT extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}let eN={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new eT,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:I},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:eI,measureDroppableContainers:I,windowRect:null,measuringScheduled:!1},eO={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:I,draggableNodes:new Map,over:null,measureDroppableContainers:I},eA=(0,k.createContext)(eO),eL=(0,k.createContext)(eN);function eF(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new eT}}}function ez(e,t){switch(t.type){case f.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case f.DragMove:if(null==e.draggable.active)return e;return{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case f.DragEnd:case f.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case f.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new eT(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case f.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,l=e.droppable.containers.get(n);if(!l||r!==l.key)return e;let o=new eT(e.droppable.containers);return o.set(n,{...l,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case f.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let l=new eT(e.droppable.containers);return l.delete(n),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function eJ(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,k.useContext)(eA),l=(0,E.D9)(r),o=(0,E.D9)(null==n?void 0:n.id);return(0,k.useEffect)(()=>{if(!t&&!r&&l&&null!=o){if(!(0,E.vd)(l)||document.activeElement===l.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(t.current||n.current)requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=(0,E.so)(e);if(t){t.focus();break}}})}},[r,t,i,o,l]),null}let eB=(0,k.createContext)({...O,scaleX:1,scaleY:1});(d=x||(x={}))[d.Uninitialized=0]="Uninitialized",d[d.Initializing=1]="Initializing",d[d.Initialized=2]="Initialized";let ej=(0,k.memo)(function(e){var t,n,r,i,l,o;let{id:s,accessibility:a,autoScroll:u=!0,children:c,sensors:d=eM,collisionDetection:p=H,measuring:m,modifiers:g,...w}=e,[C,S]=(0,k.useReducer)(ez,void 0,eF),[M,I]=function(){let[e]=(0,k.useState)(()=>new Set),t=(0,k.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,k.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]),t]}(),[T,N]=(0,k.useState)(x.Uninitialized),A=T===x.Initialized,{draggable:{active:L,nodes:F,translate:z},droppable:{containers:B}}=C,j=null!=L?F.get(L):null,P=(0,k.useRef)({initial:null,translated:null}),K=(0,k.useMemo)(()=>{var e;return null!=L?{id:L,data:null!=(e=null==j?void 0:j.data)?e:eD,rect:P}:null},[L,j]),X=(0,k.useRef)(null),[Z,G]=(0,k.useState)(null),[er,el]=(0,k.useState)(null),eo=(0,E.Ey)(w,Object.values(w)),es=(0,E.Ld)("DndDescribedBy",s),ea=(0,k.useMemo)(()=>B.getEnabled(),[B]),eu=(0,k.useMemo)(()=>({draggable:{...eI.draggable,...null==m?void 0:m.draggable},droppable:{...eI.droppable,...null==m?void 0:m.droppable},dragOverlay:{...eI.dragOverlay,...null==m?void 0:m.dragOverlay}}),[null==m?void 0:m.draggable,null==m?void 0:m.droppable,null==m?void 0:m.dragOverlay]),{droppableRects:ec,measureDroppableContainers:ed,measuringScheduled:ef}=function(e,t){let{dragging:n,dependencies:r,config:i}=t,[l,o]=(0,k.useState)(null),{frequency:s,measure:a,strategy:u}=i,c=(0,k.useRef)(e),d=function(){switch(u){case b.Always:return!1;case b.BeforeDragging:return n;default:return!n}}(),f=(0,E.Ey)(d),h=(0,k.useCallback)(function(e){void 0===e&&(e=[]),!f.current&&o(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),p=(0,k.useRef)(null),m=(0,E.Gj)(t=>{if(d&&!n)return ey;if(!t||t===ey||c.current!==e||null!=l){let t=new Map;for(let n of e){if(!n)continue;if(l&&l.length>0&&!l.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new ei(a(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,l,n,d,a]);return(0,k.useEffect)(()=>{c.current=e},[e]),(0,k.useEffect)(()=>{!d&&h()},[n,d]),(0,k.useEffect)(()=>{l&&l.length>0&&o(null)},[JSON.stringify(l)]),(0,k.useEffect)(()=>{!d&&"number"==typeof s&&null===p.current&&(p.current=setTimeout(()=>{h(),p.current=null},s))},[s,d,h,...r]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:null!=l}}(ea,{dragging:A,dependencies:[z.x,z.y],config:eu.droppable}),eh=function(e,t){let n=null!=t?e.get(t):void 0,r=n?n.node.current:null;return(0,E.Gj)(e=>{var n;return null==t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(F,L),ep=(0,k.useMemo)(()=>er?(0,E.DC)(er):null,[er]),em=function(){let e=(null==Z?void 0:Z.autoScrollEnabled)===!1,t="object"==typeof u?!1===u.enabled:!1===u,n=A&&!e&&!t;return"object"==typeof u?{...u,enabled:n}:{enabled:n}}(),eg=eb(eh,eu.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,l=(0,k.useRef)(!1),{x:o,y:s}="boolean"==typeof i?{x:i,y:i}:i;(0,E.LI)(()=>{if(!o&&!s||!t){l.current=!1;return}if(l.current||!r)return;let e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;let i=Y(n(e),r);if(o||(i.x=0),s||(i.y=0),l.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=_(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}({activeNode:null!=L?F.get(L):null,config:em.layoutShiftCompensation,initialRect:eg,measure:eu.draggable.measure});let ex=ek(eh,eu.draggable.measure,eg),eT=ek(eh?eh.parentElement:null),eN=(0,k.useRef)({activatorEvent:null,active:null,activeNode:eh,collisionRect:null,collisions:null,droppableRects:ec,draggableNodes:F,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),eO=B.getNodeFor(null==(t=eN.current.over)?void 0:t.id),ej=function(e){let{measure:t}=e,[n,r]=(0,k.useState)(null),i=ew({callback:(0,k.useCallback)(e=>{for(let{target:n}of e)if((0,E.Re)(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),l=(0,k.useCallback)(e=>{let n=function(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return(0,E.Re)(t)?t:e}(e);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?t(n):null)},[t,i]),[o,s]=(0,E.wm)(l);return(0,k.useMemo)(()=>({nodeRef:o,rect:n,setRef:s}),[n,o,s])}({measure:eu.dragOverlay.measure}),eP=null!=(n=ej.nodeRef.current)?n:eh,eH=A?null!=(r=ej.rect)?r:ex:null,eY=!!(ej.nodeRef.current&&ej.rect),eW=function(e){let t=eb(e);return Y(e,t)}(eY?null:ex),eK=eR(eP?(0,E.Jj)(eP):null),eU=function(e){let t=(0,k.useRef)(e),n=(0,E.Gj)(n=>e?n&&n!==eE&&e&&t.current&&e.parentNode===t.current.parentNode?n:$(e):eE,[e]);return(0,k.useEffect)(()=>{t.current=e},[e]),n}(A?null!=eO?eO:eh:null),eX=function(e,t){void 0===t&&(t=U);let[n]=e,r=eR(n?(0,E.Jj)(n):null),[i,l]=(0,k.useState)(eS);function o(){l(()=>e.length?e.map(e=>Q(e)?r:new ei(t(e),e)):eS)}let s=ew({callback:o});return(0,E.LI)(()=>{null==s||s.disconnect(),o(),e.forEach(e=>null==s?void 0:s.observe(e))},[e]),i}(eU),e$=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}(g,{transform:{x:z.x-eW.x,y:z.y-eW.y,scaleX:1,scaleY:1},activatorEvent:er,active:K,activeNodeRect:ex,containerNodeRect:eT,draggingNodeRect:eH,over:eN.current.over,overlayNodeRect:ej.rect,scrollableAncestors:eU,scrollableAncestorRects:eX,windowRect:eK}),e_=ep?(0,E.IH)(ep,z):null,eq=function(e){let[t,n]=(0,k.useState)(null),r=(0,k.useRef)(e),i=(0,k.useCallback)(e=>{let t=q(e.target);t&&n(e=>e?(e.set(t,V(t)),new Map(e)):null)},[]);return(0,k.useEffect)(()=>{let t=r.current;if(e!==t){l(t);let o=e.map(e=>{let t=q(e);return t?(t.addEventListener("scroll",i,{passive:!0}),[t,V(t)]):null}).filter(e=>null!=e);n(o.length?new Map(o):null),r.current=e}return()=>{l(e),l(t)};function l(e){e.forEach(e=>{let t=q(e);null==t||t.removeEventListener("scroll",i)})}},[i,e]),(0,k.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>(0,E.IH)(e,t),O):en(e):O,[e,t])}(eU),eZ=eC(eq),eG=eC(eq,[ex]),eV=(0,E.IH)(e$,eZ),eQ=eH?W(eH,e$):null,e0=K&&eQ?p({active:K,collisionRect:eQ,droppableRects:ec,droppableContainers:ea,pointerCoordinates:e_}):null,e1=J(e0,"id"),[e2,e3]=(0,k.useState)(null),e5=(l=eY?e$:(0,E.IH)(e$,eG),o=null!=(i=null==e2?void 0:e2.rect)?i:null,{...l,scaleX:o&&ex?o.width/ex.width:1,scaleY:o&&ex?o.height/ex.height:1}),e6=(0,k.useRef)(null),e4=(0,k.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(null==X.current)return;let i=F.get(X.current);if(!i)return;let l=e.nativeEvent,o=new n({active:X.current,activeNode:i,event:l,options:r,context:eN,onAbort(e){if(!F.get(e))return;let{onDragAbort:t}=eo.current,n={id:e};null==t||t(n),M({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!F.get(e))return;let{onDragPending:i}=eo.current,l={id:e,constraint:t,initialCoordinates:n,offset:r};null==i||i(l),M({type:"onDragPending",event:l})},onStart(e){let t=X.current;if(null==t)return;let n=F.get(t);if(!n)return;let{onDragStart:r}=eo.current,i={activatorEvent:l,active:{id:t,data:n.data,rect:P}};(0,k.unstable_batchedUpdates)(()=>{null==r||r(i),N(x.Initializing),S({type:f.DragStart,initialCoordinates:e,active:t}),M({type:"onDragStart",event:i}),G(e6.current),el(l)})},onMove(e){S({type:f.DragMove,coordinates:e})},onEnd:s(f.DragEnd),onCancel:s(f.DragCancel)});function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=eN.current,o=null;if(t&&i){let{cancelDrop:s}=eo.current;o={activatorEvent:l,active:t,collisions:n,delta:i,over:r},e===f.DragEnd&&"function"==typeof s&&await Promise.resolve(s(o))&&(e=f.DragCancel)}X.current=null,(0,k.unstable_batchedUpdates)(()=>{S({type:e}),N(x.Uninitialized),e3(null),G(null),el(null),e6.current=null;let t=e===f.DragEnd?"onDragEnd":"onDragCancel";if(o){let e=eo.current[t];null==e||e(o),M({type:t,event:o})}})}}e6.current=o},[F]),e8=(0,k.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,l=F.get(r);null===X.current&&l&&!i.dndKit&&!i.defaultPrevented&&!0===e(n,t.options,{active:l})&&(i.dndKit={capturedBy:t.sensor},X.current=r,e4(n,t))},[F,e4]),e9=(0,k.useMemo)(()=>d.reduce((e,t)=>{let{sensor:n}=t;return[...e,...n.activators.map(e=>({eventName:e.eventName,handler:e8(e.handler,t)}))]},[]),[d,e8]);(0,k.useEffect)(()=>{if(!E.Nq)return;let e=d.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(let t of e)null==t||t()}},d.map(e=>{let{sensor:t}=e;return t})),(0,E.LI)(()=>{ex&&T===x.Initializing&&N(x.Initialized)},[ex,T]),(0,k.useEffect)(()=>{let{onDragMove:e}=eo.current,{active:t,activatorEvent:n,collisions:r,over:i}=eN.current;if(!t||!n)return;let l={active:t,activatorEvent:n,collisions:r,delta:{x:eV.x,y:eV.y},over:i};(0,k.unstable_batchedUpdates)(()=>{null==e||e(l),M({type:"onDragMove",event:l})})},[eV.x,eV.y]),(0,k.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=eN.current;if(!e||null==X.current||!t||!i)return;let{onDragOver:l}=eo.current,o=r.get(e1),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,a={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,k.unstable_batchedUpdates)(()=>{e3(s),null==l||l(a),M({type:"onDragOver",event:a})})},[e1]),(0,E.LI)(()=>{eN.current={activatorEvent:er,active:K,activeNode:eh,collisionRect:eQ,collisions:e0,droppableRects:ec,draggableNodes:F,draggingNode:eP,draggingNodeRect:eH,droppableContainers:B,over:e2,scrollableAncestors:eU,scrollAdjustedTranslate:eV},P.current={initial:eH,translated:eQ}},[K,eh,e0,eQ,F,eP,eH,ec,B,e2,eU,eV]),function(e){let{acceleration:t,activator:n=v.Pointer,canScroll:r,draggingRect:i,enabled:l,interval:o=5,order:s=y.TreeOrder,pointerCoordinates:a,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:f}=e,p=function(e){let{delta:t,disabled:n}=e,r=(0,E.D9)(t);return(0,E.Gj)(e=>{if(n||!r||!e)return ev;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[h.Backward]:e.x[h.Backward]||-1===i.x,[h.Forward]:e.x[h.Forward]||1===i.x},y:{[h.Backward]:e.y[h.Backward]||-1===i.y,[h.Forward]:e.y[h.Forward]||1===i.y}}},[n,t,r])}({delta:d,disabled:!l}),[m,g]=(0,E.Yz)(),b=(0,k.useRef)({x:0,y:0}),w=(0,k.useRef)({x:0,y:0}),x=(0,k.useMemo)(()=>{switch(n){case v.Pointer:return a?{top:a.y,bottom:a.y,left:a.x,right:a.x}:null;case v.DraggableRect:return i}},[n,i,a]),C=(0,k.useRef)(null),R=(0,k.useCallback)(()=>{let e=C.current;if(!e)return;let t=b.current.x*w.current.x,n=b.current.y*w.current.y;e.scrollBy(t,n)},[]),S=(0,k.useMemo)(()=>s===y.TreeOrder?[...u].reverse():u,[s,u]);(0,k.useEffect)(()=>{if(!l||!u.length||!x){g();return}for(let e of S){if((null==r?void 0:r(e))===!1)continue;let n=c[u.indexOf(e)];if(!n)continue;let{direction:i,speed:l}=function(e,t,n,r,i){let{top:l,left:o,right:s,bottom:a}=n;void 0===r&&(r=10),void 0===i&&(i=et);let{isTop:u,isBottom:c,isLeft:d,isRight:f}=ee(e),p={x:0,y:0},m={x:0,y:0},g={height:t.height*i.y,width:t.width*i.x};return!u&&l<=t.top+g.height?(p.y=h.Backward,m.y=r*Math.abs((t.top+g.height-l)/g.height)):!c&&a>=t.bottom-g.height&&(p.y=h.Forward,m.y=r*Math.abs((t.bottom-g.height-a)/g.height)),!f&&s>=t.right-g.width?(p.x=h.Forward,m.x=r*Math.abs((t.right-g.width-s)/g.width)):!d&&o<=t.left+g.width&&(p.x=h.Backward,m.x=r*Math.abs((t.left+g.width-o)/g.width)),{direction:p,speed:m}}(e,n,x,t,f);for(let e of["x","y"])p[e][i[e]]||(l[e]=0,i[e]=0);if(l.x>0||l.y>0){g(),C.current=e,m(R,o),b.current=l,w.current=i;return}}b.current={x:0,y:0},w.current={x:0,y:0},g()},[t,R,r,g,l,o,JSON.stringify(x),JSON.stringify(p),m,u,S,c,JSON.stringify(f)])}({...em,delta:z,draggingRect:eQ,pointerCoordinates:e_,scrollableAncestors:eU,scrollableAncestorRects:eX});let e7=(0,k.useMemo)(()=>({active:K,activeNode:eh,activeNodeRect:ex,activatorEvent:er,collisions:e0,containerNodeRect:eT,dragOverlay:ej,draggableNodes:F,droppableContainers:B,droppableRects:ec,over:e2,measureDroppableContainers:ed,scrollableAncestors:eU,scrollableAncestorRects:eX,measuringConfiguration:eu,measuringScheduled:ef,windowRect:eK}),[K,eh,ex,er,e0,eT,ej,F,B,ec,e2,ed,eU,eX,eu,ef,eK]),te=(0,k.useMemo)(()=>({activatorEvent:er,activators:e9,active:K,activeNodeRect:ex,ariaDescribedById:{draggable:es},dispatch:S,draggableNodes:F,over:e2,measureDroppableContainers:ed}),[er,e9,K,ex,S,es,F,e2,ed]);return k.default.createElement(R.Provider,{value:I},k.default.createElement(eA.Provider,{value:te},k.default.createElement(eL.Provider,{value:e7},k.default.createElement(eB.Provider,{value:e5},c)),k.default.createElement(eJ,{disabled:(null==a?void 0:a.restoreFocus)===!1})),k.default.createElement(D,{...a,hiddenTextDescribedById:es}))}),eP=(0,k.createContext)(null),eH="button";function eY(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,l=(0,E.Ld)("Draggable"),{activators:o,activatorEvent:s,active:a,activeNodeRect:u,ariaDescribedById:c,draggableNodes:d,over:f}=(0,k.useContext)(eA),{role:h=eH,roleDescription:p="draggable",tabIndex:m=0}=null!=i?i:{},g=(null==a?void 0:a.id)===t,v=(0,k.useContext)(g?eB:eP),[y,b]=(0,E.wm)(),[w,x]=(0,E.wm)(),C=(0,k.useMemo)(()=>o.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[o,t]),R=(0,E.Ey)(n);return(0,E.LI)(()=>(d.set(t,{id:t,key:l,node:y,activatorNode:w,data:R}),()=>{let e=d.get(t);e&&e.key===l&&d.delete(t)}),[d,t]),{active:a,activatorEvent:s,activeNodeRect:u,attributes:(0,k.useMemo)(()=>({role:h,tabIndex:m,"aria-disabled":r,"aria-pressed":!!g&&h===eH||void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[r,h,m,g,p,c.draggable]),isDragging:g,listeners:r?void 0:C,node:y,over:f,setNodeRef:b,setActivatorNodeRef:x,transform:v}}function eW(){return(0,k.useContext)(eL)}let eK={timeout:25};function eU(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,l=(0,E.Ld)("Droppable"),{active:o,dispatch:s,over:a,measureDroppableContainers:u}=(0,k.useContext)(eA),c=(0,k.useRef)({disabled:n}),d=(0,k.useRef)(!1),h=(0,k.useRef)(null),p=(0,k.useRef)(null),{disabled:m,updateMeasurementsFor:g,timeout:v}={...eK,...i},y=(0,E.Ey)(null!=g?g:r),b=ew({callback:(0,k.useCallback)(()=>{if(!d.current){d.current=!0;return}null!=p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(y.current)?y.current:[y.current]),p.current=null},v)},[v]),disabled:m||!o}),w=(0,k.useCallback)((e,t)=>{b&&(t&&(b.unobserve(t),d.current=!1),e&&b.observe(e))},[b]),[x,C]=(0,E.wm)(w),R=(0,E.Ey)(t);return(0,k.useEffect)(()=>{b&&x.current&&(b.disconnect(),d.current=!1,b.observe(x.current))},[x,b]),(0,k.useEffect)(()=>(s({type:f.RegisterDroppable,element:{id:r,key:l,disabled:n,node:x,rect:h,data:R}}),()=>s({type:f.UnregisterDroppable,key:l,id:r})),[r]),(0,k.useEffect)(()=>{n!==c.current.disabled&&(s({type:f.SetDroppableDisabled,id:r,key:l,disabled:n}),c.current.disabled=n)},[r,l,n,s]),{active:o,rect:h,isOver:(null==a?void 0:a.id)===r,node:x,over:a,setNodeRef:C}}},45587:function(e,t,n){"use strict";n.d(t,{Fo:()=>d,Rp:()=>o,U2:()=>a,is:()=>x,nB:()=>y});var r=n(98661),i=n(94697),l=n(24285);function o(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function s(e){return null!==e&&e>=0}let a=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,l=o(t,r,n),s=t[i],a=l[i];return a&&s?{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}:null},u="Sortable",c=r.default.createContext({activeIndex:-1,containerId:u,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:a,disabled:{draggable:!1,droppable:!1}});function d(e){let{children:t,id:n,items:o,strategy:s=a,disabled:d=!1}=e,{active:f,dragOverlay:h,droppableRects:p,over:m,measureDroppableContainers:g}=(0,i.Cj)(),v=(0,l.Ld)(u,n),y=null!==h.rect,b=(0,r.useMemo)(()=>o.map(e=>"object"==typeof e&&"id"in e?e.id:e),[o]),w=null!=f,x=f?b.indexOf(f.id):-1,k=m?b.indexOf(m.id):-1,E=(0,r.useRef)(b),C=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{C&&w&&g(b)},[C,b,w,g]),(0,r.useEffect)(()=>{E.current=b},[b]);let M=(0,r.useMemo)(()=>({activeIndex:x,containerId:v,disabled:S,disableTransforms:R,items:b,overIndex:k,useDragOverlay:y,sortedRects:b.reduce((e,t,n)=>{let r=p.get(t);return r&&(e[n]=r),e},Array(b.length)),strategy:s}),[x,v,S.draggable,S.droppable,R,b,k,p,y,s]);return r.default.createElement(c.Provider,{value:M},t)}let f=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return o(n,r,i).indexOf(t)},h=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:l,newIndex:o,previousItems:s,previousContainerId:a,transition:u}=e;return!!u&&!!r&&(s===l||i!==o)&&(!!n||o!==i&&t===a)},p={duration:200,easing:"ease"},m="transform",g=l.ux.Transition.toString({property:m,duration:0,easing:"linear"}),v={roleDescription:"sortable"};function y(e){var t,n,o,a;let{animateLayoutChanges:u=h,attributes:d,disabled:y,data:b,getNewIndex:w=f,id:x,strategy:k,resizeObserverConfig:E,transition:C=p}=e,{items:R,containerId:S,activeIndex:M,disabled:D,disableTransforms:I,sortedRects:T,overIndex:N,useDragOverlay:O,strategy:A}=(0,r.useContext)(c),L=(t=y,n=D,"boolean"==typeof t?{draggable:t,droppable:!1}:{draggable:null!=(o=null==t?void 0:t.draggable)?o:n.draggable,droppable:null!=(a=null==t?void 0:t.droppable)?a:n.droppable}),F=R.indexOf(x),z=(0,r.useMemo)(()=>({sortable:{containerId:S,index:F,items:R},...b}),[S,b,F,R]),J=(0,r.useMemo)(()=>R.slice(R.indexOf(x)),[R,x]),{rect:B,node:j,isOver:P,setNodeRef:H}=(0,i.Zj)({id:x,data:z,disabled:L.droppable,resizeObserverConfig:{updateMeasurementsFor:J,...E}}),{active:Y,activatorEvent:W,activeNodeRect:K,attributes:U,setNodeRef:X,listeners:$,isDragging:_,over:q,setActivatorNodeRef:Z,transform:G}=(0,i.O1)({id:x,data:z,attributes:{...v,...d},disabled:L.draggable}),V=(0,l.HB)(H,X),Q=!!Y,ee=Q&&!I&&s(M)&&s(N),et=!O&&_,en=et&&ee?G:null,er=ee?null!=en?en:(null!=k?k:A)({rects:T,activeNodeRect:K,activeIndex:M,overIndex:N,index:F}):null,ei=s(M)&&s(N)?w({id:x,items:R,activeIndex:M,overIndex:N}):F,el=null==Y?void 0:Y.id,eo=(0,r.useRef)({activeId:el,items:R,newIndex:ei,containerId:S}),es=R!==eo.current.items,ea=u({active:Y,containerId:S,isDragging:_,isSorting:Q,id:x,index:F,items:R,newIndex:eo.current.newIndex,previousItems:eo.current.items,previousContainerId:eo.current.containerId,transition:C,wasDragging:null!=eo.current.activeId}),eu=function(e){let{disabled:t,index:n,node:o,rect:s}=e,[a,u]=(0,r.useState)(null),c=(0,r.useRef)(n);return(0,l.LI)(()=>{if(!t&&n!==c.current&&o.current){let e=s.current;if(e){let t=(0,i.VK)(o.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&u(n)}}n!==c.current&&(c.current=n)},[t,n,o,s]),(0,r.useEffect)(()=>{a&&u(null)},[a]),a}({disabled:!ea,index:F,node:j,rect:B});return(0,r.useEffect)(()=>{Q&&eo.current.newIndex!==ei&&(eo.current.newIndex=ei),S!==eo.current.containerId&&(eo.current.containerId=S),R!==eo.current.items&&(eo.current.items=R)},[Q,ei,S,R]),(0,r.useEffect)(()=>{if(el===eo.current.activeId)return;if(el&&!eo.current.activeId){eo.current.activeId=el;return}let e=setTimeout(()=>{eo.current.activeId=el},50);return()=>clearTimeout(e)},[el]),{active:Y,activeIndex:M,attributes:U,data:z,rect:B,index:F,newIndex:ei,items:R,isOver:P,isSorting:Q,isDragging:_,listeners:$,node:j,overIndex:N,over:q,setNodeRef:V,setActivatorNodeRef:Z,setDroppableNodeRef:H,setDraggableNodeRef:X,transform:null!=eu?eu:er,transition:eu||es&&eo.current.newIndex===F?g:(!et||(0,l.vd)(W))&&C&&(Q||ea)?l.ux.Transition.toString({...C,property:m}):void 0}}function b(e){if(!e)return!1;let t=e.data.current;return!!t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable}let w=[i.g4.Down,i.g4.Right,i.g4.Up,i.g4.Left],x=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:s,over:a,scrollableAncestors:u}}=t;if(w.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];s.getEnabled().forEach(n=>{if(!n||null!=n&&n.disabled)return;let l=o.get(n.id);if(l)switch(e.code){case i.g4.Down:r.topl.top&&t.push(n);break;case i.g4.Left:r.left>l.left&&t.push(n);break;case i.g4.Right:r.left1&&(h=f[1].id),null!=h){let e=s.get(n.id),t=s.get(h),a=t?o.get(t.id):null,f=null==t?void 0:t.node.current;if(f&&a&&e&&t){var c,d;let n=(0,i.hI)(f).some((e,t)=>u[t]!==e),o=k(e,t),s=(c=e,d=t,!!(b(c)&&b(d)&&k(c,d))&&c.data.current.sortable.indexC,D9:()=>b,DC:()=>S,Ey:()=>g,FJ:()=>o,Gj:()=>v,HB:()=>i,IH:()=>E,Jj:()=>a,LI:()=>h,Ld:()=>x,Nq:()=>l,Re:()=>c,UG:()=>s,Yz:()=>m,qk:()=>u,r3:()=>f,so:()=>I,ux:()=>M,vZ:()=>d,vd:()=>R,wm:()=>y,zX:()=>p});var r=n(98661);function i(){for(var e=arguments.length,t=Array(e),n=0;ne=>{t.forEach(t=>t(e))},t)}let l="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function o(e){let t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function s(e){return"nodeType"in e}function a(e){var t,n;return e?o(e)?e:s(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function u(e){let{Document:t}=a(e);return e instanceof t}function c(e){return!o(e)&&e instanceof a(e).HTMLElement}function d(e){return e instanceof a(e).SVGElement}function f(e){return e?o(e)?e.document:s(e)?u(e)?e:c(e)||d(e)?e.ownerDocument:document:document:document}let h=l?r.useLayoutEffect:r.useEffect;function p(e){let t=(0,r.useRef)(e);return h(()=>{t.current=e}),(0,r.useCallback)(function(){for(var e=arguments.length,n=Array(e),r=0;r{e.current=setInterval(t,n)},[]),(0,r.useCallback)(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}function g(e,t){void 0===t&&(t=[e]);let n=(0,r.useRef)(e);return h(()=>{n.current!==e&&(n.current=e)},t),n}function v(e,t){let n=(0,r.useRef)();return(0,r.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function y(e){let t=p(e),n=(0,r.useRef)(null),i=(0,r.useCallback)(e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e},[]);return[n,i]}function b(e){let t=(0,r.useRef)();return(0,r.useEffect)(()=>{t.current=e},[e]),t.current}let w={};function x(e,t){return(0,r.useMemo)(()=>{if(t)return t;let n=null==w[e]?0:w[e]+1;return w[e]=n,e+"-"+n},[e,t])}function k(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i{for(let[r,i]of Object.entries(n)){let n=t[r];null!=n&&(t[r]=n+e*i)}return t},{...t})}}let E=k(1),C=k(-1);function R(e){if(!e)return!1;let{KeyboardEvent:t}=a(e.target);return t&&e instanceof t}function S(e){if(function(e){if(!e)return!1;let{TouchEvent:t}=a(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return"clientX"in e&&"clientY"in e?{x:e.clientX,y:e.clientY}:null}let M=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[M.Translate.toString(e),M.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),D="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function I(e){return e.matches(D)?e:e.querySelector(D)}},7654:function(e,t,n){var r=n(81763);e.exports=function(e){return r(e)&&e!=+e}},23493:function(e,t,n){var r=n(23279),i=n(13218);e.exports=function(e,t,n){var l=!0,o=!0;if("function"!=typeof e)throw TypeError("Expected a function");return i(n)&&(l="leading"in n?!!n.leading:l,o="trailing"in n?!!n.trailing:o),r(e,t,{leading:l,maxWait:t,trailing:o})}},10120:function(e,t,n){"use strict";n.d(t,{I:()=>o,r:()=>l});var r=n(98661),i=n(22007);function l(){var e=(0,r.useState)(!1),t=e[0],n=e[1],l=(0,r.useRef)(null);(0,r.useEffect)(function(){var e=function(){n(i.Z.fullscreenElement===l.current)};return i.Z.addEventListener("fullscreenchange",e),function(){return i.Z.removeEventListener("fullscreenchange",e)}},[]);var o=(0,r.useCallback)(function(){return i.Z.fullscreenElement?i.Z.exitFullscreen().then(function(){return i.Z.requestFullscreen(l.current)}):l.current?i.Z.requestFullscreen(l.current):void 0},[]),s=(0,r.useCallback)(function(){return i.Z.fullscreenElement===l.current?i.Z.exitFullscreen():Promise.resolve()},[]);return(0,r.useMemo)(function(){return{active:t,enter:o,exit:s,node:l}},[t,o,s])}var o=function(e){var t=e.handle,n=e.onChange,i=e.children,l=e.className,o=[];return l&&o.push(l),o.push("fullscreen"),t.active&&o.push("fullscreen-enabled"),(0,r.useEffect)(function(){n&&n(t.active,t)},[t.active]),r.default.createElement("div",{className:o.join(" "),ref:t.node,style:t.active?{height:"100%",width:"100%"}:void 0},i)}},28518:function(e,t,n){"use strict";n.d(t,{NI:()=>Y,YF:()=>B,Y_:()=>U,bQ:()=>J,ll:()=>O});var r=n(98661),i=n(17268),l=n(33771),o=n(31720),s=n(88388),a=n(78493);let u={...r},c=u.useInsertionEffect||(e=>e());function d(e){let t=r.useRef(()=>{});return c(()=>{t.current=e}),r.useCallback(function(){for(var e=arguments.length,n=Array(e),r=0;r"floating-ui-"+Math.random().toString(36).slice(2,6)+p++,g=u.useId||function(){let[e,t]=r.useState(()=>h?m():void 0);return f(()=>{null==e&&t(m())},[]),r.useEffect(()=>{h=!0},[]),e},v=r.createContext(null),y=r.createContext(null),b=()=>{var e;return(null==(e=r.useContext(v))?void 0:e.id)||null},w=()=>r.useContext(y);function x(e){return"data-floating-ui-"+e}function k(e){let t=(0,r.useRef)(e);return f(()=>{t.current=e}),t}function E(e,t){let n=e.filter(e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}),r=n;for(;r.length;)r=e.filter(e=>{var t;return null==(t=r)?void 0:t.some(t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)})}),n=n.concat(r);return n}let C=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function R(e,t){let n=(0,s.ht)(e,C());"prev"===t&&n.reverse();let r=n.indexOf((0,i.AW)((0,i.Me)(e)));return n.slice(r+1)[0]}function S(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!(0,i.r3)(n,r)}function M(e){e.querySelectorAll("[data-tabindex]").forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}let D={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},I=r.forwardRef(function(e,t){let[n,o]=r.useState();f(()=>{(0,i.G6)()&&o("button")},[]);let s={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[x("focus-guard")]:"",style:D};return(0,l.tZ)("span",{...e,...s})}),T=r.createContext(null),N=x("portal");function O(e){let{children:t,id:n,root:i,preserveTabOrder:a=!0}=e,u=function(e){void 0===e&&(e={});let{id:t,root:n}=e,i=g(),l=A(),[s,a]=r.useState(null),u=r.useRef(null);return f(()=>()=>{null==s||s.remove(),queueMicrotask(()=>{u.current=null})},[s]),f(()=>{if(!i||u.current)return;let e=t?document.getElementById(t):null;if(!e)return;let n=document.createElement("div");n.id=i,n.setAttribute(N,""),e.appendChild(n),u.current=n,a(n)},[t,i]),f(()=>{if(null===n||!i||u.current)return;let e=n||(null==l?void 0:l.portalNode);e&&!(0,o.kK)(e)&&(e=e.current),e=e||document.body;let r=null;t&&((r=document.createElement("div")).id=t,e.appendChild(r));let s=document.createElement("div");s.id=i,s.setAttribute(N,""),(e=r||e).appendChild(s),u.current=s,a(s)},[t,n,i,l]),s}({id:n,root:i}),[c,d]=r.useState(null),h=r.useRef(null),p=r.useRef(null),m=r.useRef(null),v=r.useRef(null),y=null==c?void 0:c.modal,b=null==c?void 0:c.open,w=!!c&&!c.modal&&c.open&&a&&!!(i||u);return r.useEffect(()=>{if(u&&a&&!y)return u.addEventListener("focusin",e,!0),u.addEventListener("focusout",e,!0),()=>{u.removeEventListener("focusin",e,!0),u.removeEventListener("focusout",e,!0)};function e(e){u&&S(e)&&("focusin"===e.type?M:function(e){(0,s.ht)(e,C()).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})})(u)}},[u,a,y]),r.useEffect(()=>{u&&(b||M(u))},[b,u]),(0,l.BX)(T.Provider,{value:r.useMemo(()=>({preserveTabOrder:a,beforeOutsideRef:h,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:v,portalNode:u,setFocusManagerState:d}),[a,u]),children:[w&&u&&(0,l.tZ)(I,{"data-type":"outside",ref:h,onFocus:e=>{if(S(e,u)){var t;null==(t=m.current)||t.focus()}else{let e=R(document.body,"prev")||(null==c?void 0:c.domReference);null==e||e.focus()}}}),w&&u&&(0,l.tZ)("span",{"aria-owns":u.id,style:D}),u&&r.createPortal(t,u),w&&u&&(0,l.tZ)(I,{"data-type":"outside",ref:p,onFocus:e=>{if(S(e,u)){var t;null==(t=v.current)||t.focus()}else{let t=R(document.body,"next")||(null==c?void 0:c.domReference);null==t||t.focus(),(null==c?void 0:c.closeOnFocusOut)&&(null==c||c.onOpenChange(!1,e.nativeEvent,"focus-out"))}}})]})}let A=()=>r.useContext(T),L={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},F={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},z=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};function J(e,t){void 0===t&&(t={});let{open:n,onOpenChange:l,elements:s,dataRef:a}=e,{enabled:u=!0,escapeKey:c=!0,outsidePress:f=!0,outsidePressEvent:h="pointerdown",referencePress:p=!1,referencePressEvent:m="pointerdown",ancestorScroll:g=!1,bubbles:v,capture:y}=t,b=w(),k=d("function"==typeof f?f:()=>!1),C="function"==typeof f?k:f,R=r.useRef(!1),S=r.useRef(!1),{escapeKey:M,outsidePress:D}=z(v),{escapeKey:I,outsidePress:T}=z(y),N=r.useRef(!1),O=d(e=>{var t;if(!n||!u||!c||"Escape"!==e.key||N.current)return;let r=null==(t=a.current.floatingContext)?void 0:t.nodeId,o=b?E(b.nodesRef.current,r):[];if(!M&&(e.stopPropagation(),o.length>0)){let e=!0;if(o.forEach(t=>{var n;if(null!=(n=t.context)&&n.open&&!t.context.dataRef.current.__escapeKeyBubbles){e=!1;return}}),!e)return}l(!1,(0,i.MM)(e)?e.nativeEvent:e,"escape-key")}),A=d(e=>{var t;let n=()=>{var t;O(e),null==(t=(0,i.U9)(e))||t.removeEventListener("keydown",n)};null==(t=(0,i.U9)(e))||t.addEventListener("keydown",n)}),J=d(e=>{var t;let n=R.current;R.current=!1;let r=S.current;if(S.current=!1,"click"===h&&r||n||"function"==typeof C&&!C(e))return;let u=(0,i.U9)(e),c="["+x("inert")+"]",d=(0,i.Me)(s.floating).querySelectorAll(c),f=(0,o.kK)(u)?u:null;for(;f&&!(0,o.Py)(f);){let e=(0,o.Ow)(f);if((0,o.Py)(e)||!(0,o.kK)(e))break;f=e}if(d.length&&(0,o.kK)(u)&&!(0,i.ex)(u)&&!(0,i.r3)(u,s.floating)&&Array.from(d).every(e=>!(0,i.r3)(f,e)))return;if((0,o.Re)(u)&&P){let t=(0,o.Py)(u),n=(0,o.Dx)(u),r=/auto|scroll/,i=t||r.test(n.overflowX),l=t||r.test(n.overflowY),s=i&&u.clientWidth>0&&u.scrollWidth>u.clientWidth,a=l&&u.clientHeight>0&&u.scrollHeight>u.clientHeight,c="rtl"===n.direction,d=a&&(c?e.offsetX<=u.offsetWidth-u.clientWidth:e.offsetX>u.clientWidth),f=s&&e.offsetY>u.clientHeight;if(d||f)return}let p=null==(t=a.current.floatingContext)?void 0:t.nodeId,m=b&&E(b.nodesRef.current,p).some(t=>{var n;return(0,i.Pe)(e,null==(n=t.context)?void 0:n.elements.floating)});if((0,i.Pe)(e,s.floating)||(0,i.Pe)(e,s.domReference)||m)return;let g=b?E(b.nodesRef.current,p):[];if(g.length>0){let e=!0;if(g.forEach(t=>{var n;if(null!=(n=t.context)&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}l(!1,e,"outside-press")}),B=d(e=>{var t;let n=()=>{var t;J(e),null==(t=(0,i.U9)(e))||t.removeEventListener(h,n)};null==(t=(0,i.U9)(e))||t.addEventListener(h,n)});r.useEffect(()=>{if(!n||!u)return;a.current.__escapeKeyBubbles=M,a.current.__outsidePressBubbles=D;let e=-1;function t(e){l(!1,e,"ancestor-scroll")}function r(){window.clearTimeout(e),N.current=!0}function d(){e=window.setTimeout(()=>{N.current=!1},5*!!(0,o.Pf)())}let f=(0,i.Me)(s.floating);c&&(f.addEventListener("keydown",I?A:O,I),f.addEventListener("compositionstart",r),f.addEventListener("compositionend",d)),C&&f.addEventListener(h,T?B:J,T);let p=[];return g&&((0,o.kK)(s.domReference)&&(p=(0,o.Kx)(s.domReference)),(0,o.kK)(s.floating)&&(p=p.concat((0,o.Kx)(s.floating))),!(0,o.kK)(s.reference)&&s.reference&&s.reference.contextElement&&(p=p.concat((0,o.Kx)(s.reference.contextElement)))),(p=p.filter(e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)})).forEach(e=>{e.addEventListener("scroll",t,{passive:!0})}),()=>{c&&(f.removeEventListener("keydown",I?A:O,I),f.removeEventListener("compositionstart",r),f.removeEventListener("compositionend",d)),C&&f.removeEventListener(h,T?B:J,T),p.forEach(e=>{e.removeEventListener("scroll",t)}),window.clearTimeout(e)}},[a,s,c,C,h,n,l,g,u,M,D,O,I,A,J,T,B]),r.useEffect(()=>{R.current=!1},[C,h]);let j=r.useMemo(()=>({onKeyDown:O,...p&&{[L[m]]:e=>{l(!1,e.nativeEvent,"reference-press")},..."click"!==m&&{onClick(e){l(!1,e.nativeEvent,"reference-press")}}}}),[O,l,p,m]),P=r.useMemo(()=>({onKeyDown:O,onMouseDown(){S.current=!0},onMouseUp(){S.current=!0},[F[h]]:()=>{R.current=!0}}),[O,h]);return r.useMemo(()=>u?{reference:j,floating:P}:{},[u,j,P])}function B(e){void 0===e&&(e={});let{nodeId:t}=e,n=function(e){let{open:t=!1,onOpenChange:n,elements:i}=e,l=g(),o=r.useRef({}),[s]=r.useState(()=>(function(){let e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter(e=>e!==n))||[])}}})()),a=null!=b(),[u,c]=r.useState(i.reference),f=d((e,t,r)=>{o.current.openEvent=e?t:void 0,s.emit("openchange",{open:e,event:t,reason:r,nested:a}),null==n||n(e,t,r)}),h=r.useMemo(()=>({setPositionReference:c}),[]),p=r.useMemo(()=>({reference:u||i.reference||null,floating:i.floating||null,domReference:i.reference}),[u,i.reference,i.floating]);return r.useMemo(()=>({dataRef:o,open:t,onOpenChange:f,elements:p,events:s,floatingId:l,refs:h}),[t,f,p,s,l,h])}({...e,elements:{reference:null,floating:null,...e.elements}}),i=e.rootContext||n,l=i.elements,[s,u]=r.useState(null),[c,h]=r.useState(null),p=(null==l?void 0:l.domReference)||s,m=r.useRef(null),v=w();f(()=>{p&&(m.current=p)},[p]);let y=(0,a.YF)({...e,elements:{...l,...c&&{reference:c}}}),x=r.useCallback(e=>{let t=(0,o.kK)(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;h(t),y.refs.setReference(t)},[y.refs]),k=r.useCallback(e=>{((0,o.kK)(e)||null===e)&&(m.current=e,u(e)),((0,o.kK)(y.refs.reference.current)||null===y.refs.reference.current||null!==e&&!(0,o.kK)(e))&&y.refs.setReference(e)},[y.refs]),E=r.useMemo(()=>({...y.refs,setReference:k,setPositionReference:x,domReference:m}),[y.refs,k,x]),C=r.useMemo(()=>({...y.elements,domReference:p}),[y.elements,p]),R=r.useMemo(()=>({...y,...i,refs:E,elements:C,nodeId:t}),[y,E,C,t,i]);return f(()=>{i.dataRef.current.floatingContext=R;let e=null==v?void 0:v.nodesRef.current.find(e=>e.id===t);e&&(e.context=R)}),r.useMemo(()=>({...y,context:R,refs:E,elements:C}),[y,E,C,R])}let j="active",P="selected";function H(e,t,n){let r=new Map,i="item"===n,l=e;if(i&&e){let{[j]:t,[P]:n,...r}=e;l=r}return{..."floating"===n&&{tabIndex:-1,"data-floating-ui-focusable":""},...l,...t.map(t=>{let r=t?t[n]:null;return"function"==typeof r?e?r(e):null:r}).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,l]=t;if(!(i&&[j,P].includes(n))){if(0===n.indexOf("on")){if(r.has(n)||r.set(n,[]),"function"==typeof l){var o;null==(o=r.get(n))||o.push(l),e[n]=function(){for(var e,t=arguments.length,i=Array(t),l=0;le(...i)).find(e=>void 0!==e)}}}else e[n]=l}}),e),{})}}function Y(e){void 0===e&&(e=[]);let t=e.map(e=>null==e?void 0:e.reference),n=e.map(e=>null==e?void 0:e.floating),i=e.map(e=>null==e?void 0:e.item),l=r.useCallback(t=>H(t,e,"reference"),t),o=r.useCallback(t=>H(t,e,"floating"),n),s=r.useCallback(t=>H(t,e,"item"),i);return r.useMemo(()=>({getReferenceProps:l,getFloatingProps:o,getItemProps:s}),[l,o,s])}let W=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase());function K(e,t){return"function"==typeof e?e(t):e}function U(e,t){void 0===t&&(t={});let{initial:n={opacity:0},open:i,close:l,common:o,duration:s=250}=t,a=e.placement,u=a.split("-")[0],c=r.useMemo(()=>({side:u,placement:a}),[u,a]),d="number"==typeof s,h=(d?s:s.open)||0,p=(d?s:s.close)||0,[m,g]=r.useState(()=>({...K(o,c),...K(n,c)})),{isMounted:v,status:y}=function(e,t){void 0===t&&(t={});let{open:n,elements:{floating:i}}=e,{duration:l=250}=t,o=("number"==typeof l?l:l.close)||0,[s,a]=r.useState("unmounted"),u=function(e,t){let[n,i]=r.useState(e);return e&&!n&&i(!0),r.useEffect(()=>{if(!e&&n){let e=setTimeout(()=>i(!1),t);return()=>clearTimeout(e)}},[e,n,t]),n}(n,o);return u||"close"!==s||a("unmounted"),f(()=>{if(i){if(n){a("initial");let e=requestAnimationFrame(()=>{a("open")});return()=>{cancelAnimationFrame(e)}}a("close")}},[n,i]),{isMounted:u,status:s}}(e,{duration:s}),b=k(n),w=k(i),x=k(l),E=k(o);return f(()=>{let e=K(b.current,c),t=K(x.current,c),n=K(E.current,c),r=K(w.current,c)||Object.keys(e).reduce((e,t)=>(e[t]="",e),{});if("initial"===y&&g(t=>({transitionProperty:t.transitionProperty,...n,...e})),"open"===y&&g({transitionProperty:Object.keys(r).map(W).join(","),transitionDuration:h+"ms",...n,...r}),"close"===y){let r=t||e;g({transitionProperty:Object.keys(r).map(W).join(","),transitionDuration:p+"ms",...n,...r})}},[p,x,b,w,E,h,y,c]),{isMounted:v,styles:m}}},17268:function(e,t,n){"use strict";n.d(t,{AW:()=>i,G6:()=>o,MM:()=>s,Me:()=>u,Pe:()=>c,U9:()=>d,ex:()=>a,r3:()=>l});var r=n(31720);function i(e){let t=e.activeElement;for(;(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function l(e,t){if(!e||!t)return!1;let n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&(0,r.Zq)(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function o(){return/apple/i.test(navigator.vendor)}function s(e){return"nativeEvent"in e}function a(e){return e.matches("html,body")}function u(e){return(null==e?void 0:e.ownerDocument)||document}function c(e,t){return null!=t&&("composedPath"in e?e.composedPath().includes(t):null!=e.target&&t.contains(e.target))}function d(e){return"composedPath"in e?e.composedPath()[0]:e.target}},83311:function(e,t,n){"use strict";n.d(t,{Ax:()=>k,FC:()=>g,GJ:()=>R,Mn:()=>E,Pu:()=>m,dR:()=>M,k9:()=>b,nd:()=>w,nj:()=>S,vs:()=>o,wx:()=>B});var r=n(76405);class i{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class l{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&l.empty)return l.empty}recover(e){let t=0,n=65535&e;if(!this.inverted)for(let e=0;ee)break;let u=this.ranges[s+l],c=this.ranges[s+o],d=a+u;if(e<=d){let l=u?e==a?-1:e==d?1:t:t,o=a+r+(l<0?0:c);if(n)return o;let f=e==(t<0?a:d)?null:s/3+(e-a)*65536,h=e==a?2:e==d?1:4;return(t<0?e!=a:e!=d)&&(h|=8),new i(o,h,f)}r+=c-u}return n?e+r:new i(e+r,0,null)}touches(e,t){let n=0,r=65535&t,i=this.inverted?2:1,l=this.inverted?1:2;for(let t=0;te)break;let s=this.ranges[t+i];if(e<=o+s&&t==3*r)return!0;n+=this.ranges[t+l]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r=0;t--){let r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new o;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;nn&&te.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,i),t.openStart,t.openEnd);return u.fromReplace(e,this.from,this.to,l)}invert(){return new f(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new d(t.pos,n.pos,this.mark)}merge(e){return e instanceof d&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new d(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new d(t.from,t.to,e.markFromJSON(t.mark))}}a.jsonID("addMark",d);class f extends a{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new r.p2(c(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return u.fromReplace(e,this.from,this.to,n)}invert(){return new d(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new f(t.pos,n.pos,this.mark)}merge(e){return e instanceof f&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new f(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new f(t.from,t.to,e.markFromJSON(t.mark))}}a.jsonID("removeMark",f);class h extends a{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return u.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return u.fromReplace(e,this.pos,this.pos+1,new r.p2(r.HY.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;nn.pos?null:new g(t.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new g(t.from,t.to,t.gapFrom,t.gapTo,r.p2.fromJSON(e,t.slice),t.insert,!!t.structure)}}function v(e,t,n){let r=e.resolve(t),i=n-t,l=r.depth;for(;i>0&&l>0&&r.indexAfter(l)==r.node(l).childCount;)l--,i--;if(i>0){let e=r.node(l).maybeChild(r.indexAfter(l));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function y(e,t,n,i=n.contentMatch,l=!0){let o=e.doc.nodeAt(t),s=[],a=t+1;for(let t=0;t=0;t--)e.step(s[t])}function b(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth;;--n){let r=e.$from.node(n),i=e.$from.index(n),l=e.$to.indexAfter(n);if(nl;e--,t--){let n=i.node(e),l=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(l,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let a=r&&r[t]||n;if(!n.canReplace(l+1,n.childCount)||!a.type.validContent(o))return!1}let s=i.indexAfter(l),a=r&&r[0];return i.node(l).canReplaceWith(s,s,a?a.type:i.node(l+1).type)}function E(e,t){let n=e.resolve(t),r=n.index();return C(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function C(e,t){return!!(e&&t&&!e.isLeaf&&e.canAppend(t))}function R(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,l,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,l=r.nodeAfter):n>0?(i=r.node(e+1),o++,l=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),l=r.node(e+1)),i&&!i.isTextblock&&C(i,l)&&r.node(e).canReplace(o,o+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function S(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,l=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(1==e)s=o.canReplace(l,l,i);else{let e=o.contentMatchAt(l).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(l,l,e[0])}if(s)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function M(e,t,n=t,i=r.p2.empty){if(t==n&&!i.size)return null;let l=e.resolve(t),o=e.resolve(n);return D(l,o,i)?new m(t,n,i):new I(l,o,i).fit()}function D(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}a.jsonID("replaceAround",g);class I{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=r.HY.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=r.HY.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(e<0?this.$to:n.doc.resolve(e));if(!i)return null;let l=this.placed,o=n.depth,s=i.depth;for(;o&&s&&1==l.childCount;)l=l.firstChild.content,o--,s--;let a=new r.p2(l,o,s);return e>-1?new g(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new m(n.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,i=null,l=(n?(i=O(this.unplaced.content,n-1).firstChild).content:this.unplaced.content).firstChild;for(let e=this.depth;e>=0;e--){let{type:o,match:s}=this.frontier[e],a,u=null;if(1==t&&(l?s.matchType(l.type)||(u=s.fillBefore(r.HY.from(l),!1)):i&&o.compatibleContent(i.type)))return{sliceDepth:n,frontierDepth:e,parent:i,inject:u};if(2==t&&l&&(a=s.findWrapping(l.type)))return{sliceDepth:n,frontierDepth:e,parent:i,wrap:a};if(i&&s.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=O(e,t);return!!i.childCount&&!i.firstChild.isLeaf&&(this.unplaced=new r.p2(e,t+1,Math.max(n,i.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=O(e,t);if(i.childCount<=1&&t>0){let l=e.size-t<=t+i.size;this.unplaced=new r.p2(T(e,t-1,1),t-1,l?t-1:n)}else this.unplaced=new r.p2(T(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:i,wrap:l}){for(;this.depth>t;)this.closeFrontierNode();if(l)for(let e=0;e1||0==a||e.content.size)&&(d=t,c.push(function e(t,n,i){if(n<=0)return t;let l=t.content;return n>1&&(l=l.replaceChild(0,e(l.firstChild,n-1,1==l.childCount?i-1:0))),n>0&&(l=t.type.contentMatch.fillBefore(l).append(l),i<=0&&(l=l.append(t.type.contentMatch.matchFragment(l).fillBefore(r.HY.empty,!0)))),t.copy(l)}(e.mark(f.allowedMarks(e.marks)),1==u?a:0,u==s.childCount?h:-1)))}let p=u==s.childCount;p||(h=-1),this.placed=N(this.placed,t,r.HY.from(c)),this.frontier[t].match=d,p&&h<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t=0;n--){let{match:t,type:r}=this.frontier[n],i=A(e,n,r,t,!0);if(!i||i.childCount)continue e}return{depth:t,fit:l,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=N(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=N(this.placed,this.depth,r.HY.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(r.HY.empty,!0);e.childCount&&(this.placed=N(this.placed,this.frontier.length,e))}}function T(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(T(e.firstChild.content,t-1,n)))}function N(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(N(e.lastChild.content,t-1,n)))}function O(e,t){for(let n=0;n=0;i--){let r=e.start(i);if(rt.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}class F extends a{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return u.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return u.fromReplace(e,this.pos,this.pos+1,new r.p2(r.HY.from(i),0,+!t.isLeaf))}getMap(){return l.empty}invert(e){return new F(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new F(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new F(t.pos,t.attr,t.value)}}a.jsonID("attr",F);class z extends a{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return u.ok(n)}getMap(){return l.empty}invert(e){return new z(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new z(t.attr,t.value)}}a.jsonID("docAttr",z);let J=class extends Error{};(J=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),J.prototype.constructor=J,J.prototype.name="TransformError";class B{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new o}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new J(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=r.p2.empty){let i=M(this.doc,e,t,n);return i&&this.step(i),this}replaceWith(e,t,n){return this.replace(e,t,new r.p2(r.HY.from(n),0,0))}delete(e,t){return this.replace(e,t,r.p2.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return!function(e,t,n,i){if(!i.size)return e.deleteRange(t,n);let l=e.doc.resolve(t),o=e.doc.resolve(n);if(D(l,o,i))return e.step(new m(t,n,i));let s=L(l,e.doc.resolve(n));0==s[s.length-1]&&s.pop();let a=-(l.depth+1);s.unshift(a);for(let e=l.depth,t=l.pos-1;e>0;e--,t--){let n=l.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(e)>-1?a=e:l.before(e)==t&&s.splice(1,0,-e)}let u=s.indexOf(a),c=[],d=i.openStart;for(let e=i.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==i.openStart)break;e=n.content}for(let e=d-1;e>=0;e--){var f;let t=c[e],n=(f=t.type).spec.defining||f.spec.definingForContent;if(n&&!t.sameMarkup(l.node(Math.abs(a)-1)))d=e;else if(n||!t.type.isTextblock)break}for(let t=i.openStart;t>=0;t--){let a=(t+d+1)%(i.openStart+1),f=c[a];if(f)for(let t=0;tl){let e=o.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(r.HY.empty,!0))}return t}(i.content,0,i.openStart,a),a,i.openEnd))}}let h=e.steps.length;for(let r=s.length-1;r>=0&&(e.replace(t,n,i),!(e.steps.length>h));r--){let e=s[r];e<0||(t=l.before(e),n=o.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return!function(e,t,n,i){if(!i.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let r=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let l=1;l<=r.depth&&l<=i.depth;l++)if(t-r.start(l)==r.depth-l&&n>r.end(l)&&i.end(l)-n!=i.depth-l)return e.delete(r.before(l),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return!function(e,t,n){let{$from:i,$to:l,depth:o}=t,s=i.before(o+1),a=l.after(o+1),u=s,c=a,d=r.HY.empty,f=0;for(let e=o,t=!1;e>n;e--)t||i.index(e)>0?(t=!0,d=r.HY.from(i.node(e).copy(d)),f++):u--;let h=r.HY.empty,p=0;for(let e=o,t=!1;e>n;e--)t||l.after(e+1)=0;e--){if(i.size){let t=n[e].type.contentMatch.matchFragment(i);if(!t||!t.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=r.HY.from(n[e].type.create(n[e].attrs,i))}let l=t.start,o=t.end;e.step(new g(l,o,l,o,new r.p2(i,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,i=null){return!function(e,t,n,i,l){if(!i.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let o=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{var s,a,u;let c,d;if(t.isTextblock&&!t.hasMarkup(i,l)&&(s=e.doc,a=e.mapping.slice(o).map(n),u=i,d=(c=s.resolve(a)).index(),c.parent.canReplaceWith(d,d+1,u))){let s=null;if(i.schema.linebreakReplacement){let e="pre"==i.whitespace,t=!!i.contentMatch.matchType(i.schema.linebreakReplacement);e&&!t?s=!1:!e&&t&&(s=!0)}!1===s&&function(e,t,n,r){t.forEach((i,l)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+l);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}(e,t,n,o),y(e,e.mapping.slice(o).map(n,1),i,void 0,null===s);let a=e.mapping.slice(o),u=a.map(n,1),c=a.map(n+t.nodeSize,1);return e.step(new g(u,c,u+1,c-1,new r.p2(r.HY.from(i.create(l,null,t.marks)),0,0),1,!0)),!0===s&&function(e,t,n,r){t.forEach((i,l)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+l+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}(e,t,n,o),!1}})}(this,e,t,n,i),this}setNodeMarkup(e,t,n=null,i){return!function(e,t,n,i,l){let o=e.doc.nodeAt(t);if(!o)throw RangeError("No node at given position");n||(n=o.type);let s=n.create(i,null,l||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,s);if(!n.validContent(o.content))throw RangeError("Invalid content for node type "+n.name);e.step(new g(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new r.p2(r.HY.from(s),0,0),1,!0))}(this,e,t,n,i),this}setNodeAttribute(e,t,n){return this.step(new F(e,t,n)),this}setDocAttribute(e,t){return this.step(new z(e,t)),this}addNodeMark(e,t){return this.step(new h(e,t)),this}removeNodeMark(e,t){if(!(t instanceof r.vc)){let n=this.doc.nodeAt(e);if(!n)throw RangeError("No node at position "+e);if(!(t=t.isInSet(n.marks)))return this}return this.step(new p(e,t)),this}split(e,t=1,n){return!function(e,t,n=1,i){let l=e.doc.resolve(t),o=r.HY.empty,s=r.HY.empty;for(let e=l.depth,t=l.depth-n,a=n-1;e>t;e--,a--){o=r.HY.from(l.node(e).copy(o));let t=i&&i[a];s=r.HY.from(t?t.type.create(t.attrs,s):l.node(e).copy(s))}e.step(new m(t,t,new r.p2(o.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){var r;let i,l,o,s;return r=this,o=[],s=[],r.doc.nodesBetween(e,t,(r,a,u)=>{if(!r.isInline)return;let c=r.marks;if(!n.isInSet(c)&&u.type.allowsMarkType(n.type)){let u=Math.max(a,e),h=Math.min(a+r.nodeSize,t),p=n.addToSet(c);for(let e=0;er.step(e)),s.forEach(e=>r.step(e)),this}removeMark(e,t,n){var i;let l,o;return i=this,l=[],o=0,i.doc.nodesBetween(e,t,(i,s)=>{if(!i.isInline)return;o++;let a=null;if(n instanceof r.ZU){let e=i.marks,t;for(;t=n.isInSet(e);)(a||(a=[])).push(t),e=t.removeFromSet(e)}else n?n.isInSet(i.marks)&&(a=[n]):a=i.marks;if(a&&a.length){let n=Math.min(s+i.nodeSize,t);for(let t=0;ti.step(new f(e.from,e.to,e.style))),this}clearIncompatible(e,t,n){return y(this,e,t,n),this}}}}]);