app-v3-scripts-editor 1.5.2 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -385,7 +385,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
385
385
|
To pick up a draggable item, press the space bar.
|
|
386
386
|
While dragging, use the arrow keys to move the item.
|
|
387
387
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
388
|
-
`},hue={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 pue(e){let{announcements:t=hue,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=fue}=e;const{announce:i,announcement:a}=cue(),s=Vf("DndLiveRegion"),[l,c]=T.useState(!1);if(T.useEffect(()=>{c(!0)},[]),uue(T.useMemo(()=>({onDragStart(d){let{active:h}=d;i(t.onDragStart({active:h}))},onDragMove(d){let{active:h,over:p}=d;t.onDragMove&&i(t.onDragMove({active:h,over:p}))},onDragOver(d){let{active:h,over:p}=d;i(t.onDragOver({active:h,over:p}))},onDragEnd(d){let{active:h,over:p}=d;i(t.onDragEnd({active:h,over:p}))},onDragCancel(d){let{active:h,over:p}=d;i(t.onDragCancel({active:h,over:p}))}}),[i,t])),!l)return null;const u=T.createElement(T.Fragment,null,T.createElement(sue,{id:r,value:o.draggable}),T.createElement(lue,{id:s,announcement:a}));return n?ur.createPortal(u,n):u}var wr;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(wr||(wr={}));function Wg(){}function i3(e,t){return T.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function mue(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return T.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const Fi=Object.freeze({x:0,y:0});function a3(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function s3(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function gue(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function l3(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function c3(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function u3(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const vue=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=u3(t,t.left,t.top),i=[];for(const a of r){const{id:s}=a,l=n.get(s);if(l){const c=a3(u3(l),o);i.push({id:s,data:{droppableContainer:a,value:c}})}}return i.sort(s3)},yue=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=l3(t),i=[];for(const a of r){const{id:s}=a,l=n.get(s);if(l){const c=l3(l),u=o.reduce((h,p,y)=>h+a3(c[y],p),0),d=Number((u/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(s3)};function bue(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,s=i-n;if(r<o&&n<i){const l=t.width*t.height,c=e.width*e.height,u=a*s,d=u/(l+c-u);return Number(d.toFixed(4))}return 0}const wue=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:a}=i,s=n.get(a);if(s){const l=bue(s,t);l>0&&o.push({id:a,data:{droppableContainer:i,value:l}})}}return o.sort(gue)};function Cue(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function d3(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Fi}function xue(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((a,s)=>({...a,top:a.top+e*s.y,bottom:a.bottom+e*s.y,left:a.left+e*s.x,right:a.right+e*s.x}),{...n})}}const Sue=xue(1);function Eue(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function $ue(e,t,n){const r=Eue(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:s}=r,l=e.left-a-(1-o)*parseFloat(n),c=e.top-s-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}const _ue={ignoreTransform:!1};function uu(e,t){t===void 0&&(t=_ue);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=wo(e).getComputedStyle(e);c&&(n=$ue(n,c,u))}const{top:r,left:o,width:i,height:a,bottom:s,right:l}=n;return{top:r,left:o,width:i,height:a,bottom:s,right:l}}function f3(e){return uu(e,{ignoreTransform:!0})}function Oue(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Nue(e,t){return t===void 0&&(t=wo(e).getComputedStyle(e)),t.position==="fixed"}function Tue(e,t){t===void 0&&(t=wo(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function Ug(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(dC(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!kf(o)||t3(o)||n.includes(o))return n;const i=wo(e).getComputedStyle(o);return o!==e&&Tue(o,i)&&n.push(o),Nue(o,i)?n:r(o.parentNode)}return e?r(e):n}function h3(e){const[t]=Ug(e,1);return t??null}function vC(e){return!zg||!e?null:su(e)?e:uC(e)?dC(e)||e===lu(e).scrollingElement?window:kf(e)?e:null:null}function p3(e){return su(e)?e.scrollX:e.scrollLeft}function m3(e){return su(e)?e.scrollY:e.scrollTop}function yC(e){return{x:p3(e),y:m3(e)}}var Pr;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Pr||(Pr={}));function g3(e){return!zg||!e?!1:e===document.scrollingElement}function v3(e){const t={x:0,y:0},n=g3(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,s=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:a,isRight:s,maxScroll:r,minScroll:t}}const Iue={x:.2,y:.2};function Pue(e,t,n,r,o){let{top:i,left:a,right:s,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=Iue);const{isTop:c,isBottom:u,isLeft:d,isRight:h}=v3(e),p={x:0,y:0},y={x:0,y:0},b={height:t.height*o.y,width:t.width*o.x};return!c&&i<=t.top+b.height?(p.y=Pr.Backward,y.y=r*Math.abs((t.top+b.height-i)/b.height)):!u&&l>=t.bottom-b.height&&(p.y=Pr.Forward,y.y=r*Math.abs((t.bottom-b.height-l)/b.height)),!h&&s>=t.right-b.width?(p.x=Pr.Forward,y.x=r*Math.abs((t.right-b.width-s)/b.width)):!d&&a<=t.left+b.width&&(p.x=Pr.Backward,y.x=r*Math.abs((t.left+b.width-a)/b.width)),{direction:p,speed:y}}function Mue(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function y3(e){return e.reduce((t,n)=>cu(t,yC(n)),Fi)}function Aue(e){return e.reduce((t,n)=>t+p3(n),0)}function Due(e){return e.reduce((t,n)=>t+m3(n),0)}function Lue(e,t){if(t===void 0&&(t=uu),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);h3(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Rue=[["x",["left","right"],Aue],["y",["top","bottom"],Due]];class bC{constructor(t,n){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;const r=Ug(n),o=y3(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,s]of Rue)for(const l of a)Object.defineProperty(this,l,{get:()=>{const c=s(r),u=o[i]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class jf{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function kue(e){const{EventTarget:t}=wo(e);return e instanceof t?e:lu(e)}function wC(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?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:!1}var oi;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(oi||(oi={}));function b3(e){e.preventDefault()}function Fue(e){e.stopPropagation()}var Xt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Xt||(Xt={}));const w3={start:[Xt.Space,Xt.Enter],cancel:[Xt.Esc],end:[Xt.Space,Xt.Enter,Xt.Tab]},Bue=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Xt.Right:return{...n,x:n.x+25};case Xt.Left:return{...n,x:n.x-25};case Xt.Down:return{...n,y:n.y+25};case Xt.Up:return{...n,y:n.y-25}}};class CC{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new jf(lu(n)),this.windowListeners=new jf(wo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(oi.Resize,this.handleCancel),this.windowListeners.add(oi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(oi.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Lue(r),n(Fi)}handleKeyDown(t){if(mC(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=w3,coordinateGetter:a=Bue,scrollBehavior:s="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:Fi;this.referenceCoordinates||(this.referenceCoordinates=u);const d=a(t,{active:n,context:r.current,currentCoordinates:u});if(d){const h=zf(d,u),p={x:0,y:0},{scrollableAncestors:y}=r.current;for(const b of y){const v=t.code,{isTop:w,isRight:x,isLeft:C,isBottom:S,maxScroll:E,minScroll:$}=v3(b),O=Mue(b),N={x:Math.min(v===Xt.Right?O.right-O.width/2:O.right,Math.max(v===Xt.Right?O.left:O.left+O.width/2,d.x)),y:Math.min(v===Xt.Down?O.bottom-O.height/2:O.bottom,Math.max(v===Xt.Down?O.top:O.top+O.height/2,d.y))},I=v===Xt.Right&&!x||v===Xt.Left&&!C,M=v===Xt.Down&&!S||v===Xt.Up&&!w;if(I&&N.x!==d.x){const A=b.scrollLeft+h.x,z=v===Xt.Right&&A<=E.x||v===Xt.Left&&A>=$.x;if(z&&!h.y){b.scrollTo({left:A,behavior:s});return}z?p.x=b.scrollLeft-A:p.x=v===Xt.Right?b.scrollLeft-E.x:b.scrollLeft-$.x,p.x&&b.scrollBy({left:-p.x,behavior:s});break}else if(M&&N.y!==d.y){const A=b.scrollTop+h.y,z=v===Xt.Down&&A<=E.y||v===Xt.Up&&A>=$.y;if(z&&!h.x){b.scrollTo({top:A,behavior:s});return}z?p.y=b.scrollTop-A:p.y=v===Xt.Down?b.scrollTop-E.y:b.scrollTop-$.y,p.y&&b.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(t,cu(zf(d,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}CC.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=w3,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const s=i.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function C3(e){return!!(e&&"distance"in e)}function x3(e){return!!(e&&"delay"in e)}class xC{constructor(t,n,r){var o;r===void 0&&(r=kue(t.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=t,this.events=n;const{event:i}=t,{target:a}=i;this.props=t,this.events=n,this.document=lu(a),this.documentListeners=new jf(this.document),this.listeners=new jf(r),this.windowListeners=new jf(wo(a)),this.initialCoordinates=(o=gC(i))!=null?o:Fi,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(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(oi.Resize,this.handleCancel),this.windowListeners.add(oi.DragStart,b3),this.windowListeners.add(oi.VisibilityChange,this.handleCancel),this.windowListeners.add(oi.ContextMenu,b3),this.documentListeners.add(oi.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(x3(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(C3(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(oi.Click,Fue,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(oi.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:s}}=i;if(!o)return;const l=(n=gC(t))!=null?n:Fi,c=zf(o,l);if(!r&&s){if(C3(s)){if(s.tolerance!=null&&wC(c,s.tolerance))return this.handleCancel();if(wC(c,s.distance))return this.handleStart()}if(x3(s)&&wC(c,s.tolerance))return this.handleCancel();this.handlePending(s,c);return}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Xt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Vue={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class SC extends xC{constructor(t){const{event:n}=t,r=lu(n.target);super(t,Vue,r)}}SC.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const zue={move:{name:"mousemove"},end:{name:"mouseup"}};var EC;(function(e){e[e.RightClick=2]="RightClick"})(EC||(EC={}));class jue extends xC{constructor(t){super(t,zue,lu(t.event.target))}}jue.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===EC.RightClick?!1:(r==null||r({event:n}),!0)}}];const $C={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Hue extends xC{constructor(t){super(t,$C)}static setup(){return window.addEventListener($C.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener($C.move.name,t)};function t(){}}}Hue.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var Hf;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Hf||(Hf={}));var qg;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(qg||(qg={}));function Wue(e){let{acceleration:t,activator:n=Hf.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:s=qg.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:h}=e;const p=que({delta:d,disabled:!i}),[y,b]=nue(),v=T.useRef({x:0,y:0}),w=T.useRef({x:0,y:0}),x=T.useMemo(()=>{switch(n){case Hf.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Hf.DraggableRect:return o}},[n,o,l]),C=T.useRef(null),S=T.useCallback(()=>{const $=C.current;if(!$)return;const O=v.current.x*w.current.x,N=v.current.y*w.current.y;$.scrollBy(O,N)},[]),E=T.useMemo(()=>s===qg.TreeOrder?[...c].reverse():c,[s,c]);T.useEffect(()=>{if(!i||!c.length||!x){b();return}for(const $ of E){if((r==null?void 0:r($))===!1)continue;const O=c.indexOf($),N=u[O];if(!N)continue;const{direction:I,speed:M}=Pue($,N,x,t,h);for(const A of["x","y"])p[A][I[A]]||(M[A]=0,I[A]=0);if(M.x>0||M.y>0){b(),C.current=$,y(S,a),v.current=M,w.current=I;return}}v.current={x:0,y:0},w.current={x:0,y:0},b()},[t,S,r,b,i,a,JSON.stringify(x),JSON.stringify(p),y,c,E,u,JSON.stringify(h)])}const Uue={x:{[Pr.Backward]:!1,[Pr.Forward]:!1},y:{[Pr.Backward]:!1,[Pr.Forward]:!1}};function que(e){let{delta:t,disabled:n}=e;const r=hC(t);return Bf(o=>{if(n||!r||!o)return Uue;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Pr.Backward]:o.x[Pr.Backward]||i.x===-1,[Pr.Forward]:o.x[Pr.Forward]||i.x===1},y:{[Pr.Backward]:o.y[Pr.Backward]||i.y===-1,[Pr.Forward]:o.y[Pr.Forward]||i.y===1}}},[n,t,r])}function Gue(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Bf(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function Kue(e,t){return T.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...i]},[]),[e,t])}var Wf;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Wf||(Wf={}));var _C;(function(e){e.Optimized="optimized"})(_C||(_C={}));const S3=new Map;function Xue(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=T.useState(null),{frequency:s,measure:l,strategy:c}=o,u=T.useRef(e),d=v(),h=Ff(d),p=T.useCallback(function(w){w===void 0&&(w=[]),!h.current&&a(x=>x===null?w:x.concat(w.filter(C=>!x.includes(C))))},[h]),y=T.useRef(null),b=Bf(w=>{if(d&&!n)return S3;if(!w||w===S3||u.current!==e||i!=null){const x=new Map;for(let C of e){if(!C)continue;if(i&&i.length>0&&!i.includes(C.id)&&C.rect.current){x.set(C.id,C.rect.current);continue}const S=C.node.current,E=S?new bC(l(S),S):null;C.rect.current=E,E&&x.set(C.id,E)}return x}return w},[e,i,n,d,l]);return T.useEffect(()=>{u.current=e},[e]),T.useEffect(()=>{d||p()},[n,d]),T.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),T.useEffect(()=>{d||typeof s!="number"||y.current!==null||(y.current=setTimeout(()=>{p(),y.current=null},s))},[s,d,p,...r]),{droppableRects:b,measureDroppableContainers:p,measuringScheduled:i!=null};function v(){switch(c){case Wf.Always:return!1;case Wf.BeforeDragging:return n;default:return!n}}}function E3(e,t){return Bf(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Yue(e,t){return E3(e,t)}function Que(e){let{callback:t,disabled:n}=e;const r=fC(t),o=T.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return T.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Gg(e){let{callback:t,disabled:n}=e;const r=fC(t),o=T.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return T.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Zue(e){return new bC(uu(e),e)}function $3(e,t,n){t===void 0&&(t=Zue);const[r,o]=T.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const a=Que({callback(l){if(e)for(const c of l){const{type:u,target:d}=c;if(u==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),s=Gg({callback:i});return pa(()=>{i(),e?(s==null||s.observe(e),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(s==null||s.disconnect(),a==null||a.disconnect())},[e]),r}function Jue(e){const t=E3(e);return d3(e,t)}const _3=[];function ede(e){const t=T.useRef(e),n=Bf(r=>e?r&&r!==_3&&e&&t.current&&e.parentNode===t.current.parentNode?r:Ug(e):_3,[e]);return T.useEffect(()=>{t.current=e},[e]),n}function tde(e){const[t,n]=T.useState(null),r=T.useRef(e),o=T.useCallback(i=>{const a=vC(i.target);a&&n(s=>s?(s.set(a,yC(a)),new Map(s)):null)},[]);return T.useEffect(()=>{const i=r.current;if(e!==i){a(i);const s=e.map(l=>{const c=vC(l);return c?(c.addEventListener("scroll",o,{passive:!0}),[c,yC(c)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),r.current=e}return()=>{a(e),a(i)};function a(s){s.forEach(l=>{const c=vC(l);c==null||c.removeEventListener("scroll",o)})}},[o,e]),T.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>cu(i,a),Fi):y3(e):Fi,[e,t])}function O3(e,t){t===void 0&&(t=[]);const n=T.useRef(null);return T.useEffect(()=>{n.current=null},t),T.useEffect(()=>{const r=e!==Fi;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?zf(e,n.current):Fi}function nde(e){T.useEffect(()=>{if(!zg)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function rde(e,t){return T.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=a=>{i(a,t)},n},{}),[e,t])}function N3(e){return T.useMemo(()=>e?Oue(e):null,[e])}const T3=[];function ode(e,t){t===void 0&&(t=uu);const[n]=e,r=N3(n?wo(n):null),[o,i]=T.useState(T3);function a(){i(()=>e.length?e.map(l=>g3(l)?r:new bC(t(l),l)):T3)}const s=Gg({callback:a});return pa(()=>{s==null||s.disconnect(),a(),e.forEach(l=>s==null?void 0:s.observe(l))},[e]),o}function ide(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return kf(t)?t:e}function ade(e){let{measure:t}=e;const[n,r]=T.useState(null),o=T.useCallback(c=>{for(const{target:u}of c)if(kf(u)){r(d=>{const h=t(u);return d?{...d,width:h.width,height:h.height}:h});break}},[t]),i=Gg({callback:o}),a=T.useCallback(c=>{const u=ide(c);i==null||i.disconnect(),u&&(i==null||i.observe(u)),r(u?t(u):null)},[t,i]),[s,l]=jg(a);return T.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}const sde=[{sensor:SC,options:{}},{sensor:CC,options:{}}],lde={current:{}},Kg={draggable:{measure:f3},droppable:{measure:f3,strategy:Wf.WhileDragging,frequency:_C.Optimized},dragOverlay:{measure:uu}};class Uf extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const cde={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Uf,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Wg},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Kg,measureDroppableContainers:Wg,windowRect:null,measuringScheduled:!1},ude={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Wg,draggableNodes:new Map,over:null,measureDroppableContainers:Wg},Xg=T.createContext(ude),I3=T.createContext(cde);function dde(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Uf}}}function fde(e,t){switch(t.type){case wr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case wr.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case wr.DragEnd:case wr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case wr.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Uf(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case wr.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new Uf(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case wr.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Uf(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function hde(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=T.useContext(Xg),i=hC(r),a=hC(n==null?void 0:n.id);return T.useEffect(()=>{if(!t&&!r&&i&&a!=null){if(!mC(i)||document.activeElement===i.target)return;const s=o.get(a);if(!s)return;const{activatorNode:l,node:c}=s;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const d=iue(u);if(d){d.focus();break}}})}},[r,t,o,a,i]),null}function pde(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function mde(e){return T.useMemo(()=>({draggable:{...Kg.draggable,...e==null?void 0:e.draggable},droppable:{...Kg.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Kg.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function gde(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=T.useRef(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;pa(()=>{if(!a&&!s||!t){i.current=!1;return}if(i.current||!r)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const u=n(c),d=d3(u,r);if(a||(d.x=0),s||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const h=h3(c);h&&h.scrollBy({top:d.y,left:d.x})}},[t,a,s,r,n])}const P3=T.createContext({...Fi,scaleX:1,scaleY:1});var Ns;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ns||(Ns={}));const vde=T.memo(function(t){var n,r,o,i;let{id:a,accessibility:s,autoScroll:l=!0,children:c,sensors:u=sde,collisionDetection:d=wue,measuring:h,modifiers:p,...y}=t;const b=T.useReducer(fde,void 0,dde),[v,w]=b,[x,C]=due(),[S,E]=T.useState(Ns.Uninitialized),$=S===Ns.Initialized,{draggable:{active:O,nodes:N,translate:I},droppable:{containers:M}}=v,A=O!=null?N.get(O):null,z=T.useRef({initial:null,translated:null}),B=T.useMemo(()=>{var je;return O!=null?{id:O,data:(je=A==null?void 0:A.data)!=null?je:lde,rect:z}:null},[O,A]),P=T.useRef(null),[F,R]=T.useState(null),[L,V]=T.useState(null),j=Ff(y,Object.values(y)),W=Vf("DndDescribedBy",a),U=T.useMemo(()=>M.getEnabled(),[M]),G=mde(h),{droppableRects:q,measureDroppableContainers:Y,measuringScheduled:K}=Xue(U,{dragging:$,dependencies:[I.x,I.y],config:G.droppable}),J=Gue(N,O),le=T.useMemo(()=>L?gC(L):null,[L]),Z=on(),ie=Yue(J,G.draggable.measure);gde({activeNode:O!=null?N.get(O):null,config:Z.layoutShiftCompensation,initialRect:ie,measure:G.draggable.measure});const de=$3(J,G.draggable.measure,ie),ce=$3(J?J.parentElement:null),ue=T.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),pe=M.getNodeFor((n=ue.current.over)==null?void 0:n.id),te=ade({measure:G.dragOverlay.measure}),re=(r=te.nodeRef.current)!=null?r:J,fe=$?(o=te.rect)!=null?o:de:null,be=!!(te.nodeRef.current&&te.rect),_e=Jue(be?null:de),xe=N3(re?wo(re):null),Oe=ede($?pe??J:null),ye=ode(Oe),Re=pde(p,{transform:{x:I.x-_e.x,y:I.y-_e.y,scaleX:1,scaleY:1},activatorEvent:L,active:B,activeNodeRect:de,containerNodeRect:ce,draggingNodeRect:fe,over:ue.current.over,overlayNodeRect:te.rect,scrollableAncestors:Oe,scrollableAncestorRects:ye,windowRect:xe}),Pe=le?cu(le,I):null,we=tde(Oe),Ae=O3(we),Be=O3(we,[de]),ft=cu(Re,Ae),qe=fe?Sue(fe,Re):null,Xe=B&&qe?d({active:B,collisionRect:qe,droppableRects:q,droppableContainers:U,pointerCoordinates:Pe}):null,pt=c3(Xe,"id"),[Je,dt]=T.useState(null),nt=be?Re:cu(Re,Be),De=Cue(nt,(i=Je==null?void 0:Je.rect)!=null?i:null,de),ze=T.useRef(null),Se=T.useCallback((je,He)=>{let{sensor:et,options:Ve}=He;if(P.current==null)return;const st=N.get(P.current);if(!st)return;const Ue=je.nativeEvent,Qe=new et({active:P.current,activeNode:st,event:Ue,options:Ve,context:ue,onAbort(Ze){if(!N.get(Ze))return;const{onDragAbort:Jt}=j.current,yt={id:Ze};Jt==null||Jt(yt),x({type:"onDragAbort",event:yt})},onPending(Ze,mt,Jt,yt){if(!N.get(Ze))return;const{onDragPending:Zn}=j.current,Ot={id:Ze,constraint:mt,initialCoordinates:Jt,offset:yt};Zn==null||Zn(Ot),x({type:"onDragPending",event:Ot})},onStart(Ze){const mt=P.current;if(mt==null)return;const Jt=N.get(mt);if(!Jt)return;const{onDragStart:yt}=j.current,Pn={activatorEvent:Ue,active:{id:mt,data:Jt.data,rect:z}};ur.unstable_batchedUpdates(()=>{yt==null||yt(Pn),E(Ns.Initializing),w({type:wr.DragStart,initialCoordinates:Ze,active:mt}),x({type:"onDragStart",event:Pn}),R(ze.current),V(Ue)})},onMove(Ze){w({type:wr.DragMove,coordinates:Ze})},onEnd:ot(wr.DragEnd),onCancel:ot(wr.DragCancel)});ze.current=Qe;function ot(Ze){return async function(){const{active:Jt,collisions:yt,over:Pn,scrollAdjustedTranslate:Zn}=ue.current;let Ot=null;if(Jt&&Zn){const{cancelDrop:Mt}=j.current;Ot={activatorEvent:Ue,active:Jt,collisions:yt,delta:Zn,over:Pn},Ze===wr.DragEnd&&typeof Mt=="function"&&await Promise.resolve(Mt(Ot))&&(Ze=wr.DragCancel)}P.current=null,ur.unstable_batchedUpdates(()=>{w({type:Ze}),E(Ns.Uninitialized),dt(null),R(null),V(null),ze.current=null;const Mt=Ze===wr.DragEnd?"onDragEnd":"onDragCancel";if(Ot){const xn=j.current[Mt];xn==null||xn(Ot),x({type:Mt,event:Ot})}})}}},[N]),Te=T.useCallback((je,He)=>(et,Ve)=>{const st=et.nativeEvent,Ue=N.get(Ve);if(P.current!==null||!Ue||st.dndKit||st.defaultPrevented)return;const Qe={active:Ue};je(et,He.options,Qe)===!0&&(st.dndKit={capturedBy:He.sensor},P.current=Ve,Se(et,He))},[N,Se]),Ye=Kue(u,Te);nde(u),pa(()=>{de&&S===Ns.Initializing&&E(Ns.Initialized)},[de,S]),T.useEffect(()=>{const{onDragMove:je}=j.current,{active:He,activatorEvent:et,collisions:Ve,over:st}=ue.current;if(!He||!et)return;const Ue={active:He,activatorEvent:et,collisions:Ve,delta:{x:ft.x,y:ft.y},over:st};ur.unstable_batchedUpdates(()=>{je==null||je(Ue),x({type:"onDragMove",event:Ue})})},[ft.x,ft.y]),T.useEffect(()=>{const{active:je,activatorEvent:He,collisions:et,droppableContainers:Ve,scrollAdjustedTranslate:st}=ue.current;if(!je||P.current==null||!He||!st)return;const{onDragOver:Ue}=j.current,Qe=Ve.get(pt),ot=Qe&&Qe.rect.current?{id:Qe.id,rect:Qe.rect.current,data:Qe.data,disabled:Qe.disabled}:null,Ze={active:je,activatorEvent:He,collisions:et,delta:{x:st.x,y:st.y},over:ot};ur.unstable_batchedUpdates(()=>{dt(ot),Ue==null||Ue(Ze),x({type:"onDragOver",event:Ze})})},[pt]),pa(()=>{ue.current={activatorEvent:L,active:B,activeNode:J,collisionRect:qe,collisions:Xe,droppableRects:q,draggableNodes:N,draggingNode:re,draggingNodeRect:fe,droppableContainers:M,over:Je,scrollableAncestors:Oe,scrollAdjustedTranslate:ft},z.current={initial:fe,translated:qe}},[B,J,Xe,qe,N,re,fe,q,M,Je,Oe,ft]),Wue({...Z,delta:I,draggingRect:qe,pointerCoordinates:Pe,scrollableAncestors:Oe,scrollableAncestorRects:ye});const At=T.useMemo(()=>({active:B,activeNode:J,activeNodeRect:de,activatorEvent:L,collisions:Xe,containerNodeRect:ce,dragOverlay:te,draggableNodes:N,droppableContainers:M,droppableRects:q,over:Je,measureDroppableContainers:Y,scrollableAncestors:Oe,scrollableAncestorRects:ye,measuringConfiguration:G,measuringScheduled:K,windowRect:xe}),[B,J,de,L,Xe,ce,te,N,M,q,Je,Y,Oe,ye,G,K,xe]),sn=T.useMemo(()=>({activatorEvent:L,activators:Ye,active:B,activeNodeRect:de,ariaDescribedById:{draggable:W},dispatch:w,draggableNodes:N,over:Je,measureDroppableContainers:Y}),[L,Ye,B,de,w,W,N,Je,Y]);return T.createElement(o3.Provider,{value:C},T.createElement(Xg.Provider,{value:sn},T.createElement(I3.Provider,{value:At},T.createElement(P3.Provider,{value:De},c)),T.createElement(hde,{disabled:(s==null?void 0:s.restoreFocus)===!1})),T.createElement(pue,{...s,hiddenTextDescribedById:W}));function on(){const je=(F==null?void 0:F.autoScrollEnabled)===!1,He=typeof l=="object"?l.enabled===!1:l===!1,et=$&&!je&&!He;return typeof l=="object"?{...l,enabled:et}:{enabled:et}}}),yde=T.createContext(null),M3="button",bde="Draggable";function wde(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Vf(bde),{activators:a,activatorEvent:s,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:h}=T.useContext(Xg),{role:p=M3,roleDescription:y="draggable",tabIndex:b=0}=o??{},v=(l==null?void 0:l.id)===t,w=T.useContext(v?P3:yde),[x,C]=jg(),[S,E]=jg(),$=rde(a,t),O=Ff(n);pa(()=>(d.set(t,{id:t,key:i,node:x,activatorNode:S,data:O}),()=>{const I=d.get(t);I&&I.key===i&&d.delete(t)}),[d,t]);const N=T.useMemo(()=>({role:p,tabIndex:b,"aria-disabled":r,"aria-pressed":v&&p===M3?!0:void 0,"aria-roledescription":y,"aria-describedby":u.draggable}),[r,p,b,v,y,u.draggable]);return{active:l,activatorEvent:s,activeNodeRect:c,attributes:N,isDragging:v,listeners:r?void 0:$,node:x,over:h,setNodeRef:C,setActivatorNodeRef:E,transform:w}}function Cde(){return T.useContext(I3)}const xde="Droppable",Sde={timeout:25};function Ede(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Vf(xde),{active:a,dispatch:s,over:l,measureDroppableContainers:c}=T.useContext(Xg),u=T.useRef({disabled:n}),d=T.useRef(!1),h=T.useRef(null),p=T.useRef(null),{disabled:y,updateMeasurementsFor:b,timeout:v}={...Sde,...o},w=Ff(b??r),x=T.useCallback(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(w.current)?w.current:[w.current]),p.current=null},v)},[v]),C=Gg({callback:x,disabled:y||!a}),S=T.useCallback((N,I)=>{C&&(I&&(C.unobserve(I),d.current=!1),N&&C.observe(N))},[C]),[E,$]=jg(S),O=Ff(t);return T.useEffect(()=>{!C||!E.current||(C.disconnect(),d.current=!1,C.observe(E.current))},[E,C]),T.useEffect(()=>(s({type:wr.RegisterDroppable,element:{id:r,key:i,disabled:n,node:E,rect:h,data:O}}),()=>s({type:wr.UnregisterDroppable,key:i,id:r})),[r]),T.useEffect(()=>{n!==u.current.disabled&&(s({type:wr.SetDroppableDisabled,id:r,key:i,disabled:n}),u.current.disabled=n)},[r,i,n,s]),{active:a,rect:h,isOver:(l==null?void 0:l.id)===r,node:E,over:l,setNodeRef:$}}function OC(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function $de(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function Yg(e){return e!==null&&e>=0}function _de(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ode(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const A3=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=OC(t,r,n),a=t[o],s=i[o];return!s||!a?null:{x:s.left-a.left,y:s.top-a.top,scaleX:s.width/a.width,scaleY:s.height/a.height}},Qg={scaleX:1,scaleY:1},Nde=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const s=(t=i[n])!=null?t:r;if(!s)return null;if(o===n){const c=i[a];return c?{x:0,y:n<a?c.top+c.height-(s.top+s.height):c.top-s.top,...Qg}:null}const l=Tde(i,o,n);return o>n&&o<=a?{x:0,y:-s.height-l,...Qg}:o<n&&o>=a?{x:0,y:s.height+l,...Qg}:{x:0,y:0,...Qg}};function Tde(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const D3="Sortable",L3=T.createContext({activeIndex:-1,containerId:D3,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:A3,disabled:{draggable:!1,droppable:!1}});function Ide(e){let{children:t,id:n,items:r,strategy:o=A3,disabled:i=!1}=e;const{active:a,dragOverlay:s,droppableRects:l,over:c,measureDroppableContainers:u}=Cde(),d=Vf(D3,n),h=s.rect!==null,p=T.useMemo(()=>r.map($=>typeof $=="object"&&"id"in $?$.id:$),[r]),y=a!=null,b=a?p.indexOf(a.id):-1,v=c?p.indexOf(c.id):-1,w=T.useRef(p),x=!_de(p,w.current),C=v!==-1&&b===-1||x,S=Ode(i);pa(()=>{x&&y&&u(p)},[x,p,y,u]),T.useEffect(()=>{w.current=p},[p]);const E=T.useMemo(()=>({activeIndex:b,containerId:d,disabled:S,disableTransforms:C,items:p,overIndex:v,useDragOverlay:h,sortedRects:$de(p,l),strategy:o}),[b,d,S.draggable,S.droppable,C,p,v,l,h,o]);return T.createElement(L3.Provider,{value:E},t)}const Pde=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return OC(n,r,o).indexOf(t)},Mde=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:s,previousContainerId:l,transition:c}=e;return!c||!r||s!==i&&o===a?!1:n?!0:a!==o&&t===l},Ade={duration:200,easing:"ease"},R3="transform",Dde=Hg.Transition.toString({property:R3,duration:0,easing:"linear"}),Lde={roleDescription:"sortable"};function Rde(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=T.useState(null),s=T.useRef(n);return pa(()=>{if(!t&&n!==s.current&&r.current){const l=o.current;if(l){const c=uu(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&a(u)}}n!==s.current&&(s.current=n)},[t,n,r,o]),T.useEffect(()=>{i&&a(null)},[i]),i}function kde(e){let{animateLayoutChanges:t=Mde,attributes:n,disabled:r,data:o,getNewIndex:i=Pde,id:a,strategy:s,resizeObserverConfig:l,transition:c=Ade}=e;const{items:u,containerId:d,activeIndex:h,disabled:p,disableTransforms:y,sortedRects:b,overIndex:v,useDragOverlay:w,strategy:x}=T.useContext(L3),C=Fde(r,p),S=u.indexOf(a),E=T.useMemo(()=>({sortable:{containerId:d,index:S,items:u},...o}),[d,o,S,u]),$=T.useMemo(()=>u.slice(u.indexOf(a)),[u,a]),{rect:O,node:N,isOver:I,setNodeRef:M}=Ede({id:a,data:E,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:$,...l}}),{active:A,activatorEvent:z,activeNodeRect:B,attributes:P,setNodeRef:F,listeners:R,isDragging:L,over:V,setActivatorNodeRef:j,transform:W}=wde({id:a,data:E,attributes:{...Lde,...n},disabled:C.draggable}),U=tue(M,F),G=!!A,q=G&&!y&&Yg(h)&&Yg(v),Y=!w&&L,K=Y&&q?W:null,le=q?K??(s??x)({rects:b,activeNodeRect:B,activeIndex:h,overIndex:v,index:S}):null,Z=Yg(h)&&Yg(v)?i({id:a,items:u,activeIndex:h,overIndex:v}):S,ie=A==null?void 0:A.id,de=T.useRef({activeId:ie,items:u,newIndex:Z,containerId:d}),ce=u!==de.current.items,ue=t({active:A,containerId:d,isDragging:L,isSorting:G,id:a,index:S,items:u,newIndex:de.current.newIndex,previousItems:de.current.items,previousContainerId:de.current.containerId,transition:c,wasDragging:de.current.activeId!=null}),pe=Rde({disabled:!ue,index:S,node:N,rect:O});return T.useEffect(()=>{G&&de.current.newIndex!==Z&&(de.current.newIndex=Z),d!==de.current.containerId&&(de.current.containerId=d),u!==de.current.items&&(de.current.items=u)},[G,Z,d,u]),T.useEffect(()=>{if(ie===de.current.activeId)return;if(ie!=null&&de.current.activeId==null){de.current.activeId=ie;return}const re=setTimeout(()=>{de.current.activeId=ie},50);return()=>clearTimeout(re)},[ie]),{active:A,activeIndex:h,attributes:P,data:E,rect:O,index:S,newIndex:Z,items:u,isOver:I,isSorting:G,isDragging:L,listeners:R,node:N,overIndex:v,over:V,setNodeRef:U,setActivatorNodeRef:j,setDroppableNodeRef:M,setDraggableNodeRef:F,transform:pe??le,transition:te()};function te(){if(pe||ce&&de.current.newIndex===S)return Dde;if(!(Y&&!mC(z)||!c)&&(G||ue))return Hg.Transition.toString({...c,property:R3})}}function Fde(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function Zg(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Bde=[Xt.Down,Xt.Right,Xt.Up,Xt.Left],Vde=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=t;if(Bde.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const h=o.get(d.id);if(h)switch(e.code){case Xt.Down:r.top<h.top&&l.push(d);break;case Xt.Up:r.top>h.top&&l.push(d);break;case Xt.Left:r.left>h.left&&l.push(d);break;case Xt.Right:r.left<h.left&&l.push(d);break}});const c=yue({collisionRect:r,droppableRects:o,droppableContainers:l});let u=c3(c,"id");if(u===(a==null?void 0:a.id)&&c.length>1&&(u=c[1].id),u!=null){const d=i.get(n.id),h=i.get(u),p=h?o.get(h.id):null,y=h==null?void 0:h.node.current;if(y&&p&&d&&h){const v=Ug(y).some(($,O)=>s[O]!==$),w=k3(d,h),x=zde(d,h),C=v||!w?{x:0,y:0}:{x:x?r.width-p.width:0,y:x?r.height-p.height:0},S={x:p.left,y:p.top};return C.x&&C.y?S:zf(S,C)}}}};function k3(e,t){return!Zg(e)||!Zg(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function zde(e,t){return!Zg(e)||!Zg(t)||!k3(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const F3="collapsed",NC="collapsing",Jg="expanding",ev="expanded",jde="collapse-css-transition",Hde="div",Wde="0px";function B3(e){requestAnimationFrame(function(){requestAnimationFrame(e)})}const jr=({children:e,transition:t,style:n,render:r,elementType:o=Hde,isOpen:i,collapseHeight:a=Wde,onInit:s,onChange:l,className:c=jde,addState:u,noAnim:d,overflowOnExpanded:h,...p})=>{const y=()=>a==="0px"?"hidden":void 0,[b,v]=T.useReducer(L=>L+1,0),w=T.useRef(),[x,C]=T.useState(0),S=T.useRef({collapse:i?ev:F3,style:{height:i?void 0:a,visibility:i?void 0:y()}}).current;T.useEffect(()=>{x&&E(l)},[x]);const E=(L,V={})=>{L&&L({state:S.collapse,style:S.style,...V})};function $(){w.current&&(S.collapse=F3,S.style={height:a,visibility:y()},v(),setTimeout(()=>C(Date.now),0))}function O(){if(w.current){if(d)return $();S.collapse=NC,S.style={height:M(),visibility:void 0},v(),B3(()=>{w.current&&S.collapse===NC&&(S.style={height:a,visibility:void 0},C(Date.now))})}}function N(){if(w.current){if(d)return I();S.collapse=Jg,B3(()=>{w.current&&S.collapse===Jg&&(S.style={height:M(),visibility:void 0},C(Date.now))})}}function I(){w.current&&(S.collapse=ev,S.style={height:void 0,visibility:void 0},v(),setTimeout(()=>C(Date.now),0))}function M(){return`${w.current.scrollHeight}px`}function A({target:L,propertyName:V}){if(L===w.current&&V==="height"){const j=L.style.height;switch(S.collapse){case Jg:j===void 0||j===a||I();break;case NC:j===void 0||j!==a||$();break}}}const z=S.collapse===ev||S.collapse===Jg;!z&&i&&N(),z&&!i&&O();const B={overflow:S.collapse===ev&&h?void 0:"hidden",transition:t,...n,...S.style},P=o,F=T.useCallback(L=>{L&&(w.current=L,E(s,{node:L}))},[o]),R=u?`${c} --c-${S.collapse}`:c;return k.jsx(P,{ref:F,style:B,onTransitionEnd:A,className:R,...p,children:typeof e=="function"?e(S.collapse):typeof r=="function"?r(S.collapse):e})};var Ude="scripts_editor_7lmk2x0",qde="scripts_editor_7lmk2x1",Gde="scripts_editor_7lmk2x2",Kde="scripts_editor_7lmk2x3",Xde="scripts_editor_7lmk2x5",Yde="scripts_editor_7lmk2x6",Qde="scripts_editor_7lmk2x7",Zde="scripts_editor_7lmk2x8",Jde="scripts_editor_7lmk2x9",efe="scripts_editor_7lmk2xa";const tfe=({item:e})=>{var y;const t=e.id,{attributes:n,listeners:r,setNodeRef:o,transform:i,transition:a,isDragging:s}=kde({id:e.id}),[l,c]=T.useState(!1),{Text:u}=hr,d={transform:i?`translate3d(${i.x}px, ${i.y}px, 0)`:void 0,transition:a},h=(y=e.id)==null?void 0:y.includes("condition-default-"),p=h?!1:l;return k.jsx("div",{ref:h?null:o,style:d,className:`${Ude} ${s?qde:""}`,children:k.jsxs(ua,{size:"small",className:`${Gde} ${s?Kde:""}`,styles:{body:{padding:"8px 12px 8px 4px",display:"flex",alignItems:"center"}},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[k.jsx(hn,{type:"text",size:"small",className:`${Xde} ${p?Yde:""}`,...n,...r,children:k.jsx(ZO,{className:Qde})}),k.jsx(u,{className:Zde,children:e.label}),k.jsx(ro,{type:"source",position:at.Right,id:t,className:Jde})]})})},{Text:nfe}=hr,rfe=({NODE_ID:e})=>{const{getNode:t,setNodes:n}=no(),{data:r}=t(e),o=r,i=cO(),a=o.conditions||[],s=mue(i3(SC,{activationConstraint:{distance:8}}),i3(CC,{coordinateGetter:Vde})),l=u=>{const{active:d,over:h}=u;if((d==null?void 0:d.id)!==(h==null?void 0:h.id)){const p=a.findIndex(b=>b.id===(d==null?void 0:d.id)),y=a.findIndex(b=>b.id===(h==null?void 0:h.id));n(b=>b.find(w=>w.id===e)?b.map(w=>w.id===e?{...w,data:{...w.data,conditions:OC(a,p,y)}}:w):b)}i(e)},c=()=>{i(e)};return k.jsx(ua,{className:efe,styles:{body:{padding:"8px"}},children:k.jsx(vde,{sensors:s,collisionDetection:vue,onDragEnd:l,onDragMove:c,children:k.jsxs(Ide,{items:a.map(u=>u.id),strategy:Nde,children:[k.jsx(jr,{isOpen:a.length===0,children:k.jsx(nfe,{type:"secondary",children:"Không có ý định nào"})}),k.jsx(jr,{isOpen:a.length>0,children:a.map(u=>k.jsx(qa,{children:k.jsx(tfe,{item:u},u.id)},u.id))})]})})})};var V3="scripts_editor_ao5dig0",z3="scripts_editor_ao5dig2",j3="scripts_editor_ao5dig3",H3="scripts_editor_ao5dig4",W3="scripts_editor_ao5dig5";const U3={missingMaleRecord:{title:"Thiếu ghi âm giọng nam",description:"Bạn chưa ghi âm giọng nam, vui lòng tải file ghi âm hoặc ghi âm trực tiếp"},missingFemaleRecord:{title:"Thiếu ghi âm giọng nữ",description:"Bạn chưa ghi âm giọng nữ, vui lòng tải file ghi âm hoặc ghi âm trực tiếp"}},q3={usePersonalized:{title:"Sử dụng cá nhân hoá",description:"Bạn nên sử dụng cá nhân hoá để tăng thời lượng cuộc gọi"},shouldHaveMemories:{title:"Cài đặt kiến thức",description:"Để bot trả lời tốt hơn, bạn nên cài đặt kiến thức. Click vào đây để cài đặt."}},ofe=e=>{var i,a,s;const t=(i=e.record)==null?void 0:i.detect_gender,n=e.type,r=[],o=[];return n===Yn.MACHINE&&r.push(q3.usePersonalized),n===Yn.PROMPT&&r.push(q3.shouldHaveMemories),n===Yn.RECORD&&t&&(((a=e.record)==null?void 0:a.male_record)===void 0&&o.push(U3.missingMaleRecord),((s=e.record)==null?void 0:s.female_record)===void 0&&o.push(U3.missingFemaleRecord)),{errors:o,infos:r}},ife=e=>{const t=[],n=[];return e.type===ki.EXTERNAL&&n.push({code:"transfer_external_warning",title:"",description:"Nếu chuyển máy vào số điện thoại thì sẽ bị tính 2 lần cước phí (chi phí bot gọi cho khách hàng và chi phí bot gọi cho số điện thoại của bạn).Bạn không nên chuyển máy vào số điện thoại trong chiến dịch gọi hàng loạt vì rủi ro chuyển máy thất bại khi nhiều cuộc gọi chuyển máy cùng lúc."}),{errors:t,infos:n}};function tv(e){const t=TC();return{infos:t.infos.filter(n=>n.nodeId===e),errors:t.errors.filter(n=>n.nodeId===e)}}function TC(){const e=Lt(n=>n.nodes);return T.useMemo(()=>{const n=[],r=[];return e.forEach(o=>{let i=[],a=[];if(o.type===We.TRANSFER){const{infos:s,errors:l}=ife(o.data);i.push(...s),a.push(...l)}if(o.type===We.SPEAK){const{infos:s,errors:l}=ofe(o.data);i.push(...s),a.push(...l)}i=i.map(s=>({...s,nodeId:o.id})),a=a.map(s=>({...s,nodeId:o.id})),n.push(...i),r.push(...a)}),{infos:n,errors:r}},[e])}var afe="scripts_editor_10lsbsa0",sfe="scripts_editor_10lsbsa1",G3="scripts_editor_10lsbsa2",K3="scripts_editor_10lsbsa3",X3="scripts_editor_10lsbsa4",Y3="scripts_editor_10lsbsa5",Q3="scripts_editor_10lsbsa6",lfe="scripts_editor_10lsbsa8",cfe="scripts_editor_10lsbsa9",ufe="scripts_editor_10lsbsaa",Z3="scripts_editor_10lsbsab";const{TextArea:dfe}=Vr,ffe=({prefixPaths:e=[]})=>k.jsx($t.Item,{name:[...e,"machine","content"],noStyle:!0,children:k.jsx(dfe,{placeholder:"Nhập kịch bản",rows:4,style:{width:"100%",border:"none",backgroundColor:"rgba(245, 245, 245, 1)",padding:"12px"}})}),{TextArea:hfe}=Vr,pfe=({prefixPaths:e=[]})=>k.jsx($t.Item,{name:[...e,"prompt","content"],noStyle:!0,children:k.jsx(hfe,{placeholder:"Nhập prompt",rows:4,style:{width:"100%",border:"none",backgroundColor:"rgba(245, 245, 245, 1)",padding:"12px"}})}),J3=6048e5,mfe=864e5,e4=Symbol.for("constructDateFrom");function Ts(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&e4 in e?e[e4](t):e instanceof Date?new e.constructor(t):new Date(t)}function Bi(e,t){return Ts(t||e,e)}let gfe={};function nv(){return gfe}function qf(e,t){var s,l,c,u;const n=nv(),r=(t==null?void 0:t.weekStartsOn)??((l=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:l.weekStartsOn)??n.weekStartsOn??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,o=Bi(e,t==null?void 0:t.in),i=o.getDay(),a=(i<r?7:0)+i-r;return o.setDate(o.getDate()-a),o.setHours(0,0,0,0),o}function rv(e,t){return qf(e,{...t,weekStartsOn:1})}function t4(e,t){const n=Bi(e,t==null?void 0:t.in),r=n.getFullYear(),o=Ts(n,0);o.setFullYear(r+1,0,4),o.setHours(0,0,0,0);const i=rv(o),a=Ts(n,0);a.setFullYear(r,0,4),a.setHours(0,0,0,0);const s=rv(a);return n.getTime()>=i.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function n4(e){const t=Bi(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function vfe(e,...t){const n=Ts.bind(null,t.find(r=>typeof r=="object"));return t.map(n)}function r4(e,t){const n=Bi(e,t==null?void 0:t.in);return n.setHours(0,0,0,0),n}function yfe(e,t,n){const[r,o]=vfe(n==null?void 0:n.in,e,t),i=r4(r),a=r4(o),s=+i-n4(i),l=+a-n4(a);return Math.round((s-l)/mfe)}function bfe(e,t){const n=t4(e,t),r=Ts(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),rv(r)}function wfe(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Cfe(e){return!(!wfe(e)&&typeof e!="number"||isNaN(+Bi(e)))}function xfe(e,t){const n=Bi(e,t==null?void 0:t.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const Sfe={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Efe=(e,t,n)=>{let r;const o=Sfe[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function IC(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const $fe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},_fe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ofe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Nfe={date:IC({formats:$fe,defaultWidth:"full"}),time:IC({formats:_fe,defaultWidth:"full"}),dateTime:IC({formats:Ofe,defaultWidth:"full"})},Tfe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ife=(e,t,n,r)=>Tfe[e];function Gf(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let o;if(r==="formatting"&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,s=n!=null&&n.width?String(n.width):a;o=e.formattingValues[s]||e.formattingValues[a]}else{const a=e.defaultWidth,s=n!=null&&n.width?String(n.width):e.defaultWidth;o=e.values[s]||e.values[a]}const i=e.argumentCallback?e.argumentCallback(t):t;return o[i]}}const Pfe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Mfe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Afe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Dfe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Lfe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Rfe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},kfe={ordinalNumber:(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:Gf({values:Pfe,defaultWidth:"wide"}),quarter:Gf({values:Mfe,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Gf({values:Afe,defaultWidth:"wide"}),day:Gf({values:Dfe,defaultWidth:"wide"}),dayPeriod:Gf({values:Lfe,defaultWidth:"wide",formattingValues:Rfe,defaultFormattingWidth:"wide"})};function Kf(e){return(t,n={})=>{const r=n.width,o=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(o);if(!i)return null;const a=i[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?Bfe(s,d=>d.test(a)):Ffe(s,d=>d.test(a));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=t.slice(a.length);return{value:c,rest:u}}}function Ffe(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Bfe(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Vfe(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const o=r[0],i=t.match(e.parsePattern);if(!i)return null;let a=e.valueCallback?e.valueCallback(i[0]):i[0];a=n.valueCallback?n.valueCallback(a):a;const s=t.slice(o.length);return{value:a,rest:s}}}const zfe=/^(\d+)(th|st|nd|rd)?/i,jfe=/\d+/i,Hfe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Wfe={any:[/^b/i,/^(a|c)/i]},Ufe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},qfe={any:[/1/i,/2/i,/3/i,/4/i]},Gfe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Kfe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Xfe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Yfe={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Qfe={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Zfe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Jfe={ordinalNumber:Vfe({matchPattern:zfe,parsePattern:jfe,valueCallback:e=>parseInt(e,10)}),era:Kf({matchPatterns:Hfe,defaultMatchWidth:"wide",parsePatterns:Wfe,defaultParseWidth:"any"}),quarter:Kf({matchPatterns:Ufe,defaultMatchWidth:"wide",parsePatterns:qfe,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Kf({matchPatterns:Gfe,defaultMatchWidth:"wide",parsePatterns:Kfe,defaultParseWidth:"any"}),day:Kf({matchPatterns:Xfe,defaultMatchWidth:"wide",parsePatterns:Yfe,defaultParseWidth:"any"}),dayPeriod:Kf({matchPatterns:Qfe,defaultMatchWidth:"any",parsePatterns:Zfe,defaultParseWidth:"any"})},ehe={code:"en-US",formatDistance:Efe,formatLong:Nfe,formatRelative:Ife,localize:kfe,match:Jfe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function the(e,t){const n=Bi(e,t==null?void 0:t.in);return yfe(n,xfe(n))+1}function nhe(e,t){const n=Bi(e,t==null?void 0:t.in),r=+rv(n)-+bfe(n);return Math.round(r/J3)+1}function o4(e,t){var u,d,h,p;const n=Bi(e,t==null?void 0:t.in),r=n.getFullYear(),o=nv(),i=(t==null?void 0:t.firstWeekContainsDate)??((d=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??o.firstWeekContainsDate??((p=(h=o.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,a=Ts((t==null?void 0:t.in)||e,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const s=qf(a,t),l=Ts((t==null?void 0:t.in)||e,0);l.setFullYear(r,0,i),l.setHours(0,0,0,0);const c=qf(l,t);return+n>=+s?r+1:+n>=+c?r:r-1}function rhe(e,t){var s,l,c,u;const n=nv(),r=(t==null?void 0:t.firstWeekContainsDate)??((l=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:l.firstWeekContainsDate)??n.firstWeekContainsDate??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,o=o4(e,t),i=Ts((t==null?void 0:t.in)||e,0);return i.setFullYear(o,0,r),i.setHours(0,0,0,0),qf(i,t)}function ohe(e,t){const n=Bi(e,t==null?void 0:t.in),r=+qf(n,t)-+rhe(n,t);return Math.round(r/J3)+1}function mn(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const Is={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return mn(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):mn(n+1,2)},d(e,t){return mn(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return mn(e.getHours()%12||12,t.length)},H(e,t){return mn(e.getHours(),t.length)},m(e,t){return mn(e.getMinutes(),t.length)},s(e,t){return mn(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),o=Math.trunc(r*Math.pow(10,n-3));return mn(o,t.length)}},du={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},i4={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),o=r>0?r:1-r;return n.ordinalNumber(o,{unit:"year"})}return Is.y(e,t)},Y:function(e,t,n,r){const o=o4(e,r),i=o>0?o:1-o;if(t==="YY"){const a=i%100;return mn(a,2)}return t==="Yo"?n.ordinalNumber(i,{unit:"year"}):mn(i,t.length)},R:function(e,t){const n=t4(e);return mn(n,t.length)},u:function(e,t){const n=e.getFullYear();return mn(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return mn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return mn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return Is.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return mn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const o=ohe(e,r);return t==="wo"?n.ordinalNumber(o,{unit:"week"}):mn(o,t.length)},I:function(e,t,n){const r=nhe(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):mn(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Is.d(e,t)},D:function(e,t,n){const r=the(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):mn(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const o=e.getDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return mn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});case"eeee":default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const o=e.getDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return mn(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});case"cccc":default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),o=r===0?7:r;switch(t){case"i":return String(o);case"ii":return mn(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const o=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let o;switch(r===12?o=du.noon:r===0?o=du.midnight:o=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let o;switch(r>=17?o=du.evening:r>=12?o=du.afternoon:r>=4?o=du.morning:o=du.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Is.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Is.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):mn(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):mn(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Is.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Is.s(e,t)},S:function(e,t){return Is.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return s4(r);case"XXXX":case"XX":return Ol(r);case"XXXXX":case"XXX":default:return Ol(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return s4(r);case"xxxx":case"xx":return Ol(r);case"xxxxx":case"xxx":default:return Ol(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+a4(r,":");case"OOOO":default:return"GMT"+Ol(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+a4(r,":");case"zzzz":default:return"GMT"+Ol(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return mn(r,t.length)},T:function(e,t,n){return mn(+e,t.length)}};function a4(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=Math.trunc(r/60),i=r%60;return i===0?n+String(o):n+String(o)+t+mn(i,2)}function s4(e,t){return e%60===0?(e>0?"-":"+")+mn(Math.abs(e)/60,2):Ol(e,t)}function Ol(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=mn(Math.trunc(r/60),2),i=mn(r%60,2);return n+o+t+i}const l4=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},c4=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},ihe={p:c4,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],o=n[2];if(!o)return l4(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",l4(r,t)).replace("{{time}}",c4(o,t))}},ahe=/^D+$/,she=/^Y+$/,lhe=["D","DD","YY","YYYY"];function che(e){return ahe.test(e)}function uhe(e){return she.test(e)}function dhe(e,t,n){const r=fhe(e,t,n);if(console.warn(r),lhe.includes(e))throw new RangeError(r)}function fhe(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const hhe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,phe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,mhe=/^'([^]*?)'?$/,ghe=/''/g,vhe=/[a-zA-Z]/;function yhe(e,t,n){var u,d,h,p;const r=nv(),o=r.locale??ehe,i=r.firstWeekContainsDate??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,a=r.weekStartsOn??((p=(h=r.locale)==null?void 0:h.options)==null?void 0:p.weekStartsOn)??0,s=Bi(e,n==null?void 0:n.in);if(!Cfe(s))throw new RangeError("Invalid time value");let l=t.match(phe).map(y=>{const b=y[0];if(b==="p"||b==="P"){const v=ihe[b];return v(y,o.formatLong)}return y}).join("").match(hhe).map(y=>{if(y==="''")return{isToken:!1,value:"'"};const b=y[0];if(b==="'")return{isToken:!1,value:bhe(y)};if(i4[b])return{isToken:!0,value:y};if(b.match(vhe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");return{isToken:!1,value:y}});o.localize.preprocessor&&(l=o.localize.preprocessor(s,l));const c={firstWeekContainsDate:i,weekStartsOn:a,locale:o};return l.map(y=>{if(!y.isToken)return y.value;const b=y.value;(uhe(b)||che(b))&&dhe(b,t,String(e));const v=i4[b[0]];return v(s,b,o.localize,c)}).join("")}function bhe(e){const t=e.match(mhe);return t?t[1].replace(ghe,"'"):e}var Nl={};const whe=e=>t=>{const n=e(t);return t.add(n),n},Che=e=>(t,n)=>(e.set(t,n),n),u4=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,d4=536870912,f4=d4*2,xhe=(e,t)=>n=>{const r=t.get(n);let o=r===void 0?n.size:r<f4?r+1:0;if(!n.has(o))return e(n,o);if(n.size<d4){for(;n.has(o);)o=Math.floor(Math.random()*f4);return e(n,o)}if(n.size>u4)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;n.has(o);)o=Math.floor(Math.random()*u4);return e(n,o)},h4=new WeakMap,She=Che(h4),p4=xhe(She,h4),Ehe=whe(p4),$he=e=>typeof e.start=="function",m4=new WeakMap,_he=e=>({...e,connect:({call:t})=>async()=>{const{port1:n,port2:r}=new MessageChannel,o=await t("connect",{port:n},[n]);return m4.set(r,o),r},disconnect:({call:t})=>async n=>{const r=m4.get(n);if(r===void 0)throw new Error("The given port is not connected.");await t("disconnect",{portId:r})},isSupported:({call:t})=>()=>t("isSupported")}),PC=new WeakMap,Ohe=e=>{if(PC.has(e))return PC.get(e);const t=new Map;return PC.set(e,t),t},g4=e=>{const t=_he(e);return n=>{const r=Ohe(n);n.addEventListener("message",({data:s})=>{const{id:l}=s;if(l!==null&&r.has(l)){const{reject:c,resolve:u}=r.get(l);r.delete(l),s.error===void 0?u(s.result):c(new Error(s.error.message))}}),$he(n)&&n.start();const o=(s,l=null,c=[])=>new Promise((u,d)=>{const h=p4(r);r.set(h,{reject:d,resolve:u}),l===null?n.postMessage({id:h,method:s},c):n.postMessage({id:h,method:s,params:l},c)}),i=(s,l,c=[])=>{n.postMessage({id:null,method:s,params:l},c)};let a={};for(const[s,l]of Object.entries(t))a={...a,[s]:l({call:o,notify:i})};return{...a}}},v4=new Set,Nhe=g4({deregister:({call:e})=>t=>e("deregister",{port:t},[t]),encode:({call:e})=>async(t,n)=>{const r=await e("encode",{encoderId:t,timeslice:n});return v4.delete(t),r},instantiate:({call:e})=>async(t,n)=>{const r=Ehe(v4),o=await e("instantiate",{encoderId:r,mimeType:t,sampleRate:n});return{encoderId:r,port:o}},register:({call:e})=>t=>e("register",{port:t},[t])}),The=e=>{const t=new Worker(e);return Nhe(t)},Ihe=`(()=>{var e={455:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:a<s?a+1:0;if(!r.has(i))return e(r,i);if(r.size<o){for(;r.has(i);)i=Math.floor(Math.random()*s);return e(r,i)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,c=r(i),l=a(c,i),d=t(l);e.addUniqueNumber=d,e.generateUniqueNumber=l}(t)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(()=>{"use strict";var e=r(455);const t=new WeakMap,n=new WeakMap,o=(r=>{const o=(s=r,{...s,connect:e=>{let{call:r}=e;return async()=>{const{port1:e,port2:n}=new MessageChannel,o=await r("connect",{port:e},[e]);return t.set(n,o),n}},disconnect:e=>{let{call:r}=e;return async e=>{const n=t.get(e);if(void 0===n)throw new Error("The given port is not connected.");await r("disconnect",{portId:n})}},isSupported:e=>{let{call:t}=e;return()=>t("isSupported")}});var s;return t=>{const r=(e=>{if(n.has(e))return n.get(e);const t=new Map;return n.set(e,t),t})(t);t.addEventListener("message",(e=>{let{data:t}=e;const{id:n}=t;if(null!==n&&r.has(n)){const{reject:e,resolve:o}=r.get(n);r.delete(n),void 0===t.error?o(t.result):e(new Error(t.error.message))}})),(e=>"function"==typeof e.start)(t)&&t.start();const s=function(n){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return new Promise(((a,i)=>{const c=(0,e.generateUniqueNumber)(r);r.set(c,{reject:i,resolve:a}),null===o?t.postMessage({id:c,method:n},s):t.postMessage({id:c,method:n,params:o},s)}))},a=function(e,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];t.postMessage({id:null,method:e,params:r},n)};let i={};for(const[e,t]of Object.entries(o))i={...i,[e]:t({call:s,notify:a})};return{...i}}})({characterize:e=>{let{call:t}=e;return()=>t("characterize")},encode:e=>{let{call:t}=e;return(e,r)=>t("encode",{recordingId:e,timeslice:r})},record:e=>{let{call:t}=e;return async(e,r,n)=>{await t("record",{recordingId:e,sampleRate:r,typedArrays:n},n.map((e=>{let{buffer:t}=e;return t})))}}}),s=-32603,a=-32602,i=-32601,c=(e,t)=>Object.assign(new Error(e),{status:t}),l=e=>c('The handler of the method called "'.concat(e,'" returned an unexpected result.'),s),d=(e,t)=>async r=>{let{data:{id:n,method:o,params:a}}=r;const d=t[o];try{if(void 0===d)throw(e=>c('The requested method called "'.concat(e,'" is not supported.'),i))(o);const t=void 0===a?d():d(a);if(void 0===t)throw(e=>c('The handler of the method called "'.concat(e,'" returned no required result.'),s))(o);const r=t instanceof Promise?await t:t;if(null===n){if(void 0!==r.result)throw l(o)}else{if(void 0===r.result)throw l(o);const{result:t,transferables:s=[]}=r;e.postMessage({id:n,result:t},s)}}catch(t){const{message:r,status:o=-32603}=t;e.postMessage({error:{code:o,message:r},id:n})}},u=new Map,h=(t,r,n)=>({...r,connect:n=>{let{port:o}=n;o.start();const s=t(o,r),a=(0,e.generateUniqueNumber)(u);return u.set(a,(()=>{s(),o.close(),u.delete(a)})),{result:a}},disconnect:e=>{let{portId:t}=e;const r=u.get(t);if(void 0===r)throw(e=>c('The specified parameter called "portId" with the given value "'.concat(e,'" does not identify a port connected to this worker.'),a))(t);return r(),{result:null}},isSupported:async()=>{if(await new Promise((e=>{const t=new ArrayBuffer(0),{port1:r,port2:n}=new MessageChannel;r.onmessage=t=>{let{data:r}=t;return e(null!==r)},n.postMessage(t,[t])}))){const e=n();return{result:e instanceof Promise?await e:e}}return{result:!1}}}),f=function(e,t){const r=h(f,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0),n=d(e,r);return e.addEventListener("message",n),()=>e.removeEventListener("message",n)},p=e=>{e.onmessage=null,e.close()},w=new Map,m=new WeakMap,g=((e,t)=>r=>{const n=t.get(r);if(void 0===n)throw new Error("There is no encoder stored which wraps this port.");e.delete(n),t.delete(r)})(w,m),v=new Map,y=(e=>t=>{const r=e.get(t);if(void 0===r)throw new Error("There was no instance of an encoder stored with the given id.");return r})(v),M=((e,t)=>r=>{const n=t(r);return e.delete(r),n})(v,y),E=((e,t)=>r=>{const[n,o,s,a]=t(r);return s?new Promise((t=>{o.onmessage=s=>{let{data:i}=s;0===i.length?(e(o),t(n.encode(r,null))):n.record(r,a,i)}})):n.encode(r,null)})(p,M),b=(e=>t=>{for(const[r,n]of Array.from(e.values()))if(r.test(t))return n;throw new Error("There is no encoder registered which could handle the given mimeType.")})(w),T=((e,t,r)=>(n,o,s)=>{if(t.has(n))throw new Error('There is already an encoder registered with an id called "'.concat(n,'".'));const a=r(o),{port1:i,port2:c}=new MessageChannel,l=[a,i,!0,s];return t.set(n,l),i.onmessage=t=>{let{data:r}=t;0===r.length?(e(i),l[2]=!1):a.record(n,s,r.map((e=>"number"==typeof e?new Float32Array(e):e)))},c})(p,v,b),I=((e,t,r)=>async n=>{const o=r(n),s=await o.characterize(),a=s.toString();if(e.has(a)||t.has(n))throw new Error("There is already an encoder stored which handles exactly the same mime types.");return e.set(a,[s,o]),t.set(n,a),s})(w,m,o),A=(e=>(t,r)=>{const[n]=e(t);return n.encode(t,r)})(y);f(self,{deregister:async e=>{let{port:t}=e;return{result:g(t)}},encode:async e=>{let{encoderId:t,timeslice:r}=e;const n=null===r?await E(t):await A(t,r);return{result:n,transferables:n}},instantiate:e=>{let{encoderId:t,mimeType:r,sampleRate:n}=e;const o=T(t,r,n);return{result:o,transferables:[o]}},register:async e=>{let{port:t}=e;return{result:await I(t)}}})})()})();`,Phe=new Blob([Ihe],{type:"application/javascript; charset=utf-8"}),y4=URL.createObjectURL(Phe),MC=The(y4),ov=MC.encode,b4=MC.instantiate,Mhe=MC.register;URL.revokeObjectURL(y4);const Ahe=e=>(t,n)=>{if(e===null){const{data:r,...o}=n,i=new Event(t,o);return i.data=r,i}return new e(t,n)},Dhe=(e,t)=>(n,r,o)=>{const i=[];let a=r,s=0;for(;s<n.byteLength;)if(a===null){const l=t(n,s);if(l===null)break;const{length:c,type:u}=l;a=u,s+=c}else{const l=e(n,s,a,o);if(l===null)break;const{content:c,length:u}=l;a=null,s+=u,c!==null&&i.push(c)}return{contents:i,currentElementType:a,offset:s}},Lhe=(e,t)=>class{constructor(r=null){this._listeners=new WeakMap,this._nativeEventTarget=r===null?e():r}addEventListener(r,o,i){if(o!==null){let a=this._listeners.get(o);a===void 0&&(a=t(this,o),typeof o=="function"&&this._listeners.set(o,a)),this._nativeEventTarget.addEventListener(r,a,i)}}dispatchEvent(r){return this._nativeEventTarget.dispatchEvent(r)}removeEventListener(r,o,i){const a=o===null?void 0:this._listeners.get(o);this._nativeEventTarget.removeEventListener(r,a===void 0?null:a,i)}},Rhe=e=>()=>{if(e===null)throw new Error("A native EventTarget could not be created.");return e.document.createElement("p")},AC=(e="")=>{try{return new DOMException(e,"InvalidModificationError")}catch(t){return t.code=13,t.message=e,t.name="InvalidModificationError",t}},khe=()=>{try{return new DOMException("","InvalidStateError")}catch(e){return e.code=11,e.name="InvalidStateError",e}},Fhe=e=>e!==null&&e.MediaStream!==void 0&&(e.MediaRecorder===void 0||e.MediaRecorder.isTypeSupported!==void 0)?new Promise(t=>{if(e.MediaRecorder===void 0)return t(!0);const n=document.createElement("canvas");if(n.getContext("2d"),typeof n.captureStream!="function")return t(!1);const r=n.captureStream(),o="audio/webm";try{const i=new e.MediaRecorder(r,{mimeType:o});i.addEventListener("dataavailable",({data:a})=>t(a.type===o)),i.start(),setTimeout(()=>i.stop(),10)}catch(i){t(i.name==="NotSupportedError")}}):Promise.resolve(!1),Bhe=(e,t,n,r,o,i,a)=>class extends i{constructor(l,c={}){const{mimeType:u}=c;if(a!==null&&(u===void 0||a.isTypeSupported!==void 0&&a.isTypeSupported(u))){const d=e(a,l,c);super(d),this._internalMediaRecorder=d}else if(u!==void 0&&o.some(d=>d.test(u)))super(),a!==null&&a.isTypeSupported!==void 0&&a.isTypeSupported("audio/webm;codecs=pcm")?this._internalMediaRecorder=r(this,a,l,u):this._internalMediaRecorder=n(this,l,u);else throw a!==null&&e(a,l,c),t();this._ondataavailable=null,this._onerror=null,this._onpause=null,this._onresume=null,this._onstart=null,this._onstop=null}get mimeType(){return this._internalMediaRecorder.mimeType}get ondataavailable(){return this._ondataavailable===null?this._ondataavailable:this._ondataavailable[0]}set ondataavailable(l){if(this._ondataavailable!==null&&this.removeEventListener("dataavailable",this._ondataavailable[1]),typeof l=="function"){const c=l.bind(this);this.addEventListener("dataavailable",c),this._ondataavailable=[l,c]}else this._ondataavailable=null}get onerror(){return this._onerror===null?this._onerror:this._onerror[0]}set onerror(l){if(this._onerror!==null&&this.removeEventListener("error",this._onerror[1]),typeof l=="function"){const c=l.bind(this);this.addEventListener("error",c),this._onerror=[l,c]}else this._onerror=null}get onpause(){return this._onpause===null?this._onpause:this._onpause[0]}set onpause(l){if(this._onpause!==null&&this.removeEventListener("pause",this._onpause[1]),typeof l=="function"){const c=l.bind(this);this.addEventListener("pause",c),this._onpause=[l,c]}else this._onpause=null}get onresume(){return this._onresume===null?this._onresume:this._onresume[0]}set onresume(l){if(this._onresume!==null&&this.removeEventListener("resume",this._onresume[1]),typeof l=="function"){const c=l.bind(this);this.addEventListener("resume",c),this._onresume=[l,c]}else this._onresume=null}get onstart(){return this._onstart===null?this._onstart:this._onstart[0]}set onstart(l){if(this._onstart!==null&&this.removeEventListener("start",this._onstart[1]),typeof l=="function"){const c=l.bind(this);this.addEventListener("start",c),this._onstart=[l,c]}else this._onstart=null}get onstop(){return this._onstop===null?this._onstop:this._onstop[0]}set onstop(l){if(this._onstop!==null&&this.removeEventListener("stop",this._onstop[1]),typeof l=="function"){const c=l.bind(this);this.addEventListener("stop",c),this._onstop=[l,c]}else this._onstop=null}get state(){return this._internalMediaRecorder.state}pause(){return this._internalMediaRecorder.pause()}resume(){return this._internalMediaRecorder.resume()}start(l){return this._internalMediaRecorder.start(l)}stop(){return this._internalMediaRecorder.stop()}static isTypeSupported(l){return a!==null&&a.isTypeSupported!==void 0&&a.isTypeSupported(l)||o.some(c=>c.test(l))}},Vhe=e=>e!==null&&e.BlobEvent!==void 0?e.BlobEvent:null,zhe=(e,t)=>(n,r,o)=>{const i=[],a=new WeakMap,s=new WeakMap,l=new n(r,o),c=new WeakMap;let u=!0;return l.addEventListener=(d=>(h,p,y)=>{let b=p;return typeof p=="function"&&(h==="dataavailable"?(b=v=>{setTimeout(()=>{if(u&&l.state==="inactive")i.push(v.data);else{if(i.length>0){const w=v.data;Object.defineProperty(v,"data",{value:new Blob([...i,w],{type:w.type})}),i.length=0}p.call(l,v)}})},a.set(p,b)):h==="error"?(b=v=>{if(v.error===void 0)p.call(l,new ErrorEvent("error",{error:e()}));else if(v.error.name==="UnknownError"){const w=v.error.message;p.call(l,new ErrorEvent("error",{error:e(w)}))}else v instanceof ErrorEvent?p.call(l,v):p.call(l,new ErrorEvent("error",{error:v.error}))},s.set(p,b)):h==="stop"&&(b=v=>{u=!1,setTimeout(()=>p.call(l,v))},c.set(p,b))),d.call(l,h,b,y)})(l.addEventListener),l.dispatchEvent=(d=>h=>{let p;setTimeout(()=>{p=u,u=!1});const y=d.call(l,h);return setTimeout(()=>u=p),y})(l.dispatchEvent),l.removeEventListener=(d=>(h,p,y)=>{let b=p;if(typeof p=="function"){if(h==="dataavailable"){const v=a.get(p);v!==void 0&&(b=v)}else if(h==="error"){const v=s.get(p);v!==void 0&&(b=v)}else if(h==="stop"){const v=c.get(p);v!==void 0&&(b=v)}}return d.call(l,h,b,y)})(l.removeEventListener),l.start=(d=>h=>{if(o.mimeType!==void 0&&o.mimeType.startsWith("audio/")&&r.getVideoTracks().length>0)throw t();return u=h!==void 0,h===void 0?d.call(l):d.call(l,h)})(l.start),l},jhe=e=>e===null||e.MediaRecorder===void 0?null:e.MediaRecorder,iv=()=>{try{return new DOMException("","NotSupportedError")}catch(e){return e.code=9,e.name="NotSupportedError",e}},Hhe=e=>(t,n,r,o=2)=>{const i=e(t,n);if(i===null)return i;const{length:a,value:s}=i;if(r==="master")return{content:null,length:a};if(n+a+s>t.byteLength)return null;if(r==="binary"){const l=(s/Float32Array.BYTES_PER_ELEMENT-1)/o,c=Array.from({length:o},()=>new Float32Array(l));for(let u=0;u<l;u+=1){const d=u*o+1;for(let h=0;h<o;h+=1)c[h][u]=t.getFloat32(n+a+(d+h)*Float32Array.BYTES_PER_ELEMENT,!0)}return{content:c,length:a+s}}return{content:null,length:a+s}},Whe=e=>(t,n)=>{const r=e(t,n);if(r===null)return r;const{length:o,value:i}=r;return i===35?{length:o,type:"binary"}:i===46||i===97||i===88713574||i===106212971||i===139690087||i===172351395||i===256095861?{length:o,type:"master"}:{length:o,type:"unknown"}},Uhe=e=>(t,n)=>{const r=e(t,n);if(r===null)return r;const o=n+Math.floor((r-1)/8);if(o+r>t.byteLength)return null;let a=t.getUint8(o)&(1<<8-r%8)-1;for(let s=1;s<r;s+=1)a=(a<<8)+t.getUint8(o+s);return{length:r,value:a}},qhe=e=>(t,n)=>(e.set(t,n),n),w4=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,C4=536870912,x4=C4*2,Ghe=(e,t)=>n=>{const r=t.get(n);let o=r===void 0?n.size:r<x4?r+1:0;if(!n.has(o))return e(n,o);if(n.size<C4){for(;n.has(o);)o=Math.floor(Math.random()*x4);return e(n,o)}if(n.size>w4)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;n.has(o);)o=Math.floor(Math.random()*w4);return e(n,o)},S4=new WeakMap,Khe=qhe(S4),Xhe=Ghe(Khe,S4),E4=Symbol.observable||"@@observable";function Yhe(e){return Symbol.observable||(typeof e=="function"&&e.prototype&&e.prototype[Symbol.observable]?(e.prototype[E4]=e.prototype[Symbol.observable],delete e.prototype[Symbol.observable]):(e[E4]=e[Symbol.observable],delete e[Symbol.observable])),e}const av=()=>{},$4=e=>{throw e};function Qhe(e){return e?e.next&&e.error&&e.complete?e:{complete:(e.complete??av).bind(e),error:(e.error??$4).bind(e),next:(e.next??av).bind(e)}:{complete:av,error:$4,next:av}}const Zhe=e=>(t,n,r)=>e(o=>{const i=a=>o.next(a);return t.addEventListener(n,i,r),()=>t.removeEventListener(n,i,r)}),Jhe=((e,t)=>{const n=()=>{},r=o=>typeof o[0]=="function";return o=>{const i=(...a)=>{const s=o(r(a)?t({next:a[0]}):t(...a));return s!==void 0?s:n};return i[Symbol.observable]=()=>({subscribe:(...a)=>({unsubscribe:i(...a)})}),e(i)}})(Yhe,Qhe),_4=Zhe(Jhe);/*!
|
|
388
|
+
`},hue={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 pue(e){let{announcements:t=hue,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=fue}=e;const{announce:i,announcement:a}=cue(),s=Vf("DndLiveRegion"),[l,c]=T.useState(!1);if(T.useEffect(()=>{c(!0)},[]),uue(T.useMemo(()=>({onDragStart(d){let{active:h}=d;i(t.onDragStart({active:h}))},onDragMove(d){let{active:h,over:p}=d;t.onDragMove&&i(t.onDragMove({active:h,over:p}))},onDragOver(d){let{active:h,over:p}=d;i(t.onDragOver({active:h,over:p}))},onDragEnd(d){let{active:h,over:p}=d;i(t.onDragEnd({active:h,over:p}))},onDragCancel(d){let{active:h,over:p}=d;i(t.onDragCancel({active:h,over:p}))}}),[i,t])),!l)return null;const u=T.createElement(T.Fragment,null,T.createElement(sue,{id:r,value:o.draggable}),T.createElement(lue,{id:s,announcement:a}));return n?ur.createPortal(u,n):u}var wr;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(wr||(wr={}));function Wg(){}function i3(e,t){return T.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function mue(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return T.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const Fi=Object.freeze({x:0,y:0});function a3(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function s3(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function gue(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function l3(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function c3(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function u3(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const vue=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=u3(t,t.left,t.top),i=[];for(const a of r){const{id:s}=a,l=n.get(s);if(l){const c=a3(u3(l),o);i.push({id:s,data:{droppableContainer:a,value:c}})}}return i.sort(s3)},yue=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=l3(t),i=[];for(const a of r){const{id:s}=a,l=n.get(s);if(l){const c=l3(l),u=o.reduce((h,p,y)=>h+a3(c[y],p),0),d=Number((u/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(s3)};function bue(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,s=i-n;if(r<o&&n<i){const l=t.width*t.height,c=e.width*e.height,u=a*s,d=u/(l+c-u);return Number(d.toFixed(4))}return 0}const wue=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:a}=i,s=n.get(a);if(s){const l=bue(s,t);l>0&&o.push({id:a,data:{droppableContainer:i,value:l}})}}return o.sort(gue)};function Cue(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function d3(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Fi}function xue(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((a,s)=>({...a,top:a.top+e*s.y,bottom:a.bottom+e*s.y,left:a.left+e*s.x,right:a.right+e*s.x}),{...n})}}const Sue=xue(1);function Eue(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function $ue(e,t,n){const r=Eue(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:s}=r,l=e.left-a-(1-o)*parseFloat(n),c=e.top-s-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}const _ue={ignoreTransform:!1};function uu(e,t){t===void 0&&(t=_ue);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=wo(e).getComputedStyle(e);c&&(n=$ue(n,c,u))}const{top:r,left:o,width:i,height:a,bottom:s,right:l}=n;return{top:r,left:o,width:i,height:a,bottom:s,right:l}}function f3(e){return uu(e,{ignoreTransform:!0})}function Oue(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Nue(e,t){return t===void 0&&(t=wo(e).getComputedStyle(e)),t.position==="fixed"}function Tue(e,t){t===void 0&&(t=wo(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function Ug(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(dC(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!kf(o)||t3(o)||n.includes(o))return n;const i=wo(e).getComputedStyle(o);return o!==e&&Tue(o,i)&&n.push(o),Nue(o,i)?n:r(o.parentNode)}return e?r(e):n}function h3(e){const[t]=Ug(e,1);return t??null}function vC(e){return!zg||!e?null:su(e)?e:uC(e)?dC(e)||e===lu(e).scrollingElement?window:kf(e)?e:null:null}function p3(e){return su(e)?e.scrollX:e.scrollLeft}function m3(e){return su(e)?e.scrollY:e.scrollTop}function yC(e){return{x:p3(e),y:m3(e)}}var Pr;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Pr||(Pr={}));function g3(e){return!zg||!e?!1:e===document.scrollingElement}function v3(e){const t={x:0,y:0},n=g3(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,s=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:a,isRight:s,maxScroll:r,minScroll:t}}const Iue={x:.2,y:.2};function Pue(e,t,n,r,o){let{top:i,left:a,right:s,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=Iue);const{isTop:c,isBottom:u,isLeft:d,isRight:h}=v3(e),p={x:0,y:0},y={x:0,y:0},b={height:t.height*o.y,width:t.width*o.x};return!c&&i<=t.top+b.height?(p.y=Pr.Backward,y.y=r*Math.abs((t.top+b.height-i)/b.height)):!u&&l>=t.bottom-b.height&&(p.y=Pr.Forward,y.y=r*Math.abs((t.bottom-b.height-l)/b.height)),!h&&s>=t.right-b.width?(p.x=Pr.Forward,y.x=r*Math.abs((t.right-b.width-s)/b.width)):!d&&a<=t.left+b.width&&(p.x=Pr.Backward,y.x=r*Math.abs((t.left+b.width-a)/b.width)),{direction:p,speed:y}}function Mue(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function y3(e){return e.reduce((t,n)=>cu(t,yC(n)),Fi)}function Aue(e){return e.reduce((t,n)=>t+p3(n),0)}function Due(e){return e.reduce((t,n)=>t+m3(n),0)}function Lue(e,t){if(t===void 0&&(t=uu),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);h3(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Rue=[["x",["left","right"],Aue],["y",["top","bottom"],Due]];class bC{constructor(t,n){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;const r=Ug(n),o=y3(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,s]of Rue)for(const l of a)Object.defineProperty(this,l,{get:()=>{const c=s(r),u=o[i]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class jf{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function kue(e){const{EventTarget:t}=wo(e);return e instanceof t?e:lu(e)}function wC(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?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:!1}var oi;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(oi||(oi={}));function b3(e){e.preventDefault()}function Fue(e){e.stopPropagation()}var Xt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Xt||(Xt={}));const w3={start:[Xt.Space,Xt.Enter],cancel:[Xt.Esc],end:[Xt.Space,Xt.Enter,Xt.Tab]},Bue=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Xt.Right:return{...n,x:n.x+25};case Xt.Left:return{...n,x:n.x-25};case Xt.Down:return{...n,y:n.y+25};case Xt.Up:return{...n,y:n.y-25}}};class CC{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new jf(lu(n)),this.windowListeners=new jf(wo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(oi.Resize,this.handleCancel),this.windowListeners.add(oi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(oi.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Lue(r),n(Fi)}handleKeyDown(t){if(mC(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=w3,coordinateGetter:a=Bue,scrollBehavior:s="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:Fi;this.referenceCoordinates||(this.referenceCoordinates=u);const d=a(t,{active:n,context:r.current,currentCoordinates:u});if(d){const h=zf(d,u),p={x:0,y:0},{scrollableAncestors:y}=r.current;for(const b of y){const v=t.code,{isTop:w,isRight:x,isLeft:C,isBottom:S,maxScroll:E,minScroll:$}=v3(b),O=Mue(b),N={x:Math.min(v===Xt.Right?O.right-O.width/2:O.right,Math.max(v===Xt.Right?O.left:O.left+O.width/2,d.x)),y:Math.min(v===Xt.Down?O.bottom-O.height/2:O.bottom,Math.max(v===Xt.Down?O.top:O.top+O.height/2,d.y))},I=v===Xt.Right&&!x||v===Xt.Left&&!C,M=v===Xt.Down&&!S||v===Xt.Up&&!w;if(I&&N.x!==d.x){const A=b.scrollLeft+h.x,z=v===Xt.Right&&A<=E.x||v===Xt.Left&&A>=$.x;if(z&&!h.y){b.scrollTo({left:A,behavior:s});return}z?p.x=b.scrollLeft-A:p.x=v===Xt.Right?b.scrollLeft-E.x:b.scrollLeft-$.x,p.x&&b.scrollBy({left:-p.x,behavior:s});break}else if(M&&N.y!==d.y){const A=b.scrollTop+h.y,z=v===Xt.Down&&A<=E.y||v===Xt.Up&&A>=$.y;if(z&&!h.x){b.scrollTo({top:A,behavior:s});return}z?p.y=b.scrollTop-A:p.y=v===Xt.Down?b.scrollTop-E.y:b.scrollTop-$.y,p.y&&b.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(t,cu(zf(d,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}CC.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=w3,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const s=i.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function C3(e){return!!(e&&"distance"in e)}function x3(e){return!!(e&&"delay"in e)}class xC{constructor(t,n,r){var o;r===void 0&&(r=kue(t.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=t,this.events=n;const{event:i}=t,{target:a}=i;this.props=t,this.events=n,this.document=lu(a),this.documentListeners=new jf(this.document),this.listeners=new jf(r),this.windowListeners=new jf(wo(a)),this.initialCoordinates=(o=gC(i))!=null?o:Fi,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(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(oi.Resize,this.handleCancel),this.windowListeners.add(oi.DragStart,b3),this.windowListeners.add(oi.VisibilityChange,this.handleCancel),this.windowListeners.add(oi.ContextMenu,b3),this.documentListeners.add(oi.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(x3(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(C3(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(oi.Click,Fue,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(oi.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:s}}=i;if(!o)return;const l=(n=gC(t))!=null?n:Fi,c=zf(o,l);if(!r&&s){if(C3(s)){if(s.tolerance!=null&&wC(c,s.tolerance))return this.handleCancel();if(wC(c,s.distance))return this.handleStart()}if(x3(s)&&wC(c,s.tolerance))return this.handleCancel();this.handlePending(s,c);return}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Xt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Vue={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class SC extends xC{constructor(t){const{event:n}=t,r=lu(n.target);super(t,Vue,r)}}SC.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const zue={move:{name:"mousemove"},end:{name:"mouseup"}};var EC;(function(e){e[e.RightClick=2]="RightClick"})(EC||(EC={}));class jue extends xC{constructor(t){super(t,zue,lu(t.event.target))}}jue.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===EC.RightClick?!1:(r==null||r({event:n}),!0)}}];const $C={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Hue extends xC{constructor(t){super(t,$C)}static setup(){return window.addEventListener($C.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener($C.move.name,t)};function t(){}}}Hue.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var Hf;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Hf||(Hf={}));var qg;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(qg||(qg={}));function Wue(e){let{acceleration:t,activator:n=Hf.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:s=qg.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:h}=e;const p=que({delta:d,disabled:!i}),[y,b]=nue(),v=T.useRef({x:0,y:0}),w=T.useRef({x:0,y:0}),x=T.useMemo(()=>{switch(n){case Hf.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Hf.DraggableRect:return o}},[n,o,l]),C=T.useRef(null),S=T.useCallback(()=>{const $=C.current;if(!$)return;const O=v.current.x*w.current.x,N=v.current.y*w.current.y;$.scrollBy(O,N)},[]),E=T.useMemo(()=>s===qg.TreeOrder?[...c].reverse():c,[s,c]);T.useEffect(()=>{if(!i||!c.length||!x){b();return}for(const $ of E){if((r==null?void 0:r($))===!1)continue;const O=c.indexOf($),N=u[O];if(!N)continue;const{direction:I,speed:M}=Pue($,N,x,t,h);for(const A of["x","y"])p[A][I[A]]||(M[A]=0,I[A]=0);if(M.x>0||M.y>0){b(),C.current=$,y(S,a),v.current=M,w.current=I;return}}v.current={x:0,y:0},w.current={x:0,y:0},b()},[t,S,r,b,i,a,JSON.stringify(x),JSON.stringify(p),y,c,E,u,JSON.stringify(h)])}const Uue={x:{[Pr.Backward]:!1,[Pr.Forward]:!1},y:{[Pr.Backward]:!1,[Pr.Forward]:!1}};function que(e){let{delta:t,disabled:n}=e;const r=hC(t);return Bf(o=>{if(n||!r||!o)return Uue;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Pr.Backward]:o.x[Pr.Backward]||i.x===-1,[Pr.Forward]:o.x[Pr.Forward]||i.x===1},y:{[Pr.Backward]:o.y[Pr.Backward]||i.y===-1,[Pr.Forward]:o.y[Pr.Forward]||i.y===1}}},[n,t,r])}function Gue(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Bf(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function Kue(e,t){return T.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...i]},[]),[e,t])}var Wf;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Wf||(Wf={}));var _C;(function(e){e.Optimized="optimized"})(_C||(_C={}));const S3=new Map;function Xue(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=T.useState(null),{frequency:s,measure:l,strategy:c}=o,u=T.useRef(e),d=v(),h=Ff(d),p=T.useCallback(function(w){w===void 0&&(w=[]),!h.current&&a(x=>x===null?w:x.concat(w.filter(C=>!x.includes(C))))},[h]),y=T.useRef(null),b=Bf(w=>{if(d&&!n)return S3;if(!w||w===S3||u.current!==e||i!=null){const x=new Map;for(let C of e){if(!C)continue;if(i&&i.length>0&&!i.includes(C.id)&&C.rect.current){x.set(C.id,C.rect.current);continue}const S=C.node.current,E=S?new bC(l(S),S):null;C.rect.current=E,E&&x.set(C.id,E)}return x}return w},[e,i,n,d,l]);return T.useEffect(()=>{u.current=e},[e]),T.useEffect(()=>{d||p()},[n,d]),T.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),T.useEffect(()=>{d||typeof s!="number"||y.current!==null||(y.current=setTimeout(()=>{p(),y.current=null},s))},[s,d,p,...r]),{droppableRects:b,measureDroppableContainers:p,measuringScheduled:i!=null};function v(){switch(c){case Wf.Always:return!1;case Wf.BeforeDragging:return n;default:return!n}}}function E3(e,t){return Bf(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Yue(e,t){return E3(e,t)}function Que(e){let{callback:t,disabled:n}=e;const r=fC(t),o=T.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return T.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Gg(e){let{callback:t,disabled:n}=e;const r=fC(t),o=T.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return T.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Zue(e){return new bC(uu(e),e)}function $3(e,t,n){t===void 0&&(t=Zue);const[r,o]=T.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const a=Que({callback(l){if(e)for(const c of l){const{type:u,target:d}=c;if(u==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),s=Gg({callback:i});return pa(()=>{i(),e?(s==null||s.observe(e),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(s==null||s.disconnect(),a==null||a.disconnect())},[e]),r}function Jue(e){const t=E3(e);return d3(e,t)}const _3=[];function ede(e){const t=T.useRef(e),n=Bf(r=>e?r&&r!==_3&&e&&t.current&&e.parentNode===t.current.parentNode?r:Ug(e):_3,[e]);return T.useEffect(()=>{t.current=e},[e]),n}function tde(e){const[t,n]=T.useState(null),r=T.useRef(e),o=T.useCallback(i=>{const a=vC(i.target);a&&n(s=>s?(s.set(a,yC(a)),new Map(s)):null)},[]);return T.useEffect(()=>{const i=r.current;if(e!==i){a(i);const s=e.map(l=>{const c=vC(l);return c?(c.addEventListener("scroll",o,{passive:!0}),[c,yC(c)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),r.current=e}return()=>{a(e),a(i)};function a(s){s.forEach(l=>{const c=vC(l);c==null||c.removeEventListener("scroll",o)})}},[o,e]),T.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>cu(i,a),Fi):y3(e):Fi,[e,t])}function O3(e,t){t===void 0&&(t=[]);const n=T.useRef(null);return T.useEffect(()=>{n.current=null},t),T.useEffect(()=>{const r=e!==Fi;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?zf(e,n.current):Fi}function nde(e){T.useEffect(()=>{if(!zg)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function rde(e,t){return T.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=a=>{i(a,t)},n},{}),[e,t])}function N3(e){return T.useMemo(()=>e?Oue(e):null,[e])}const T3=[];function ode(e,t){t===void 0&&(t=uu);const[n]=e,r=N3(n?wo(n):null),[o,i]=T.useState(T3);function a(){i(()=>e.length?e.map(l=>g3(l)?r:new bC(t(l),l)):T3)}const s=Gg({callback:a});return pa(()=>{s==null||s.disconnect(),a(),e.forEach(l=>s==null?void 0:s.observe(l))},[e]),o}function ide(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return kf(t)?t:e}function ade(e){let{measure:t}=e;const[n,r]=T.useState(null),o=T.useCallback(c=>{for(const{target:u}of c)if(kf(u)){r(d=>{const h=t(u);return d?{...d,width:h.width,height:h.height}:h});break}},[t]),i=Gg({callback:o}),a=T.useCallback(c=>{const u=ide(c);i==null||i.disconnect(),u&&(i==null||i.observe(u)),r(u?t(u):null)},[t,i]),[s,l]=jg(a);return T.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}const sde=[{sensor:SC,options:{}},{sensor:CC,options:{}}],lde={current:{}},Kg={draggable:{measure:f3},droppable:{measure:f3,strategy:Wf.WhileDragging,frequency:_C.Optimized},dragOverlay:{measure:uu}};class Uf extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const cde={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Uf,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Wg},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Kg,measureDroppableContainers:Wg,windowRect:null,measuringScheduled:!1},ude={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Wg,draggableNodes:new Map,over:null,measureDroppableContainers:Wg},Xg=T.createContext(ude),I3=T.createContext(cde);function dde(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Uf}}}function fde(e,t){switch(t.type){case wr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case wr.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case wr.DragEnd:case wr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case wr.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Uf(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case wr.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new Uf(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case wr.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Uf(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function hde(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=T.useContext(Xg),i=hC(r),a=hC(n==null?void 0:n.id);return T.useEffect(()=>{if(!t&&!r&&i&&a!=null){if(!mC(i)||document.activeElement===i.target)return;const s=o.get(a);if(!s)return;const{activatorNode:l,node:c}=s;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const d=iue(u);if(d){d.focus();break}}})}},[r,t,o,a,i]),null}function pde(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function mde(e){return T.useMemo(()=>({draggable:{...Kg.draggable,...e==null?void 0:e.draggable},droppable:{...Kg.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Kg.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function gde(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=T.useRef(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;pa(()=>{if(!a&&!s||!t){i.current=!1;return}if(i.current||!r)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const u=n(c),d=d3(u,r);if(a||(d.x=0),s||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const h=h3(c);h&&h.scrollBy({top:d.y,left:d.x})}},[t,a,s,r,n])}const P3=T.createContext({...Fi,scaleX:1,scaleY:1});var Ns;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ns||(Ns={}));const vde=T.memo(function(t){var n,r,o,i;let{id:a,accessibility:s,autoScroll:l=!0,children:c,sensors:u=sde,collisionDetection:d=wue,measuring:h,modifiers:p,...y}=t;const b=T.useReducer(fde,void 0,dde),[v,w]=b,[x,C]=due(),[S,E]=T.useState(Ns.Uninitialized),$=S===Ns.Initialized,{draggable:{active:O,nodes:N,translate:I},droppable:{containers:M}}=v,A=O!=null?N.get(O):null,z=T.useRef({initial:null,translated:null}),B=T.useMemo(()=>{var je;return O!=null?{id:O,data:(je=A==null?void 0:A.data)!=null?je:lde,rect:z}:null},[O,A]),P=T.useRef(null),[F,R]=T.useState(null),[L,V]=T.useState(null),j=Ff(y,Object.values(y)),W=Vf("DndDescribedBy",a),U=T.useMemo(()=>M.getEnabled(),[M]),G=mde(h),{droppableRects:q,measureDroppableContainers:Y,measuringScheduled:K}=Xue(U,{dragging:$,dependencies:[I.x,I.y],config:G.droppable}),J=Gue(N,O),le=T.useMemo(()=>L?gC(L):null,[L]),Z=on(),ie=Yue(J,G.draggable.measure);gde({activeNode:O!=null?N.get(O):null,config:Z.layoutShiftCompensation,initialRect:ie,measure:G.draggable.measure});const de=$3(J,G.draggable.measure,ie),ce=$3(J?J.parentElement:null),ue=T.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),pe=M.getNodeFor((n=ue.current.over)==null?void 0:n.id),te=ade({measure:G.dragOverlay.measure}),re=(r=te.nodeRef.current)!=null?r:J,fe=$?(o=te.rect)!=null?o:de:null,be=!!(te.nodeRef.current&&te.rect),_e=Jue(be?null:de),xe=N3(re?wo(re):null),Oe=ede($?pe??J:null),ye=ode(Oe),Re=pde(p,{transform:{x:I.x-_e.x,y:I.y-_e.y,scaleX:1,scaleY:1},activatorEvent:L,active:B,activeNodeRect:de,containerNodeRect:ce,draggingNodeRect:fe,over:ue.current.over,overlayNodeRect:te.rect,scrollableAncestors:Oe,scrollableAncestorRects:ye,windowRect:xe}),Pe=le?cu(le,I):null,we=tde(Oe),Ae=O3(we),Be=O3(we,[de]),ft=cu(Re,Ae),qe=fe?Sue(fe,Re):null,Xe=B&&qe?d({active:B,collisionRect:qe,droppableRects:q,droppableContainers:U,pointerCoordinates:Pe}):null,pt=c3(Xe,"id"),[Je,dt]=T.useState(null),nt=be?Re:cu(Re,Be),De=Cue(nt,(i=Je==null?void 0:Je.rect)!=null?i:null,de),ze=T.useRef(null),Se=T.useCallback((je,He)=>{let{sensor:et,options:Ve}=He;if(P.current==null)return;const st=N.get(P.current);if(!st)return;const Ue=je.nativeEvent,Qe=new et({active:P.current,activeNode:st,event:Ue,options:Ve,context:ue,onAbort(Ze){if(!N.get(Ze))return;const{onDragAbort:Jt}=j.current,yt={id:Ze};Jt==null||Jt(yt),x({type:"onDragAbort",event:yt})},onPending(Ze,mt,Jt,yt){if(!N.get(Ze))return;const{onDragPending:Zn}=j.current,Ot={id:Ze,constraint:mt,initialCoordinates:Jt,offset:yt};Zn==null||Zn(Ot),x({type:"onDragPending",event:Ot})},onStart(Ze){const mt=P.current;if(mt==null)return;const Jt=N.get(mt);if(!Jt)return;const{onDragStart:yt}=j.current,Pn={activatorEvent:Ue,active:{id:mt,data:Jt.data,rect:z}};ur.unstable_batchedUpdates(()=>{yt==null||yt(Pn),E(Ns.Initializing),w({type:wr.DragStart,initialCoordinates:Ze,active:mt}),x({type:"onDragStart",event:Pn}),R(ze.current),V(Ue)})},onMove(Ze){w({type:wr.DragMove,coordinates:Ze})},onEnd:ot(wr.DragEnd),onCancel:ot(wr.DragCancel)});ze.current=Qe;function ot(Ze){return async function(){const{active:Jt,collisions:yt,over:Pn,scrollAdjustedTranslate:Zn}=ue.current;let Ot=null;if(Jt&&Zn){const{cancelDrop:Mt}=j.current;Ot={activatorEvent:Ue,active:Jt,collisions:yt,delta:Zn,over:Pn},Ze===wr.DragEnd&&typeof Mt=="function"&&await Promise.resolve(Mt(Ot))&&(Ze=wr.DragCancel)}P.current=null,ur.unstable_batchedUpdates(()=>{w({type:Ze}),E(Ns.Uninitialized),dt(null),R(null),V(null),ze.current=null;const Mt=Ze===wr.DragEnd?"onDragEnd":"onDragCancel";if(Ot){const xn=j.current[Mt];xn==null||xn(Ot),x({type:Mt,event:Ot})}})}}},[N]),Te=T.useCallback((je,He)=>(et,Ve)=>{const st=et.nativeEvent,Ue=N.get(Ve);if(P.current!==null||!Ue||st.dndKit||st.defaultPrevented)return;const Qe={active:Ue};je(et,He.options,Qe)===!0&&(st.dndKit={capturedBy:He.sensor},P.current=Ve,Se(et,He))},[N,Se]),Ye=Kue(u,Te);nde(u),pa(()=>{de&&S===Ns.Initializing&&E(Ns.Initialized)},[de,S]),T.useEffect(()=>{const{onDragMove:je}=j.current,{active:He,activatorEvent:et,collisions:Ve,over:st}=ue.current;if(!He||!et)return;const Ue={active:He,activatorEvent:et,collisions:Ve,delta:{x:ft.x,y:ft.y},over:st};ur.unstable_batchedUpdates(()=>{je==null||je(Ue),x({type:"onDragMove",event:Ue})})},[ft.x,ft.y]),T.useEffect(()=>{const{active:je,activatorEvent:He,collisions:et,droppableContainers:Ve,scrollAdjustedTranslate:st}=ue.current;if(!je||P.current==null||!He||!st)return;const{onDragOver:Ue}=j.current,Qe=Ve.get(pt),ot=Qe&&Qe.rect.current?{id:Qe.id,rect:Qe.rect.current,data:Qe.data,disabled:Qe.disabled}:null,Ze={active:je,activatorEvent:He,collisions:et,delta:{x:st.x,y:st.y},over:ot};ur.unstable_batchedUpdates(()=>{dt(ot),Ue==null||Ue(Ze),x({type:"onDragOver",event:Ze})})},[pt]),pa(()=>{ue.current={activatorEvent:L,active:B,activeNode:J,collisionRect:qe,collisions:Xe,droppableRects:q,draggableNodes:N,draggingNode:re,draggingNodeRect:fe,droppableContainers:M,over:Je,scrollableAncestors:Oe,scrollAdjustedTranslate:ft},z.current={initial:fe,translated:qe}},[B,J,Xe,qe,N,re,fe,q,M,Je,Oe,ft]),Wue({...Z,delta:I,draggingRect:qe,pointerCoordinates:Pe,scrollableAncestors:Oe,scrollableAncestorRects:ye});const At=T.useMemo(()=>({active:B,activeNode:J,activeNodeRect:de,activatorEvent:L,collisions:Xe,containerNodeRect:ce,dragOverlay:te,draggableNodes:N,droppableContainers:M,droppableRects:q,over:Je,measureDroppableContainers:Y,scrollableAncestors:Oe,scrollableAncestorRects:ye,measuringConfiguration:G,measuringScheduled:K,windowRect:xe}),[B,J,de,L,Xe,ce,te,N,M,q,Je,Y,Oe,ye,G,K,xe]),sn=T.useMemo(()=>({activatorEvent:L,activators:Ye,active:B,activeNodeRect:de,ariaDescribedById:{draggable:W},dispatch:w,draggableNodes:N,over:Je,measureDroppableContainers:Y}),[L,Ye,B,de,w,W,N,Je,Y]);return T.createElement(o3.Provider,{value:C},T.createElement(Xg.Provider,{value:sn},T.createElement(I3.Provider,{value:At},T.createElement(P3.Provider,{value:De},c)),T.createElement(hde,{disabled:(s==null?void 0:s.restoreFocus)===!1})),T.createElement(pue,{...s,hiddenTextDescribedById:W}));function on(){const je=(F==null?void 0:F.autoScrollEnabled)===!1,He=typeof l=="object"?l.enabled===!1:l===!1,et=$&&!je&&!He;return typeof l=="object"?{...l,enabled:et}:{enabled:et}}}),yde=T.createContext(null),M3="button",bde="Draggable";function wde(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Vf(bde),{activators:a,activatorEvent:s,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:h}=T.useContext(Xg),{role:p=M3,roleDescription:y="draggable",tabIndex:b=0}=o??{},v=(l==null?void 0:l.id)===t,w=T.useContext(v?P3:yde),[x,C]=jg(),[S,E]=jg(),$=rde(a,t),O=Ff(n);pa(()=>(d.set(t,{id:t,key:i,node:x,activatorNode:S,data:O}),()=>{const I=d.get(t);I&&I.key===i&&d.delete(t)}),[d,t]);const N=T.useMemo(()=>({role:p,tabIndex:b,"aria-disabled":r,"aria-pressed":v&&p===M3?!0:void 0,"aria-roledescription":y,"aria-describedby":u.draggable}),[r,p,b,v,y,u.draggable]);return{active:l,activatorEvent:s,activeNodeRect:c,attributes:N,isDragging:v,listeners:r?void 0:$,node:x,over:h,setNodeRef:C,setActivatorNodeRef:E,transform:w}}function Cde(){return T.useContext(I3)}const xde="Droppable",Sde={timeout:25};function Ede(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Vf(xde),{active:a,dispatch:s,over:l,measureDroppableContainers:c}=T.useContext(Xg),u=T.useRef({disabled:n}),d=T.useRef(!1),h=T.useRef(null),p=T.useRef(null),{disabled:y,updateMeasurementsFor:b,timeout:v}={...Sde,...o},w=Ff(b??r),x=T.useCallback(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(w.current)?w.current:[w.current]),p.current=null},v)},[v]),C=Gg({callback:x,disabled:y||!a}),S=T.useCallback((N,I)=>{C&&(I&&(C.unobserve(I),d.current=!1),N&&C.observe(N))},[C]),[E,$]=jg(S),O=Ff(t);return T.useEffect(()=>{!C||!E.current||(C.disconnect(),d.current=!1,C.observe(E.current))},[E,C]),T.useEffect(()=>(s({type:wr.RegisterDroppable,element:{id:r,key:i,disabled:n,node:E,rect:h,data:O}}),()=>s({type:wr.UnregisterDroppable,key:i,id:r})),[r]),T.useEffect(()=>{n!==u.current.disabled&&(s({type:wr.SetDroppableDisabled,id:r,key:i,disabled:n}),u.current.disabled=n)},[r,i,n,s]),{active:a,rect:h,isOver:(l==null?void 0:l.id)===r,node:E,over:l,setNodeRef:$}}function OC(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function $de(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function Yg(e){return e!==null&&e>=0}function _de(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ode(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const A3=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=OC(t,r,n),a=t[o],s=i[o];return!s||!a?null:{x:s.left-a.left,y:s.top-a.top,scaleX:s.width/a.width,scaleY:s.height/a.height}},Qg={scaleX:1,scaleY:1},Nde=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const s=(t=i[n])!=null?t:r;if(!s)return null;if(o===n){const c=i[a];return c?{x:0,y:n<a?c.top+c.height-(s.top+s.height):c.top-s.top,...Qg}:null}const l=Tde(i,o,n);return o>n&&o<=a?{x:0,y:-s.height-l,...Qg}:o<n&&o>=a?{x:0,y:s.height+l,...Qg}:{x:0,y:0,...Qg}};function Tde(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const D3="Sortable",L3=T.createContext({activeIndex:-1,containerId:D3,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:A3,disabled:{draggable:!1,droppable:!1}});function Ide(e){let{children:t,id:n,items:r,strategy:o=A3,disabled:i=!1}=e;const{active:a,dragOverlay:s,droppableRects:l,over:c,measureDroppableContainers:u}=Cde(),d=Vf(D3,n),h=s.rect!==null,p=T.useMemo(()=>r.map($=>typeof $=="object"&&"id"in $?$.id:$),[r]),y=a!=null,b=a?p.indexOf(a.id):-1,v=c?p.indexOf(c.id):-1,w=T.useRef(p),x=!_de(p,w.current),C=v!==-1&&b===-1||x,S=Ode(i);pa(()=>{x&&y&&u(p)},[x,p,y,u]),T.useEffect(()=>{w.current=p},[p]);const E=T.useMemo(()=>({activeIndex:b,containerId:d,disabled:S,disableTransforms:C,items:p,overIndex:v,useDragOverlay:h,sortedRects:$de(p,l),strategy:o}),[b,d,S.draggable,S.droppable,C,p,v,l,h,o]);return T.createElement(L3.Provider,{value:E},t)}const Pde=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return OC(n,r,o).indexOf(t)},Mde=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:s,previousContainerId:l,transition:c}=e;return!c||!r||s!==i&&o===a?!1:n?!0:a!==o&&t===l},Ade={duration:200,easing:"ease"},R3="transform",Dde=Hg.Transition.toString({property:R3,duration:0,easing:"linear"}),Lde={roleDescription:"sortable"};function Rde(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=T.useState(null),s=T.useRef(n);return pa(()=>{if(!t&&n!==s.current&&r.current){const l=o.current;if(l){const c=uu(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&a(u)}}n!==s.current&&(s.current=n)},[t,n,r,o]),T.useEffect(()=>{i&&a(null)},[i]),i}function kde(e){let{animateLayoutChanges:t=Mde,attributes:n,disabled:r,data:o,getNewIndex:i=Pde,id:a,strategy:s,resizeObserverConfig:l,transition:c=Ade}=e;const{items:u,containerId:d,activeIndex:h,disabled:p,disableTransforms:y,sortedRects:b,overIndex:v,useDragOverlay:w,strategy:x}=T.useContext(L3),C=Fde(r,p),S=u.indexOf(a),E=T.useMemo(()=>({sortable:{containerId:d,index:S,items:u},...o}),[d,o,S,u]),$=T.useMemo(()=>u.slice(u.indexOf(a)),[u,a]),{rect:O,node:N,isOver:I,setNodeRef:M}=Ede({id:a,data:E,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:$,...l}}),{active:A,activatorEvent:z,activeNodeRect:B,attributes:P,setNodeRef:F,listeners:R,isDragging:L,over:V,setActivatorNodeRef:j,transform:W}=wde({id:a,data:E,attributes:{...Lde,...n},disabled:C.draggable}),U=tue(M,F),G=!!A,q=G&&!y&&Yg(h)&&Yg(v),Y=!w&&L,K=Y&&q?W:null,le=q?K??(s??x)({rects:b,activeNodeRect:B,activeIndex:h,overIndex:v,index:S}):null,Z=Yg(h)&&Yg(v)?i({id:a,items:u,activeIndex:h,overIndex:v}):S,ie=A==null?void 0:A.id,de=T.useRef({activeId:ie,items:u,newIndex:Z,containerId:d}),ce=u!==de.current.items,ue=t({active:A,containerId:d,isDragging:L,isSorting:G,id:a,index:S,items:u,newIndex:de.current.newIndex,previousItems:de.current.items,previousContainerId:de.current.containerId,transition:c,wasDragging:de.current.activeId!=null}),pe=Rde({disabled:!ue,index:S,node:N,rect:O});return T.useEffect(()=>{G&&de.current.newIndex!==Z&&(de.current.newIndex=Z),d!==de.current.containerId&&(de.current.containerId=d),u!==de.current.items&&(de.current.items=u)},[G,Z,d,u]),T.useEffect(()=>{if(ie===de.current.activeId)return;if(ie!=null&&de.current.activeId==null){de.current.activeId=ie;return}const re=setTimeout(()=>{de.current.activeId=ie},50);return()=>clearTimeout(re)},[ie]),{active:A,activeIndex:h,attributes:P,data:E,rect:O,index:S,newIndex:Z,items:u,isOver:I,isSorting:G,isDragging:L,listeners:R,node:N,overIndex:v,over:V,setNodeRef:U,setActivatorNodeRef:j,setDroppableNodeRef:M,setDraggableNodeRef:F,transform:pe??le,transition:te()};function te(){if(pe||ce&&de.current.newIndex===S)return Dde;if(!(Y&&!mC(z)||!c)&&(G||ue))return Hg.Transition.toString({...c,property:R3})}}function Fde(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function Zg(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Bde=[Xt.Down,Xt.Right,Xt.Up,Xt.Left],Vde=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=t;if(Bde.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const h=o.get(d.id);if(h)switch(e.code){case Xt.Down:r.top<h.top&&l.push(d);break;case Xt.Up:r.top>h.top&&l.push(d);break;case Xt.Left:r.left>h.left&&l.push(d);break;case Xt.Right:r.left<h.left&&l.push(d);break}});const c=yue({collisionRect:r,droppableRects:o,droppableContainers:l});let u=c3(c,"id");if(u===(a==null?void 0:a.id)&&c.length>1&&(u=c[1].id),u!=null){const d=i.get(n.id),h=i.get(u),p=h?o.get(h.id):null,y=h==null?void 0:h.node.current;if(y&&p&&d&&h){const v=Ug(y).some(($,O)=>s[O]!==$),w=k3(d,h),x=zde(d,h),C=v||!w?{x:0,y:0}:{x:x?r.width-p.width:0,y:x?r.height-p.height:0},S={x:p.left,y:p.top};return C.x&&C.y?S:zf(S,C)}}}};function k3(e,t){return!Zg(e)||!Zg(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function zde(e,t){return!Zg(e)||!Zg(t)||!k3(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const F3="collapsed",NC="collapsing",Jg="expanding",ev="expanded",jde="collapse-css-transition",Hde="div",Wde="0px";function B3(e){requestAnimationFrame(function(){requestAnimationFrame(e)})}const jr=({children:e,transition:t,style:n,render:r,elementType:o=Hde,isOpen:i,collapseHeight:a=Wde,onInit:s,onChange:l,className:c=jde,addState:u,noAnim:d,overflowOnExpanded:h,...p})=>{const y=()=>a==="0px"?"hidden":void 0,[b,v]=T.useReducer(L=>L+1,0),w=T.useRef(),[x,C]=T.useState(0),S=T.useRef({collapse:i?ev:F3,style:{height:i?void 0:a,visibility:i?void 0:y()}}).current;T.useEffect(()=>{x&&E(l)},[x]);const E=(L,V={})=>{L&&L({state:S.collapse,style:S.style,...V})};function $(){w.current&&(S.collapse=F3,S.style={height:a,visibility:y()},v(),setTimeout(()=>C(Date.now),0))}function O(){if(w.current){if(d)return $();S.collapse=NC,S.style={height:M(),visibility:void 0},v(),B3(()=>{w.current&&S.collapse===NC&&(S.style={height:a,visibility:void 0},C(Date.now))})}}function N(){if(w.current){if(d)return I();S.collapse=Jg,B3(()=>{w.current&&S.collapse===Jg&&(S.style={height:M(),visibility:void 0},C(Date.now))})}}function I(){w.current&&(S.collapse=ev,S.style={height:void 0,visibility:void 0},v(),setTimeout(()=>C(Date.now),0))}function M(){return`${w.current.scrollHeight}px`}function A({target:L,propertyName:V}){if(L===w.current&&V==="height"){const j=L.style.height;switch(S.collapse){case Jg:j===void 0||j===a||I();break;case NC:j===void 0||j!==a||$();break}}}const z=S.collapse===ev||S.collapse===Jg;!z&&i&&N(),z&&!i&&O();const B={overflow:S.collapse===ev&&h?void 0:"hidden",transition:t,...n,...S.style},P=o,F=T.useCallback(L=>{L&&(w.current=L,E(s,{node:L}))},[o]),R=u?`${c} --c-${S.collapse}`:c;return k.jsx(P,{ref:F,style:B,onTransitionEnd:A,className:R,...p,children:typeof e=="function"?e(S.collapse):typeof r=="function"?r(S.collapse):e})};var Ude="scripts_editor_7lmk2x0",qde="scripts_editor_7lmk2x1",Gde="scripts_editor_7lmk2x2",Kde="scripts_editor_7lmk2x3",Xde="scripts_editor_7lmk2x5",Yde="scripts_editor_7lmk2x6",Qde="scripts_editor_7lmk2x7",Zde="scripts_editor_7lmk2x8",Jde="scripts_editor_7lmk2x9",efe="scripts_editor_7lmk2xa";const tfe=({item:e})=>{var y;const t=e.id,{attributes:n,listeners:r,setNodeRef:o,transform:i,transition:a,isDragging:s}=kde({id:e.id}),[l,c]=T.useState(!1),{Text:u}=hr,d={transform:i?`translate3d(${i.x}px, ${i.y}px, 0)`:void 0,transition:a},h=(y=e.id)==null?void 0:y.includes("condition-default-"),p=h?!1:l;return k.jsx("div",{ref:h?null:o,style:d,className:`${Ude} ${s?qde:""}`,children:k.jsxs(ua,{size:"small",className:`${Gde} ${s?Kde:""}`,styles:{body:{padding:"8px 12px 8px 4px",display:"flex",alignItems:"center"}},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[k.jsx(hn,{type:"text",size:"small",className:`${Xde} ${p?Yde:""}`,...n,...r,children:k.jsx(ZO,{className:Qde})}),k.jsx(u,{className:Zde,children:e.label}),k.jsx(ro,{type:"source",position:at.Right,id:t,className:Jde})]})})},{Text:nfe}=hr,rfe=({NODE_ID:e})=>{const{getNode:t,setNodes:n}=no(),{data:r}=t(e),o=r,i=cO(),a=o.conditions||[],s=mue(i3(SC,{activationConstraint:{distance:8}}),i3(CC,{coordinateGetter:Vde})),l=u=>{const{active:d,over:h}=u;if((d==null?void 0:d.id)!==(h==null?void 0:h.id)){const p=a.findIndex(b=>b.id===(d==null?void 0:d.id)),y=a.findIndex(b=>b.id===(h==null?void 0:h.id));n(b=>b.find(w=>w.id===e)?b.map(w=>w.id===e?{...w,data:{...w.data,conditions:OC(a,p,y)}}:w):b)}i(e)},c=()=>{i(e)};return k.jsx(ua,{className:efe,styles:{body:{padding:"8px"}},children:k.jsx(vde,{sensors:s,collisionDetection:vue,onDragEnd:l,onDragMove:c,children:k.jsxs(Ide,{items:a.map(u=>u.id),strategy:Nde,children:[k.jsx(jr,{isOpen:a.length===0,children:k.jsx(nfe,{type:"secondary",children:"Không có ý định nào"})}),k.jsx(jr,{isOpen:a.length>0,children:a.map(u=>k.jsx(qa,{children:k.jsx(tfe,{item:u},u.id)},u.id))})]})})})};var V3="scripts_editor_ao5dig0",z3="scripts_editor_ao5dig2",j3="scripts_editor_ao5dig3",H3="scripts_editor_ao5dig4",W3="scripts_editor_ao5dig5";const U3={missingMaleRecord:{code:"missing_male_record",title:"Thiếu ghi âm giọng nam",description:"Bạn chưa ghi âm giọng nam, vui lòng tải file ghi âm hoặc ghi âm trực tiếp"},missingFemaleRecord:{code:"missing_female_record",title:"Thiếu ghi âm giọng nữ",description:"Bạn chưa ghi âm giọng nữ, vui lòng tải file ghi âm hoặc ghi âm trực tiếp"}},q3={usePersonalized:{code:"use_personalized_speak",title:"Sử dụng cá nhân hoá",description:"Bạn nên sử dụng cá nhân hoá để tăng thời lượng cuộc gọi"},shouldHaveMemories:{code:"should_have_memories",title:"Cài đặt kiến thức",description:"Để bot trả lời tốt hơn, bạn nên cài đặt kiến thức. Click vào đây để cài đặt."}},ofe=e=>{var i,a,s;const t=(i=e.record)==null?void 0:i.detect_gender,n=e.type,r=[],o=[];return n===Yn.MACHINE&&r.push(q3.usePersonalized),n===Yn.PROMPT&&r.push(q3.shouldHaveMemories),n===Yn.RECORD&&t&&(((a=e.record)==null?void 0:a.male_record)===void 0&&o.push(U3.missingMaleRecord),((s=e.record)==null?void 0:s.female_record)===void 0&&o.push(U3.missingFemaleRecord)),{errors:o,infos:r}},ife=e=>{const t=[],n=[];return e.type===ki.EXTERNAL&&n.push({code:"transfer_external_warning",title:"",description:"Nếu chuyển máy vào số điện thoại thì sẽ bị tính 2 lần cước phí (chi phí bot gọi cho khách hàng và chi phí bot gọi cho số điện thoại của bạn).Bạn không nên chuyển máy vào số điện thoại trong chiến dịch gọi hàng loạt vì rủi ro chuyển máy thất bại khi nhiều cuộc gọi chuyển máy cùng lúc."}),{errors:t,infos:n}};function tv(e){const t=TC();return{infos:t.infos.filter(n=>n.nodeId===e),errors:t.errors.filter(n=>n.nodeId===e)}}function TC(){const e=Lt(n=>n.nodes);return T.useMemo(()=>{const n=[],r=[];return e.forEach(o=>{let i=[],a=[];if(o.type===We.TRANSFER){const{infos:s,errors:l}=ife(o.data);i.push(...s),a.push(...l)}if(o.type===We.SPEAK){const{infos:s,errors:l}=ofe(o.data);i.push(...s),a.push(...l)}i=i.map(s=>({...s,nodeId:o.id})),a=a.map(s=>({...s,nodeId:o.id})),n.push(...i),r.push(...a)}),{infos:n,errors:r}},[e])}var afe="scripts_editor_10lsbsa0",sfe="scripts_editor_10lsbsa1",G3="scripts_editor_10lsbsa2",K3="scripts_editor_10lsbsa3",X3="scripts_editor_10lsbsa4",Y3="scripts_editor_10lsbsa5",Q3="scripts_editor_10lsbsa6",lfe="scripts_editor_10lsbsa8",cfe="scripts_editor_10lsbsa9",ufe="scripts_editor_10lsbsaa",Z3="scripts_editor_10lsbsab";const{TextArea:dfe}=Vr,ffe=({prefixPaths:e=[]})=>k.jsx($t.Item,{name:[...e,"machine","content"],noStyle:!0,children:k.jsx(dfe,{placeholder:"Nhập kịch bản",rows:4,style:{width:"100%",border:"none",backgroundColor:"rgba(245, 245, 245, 1)",padding:"12px"}})}),{TextArea:hfe}=Vr,pfe=({prefixPaths:e=[]})=>k.jsx($t.Item,{name:[...e,"prompt","content"],noStyle:!0,children:k.jsx(hfe,{placeholder:"Nhập prompt",rows:4,style:{width:"100%",border:"none",backgroundColor:"rgba(245, 245, 245, 1)",padding:"12px"}})}),J3=6048e5,mfe=864e5,e4=Symbol.for("constructDateFrom");function Ts(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&e4 in e?e[e4](t):e instanceof Date?new e.constructor(t):new Date(t)}function Bi(e,t){return Ts(t||e,e)}let gfe={};function nv(){return gfe}function qf(e,t){var s,l,c,u;const n=nv(),r=(t==null?void 0:t.weekStartsOn)??((l=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:l.weekStartsOn)??n.weekStartsOn??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,o=Bi(e,t==null?void 0:t.in),i=o.getDay(),a=(i<r?7:0)+i-r;return o.setDate(o.getDate()-a),o.setHours(0,0,0,0),o}function rv(e,t){return qf(e,{...t,weekStartsOn:1})}function t4(e,t){const n=Bi(e,t==null?void 0:t.in),r=n.getFullYear(),o=Ts(n,0);o.setFullYear(r+1,0,4),o.setHours(0,0,0,0);const i=rv(o),a=Ts(n,0);a.setFullYear(r,0,4),a.setHours(0,0,0,0);const s=rv(a);return n.getTime()>=i.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function n4(e){const t=Bi(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function vfe(e,...t){const n=Ts.bind(null,t.find(r=>typeof r=="object"));return t.map(n)}function r4(e,t){const n=Bi(e,t==null?void 0:t.in);return n.setHours(0,0,0,0),n}function yfe(e,t,n){const[r,o]=vfe(n==null?void 0:n.in,e,t),i=r4(r),a=r4(o),s=+i-n4(i),l=+a-n4(a);return Math.round((s-l)/mfe)}function bfe(e,t){const n=t4(e,t),r=Ts(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),rv(r)}function wfe(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Cfe(e){return!(!wfe(e)&&typeof e!="number"||isNaN(+Bi(e)))}function xfe(e,t){const n=Bi(e,t==null?void 0:t.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const Sfe={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Efe=(e,t,n)=>{let r;const o=Sfe[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function IC(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const $fe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},_fe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ofe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Nfe={date:IC({formats:$fe,defaultWidth:"full"}),time:IC({formats:_fe,defaultWidth:"full"}),dateTime:IC({formats:Ofe,defaultWidth:"full"})},Tfe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ife=(e,t,n,r)=>Tfe[e];function Gf(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let o;if(r==="formatting"&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,s=n!=null&&n.width?String(n.width):a;o=e.formattingValues[s]||e.formattingValues[a]}else{const a=e.defaultWidth,s=n!=null&&n.width?String(n.width):e.defaultWidth;o=e.values[s]||e.values[a]}const i=e.argumentCallback?e.argumentCallback(t):t;return o[i]}}const Pfe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Mfe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Afe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Dfe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Lfe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Rfe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},kfe={ordinalNumber:(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:Gf({values:Pfe,defaultWidth:"wide"}),quarter:Gf({values:Mfe,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Gf({values:Afe,defaultWidth:"wide"}),day:Gf({values:Dfe,defaultWidth:"wide"}),dayPeriod:Gf({values:Lfe,defaultWidth:"wide",formattingValues:Rfe,defaultFormattingWidth:"wide"})};function Kf(e){return(t,n={})=>{const r=n.width,o=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(o);if(!i)return null;const a=i[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?Bfe(s,d=>d.test(a)):Ffe(s,d=>d.test(a));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=t.slice(a.length);return{value:c,rest:u}}}function Ffe(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Bfe(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Vfe(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const o=r[0],i=t.match(e.parsePattern);if(!i)return null;let a=e.valueCallback?e.valueCallback(i[0]):i[0];a=n.valueCallback?n.valueCallback(a):a;const s=t.slice(o.length);return{value:a,rest:s}}}const zfe=/^(\d+)(th|st|nd|rd)?/i,jfe=/\d+/i,Hfe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Wfe={any:[/^b/i,/^(a|c)/i]},Ufe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},qfe={any:[/1/i,/2/i,/3/i,/4/i]},Gfe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Kfe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Xfe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Yfe={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Qfe={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Zfe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Jfe={ordinalNumber:Vfe({matchPattern:zfe,parsePattern:jfe,valueCallback:e=>parseInt(e,10)}),era:Kf({matchPatterns:Hfe,defaultMatchWidth:"wide",parsePatterns:Wfe,defaultParseWidth:"any"}),quarter:Kf({matchPatterns:Ufe,defaultMatchWidth:"wide",parsePatterns:qfe,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Kf({matchPatterns:Gfe,defaultMatchWidth:"wide",parsePatterns:Kfe,defaultParseWidth:"any"}),day:Kf({matchPatterns:Xfe,defaultMatchWidth:"wide",parsePatterns:Yfe,defaultParseWidth:"any"}),dayPeriod:Kf({matchPatterns:Qfe,defaultMatchWidth:"any",parsePatterns:Zfe,defaultParseWidth:"any"})},ehe={code:"en-US",formatDistance:Efe,formatLong:Nfe,formatRelative:Ife,localize:kfe,match:Jfe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function the(e,t){const n=Bi(e,t==null?void 0:t.in);return yfe(n,xfe(n))+1}function nhe(e,t){const n=Bi(e,t==null?void 0:t.in),r=+rv(n)-+bfe(n);return Math.round(r/J3)+1}function o4(e,t){var u,d,h,p;const n=Bi(e,t==null?void 0:t.in),r=n.getFullYear(),o=nv(),i=(t==null?void 0:t.firstWeekContainsDate)??((d=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??o.firstWeekContainsDate??((p=(h=o.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,a=Ts((t==null?void 0:t.in)||e,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const s=qf(a,t),l=Ts((t==null?void 0:t.in)||e,0);l.setFullYear(r,0,i),l.setHours(0,0,0,0);const c=qf(l,t);return+n>=+s?r+1:+n>=+c?r:r-1}function rhe(e,t){var s,l,c,u;const n=nv(),r=(t==null?void 0:t.firstWeekContainsDate)??((l=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:l.firstWeekContainsDate)??n.firstWeekContainsDate??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,o=o4(e,t),i=Ts((t==null?void 0:t.in)||e,0);return i.setFullYear(o,0,r),i.setHours(0,0,0,0),qf(i,t)}function ohe(e,t){const n=Bi(e,t==null?void 0:t.in),r=+qf(n,t)-+rhe(n,t);return Math.round(r/J3)+1}function mn(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const Is={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return mn(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):mn(n+1,2)},d(e,t){return mn(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return mn(e.getHours()%12||12,t.length)},H(e,t){return mn(e.getHours(),t.length)},m(e,t){return mn(e.getMinutes(),t.length)},s(e,t){return mn(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),o=Math.trunc(r*Math.pow(10,n-3));return mn(o,t.length)}},du={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},i4={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),o=r>0?r:1-r;return n.ordinalNumber(o,{unit:"year"})}return Is.y(e,t)},Y:function(e,t,n,r){const o=o4(e,r),i=o>0?o:1-o;if(t==="YY"){const a=i%100;return mn(a,2)}return t==="Yo"?n.ordinalNumber(i,{unit:"year"}):mn(i,t.length)},R:function(e,t){const n=t4(e);return mn(n,t.length)},u:function(e,t){const n=e.getFullYear();return mn(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return mn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return mn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return Is.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return mn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const o=ohe(e,r);return t==="wo"?n.ordinalNumber(o,{unit:"week"}):mn(o,t.length)},I:function(e,t,n){const r=nhe(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):mn(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Is.d(e,t)},D:function(e,t,n){const r=the(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):mn(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const o=e.getDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return mn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});case"eeee":default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const o=e.getDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return mn(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});case"cccc":default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),o=r===0?7:r;switch(t){case"i":return String(o);case"ii":return mn(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const o=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let o;switch(r===12?o=du.noon:r===0?o=du.midnight:o=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let o;switch(r>=17?o=du.evening:r>=12?o=du.afternoon:r>=4?o=du.morning:o=du.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Is.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Is.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):mn(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):mn(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Is.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Is.s(e,t)},S:function(e,t){return Is.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return s4(r);case"XXXX":case"XX":return Ol(r);case"XXXXX":case"XXX":default:return Ol(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return s4(r);case"xxxx":case"xx":return Ol(r);case"xxxxx":case"xxx":default:return Ol(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+a4(r,":");case"OOOO":default:return"GMT"+Ol(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+a4(r,":");case"zzzz":default:return"GMT"+Ol(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return mn(r,t.length)},T:function(e,t,n){return mn(+e,t.length)}};function a4(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=Math.trunc(r/60),i=r%60;return i===0?n+String(o):n+String(o)+t+mn(i,2)}function s4(e,t){return e%60===0?(e>0?"-":"+")+mn(Math.abs(e)/60,2):Ol(e,t)}function Ol(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=mn(Math.trunc(r/60),2),i=mn(r%60,2);return n+o+t+i}const l4=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},c4=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},ihe={p:c4,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],o=n[2];if(!o)return l4(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",l4(r,t)).replace("{{time}}",c4(o,t))}},ahe=/^D+$/,she=/^Y+$/,lhe=["D","DD","YY","YYYY"];function che(e){return ahe.test(e)}function uhe(e){return she.test(e)}function dhe(e,t,n){const r=fhe(e,t,n);if(console.warn(r),lhe.includes(e))throw new RangeError(r)}function fhe(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const hhe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,phe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,mhe=/^'([^]*?)'?$/,ghe=/''/g,vhe=/[a-zA-Z]/;function yhe(e,t,n){var u,d,h,p;const r=nv(),o=r.locale??ehe,i=r.firstWeekContainsDate??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,a=r.weekStartsOn??((p=(h=r.locale)==null?void 0:h.options)==null?void 0:p.weekStartsOn)??0,s=Bi(e,n==null?void 0:n.in);if(!Cfe(s))throw new RangeError("Invalid time value");let l=t.match(phe).map(y=>{const b=y[0];if(b==="p"||b==="P"){const v=ihe[b];return v(y,o.formatLong)}return y}).join("").match(hhe).map(y=>{if(y==="''")return{isToken:!1,value:"'"};const b=y[0];if(b==="'")return{isToken:!1,value:bhe(y)};if(i4[b])return{isToken:!0,value:y};if(b.match(vhe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");return{isToken:!1,value:y}});o.localize.preprocessor&&(l=o.localize.preprocessor(s,l));const c={firstWeekContainsDate:i,weekStartsOn:a,locale:o};return l.map(y=>{if(!y.isToken)return y.value;const b=y.value;(uhe(b)||che(b))&&dhe(b,t,String(e));const v=i4[b[0]];return v(s,b,o.localize,c)}).join("")}function bhe(e){const t=e.match(mhe);return t?t[1].replace(ghe,"'"):e}var Nl={};const whe=e=>t=>{const n=e(t);return t.add(n),n},Che=e=>(t,n)=>(e.set(t,n),n),u4=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,d4=536870912,f4=d4*2,xhe=(e,t)=>n=>{const r=t.get(n);let o=r===void 0?n.size:r<f4?r+1:0;if(!n.has(o))return e(n,o);if(n.size<d4){for(;n.has(o);)o=Math.floor(Math.random()*f4);return e(n,o)}if(n.size>u4)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;n.has(o);)o=Math.floor(Math.random()*u4);return e(n,o)},h4=new WeakMap,She=Che(h4),p4=xhe(She,h4),Ehe=whe(p4),$he=e=>typeof e.start=="function",m4=new WeakMap,_he=e=>({...e,connect:({call:t})=>async()=>{const{port1:n,port2:r}=new MessageChannel,o=await t("connect",{port:n},[n]);return m4.set(r,o),r},disconnect:({call:t})=>async n=>{const r=m4.get(n);if(r===void 0)throw new Error("The given port is not connected.");await t("disconnect",{portId:r})},isSupported:({call:t})=>()=>t("isSupported")}),PC=new WeakMap,Ohe=e=>{if(PC.has(e))return PC.get(e);const t=new Map;return PC.set(e,t),t},g4=e=>{const t=_he(e);return n=>{const r=Ohe(n);n.addEventListener("message",({data:s})=>{const{id:l}=s;if(l!==null&&r.has(l)){const{reject:c,resolve:u}=r.get(l);r.delete(l),s.error===void 0?u(s.result):c(new Error(s.error.message))}}),$he(n)&&n.start();const o=(s,l=null,c=[])=>new Promise((u,d)=>{const h=p4(r);r.set(h,{reject:d,resolve:u}),l===null?n.postMessage({id:h,method:s},c):n.postMessage({id:h,method:s,params:l},c)}),i=(s,l,c=[])=>{n.postMessage({id:null,method:s,params:l},c)};let a={};for(const[s,l]of Object.entries(t))a={...a,[s]:l({call:o,notify:i})};return{...a}}},v4=new Set,Nhe=g4({deregister:({call:e})=>t=>e("deregister",{port:t},[t]),encode:({call:e})=>async(t,n)=>{const r=await e("encode",{encoderId:t,timeslice:n});return v4.delete(t),r},instantiate:({call:e})=>async(t,n)=>{const r=Ehe(v4),o=await e("instantiate",{encoderId:r,mimeType:t,sampleRate:n});return{encoderId:r,port:o}},register:({call:e})=>t=>e("register",{port:t},[t])}),The=e=>{const t=new Worker(e);return Nhe(t)},Ihe=`(()=>{var e={455:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:a<s?a+1:0;if(!r.has(i))return e(r,i);if(r.size<o){for(;r.has(i);)i=Math.floor(Math.random()*s);return e(r,i)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,c=r(i),l=a(c,i),d=t(l);e.addUniqueNumber=d,e.generateUniqueNumber=l}(t)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(()=>{"use strict";var e=r(455);const t=new WeakMap,n=new WeakMap,o=(r=>{const o=(s=r,{...s,connect:e=>{let{call:r}=e;return async()=>{const{port1:e,port2:n}=new MessageChannel,o=await r("connect",{port:e},[e]);return t.set(n,o),n}},disconnect:e=>{let{call:r}=e;return async e=>{const n=t.get(e);if(void 0===n)throw new Error("The given port is not connected.");await r("disconnect",{portId:n})}},isSupported:e=>{let{call:t}=e;return()=>t("isSupported")}});var s;return t=>{const r=(e=>{if(n.has(e))return n.get(e);const t=new Map;return n.set(e,t),t})(t);t.addEventListener("message",(e=>{let{data:t}=e;const{id:n}=t;if(null!==n&&r.has(n)){const{reject:e,resolve:o}=r.get(n);r.delete(n),void 0===t.error?o(t.result):e(new Error(t.error.message))}})),(e=>"function"==typeof e.start)(t)&&t.start();const s=function(n){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return new Promise(((a,i)=>{const c=(0,e.generateUniqueNumber)(r);r.set(c,{reject:i,resolve:a}),null===o?t.postMessage({id:c,method:n},s):t.postMessage({id:c,method:n,params:o},s)}))},a=function(e,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];t.postMessage({id:null,method:e,params:r},n)};let i={};for(const[e,t]of Object.entries(o))i={...i,[e]:t({call:s,notify:a})};return{...i}}})({characterize:e=>{let{call:t}=e;return()=>t("characterize")},encode:e=>{let{call:t}=e;return(e,r)=>t("encode",{recordingId:e,timeslice:r})},record:e=>{let{call:t}=e;return async(e,r,n)=>{await t("record",{recordingId:e,sampleRate:r,typedArrays:n},n.map((e=>{let{buffer:t}=e;return t})))}}}),s=-32603,a=-32602,i=-32601,c=(e,t)=>Object.assign(new Error(e),{status:t}),l=e=>c('The handler of the method called "'.concat(e,'" returned an unexpected result.'),s),d=(e,t)=>async r=>{let{data:{id:n,method:o,params:a}}=r;const d=t[o];try{if(void 0===d)throw(e=>c('The requested method called "'.concat(e,'" is not supported.'),i))(o);const t=void 0===a?d():d(a);if(void 0===t)throw(e=>c('The handler of the method called "'.concat(e,'" returned no required result.'),s))(o);const r=t instanceof Promise?await t:t;if(null===n){if(void 0!==r.result)throw l(o)}else{if(void 0===r.result)throw l(o);const{result:t,transferables:s=[]}=r;e.postMessage({id:n,result:t},s)}}catch(t){const{message:r,status:o=-32603}=t;e.postMessage({error:{code:o,message:r},id:n})}},u=new Map,h=(t,r,n)=>({...r,connect:n=>{let{port:o}=n;o.start();const s=t(o,r),a=(0,e.generateUniqueNumber)(u);return u.set(a,(()=>{s(),o.close(),u.delete(a)})),{result:a}},disconnect:e=>{let{portId:t}=e;const r=u.get(t);if(void 0===r)throw(e=>c('The specified parameter called "portId" with the given value "'.concat(e,'" does not identify a port connected to this worker.'),a))(t);return r(),{result:null}},isSupported:async()=>{if(await new Promise((e=>{const t=new ArrayBuffer(0),{port1:r,port2:n}=new MessageChannel;r.onmessage=t=>{let{data:r}=t;return e(null!==r)},n.postMessage(t,[t])}))){const e=n();return{result:e instanceof Promise?await e:e}}return{result:!1}}}),f=function(e,t){const r=h(f,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0),n=d(e,r);return e.addEventListener("message",n),()=>e.removeEventListener("message",n)},p=e=>{e.onmessage=null,e.close()},w=new Map,m=new WeakMap,g=((e,t)=>r=>{const n=t.get(r);if(void 0===n)throw new Error("There is no encoder stored which wraps this port.");e.delete(n),t.delete(r)})(w,m),v=new Map,y=(e=>t=>{const r=e.get(t);if(void 0===r)throw new Error("There was no instance of an encoder stored with the given id.");return r})(v),M=((e,t)=>r=>{const n=t(r);return e.delete(r),n})(v,y),E=((e,t)=>r=>{const[n,o,s,a]=t(r);return s?new Promise((t=>{o.onmessage=s=>{let{data:i}=s;0===i.length?(e(o),t(n.encode(r,null))):n.record(r,a,i)}})):n.encode(r,null)})(p,M),b=(e=>t=>{for(const[r,n]of Array.from(e.values()))if(r.test(t))return n;throw new Error("There is no encoder registered which could handle the given mimeType.")})(w),T=((e,t,r)=>(n,o,s)=>{if(t.has(n))throw new Error('There is already an encoder registered with an id called "'.concat(n,'".'));const a=r(o),{port1:i,port2:c}=new MessageChannel,l=[a,i,!0,s];return t.set(n,l),i.onmessage=t=>{let{data:r}=t;0===r.length?(e(i),l[2]=!1):a.record(n,s,r.map((e=>"number"==typeof e?new Float32Array(e):e)))},c})(p,v,b),I=((e,t,r)=>async n=>{const o=r(n),s=await o.characterize(),a=s.toString();if(e.has(a)||t.has(n))throw new Error("There is already an encoder stored which handles exactly the same mime types.");return e.set(a,[s,o]),t.set(n,a),s})(w,m,o),A=(e=>(t,r)=>{const[n]=e(t);return n.encode(t,r)})(y);f(self,{deregister:async e=>{let{port:t}=e;return{result:g(t)}},encode:async e=>{let{encoderId:t,timeslice:r}=e;const n=null===r?await E(t):await A(t,r);return{result:n,transferables:n}},instantiate:e=>{let{encoderId:t,mimeType:r,sampleRate:n}=e;const o=T(t,r,n);return{result:o,transferables:[o]}},register:async e=>{let{port:t}=e;return{result:await I(t)}}})})()})();`,Phe=new Blob([Ihe],{type:"application/javascript; charset=utf-8"}),y4=URL.createObjectURL(Phe),MC=The(y4),ov=MC.encode,b4=MC.instantiate,Mhe=MC.register;URL.revokeObjectURL(y4);const Ahe=e=>(t,n)=>{if(e===null){const{data:r,...o}=n,i=new Event(t,o);return i.data=r,i}return new e(t,n)},Dhe=(e,t)=>(n,r,o)=>{const i=[];let a=r,s=0;for(;s<n.byteLength;)if(a===null){const l=t(n,s);if(l===null)break;const{length:c,type:u}=l;a=u,s+=c}else{const l=e(n,s,a,o);if(l===null)break;const{content:c,length:u}=l;a=null,s+=u,c!==null&&i.push(c)}return{contents:i,currentElementType:a,offset:s}},Lhe=(e,t)=>class{constructor(r=null){this._listeners=new WeakMap,this._nativeEventTarget=r===null?e():r}addEventListener(r,o,i){if(o!==null){let a=this._listeners.get(o);a===void 0&&(a=t(this,o),typeof o=="function"&&this._listeners.set(o,a)),this._nativeEventTarget.addEventListener(r,a,i)}}dispatchEvent(r){return this._nativeEventTarget.dispatchEvent(r)}removeEventListener(r,o,i){const a=o===null?void 0:this._listeners.get(o);this._nativeEventTarget.removeEventListener(r,a===void 0?null:a,i)}},Rhe=e=>()=>{if(e===null)throw new Error("A native EventTarget could not be created.");return e.document.createElement("p")},AC=(e="")=>{try{return new DOMException(e,"InvalidModificationError")}catch(t){return t.code=13,t.message=e,t.name="InvalidModificationError",t}},khe=()=>{try{return new DOMException("","InvalidStateError")}catch(e){return e.code=11,e.name="InvalidStateError",e}},Fhe=e=>e!==null&&e.MediaStream!==void 0&&(e.MediaRecorder===void 0||e.MediaRecorder.isTypeSupported!==void 0)?new Promise(t=>{if(e.MediaRecorder===void 0)return t(!0);const n=document.createElement("canvas");if(n.getContext("2d"),typeof n.captureStream!="function")return t(!1);const r=n.captureStream(),o="audio/webm";try{const i=new e.MediaRecorder(r,{mimeType:o});i.addEventListener("dataavailable",({data:a})=>t(a.type===o)),i.start(),setTimeout(()=>i.stop(),10)}catch(i){t(i.name==="NotSupportedError")}}):Promise.resolve(!1),Bhe=(e,t,n,r,o,i,a)=>class extends i{constructor(l,c={}){const{mimeType:u}=c;if(a!==null&&(u===void 0||a.isTypeSupported!==void 0&&a.isTypeSupported(u))){const d=e(a,l,c);super(d),this._internalMediaRecorder=d}else if(u!==void 0&&o.some(d=>d.test(u)))super(),a!==null&&a.isTypeSupported!==void 0&&a.isTypeSupported("audio/webm;codecs=pcm")?this._internalMediaRecorder=r(this,a,l,u):this._internalMediaRecorder=n(this,l,u);else throw a!==null&&e(a,l,c),t();this._ondataavailable=null,this._onerror=null,this._onpause=null,this._onresume=null,this._onstart=null,this._onstop=null}get mimeType(){return this._internalMediaRecorder.mimeType}get ondataavailable(){return this._ondataavailable===null?this._ondataavailable:this._ondataavailable[0]}set ondataavailable(l){if(this._ondataavailable!==null&&this.removeEventListener("dataavailable",this._ondataavailable[1]),typeof l=="function"){const c=l.bind(this);this.addEventListener("dataavailable",c),this._ondataavailable=[l,c]}else this._ondataavailable=null}get onerror(){return this._onerror===null?this._onerror:this._onerror[0]}set onerror(l){if(this._onerror!==null&&this.removeEventListener("error",this._onerror[1]),typeof l=="function"){const c=l.bind(this);this.addEventListener("error",c),this._onerror=[l,c]}else this._onerror=null}get onpause(){return this._onpause===null?this._onpause:this._onpause[0]}set onpause(l){if(this._onpause!==null&&this.removeEventListener("pause",this._onpause[1]),typeof l=="function"){const c=l.bind(this);this.addEventListener("pause",c),this._onpause=[l,c]}else this._onpause=null}get onresume(){return this._onresume===null?this._onresume:this._onresume[0]}set onresume(l){if(this._onresume!==null&&this.removeEventListener("resume",this._onresume[1]),typeof l=="function"){const c=l.bind(this);this.addEventListener("resume",c),this._onresume=[l,c]}else this._onresume=null}get onstart(){return this._onstart===null?this._onstart:this._onstart[0]}set onstart(l){if(this._onstart!==null&&this.removeEventListener("start",this._onstart[1]),typeof l=="function"){const c=l.bind(this);this.addEventListener("start",c),this._onstart=[l,c]}else this._onstart=null}get onstop(){return this._onstop===null?this._onstop:this._onstop[0]}set onstop(l){if(this._onstop!==null&&this.removeEventListener("stop",this._onstop[1]),typeof l=="function"){const c=l.bind(this);this.addEventListener("stop",c),this._onstop=[l,c]}else this._onstop=null}get state(){return this._internalMediaRecorder.state}pause(){return this._internalMediaRecorder.pause()}resume(){return this._internalMediaRecorder.resume()}start(l){return this._internalMediaRecorder.start(l)}stop(){return this._internalMediaRecorder.stop()}static isTypeSupported(l){return a!==null&&a.isTypeSupported!==void 0&&a.isTypeSupported(l)||o.some(c=>c.test(l))}},Vhe=e=>e!==null&&e.BlobEvent!==void 0?e.BlobEvent:null,zhe=(e,t)=>(n,r,o)=>{const i=[],a=new WeakMap,s=new WeakMap,l=new n(r,o),c=new WeakMap;let u=!0;return l.addEventListener=(d=>(h,p,y)=>{let b=p;return typeof p=="function"&&(h==="dataavailable"?(b=v=>{setTimeout(()=>{if(u&&l.state==="inactive")i.push(v.data);else{if(i.length>0){const w=v.data;Object.defineProperty(v,"data",{value:new Blob([...i,w],{type:w.type})}),i.length=0}p.call(l,v)}})},a.set(p,b)):h==="error"?(b=v=>{if(v.error===void 0)p.call(l,new ErrorEvent("error",{error:e()}));else if(v.error.name==="UnknownError"){const w=v.error.message;p.call(l,new ErrorEvent("error",{error:e(w)}))}else v instanceof ErrorEvent?p.call(l,v):p.call(l,new ErrorEvent("error",{error:v.error}))},s.set(p,b)):h==="stop"&&(b=v=>{u=!1,setTimeout(()=>p.call(l,v))},c.set(p,b))),d.call(l,h,b,y)})(l.addEventListener),l.dispatchEvent=(d=>h=>{let p;setTimeout(()=>{p=u,u=!1});const y=d.call(l,h);return setTimeout(()=>u=p),y})(l.dispatchEvent),l.removeEventListener=(d=>(h,p,y)=>{let b=p;if(typeof p=="function"){if(h==="dataavailable"){const v=a.get(p);v!==void 0&&(b=v)}else if(h==="error"){const v=s.get(p);v!==void 0&&(b=v)}else if(h==="stop"){const v=c.get(p);v!==void 0&&(b=v)}}return d.call(l,h,b,y)})(l.removeEventListener),l.start=(d=>h=>{if(o.mimeType!==void 0&&o.mimeType.startsWith("audio/")&&r.getVideoTracks().length>0)throw t();return u=h!==void 0,h===void 0?d.call(l):d.call(l,h)})(l.start),l},jhe=e=>e===null||e.MediaRecorder===void 0?null:e.MediaRecorder,iv=()=>{try{return new DOMException("","NotSupportedError")}catch(e){return e.code=9,e.name="NotSupportedError",e}},Hhe=e=>(t,n,r,o=2)=>{const i=e(t,n);if(i===null)return i;const{length:a,value:s}=i;if(r==="master")return{content:null,length:a};if(n+a+s>t.byteLength)return null;if(r==="binary"){const l=(s/Float32Array.BYTES_PER_ELEMENT-1)/o,c=Array.from({length:o},()=>new Float32Array(l));for(let u=0;u<l;u+=1){const d=u*o+1;for(let h=0;h<o;h+=1)c[h][u]=t.getFloat32(n+a+(d+h)*Float32Array.BYTES_PER_ELEMENT,!0)}return{content:c,length:a+s}}return{content:null,length:a+s}},Whe=e=>(t,n)=>{const r=e(t,n);if(r===null)return r;const{length:o,value:i}=r;return i===35?{length:o,type:"binary"}:i===46||i===97||i===88713574||i===106212971||i===139690087||i===172351395||i===256095861?{length:o,type:"master"}:{length:o,type:"unknown"}},Uhe=e=>(t,n)=>{const r=e(t,n);if(r===null)return r;const o=n+Math.floor((r-1)/8);if(o+r>t.byteLength)return null;let a=t.getUint8(o)&(1<<8-r%8)-1;for(let s=1;s<r;s+=1)a=(a<<8)+t.getUint8(o+s);return{length:r,value:a}},qhe=e=>(t,n)=>(e.set(t,n),n),w4=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,C4=536870912,x4=C4*2,Ghe=(e,t)=>n=>{const r=t.get(n);let o=r===void 0?n.size:r<x4?r+1:0;if(!n.has(o))return e(n,o);if(n.size<C4){for(;n.has(o);)o=Math.floor(Math.random()*x4);return e(n,o)}if(n.size>w4)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;n.has(o);)o=Math.floor(Math.random()*w4);return e(n,o)},S4=new WeakMap,Khe=qhe(S4),Xhe=Ghe(Khe,S4),E4=Symbol.observable||"@@observable";function Yhe(e){return Symbol.observable||(typeof e=="function"&&e.prototype&&e.prototype[Symbol.observable]?(e.prototype[E4]=e.prototype[Symbol.observable],delete e.prototype[Symbol.observable]):(e[E4]=e[Symbol.observable],delete e[Symbol.observable])),e}const av=()=>{},$4=e=>{throw e};function Qhe(e){return e?e.next&&e.error&&e.complete?e:{complete:(e.complete??av).bind(e),error:(e.error??$4).bind(e),next:(e.next??av).bind(e)}:{complete:av,error:$4,next:av}}const Zhe=e=>(t,n,r)=>e(o=>{const i=a=>o.next(a);return t.addEventListener(n,i,r),()=>t.removeEventListener(n,i,r)}),Jhe=((e,t)=>{const n=()=>{},r=o=>typeof o[0]=="function";return o=>{const i=(...a)=>{const s=o(r(a)?t({next:a[0]}):t(...a));return s!==void 0?s:n};return i[Symbol.observable]=()=>({subscribe:(...a)=>({unsubscribe:i(...a)})}),e(i)}})(Yhe,Qhe),_4=Zhe(Jhe);/*!
|
|
389
389
|
* dashify <https://github.com/jonschlinkert/dashify>
|
|
390
390
|
*
|
|
391
391
|
* Copyright (c) 2015-2017, Jon Schlinkert.
|
|
@@ -399,5 +399,5 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
399
399
|
`):" "+gL(i[0]):"as no adapter specified";throw new Pt("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:vx};function yx(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new yu(null,e)}function yL(e){return yx(e),e.headers=xo.from(e.headers),e.data=mx.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),vL.getAdapter(e.adapter||uh.adapter)(e).then(function(r){return yx(e),r.data=mx.call(e,e.transformResponse,r),r.headers=xo.from(r.headers),r},function(r){return iL(r)||(yx(e),r&&r.response&&(r.response.data=mx.call(e,e.transformResponse,r.response),r.response.headers=xo.from(r.response.headers))),Promise.reject(r)})}const bL="1.11.0",kv={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{kv[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const wL={};kv.transitional=function(t,n,r){function o(i,a){return"[Axios v"+bL+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,s)=>{if(t===!1)throw new Pt(o(a," has been removed"+(n?" in "+n:"")),Pt.ERR_DEPRECATED);return n&&!wL[a]&&(wL[a]=!0,console.warn(o(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,a,s):!0}},kv.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function uye(e,t,n){if(typeof e!="object")throw new Pt("options must be an object",Pt.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=t[i];if(a){const s=e[i],l=s===void 0||a(s,i,e);if(l!==!0)throw new Pt("option "+i+" must be "+l,Pt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Pt("Unknown option "+i,Pt.ERR_BAD_OPTION)}}const Fv={assertOptions:uye,validators:kv},va=Fv.validators;let Rl=class{constructor(t){this.defaults=t||{},this.interceptors={request:new tL,response:new tL}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
400
400
|
`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Ll(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&Fv.assertOptions(r,{silentJSONParsing:va.transitional(va.boolean),forcedJSONParsing:va.transitional(va.boolean),clarifyTimeoutError:va.transitional(va.boolean)},!1),o!=null&&($e.isFunction(o)?n.paramsSerializer={serialize:o}:Fv.assertOptions(o,{encode:va.function,serialize:va.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Fv.assertOptions(n,{baseUrl:va.spelling("baseURL"),withXsrfToken:va.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&$e.merge(i.common,i[n.method]);i&&$e.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=xo.concat(a,i);const s=[];let l=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(n)===!1||(l=l&&b.synchronous,s.unshift(b.fulfilled,b.rejected))});const c=[];this.interceptors.response.forEach(function(b){c.push(b.fulfilled,b.rejected)});let u,d=0,h;if(!l){const y=[yL.bind(this),void 0];for(y.unshift(...s),y.push(...c),h=y.length,u=Promise.resolve(n);d<h;)u=u.then(y[d++],y[d++]);return u}h=s.length;let p=n;for(d=0;d<h;){const y=s[d++],b=s[d++];try{p=y(p)}catch(v){b.call(this,v);break}}try{u=yL.call(this,p)}catch(y){return Promise.reject(y)}for(d=0,h=c.length;d<h;)u=u.then(c[d++],c[d++]);return u}getUri(t){t=Ll(this.defaults,t);const n=cL(t.baseURL,t.url,t.allowAbsoluteUrls);return eL(n,t.params,t.paramsSerializer)}};$e.forEach(["delete","get","head","options"],function(t){Rl.prototype[t]=function(n,r){return this.request(Ll(r||{},{method:t,url:n,data:(r||{}).data}))}}),$e.forEach(["post","put","patch"],function(t){function n(r){return function(i,a,s){return this.request(Ll(s||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Rl.prototype[t]=n(),Rl.prototype[t+"Form"]=n(!0)});let dye=class GB{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(s=>{r.subscribe(s),i=s}).then(o);return a.cancel=function(){r.unsubscribe(i)},a},t(function(i,a,s){r.reason||(r.reason=new yu(i,a,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new GB(function(o){t=o}),cancel:t}}};function fye(e){return function(n){return e.apply(null,n)}}function hye(e){return $e.isObject(e)&&e.isAxiosError===!0}const bx={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(bx).forEach(([e,t])=>{bx[t]=e});function CL(e){const t=new Rl(e),n=B6(Rl.prototype.request,t);return $e.extend(n,Rl.prototype,t,{allOwnKeys:!0}),$e.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return CL(Ll(e,o))},n}const rr=CL(uh);rr.Axios=Rl,rr.CanceledError=yu,rr.CancelToken=dye,rr.isCancel=iL,rr.VERSION=bL,rr.toFormData=Mv,rr.AxiosError=Pt,rr.Cancel=rr.CanceledError,rr.all=function(t){return Promise.all(t)},rr.spread=fye,rr.isAxiosError=hye,rr.mergeConfig=Ll,rr.AxiosHeaders=xo,rr.formToJSON=e=>rL($e.isHTMLForm(e)?new FormData(e):e),rr.getAdapter=vL.getAdapter,rr.HttpStatusCode=bx,rr.default=rr;const{Axios:OTe,AxiosError:NTe,CanceledError:TTe,isCancel:ITe,CancelToken:PTe,VERSION:MTe,all:ATe,Cancel:DTe,isAxiosError:LTe,spread:RTe,toFormData:kTe,AxiosHeaders:FTe,HttpStatusCode:BTe,formToJSON:VTe,getAdapter:zTe,mergeConfig:jTe}=rr,xL=T.createContext(void 0),pye=(e,t,n)=>{if(!t)throw new Error("AUTHORIZATION_HEADER is required");const r=rr.create({baseURL:e,headers:{"Content-Type":"application/json",...t.startsWith("Bearer ")?{Authorization:t}:t.startsWith("x-api-key")?{"x-api-key":t.substring(9)}:{Authorization:`Bearer ${t}`}}});return r.interceptors.request.use(o=>{var i;return console.log(`[Scripts Editor - ${n}]: Request:`,(i=o.method)==null?void 0:i.toUpperCase(),o.url),o},o=>Promise.reject(o)),r.interceptors.response.use(o=>o,o=>{var i,a;return console.error(`[Scripts Editor - ${n}]: Response Error:`,(i=o.response)==null?void 0:i.status,(a=o.response)==null?void 0:a.data),Promise.reject(o)}),r},SL=({children:e,BASE_URL:t,AUTHORIZATION_HEADER:n,context:r,BLOCKS_ENABLED:o})=>{const i=T.useRef(null),a=T.useMemo(()=>pye(t,n,"Main API"),[t,n]),s=T.useMemo(()=>({axiosInstance:a,reactFlowRef:i,context:r,BLOCKS_ENABLED:o}),[a,r,o]);return k.jsx(xL.Provider,{value:s,children:e})},Bv=()=>{const e=T.useContext(xL);if(!e)throw new Error("useInstanceContext must be used within an InstanceContextProvider");return e},EL=()=>{const{axiosInstance:e,context:{COMPANY_ID:t,CALLBOTSCENARIO_ID:n}}=Bv(),{error:r}=lC();return CV({mutationFn:async({audio:o})=>{var a,s,l,c;if(!t||!n)throw new Error("COMPANY_ID and CALLBOTSCENARIO_ID are required");const i=new FormData;i.append("raw_file",o);try{return(a=(await e.postForm(`/company/${t}/callbotscenario/${n}/file`,i)).data)==null?void 0:a.url}catch(u){const d=u;throw r((c=(l=(s=d.response)==null?void 0:s.data)==null?void 0:l.raw_file)==null?void 0:c[0]),d}},onError:o=>{console.error("Upload audio error:",o)}})},mye=({audioStream:e,isRecording:t})=>{const n=T.useRef(null),r=T.useRef(void 0),o=T.useRef(null),i=T.useRef(null);return T.useEffect(()=>{if(!e||!t){r.current&&cancelAnimationFrame(r.current),i.current&&(i.current.close(),i.current=null);return}const a=n.current;if(!a)return;const s=a.getContext("2d");if(!s)return;i.current=new(window.AudioContext||window.webkitAudioContext);const l=i.current.createMediaStreamSource(e);o.current=i.current.createAnalyser(),o.current.fftSize=256,o.current.smoothingTimeConstant=.8,l.connect(o.current);const c=o.current.frequencyBinCount,u=new Uint8Array(c),d=()=>{if(!o.current||!s)return;r.current=requestAnimationFrame(d),o.current.getByteFrequencyData(u),s.clearRect(0,0,a.width,a.height);const h=3,p=1;let y=0;for(let v=0;v<c;v++){const w=Math.max(4,u[v]/255*(a.height-8));s.fillStyle="#000",s.beginPath(),s.roundRect(y,a.height-w-4,h,w,1.5),s.fill(),y+=h+p}const b=a.height/2;s.strokeStyle="#ccc",s.setLineDash([2,2]),s.lineWidth=1,s.beginPath(),s.moveTo(y+8,b),s.lineTo(a.width-4,b),s.stroke(),s.setLineDash([])};return d(),()=>{r.current&&cancelAnimationFrame(r.current)}},[e,t]),k.jsx("canvas",{ref:n,width:64,height:32,style:{backgroundColor:"transparent"}})},wx=60*10,Cx=({onFinishRecord:e})=>{const[t,n]=T.useState(!1),{mutateAsync:r}=EL(),o=y=>{const b=Math.floor(y/60),v=y%60;return`${b.toString().padStart(2,"0")}:${v.toString().padStart(2,"0")}`},i=y=>yhe(y,"dd/MM/yyyy HH:mm:ss"),a=T.useCallback(()=>{const y=new Date;return y.setSeconds(y.getSeconds()+wx),y},[]),{totalSeconds:s,isRunning:l,start:c,pause:u,restart:d}=Wve.useTimer({expiryTimestamp:a(),onExpire:()=>console.warn("Recording time expired"),autoStart:!1}),h=wx-s,p=async y=>{const b=`recording_${i(new Date).replace(/[/:]/g,"_")}.wav`,v=new File([y],b,{type:y.type});return{audioUrl:await r({audio:v}),transcript:`Transcript for ${b} - This is a placeholder transcript that would be generated from the recorded audio.`}};return k.jsx(zve.ReactMediaRecorder,{audio:!0,video:!1,onStart:()=>{const y=new Date;y.setSeconds(y.getSeconds()+wx),d(y),c()},onStop:async(y,b)=>{if(u(),b&&e){n(!0);try{const v=await p(b);e(v.audioUrl,v.transcript)}catch(v){iu.error("Tải lên audio thất bại!"),console.error("Upload error:",v),e(y)}finally{n(!1)}}},render:({status:y,startRecording:b,stopRecording:v,mediaBlobUrl:w,previewAudioStream:x})=>{const C=y==="recording";return k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[C?k.jsx(hn,{type:"text",onClick:v,disabled:t,style:{width:"32px",height:"32px",borderRadius:"8px",backgroundColor:In.speakBlock.background,border:`1px solid ${In.speakBlock.border}`,display:"flex",alignItems:"center",justifyContent:"center",padding:0},children:k.jsx("div",{style:{width:"12px",height:"12px",backgroundColor:In.common.red,borderRadius:"2px"}})}):k.jsx(hn,{icon:t?k.jsx(aa,{}):k.jsx(ub,{}),onClick:b,disabled:t,loading:t,children:t?"Đang tải lên...":"Ghi âm"}),C&&k.jsxs(k.Fragment,{children:[k.jsx("div",{style:{display:"flex",alignItems:"center",flex:1},children:k.jsx(mye,{audioStream:x,isRecording:C})}),k.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:"#000",minWidth:"40px",textAlign:"right"},children:o(h)})]})]})}})},xx=({url:e,className:t,formPath:n})=>{const r=$t.useFormInstance();if(!e||e==="")return k.jsx(Rc,{message:"Không có file âm thanh",description:"Vui lòng tải lên file âm thanh hoặc ghi âm",type:"info",showIcon:!0,icon:k.jsx(ub,{})});const o=()=>{n&&n.forEach(i=>{r.setFieldValue(i,void 0)})};return k.jsx("div",{className:t,children:k.jsxs("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[k.jsxs("audio",{controls:!0,preload:"auto","aria-label":"Audio playback",src:e,style:{height:32,maxWidth:"260px"},children:[k.jsx("track",{kind:"captions",src:"",label:"Captions"}),"Trình duyệt của bạn không hỗ trợ phát âm thanh."]}),n&&k.jsx(Tf,{title:"Xóa âm thanh",description:"Bạn có chắc chắn muốn xóa không?",onConfirm:o,okText:"Xóa",cancelText:"Hủy",placement:"top",children:k.jsx(hn,{danger:!0,icon:k.jsx(Md,{}),"aria-label":"Delete audio",style:{marginLeft:"8px"}})})]})})},{TextArea:gye}=Vr,vye=({placeholder:e="Vui lòng tải lên ghi âm để cá nhân hoá",rows:t=4})=>{const n=yg(),r=T.useRef(null),{isOpen:o,onOpen:i,onClose:a}=Df(),[s,l]=T.useState(""),[c,u]=T.useState("confirm"),d=C=>{},h=C=>{var O;const S=r.current;if(!S)return;const E=(O=S.resizableTextArea)==null?void 0:O.textArea;if(!E)return;const $=E.value.substring(E.selectionStart,E.selectionEnd);$.trim()?(l($),u("confirm"),i()):a()},p=()=>{u("configure")},y=()=>{a(),l(""),u("confirm")},b=()=>{var I;const C=r.current;if(!C)return;const S=(I=C.resizableTextArea)==null?void 0:I.textArea;if(!S)return;const E=S.value,$=E.substring(0,S.selectionStart),O=E.substring(S.selectionEnd),N=$+`{{${s}}}`+O;n.setFieldValue(["record","transcript_personalize"],N),n.submit(),a(),l(""),u("confirm")},v=()=>{a(),l(""),u("confirm")},w=()=>k.jsxs("div",{style:{minWidth:"300px"},children:[k.jsx("div",{style:{marginBottom:"16px"},children:k.jsxs(hr.Text,{children:["Bạn muốn thay thế cụm từ ",k.jsx("strong",{children:s})," bằng biến?"]})}),k.jsx(jr,{isOpen:c==="configure",children:k.jsx("div",{children:k.jsx("div",{style:{padding:"16px",backgroundColor:"#f5f5f5",borderRadius:"8px"},children:k.jsx("p",{children:"TODO: Component tìm kiếm tên trường"})})})})]}),x=()=>c==="confirm"?{onConfirm:p,onCancel:y,okText:"Thêm biến",cancelText:"Hủy"}:{onConfirm:b,onCancel:v,okText:"Thêm biến",cancelText:"Hủy"};return k.jsxs(k.Fragment,{children:[k.jsx(Tf,{title:w(),...x(),open:o,icon:!1,children:k.jsx(hr.Text,{type:"secondary",children:"Bôi đen cụm từ trong kịch bản để thay thế bằng biến"})}),k.jsx(gye,{ref:r,placeholder:e,rows:t,value:n.getFieldValue(["record","transcript_personalize"]),onChange:d,onMouseUp:h,style:{width:"100%",border:"none",borderRadius:X5.block.rounded.borderRadius,backgroundColor:In.common.gray,padding:"12px",marginTop:"12px",fontSize:"14px",lineHeight:"1.5",resize:"none"}})]})},Sx=({onUploadSuccess:e,fieldName:t="audio",disabled:n=!1})=>{const{mutateAsync:r,isPending:o}=EL(),i=async s=>({audioUrl:await r({audio:s}),transcript:`Transcript for ${s.name} - This is a placeholder transcript that would be generated from the uploaded audio file.`}),a={name:t,accept:".mp3,.wav,.m4a",showUploadList:!1,beforeUpload:async s=>{if(!["audio/mp3","audio/mpeg","audio/wav","audio/x-wav","audio/m4a","audio/x-m4a"].includes(s.type))return iu.error("Chỉ chấp nhận file audio (mp3, wav, m4a)!"),!1;if(!(s.size/1024/1024<50))return iu.error("File phải nhỏ hơn 50MB!"),!1;try{const u=await i(s);e==null||e(u.audioUrl,u.transcript)}catch(u){iu.error("Tải lên audio thất bại!"),console.error("Upload error:",u)}return!1}};return k.jsx(iC,{...a,children:k.jsx(hn,{icon:o?k.jsx(aa,{}):k.jsx(hN,{}),disabled:n||o,loading:o,children:o?"Đang tải lên...":"Tải lên"})})},{TextArea:Ex}=Vr,{Text:bu}=hr,yye=({prefixPaths:e=[]})=>{const t=$t.useWatch([...e,"record","detect_gender"]),n=$t.useWatch([...e,"record","personalize"]),r=yg(),o=$t.useWatch([...e,"record","default_record"],r),i=$t.useWatch([...e,"record","male_record"],r),a=$t.useWatch([...e,"record","female_record"],r);return k.jsxs(k.Fragment,{children:[k.jsxs($t.Item,{name:[...e,"record","default_record"],valuePropName:"checked",style:{marginBottom:"8px"},label:k.jsx(bu,{strong:!0,children:"Mặc định"}),children:[k.jsxs(an,{direction:"horizontal",size:0,wrap:!0,children:[k.jsx(jr,{isOpen:!o,children:k.jsxs(an,{direction:"horizontal",size:16,wrap:!0,style:{marginTop:"8px"},children:[k.jsx(Sx,{onUploadSuccess:(s,l)=>{r.setFieldValue([...e,"record","default_record"],s),r.setFieldValue([...e,"record","transcript_original"],l),r.submit()}}),k.jsx(Cx,{onFinishRecord:(s,l)=>{r.setFieldValue([...e,"record","default_record"],s),r.setFieldValue([...e,"record","transcript_original"],l),r.submit()}})]})}),k.jsx(jr,{isOpen:!!o,children:k.jsx(xx,{url:o,formPath:[[...e,"record","default_record"],[...e,"record","transcript_original"]]})})]}),k.jsx("div",{style:{marginTop:8},children:k.jsx(bu,{italic:!0,type:"secondary",children:r.getFieldValue([...e,"record","transcript_original"])})})]}),k.jsx($t.Item,{name:[...e,"record","detect_gender"],valuePropName:"checked",style:{marginBottom:"0px"},children:k.jsx(Ef,{children:k.jsx(bu,{strong:!0,children:"Phân biệt giới tính"})})}),k.jsx(jr,{isOpen:t,children:k.jsxs(Sw,{gutter:[0,16],children:[k.jsx($t.Item,{name:[...e,"record","male_record"],noStyle:!0,children:k.jsxs(an,{direction:"horizontal",size:0,wrap:!0,children:[k.jsx(bu,{children:"Khách hàng nam"}),k.jsxs(an,{direction:"horizontal",size:0,wrap:!0,children:[k.jsx(jr,{isOpen:!i,children:k.jsxs(an,{direction:"horizontal",size:16,wrap:!0,style:{marginTop:"8px"},children:[k.jsx(Sx,{onUploadSuccess:(s,l)=>{r.setFieldValue([...e,"record","male_record"],s),r.submit()}}),k.jsx(Cx,{onFinishRecord:(s,l)=>{r.setFieldValue([...e,"record","male_record"],s),r.submit()}})]})}),k.jsx(jr,{isOpen:!!i,children:k.jsx(xx,{url:i,formPath:[[...e,"record","male_record"],[...e,"record","transcript_original"]]})})]})]})}),k.jsx($t.Item,{name:[...e,"record","female_record"],noStyle:!0,children:k.jsxs(an,{direction:"horizontal",size:0,wrap:!0,children:[k.jsx(bu,{children:"Khách hàng nữ"}),k.jsxs(an,{direction:"horizontal",size:0,wrap:!0,children:[k.jsx(jr,{isOpen:!a,children:k.jsxs(an,{direction:"horizontal",size:16,wrap:!0,style:{marginTop:"8px"},children:[k.jsx(Sx,{onUploadSuccess:(s,l)=>{r.setFieldValue([...e,"record","female_record"],s),r.submit()}}),k.jsx(Cx,{onFinishRecord:(s,l)=>{r.setFieldValue([...e,"record","female_record"],s),r.submit()}})]})}),k.jsx(jr,{isOpen:!!a,children:k.jsx(xx,{url:a,formPath:[[...e,"record","female_record"],[...e,"record","transcript_original"]]})})]})]})})]})}),k.jsx($f,{style:{margin:"8px 0"}}),k.jsx($t.Item,{name:[...e,"record","personalize"],valuePropName:"checked",style:{marginBottom:"8px"},children:k.jsx(Ef,{children:k.jsx(bu,{strong:!0,children:"Cá nhân hoá"})})}),k.jsx(jr,{isOpen:n,children:k.jsx(vye,{})}),k.jsx($t.Item,{name:[...e,"record","transcript_with_timestamp"],label:"Transcript với timestamp",hidden:!0,children:k.jsx(Ex,{placeholder:"<span start='0.0' end='0.3'>em</span> ...",rows:2})}),k.jsx($t.Item,{name:[...e,"record","transcript_original"],label:"Transcript gốc",hidden:!0,children:k.jsx(Ex,{placeholder:"Em chào anh chị ạ",rows:2})}),k.jsx($t.Item,{name:[...e,"record","transcript_personalize"],label:"Transcript cá nhân hóa",hidden:!0,children:k.jsx(Ex,{placeholder:"Em chào {{name}} ạ",rows:2})})]})},bye=({id:e})=>{const{getNode:t,setNodes:n}=no(),r=Bg(),{infos:o,errors:i}=tv(e),a=o.length!==0||i.length!==0,{data:s}=t(e),l=s,[c]=$t.useForm(),u=$t.useWatch(["type"],c)||Yn.MACHINE,d=p=>{r(e,p)},h=ha.debounce(()=>{c.submit()},500);return k.jsx("div",{className:ufe,children:k.jsx($t,{form:c,layout:"vertical",initialValues:{...l},onFinish:d,onBlur:()=>{c.submit()},onChange:()=>{h()},children:k.jsxs(an,{direction:"vertical",size:"small",style:{height:"500px"},children:[k.jsx($t.Item,{name:["type"],noStyle:!0,children:k.jsx(Ew,{block:!0,options:[{label:"Giọng máy",value:Yn.MACHINE},{label:"Ghi âm",value:Yn.RECORD},{label:"Prompt",value:Yn.PROMPT}]})}),k.jsx(jr,{isOpen:u===Yn.RECORD,children:k.jsx(yye,{})}),k.jsx(jr,{isOpen:u===Yn.MACHINE,children:k.jsx(ffe,{})}),k.jsx(jr,{isOpen:u===Yn.PROMPT,children:k.jsx(pfe,{})}),k.jsxs(qa,{visible:a,children:[k.jsx($f,{style:{margin:"4px 0"}}),!ha.isEmpty(o)&&k.jsx("div",{className:Z3,children:o.map(p=>k.jsx(Rc,{message:p.title,description:p.description,type:"info",showIcon:!0,closable:!0,style:{padding:"12px",margin:"12px 0"}},p.title))}),!ha.isEmpty(i)&&k.jsx("div",{className:Z3,children:i.map(p=>k.jsx(Rc,{style:{padding:"12px"},message:p.title,description:p.description,type:"error",showIcon:!0,closable:!0},p.title))})]}),k.jsx(jS,{id:e}),k.jsx("div",{style:{height:"200px"}})]})})})},$x=({id:e,data:t,mini:n})=>{const{displayComponent:r}=kg(),{errors:o}=tv(e),i=t.title||"Bot nói",a=t.type||Yn.RECORD,s=T.useMemo(()=>{var u,d,h;return a===Yn.MACHINE?((u=t==null?void 0:t.machine)==null?void 0:u.content)||"Vui lòng nhập nội dung":a===Yn.PROMPT?((d=t==null?void 0:t.prompt)==null?void 0:d.content)||"Vui lòng nhập nội dung":a===Yn.RECORD?((h=t==null?void 0:t.record)==null?void 0:h.transcript_original)||"Vui lòng ghi âm hoặc tải file ghi âm":"N/A"},[a,t]),l=u=>{var d;(d=u.target)!=null&&d.closest("button")||(u.stopPropagation(),u.preventDefault(),r(k.jsx(bye,{id:e}),"Cài đặt bot nói"))},c=T.useMemo(()=>a===Yn.RECORD?"Ghi âm":a===Yn.MACHINE?"Giọng máy":a===Yn.PROMPT?"Prompt":"UNKNOWN",[a]);return n?k.jsx("div",{className:sfe,children:k.jsx("div",{className:G3,children:k.jsxs("div",{className:K3,children:[k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[k.jsx("span",{className:X3,children:k.jsx(mb,{})}),k.jsx("span",{className:Y3,children:i})]}),k.jsx("div",{className:Q3,children:c})]})})}):k.jsx("div",{className:afe,onClick:l,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&l(u)},children:k.jsxs("div",{className:G3,children:[k.jsxs("div",{className:K3,children:[k.jsx("span",{className:X3,children:k.jsx(mb,{})}),k.jsx("span",{className:Y3,children:i}),k.jsx(Vg,{id:e,color:In.common.red}),k.jsx("div",{className:Q3,children:c}),k.jsx(Fg,{id:e,deleteBtnColor:In.common.red})]}),k.jsx(jr,{isOpen:!ha.isEmpty(o),children:k.jsx("div",{className:lfe,children:o.map(u=>k.jsx(Rc,{style:{width:"100%"},message:u.title,type:"error",showIcon:!0,closable:!0},`small-${e}-${u.title}`))})}),k.jsx("div",{className:cfe,children:k.jsx(qa,{children:s},`${e}-${s}`)})]})})};var wye="scripts_editor_flqrya0",Cye="scripts_editor_flqrya1",xye="scripts_editor_flqrya2 scripts_editor_flqrya1",$L="scripts_editor_flqrya3",Sye="scripts_editor_flqrya4",Eye="scripts_editor_flqrya5 scripts_editor_flqrya4";const _L=({mini:e})=>e?k.jsxs("div",{className:xye,children:[k.jsx("span",{className:$L,children:k.jsx(J5,{style:{fontSize:"20px"}})}),k.jsx("span",{className:Eye,children:"Bắt đầu"})]}):k.jsx("div",{className:wye,children:k.jsxs("div",{className:Cye,children:[k.jsx("span",{className:$L,children:k.jsx(J5,{})}),k.jsx("span",{className:Sye,children:"Bắt đầu"})]})}),OL=T.createContext({});function $ye(e){const t=T.useRef(null);return t.current===null&&(t.current=e()),t.current}const _x=typeof window<"u",_ye=_x?T.useLayoutEffect:T.useEffect,Ox=T.createContext(null);function Nx(e,t){e.indexOf(t)===-1&&e.push(t)}function Tx(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Ka=(e,t,n)=>n>t?t:n<e?e:n;function Ix(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}let wu=()=>{},Xa=()=>{};process.env.NODE_ENV!=="production"&&(wu=(e,t,n)=>{!e&&typeof console<"u"&&console.warn(Ix(t,n))},Xa=(e,t,n)=>{if(!e)throw new Error(Ix(t,n))});const Ya={},NL=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function TL(e){return typeof e=="object"&&e!==null}const IL=e=>/^0[^.\s]+$/u.test(e);function Px(e){let t;return()=>(t===void 0&&(t=e()),t)}const ai=e=>e,Oye=(e,t)=>n=>t(e(n)),fh=(...e)=>e.reduce(Oye),hh=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class Mx{constructor(){this.subscriptions=[]}add(t){return Nx(this.subscriptions,t),()=>Tx(this.subscriptions,t)}notify(t,n,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,n,r);else for(let i=0;i<o;i++){const a=this.subscriptions[i];a&&a(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Hi=e=>e*1e3,ya=e=>e/1e3;function PL(e,t){return t?e*(1e3/t):0}const ML=new Set;function Ax(e,t,n){e||ML.has(t)||(console.warn(Ix(t,n)),ML.add(t))}const AL=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Nye=1e-7,Tye=12;function Iye(e,t,n,r,o){let i,a,s=0;do a=t+(n-t)/2,i=AL(a,r,o)-e,i>0?n=a:t=a;while(Math.abs(i)>Nye&&++s<Tye);return a}function ph(e,t,n,r){if(e===t&&n===r)return ai;const o=i=>Iye(i,0,1,e,n);return i=>i===0||i===1?i:AL(o(i),t,r)}const DL=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,LL=e=>t=>1-e(1-t),RL=ph(.33,1.53,.69,.99),Dx=LL(RL),kL=DL(Dx),FL=e=>(e*=2)<1?.5*Dx(e):.5*(2-Math.pow(2,-10*(e-1))),Lx=e=>1-Math.sin(Math.acos(e)),BL=LL(Lx),VL=DL(Lx),Pye=ph(.42,0,1,1),Mye=ph(0,0,.58,1),zL=ph(.42,0,.58,1),Aye=e=>Array.isArray(e)&&typeof e[0]!="number",jL=e=>Array.isArray(e)&&typeof e[0]=="number",HL={linear:ai,easeIn:Pye,easeInOut:zL,easeOut:Mye,circIn:Lx,circInOut:VL,circOut:BL,backIn:Dx,backInOut:kL,backOut:RL,anticipate:FL},Dye=e=>typeof e=="string",WL=e=>{if(jL(e)){Xa(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,n,r,o]=e;return ph(t,n,r,o)}else if(Dye(e))return Xa(HL[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),HL[e];return e},Vv=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Lye(e,t){let n=new Set,r=new Set,o=!1,i=!1;const a=new WeakSet;let s={delta:0,timestamp:0,isProcessing:!1};function l(u){a.has(u)&&(c.schedule(u),e()),u(s)}const c={schedule:(u,d=!1,h=!1)=>{const y=h&&o?n:r;return d&&a.add(u),y.has(u)||y.add(u),u},cancel:u=>{r.delete(u),a.delete(u)},process:u=>{if(s=u,o){i=!0;return}o=!0,[n,r]=[r,n],n.forEach(l),n.clear(),o=!1,i&&(i=!1,c.process(u))}};return c}const Rye=40;function UL(e,t){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=Vv.reduce((C,S)=>(C[S]=Lye(i),C),{}),{setup:s,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:h,render:p,postRender:y}=a,b=()=>{const C=Ya.useManualTiming?o.timestamp:performance.now();n=!1,Ya.useManualTiming||(o.delta=r?1e3/60:Math.max(Math.min(C-o.timestamp,Rye),1)),o.timestamp=C,o.isProcessing=!0,s.process(o),l.process(o),c.process(o),u.process(o),d.process(o),h.process(o),p.process(o),y.process(o),o.isProcessing=!1,n&&t&&(r=!1,e(b))},v=()=>{n=!0,r=!0,o.isProcessing||e(b)};return{schedule:Vv.reduce((C,S)=>{const E=a[S];return C[S]=($,O=!1,N=!1)=>(n||v(),E.schedule($,O,N)),C},{}),cancel:C=>{for(let S=0;S<Vv.length;S++)a[Vv[S]].cancel(C)},state:o,steps:a}}const{schedule:Rn,cancel:Rs,state:Hr,steps:Rx}=UL(typeof requestAnimationFrame<"u"?requestAnimationFrame:ai,!0);let zv;function kye(){zv=void 0}const So={now:()=>(zv===void 0&&So.set(Hr.isProcessing||Ya.useManualTiming?Hr.timestamp:performance.now()),zv),set:e=>{zv=e,queueMicrotask(kye)}},qL=e=>t=>typeof t=="string"&&t.startsWith(e),kx=qL("--"),Fye=qL("var(--"),Fx=e=>Fye(e)?Bye.test(e.split("/*")[0].trim()):!1,Bye=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Cu={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},mh={...Cu,transform:e=>Ka(0,1,e)},jv={...Cu,default:1},gh=e=>Math.round(e*1e5)/1e5,Bx=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Vye(e){return e==null}const zye=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Vx=(e,t)=>n=>!!(typeof n=="string"&&zye.test(n)&&n.startsWith(e)||t&&!Vye(n)&&Object.prototype.hasOwnProperty.call(n,t)),GL=(e,t,n)=>r=>{if(typeof r!="string")return r;const[o,i,a,s]=r.match(Bx);return{[e]:parseFloat(o),[t]:parseFloat(i),[n]:parseFloat(a),alpha:s!==void 0?parseFloat(s):1}},jye=e=>Ka(0,255,e),zx={...Cu,transform:e=>Math.round(jye(e))},kl={test:Vx("rgb","red"),parse:GL("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+zx.transform(e)+", "+zx.transform(t)+", "+zx.transform(n)+", "+gh(mh.transform(r))+")"};function Hye(e){let t="",n="",r="",o="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),o=e.substring(4,5),t+=t,n+=n,r+=r,o+=o),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const jx={test:Vx("#"),parse:Hye,transform:kl.transform},vh=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ks=vh("deg"),ba=vh("%"),St=vh("px"),Wye=vh("vh"),Uye=vh("vw"),KL={...ba,parse:e=>ba.parse(e)/100,transform:e=>ba.transform(e*100)},xu={test:Vx("hsl","hue"),parse:GL("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+ba.transform(gh(t))+", "+ba.transform(gh(n))+", "+gh(mh.transform(r))+")"},pr={test:e=>kl.test(e)||jx.test(e)||xu.test(e),parse:e=>kl.test(e)?kl.parse(e):xu.test(e)?xu.parse(e):jx.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?kl.transform(e):xu.transform(e),getAnimatableNone:e=>{const t=pr.parse(e);return t.alpha=0,pr.transform(t)}},qye=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Gye(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Bx))==null?void 0:t.length)||0)+(((n=e.match(qye))==null?void 0:n.length)||0)>0}const XL="number",YL="color",Kye="var",Xye="var(",QL="${}",Yye=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function yh(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const s=t.replace(Yye,l=>(pr.test(l)?(r.color.push(i),o.push(YL),n.push(pr.parse(l))):l.startsWith(Xye)?(r.var.push(i),o.push(Kye),n.push(l)):(r.number.push(i),o.push(XL),n.push(parseFloat(l))),++i,QL)).split(QL);return{values:n,split:s,indexes:r,types:o}}function ZL(e){return yh(e).values}function JL(e){const{split:t,types:n}=yh(e),r=t.length;return o=>{let i="";for(let a=0;a<r;a++)if(i+=t[a],o[a]!==void 0){const s=n[a];s===XL?i+=gh(o[a]):s===YL?i+=pr.transform(o[a]):i+=o[a]}return i}}const Qye=e=>typeof e=="number"?0:pr.test(e)?pr.getAnimatableNone(e):e;function Zye(e){const t=ZL(e);return JL(e)(t.map(Qye))}const Fs={test:Gye,parse:ZL,createTransformer:JL,getAnimatableNone:Zye};function Hx(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Jye({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let o=0,i=0,a=0;if(!t)o=i=a=n;else{const s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;o=Hx(l,s,e+1/3),i=Hx(l,s,e),a=Hx(l,s,e-1/3)}return{red:Math.round(o*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:r}}function Hv(e,t){return n=>n>0?t:e}const jn=(e,t,n)=>e+(t-e)*n,Wx=(e,t,n)=>{const r=e*e,o=n*(t*t-r)+r;return o<0?0:Math.sqrt(o)},ebe=[jx,kl,xu],tbe=e=>ebe.find(t=>t.test(e));function eR(e){const t=tbe(e);if(wu(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let n=t.parse(e);return t===xu&&(n=Jye(n)),n}const tR=(e,t)=>{const n=eR(e),r=eR(t);if(!n||!r)return Hv(e,t);const o={...n};return i=>(o.red=Wx(n.red,r.red,i),o.green=Wx(n.green,r.green,i),o.blue=Wx(n.blue,r.blue,i),o.alpha=jn(n.alpha,r.alpha,i),kl.transform(o))},Ux=new Set(["none","hidden"]);function nbe(e,t){return Ux.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function rbe(e,t){return n=>jn(e,t,n)}function qx(e){return typeof e=="number"?rbe:typeof e=="string"?Fx(e)?Hv:pr.test(e)?tR:abe:Array.isArray(e)?nR:typeof e=="object"?pr.test(e)?tR:obe:Hv}function nR(e,t){const n=[...e],r=n.length,o=e.map((i,a)=>qx(i)(i,t[a]));return i=>{for(let a=0;a<r;a++)n[a]=o[a](i);return n}}function obe(e,t){const n={...e,...t},r={};for(const o in n)e[o]!==void 0&&t[o]!==void 0&&(r[o]=qx(e[o])(e[o],t[o]));return o=>{for(const i in r)n[i]=r[i](o);return n}}function ibe(e,t){const n=[],r={color:0,var:0,number:0};for(let o=0;o<t.values.length;o++){const i=t.types[o],a=e.indexes[i][r[i]],s=e.values[a]??0;n[o]=s,r[i]++}return n}const abe=(e,t)=>{const n=Fs.createTransformer(t),r=yh(e),o=yh(t);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?Ux.has(e)&&!o.values.length||Ux.has(t)&&!r.values.length?nbe(e,t):fh(nR(ibe(r,o),o.values),n):(wu(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),Hv(e,t))};function rR(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?jn(e,t,n):qx(e)(e,t)}const sbe=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Rn.update(t,n),stop:()=>Rs(t),now:()=>Hr.isProcessing?Hr.timestamp:So.now()}},oR=(e,t,n=10)=>{let r="";const o=Math.max(Math.round(t/n),2);for(let i=0;i<o;i++)r+=Math.round(e(i/(o-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Wv=2e4;function Gx(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<Wv;)t+=n,r=e.next(t);return t>=Wv?1/0:t}function lbe(e,t=100,n){const r=n({...e,keyframes:[0,t]}),o=Math.min(Gx(r),Wv);return{type:"keyframes",ease:i=>r.next(o*i).value/t,duration:ya(o)}}const cbe=5;function iR(e,t,n){const r=Math.max(t-cbe,0);return PL(n-e(r),t-r)}const Hn={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Kx=.001;function ube({duration:e=Hn.duration,bounce:t=Hn.bounce,velocity:n=Hn.velocity,mass:r=Hn.mass}){let o,i;wu(e<=Hi(Hn.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let a=1-t;a=Ka(Hn.minDamping,Hn.maxDamping,a),e=Ka(Hn.minDuration,Hn.maxDuration,ya(e)),a<1?(o=c=>{const u=c*a,d=u*e,h=u-n,p=Xx(c,a),y=Math.exp(-d);return Kx-h/p*y},i=c=>{const d=c*a*e,h=d*n+n,p=Math.pow(a,2)*Math.pow(c,2)*e,y=Math.exp(-d),b=Xx(Math.pow(c,2),a);return(-o(c)+Kx>0?-1:1)*((h-p)*y)/b}):(o=c=>{const u=Math.exp(-c*e),d=(c-n)*e+1;return-Kx+u*d},i=c=>{const u=Math.exp(-c*e),d=(n-c)*(e*e);return u*d});const s=5/e,l=fbe(o,i,s);if(e=Hi(e),isNaN(l))return{stiffness:Hn.stiffness,damping:Hn.damping,duration:e};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:a*2*Math.sqrt(r*c),duration:e}}}const dbe=12;function fbe(e,t,n){let r=n;for(let o=1;o<dbe;o++)r=r-e(r)/t(r);return r}function Xx(e,t){return e*Math.sqrt(1-t*t)}const hbe=["duration","bounce"],pbe=["stiffness","damping","mass"];function aR(e,t){return t.some(n=>e[n]!==void 0)}function mbe(e){let t={velocity:Hn.velocity,stiffness:Hn.stiffness,damping:Hn.damping,mass:Hn.mass,isResolvedFromDuration:!1,...e};if(!aR(e,pbe)&&aR(e,hbe))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),o=r*r,i=2*Ka(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:Hn.mass,stiffness:o,damping:i}}else{const n=ube(e);t={...t,...n,mass:Hn.mass},t.isResolvedFromDuration=!0}return t}function Uv(e=Hn.visualDuration,t=Hn.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:o}=n;const i=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],s={done:!1,value:i},{stiffness:l,damping:c,mass:u,duration:d,velocity:h,isResolvedFromDuration:p}=mbe({...n,velocity:-ya(n.velocity||0)}),y=h||0,b=c/(2*Math.sqrt(l*u)),v=a-i,w=ya(Math.sqrt(l/u)),x=Math.abs(v)<5;r||(r=x?Hn.restSpeed.granular:Hn.restSpeed.default),o||(o=x?Hn.restDelta.granular:Hn.restDelta.default);let C;if(b<1){const E=Xx(w,b);C=$=>{const O=Math.exp(-b*w*$);return a-O*((y+b*w*v)/E*Math.sin(E*$)+v*Math.cos(E*$))}}else if(b===1)C=E=>a-Math.exp(-w*E)*(v+(y+w*v)*E);else{const E=w*Math.sqrt(b*b-1);C=$=>{const O=Math.exp(-b*w*$),N=Math.min(E*$,300);return a-O*((y+b*w*v)*Math.sinh(N)+E*v*Math.cosh(N))/E}}const S={calculatedDuration:p&&d||null,next:E=>{const $=C(E);if(p)s.done=E>=d;else{let O=E===0?y:0;b<1&&(O=E===0?Hi(y):iR(C,E,$));const N=Math.abs(O)<=r,I=Math.abs(a-$)<=o;s.done=N&&I}return s.value=s.done?a:$,s},toString:()=>{const E=Math.min(Gx(S),Wv),$=oR(O=>S.next(E*O).value,E,30);return E+"ms "+$},toTransition:()=>{}};return S}Uv.applyToOptions=e=>{const t=lbe(e,100,Uv);return e.ease=t.ease,e.duration=Hi(t.duration),e.type="keyframes",e};function Yx({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:i=500,modifyTarget:a,min:s,max:l,restDelta:c=.5,restSpeed:u}){const d=e[0],h={done:!1,value:d},p=N=>s!==void 0&&N<s||l!==void 0&&N>l,y=N=>s===void 0?l:l===void 0||Math.abs(s-N)<Math.abs(l-N)?s:l;let b=n*t;const v=d+b,w=a===void 0?v:a(v);w!==v&&(b=w-d);const x=N=>-b*Math.exp(-N/r),C=N=>w+x(N),S=N=>{const I=x(N),M=C(N);h.done=Math.abs(I)<=c,h.value=h.done?w:M};let E,$;const O=N=>{p(h.value)&&(E=N,$=Uv({keyframes:[h.value,y(h.value)],velocity:iR(C,N,h.value),damping:o,stiffness:i,restDelta:c,restSpeed:u}))};return O(0),{calculatedDuration:null,next:N=>{let I=!1;return!$&&E===void 0&&(I=!0,S(N),O(N)),E!==void 0&&N>=E?$.next(N-E):(!I&&S(N),h)}}}function gbe(e,t,n){const r=[],o=n||Ya.mix||rR,i=e.length-1;for(let a=0;a<i;a++){let s=o(e[a],e[a+1]);if(t){const l=Array.isArray(t)?t[a]||ai:t;s=fh(l,s)}r.push(s)}return r}function vbe(e,t,{clamp:n=!0,ease:r,mixer:o}={}){const i=e.length;if(Xa(i===t.length,"Both input and output ranges must be the same length","range-length"),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const s=gbe(t,r,o),l=s.length,c=u=>{if(a&&u<e[0])return t[0];let d=0;if(l>1)for(;d<e.length-2&&!(u<e[d+1]);d++);const h=hh(e[d],e[d+1],u);return s[d](h)};return n?u=>c(Ka(e[0],e[i-1],u)):c}function ybe(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const o=hh(0,t,r);e.push(jn(n,1,o))}}function bbe(e){const t=[0];return ybe(t,e.length-1),t}function wbe(e,t){return e.map(n=>n*t)}function Cbe(e,t){return e.map(()=>t||zL).splice(0,e.length-1)}function Su({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const o=Aye(r)?r.map(WL):WL(r),i={done:!1,value:t[0]},a=wbe(n&&n.length===t.length?n:bbe(t),e),s=vbe(a,t,{ease:Array.isArray(o)?o:Cbe(t,o)});return{calculatedDuration:e,next:l=>(i.value=s(l),i.done=l>=e,i)}}const xbe=e=>e!==null;function Qx(e,{repeat:t,repeatType:n="loop"},r,o=1){const i=e.filter(xbe),s=o<0||t&&n!=="loop"&&t%2===1?0:i.length-1;return!s||r===void 0?i[s]:r}const Sbe={decay:Yx,inertia:Yx,tween:Su,keyframes:Su,spring:Uv};function sR(e){typeof e.type=="string"&&(e.type=Sbe[e.type])}class Zx{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const Ebe=e=>e/100;class Jx extends Zx{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var r,o;const{motionValue:n}=this.options;n&&n.updatedAt!==So.now()&&this.tick(So.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(o=(r=this.options).onStop)==null||o.call(r))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;sR(t);const{type:n=Su,repeat:r=0,repeatDelay:o=0,repeatType:i,velocity:a=0}=t;let{keyframes:s}=t;const l=n||Su;process.env.NODE_ENV!=="production"&&l!==Su&&Xa(s.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${s}`,"spring-two-frames"),l!==Su&&typeof s[0]!="number"&&(this.mixKeyframes=fh(Ebe,rR(s[0],s[1])),s=[0,100]);const c=l({...t,keyframes:s});i==="mirror"&&(this.mirroredGenerator=l({...t,keyframes:[...s].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=Gx(c));const{calculatedDuration:u}=c;this.calculatedDuration=u,this.resolvedDuration=u+o,this.totalDuration=this.resolvedDuration*(r+1)-o,this.generator=c}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:o,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:s,calculatedDuration:l}=this;if(this.startTime===null)return r.next(0);const{delay:c=0,keyframes:u,repeat:d,repeatType:h,repeatDelay:p,type:y,onUpdate:b,finalKeyframe:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-o/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const w=this.currentTime-c*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?w<0:w>o;this.currentTime=Math.max(w,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let C=this.currentTime,S=r;if(d){const N=Math.min(this.currentTime,o)/s;let I=Math.floor(N),M=N%1;!M&&N>=1&&(M=1),M===1&&I--,I=Math.min(I,d+1),!!(I%2)&&(h==="reverse"?(M=1-M,p&&(M-=p/s)):h==="mirror"&&(S=a)),C=Ka(0,1,M)*s}const E=x?{done:!1,value:u[0]}:S.next(C);i&&(E.value=i(E.value));let{done:$}=E;!x&&l!==null&&($=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&$);return O&&y!==Yx&&(E.value=Qx(u,this.options,v,this.speed)),b&&b(E.value),O&&this.finish(),E}then(t,n){return this.finished.then(t,n)}get duration(){return ya(this.calculatedDuration)}get time(){return ya(this.currentTime)}set time(t){var n;t=Hi(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(So.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=ya(this.currentTime))}play(){var o,i;if(this.isStopped)return;const{driver:t=sbe,startTime:n}=this.options;this.driver||(this.driver=t(a=>this.tick(a))),(i=(o=this.options).onPlay)==null||i.call(o);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(So.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function $be(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Fl=e=>e*180/Math.PI,eS=e=>{const t=Fl(Math.atan2(e[1],e[0]));return tS(t)},_be={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:eS,rotateZ:eS,skewX:e=>Fl(Math.atan(e[1])),skewY:e=>Fl(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},tS=e=>(e=e%360,e<0&&(e+=360),e),lR=eS,cR=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),uR=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Obe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:cR,scaleY:uR,scale:e=>(cR(e)+uR(e))/2,rotateX:e=>tS(Fl(Math.atan2(e[6],e[5]))),rotateY:e=>tS(Fl(Math.atan2(-e[2],e[0]))),rotateZ:lR,rotate:lR,skewX:e=>Fl(Math.atan(e[4])),skewY:e=>Fl(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function nS(e){return e.includes("scale")?1:0}function rS(e,t){if(!e||e==="none")return nS(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(n)r=Obe,o=n;else{const s=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=_be,o=s}if(!o)return nS(t);const i=r[t],a=o[1].split(",").map(Tbe);return typeof i=="function"?i(a):a[i]}const Nbe=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return rS(n,t)};function Tbe(e){return parseFloat(e.trim())}const Eu=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],$u=new Set(Eu),dR=e=>e===Cu||e===St,Ibe=new Set(["x","y","z"]),Pbe=Eu.filter(e=>!Ibe.has(e));function Mbe(e){const t=[];return Pbe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Bl={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>rS(t,"x"),y:(e,{transform:t})=>rS(t,"y")};Bl.translateX=Bl.x,Bl.translateY=Bl.y;const Vl=new Set;let oS=!1,iS=!1,aS=!1;function fR(){if(iS){const e=Array.from(Vl).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const o=Mbe(r);o.length&&(n.set(r,o),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const o=n.get(r);o&&o.forEach(([i,a])=>{var s;(s=r.getValue(i))==null||s.set(a)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}iS=!1,oS=!1,Vl.forEach(e=>e.complete(aS)),Vl.clear()}function hR(){Vl.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(iS=!0)})}function Abe(){aS=!0,hR(),fR(),aS=!1}class sS{constructor(t,n,r,o,i,a=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=o,this.element=i,this.isAsync=a}scheduleResolve(){this.state="scheduled",this.isAsync?(Vl.add(this),oS||(oS=!0,Rn.read(hR),Rn.resolveKeyframes(fR))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:o}=this;if(t[0]===null){const i=o==null?void 0:o.get(),a=t[t.length-1];if(i!==void 0)t[0]=i;else if(r&&n){const s=r.readValue(n,a);s!=null&&(t[0]=s)}t[0]===void 0&&(t[0]=a),o&&i===void 0&&o.set(t[0])}$be(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Vl.delete(this)}cancel(){this.state==="scheduled"&&(Vl.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Dbe=e=>e.startsWith("--");function Lbe(e,t,n){Dbe(t)?e.style.setProperty(t,n):e.style[t]=n}const Rbe=Px(()=>window.ScrollTimeline!==void 0),kbe={};function Fbe(e,t){const n=Px(e);return()=>kbe[t]??n()}const pR=Fbe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),bh=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,mR={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:bh([0,.65,.55,1]),circOut:bh([.55,0,1,.45]),backIn:bh([.31,.01,.66,-.59]),backOut:bh([.33,1.53,.69,.99])};function gR(e,t){if(e)return typeof e=="function"?pR()?oR(e,t):"ease-out":jL(e)?bh(e):Array.isArray(e)?e.map(n=>gR(n,t)||mR.easeOut):mR[e]}function Bbe(e,t,n,{delay:r=0,duration:o=300,repeat:i=0,repeatType:a="loop",ease:s="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const d=gR(s,o);Array.isArray(d)&&(u.easing=d);const h={delay:r,duration:o,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal"};return c&&(h.pseudoElement=c),e.animate(u,h)}function vR(e){return typeof e=="function"&&"applyToOptions"in e}function Vbe({type:e,...t}){return vR(e)&&pR()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class zbe extends Zx{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:r,keyframes:o,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:s,onComplete:l}=t;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=t,Xa(typeof t.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const c=Vbe(t);this.animation=Bbe(n,r,o,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const u=Qx(o,this.options,s,this.speed);this.updateMotionValue?this.updateMotionValue(u):Lbe(n,r,u),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,n;this.isPseudoElement||(n=(t=this.animation).commitStyles)==null||n.call(t)}get duration(){var n,r;const t=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return ya(Number(t))}get time(){return ya(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=Hi(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){var r;return this.allowFlatten&&((r=this.animation.effect)==null||r.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&Rbe()?(this.animation.timeline=t,ai):n(this)}}const yR={anticipate:FL,backInOut:kL,circInOut:VL};function jbe(e){return e in yR}function Hbe(e){typeof e.ease=="string"&&jbe(e.ease)&&(e.ease=yR[e.ease])}const bR=10;class Wbe extends zbe{constructor(t){Hbe(t),sR(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:o,element:i,...a}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const s=new Jx({...a,autoplay:!1}),l=Hi(this.finishedTime??this.time);n.setWithVelocity(s.sample(l-bR).value,s.sample(l).value,bR),s.stop()}}const wR=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Fs.test(e)||e==="0")&&!e.startsWith("url("));function Ube(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function qbe(e,t,n,r){const o=e[0];if(o===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],a=wR(o,t),s=wR(i,t);return wu(a===s,`You are trying to animate ${t} from "${o}" to "${i}". "${a?i:o}" is not an animatable value.`,"value-not-animatable"),!a||!s?!1:Ube(e)||(n==="spring"||vR(n))&&r}function lS(e){e.duration=0,e.type}const Gbe=new Set(["opacity","clipPath","filter","transform"]),Kbe=Px(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Xbe(e){var u;const{motionValue:t,name:n,repeatDelay:r,repeatType:o,damping:i,type:a}=e;if(!(((u=t==null?void 0:t.owner)==null?void 0:u.current)instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:c}=t.owner.getProps();return Kbe()&&n&&Gbe.has(n)&&(n!=="transform"||!c)&&!l&&!r&&o!=="mirror"&&i!==0&&a!=="inertia"}const Ybe=40;class Qbe extends Zx{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:o=0,repeatDelay:i=0,repeatType:a="loop",keyframes:s,name:l,motionValue:c,element:u,...d}){var y;super(),this.stop=()=>{var b,v;this._animation&&(this._animation.stop(),(b=this.stopTimeline)==null||b.call(this)),(v=this.keyframeResolver)==null||v.cancel()},this.createdAt=So.now();const h={autoplay:t,delay:n,type:r,repeat:o,repeatDelay:i,repeatType:a,name:l,motionValue:c,element:u,...d},p=(u==null?void 0:u.KeyframeResolver)||sS;this.keyframeResolver=new p(s,(b,v,w)=>this.onKeyframesResolved(b,v,h,!w),l,c,u),(y=this.keyframeResolver)==null||y.scheduleResolve()}onKeyframesResolved(t,n,r,o){this.keyframeResolver=void 0;const{name:i,type:a,velocity:s,delay:l,isHandoff:c,onUpdate:u}=r;this.resolvedAt=So.now(),qbe(t,i,a,s)||((Ya.instantAnimations||!l)&&(u==null||u(Qx(t,r,n))),t[0]=t[t.length-1],lS(r),r.repeat=0);const h={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>Ybe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},p=!c&&Xbe(h)?new Wbe({...h,element:h.motionValue.owner.current}):new Jx(h);p.finished.then(()=>this.notifyFinished()).catch(ai),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),Abe()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}const Zbe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Jbe(e){const t=Zbe.exec(e);if(!t)return[,];const[,n,r,o]=t;return[`--${n??r}`,o]}const e1e=4;function CR(e,t,n=1){Xa(n<=e1e,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,o]=Jbe(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const a=i.trim();return NL(a)?parseFloat(a):a}return Fx(o)?CR(o,t,n+1):o}function cS(e,t){return(e==null?void 0:e[t])??(e==null?void 0:e.default)??e}const xR=new Set(["width","height","top","left","right","bottom",...Eu]),t1e={test:e=>e==="auto",parse:e=>e},SR=e=>t=>t.test(e),ER=[Cu,St,ba,ks,Uye,Wye,t1e],$R=e=>ER.find(SR(e));function n1e(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||IL(e):!0}const r1e=new Set(["brightness","contrast","saturate","opacity"]);function o1e(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Bx)||[];if(!r)return e;const o=n.replace(r,"");let i=r1e.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+o+")"}const i1e=/\b([a-z-]*)\(.*?\)/gu,uS={...Fs,getAnimatableNone:e=>{const t=e.match(i1e);return t?t.map(o1e).join(" "):e}},_R={...Cu,transform:Math.round},dS={borderWidth:St,borderTopWidth:St,borderRightWidth:St,borderBottomWidth:St,borderLeftWidth:St,borderRadius:St,radius:St,borderTopLeftRadius:St,borderTopRightRadius:St,borderBottomRightRadius:St,borderBottomLeftRadius:St,width:St,maxWidth:St,height:St,maxHeight:St,top:St,right:St,bottom:St,left:St,padding:St,paddingTop:St,paddingRight:St,paddingBottom:St,paddingLeft:St,margin:St,marginTop:St,marginRight:St,marginBottom:St,marginLeft:St,backgroundPositionX:St,backgroundPositionY:St,...{rotate:ks,rotateX:ks,rotateY:ks,rotateZ:ks,scale:jv,scaleX:jv,scaleY:jv,scaleZ:jv,skew:ks,skewX:ks,skewY:ks,distance:St,translateX:St,translateY:St,translateZ:St,x:St,y:St,z:St,perspective:St,transformPerspective:St,opacity:mh,originX:KL,originY:KL,originZ:St},zIndex:_R,fillOpacity:mh,strokeOpacity:mh,numOctaves:_R},a1e={...dS,color:pr,backgroundColor:pr,outlineColor:pr,fill:pr,stroke:pr,borderColor:pr,borderTopColor:pr,borderRightColor:pr,borderBottomColor:pr,borderLeftColor:pr,filter:uS,WebkitFilter:uS},OR=e=>a1e[e];function NR(e,t){let n=OR(e);return n!==uS&&(n=Fs),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const s1e=new Set(["auto","none","0"]);function l1e(e,t,n){let r=0,o;for(;r<e.length&&!o;){const i=e[r];typeof i=="string"&&!s1e.has(i)&&yh(i).values.length&&(o=e[r]),r++}if(o&&n)for(const i of t)e[i]=NR(n,o)}class c1e extends sS{constructor(t,n,r,o,i){super(t,n,r,o,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let l=0;l<t.length;l++){let c=t[l];if(typeof c=="string"&&(c=c.trim(),Fx(c))){const u=CR(c,n.current);u!==void 0&&(t[l]=u),l===t.length-1&&(this.finalKeyframe=c)}}if(this.resolveNoneKeyframes(),!xR.has(r)||t.length!==2)return;const[o,i]=t,a=$R(o),s=$R(i);if(a!==s)if(dR(a)&&dR(s))for(let l=0;l<t.length;l++){const c=t[l];typeof c=="string"&&(t[l]=parseFloat(c))}else Bl[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let o=0;o<t.length;o++)(t[o]===null||n1e(t[o]))&&r.push(o);r.length&&l1e(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Bl[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&t.getValue(r,o).jump(o,!1)}measureEndState(){var s;const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const o=t.getValue(n);o&&o.jump(this.measuredOrigin,!1);const i=r.length-1,a=r[i];r[i]=Bl[n](t.measureViewportBox(),window.getComputedStyle(t.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),(s=this.removedTransforms)!=null&&s.length&&this.removedTransforms.forEach(([l,c])=>{t.getValue(l).set(c)}),this.resolveNoneKeyframes()}}function u1e(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const o=(n==null?void 0:n[e])??r.querySelectorAll(e);return o?Array.from(o):[]}return Array.from(e)}const TR=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function d1e(e){return TL(e)&&"offsetHeight"in e}const IR=30,f1e=e=>!isNaN(parseFloat(e));class h1e{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var i;const o=So.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=So.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=f1e(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return process.env.NODE_ENV!=="production"&&Ax(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Mx);const r=this.events[t].add(n);return t==="change"?()=>{r(),Rn.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=So.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>IR)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,IR);return PL(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function _u(e,t){return new h1e(e,t)}const{schedule:fS}=UL(queueMicrotask,!1),Wi={x:!1,y:!1};function PR(){return Wi.x||Wi.y}function p1e(e){return e==="x"||e==="y"?Wi[e]?null:(Wi[e]=!0,()=>{Wi[e]=!1}):Wi.x||Wi.y?null:(Wi.x=Wi.y=!0,()=>{Wi.x=Wi.y=!1})}function MR(e,t){const n=u1e(e),r=new AbortController,o={passive:!0,...t,signal:r.signal};return[n,o,()=>r.abort()]}function AR(e){return!(e.pointerType==="touch"||PR())}function m1e(e,t,n={}){const[r,o,i]=MR(e,n),a=s=>{if(!AR(s))return;const{target:l}=s,c=t(l,s);if(typeof c!="function"||!l)return;const u=d=>{AR(d)&&(c(d),l.removeEventListener("pointerleave",u))};l.addEventListener("pointerleave",u,o)};return r.forEach(s=>{s.addEventListener("pointerenter",a,o)}),i}const DR=(e,t)=>t?e===t?!0:DR(e,t.parentElement):!1,hS=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,g1e=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function v1e(e){return g1e.has(e.tagName)||e.tabIndex!==-1}const qv=new WeakSet;function LR(e){return t=>{t.key==="Enter"&&e(t)}}function pS(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const y1e=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=LR(()=>{if(qv.has(n))return;pS(n,"down");const o=LR(()=>{pS(n,"up")}),i=()=>pS(n,"cancel");n.addEventListener("keyup",o,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function RR(e){return hS(e)&&!PR()}function b1e(e,t,n={}){const[r,o,i]=MR(e,n),a=s=>{const l=s.currentTarget;if(!RR(s))return;qv.add(l);const c=t(l,s),u=(p,y)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",h),qv.has(l)&&qv.delete(l),RR(p)&&typeof c=="function"&&c(p,{success:y})},d=p=>{u(p,l===window||l===document||n.useGlobalTarget||DR(l,p.target))},h=p=>{u(p,!1)};window.addEventListener("pointerup",d,o),window.addEventListener("pointercancel",h,o)};return r.forEach(s=>{(n.useGlobalTarget?window:s).addEventListener("pointerdown",a,o),d1e(s)&&(s.addEventListener("focus",c=>y1e(c,o)),!v1e(s)&&!s.hasAttribute("tabindex")&&(s.tabIndex=0))}),i}function kR(e){return TL(e)&&"ownerSVGElement"in e}function w1e(e){return kR(e)&&e.tagName==="svg"}const Xr=e=>!!(e&&e.getVelocity),C1e=[...ER,pr,Fs],x1e=e=>C1e.find(SR(e)),FR=T.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function S1e(e=!0){const t=T.useContext(Ox);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=t,i=T.useId();T.useEffect(()=>{if(e)return o(i)},[e]);const a=T.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,a]:[!0]}const BR=T.createContext({strict:!1}),VR={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Ou={};for(const e in VR)Ou[e]={isEnabled:t=>VR[e].some(n=>!!t[n])};function E1e(e){for(const t in e)Ou[t]={...Ou[t],...e[t]}}const $1e=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Gv(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||$1e.has(e)}let zR=e=>!Gv(e);function _1e(e){typeof e=="function"&&(zR=t=>t.startsWith("on")?!Gv(t):e(t))}try{_1e(require("@emotion/is-prop-valid").default)}catch{}function O1e(e,t,n){const r={};for(const o in e)o==="values"&&typeof e.values=="object"||(zR(o)||n===!0&&Gv(o)||!t&&!Gv(o)||e.draggable&&o.startsWith("onDrag"))&&(r[o]=e[o]);return r}const Kv=T.createContext({});function Xv(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function wh(e){return typeof e=="string"||Array.isArray(e)}const mS=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],gS=["initial",...mS];function Yv(e){return Xv(e.animate)||gS.some(t=>wh(e[t]))}function jR(e){return!!(Yv(e)||e.variants)}function N1e(e,t){if(Yv(e)){const{initial:n,animate:r}=e;return{initial:n===!1||wh(n)?n:void 0,animate:wh(r)?r:void 0}}return e.inherit!==!1?t:{}}function T1e(e){const{initial:t,animate:n}=N1e(e,T.useContext(Kv));return T.useMemo(()=>({initial:t,animate:n}),[HR(t),HR(n)])}function HR(e){return Array.isArray(e)?e.join(" "):e}const Ch={};function I1e(e){for(const t in e)Ch[t]=e[t],kx(t)&&(Ch[t].isCSSVariable=!0)}function WR(e,{layout:t,layoutId:n}){return $u.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Ch[e]||e==="opacity")}const P1e={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},M1e=Eu.length;function A1e(e,t,n){let r="",o=!0;for(let i=0;i<M1e;i++){const a=Eu[i],s=e[a];if(s===void 0)continue;let l=!0;if(typeof s=="number"?l=s===(a.startsWith("scale")?1:0):l=parseFloat(s)===0,!l||n){const c=TR(s,dS[a]);if(!l){o=!1;const u=P1e[a]||a;r+=`${u}(${c}) `}n&&(t[a]=c)}}return r=r.trim(),n?r=n(t,o?"":r):o&&(r="none"),r}function vS(e,t,n){const{style:r,vars:o,transformOrigin:i}=e;let a=!1,s=!1;for(const l in t){const c=t[l];if($u.has(l)){a=!0;continue}else if(kx(l)){o[l]=c;continue}else{const u=TR(c,dS[l]);l.startsWith("origin")?(s=!0,i[l]=u):r[l]=u}}if(t.transform||(a||n?r.transform=A1e(t,e.transform,n):r.transform&&(r.transform="none")),s){const{originX:l="50%",originY:c="50%",originZ:u=0}=i;r.transformOrigin=`${l} ${c} ${u}`}}const yS=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function UR(e,t,n){for(const r in t)!Xr(t[r])&&!WR(r,n)&&(e[r]=t[r])}function D1e({transformTemplate:e},t){return T.useMemo(()=>{const n=yS();return vS(n,t,e),Object.assign({},n.vars,n.style)},[t])}function L1e(e,t){const n=e.style||{},r={};return UR(r,n,e),Object.assign(r,D1e(e,t)),r}function R1e(e,t){const n={},r=L1e(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const k1e={offset:"stroke-dashoffset",array:"stroke-dasharray"},F1e={offset:"strokeDashoffset",array:"strokeDasharray"};function B1e(e,t,n=1,r=0,o=!0){e.pathLength=1;const i=o?k1e:F1e;e[i.offset]=St.transform(-r);const a=St.transform(t),s=St.transform(n);e[i.array]=`${a} ${s}`}function qR(e,{attrX:t,attrY:n,attrScale:r,pathLength:o,pathSpacing:i=1,pathOffset:a=0,...s},l,c,u){if(vS(e,s,c),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:d,style:h}=e;d.transform&&(h.transform=d.transform,delete d.transform),(h.transform||d.transformOrigin)&&(h.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),h.transform&&(h.transformBox=(u==null?void 0:u.transformBox)??"fill-box",delete d.transformBox),t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),o!==void 0&&B1e(d,o,i,a,!1)}const GR=()=>({...yS(),attrs:{}}),KR=e=>typeof e=="string"&&e.toLowerCase()==="svg";function V1e(e,t,n,r){const o=T.useMemo(()=>{const i=GR();return qR(i,t,KR(r),e.transformTemplate,e.style),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};UR(i,e.style,e),o.style={...i,...o.style}}return o}const z1e=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function bS(e){return typeof e!="string"||e.includes("-")?!1:!!(z1e.indexOf(e)>-1||/[A-Z]/u.test(e))}function j1e(e,t,n,{latestValues:r},o,i=!1){const s=(bS(e)?V1e:R1e)(t,r,o,e),l=O1e(t,typeof e=="string",i),c=e!==T.Fragment?{...l,...s,ref:n}:{},{children:u}=t,d=T.useMemo(()=>Xr(u)?u.get():u,[u]);return T.createElement(e,{...c,children:d})}function XR(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function wS(e,t,n,r){if(typeof t=="function"){const[o,i]=XR(r);t=t(n!==void 0?n:e.custom,o,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[o,i]=XR(r);t=t(n!==void 0?n:e.custom,o,i)}return t}function Qv(e){return Xr(e)?e.get():e}function H1e({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,o){return{latestValues:W1e(n,r,o,e),renderState:t()}}function W1e(e,t,n,r){const o={},i=r(e,{});for(const h in i)o[h]=Qv(i[h]);let{initial:a,animate:s}=e;const l=Yv(e),c=jR(e);t&&c&&!l&&e.inherit!==!1&&(a===void 0&&(a=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u=u||a===!1;const d=u?s:a;if(d&&typeof d!="boolean"&&!Xv(d)){const h=Array.isArray(d)?d:[d];for(let p=0;p<h.length;p++){const y=wS(e,h[p]);if(y){const{transitionEnd:b,transition:v,...w}=y;for(const x in w){let C=w[x];if(Array.isArray(C)){const S=u?C.length-1:0;C=C[S]}C!==null&&(o[x]=C)}for(const x in b)o[x]=b[x]}}}return o}const YR=e=>(t,n)=>{const r=T.useContext(Kv),o=T.useContext(Ox),i=()=>H1e(e,t,r,o);return n?i():$ye(i)};function CS(e,t,n){var i;const{style:r}=e,o={};for(const a in r)(Xr(r[a])||t.style&&Xr(t.style[a])||WR(a,e)||((i=n==null?void 0:n.getValue(a))==null?void 0:i.liveStyle)!==void 0)&&(o[a]=r[a]);return o}const U1e=YR({scrapeMotionValuesFromProps:CS,createRenderState:yS});function QR(e,t,n){const r=CS(e,t,n);for(const o in e)if(Xr(e[o])||Xr(t[o])){const i=Eu.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;r[i]=e[o]}return r}const q1e=YR({scrapeMotionValuesFromProps:QR,createRenderState:GR}),G1e=Symbol.for("motionComponentSymbol");function Nu(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function K1e(e,t,n){return T.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Nu(n)&&(n.current=r))},[t])}const xS=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),ZR="data-"+xS("framerAppearId"),JR=T.createContext({});function X1e(e,t,n,r,o){var b,v;const{visualElement:i}=T.useContext(Kv),a=T.useContext(BR),s=T.useContext(Ox),l=T.useContext(FR).reducedMotion,c=T.useRef(null);r=r||a.renderer,!c.current&&r&&(c.current=r(e,{visualState:t,parent:i,props:n,presenceContext:s,blockInitialAnimation:s?s.initial===!1:!1,reducedMotionConfig:l}));const u=c.current,d=T.useContext(JR);u&&!u.projection&&o&&(u.type==="html"||u.type==="svg")&&Y1e(c.current,n,o,d);const h=T.useRef(!1);T.useInsertionEffect(()=>{u&&h.current&&u.update(n,s)});const p=n[ZR],y=T.useRef(!!p&&!((b=window.MotionHandoffIsComplete)!=null&&b.call(window,p))&&((v=window.MotionHasOptimisedAnimation)==null?void 0:v.call(window,p)));return _ye(()=>{u&&(h.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),u.scheduleRenderMicrotask(),y.current&&u.animationState&&u.animationState.animateChanges())}),T.useEffect(()=>{u&&(!y.current&&u.animationState&&u.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{var w;(w=window.MotionHandoffMarkAsComplete)==null||w.call(window,p)}),y.current=!1),u.enteringChildren=void 0)}),u}function Y1e(e,t,n,r){const{layoutId:o,layout:i,drag:a,dragConstraints:s,layoutScroll:l,layoutRoot:c,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:e8(e.parent)),e.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:!!a||s&&Nu(s),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:u,layoutScroll:l,layoutRoot:c})}function e8(e){if(e)return e.options.allowProjection!==!1?e.projection:e8(e.parent)}function SS(e,{forwardMotionProps:t=!1}={},n,r){n&&E1e(n);const o=bS(e)?q1e:U1e;function i(s,l){let c;const u={...T.useContext(FR),...s,layoutId:Q1e(s)},{isStatic:d}=u,h=T1e(s),p=o(s,d);if(!d&&_x){Z1e(u,n);const y=J1e(u);c=y.MeasureLayout,h.visualElement=X1e(e,p,u,r,y.ProjectionNode)}return k.jsxs(Kv.Provider,{value:h,children:[c&&h.visualElement?k.jsx(c,{visualElement:h.visualElement,...u}):null,j1e(e,s,K1e(p,h.visualElement,l),p,d,t)]})}i.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const a=T.forwardRef(i);return a[G1e]=e,a}function Q1e({layoutId:e}){const t=T.useContext(OL).id;return t&&e!==void 0?t+"-"+e:e}function Z1e(e,t){const n=T.useContext(BR).strict;if(process.env.NODE_ENV!=="production"&&t&&n){const r="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?wu(!1,r,"lazy-strict-mode"):Xa(!1,r,"lazy-strict-mode")}}function J1e(e){const{drag:t,layout:n}=Ou;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function ewe(e,t){if(typeof Proxy>"u")return SS;const n=new Map,r=(i,a)=>SS(i,a,e,t),o=(i,a)=>(process.env.NODE_ENV!=="production"&&Ax(!1,"motion() is deprecated. Use motion.create() instead."),r(i,a));return new Proxy(o,{get:(i,a)=>a==="create"?r:(n.has(a)||n.set(a,SS(a,void 0,e,t)),n.get(a))})}function t8({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function twe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function nwe(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function ES(e){return e===void 0||e===1}function $S({scale:e,scaleX:t,scaleY:n}){return!ES(e)||!ES(t)||!ES(n)}function zl(e){return $S(e)||n8(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function n8(e){return r8(e.x)||r8(e.y)}function r8(e){return e&&e!=="0%"}function Zv(e,t,n){const r=e-n,o=t*r;return n+o}function o8(e,t,n,r,o){return o!==void 0&&(e=Zv(e,o,r)),Zv(e,n,r)+t}function _S(e,t=0,n=1,r,o){e.min=o8(e.min,t,n,r,o),e.max=o8(e.max,t,n,r,o)}function i8(e,{x:t,y:n}){_S(e.x,t.translate,t.scale,t.originPoint),_S(e.y,n.translate,n.scale,n.originPoint)}const a8=.999999999999,s8=1.0000000000001;function rwe(e,t,n,r=!1){const o=n.length;if(!o)return;t.x=t.y=1;let i,a;for(let s=0;s<o;s++){i=n[s],a=i.projectionDelta;const{visualElement:l}=i.options;l&&l.props.style&&l.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Iu(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),a&&(t.x*=a.x.scale,t.y*=a.y.scale,i8(e,a)),r&&zl(i.latestValues)&&Iu(e,i.latestValues))}t.x<s8&&t.x>a8&&(t.x=1),t.y<s8&&t.y>a8&&(t.y=1)}function Tu(e,t){e.min=e.min+t,e.max=e.max+t}function l8(e,t,n,r,o=.5){const i=jn(e.min,e.max,o);_S(e,t,n,i,r)}function Iu(e,t){l8(e.x,t.x,t.scaleX,t.scale,t.originX),l8(e.y,t.y,t.scaleY,t.scale,t.originY)}function c8(e,t){return t8(nwe(e.getBoundingClientRect(),t))}function owe(e,t,n){const r=c8(e,n),{scroll:o}=t;return o&&(Tu(r.x,o.offset.x),Tu(r.y,o.offset.y)),r}const u8=()=>({translate:0,scale:1,origin:0,originPoint:0}),Pu=()=>({x:u8(),y:u8()}),d8=()=>({min:0,max:0}),or=()=>({x:d8(),y:d8()}),OS={current:null},f8={current:!1};function iwe(){if(f8.current=!0,!!_x)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>OS.current=e.matches;e.addEventListener("change",t),t()}else OS.current=!1}const awe=new WeakMap;function swe(e,t,n){for(const r in t){const o=t[r],i=n[r];if(Xr(o))e.addValue(r,o);else if(Xr(i))e.addValue(r,_u(o,{owner:e}));else if(i!==o)if(e.hasValue(r)){const a=e.getValue(r);a.liveStyle===!0?a.jump(o):a.hasAnimated||a.set(o)}else{const a=e.getStaticValue(r);e.addValue(r,_u(a!==void 0?a:o,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const h8=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class lwe{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:o,blockInitialAnimation:i,visualState:a},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=sS,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const h=So.now();this.renderScheduledAt<h&&(this.renderScheduledAt=h,Rn.render(this.render,!1,!0))};const{latestValues:l,renderState:c}=a;this.latestValues=l,this.baseTarget={...l},this.initialValues=n.initial?{...l}:{},this.renderState=c,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=o,this.options=s,this.blockInitialAnimation=!!i,this.isControllingVariants=Yv(n),this.isVariantNode=jR(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...d}=this.scrapeMotionValuesFromProps(n,{},this);for(const h in d){const p=d[h];l[h]!==void 0&&Xr(p)&&p.set(l[h])}}mount(t){var n;this.current=t,awe.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,o)=>this.bindToMotionValue(o,r)),f8.current||iwe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:OS.current,process.env.NODE_ENV!=="production"&&Ax(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var t;this.projection&&this.projection.unmount(),Rs(this.notifyUpdate),Rs(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=$u.has(t);r&&this.onBindTransform&&this.onBindTransform();const o=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&Rn.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{o(),i&&i(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Ou){const n=Ou[t];if(!n)continue;const{isEnabled:r,Feature:o}=n;if(!this.features[t]&&o&&r(this.props)&&(this.features[t]=new o(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):or()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<h8.length;r++){const o=h8[r];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const i="on"+o,a=t[i];a&&(this.propEventSubscriptions[o]=this.on(o,a))}this.prevMotionValues=swe(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=_u(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(NL(r)||IL(r))?r=parseFloat(r):!x1e(r)&&Fs.test(n)&&(r=NR(t,n)),this.setBaseTarget(t,Xr(r)?r.get():r)),Xr(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var i;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const a=wS(this.props,n,(i=this.presenceContext)==null?void 0:i.custom);a&&(r=a[t])}if(n&&r!==void 0)return r;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!Xr(o)?o:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Mx),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){fS.render(this.render)}}class p8 extends lwe{constructor(){super(...arguments),this.KeyframeResolver=c1e}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Xr(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function m8(e,{style:t,vars:n},r,o){const i=e.style;let a;for(a in t)i[a]=t[a];o==null||o.applyProjectionStyles(i,r);for(a in n)i.setProperty(a,n[a])}function cwe(e){return window.getComputedStyle(e)}class uwe extends p8{constructor(){super(...arguments),this.type="html",this.renderInstance=m8}readValueFromInstance(t,n){var r;if($u.has(n))return(r=this.projection)!=null&&r.isProjecting?nS(n):Nbe(t,n);{const o=cwe(t),i=(kx(n)?o.getPropertyValue(n):o[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return c8(t,n)}build(t,n,r){vS(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return CS(t,n,r)}}const g8=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function dwe(e,t,n,r){m8(e,t,void 0,r);for(const o in t.attrs)e.setAttribute(g8.has(o)?o:xS(o),t.attrs[o])}class fwe extends p8{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=or}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if($u.has(n)){const r=OR(n);return r&&r.default||0}return n=g8.has(n)?n:xS(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return QR(t,n,r)}build(t,n,r){qR(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,o){dwe(t,n,r,o)}mount(t){this.isSVGTag=KR(t.tagName),super.mount(t)}}const hwe=(e,t)=>bS(e)?new fwe(t):new uwe(t,{allowProjection:e!==T.Fragment});function Mu(e,t,n){const r=e.getProps();return wS(r,t,n!==void 0?n:r.custom,e)}const NS=e=>Array.isArray(e);function pwe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,_u(n))}function mwe(e){return NS(e)?e[e.length-1]||0:e}function gwe(e,t){const n=Mu(e,t);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const a in i){const s=mwe(i[a]);pwe(e,a,s)}}function vwe(e){return!!(Xr(e)&&e.add)}function TS(e,t){const n=e.getValue("willChange");if(vwe(n))return n.add(t);if(!n&&Ya.WillChange){const r=new Ya.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function v8(e){return e.props[ZR]}const ywe=e=>e!==null;function bwe(e,{repeat:t,repeatType:n="loop"},r){const o=e.filter(ywe),i=t&&n!=="loop"&&t%2===1?0:o.length-1;return o[i]}const wwe={type:"spring",stiffness:500,damping:25,restSpeed:10},Cwe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),xwe={type:"keyframes",duration:.8},Swe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ewe=(e,{keyframes:t})=>t.length>2?xwe:$u.has(e)?e.startsWith("scale")?Cwe(t[1]):wwe:Swe;function $we({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:i,repeatType:a,repeatDelay:s,from:l,elapsed:c,...u}){return!!Object.keys(u).length}const IS=(e,t,n,r={},o,i)=>a=>{const s=cS(r,e)||{},l=s.delay||r.delay||0;let{elapsed:c=0}=r;c=c-Hi(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...s,delay:-c,onUpdate:h=>{t.set(h),s.onUpdate&&s.onUpdate(h)},onComplete:()=>{a(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:i?void 0:o};$we(s)||Object.assign(u,Ewe(e,u)),u.duration&&(u.duration=Hi(u.duration)),u.repeatDelay&&(u.repeatDelay=Hi(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(lS(u),u.delay===0&&(d=!0)),(Ya.instantAnimations||Ya.skipAnimations)&&(d=!0,lS(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!i&&t.get()!==void 0){const h=bwe(u.keyframes,s);if(h!==void 0){Rn.update(()=>{u.onUpdate(h),u.onComplete()});return}}return s.isSync?new Jx(u):new Qbe(u)};function _we({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function y8(e,t,{delay:n=0,transitionOverride:r,type:o}={}){let{transition:i=e.getDefaultTransition(),transitionEnd:a,...s}=t;r&&(i=r);const l=[],c=o&&e.animationState&&e.animationState.getState()[o];for(const u in s){const d=e.getValue(u,e.latestValues[u]??null),h=s[u];if(h===void 0||c&&_we(c,u))continue;const p={delay:n,...cS(i||{},u)},y=d.get();if(y!==void 0&&!d.isAnimating&&!Array.isArray(h)&&h===y&&!p.velocity)continue;let b=!1;if(window.MotionHandoffAnimation){const w=v8(e);if(w){const x=window.MotionHandoffAnimation(w,u,Rn);x!==null&&(p.startTime=x,b=!0)}}TS(e,u),d.start(IS(u,d,h,e.shouldReduceMotion&&xR.has(u)?{type:!1}:p,e,b));const v=d.animation;v&&l.push(v)}return a&&Promise.all(l).then(()=>{Rn.update(()=>{a&&gwe(e,a)})}),l}function b8(e,t,n,r=0,o=1){const i=Array.from(e).sort((c,u)=>c.sortNodePosition(u)).indexOf(t),a=e.size,s=(a-1)*r;return typeof n=="function"?n(i,a):o===1?i*r:s-i*r}function PS(e,t,n={}){var l;const r=Mu(e,t,n.type==="exit"?(l=e.presenceContext)==null?void 0:l.custom:void 0);let{transition:o=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(o=n.transitionOverride);const i=r?()=>Promise.all(y8(e,r,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:d,staggerDirection:h}=o;return Owe(e,t,c,u,d,h,n)}:()=>Promise.resolve(),{when:s}=o;if(s){const[c,u]=s==="beforeChildren"?[i,a]:[a,i];return c().then(()=>u())}else return Promise.all([i(),a(n.delay)])}function Owe(e,t,n=0,r=0,o=0,i=1,a){const s=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),s.push(PS(l,t,{...a,delay:n+(typeof r=="function"?0:r)+b8(e.variantChildren,l,r,o,i)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(s)}function Nwe(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const o=t.map(i=>PS(e,i,n));r=Promise.all(o)}else if(typeof t=="string")r=PS(e,t,n);else{const o=typeof t=="function"?Mu(e,t,n.custom):t;r=Promise.all(y8(e,o,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}function w8(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const Twe=gS.length;function C8(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?C8(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<Twe;n++){const r=gS[n],o=e.props[r];(wh(o)||o===!1)&&(t[r]=o)}return t}const Iwe=[...mS].reverse(),Pwe=mS.length;function Mwe(e){return t=>Promise.all(t.map(({animation:n,options:r})=>Nwe(e,n,r)))}function Awe(e){let t=Mwe(e),n=x8(),r=!0;const o=l=>(c,u)=>{var h;const d=Mu(e,u,l==="exit"?(h=e.presenceContext)==null?void 0:h.custom:void 0);if(d){const{transition:p,transitionEnd:y,...b}=d;c={...c,...b,...y}}return c};function i(l){t=l(e)}function a(l){const{props:c}=e,u=C8(e.parent)||{},d=[],h=new Set;let p={},y=1/0;for(let v=0;v<Pwe;v++){const w=Iwe[v],x=n[w],C=c[w]!==void 0?c[w]:u[w],S=wh(C),E=w===l?x.isActive:null;E===!1&&(y=v);let $=C===u[w]&&C!==c[w]&&S;if($&&r&&e.manuallyAnimateOnMount&&($=!1),x.protectedKeys={...p},!x.isActive&&E===null||!C&&!x.prevProp||Xv(C)||typeof C=="boolean")continue;const O=Dwe(x.prevProp,C);let N=O||w===l&&x.isActive&&!$&&S||v>y&&S,I=!1;const M=Array.isArray(C)?C:[C];let A=M.reduce(o(w),{});E===!1&&(A={});const{prevResolvedValues:z={}}=x,B={...z,...A},P=L=>{N=!0,h.has(L)&&(I=!0,h.delete(L)),x.needsAnimating[L]=!0;const V=e.getValue(L);V&&(V.liveStyle=!1)};for(const L in B){const V=A[L],j=z[L];if(p.hasOwnProperty(L))continue;let W=!1;NS(V)&&NS(j)?W=!w8(V,j):W=V!==j,W?V!=null?P(L):h.add(L):V!==void 0&&h.has(L)?P(L):x.protectedKeys[L]=!0}x.prevProp=C,x.prevResolvedValues=A,x.isActive&&(p={...p,...A}),r&&e.blockInitialAnimation&&(N=!1);const F=$&&O;N&&(!F||I)&&d.push(...M.map(L=>{const V={type:w};if(typeof L=="string"&&r&&!F&&e.manuallyAnimateOnMount&&e.parent){const{parent:j}=e,W=Mu(j,L);if(j.enteringChildren&&W){const{delayChildren:U}=W.transition||{};V.delay=b8(j.enteringChildren,e,U)}}return{animation:L,options:V}}))}if(h.size){const v={};if(typeof c.initial!="boolean"){const w=Mu(e,Array.isArray(c.initial)?c.initial[0]:c.initial);w&&w.transition&&(v.transition=w.transition)}h.forEach(w=>{const x=e.getBaseTarget(w),C=e.getValue(w);C&&(C.liveStyle=!0),v[w]=x??null}),d.push({animation:v})}let b=!!d.length;return r&&(c.initial===!1||c.initial===c.animate)&&!e.manuallyAnimateOnMount&&(b=!1),r=!1,b?t(d):Promise.resolve()}function s(l,c){var d;if(n[l].isActive===c)return Promise.resolve();(d=e.variantChildren)==null||d.forEach(h=>{var p;return(p=h.animationState)==null?void 0:p.setActive(l,c)}),n[l].isActive=c;const u=a(l);for(const h in n)n[h].protectedKeys={};return u}return{animateChanges:a,setActive:s,setAnimateFunction:i,getState:()=>n,reset:()=>{n=x8(),r=!0}}}function Dwe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!w8(t,e):!1}function jl(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function x8(){return{animate:jl(!0),whileInView:jl(),whileHover:jl(),whileTap:jl(),whileDrag:jl(),whileFocus:jl(),exit:jl()}}class Bs{constructor(t){this.isMounted=!1,this.node=t}update(){}}class Lwe extends Bs{constructor(t){super(t),t.animationState||(t.animationState=Awe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Xv(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let Rwe=0;class kwe extends Bs{constructor(){super(...arguments),this.id=Rwe++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const o=this.node.animationState.setActive("exit",!t);n&&!t&&o.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const Fwe={animation:{Feature:Lwe},exit:{Feature:kwe}};function xh(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Sh(e){return{point:{x:e.pageX,y:e.pageY}}}const Bwe=e=>t=>hS(t)&&e(t,Sh(t));function Eh(e,t,n,r){return xh(e,t,Bwe(n),r)}const S8=1e-4,Vwe=1-S8,zwe=1+S8,E8=.01,jwe=0-E8,Hwe=0+E8;function lo(e){return e.max-e.min}function Wwe(e,t,n){return Math.abs(e-t)<=n}function $8(e,t,n,r=.5){e.origin=r,e.originPoint=jn(t.min,t.max,e.origin),e.scale=lo(n)/lo(t),e.translate=jn(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Vwe&&e.scale<=zwe||isNaN(e.scale))&&(e.scale=1),(e.translate>=jwe&&e.translate<=Hwe||isNaN(e.translate))&&(e.translate=0)}function $h(e,t,n,r){$8(e.x,t.x,n.x,r?r.originX:void 0),$8(e.y,t.y,n.y,r?r.originY:void 0)}function _8(e,t,n){e.min=n.min+t.min,e.max=e.min+lo(t)}function Uwe(e,t,n){_8(e.x,t.x,n.x),_8(e.y,t.y,n.y)}function O8(e,t,n){e.min=t.min-n.min,e.max=e.min+lo(t)}function _h(e,t,n){O8(e.x,t.x,n.x),O8(e.y,t.y,n.y)}function si(e){return[e("x"),e("y")]}const N8=({current:e})=>e?e.ownerDocument.defaultView:null,T8=(e,t)=>Math.abs(e-t);function qwe(e,t){const n=T8(e.x,t.x),r=T8(e.y,t.y);return Math.sqrt(n**2+r**2)}class I8{constructor(t,n,{transformPagePoint:r,contextWindow:o=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=AS(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,y=qwe(h.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!y)return;const{point:b}=h,{timestamp:v}=Hr;this.history.push({...b,timestamp:v});const{onStart:w,onMove:x}=this.handlers;p||(w&&w(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,h)},this.handlePointerMove=(h,p)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=MS(p,this.transformPagePoint),Rn.update(this.updatePoint,!0)},this.handlePointerUp=(h,p)=>{this.end();const{onEnd:y,onSessionEnd:b,resumeAnimation:v}=this.handlers;if(this.dragSnapToOrigin&&v&&v(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=AS(h.type==="pointercancel"?this.lastMoveEventInfo:MS(p,this.transformPagePoint),this.history);this.startEvent&&y&&y(h,w),b&&b(h,w)},!hS(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=a,this.contextWindow=o||window;const s=Sh(t),l=MS(s,this.transformPagePoint),{point:c}=l,{timestamp:u}=Hr;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,AS(l,this.history)),this.removeListeners=fh(Eh(this.contextWindow,"pointermove",this.handlePointerMove),Eh(this.contextWindow,"pointerup",this.handlePointerUp),Eh(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Rs(this.updatePoint)}}function MS(e,t){return t?{point:t(e.point)}:e}function P8(e,t){return{x:e.x-t.x,y:e.y-t.y}}function AS({point:e},t){return{point:e,delta:P8(e,M8(t)),offset:P8(e,Gwe(t)),velocity:Kwe(t,.1)}}function Gwe(e){return e[0]}function M8(e){return e[e.length-1]}function Kwe(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=M8(e);for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>Hi(t)));)n--;if(!r)return{x:0,y:0};const i=ya(o.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const a={x:(o.x-r.x)/i,y:(o.y-r.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function Xwe(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?jn(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?jn(n,e,r.max):Math.min(e,n)),e}function A8(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function Ywe(e,{top:t,left:n,bottom:r,right:o}){return{x:A8(e.x,n,o),y:A8(e.y,t,r)}}function D8(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function Qwe(e,t){return{x:D8(e.x,t.x),y:D8(e.y,t.y)}}function Zwe(e,t){let n=.5;const r=lo(e),o=lo(t);return o>r?n=hh(t.min,t.max-r,e.min):r>o&&(n=hh(e.min,e.max-o,t.min)),Ka(0,1,n)}function Jwe(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const DS=.35;function eCe(e=DS){return e===!1?e=0:e===!0&&(e=DS),{x:L8(e,"left","right"),y:L8(e,"top","bottom")}}function L8(e,t,n){return{min:R8(e,t),max:R8(e,n)}}function R8(e,t){return typeof e=="number"?e:e[t]||0}const tCe=new WeakMap;class nCe{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=or(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Sh(d).point)},a=(d,h)=>{const{drag:p,dragPropagation:y,onDragStart:b}=this.getProps();if(p&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=p1e(p),!this.openDragLock))return;this.latestPointerEvent=d,this.latestPanInfo=h,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),si(w=>{let x=this.getAxisMotionValue(w).get()||0;if(ba.test(x)){const{projection:C}=this.visualElement;if(C&&C.layout){const S=C.layout.layoutBox[w];S&&(x=lo(S)*(parseFloat(x)/100))}}this.originPoint[w]=x}),b&&Rn.postRender(()=>b(d,h)),TS(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},s=(d,h)=>{this.latestPointerEvent=d,this.latestPanInfo=h;const{dragPropagation:p,dragDirectionLock:y,onDirectionLock:b,onDrag:v}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:w}=h;if(y&&this.currentDirection===null){this.currentDirection=rCe(w),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",h.point,w),this.updateAxis("y",h.point,w),this.visualElement.render(),v&&v(d,h)},l=(d,h)=>{this.latestPointerEvent=d,this.latestPanInfo=h,this.stop(d,h),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>si(d=>{var h;return this.getAnimationState(d)==="paused"&&((h=this.getAxisMotionValue(d).animation)==null?void 0:h.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new I8(t,{onSessionStart:i,onStart:a,onMove:s,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:r,contextWindow:N8(this.visualElement)})}stop(t,n){const r=t||this.latestPointerEvent,o=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!o||!r)return;const{velocity:a}=o;this.startAnimation(a);const{onDragEnd:s}=this.getProps();s&&Rn.postRender(()=>s(r,o))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:o}=this.getProps();if(!r||!Jv(t,o,this.currentDirection))return;const i=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=Xwe(a,this.constraints[t],this.elastic[t])),i.set(a)}resolveConstraints(){var i;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(i=this.visualElement.projection)==null?void 0:i.layout,o=this.constraints;t&&Nu(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=Ywe(r.layoutBox,t):this.constraints=!1,this.elastic=eCe(n),o!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&si(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=Jwe(r.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Nu(t))return!1;const r=t.current;Xa(r!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const i=owe(r,o.root,this.visualElement.getTransformPagePoint());let a=Qwe(o.layout.layoutBox,i);if(n){const s=n(twe(a));this.hasMutatedConstraints=!!s,s&&(a=t8(s))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:o,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:s}=this.getProps(),l=this.constraints||{},c=si(u=>{if(!Jv(u,n,this.currentDirection))return;let d=l&&l[u]||{};a&&(d={min:0,max:0});const h=o?200:1e6,p=o?40:1e7,y={type:"inertia",velocity:r?t[u]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...d};return this.startAxisValueAnimation(u,y)});return Promise.all(c).then(s)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return TS(this.visualElement,t),r.start(IS(t,r,0,n,this.visualElement,!1))}stopAnimation(){si(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){si(t=>{var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),o=r[n];return o||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){si(n=>{const{drag:r}=this.getProps();if(!Jv(n,r,this.currentDirection))return;const{projection:o}=this.visualElement,i=this.getAxisMotionValue(n);if(o&&o.layout){const{min:a,max:s}=o.layout.layoutBox[n];i.set(t[n]-jn(a,s,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Nu(n)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};si(a=>{const s=this.getAxisMotionValue(a);if(s&&this.constraints!==!1){const l=s.get();o[a]=Zwe({min:l,max:l},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),si(a=>{if(!Jv(a,t,null))return;const s=this.getAxisMotionValue(a),{min:l,max:c}=this.constraints[a];s.set(jn(l,c,o[a]))})}addListeners(){if(!this.visualElement.current)return;tCe.set(this.visualElement,this);const t=this.visualElement.current,n=Eh(t,"pointerdown",l=>{const{drag:c,dragListener:u=!0}=this.getProps();c&&u&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Nu(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,i=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),Rn.read(r);const a=xh(window,"resize",()=>this.scalePositionWithinConstraints()),s=o.addEventListener("didUpdate",({delta:l,hasLayoutChanged:c})=>{this.isDragging&&c&&(si(u=>{const d=this.getAxisMotionValue(u);d&&(this.originPoint[u]+=l[u].translate,d.set(d.get()+l[u].translate))}),this.visualElement.render())});return()=>{a(),n(),i(),s&&s()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:i=!1,dragElastic:a=DS,dragMomentum:s=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:o,dragConstraints:i,dragElastic:a,dragMomentum:s}}}function Jv(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function rCe(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class oCe extends Bs{constructor(t){super(t),this.removeGroupControls=ai,this.removeListeners=ai,this.controls=new nCe(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ai}unmount(){this.removeGroupControls(),this.removeListeners()}}const k8=e=>(t,n)=>{e&&Rn.postRender(()=>e(t,n))};class iCe extends Bs{constructor(){super(...arguments),this.removePointerDownListener=ai}onPointerDown(t){this.session=new I8(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:N8(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:k8(t),onStart:k8(n),onMove:r,onEnd:(i,a)=>{delete this.session,o&&Rn.postRender(()=>o(i,a))}}}mount(){this.removePointerDownListener=Eh(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const e0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function F8(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Oh={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(St.test(e))e=parseFloat(e);else return e;const n=F8(e,t.target.x),r=F8(e,t.target.y);return`${n}% ${r}%`}},aCe={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,o=Fs.parse(e);if(o.length>5)return r;const i=Fs.createTransformer(e),a=typeof o[0]!="number"?1:0,s=n.x.scale*t.x,l=n.y.scale*t.y;o[0+a]/=s,o[1+a]/=l;const c=jn(s,l,.5);return typeof o[2+a]=="number"&&(o[2+a]/=c),typeof o[3+a]=="number"&&(o[3+a]/=c),i(o)}};let LS=!1;class sCe extends T.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:o}=this.props,{projection:i}=t;I1e(lCe),i&&(n.group&&n.group.add(i),r&&r.register&&o&&r.register(i),LS&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),e0.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:o,isPresent:i}=this.props,{projection:a}=r;return a&&(a.isPresent=i,LS=!0,o||t.layoutDependency!==n||n===void 0||t.isPresent!==i?a.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?a.promote():a.relegate()||Rn.postRender(()=>{const s=a.getStack();(!s||!s.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),fS.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:o}=t;LS=!0,o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function B8(e){const[t,n]=S1e(),r=T.useContext(OL);return k.jsx(sCe,{...e,layoutGroup:r,switchLayoutGroup:T.useContext(JR),isPresent:t,safeToRemove:n})}const lCe={borderRadius:{...Oh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Oh,borderTopRightRadius:Oh,borderBottomLeftRadius:Oh,borderBottomRightRadius:Oh,boxShadow:aCe};function cCe(e,t,n){const r=Xr(e)?e:_u(e);return r.start(IS("",r,t,n)),r.animation}const uCe=(e,t)=>e.depth-t.depth;class dCe{constructor(){this.children=[],this.isDirty=!1}add(t){Nx(this.children,t),this.isDirty=!0}remove(t){Tx(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(uCe),this.isDirty=!1,this.children.forEach(t)}}function fCe(e,t){const n=So.now(),r=({timestamp:o})=>{const i=o-n;i>=t&&(Rs(r),e(i-t))};return Rn.setup(r,!0),()=>Rs(r)}const V8=["TopLeft","TopRight","BottomLeft","BottomRight"],hCe=V8.length,z8=e=>typeof e=="string"?parseFloat(e):e,j8=e=>typeof e=="number"||St.test(e);function pCe(e,t,n,r,o,i){o?(e.opacity=jn(0,n.opacity??1,mCe(r)),e.opacityExit=jn(t.opacity??1,0,gCe(r))):i&&(e.opacity=jn(t.opacity??1,n.opacity??1,r));for(let a=0;a<hCe;a++){const s=`border${V8[a]}Radius`;let l=H8(t,s),c=H8(n,s);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||j8(l)===j8(c)?(e[s]=Math.max(jn(z8(l),z8(c),r),0),(ba.test(c)||ba.test(l))&&(e[s]+="%")):e[s]=c}(t.rotate||n.rotate)&&(e.rotate=jn(t.rotate||0,n.rotate||0,r))}function H8(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const mCe=W8(0,.5,BL),gCe=W8(.5,.95,ai);function W8(e,t,n){return r=>r<e?0:r>t?1:n(hh(e,t,r))}function U8(e,t){e.min=t.min,e.max=t.max}function li(e,t){U8(e.x,t.x),U8(e.y,t.y)}function q8(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function G8(e,t,n,r,o){return e-=t,e=Zv(e,1/n,r),o!==void 0&&(e=Zv(e,1/o,r)),e}function vCe(e,t=0,n=1,r=.5,o,i=e,a=e){if(ba.test(t)&&(t=parseFloat(t),t=jn(a.min,a.max,t/100)-a.min),typeof t!="number")return;let s=jn(i.min,i.max,r);e===i&&(s-=t),e.min=G8(e.min,t,n,s,o),e.max=G8(e.max,t,n,s,o)}function K8(e,t,[n,r,o],i,a){vCe(e,t[n],t[r],t[o],t.scale,i,a)}const yCe=["x","scaleX","originX"],bCe=["y","scaleY","originY"];function X8(e,t,n,r){K8(e.x,t,yCe,n?n.x:void 0,r?r.x:void 0),K8(e.y,t,bCe,n?n.y:void 0,r?r.y:void 0)}function Y8(e){return e.translate===0&&e.scale===1}function Q8(e){return Y8(e.x)&&Y8(e.y)}function Z8(e,t){return e.min===t.min&&e.max===t.max}function wCe(e,t){return Z8(e.x,t.x)&&Z8(e.y,t.y)}function J8(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function ek(e,t){return J8(e.x,t.x)&&J8(e.y,t.y)}function tk(e){return lo(e.x)/lo(e.y)}function nk(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class CCe{constructor(){this.members=[]}add(t){Nx(this.members,t),t.scheduleRender()}remove(t){if(Tx(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(o=>t===o);if(n===0)return!1;let r;for(let o=n;o>=0;o--){const i=this.members[o];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:o}=t.options;o===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function xCe(e,t,n){let r="";const o=e.x.translate/t.x,i=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((o||i||a)&&(r=`translate3d(${o}px, ${i}px, ${a}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:c,rotate:u,rotateX:d,rotateY:h,skewX:p,skewY:y}=n;c&&(r=`perspective(${c}px) ${r}`),u&&(r+=`rotate(${u}deg) `),d&&(r+=`rotateX(${d}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),y&&(r+=`skewY(${y}deg) `)}const s=e.x.scale*t.x,l=e.y.scale*t.y;return(s!==1||l!==1)&&(r+=`scale(${s}, ${l})`),r||"none"}const RS=["","X","Y","Z"],SCe=1e3;let ECe=0;function kS(e,t,n,r){const{latestValues:o}=t;o[e]&&(n[e]=o[e],t.setStaticValue(e,0),r&&(r[e]=0))}function rk(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=v8(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Rn,!(o||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&rk(r)}function ok({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(a={},s=t==null?void 0:t()){this.id=ECe++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(OCe),this.nodes.forEach(PCe),this.nodes.forEach(MCe),this.nodes.forEach(NCe)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new dCe)}addEventListener(a,s){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new Mx),this.eventHandlers.get(a).add(s)}notifyListeners(a,...s){const l=this.eventHandlers.get(a);l&&l.notify(...s)}hasListeners(a){return this.eventHandlers.has(a)}mount(a){if(this.instance)return;this.isSVG=kR(a)&&!w1e(a),this.instance=a;const{layoutId:s,layout:l,visualElement:c}=this.options;if(c&&!c.current&&c.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||s)&&(this.isLayoutDirty=!0),e){let u,d=0;const h=()=>this.root.updateBlockedByResize=!1;Rn.read(()=>{d=window.innerWidth}),e(a,()=>{const p=window.innerWidth;p!==d&&(d=p,this.root.updateBlockedByResize=!0,u&&u(),u=fCe(h,250),e0.hasAnimatedSinceResize&&(e0.hasAnimatedSinceResize=!1,this.nodes.forEach(sk)))})}s&&this.root.registerSharedNode(s,this),this.options.animate!==!1&&c&&(s||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d,hasRelativeLayoutChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||c.getDefaultTransition()||kCe,{onLayoutAnimationStart:b,onLayoutAnimationComplete:v}=c.getProps(),w=!this.targetLayout||!ek(this.targetLayout,p),x=!d&&h;if(this.options.layoutRoot||this.resumeFrom||x||d&&(w||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const C={...cS(y,"layout"),onPlay:b,onComplete:v};(c.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C),this.setAnimationOrigin(u,x)}else d||sk(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Rs(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(ACe),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&rk(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const d=this.path[u];d.shouldResetTransform=!0,d.updateScroll("snapshot"),d.options.layoutRoot&&d.willUpdate(!1)}const{layoutId:s,layout:l}=this.options;if(s===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(ik);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(ak);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(ICe),this.nodes.forEach($Ce),this.nodes.forEach(_Ce)):this.nodes.forEach(ak),this.clearAllSnapshots();const s=So.now();Hr.delta=Ka(0,1e3/60,s-Hr.timestamp),Hr.timestamp=s,Hr.isProcessing=!0,Rx.update.process(Hr),Rx.preRender.process(Hr),Rx.render.process(Hr),Hr.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,fS.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(TCe),this.sharedNodes.forEach(DCe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Rn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Rn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!lo(this.snapshot.measuredBox.x)&&!lo(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutCorrected=or(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:s}=this.options;s&&s.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let s=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(s=!1),s&&this.instance){const l=r(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!o)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,s=this.projectionDelta&&!Q8(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;a&&this.instance&&(s||zl(this.latestValues)||u)&&(o(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const s=this.measurePageBox();let l=this.removeElementScroll(s);return a&&(l=this.removeTransform(l)),FCe(l),{animationId:this.root.animationId,measuredBox:s,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var c;const{visualElement:a}=this.options;if(!a)return or();const s=a.measureViewportBox();if(!(((c=this.scroll)==null?void 0:c.wasRoot)||this.path.some(BCe))){const{scroll:u}=this.root;u&&(Tu(s.x,u.offset.x),Tu(s.y,u.offset.y))}return s}removeElementScroll(a){var l;const s=or();if(li(s,a),(l=this.scroll)!=null&&l.wasRoot)return s;for(let c=0;c<this.path.length;c++){const u=this.path[c],{scroll:d,options:h}=u;u!==this.root&&d&&h.layoutScroll&&(d.wasRoot&&li(s,a),Tu(s.x,d.offset.x),Tu(s.y,d.offset.y))}return s}applyTransform(a,s=!1){const l=or();li(l,a);for(let c=0;c<this.path.length;c++){const u=this.path[c];!s&&u.options.layoutScroll&&u.scroll&&u!==u.root&&Iu(l,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),zl(u.latestValues)&&Iu(l,u.latestValues)}return zl(this.latestValues)&&Iu(l,this.latestValues),l}removeTransform(a){const s=or();li(s,a);for(let l=0;l<this.path.length;l++){const c=this.path[l];if(!c.instance||!zl(c.latestValues))continue;$S(c.latestValues)&&c.updateSnapshot();const u=or(),d=c.measurePageBox();li(u,d),X8(s,c.latestValues,c.snapshot?c.snapshot.layoutBox:void 0,u)}return zl(this.latestValues)&&X8(s,this.latestValues),s}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Hr.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){var h;const s=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=s.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=s.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=s.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==s;if(!(a||l&&this.isSharedProjectionDirty||this.isProjectionDirty||(h=this.parent)!=null&&h.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:d}=this.options;if(!(!this.layout||!(u||d))){if(this.resolvedRelativeTargetAt=Hr.timestamp,!this.targetDelta&&!this.relativeTarget){const p=this.getClosestProjectingParent();p&&p.layout&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=or(),this.relativeTargetOrigin=or(),_h(this.relativeTargetOrigin,this.layout.layoutBox,p.layout.layoutBox),li(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=or(),this.targetWithTransforms=or()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Uwe(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):li(this.target,this.layout.layoutBox),i8(this.target,this.targetDelta)):li(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const p=this.getClosestProjectingParent();p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=or(),this.relativeTargetOrigin=or(),_h(this.relativeTargetOrigin,this.target,p.target),li(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||$S(this.parent.latestValues)||n8(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var y;const a=this.getLead(),s=!!this.resumingFrom||this!==a;let l=!0;if((this.isProjectionDirty||(y=this.parent)!=null&&y.isProjectionDirty)&&(l=!1),s&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===Hr.timestamp&&(l=!1),l)return;const{layout:c,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||u))return;li(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,h=this.treeScale.y;rwe(this.layoutCorrected,this.treeScale,this.path,s),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=or());const{target:p}=a;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(q8(this.prevProjectionDelta.x,this.projectionDelta.x),q8(this.prevProjectionDelta.y,this.projectionDelta.y)),$h(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==d||this.treeScale.y!==h||!nk(this.projectionDelta.x,this.prevProjectionDelta.x)||!nk(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){var s;if((s=this.options.visualElement)==null||s.scheduleRender(),a){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Pu(),this.projectionDelta=Pu(),this.projectionDeltaWithTransform=Pu()}setAnimationOrigin(a,s=!1){const l=this.snapshot,c=l?l.latestValues:{},u={...this.latestValues},d=Pu();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!s;const h=or(),p=l?l.source:void 0,y=this.layout?this.layout.source:void 0,b=p!==y,v=this.getStack(),w=!v||v.members.length<=1,x=!!(b&&!w&&this.options.crossfade===!0&&!this.path.some(RCe));this.animationProgress=0;let C;this.mixTargetDelta=S=>{const E=S/1e3;lk(d.x,a.x,E),lk(d.y,a.y,E),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(_h(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),LCe(this.relativeTarget,this.relativeTargetOrigin,h,E),C&&wCe(this.relativeTarget,C)&&(this.isProjectionDirty=!1),C||(C=or()),li(C,this.relativeTarget)),b&&(this.animationValues=u,pCe(u,c,this.latestValues,E,x,w)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){var s,l,c;this.notifyListeners("animationStart"),(s=this.currentAnimation)==null||s.stop(),(c=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||c.stop(),this.pendingAnimation&&(Rs(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Rn.update(()=>{e0.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=_u(0)),this.currentAnimation=cCe(this.motionValue,[0,1e3],{...a,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),a.onUpdate&&a.onUpdate(u)},onStop:()=>{},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(SCe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:s,target:l,layout:c,latestValues:u}=a;if(!(!s||!l||!c)){if(this!==a&&this.layout&&c&&hk(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||or();const d=lo(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+d;const h=lo(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+h}li(s,l),Iu(s,u),$h(this.projectionDeltaWithTransform,this.layoutCorrected,s,u)}}registerSharedNode(a,s){this.sharedNodes.has(a)||this.sharedNodes.set(a,new CCe),this.sharedNodes.get(a).add(s);const c=s.options.initialPromotionConfig;s.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(s):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var s;const{layoutId:a}=this.options;return a?((s=this.getStack())==null?void 0:s.lead)||this:this}getPrevLead(){var s;const{layoutId:a}=this.options;return a?(s=this.getStack())==null?void 0:s.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:s,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let s=!1;const{latestValues:l}=a;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(s=!0),!s)return;const c={};l.z&&kS("z",a,c,this.animationValues);for(let u=0;u<RS.length;u++)kS(`rotate${RS[u]}`,a,c,this.animationValues),kS(`skew${RS[u]}`,a,c,this.animationValues);a.render();for(const u in c)a.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);a.scheduleRender()}applyProjectionStyles(a,s){if(!this.instance||this.isSVG)return;if(!this.isVisible){a.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,a.visibility="",a.opacity="",a.pointerEvents=Qv(s==null?void 0:s.pointerEvents)||"",a.transform=l?l(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(a.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,a.pointerEvents=Qv(s==null?void 0:s.pointerEvents)||""),this.hasProjected&&!zl(this.latestValues)&&(a.transform=l?l({},""):"none",this.hasProjected=!1);return}a.visibility="";const u=c.animationValues||c.latestValues;this.applyTransformsToTarget();let d=xCe(this.projectionDeltaWithTransform,this.treeScale,u);l&&(d=l(u,d)),a.transform=d;const{x:h,y:p}=this.projectionDelta;a.transformOrigin=`${h.origin*100}% ${p.origin*100}% 0`,c.animationValues?a.opacity=c===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:a.opacity=c===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const y in Ch){if(u[y]===void 0)continue;const{correct:b,applyTo:v,isCSSVariable:w}=Ch[y],x=d==="none"?u[y]:b(u[y],c);if(v){const C=v.length;for(let S=0;S<C;S++)a[v[S]]=x}else w?this.options.visualElement.renderState.vars[y]=x:a[y]=x}this.options.layoutId&&(a.pointerEvents=c===this?Qv(s==null?void 0:s.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>{var s;return(s=a.currentAnimation)==null?void 0:s.stop()}),this.root.nodes.forEach(ik),this.root.sharedNodes.clear()}}}function $Ce(e){e.updateLayout()}function _Ce(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:o}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;i==="size"?si(d=>{const h=a?t.measuredBox[d]:t.layoutBox[d],p=lo(h);h.min=r[d].min,h.max=h.min+p}):hk(i,t.layoutBox,r)&&si(d=>{const h=a?t.measuredBox[d]:t.layoutBox[d],p=lo(r[d]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+p)});const s=Pu();$h(s,r,t.layoutBox);const l=Pu();a?$h(l,e.applyTransform(o,!0),t.measuredBox):$h(l,r,t.layoutBox);const c=!Q8(s);let u=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:h,layout:p}=d;if(h&&p){const y=or();_h(y,t.layoutBox,h.layoutBox);const b=or();_h(b,r,p.layoutBox),ek(y,b)||(u=!0),d.options.layoutRoot&&(e.relativeTarget=b,e.relativeTargetOrigin=y,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:l,layoutDelta:s,hasLayoutChanged:c,hasRelativeLayoutChanged:u})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function OCe(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function NCe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function TCe(e){e.clearSnapshot()}function ik(e){e.clearMeasurements()}function ak(e){e.isLayoutDirty=!1}function ICe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function sk(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function PCe(e){e.resolveTargetDelta()}function MCe(e){e.calcProjection()}function ACe(e){e.resetSkewAndRotation()}function DCe(e){e.removeLeadSnapshot()}function lk(e,t,n){e.translate=jn(t.translate,0,n),e.scale=jn(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function ck(e,t,n,r){e.min=jn(t.min,n.min,r),e.max=jn(t.max,n.max,r)}function LCe(e,t,n,r){ck(e.x,t.x,n.x,r),ck(e.y,t.y,n.y,r)}function RCe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const kCe={duration:.45,ease:[.4,0,.1,1]},uk=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),dk=uk("applewebkit/")&&!uk("chrome/")?Math.round:ai;function fk(e){e.min=dk(e.min),e.max=dk(e.max)}function FCe(e){fk(e.x),fk(e.y)}function hk(e,t,n){return e==="position"||e==="preserve-aspect"&&!Wwe(tk(t),tk(n),.2)}function BCe(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const VCe=ok({attachResizeListener:(e,t)=>xh(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),FS={current:void 0},pk=ok({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!FS.current){const e=new VCe({});e.mount(window),e.setOptions({layoutScroll:!0}),FS.current=e}return FS.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),zCe={pan:{Feature:iCe},drag:{Feature:oCe,ProjectionNode:pk,MeasureLayout:B8}};function mk(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,i=r[o];i&&Rn.postRender(()=>i(t,Sh(t)))}class jCe extends Bs{mount(){const{current:t}=this.node;t&&(this.unmount=m1e(t,(n,r)=>(mk(this.node,r,"Start"),o=>mk(this.node,o,"End"))))}unmount(){}}class HCe extends Bs{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=fh(xh(this.node.current,"focus",()=>this.onFocus()),xh(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function gk(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),i=r[o];i&&Rn.postRender(()=>i(t,Sh(t)))}class WCe extends Bs{mount(){const{current:t}=this.node;t&&(this.unmount=b1e(t,(n,r)=>(gk(this.node,r,"Start"),(o,{success:i})=>gk(this.node,o,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const BS=new WeakMap,VS=new WeakMap,UCe=e=>{const t=BS.get(e.target);t&&t(e)},qCe=e=>{e.forEach(UCe)};function GCe({root:e,...t}){const n=e||document;VS.has(n)||VS.set(n,{});const r=VS.get(n),o=JSON.stringify(t);return r[o]||(r[o]=new IntersectionObserver(qCe,{root:e,...t})),r[o]}function KCe(e,t,n){const r=GCe(t);return BS.set(e,n),r.observe(e),()=>{BS.delete(e),r.unobserve(e)}}const XCe={some:0,all:1};class YCe extends Bs{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:o="some",once:i}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:XCe[o]},s=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,i&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:u,onViewportLeave:d}=this.node.getProps(),h=c?u:d;h&&h(l)};return KCe(this.node.current,a,s)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(QCe(t,n))&&this.startObserver()}unmount(){}}function QCe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const ZCe={...Fwe,...{inView:{Feature:YCe},tap:{Feature:WCe},focus:{Feature:HCe},hover:{Feature:jCe}},...zCe,...{layout:{ProjectionNode:pk,MeasureLayout:B8}}},JCe=ewe(ZCe,hwe),Nh=({children:e})=>k.jsx(JCe.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.18,ease:"easeOut"},children:e}),exe=({id:e,data:t})=>k.jsxs(Nh,{children:[k.jsx(ro,{type:"source",position:at.Right}),k.jsx(_L,{id:e,data:t})]});var txe="scripts_editor_1b2l0x40",nxe="scripts_editor_1b2l0x41",vk="scripts_editor_1b2l0x42",yk="scripts_editor_1b2l0x43",bk="scripts_editor_1b2l0x44",wk="scripts_editor_1b2l0x45",rxe="scripts_editor_1b2l0x46",oxe="scripts_editor_1b2l0x49",Ck="scripts_editor_1b2l0x4a",xk="scripts_editor_1b2l0x4d";const ixe=()=>k.jsxs(k.Fragment,{children:[k.jsx(hr.Text,{strong:!0,children:"Cài đặt tổng đài"}),k.jsx($t.Item,{label:"Chọn nhánh nội bộ",name:["external","value"],style:{marginBottom:12},children:k.jsx(Vr,{placeholder:"Nhập số điện thoại"})}),k.jsx($t.Item,{noStyle:!0,name:["external","maximum_try"],children:k.jsx(pg,{addonBefore:"Chờ tối đa",addonAfter:"giây",min:1,max:300,placeholder:"30",style:{width:"100%"}})})]}),axe=()=>k.jsxs(k.Fragment,{children:[k.jsx(hr.Text,{strong:!0,children:"Cài đặt tổng đài"}),k.jsx($t.Item,{label:"Chọn nhánh nội bộ",name:["internal","value"],style:{marginBottom:12},children:k.jsx(Vr,{placeholder:"Chọn nhánh nội bộ hoặc nhập số điện thoại"})}),k.jsx($t.Item,{noStyle:!0,name:["internal","maximum_try"],children:k.jsx(pg,{addonBefore:"Chờ tối đa",addonAfter:"giây",min:1,max:300,placeholder:"30",style:{width:"100%"}})})]}),sxe=({id:e})=>{const{getNode:t}=no(),{data:n}=t(e),r=n,[o]=$t.useForm(),[i,a]=T.useState(r.type),{infos:s}=tv(e),l=Bg(),c=d=>{l(e,d)},u=ha.debounce(()=>{o.submit()},500);return T.useEffect(()=>{o.setFieldsValue({...r}),a(r.type)},[r,o]),k.jsxs($t,{form:o,layout:"vertical",onFinish:c,onBlur:()=>{o.submit()},onChange:()=>{u()},children:[k.jsx($t.Item,{name:"type",noStyle:!0,children:k.jsx(Ew,{value:i,onChange:d=>{a(d)},options:[{label:"Tổng đài",value:ki.INTERNAL},{label:"Điện thoại",value:ki.EXTERNAL}],block:!0})}),k.jsxs(an,{direction:"vertical",size:8,style:{width:"100%",marginTop:16},children:[k.jsx(jr,{isOpen:i===ki.INTERNAL,children:k.jsx(axe,{})}),k.jsx(jr,{isOpen:i===ki.EXTERNAL,children:k.jsx(ixe,{})}),!ha.isEmpty(s)&&k.jsx(qa,{children:s.map(d=>k.jsx(Rc,{message:d.title,description:d.description,type:"info",showIcon:!0,closable:!0,style:{padding:"12px",margin:"12px 0"}},d.title))})]}),k.jsx($f,{}),k.jsx(jS,{id:e}),k.jsx("div",{style:{height:"200px"}})]})},zS=({id:e,data:t,mini:n,group:r})=>{const{displayComponent:o}=kg(),i=t.title||"Chuyển máy",a=t.type||ki.INTERNAL,s=cO(),l=u=>{var d;(d=u.target)!=null&&d.closest("button")||(u.stopPropagation(),u.preventDefault(),o(k.jsx(sxe,{id:e}),"Cài đặt chuyển máy"),s(e))},c=T.useMemo(()=>a===ki.INTERNAL?"Tổng đài":a===ki.EXTERNAL?"Điện thoại":"UNKNOWN",[a]);return n?k.jsx("div",{className:nxe,children:k.jsx("div",{className:vk,children:k.jsxs("div",{className:yk,children:[k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[k.jsx("span",{className:bk,children:k.jsx(iN,{})}),k.jsx("span",{className:wk,children:i})]}),k.jsx("div",{className:rxe,children:c})]})})}):k.jsx("div",{className:txe,onClick:l,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&l(u)},children:k.jsxs("div",{className:vk,children:[k.jsxs("div",{className:yk,children:[k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[k.jsx("span",{className:bk,children:k.jsx(eue,{})}),k.jsx("span",{className:wk,children:i}),k.jsx(Vg,{id:e,color:In.icon.transferCall})]}),k.jsx(Fg,{id:e,deleteBtnColor:In.icon.transferCall})]}),!r&&k.jsx("div",{className:oxe,children:k.jsxs(qa,{children:[k.jsxs("div",{className:Ck,children:["Chuyển máy thành công",k.jsx(ro,{type:"target",id:`${e}_success`,position:at.Right,className:xk,style:{top:"50%",right:"8%"}})]}),k.jsxs("div",{className:Ck,children:["Chuyển máy thất bại",k.jsx(ro,{type:"target",id:`${e}_failed`,position:at.Right,className:xk,style:{top:"75%",right:"8%"}})]})]})})]})})},lxe=({data:e,id:t})=>k.jsxs(Nh,{children:[k.jsx(ro,{type:"target",position:at.Left}),k.jsx(zS,{id:t,data:e})]}),jS=({id:e})=>{const t=ZW(),n=eU(),{fitView:r}=no(),o=rH({id:e},t,n),i=nH({id:e},t,n),a=T.useCallback(c=>{r({nodes:[{id:c}],padding:.2,duration:700})},[r]),s=T.useCallback(c=>c.length===0?k.jsx(hr.Text,{type:"secondary",children:"Không có node nào"}):k.jsx(qa,{wrapperTag:u=>k.jsx(an,{...u,direction:"vertical",wrap:!0,size:0,style:{width:"100%"}}),children:c.map(u=>{const d={id:u.id,data:u.data,mini:!0};let h=k.jsx(hr.Text,{children:"NODE_NOT_IMPLEMENTED"},u.id);return u.type===We.START&&(h=k.jsx(_L,{...d})),u.type===We.SPEAK&&(h=k.jsx($x,{...d})),u.type===We.LISTEN&&(h=k.jsx(US,{...d})),u.type===We.TRANSFER&&(h=k.jsx(zS,{...d})),k.jsx("div",{onMouseDown:p=>(p.stopPropagation(),a(u.id)),style:{width:"100%",border:"none",background:"transparent",padding:0,margin:0,cursor:"pointer",outline:"none",textAlign:"left"},children:h},u.id)})}),[a]),l=[{key:"1",label:k.jsx("b",{children:"Mối quan hệ"}),children:k.jsxs(an,{wrap:!0,direction:"vertical",size:8,style:{width:"100%"},children:[k.jsx(hr.Text,{strong:!0,type:"secondary",children:"Node trước"}),s(o),k.jsx(hr.Text,{strong:!0,type:"secondary",children:"Node sau"}),s(i),k.jsx(hr.Text,{strong:!0,type:"secondary",children:"Node cha"}),s([])]}),styles:{header:{padding:"0px 0px 12px 0px"},body:{padding:0}}}];return k.jsx(eP,{ghost:!0,items:l})},cxe=()=>{const e=yg(),t=r=>{var a;const o={id:"condition-"+R5(),label:`Ý định ${(((a=e.getFieldValue("conditions"))==null?void 0:a.length)||0)+1}`,description:"",included_keywords:[],excluded_keywords:[],repeat_if_interrupted:!1,is_conversion:!1,...r},i=e.getFieldValue("conditions")||[];e.setFieldValue("conditions",[o,...i])},n=[{key:"new",label:"Mới",icon:k.jsx(hb,{}),onClick:t},{key:"interested",label:"Quan tâm",onClick:()=>t(Af.INTERESTED)},{key:"not-interested",label:"Không quan tâm",onClick:()=>t(Af.NOT_INTERESTED)},{key:"not-heard",label:"Không nghe rõ",onClick:()=>t(Af.NOT_HEARD)},{key:"busy",label:"Bận",onClick:()=>t(Af.BUSY)}];return k.jsx(mg,{menu:{items:n},placement:"bottomRight",trigger:["hover"],children:k.jsx(hn,{type:"primary",icon:k.jsx(pb,{}),size:"small"})})};function uxe(e){return au({attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12.0005 0C18.627 0 24 5.373 24 12.0005 24 18.627 18.627 24 11.9995 24 5.373 24 0 18.627 0 11.9995 0 5.373 5.373 0 12.0005 0zm0 19.826a7.8265 7.8265 0 10-.001-15.652C7.7133 4.2246 4.2653 7.7136 4.2653 12c0 4.2864 3.448 7.7754 7.7342 7.826h.001zm0-3.9853a3.8402 3.8402 0 110-7.6803c2.1204.0006 3.839 1.7197 3.839 3.8401s-1.7186 3.8396-3.839 3.8402z"},child:[]}]})(e)}var dxe="scripts_editor_18y8ld80",fxe="scripts_editor_18y8ld81",hxe="scripts_editor_18y8ld82",pxe="scripts_editor_18y8ld83",mxe="scripts_editor_18y8ld84",gxe="scripts_editor_18y8ld85",t0="scripts_editor_18y8ld86",HS="scripts_editor_18y8ld87",vxe="scripts_editor_18y8ld88",yxe="scripts_editor_18y8ld89";const bxe=({fieldName:e,isConversion:t})=>{const{isOpen:n,onOpen:r,onClose:o}=Df(),i=$t.useFormInstance(),[a,s]=T.useState(!1),l=T.useMemo(()=>{var y;const p=i.getFieldValue("conditions")||[];return((y=p==null?void 0:p[e])==null?void 0:y.label)??""},[e,i]),[c,u]=T.useState(l),d=({key:p})=>{if(p==="conversion"){const y=i.getFieldValue("conditions")||[],b=y.map(v=>{var w;return v.id===((w=y[e])==null?void 0:w.id)?{...v,is_conversion:!t}:v});i.setFieldValue("conditions",b),i.submit()}p==="rename"&&(u(l),o(),s(!0))},h=[{key:"template",icon:k.jsx(sN,{}),label:"Lưu thành mẫu",disabled:!0},{key:"conversion",icon:k.jsx(KO,{}),label:t?"Hủy làm chuyển đổi":"Đặt làm chuyển đổi"},{type:"divider"},{key:"rename",icon:k.jsx(Kp,{}),label:"Đổi tên nhãn"}];return k.jsx(mg,{menu:{items:h,onClick:d},open:n,onOpenChange:p=>{p?r():o()},children:k.jsx(Jm,{open:a,onOpenChange:p=>s(p),trigger:"click",placement:"bottomRight",content:k.jsxs(an,{direction:"vertical",size:8,className:vxe,children:[k.jsx(Vr,{autoFocus:!0,value:c,onChange:p=>u(p.target.value),placeholder:"Nhập nhãn mới",onPressEnter:()=>{const p=i.getFieldValue("conditions")||[],y=p.map(b=>{var v;return b.id===((v=p[e])==null?void 0:v.id)?{...b,label:c}:b});i.setFieldValue("conditions",y),s(!1),i.submit()}}),k.jsxs(an,{className:yxe,children:[k.jsx(hn,{size:"small",onClick:()=>s(!1),children:"Hủy"}),k.jsx(hn,{size:"small",type:"primary",onClick:()=>{const p=i.getFieldValue("conditions")||[],y=p.map(b=>{var v;return b.id===((v=p[e])==null?void 0:v.id)?{...b,label:c}:b});i.setFieldValue("conditions",y),s(!1),i.submit()},children:"Xác nhận"})]})]}),children:k.jsx(hn,{onClick:p=>{p.stopPropagation()},icon:k.jsx(rN,{}),type:"text",size:"small"})})})},{Text:Th}=hr,wxe=({field:e,condition:t,onDelete:n})=>k.jsx(eP,{defaultActiveKey:["1"],className:dxe,items:[{key:"1",label:k.jsxs("div",{className:fxe,children:[k.jsxs("div",{className:hxe,children:[k.jsx($t.Item,{name:[e.name,"label"],noStyle:!0,children:k.jsx(Th,{strong:!0,children:t.label})}),t.is_conversion&&k.jsx(jw,{color:"orange",className:pxe,children:k.jsxs(an,{size:4,direction:"horizontal",align:"center",children:[k.jsx(uxe,{className:mxe}),"Chuyển đổi"]})})]}),k.jsxs(an,{onClick:r=>r.stopPropagation(),children:[k.jsx(hn,{icon:k.jsx(Md,{}),type:"text",danger:!0,size:"small",onClick:()=>n(t.id)}),k.jsx(bxe,{fieldName:e.name,isConversion:t.is_conversion})]})]}),children:k.jsxs("div",{className:gxe,children:[k.jsx($t.Item,{name:[e.name,"description"],label:k.jsxs(an,{size:8,direction:"horizontal",align:"center",children:[k.jsx(Th,{children:"Nhận diện ý định bằng AI"}),k.jsx(hn,{type:"text",size:"small",children:k.jsx(cC,{className:HS})})]}),className:t0,children:k.jsx(Vr,{placeholder:"Mô tả ý định"})}),k.jsx($t.Item,{name:[e.name,"included_keywords"],label:k.jsxs(an,{size:8,direction:"horizontal",align:"center",children:[k.jsx(Th,{children:"Từ khoá"}),k.jsx(hn,{type:"text",size:"small",children:k.jsx(cC,{className:HS})})]}),className:t0,children:k.jsx(Vr,{placeholder:"Điền từ khoá"})}),k.jsx($t.Item,{name:[e.name,"excluded_keywords"],label:k.jsxs(an,{size:8,direction:"horizontal",align:"center",children:[k.jsx(Th,{children:"Từ khoá loại trừ"}),k.jsx(hn,{type:"text",size:"small",children:k.jsx(cC,{className:HS})})]}),className:t0,children:k.jsx(Vr,{placeholder:"Điền từ khoá loại trừ"})}),k.jsx($t.Item,{name:[e.name,"repeat_if_interrupted"],valuePropName:"checked",className:t0,children:k.jsxs(an,{direction:"horizontal",size:8,align:"start",children:[k.jsx($g,{}),k.jsx(Th,{children:"Quay trở lại câu đang nói nếu bị ngắt quãng"})]})})]})}]},e.key),{Text:WS}=hr,Cxe=({id:e})=>{const t=Bg(),{data:n}=Q5(e),r=n,[o]=$t.useForm(),i=$t.useWatch("conditions",o),a=c=>{t(e,c)},s=ha.debounce(()=>{o.submit()},500),l=c=>{const d=(o.getFieldValue("conditions")||[]).filter(h=>h.id!==c);o.setFieldValue("conditions",d),s()};return yO(()=>{r.conditions&&o.setFieldsValue(r)},[r.conditions]),k.jsx("div",{style:{height:"100%"},children:k.jsx($t,{form:o,layout:"vertical",initialValues:{...r},onFinish:a,onBlur:()=>{o.submit()},onChange:()=>{s()},children:k.jsxs(an,{direction:"vertical",size:"small",style:{width:"100%"},children:[k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[k.jsx(WS,{strong:!0,children:"Nhận diện ý định khách hàng"}),k.jsx(cxe,{})]}),k.jsx($t.List,{name:"conditions",children:c=>ha.isEmpty(c)?k.jsx(Xm,{}):k.jsx(k.Fragment,{children:c.map((u,d)=>{var p;const h=i==null?void 0:i[d];return h?(p=h.id)!=null&&p.includes("condition-default-")?k.jsx(k.Fragment,{}):k.jsx(qa,{children:k.jsx(wxe,{field:u,condition:h,onDelete:l})},u.key):k.jsx(Fw,{})})})}),k.jsx($f,{}),k.jsxs(an,{direction:"vertical",size:16,style:{width:"100%"},children:[k.jsx($t.Item,{noStyle:!0,name:"maximum_retry",children:k.jsx(Vr,{addonBefore:"Kích hoạt mỗi TH tối đa",type:"number",min:0,addonAfter:"lần",style:{width:"100%"}})}),k.jsx($t.Item,{name:"is_global_node",valuePropName:"checked",children:k.jsxs(an,{direction:"horizontal",size:4,align:"start",children:[k.jsx($g,{}),k.jsxs(an,{direction:"vertical",size:4,style:{padding:"0 8px"},children:[k.jsx(WS,{children:"Node toàn cục"}),k.jsx(WS,{type:"secondary",children:"Cho phép node này được kích hoạt tại bất cứ thời điểm nào trong cuộc gọi"})]})]})})]}),k.jsx(jS,{id:e}),k.jsx("div",{style:{height:"100px"}})]})})})},{Text:Sk}=hr,US=({id:e,data:t,mini:n})=>{const{displayComponent:r}=kg(),o=i=>{var a;(a=i.target)!=null&&a.closest("button")||(i.stopPropagation(),i.preventDefault(),r(k.jsx(Cxe,{id:e}),"Cài đặt bot nghe"))};return n?k.jsxs(ua,{className:V3,styles:{body:{padding:"8px"}},children:[k.jsx("div",{className:`${j3}`,children:k.jsxs("div",{className:z3,children:[k.jsx(e3,{size:24,color:In.listenBlock.focus}),k.jsx(Sk,{strong:!0,className:H3,children:t.title})]})}),k.jsx("div",{className:W3})]}):k.jsxs(ua,{onClick:o,className:V3,styles:{body:{padding:"8px"}},children:[k.jsxs("div",{className:`${j3} drag-handle__custom`,children:[k.jsxs("div",{className:z3,children:[k.jsx(e3,{size:16,color:In.listenBlock.focus}),k.jsx(Sk,{strong:!0,className:H3,children:t.title}),k.jsx(Vg,{id:e,color:In.listenBlock.focus})]}),k.jsx(Fg,{id:e,deleteBtnColor:In.listenBlock.focus})]}),k.jsx("div",{className:W3,children:k.jsx(rfe,{NODE_ID:e})})]})},xxe=({data:e,id:t})=>k.jsxs(Nh,{children:[k.jsx(ro,{type:"target",position:at.Left}),k.jsx(US,{id:t,data:e})]}),Sxe=[We.SPEAK,We.TRANSFER],Exe=e=>{const t=W5(e);return{verifyAddable:T.useCallback(r=>{const o=Sxe.includes(r);let i=!0;const a=[];return o||(i=!1,a.push("Block này không hỗ trợ thêm vào nhóm")),t.filter(s=>s.type===We.SPEAK).length>0&&r===We.SPEAK&&(i=!1,a.push("Nhóm chỉ có thể chứa tối đa 1 block nói")),t.filter(s=>s.type===We.TRANSFER).length>0&&r===We.TRANSFER&&(i=!1,a.push("Nhóm chỉ có thể chứa tối đa 1 block chuyển máy")),{allowed:i,errors:a}},[t])}};var $xe="scripts_editor_dxvfua1",_xe="scripts_editor_dxvfua2",Oxe="scripts_editor_dxvfua3",Nxe="scripts_editor_dxvfua4",Txe="scripts_editor_dxvfua5 scripts_editor_dxvfua4";const{Text:Ek}=hr,Ixe=({id:e,data:t})=>{const[n]=sC(),{setNodes:r}=no(),{screenToFlowPosition:o}=no(),i=W5(e),{verifyAddable:a}=Exe(e),{error:s}=lC(),l=i.length>0,c=p=>{p.preventDefault(),p.dataTransfer.dropEffect="move"},u=p=>`${e}_${p.toLowerCase()}_${Mg()}`,d=p=>{if(p.preventDefault(),!n)return;const y=a(n);if(!y.allowed){y.errors.forEach(w=>{s({content:w,key:w})});return}const b=o({x:p.clientX,y:p.clientY}),v={id:u(n),type:n,position:b,data:{title:Mf[n],...Ag[n]},deletable:!0,...Dg[n],parentId:e,extent:"parent",hidden:!0};r(w=>w.concat(v))},h=T.useMemo(()=>i.map(p=>p.type===We.SPEAK?k.jsx($x,{...p,data:p.data,group:!0},p.id):p.type===We.LISTEN?k.jsx(US,{...p,data:p.data,group:!0},p.id):p.type===We.TRANSFER?k.jsx(zS,{...p,data:p.data,group:!0},p.id):k.jsx(k.Fragment,{})),[i]);return k.jsx("div",{children:k.jsxs(ua,{className:$xe,styles:{body:{padding:"8px",display:"flex",flex:1,flexDirection:"column",height:"100%",minHeight:"100%"}},children:[k.jsxs("div",{className:`${_xe} drag-handle__custom`,children:[k.jsxs("div",{className:Oxe,children:[k.jsx(H5,{size:16,color:In.common.black}),k.jsx(Ek,{strong:!0,children:t.title}),k.jsx(Vg,{id:e,color:In.common.black})]}),k.jsx(Fg,{id:e,deleteBtnColor:In.common.black})]}),k.jsx(an,{direction:"vertical",size:8,children:h}),k.jsx("button",{className:l?Nxe:Txe,onDragOver:c,onDrop:d,type:"button","data-group-drop-zone":"true",children:k.jsx(Ek,{children:"Thả block vào đây"})}),k.jsxs(an,{direction:"vertical",size:8,style:{marginTop:8},children:[k.jsxs(ua,{styles:{body:{padding:"12px"}},children:["Thực hiện thành công",k.jsx(ro,{type:"source",position:at.Right})]}),k.jsxs(ua,{styles:{body:{padding:"12px"}},children:["Thực hiện thất bại",k.jsx(ro,{type:"source",position:at.Right})]})]})]})})},Pxe=({data:e,id:t})=>k.jsxs(Nh,{children:[k.jsx(ro,{type:"target",position:at.Left}),k.jsx(Ixe,{id:t,data:e})]}),Mxe=({data:e,id:t})=>k.jsxs(Nh,{children:[k.jsx(ro,{type:"target",position:at.Left}),k.jsx($x,{id:t,data:e}),k.jsx(ro,{type:"source",position:at.Right})]}),$k={[We.SPEAK]:Mxe,[We.START]:exe,[We.LISTEN]:xxe,[We.TRANSFER]:lxe,[We.GROUP]:Pxe},n0=e=>{switch(e.type){case We.START:return In.startBlock.background;case We.SPEAK:return In.speakBlock.background;case We.LISTEN:return In.listenBlock.background;case We.TRANSFER:return In.icon.transferCall;case We.GET_DATA:case We.UPDATE_DATA:case We.ADD_DATA:return In.icon.getData;case We.HTTP_REQUEST:return In.icon.httpRequest;case We.CONDITION:return In.icon.condition;case We.NOTE:return In.common.gray;case We.GROUP:return In.groupBlock.background;default:return In.common.gray}},_k=[We.SPEAK,We.LISTEN,We.TRANSFER,We.GET_DATA,We.UPDATE_DATA,We.ADD_DATA,We.HTTP_REQUEST,We.CONDITION,We.NOTE,We.GROUP],qS=[{key:We.SPEAK,label:"Bot nói",icon:uN},{key:We.LISTEN,label:"Bot nghe",icon:UO},{key:We.TRANSFER,label:"Chuyển máy",icon:dN},{key:We.GET_DATA,label:"Lấy dữ liệu",icon:Gp},{key:We.UPDATE_DATA,label:`Cập nhật
|
|
401
401
|
dữ liệu`,icon:Gp},{key:We.ADD_DATA,label:"Thêm dữ liệu",icon:Gp},{key:We.HTTP_REQUEST,label:`HTTP
|
|
402
|
-
Request`,icon:WO},{key:We.CONDITION,label:"Điều kiện",icon:GO},{key:We.NOTE,label:"Gán biến",icon:nN},{key:We.GROUP,label:"Nhóm",icon:H5}],GS={[We.START]:"none",[We.SPEAK]:"#d7268a",[We.LISTEN]:"#d2691e",[We.TRANSFER]:"#20b2aa",[We.GET_DATA]:"#1890ff",[We.UPDATE_DATA]:"#1890ff",[We.ADD_DATA]:"#1890ff",[We.HTTP_REQUEST]:"#20b2aa",[We.CONDITION]:"#1890ff",[We.NOTE]:"#8a2be2",[We.GROUP]:"#000000"};var Axe="scripts_editor_223f7c0",Dxe="scripts_editor_223f7c2";const Lxe={button:({id:e,sourceX:t,sourceY:n,targetX:r,targetY:o,sourcePosition:i,targetPosition:a,style:s,markerEnd:l,target:c})=>{const{isOpen:u,onOpen:d,onClose:h}=Df(),{setEdges:p,setNodes:y}=no(),[b,v,w]=by({sourceX:t,sourceY:n,sourcePosition:i,targetX:r,targetY:o,targetPosition:a}),x=[...qS.map(E=>({label:k.jsxs(an,{align:"center",size:8,children:[T.createElement(E.icon,{style:{color:GS[E.key]}}),E.label]}),key:E.key}))],C=E=>{E.preventDefault(),d()},S=({key:E})=>{const $=E,O={id:`${$.toLowerCase()}_${Mg()}`,type:$,position:{x:v,y:w},data:{title:Mf[$],...Ag[$]},deletable:!0,...Dg[$]};y(N=>N.concat(O)),Ok.includes($)?p(N=>{const I=N.map(M=>M.id===e?{...M,target:O.id}:M);if(c){const M={id:`${O.id}_${c}_${Mg()}`,source:O.id,target:c,type:"button"};I.push(M)}return I}):p(N=>N.filter(I=>I.id!==e)),h()};return k.jsxs(k.Fragment,{children:[k.jsx($d,{path:b,markerEnd:l,style:s??{}}),k.jsx(YW,{children:k.jsx(Ai,{title:"Thêm nút",children:k.jsx("div",{className:`${Axe} nodrag nopan ${u?Dxe:""}`,style:{transform:`translate(-50%, -50%) translate(${v}px,${w}px)`},children:k.jsx(mg,{onOpenChange:E=>{E?d():h()},menu:{items:x,onClick:S},open:u,trigger:["click"],children:k.jsx(hn,{onClick:C,type:"text",size:"large",style:{padding:4},children:k.jsx(hb,{style:{fontSize:24}})})})})})})]})}},Ok=[We.SPEAK];function Rxe(){const{getNodes:e,getEdges:t}=no(),n=lC();return{isValidConnection:T.useCallback(o=>{const i=e(),a=t(),s=i.find(l=>l.id===o.source);return i.find(l=>l.id===o.target),s.type===We.START&&a.filter(l=>l.source===o.source).length>0?(n.error({key:"start-node-only-one",content:"Bot bắt đầu chỉ có 1 đầu ra"}),!1):!0},[t,e,n])}}var kxe="scripts_editor_ohkkdt0",Nk="scripts_editor_ohkkdt2",Fxe="scripts_editor_ohkkdt3",Bxe="scripts_editor_ohkkdt4",Vxe="scripts_editor_ohkkdt5";const zxe=()=>{const[e,t]=sC(),{BLOCKS_ENABLED:n}=Bv(),r=(o,i)=>{t(i),o.dataTransfer.effectAllowed="move"};return ha.isEmpty(n)?k.jsx(k.Fragment,{}):k.jsx("div",{className:kxe,children:k.jsx(qa,{wrapperTag:o=>k.jsx(an,{...o,direction:"vertical",size:16}),children:qS.map(o=>{const i=o.icon,a=o.active,s=o.label.includes(`
|
|
403
|
-
`)||o.label.length>9;return
|
|
402
|
+
Request`,icon:WO},{key:We.CONDITION,label:"Điều kiện",icon:GO},{key:We.NOTE,label:"Gán biến",icon:nN},{key:We.GROUP,label:"Nhóm",icon:H5}],GS={[We.START]:"none",[We.SPEAK]:"#d7268a",[We.LISTEN]:"#d2691e",[We.TRANSFER]:"#20b2aa",[We.GET_DATA]:"#1890ff",[We.UPDATE_DATA]:"#1890ff",[We.ADD_DATA]:"#1890ff",[We.HTTP_REQUEST]:"#20b2aa",[We.CONDITION]:"#1890ff",[We.NOTE]:"#8a2be2",[We.GROUP]:"#000000"};var Axe="scripts_editor_223f7c0",Dxe="scripts_editor_223f7c2";const Lxe={button:({id:e,sourceX:t,sourceY:n,targetX:r,targetY:o,sourcePosition:i,targetPosition:a,style:s,markerEnd:l,target:c})=>{const{isOpen:u,onOpen:d,onClose:h}=Df(),{setEdges:p,setNodes:y}=no(),[b,v,w]=by({sourceX:t,sourceY:n,sourcePosition:i,targetX:r,targetY:o,targetPosition:a}),x=[...qS.map(E=>({label:k.jsxs(an,{align:"center",size:8,children:[T.createElement(E.icon,{style:{color:GS[E.key]}}),E.label]}),key:E.key}))],C=E=>{E.preventDefault(),d()},S=({key:E})=>{const $=E,O={id:`${$.toLowerCase()}_${Mg()}`,type:$,position:{x:v,y:w},data:{title:Mf[$],...Ag[$]},deletable:!0,...Dg[$]};y(N=>N.concat(O)),Ok.includes($)?p(N=>{const I=N.map(M=>M.id===e?{...M,target:O.id}:M);if(c){const M={id:`${O.id}_${c}_${Mg()}`,source:O.id,target:c,type:"button"};I.push(M)}return I}):p(N=>N.filter(I=>I.id!==e)),h()};return k.jsxs(k.Fragment,{children:[k.jsx($d,{path:b,markerEnd:l,style:s??{}}),k.jsx(YW,{children:k.jsx(Ai,{title:"Thêm nút",children:k.jsx("div",{className:`${Axe} nodrag nopan ${u?Dxe:""}`,style:{transform:`translate(-50%, -50%) translate(${v}px,${w}px)`},children:k.jsx(mg,{onOpenChange:E=>{E?d():h()},menu:{items:x,onClick:S},open:u,trigger:["click"],children:k.jsx(hn,{onClick:C,type:"text",size:"large",style:{padding:4},children:k.jsx(hb,{style:{fontSize:24}})})})})})})]})}},Ok=[We.SPEAK];function Rxe(){const{getNodes:e,getEdges:t}=no(),n=lC();return{isValidConnection:T.useCallback(o=>{const i=e(),a=t(),s=i.find(l=>l.id===o.source);return i.find(l=>l.id===o.target),s.type===We.START&&a.filter(l=>l.source===o.source).length>0?(n.error({key:"start-node-only-one",content:"Bot bắt đầu chỉ có 1 đầu ra"}),!1):!0},[t,e,n])}}var kxe="scripts_editor_ohkkdt0",Nk="scripts_editor_ohkkdt2",Fxe="scripts_editor_ohkkdt3",Bxe="scripts_editor_ohkkdt4",Vxe="scripts_editor_ohkkdt5";const zxe=()=>{const[e,t]=sC(),{BLOCKS_ENABLED:n}=Bv(),r=(o,i)=>{t(i),o.dataTransfer.effectAllowed="move"};return ha.isEmpty(n)?k.jsx(k.Fragment,{}):k.jsx("div",{className:kxe,children:k.jsx(qa,{wrapperTag:o=>k.jsx(an,{...o,direction:"vertical",size:16}),children:qS.filter(o=>n==null?void 0:n.includes(o.key)).map(o=>{const i=o.icon,a=o.active,s=o.label.includes(`
|
|
403
|
+
`)||o.label.length>9;return k.jsxs(hn,{draggable:!0,type:"text",className:a?`${Nk} ${Fxe}`:Nk,onDragStart:l=>r(l,o.key),style:{minHeight:s?"62px":"54px"},children:[k.jsx("span",{className:Bxe,style:{color:GS[o.key]},children:k.jsx(i,{})}),k.jsx("span",{className:Vxe,children:o.label})]},o.key)})})})};var jxe="scripts_editor_3c0va90",Hxe="scripts_editor_3c0va91",Wxe="scripts_editor_3c0va93";const Uxe=e=>`${e.toLowerCase()}_${Mg()}`,qxe=T.forwardRef((e,t)=>{const{reactFlowRef:n}=Bv(),[r,o,i]=tU(k5),[a,s,l]=nU(F5),[c,u]=T.useState(),{screenToFlowPosition:d,fitView:h}=no(),{isValidConnection:p}=Rxe(),[y]=sC(),b=TC(),v=e.onAlertsChange||(()=>{}),w=T.useCallback($=>s(O=>M2({...$,type:"button"},O)),[s]),x=T.useCallback($=>{u($)},[]),C=T.useCallback($=>{$.preventDefault(),$.dataTransfer.dropEffect="move"},[]),S=T.useCallback($=>{if($.preventDefault(),!y||$.target.closest('[data-group-drop-zone="true"]'))return;const I=d({x:$.clientX,y:$.clientY}),M={id:Uxe(y),type:y,position:I,data:{title:Mf[y],...Ag[y]},deletable:!0,...Dg[y]};o(A=>A.concat(M))},[d,y,o]),E=T.useCallback($=>{h({nodes:[{id:$}],padding:.2,duration:700})},[h]);return T.useImperativeHandle(t,()=>({getFlowJson:()=>c==null?void 0:c.toObject(),loadFlowJson:$=>{if(!$)return;const O=Array.isArray($.nodes)?$.nodes:[],N=Array.isArray($.edges)?$.edges:[];if(o(O),s(N),$.viewport&&c){const{x:I,y:M,zoom:A}=$.viewport;c.setViewport({x:I,y:M,zoom:A})}else c&&c.fitView()},moveToNode:$=>{E($)}})),yO(()=>{v(b)},[b]),k.jsx("div",{className:jxe,children:k.jsx("div",{className:Hxe,children:k.jsx("div",{className:Wxe,ref:n,children:k.jsxs(KW,{nodes:r,edges:a,nodeTypes:$k,edgeTypes:Lxe,onNodesChange:i,onEdgesChange:l,isValidConnection:p,onConnect:w,onInit:x,onDrop:S,onDragOver:C,fitView:!0,connectionMode:ll.Strict,children:[k.jsx(pU,{orientation:"horizontal"}),k.jsx(sU,{variant:"dots",gap:12,size:2}),k.jsx(OU,{nodeColor:n0,pannable:!0,zoomable:!0,maskColor:"#F7F7F7",nodeStrokeWidth:4,nodeStrokeColor:$=>n0($)?Or(n0($)).darken(.25).hex():"transparent",nodeBorderRadius:12}),k.jsx(zxe,{})]})})})})}),Gxe=T.forwardRef((e,t)=>k.jsx("section",{className:"scripts-editor-global",children:k.jsx(SL,{...e,BLOCKS_ENABLED:e.BLOCKS_ENABLED||_k,children:k.jsx(wV,{client:WU,children:k.jsx(qce,{children:k.jsx(lO,{children:k.jsx(Uce,{children:k.jsx(Qce,{children:k.jsx(qxe,{ref:t,onAlertsChange:e.onAlertsChange})})})})})})})}));Ct.AUTO_CONNECT_BLOCKS=Ok,Ct.BlockType=We,Ct.DEFAULT_SIDEBAR_BUTTONS=_k,Ct.INTENTS=Af,Ct.InstanceContextProvider=SL,Ct.SPEAK_TYPE=Yn,Ct.ScriptEditor=Gxe,Ct.TRANSFER_TYPE=ki,Ct.getNodeColor=n0,Ct.iconColors=GS,Ct.initialData=Ag,Ct.initialEdges=F5,Ct.initialNodeProps=Dg,Ct.initialNodes=k5,Ct.initialTitles=Mf,Ct.nodeTypes=$k,Ct.sidebarButtons=qS,Ct.useAlert=tv,Ct.useAlerts=TC,Ct.useInstanceContext=Bv,Object.defineProperty(Ct,Symbol.toStringTag,{value:"Module"})});
|