mobileboost-cli 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/{index-Deils465.js → index-DZmEo48o.js} +27 -27
- package/.output/public/assets/{main-5WzLXT-A.js → main-FOq-oewQ.js} +1 -1
- package/.output/server/chunks/_/{_tanstack-start-manifest_v-Chz34YFq.mjs → _tanstack-start-manifest_v-BAlHtpU2.mjs} +1 -1
- package/.output/server/chunks/_/cache-D_LOBxSY.mjs +1 -0
- package/.output/server/chunks/_/client-DG3m9828.mjs +1 -0
- package/.output/server/chunks/_/{index-BPmuBr-n.mjs → index-BXxc4aBP.mjs} +69 -69
- package/.output/server/chunks/_/{router-vxnEMbKX.mjs → router-PQBliVi5.mjs} +1 -1
- package/.output/server/chunks/_/server.mjs +2 -2
- package/.output/server/index.mjs +6 -6
- package/dist/commands/studio.js +16 -8
- package/dist/commands/studio.js.map +1 -1
- package/package.json +1 -1
- package/.output/server/chunks/_/cache-C5L90tGD.mjs +0 -1
- package/.output/server/chunks/_/client-CzCEo8ab.mjs +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as x,Fragment as Xn,jsx as l}from"react/jsx-runtime";import ee,{useRef as J,useEffect as Ne,useContext as mo,useLayoutEffect as Hi,useState as Ee,useMemo as Ui,useCallback as ho}from"react";import G from"@emotion/styled";import{useMutation as ce,mutationOptions as me,useQuery as mt,queryOptions as hn,useQueryClient as ji}from"@tanstack/react-query";import{CircularProgress as go,Typography as M,Box as ge,IconButton as _,Divider as Ht,Dialog as qi,DialogTitle as Yi,DialogContent as Ki,TextField as H,DialogActions as Xi,Button as Ae,Tooltip as ln,FormControl as gn,InputLabel as bn,Select as vn,MenuItem as Dt,FormControlLabel as we,Switch as Ar,ToggleButtonGroup as Ji,ToggleButton as Pr,Snackbar as Zi,Alert as Qi,List as bo,FormHelperText as Jn,Checkbox as $e,ListItem as On,InputAdornment as ea,ListItemIcon as Rr,ListItemText as Tr,Collapse as ta,styled as et,Paper as Zn,Chip as He}from"@mui/material";import{Store as na,useStore as Ie}from"@tanstack/react-store";import ra,{flushSync as vo}from"react-dom";import{bindActionCreators as Br,createStore as oa,compose as ia,applyMiddleware as aa}from"redux";import{connect as yo,Provider as sa}from"react-redux";import $r from"tiny-invariant";import xo from"@babel/runtime/helpers/esm/extends";import{R as C,y as Do,S as la,m as ca,p as da,c as ua,l as pa,r as fa,i as ma,s as ha,I as _r,j as ga}from"./stores-C1dCcTeV.mjs";import{styled as It}from"@mui/material/styles";import ba from"@mui/icons-material/Keyboard";import va from"@mui/icons-material/SwipeVertical";import ya from"@mui/icons-material/Search";import xa from"@mui/icons-material/Link";import Da from"@mui/icons-material/SmartToy";import tt from"@mui/icons-material/PlayArrow";import nt from"@mui/icons-material/FastForward";import rt from"@mui/icons-material/Edit";import Ye from"@mui/icons-material/Delete";import{a as ie,g as Ea,T as wa}from"./server.mjs";import{h as Ca,d as Ia,l as Na,x as Sa,A as Oa,e as Qn,r as Aa}from"./device-8ONaG49P.mjs";import{performTap as Pa,performType as Ra,performScroll as Eo,getPageSource as er,performDeepLink as Ta,ensureAppiumSession as Ba,performSwipe as $a}from"./appium-client-D-NjeB35.mjs";import{h as tr,c as wo,l as _a,a as ka,$ as Fa,i as La,m as Va}from"./hierarchy-helpers-DF8QSYE6.mjs";import{f as Ma,u as Ga,b as Wa}from"./adb-client-DwefjXbe.mjs";import{m as za,u as Ha}from"./ios-client-1xTZzFD8.mjs";import{i as Ua,n as ja}from"./step-CEQtT3SD.mjs";import kr from"node:fs";import Re from"node:path";import qa from"node:crypto";import{o as Ya,i as Ka,n as Xa}from"./cache-D_LOBxSY.mjs";import{j as Ja,E as Za,x as Qa,I as es}from"./ai-client-BtI1TeHN.mjs";import Fe from"fs-extra";import{z as q}from"zod";import{useForm as ts}from"@tanstack/react-form";import ns from"@mui/icons-material/Save";import rs from"@mui/icons-material/Close";import os from"@mui/icons-material/KeyboardArrowUp";import is from"@mui/icons-material/KeyboardArrowDown";import as from"@mui/icons-material/CheckCircle";import ss from"@mui/icons-material/Info";import Co from"@mui/icons-material/Add";import ls from"@mui/icons-material/Refresh";import cs from"@mui/icons-material/CreateNewFolder";import ds from"@mui/icons-material/Folder";import us from"@mui/icons-material/InsertDriveFile";import ps from"@mui/icons-material/ExpandLess";import fs from"@mui/icons-material/ExpandMore";import ms from"@mui/icons-material/Check";import hs from"@mui/material/AlertTitle";import"@tanstack/history";import"@tanstack/router-core/ssr/client";import"@tanstack/router-core";import"node:async_hooks";import"@tanstack/router-core/ssr/server";import"../../index.mjs";import"node:http";import"node:stream";import"node:https";import"node:http2";import"node:url";import"seroval";import"@tanstack/react-router/ssr/server";import"@tanstack/react-router";import"webdriverio";import"xml2js";import"node:child_process";import"node:util";import"sharp";var Me=function(t){var n=t.top,r=t.right,o=t.bottom,i=t.left,a=r-i,s=o-n,c={top:n,right:r,bottom:o,left:i,width:a,height:s,x:i,y:n,center:{x:(r+i)/2,y:(o+n)/2}};return c},nr=function(t,n){return{top:t.top-n.top,left:t.left-n.left,bottom:t.bottom+n.bottom,right:t.right+n.right}},Fr=function(t,n){return{top:t.top+n.top,left:t.left+n.left,bottom:t.bottom-n.bottom,right:t.right-n.right}},gs=function(t,n){return{top:t.top+n.y,left:t.left+n.x,bottom:t.bottom+n.y,right:t.right+n.x}},An={top:0,right:0,bottom:0,left:0},rr=function(t){var n=t.borderBox,r=t.margin,o=r===void 0?An:r,i=t.border,a=i===void 0?An:i,s=t.padding,c=s===void 0?An:s,u=Me(nr(n,o)),f=Me(Fr(n,a)),d=Me(Fr(f,c));return{marginBox:u,borderBox:Me(n),paddingBox:f,contentBox:d,margin:o,border:a,padding:c}},_e=function(t){var n=t.slice(0,-2),r=t.slice(-2);if(r!=="px")return 0;var o=Number(n);return isNaN(o)&&(process.env.NODE_ENV!=="production"?$r(!1,"Could not parse value [raw: "+t+", without suffix: "+n+"]"):$r(!1)),o},bs=function(){return{x:window.pageXOffset,y:window.pageYOffset}},cn=function(t,n){var r=t.borderBox,o=t.border,i=t.margin,a=t.padding,s=gs(r,n);return rr({borderBox:s,border:o,margin:i,padding:a})},dn=function(t,n){return n===void 0&&(n=bs()),cn(t,n)},Io=function(t,n){var r={top:_e(n.marginTop),right:_e(n.marginRight),bottom:_e(n.marginBottom),left:_e(n.marginLeft)},o={top:_e(n.paddingTop),right:_e(n.paddingRight),bottom:_e(n.paddingBottom),left:_e(n.paddingLeft)},i={top:_e(n.borderTopWidth),right:_e(n.borderRightWidth),bottom:_e(n.borderBottomWidth),left:_e(n.borderLeftWidth)};return rr({borderBox:t,margin:r,padding:o,border:i})},No=function(t){var n=t.getBoundingClientRect(),r=window.getComputedStyle(t);return Io(n,r)},_t=function(t){var n=[],r=null,o=function(){for(var a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];n=s,!r&&(r=requestAnimationFrame(function(){r=null,t.apply(void 0,n)}))};return o.cancel=function(){r&&(cancelAnimationFrame(r),r=null)},o};const vs=process.env.NODE_ENV==="production",ys=/[ \t]{2,}/g,xs=/^[ \t]*/gm,Lr=e=>e.replace(ys," ").replace(xs,"").trim(),Ds=e=>Lr(`
|
|
2
2
|
%c@hello-pangea/dnd
|
|
3
3
|
|
|
4
4
|
%c${Lr(e)}
|
|
5
5
|
|
|
6
6
|
%c👷 This is a development only message. It will be removed in production builds.
|
|
7
|
-
`),Es=e=>[
|
|
7
|
+
`),Es=e=>[Ds(e),"color: #00C584; font-size: 1.2em; font-weight: bold;","line-height: 1.5","color: #723874;"],ws="__@hello-pangea/dnd-disable-dev-warnings";function So(e,t){vs||typeof window<"u"&&window[ws]||console[e](...Es(t))}const Z=So.bind(null,"warn"),Wn=So.bind(null,"error");function Je(){}function Cs(e,t){return{...e,...t}}function ke(e,t,n){const r=t.map(o=>{const i=Cs(n,o.options);return e.addEventListener(o.eventName,o.fn,i),function(){e.removeEventListener(o.eventName,o.fn,i)}});return function(){r.forEach(i=>{i()})}}const Is=process.env.NODE_ENV==="production",Vr="Invariant failed";class kt extends Error{}kt.prototype.toString=function(){return this.message};function h(e,t){throw Is?new kt(Vr):new kt(`${Vr}: ${t||""}`)}class Ns extends ee.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=Je,this.onWindowError=n=>{const r=this.getCallbacks();r.isDragging()&&(r.tryAbort(),process.env.NODE_ENV!=="production"&&Z(`
|
|
8
8
|
An error was caught by our window 'error' event listener while a drag was occurring.
|
|
9
9
|
The active drag has been aborted.
|
|
10
|
-
`));const o=n.error;o instanceof kt&&(n.preventDefault(),process.env.NODE_ENV!=="production"&&Wn(o.message))},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=n=>{this.callbacks=n}}componentDidMount(){this.unbind=
|
|
10
|
+
`));const o=n.error;o instanceof kt&&(n.preventDefault(),process.env.NODE_ENV!=="production"&&Wn(o.message))},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=n=>{this.callbacks=n}}componentDidMount(){this.unbind=ke(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof kt){process.env.NODE_ENV!=="production"&&Wn(t.message),this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const Ss=`
|
|
11
11
|
Press space bar to start a drag.
|
|
12
12
|
When dragging you can use the arrow keys to move the item around and escape to cancel.
|
|
13
13
|
Some screen readers may require you to be in focus mode or to use your pass through key
|
|
@@ -43,27 +43,27 @@ import{jsxs as D,Fragment as Xn,jsx as l}from"react/jsx-runtime";import ee,{useR
|
|
|
43
43
|
`:`
|
|
44
44
|
The item has been dropped while not over a drop area.
|
|
45
45
|
${Mr(e.source)}
|
|
46
|
-
`},sn={dragHandleUsageInstructions:Ss,onDragStart:Os,onDragUpdate:As,onDragEnd:Ps};function Rs(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function Po(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Rs(e[n],t[n]))return!1;return!0}function L(e,t){const n=we(()=>({inputs:t,result:e()}))[0],r=J(!0),o=J(n),a=r.current||!!(t&&o.current.inputs&&Po(t,o.current.inputs))?o.current:{inputs:t,result:e()};return Se(()=>{r.current=!1,o.current=a},[a]),a.result}function x(e,t){return L(()=>e,t)}const fe={x:0,y:0},he=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),Pe=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),Je=(e,t)=>e.x===t.x&&e.y===t.y,Nt=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),gt=(e,t,n=0)=>e==="x"?{x:t,y:n}:{x:n,y:t},_t=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),Gr=(e,t)=>Math.min(...t.map(n=>_t(e,n))),Ro=e=>t=>({x:e(t.x),y:e(t.y)});var Ts=(e,t)=>{const n=Ge({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return n.width<=0||n.height<=0?null:n};const Ht=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),Wr=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],Bs={top:0,right:0,bottom:0,left:0},$s=(e,t)=>t?Ht(e,t.scroll.diff.displacement):e,ks=(e,t,n)=>n&&n.increasedBy?{...e,[t.end]:e[t.end]+n.increasedBy[t.line]}:e,_s=(e,t)=>t&&t.shouldClipSubject?Ts(t.pageMarginBox,e):Ge(e);var Et=({page:e,withPlaceholder:t,axis:n,frame:r})=>{const o=$s(e.marginBox,r),i=ks(o,n,t),a=_s(i,r);return{page:e,withPlaceholder:t,active:a}},or=(e,t)=>{e.frame||(process.env.NODE_ENV,h());const n=e.frame,r=Pe(t,n.scroll.initial),o=Nt(r),i={...n,scroll:{initial:n.scroll.initial,current:t,diff:{value:r,displacement:o},max:n.scroll.max}},a=Et({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:i});return{...e,frame:i,subject:a}};function pe(e,t=Po){let n=null;function r(...o){if(n&&n.lastThis===this&&t(o,n.lastArgs))return n.lastResult;const i=e.apply(this,o);return n={lastResult:i,lastArgs:o,lastThis:this},i}return r.clear=function(){n=null},r}const To=pe(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),Bo=pe(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),yn=pe(e=>Object.values(e)),Fs=pe(e=>Object.values(e));var bt=pe((e,t)=>Fs(t).filter(r=>e===r.descriptor.droppableId).sort((r,o)=>r.descriptor.index-o.descriptor.index));function ir(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function Dn(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var xn=pe((e,t)=>t.filter(n=>n.descriptor.id!==e.descriptor.id)),Ls=({isMovingForward:e,draggable:t,destination:n,insideDestination:r,previousImpact:o})=>{if(!n.isCombineEnabled||!ir(o))return null;function a(m){const b={type:"COMBINE",combine:{draggableId:m,droppableId:n.descriptor.id}};return{...o,at:b}}const s=o.displaced.all,c=s.length?s[0]:null;if(e)return c?a(c):null;const u=xn(t,r);if(!c){if(!u.length)return null;const m=u[u.length-1];return a(m.descriptor.id)}const f=u.findIndex(m=>m.descriptor.id===c);f===-1&&(process.env.NODE_ENV!=="production"?h(!1,"Could not find displaced item in set"):h());const d=f-1;if(d<0)return null;const p=u[d];return a(p.descriptor.id)},St=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const $o={point:fe,value:0},Ft={invisible:{},visible:{},all:[]},Vs={displaced:Ft,displacedBy:$o,at:null};var Ve=(e,t)=>n=>e<=n&&n<=t,ko=e=>{const t=Ve(e.top,e.bottom),n=Ve(e.left,e.right);return r=>{if(t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right))return!0;const i=t(r.top)||t(r.bottom),a=n(r.left)||n(r.right);if(i&&a)return!0;const c=r.top<e.top&&r.bottom>e.bottom,u=r.left<e.left&&r.right>e.right;return c&&u?!0:c&&a||u&&i}},Ms=e=>{const t=Ve(e.top,e.bottom),n=Ve(e.left,e.right);return r=>t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right)};const ar={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},_o={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var Gs=e=>t=>{const n=Ve(t.top,t.bottom),r=Ve(t.left,t.right);return o=>e===ar?n(o.top)&&n(o.bottom):r(o.left)&&r(o.right)};const Ws=(e,t)=>{const n=t.frame?t.frame.scroll.diff.displacement:fe;return Ht(e,n)},zs=(e,t,n)=>t.subject.active?n(t.subject.active)(e):!1,Hs=(e,t,n)=>n(t)(e),sr=({target:e,destination:t,viewport:n,withDroppableDisplacement:r,isVisibleThroughFrameFn:o})=>{const i=r?Ws(e,t):e;return zs(i,t,o)&&Hs(i,n,o)},Us=e=>sr({...e,isVisibleThroughFrameFn:ko}),Fo=e=>sr({...e,isVisibleThroughFrameFn:Ms}),js=e=>sr({...e,isVisibleThroughFrameFn:Gs(e.destination.axis)}),qs=(e,t,n)=>{if(typeof n=="boolean")return n;if(!t)return!0;const{invisible:r,visible:o}=t;if(r[e])return!1;const i=o[e];return i?i.shouldAnimate:!0};function Ks(e,t){const n=e.page.marginBox,r={top:t.point.y,right:0,bottom:0,left:t.point.x};return Ge(nr(n,r))}function Lt({afterDragging:e,destination:t,displacedBy:n,viewport:r,forceShouldAnimate:o,last:i}){return e.reduce(function(s,c){const u=Ks(c,n),f=c.descriptor.id;if(s.all.push(f),!Us({target:u,destination:t,viewport:r,withDroppableDisplacement:!0}))return s.invisible[c.descriptor.id]=!0,s;const p=qs(f,i,o),m={draggableId:f,shouldAnimate:p};return s.visible[f]=m,s},{all:[],visible:{},invisible:{}})}function Ys(e,t){if(!e.length)return 0;const n=e[e.length-1].descriptor.index;return t.inHomeList?n:n+1}function zr({insideDestination:e,inHomeList:t,displacedBy:n,destination:r}){const o=Ys(e,{inHomeList:t});return{displaced:Ft,displacedBy:n,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:o}}}}function pn({draggable:e,insideDestination:t,destination:n,viewport:r,displacedBy:o,last:i,index:a,forceShouldAnimate:s}){const c=St(e,n);if(a==null)return zr({insideDestination:t,inHomeList:c,displacedBy:o,destination:n});const u=t.find(b=>b.descriptor.index===a);if(!u)return zr({insideDestination:t,inHomeList:c,displacedBy:o,destination:n});const f=xn(e,t),d=t.indexOf(u),p=f.slice(d);return{displaced:Lt({afterDragging:p,destination:n,displacedBy:o,last:i,viewport:r.frame,forceShouldAnimate:s}),displacedBy:o,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:a}}}}function Ze(e,t){return!!t.effected[e]}var Xs=({isMovingForward:e,destination:t,draggables:n,combine:r,afterCritical:o})=>{if(!t.isCombineEnabled)return null;const i=r.draggableId,s=n[i].descriptor.index;return Ze(i,o)?e?s:s-1:e?s+1:s},Js=({isMovingForward:e,isInHomeList:t,insideDestination:n,location:r})=>{if(!n.length)return null;const o=r.index,i=e?o+1:o-1,a=n[0].descriptor.index,s=n[n.length-1].descriptor.index,c=t?s:s+1;return i<a||i>c?null:i},Zs=({isMovingForward:e,isInHomeList:t,draggable:n,draggables:r,destination:o,insideDestination:i,previousImpact:a,viewport:s,afterCritical:c})=>{const u=a.at;if(u||(process.env.NODE_ENV!=="production"?h(!1,"Cannot move in direction without previous impact location"):h()),u.type==="REORDER"){const d=Js({isMovingForward:e,isInHomeList:t,location:u.destination,insideDestination:i});return d==null?null:pn({draggable:n,insideDestination:i,destination:o,viewport:s,last:a.displaced,displacedBy:a.displacedBy,index:d})}const f=Xs({isMovingForward:e,destination:o,displaced:a.displaced,draggables:r,combine:u.combine,afterCritical:c});return f==null?null:pn({draggable:n,insideDestination:i,destination:o,viewport:s,last:a.displaced,displacedBy:a.displacedBy,index:f})},Qs=({displaced:e,afterCritical:t,combineWith:n,displacedBy:r})=>{const o=!!(e.visible[n]||e.invisible[n]);return Ze(n,t)?o?fe:Nt(r.point):o?r.point:fe},el=({afterCritical:e,impact:t,draggables:n})=>{const r=Dn(t);r||(process.env.NODE_ENV,h());const o=r.draggableId,i=n[o].page.borderBox.center,a=Qs({displaced:t.displaced,afterCritical:e,combineWith:o,displacedBy:t.displacedBy});return he(i,a)};const Lo=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,tl=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,lr=(e,t,n)=>t[e.crossAxisStart]+n.margin[e.crossAxisStart]+n.borderBox[e.crossAxisSize]/2,Hr=({axis:e,moveRelativeTo:t,isMoving:n})=>gt(e.line,t.marginBox[e.end]+Lo(e,n),lr(e,t.marginBox,n)),Ur=({axis:e,moveRelativeTo:t,isMoving:n})=>gt(e.line,t.marginBox[e.start]-tl(e,n),lr(e,t.marginBox,n)),nl=({axis:e,moveInto:t,isMoving:n})=>gt(e.line,t.contentBox[e.start]+Lo(e,n),lr(e,t.contentBox,n));var rl=({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:o})=>{const i=bt(r.descriptor.id,n),a=t.page,s=r.axis;if(!i.length)return nl({axis:s,moveInto:r.page,isMoving:a});const{displaced:c,displacedBy:u}=e,f=c.all[0];if(f){const p=n[f];if(Ze(f,o))return Ur({axis:s,moveRelativeTo:p.page,isMoving:a});const m=cn(p.page,u.point);return Ur({axis:s,moveRelativeTo:m,isMoving:a})}const d=i[i.length-1];if(d.descriptor.id===t.descriptor.id)return a.borderBox.center;if(Ze(d.descriptor.id,o)){const p=cn(d.page,Nt(o.displacedBy.point));return Hr({axis:s,moveRelativeTo:p,isMoving:a})}return Hr({axis:s,moveRelativeTo:d.page,isMoving:a})},zn=(e,t)=>{const n=e.frame;return n?he(t,n.scroll.diff.displacement):t};const ol=({impact:e,draggable:t,droppable:n,draggables:r,afterCritical:o})=>{const i=t.page.borderBox.center,a=e.at;return!n||!a?i:a.type==="REORDER"?rl({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:o}):el({impact:e,draggables:r,afterCritical:o})};var En=e=>{const t=ol(e),n=e.droppable;return n?zn(n,t):t},Vo=(e,t)=>{const n=Pe(t,e.scroll.initial),r=Nt(n);return{frame:Ge({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:n,displacement:r}}}};function jr(e,t){return e.map(n=>t[n])}function il(e,t){for(let n=0;n<t.length;n++){const r=t[n].visible[e];if(r)return r}return null}var al=({impact:e,viewport:t,destination:n,draggables:r,maxScrollChange:o})=>{const i=Vo(t,he(t.scroll.current,o)),a=n.frame?or(n,he(n.frame.scroll.current,o)):n,s=e.displaced,c=Lt({afterDragging:jr(s.all,r),destination:n,displacedBy:e.displacedBy,viewport:i.frame,last:s,forceShouldAnimate:!1}),u=Lt({afterDragging:jr(s.all,r),destination:a,displacedBy:e.displacedBy,viewport:t.frame,last:s,forceShouldAnimate:!1}),f={},d={},p=[s,c,u];return s.all.forEach(b=>{const v=il(b,p);if(v){d[b]=v;return}f[b]=!0}),{...e,displaced:{all:s.all,invisible:f,visible:d}}},sl=(e,t)=>he(e.scroll.diff.displacement,t),cr=({pageBorderBoxCenter:e,draggable:t,viewport:n})=>{const r=sl(n,e),o=Pe(r,t.page.borderBox.center);return he(t.client.borderBox.center,o)},Mo=({draggable:e,destination:t,newPageBorderBoxCenter:n,viewport:r,withDroppableDisplacement:o,onlyOnMainAxis:i=!1})=>{const a=Pe(n,e.page.borderBox.center),c={target:Ht(e.page.borderBox,a),destination:t,withDroppableDisplacement:o,viewport:r};return i?js(c):Fo(c)},ll=({isMovingForward:e,draggable:t,destination:n,draggables:r,previousImpact:o,viewport:i,previousPageBorderBoxCenter:a,previousClientSelection:s,afterCritical:c})=>{if(!n.isEnabled)return null;const u=bt(n.descriptor.id,r),f=St(t,n),d=Ls({isMovingForward:e,draggable:t,destination:n,insideDestination:u,previousImpact:o})||Zs({isMovingForward:e,isInHomeList:f,draggable:t,draggables:r,destination:n,insideDestination:u,previousImpact:o,viewport:i,afterCritical:c});if(!d)return null;const p=En({impact:d,draggable:t,droppable:n,draggables:r,afterCritical:c});if(Mo({draggable:t,destination:n,newPageBorderBoxCenter:p,viewport:i.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:cr({pageBorderBoxCenter:p,draggable:t,viewport:i}),impact:d,scrollJumpRequest:null};const b=Pe(p,a),v=al({impact:d,viewport:i,destination:n,draggables:r,maxScrollChange:b});return{clientSelection:s,impact:v,scrollJumpRequest:b}};const Ee=e=>{const t=e.subject.active;return t||(process.env.NODE_ENV!=="production"?h(!1,"Cannot get clipped area from droppable"):h()),t};var cl=({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:r,viewport:o})=>{const i=n.subject.active;if(!i)return null;const a=n.axis,s=Ve(i[a.start],i[a.end]),c=yn(r).filter(f=>f!==n).filter(f=>f.isEnabled).filter(f=>!!f.subject.active).filter(f=>ko(o.frame)(Ee(f))).filter(f=>{const d=Ee(f);return e?i[a.crossAxisEnd]<d[a.crossAxisEnd]:d[a.crossAxisStart]<i[a.crossAxisStart]}).filter(f=>{const d=Ee(f),p=Ve(d[a.start],d[a.end]);return s(d[a.start])||s(d[a.end])||p(i[a.start])||p(i[a.end])}).sort((f,d)=>{const p=Ee(f)[a.crossAxisStart],m=Ee(d)[a.crossAxisStart];return e?p-m:m-p}).filter((f,d,p)=>Ee(f)[a.crossAxisStart]===Ee(p[0])[a.crossAxisStart]);if(!c.length)return null;if(c.length===1)return c[0];const u=c.filter(f=>Ve(Ee(f)[a.start],Ee(f)[a.end])(t[a.line]));return u.length===1?u[0]:u.length>1?u.sort((f,d)=>Ee(f)[a.start]-Ee(d)[a.start])[0]:c.sort((f,d)=>{const p=Gr(t,Wr(Ee(f))),m=Gr(t,Wr(Ee(d)));return p!==m?p-m:Ee(f)[a.start]-Ee(d)[a.start]})[0]};const qr=(e,t)=>{const n=e.page.borderBox.center;return Ze(e.descriptor.id,t)?Pe(n,t.displacedBy.point):n},dl=(e,t)=>{const n=e.page.borderBox;return Ze(e.descriptor.id,t)?Ht(n,Nt(t.displacedBy.point)):n};var ul=({pageBorderBoxCenter:e,viewport:t,destination:n,insideDestination:r,afterCritical:o})=>r.filter(a=>Fo({target:dl(a,o),destination:n,viewport:t.frame,withDroppableDisplacement:!0})).sort((a,s)=>{const c=_t(e,zn(n,qr(a,o))),u=_t(e,zn(n,qr(s,o)));return c<u?-1:u<c?1:a.descriptor.index-s.descriptor.index})[0]||null,Ut=pe(function(t,n){const r=n[t.line];return{value:r,point:gt(t.line,r)}});const pl=(e,t,n)=>{const r=e.axis;if(e.descriptor.mode==="virtual")return gt(r.line,t[r.line]);const o=e.subject.page.contentBox[r.size],c=bt(e.descriptor.id,n).reduce((u,f)=>u+f.client.marginBox[r.size],0)+t[r.line]-o;return c<=0?null:gt(r.line,c)},Go=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),Wo=(e,t,n)=>{const r=e.frame;St(t,e)&&(process.env.NODE_ENV!=="production"?h(!1,"Should not add placeholder space to home list"):h()),e.subject.withPlaceholder&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot add placeholder size to a subject when it already has one"):h());const o=Ut(e.axis,t.displaceBy).point,i=pl(e,o,n),a={placeholderSize:o,increasedBy:i,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!r){const f=Et({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:e.frame});return{...e,subject:f}}const s=i?he(r.scroll.max,i):r.scroll.max,c=Go(r,s),u=Et({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:c});return{...e,subject:u,frame:c}},fl=e=>{const t=e.subject.withPlaceholder;t||(process.env.NODE_ENV!=="production"?h(!1,"Cannot remove placeholder form subject when there was none"):h());const n=e.frame;if(!n){const a=Et({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:a}}const r=t.oldFrameMaxScroll;r||(process.env.NODE_ENV!=="production"?h(!1,"Expected droppable with frame to have old max frame scroll when removing placeholder"):h());const o=Go(n,r),i=Et({page:e.subject.page,axis:e.axis,frame:o,withPlaceholder:null});return{...e,subject:i,frame:o}};var ml=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:n,draggable:r,draggables:o,destination:i,viewport:a,afterCritical:s})=>{if(!t){if(n.length)return null;const d={displaced:Ft,displacedBy:$o,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:0}}},p=En({impact:d,draggable:r,droppable:i,draggables:o,afterCritical:s}),m=St(r,i)?i:Wo(i,r,o);return Mo({draggable:r,destination:m,newPageBorderBoxCenter:p,viewport:a.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?d:null}const c=e[i.axis.line]<=t.page.borderBox.center[i.axis.line],u=(()=>{const d=t.descriptor.index;return t.descriptor.id===r.descriptor.id||c?d:d+1})(),f=Ut(i.axis,r.displaceBy);return pn({draggable:r,insideDestination:n,destination:i,viewport:a,displacedBy:f,last:Ft,index:u})},hl=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:n,isOver:r,draggables:o,droppables:i,viewport:a,afterCritical:s})=>{const c=cl({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:i,viewport:a});if(!c)return null;const u=bt(c.descriptor.id,o),f=ul({pageBorderBoxCenter:t,viewport:a,destination:c,insideDestination:u,afterCritical:s}),d=ml({previousPageBorderBoxCenter:t,destination:c,draggable:n,draggables:o,moveRelativeTo:f,insideDestination:u,viewport:a,afterCritical:s});if(!d)return null;const p=En({impact:d,draggable:n,droppable:c,draggables:o,afterCritical:s});return{clientSelection:cr({pageBorderBoxCenter:p,draggable:n,viewport:a}),impact:d,scrollJumpRequest:null}},Te=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const gl=(e,t)=>{const n=Te(e);return n?t[n]:null};var bl=({state:e,type:t})=>{const n=gl(e.impact,e.dimensions.droppables),r=!!n,o=e.dimensions.droppables[e.critical.droppable.id],i=n||o,a=i.axis.direction,s=a==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||a==="horizontal"&&(t==="MOVE_LEFT"||t==="MOVE_RIGHT");if(s&&!r)return null;const c=t==="MOVE_DOWN"||t==="MOVE_RIGHT",u=e.dimensions.draggables[e.critical.draggable.id],f=e.current.page.borderBoxCenter,{draggables:d,droppables:p}=e.dimensions;return s?ll({isMovingForward:c,previousPageBorderBoxCenter:f,draggable:u,destination:i,draggables:d,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):hl({isMovingForward:c,previousPageBorderBoxCenter:f,draggable:u,isOver:i,draggables:d,droppables:p,viewport:e.viewport,afterCritical:e.afterCritical})};function ft(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function zo(e){const t=Ve(e.top,e.bottom),n=Ve(e.left,e.right);return function(o){return t(o.y)&&n(o.x)}}function vl(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function yl({pageBorderBox:e,draggable:t,candidates:n}){const r=t.page.borderBox.center,o=n.map(i=>{const a=i.axis,s=gt(i.axis.line,e.center[a.line],i.page.borderBox.center[a.crossAxisLine]);return{id:i.descriptor.id,distance:_t(r,s)}}).sort((i,a)=>a.distance-i.distance);return o[0]?o[0].id:null}function Dl({pageBorderBox:e,draggable:t,droppables:n}){const r=yn(n).filter(o=>{if(!o.isEnabled)return!1;const i=o.subject.active;if(!i||!vl(e,i))return!1;if(zo(i)(e.center))return!0;const a=o.axis,s=i.center[a.crossAxisLine],c=e[a.crossAxisStart],u=e[a.crossAxisEnd],f=Ve(i[a.crossAxisStart],i[a.crossAxisEnd]),d=f(c),p=f(u);return!d&&!p?!0:d?c<s:u>s});return r.length?r.length===1?r[0].descriptor.id:yl({pageBorderBox:e,draggable:t,candidates:r}):null}const Ho=(e,t)=>Ge(Ht(e,t));var xl=(e,t)=>{const n=e.frame;return n?Ho(t,n.scroll.diff.value):t};function Uo({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function El({draggable:e,closest:t,inHomeList:n}){return t?n&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var wl=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:n,insideDestination:r,last:o,viewport:i,afterCritical:a})=>{const s=n.axis,c=Ut(n.axis,t.displaceBy),u=c.value,f=e[s.start],d=e[s.end],m=xn(t,r).find(v=>{const y=v.descriptor.id,w=v.page.borderBox.center[s.line],O=Ze(y,a),H=Uo({displaced:o,id:y});return O?H?d<=w:f<w-u:H?d<=w+u:f<w})||null,b=El({draggable:t,closest:m,inHomeList:St(t,n)});return pn({draggable:t,insideDestination:r,destination:n,viewport:i,last:o,displacedBy:c,index:b})};const Cl=4;var Il=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:n,destination:r,insideDestination:o,afterCritical:i})=>{if(!r.isCombineEnabled)return null;const a=r.axis,s=Ut(r.axis,e.displaceBy),c=s.value,u=t[a.start],f=t[a.end],p=xn(e,o).find(b=>{const v=b.descriptor.id,y=b.page.borderBox,O=y[a.size]/Cl,H=Ze(v,i),T=Uo({displaced:n.displaced,id:v});return H?T?f>y[a.start]+O&&f<y[a.end]-O:u>y[a.start]-c+O&&u<y[a.end]-c-O:T?f>y[a.start]+c+O&&f<y[a.end]+c-O:u>y[a.start]+O&&u<y[a.end]-O});return p?{displacedBy:s,displaced:n.displaced,at:{type:"COMBINE",combine:{draggableId:p.descriptor.id,droppableId:r.descriptor.id}}}:null},jo=({pageOffset:e,draggable:t,draggables:n,droppables:r,previousImpact:o,viewport:i,afterCritical:a})=>{const s=Ho(t.page.borderBox,e),c=Dl({pageBorderBox:s,draggable:t,droppables:r});if(!c)return Vs;const u=r[c],f=bt(u.descriptor.id,n),d=xl(u,s);return Il({pageBorderBoxWithDroppableScroll:d,draggable:t,previousImpact:o,destination:u,insideDestination:f,afterCritical:a})||wl({pageBorderBoxWithDroppableScroll:d,draggable:t,destination:u,insideDestination:f,last:o.displaced,viewport:i,afterCritical:a})},dr=(e,t)=>({...e,[t.descriptor.id]:t});const Nl=({previousImpact:e,impact:t,droppables:n})=>{const r=Te(e),o=Te(t);if(!r||r===o)return n;const i=n[r];if(!i.subject.withPlaceholder)return n;const a=fl(i);return dr(n,a)};var Sl=({draggable:e,draggables:t,droppables:n,previousImpact:r,impact:o})=>{const i=Nl({previousImpact:r,impact:o,droppables:n}),a=Te(o);if(!a)return i;const s=n[a];if(St(e,s)||s.subject.withPlaceholder)return i;const c=Wo(s,e,t);return dr(i,c)},Tt=({state:e,clientSelection:t,dimensions:n,viewport:r,impact:o,scrollJumpRequest:i})=>{const a=r||e.viewport,s=n||e.dimensions,c=t||e.current.client.selection,u=Pe(c,e.initial.client.selection),f={offset:u,selection:c,borderBoxCenter:he(e.initial.client.borderBoxCenter,u)},d={selection:he(f.selection,a.scroll.current),borderBoxCenter:he(f.borderBoxCenter,a.scroll.current),offset:he(f.offset,a.scroll.diff.value)},p={client:f,page:d};if(e.phase==="COLLECTING")return{...e,dimensions:s,viewport:a,current:p};const m=s.draggables[e.critical.draggable.id],b=o||jo({pageOffset:d.offset,draggable:m,draggables:s.draggables,droppables:s.droppables,previousImpact:e.impact,viewport:a,afterCritical:e.afterCritical}),v=Sl({draggable:m,impact:b,previousImpact:e.impact,draggables:s.draggables,droppables:s.droppables});return{...e,current:p,dimensions:{draggables:s.draggables,droppables:v},impact:b,viewport:a,scrollJumpRequest:i||null,forceShouldAnimate:i?!1:null}};function Ol(e,t){return e.map(n=>t[n])}var qo=({impact:e,viewport:t,draggables:n,destination:r,forceShouldAnimate:o})=>{const i=e.displaced,a=Ol(i.all,n),s=Lt({afterDragging:a,destination:r,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:o,last:i});return{...e,displaced:s}},Ko=({impact:e,draggable:t,droppable:n,draggables:r,viewport:o,afterCritical:i})=>{const a=En({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:i});return cr({pageBorderBoxCenter:a,draggable:t,viewport:o})},Yo=({state:e,dimensions:t,viewport:n})=>{e.movementMode!=="SNAP"&&(process.env.NODE_ENV,h());const r=e.impact,o=n||e.viewport,i=t||e.dimensions,{draggables:a,droppables:s}=i,c=a[e.critical.draggable.id],u=Te(r);u||(process.env.NODE_ENV!=="production"?h(!1,"Must be over a destination in SNAP movement mode"):h());const f=s[u],d=qo({impact:r,viewport:o,destination:f,draggables:a}),p=Ko({impact:d,draggable:c,droppable:f,draggables:a,viewport:o,afterCritical:e.afterCritical});return Tt({impact:d,clientSelection:p,state:e,dimensions:i,viewport:o})},Al=e=>({index:e.index,droppableId:e.droppableId}),Xo=({draggable:e,home:t,draggables:n,viewport:r})=>{const o=Ut(t.axis,e.displaceBy),i=bt(t.descriptor.id,n),a=i.indexOf(e);a===-1&&(process.env.NODE_ENV!=="production"?h(!1,"Expected draggable to be inside home list"):h());const s=i.slice(a+1),c=s.reduce((p,m)=>(p[m.descriptor.id]=!0,p),{}),u={inVirtualList:t.descriptor.mode==="virtual",displacedBy:o,effected:c};return{impact:{displaced:Lt({afterDragging:s,destination:t,displacedBy:o,last:null,viewport:r.frame,forceShouldAnimate:!1}),displacedBy:o,at:{type:"REORDER",destination:Al(e.descriptor)}},afterCritical:u}},Pl=(e,t)=>({draggables:e.draggables,droppables:dr(e.droppables,t)});const jt=e=>{process.env.NODE_ENV},qt=e=>{process.env.NODE_ENV};var Rl=({draggable:e,offset:t,initialWindowScroll:n})=>{const r=cn(e.client,t),o=dn(r,n);return{...e,placeholder:{...e.placeholder,client:r},client:r,page:o}},Tl=e=>{const t=e.frame;return t||(process.env.NODE_ENV!=="production"?h(!1,"Expected Droppable to have a frame"):h()),t},Bl=({additions:e,updatedDroppables:t,viewport:n})=>{const r=n.scroll.diff.value;return e.map(o=>{const i=o.descriptor.droppableId,a=t[i],c=Tl(a).scroll.diff.value,u=he(r,c);return Rl({draggable:o,offset:u,initialWindowScroll:n.scroll.initial})})},$l=({state:e,published:t})=>{jt();const n=t.modified.map(w=>{const O=e.dimensions.droppables[w.droppableId];return or(O,w.scroll)}),r={...e.dimensions.droppables,...To(n)},o=Bo(Bl({additions:t.additions,updatedDroppables:r,viewport:e.viewport})),i={...e.dimensions.draggables,...o};t.removals.forEach(w=>{delete i[w]});const a={droppables:r,draggables:i},s=Te(e.impact),c=s?a.droppables[s]:null,u=a.draggables[e.critical.draggable.id],f=a.droppables[e.critical.droppable.id],{impact:d,afterCritical:p}=Xo({draggable:u,home:f,draggables:i,viewport:e.viewport}),m=c&&c.isCombineEnabled?e.impact:d,b=jo({pageOffset:e.current.page.offset,draggable:a.draggables[e.critical.draggable.id],draggables:a.draggables,droppables:a.droppables,previousImpact:m,viewport:e.viewport,afterCritical:p});qt();const v={...e,phase:"DRAGGING",impact:b,onLiftImpact:d,dimensions:a,afterCritical:p,forceShouldAnimate:!1};return e.phase==="COLLECTING"?v:{...v,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const Hn=e=>e.movementMode==="SNAP",Pn=(e,t,n)=>{const r=Pl(e.dimensions,t);return!Hn(e)||n?Tt({state:e,dimensions:r}):Yo({state:e,dimensions:r})};function Rn(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const Kr={phase:"IDLE",completed:null,shouldFlush:!1};var kl=(e=Kr,t)=>{if(t.type==="FLUSH")return{...Kr,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&(process.env.NODE_ENV!=="production"?h(!1,"INITIAL_PUBLISH must come after a IDLE phase"):h());const{critical:n,clientSelection:r,viewport:o,dimensions:i,movementMode:a}=t.payload,s=i.draggables[n.draggable.id],c=i.droppables[n.droppable.id],u={selection:r,borderBoxCenter:s.client.borderBox.center,offset:fe},f={client:u,page:{selection:he(u.selection,o.scroll.initial),borderBoxCenter:he(u.selection,o.scroll.initial),offset:he(u.selection,o.scroll.diff.value)}},d=yn(i.droppables).every(v=>!v.isFixedOnPage),{impact:p,afterCritical:m}=Xo({draggable:s,home:c,draggables:i.draggables,viewport:o});return{phase:"DRAGGING",isDragging:!0,critical:n,movementMode:a,dimensions:i,initial:f,current:f,isWindowScrollAllowed:d,impact:p,afterCritical:m,onLiftImpact:p,viewport:o,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&(process.env.NODE_ENV!=="production"?h(!1,`Collection cannot start from phase ${e.phase}`):h()),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||(process.env.NODE_ENV!=="production"?h(!1,`Unexpected ${t.type} received in phase ${e.phase}`):h()),$l({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;ft(e)||(process.env.NODE_ENV!=="production"?h(!1,`${t.type} not permitted in phase ${e.phase}`):h());const{client:n}=t.payload;return Je(n,e.current.client.selection)?e:Tt({state:e,clientSelection:n,impact:Hn(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return Rn(e);ft(e)||(process.env.NODE_ENV!=="production"?h(!1,`${t.type} not permitted in phase ${e.phase}`):h());const{id:n,newScroll:r}=t.payload,o=e.dimensions.droppables[n];if(!o)return e;const i=or(o,r);return Pn(e,i,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;ft(e)||(process.env.NODE_ENV!=="production"?h(!1,`Attempting to move in an unsupported phase ${e.phase}`):h());const{id:n,isEnabled:r}=t.payload,o=e.dimensions.droppables[n];o||(process.env.NODE_ENV!=="production"?h(!1,`Cannot find Droppable[id: ${n}] to toggle its enabled state`):h()),o.isEnabled===r&&(process.env.NODE_ENV!=="production"?h(!1,`Trying to set droppable isEnabled to ${String(r)}
|
|
46
|
+
`},sn={dragHandleUsageInstructions:Ss,onDragStart:Os,onDragUpdate:As,onDragEnd:Ps};function Rs(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function Po(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Rs(e[n],t[n]))return!1;return!0}function V(e,t){const n=Ee(()=>({inputs:t,result:e()}))[0],r=J(!0),o=J(n),a=r.current||!!(t&&o.current.inputs&&Po(t,o.current.inputs))?o.current:{inputs:t,result:e()};return Ne(()=>{r.current=!1,o.current=a},[a]),a.result}function D(e,t){return V(()=>e,t)}const fe={x:0,y:0},he=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),Pe=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),Ze=(e,t)=>e.x===t.x&&e.y===t.y,Nt=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),gt=(e,t,n=0)=>e==="x"?{x:t,y:n}:{x:n,y:t},Ft=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),Gr=(e,t)=>Math.min(...t.map(n=>Ft(e,n))),Ro=e=>t=>({x:e(t.x),y:e(t.y)});var Ts=(e,t)=>{const n=Me({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return n.width<=0||n.height<=0?null:n};const Ut=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),Wr=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],Bs={top:0,right:0,bottom:0,left:0},$s=(e,t)=>t?Ut(e,t.scroll.diff.displacement):e,_s=(e,t,n)=>n&&n.increasedBy?{...e,[t.end]:e[t.end]+n.increasedBy[t.line]}:e,ks=(e,t)=>t&&t.shouldClipSubject?Ts(t.pageMarginBox,e):Me(e);var Et=({page:e,withPlaceholder:t,axis:n,frame:r})=>{const o=$s(e.marginBox,r),i=_s(o,n,t),a=ks(i,r);return{page:e,withPlaceholder:t,active:a}},or=(e,t)=>{e.frame||(process.env.NODE_ENV,h());const n=e.frame,r=Pe(t,n.scroll.initial),o=Nt(r),i={...n,scroll:{initial:n.scroll.initial,current:t,diff:{value:r,displacement:o},max:n.scroll.max}},a=Et({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:i});return{...e,frame:i,subject:a}};function pe(e,t=Po){let n=null;function r(...o){if(n&&n.lastThis===this&&t(o,n.lastArgs))return n.lastResult;const i=e.apply(this,o);return n={lastResult:i,lastArgs:o,lastThis:this},i}return r.clear=function(){n=null},r}const To=pe(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),Bo=pe(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),yn=pe(e=>Object.values(e)),Fs=pe(e=>Object.values(e));var bt=pe((e,t)=>Fs(t).filter(r=>e===r.descriptor.droppableId).sort((r,o)=>r.descriptor.index-o.descriptor.index));function ir(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function xn(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var Dn=pe((e,t)=>t.filter(n=>n.descriptor.id!==e.descriptor.id)),Ls=({isMovingForward:e,draggable:t,destination:n,insideDestination:r,previousImpact:o})=>{if(!n.isCombineEnabled||!ir(o))return null;function a(m){const b={type:"COMBINE",combine:{draggableId:m,droppableId:n.descriptor.id}};return{...o,at:b}}const s=o.displaced.all,c=s.length?s[0]:null;if(e)return c?a(c):null;const u=Dn(t,r);if(!c){if(!u.length)return null;const m=u[u.length-1];return a(m.descriptor.id)}const f=u.findIndex(m=>m.descriptor.id===c);f===-1&&(process.env.NODE_ENV!=="production"?h(!1,"Could not find displaced item in set"):h());const d=f-1;if(d<0)return null;const p=u[d];return a(p.descriptor.id)},St=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const $o={point:fe,value:0},Lt={invisible:{},visible:{},all:[]},Vs={displaced:Lt,displacedBy:$o,at:null};var Le=(e,t)=>n=>e<=n&&n<=t,_o=e=>{const t=Le(e.top,e.bottom),n=Le(e.left,e.right);return r=>{if(t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right))return!0;const i=t(r.top)||t(r.bottom),a=n(r.left)||n(r.right);if(i&&a)return!0;const c=r.top<e.top&&r.bottom>e.bottom,u=r.left<e.left&&r.right>e.right;return c&&u?!0:c&&a||u&&i}},Ms=e=>{const t=Le(e.top,e.bottom),n=Le(e.left,e.right);return r=>t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right)};const ar={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},ko={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var Gs=e=>t=>{const n=Le(t.top,t.bottom),r=Le(t.left,t.right);return o=>e===ar?n(o.top)&&n(o.bottom):r(o.left)&&r(o.right)};const Ws=(e,t)=>{const n=t.frame?t.frame.scroll.diff.displacement:fe;return Ut(e,n)},zs=(e,t,n)=>t.subject.active?n(t.subject.active)(e):!1,Hs=(e,t,n)=>n(t)(e),sr=({target:e,destination:t,viewport:n,withDroppableDisplacement:r,isVisibleThroughFrameFn:o})=>{const i=r?Ws(e,t):e;return zs(i,t,o)&&Hs(i,n,o)},Us=e=>sr({...e,isVisibleThroughFrameFn:_o}),Fo=e=>sr({...e,isVisibleThroughFrameFn:Ms}),js=e=>sr({...e,isVisibleThroughFrameFn:Gs(e.destination.axis)}),qs=(e,t,n)=>{if(typeof n=="boolean")return n;if(!t)return!0;const{invisible:r,visible:o}=t;if(r[e])return!1;const i=o[e];return i?i.shouldAnimate:!0};function Ys(e,t){const n=e.page.marginBox,r={top:t.point.y,right:0,bottom:0,left:t.point.x};return Me(nr(n,r))}function Vt({afterDragging:e,destination:t,displacedBy:n,viewport:r,forceShouldAnimate:o,last:i}){return e.reduce(function(s,c){const u=Ys(c,n),f=c.descriptor.id;if(s.all.push(f),!Us({target:u,destination:t,viewport:r,withDroppableDisplacement:!0}))return s.invisible[c.descriptor.id]=!0,s;const p=qs(f,i,o),m={draggableId:f,shouldAnimate:p};return s.visible[f]=m,s},{all:[],visible:{},invisible:{}})}function Ks(e,t){if(!e.length)return 0;const n=e[e.length-1].descriptor.index;return t.inHomeList?n:n+1}function zr({insideDestination:e,inHomeList:t,displacedBy:n,destination:r}){const o=Ks(e,{inHomeList:t});return{displaced:Lt,displacedBy:n,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:o}}}}function pn({draggable:e,insideDestination:t,destination:n,viewport:r,displacedBy:o,last:i,index:a,forceShouldAnimate:s}){const c=St(e,n);if(a==null)return zr({insideDestination:t,inHomeList:c,displacedBy:o,destination:n});const u=t.find(b=>b.descriptor.index===a);if(!u)return zr({insideDestination:t,inHomeList:c,displacedBy:o,destination:n});const f=Dn(e,t),d=t.indexOf(u),p=f.slice(d);return{displaced:Vt({afterDragging:p,destination:n,displacedBy:o,last:i,viewport:r.frame,forceShouldAnimate:s}),displacedBy:o,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:a}}}}function Qe(e,t){return!!t.effected[e]}var Xs=({isMovingForward:e,destination:t,draggables:n,combine:r,afterCritical:o})=>{if(!t.isCombineEnabled)return null;const i=r.draggableId,s=n[i].descriptor.index;return Qe(i,o)?e?s:s-1:e?s+1:s},Js=({isMovingForward:e,isInHomeList:t,insideDestination:n,location:r})=>{if(!n.length)return null;const o=r.index,i=e?o+1:o-1,a=n[0].descriptor.index,s=n[n.length-1].descriptor.index,c=t?s:s+1;return i<a||i>c?null:i},Zs=({isMovingForward:e,isInHomeList:t,draggable:n,draggables:r,destination:o,insideDestination:i,previousImpact:a,viewport:s,afterCritical:c})=>{const u=a.at;if(u||(process.env.NODE_ENV!=="production"?h(!1,"Cannot move in direction without previous impact location"):h()),u.type==="REORDER"){const d=Js({isMovingForward:e,isInHomeList:t,location:u.destination,insideDestination:i});return d==null?null:pn({draggable:n,insideDestination:i,destination:o,viewport:s,last:a.displaced,displacedBy:a.displacedBy,index:d})}const f=Xs({isMovingForward:e,destination:o,displaced:a.displaced,draggables:r,combine:u.combine,afterCritical:c});return f==null?null:pn({draggable:n,insideDestination:i,destination:o,viewport:s,last:a.displaced,displacedBy:a.displacedBy,index:f})},Qs=({displaced:e,afterCritical:t,combineWith:n,displacedBy:r})=>{const o=!!(e.visible[n]||e.invisible[n]);return Qe(n,t)?o?fe:Nt(r.point):o?r.point:fe},el=({afterCritical:e,impact:t,draggables:n})=>{const r=xn(t);r||(process.env.NODE_ENV,h());const o=r.draggableId,i=n[o].page.borderBox.center,a=Qs({displaced:t.displaced,afterCritical:e,combineWith:o,displacedBy:t.displacedBy});return he(i,a)};const Lo=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,tl=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,lr=(e,t,n)=>t[e.crossAxisStart]+n.margin[e.crossAxisStart]+n.borderBox[e.crossAxisSize]/2,Hr=({axis:e,moveRelativeTo:t,isMoving:n})=>gt(e.line,t.marginBox[e.end]+Lo(e,n),lr(e,t.marginBox,n)),Ur=({axis:e,moveRelativeTo:t,isMoving:n})=>gt(e.line,t.marginBox[e.start]-tl(e,n),lr(e,t.marginBox,n)),nl=({axis:e,moveInto:t,isMoving:n})=>gt(e.line,t.contentBox[e.start]+Lo(e,n),lr(e,t.contentBox,n));var rl=({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:o})=>{const i=bt(r.descriptor.id,n),a=t.page,s=r.axis;if(!i.length)return nl({axis:s,moveInto:r.page,isMoving:a});const{displaced:c,displacedBy:u}=e,f=c.all[0];if(f){const p=n[f];if(Qe(f,o))return Ur({axis:s,moveRelativeTo:p.page,isMoving:a});const m=cn(p.page,u.point);return Ur({axis:s,moveRelativeTo:m,isMoving:a})}const d=i[i.length-1];if(d.descriptor.id===t.descriptor.id)return a.borderBox.center;if(Qe(d.descriptor.id,o)){const p=cn(d.page,Nt(o.displacedBy.point));return Hr({axis:s,moveRelativeTo:p,isMoving:a})}return Hr({axis:s,moveRelativeTo:d.page,isMoving:a})},zn=(e,t)=>{const n=e.frame;return n?he(t,n.scroll.diff.displacement):t};const ol=({impact:e,draggable:t,droppable:n,draggables:r,afterCritical:o})=>{const i=t.page.borderBox.center,a=e.at;return!n||!a?i:a.type==="REORDER"?rl({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:o}):el({impact:e,draggables:r,afterCritical:o})};var En=e=>{const t=ol(e),n=e.droppable;return n?zn(n,t):t},Vo=(e,t)=>{const n=Pe(t,e.scroll.initial),r=Nt(n);return{frame:Me({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:n,displacement:r}}}};function jr(e,t){return e.map(n=>t[n])}function il(e,t){for(let n=0;n<t.length;n++){const r=t[n].visible[e];if(r)return r}return null}var al=({impact:e,viewport:t,destination:n,draggables:r,maxScrollChange:o})=>{const i=Vo(t,he(t.scroll.current,o)),a=n.frame?or(n,he(n.frame.scroll.current,o)):n,s=e.displaced,c=Vt({afterDragging:jr(s.all,r),destination:n,displacedBy:e.displacedBy,viewport:i.frame,last:s,forceShouldAnimate:!1}),u=Vt({afterDragging:jr(s.all,r),destination:a,displacedBy:e.displacedBy,viewport:t.frame,last:s,forceShouldAnimate:!1}),f={},d={},p=[s,c,u];return s.all.forEach(b=>{const v=il(b,p);if(v){d[b]=v;return}f[b]=!0}),{...e,displaced:{all:s.all,invisible:f,visible:d}}},sl=(e,t)=>he(e.scroll.diff.displacement,t),cr=({pageBorderBoxCenter:e,draggable:t,viewport:n})=>{const r=sl(n,e),o=Pe(r,t.page.borderBox.center);return he(t.client.borderBox.center,o)},Mo=({draggable:e,destination:t,newPageBorderBoxCenter:n,viewport:r,withDroppableDisplacement:o,onlyOnMainAxis:i=!1})=>{const a=Pe(n,e.page.borderBox.center),c={target:Ut(e.page.borderBox,a),destination:t,withDroppableDisplacement:o,viewport:r};return i?js(c):Fo(c)},ll=({isMovingForward:e,draggable:t,destination:n,draggables:r,previousImpact:o,viewport:i,previousPageBorderBoxCenter:a,previousClientSelection:s,afterCritical:c})=>{if(!n.isEnabled)return null;const u=bt(n.descriptor.id,r),f=St(t,n),d=Ls({isMovingForward:e,draggable:t,destination:n,insideDestination:u,previousImpact:o})||Zs({isMovingForward:e,isInHomeList:f,draggable:t,draggables:r,destination:n,insideDestination:u,previousImpact:o,viewport:i,afterCritical:c});if(!d)return null;const p=En({impact:d,draggable:t,droppable:n,draggables:r,afterCritical:c});if(Mo({draggable:t,destination:n,newPageBorderBoxCenter:p,viewport:i.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:cr({pageBorderBoxCenter:p,draggable:t,viewport:i}),impact:d,scrollJumpRequest:null};const b=Pe(p,a),v=al({impact:d,viewport:i,destination:n,draggables:r,maxScrollChange:b});return{clientSelection:s,impact:v,scrollJumpRequest:b}};const De=e=>{const t=e.subject.active;return t||(process.env.NODE_ENV!=="production"?h(!1,"Cannot get clipped area from droppable"):h()),t};var cl=({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:r,viewport:o})=>{const i=n.subject.active;if(!i)return null;const a=n.axis,s=Le(i[a.start],i[a.end]),c=yn(r).filter(f=>f!==n).filter(f=>f.isEnabled).filter(f=>!!f.subject.active).filter(f=>_o(o.frame)(De(f))).filter(f=>{const d=De(f);return e?i[a.crossAxisEnd]<d[a.crossAxisEnd]:d[a.crossAxisStart]<i[a.crossAxisStart]}).filter(f=>{const d=De(f),p=Le(d[a.start],d[a.end]);return s(d[a.start])||s(d[a.end])||p(i[a.start])||p(i[a.end])}).sort((f,d)=>{const p=De(f)[a.crossAxisStart],m=De(d)[a.crossAxisStart];return e?p-m:m-p}).filter((f,d,p)=>De(f)[a.crossAxisStart]===De(p[0])[a.crossAxisStart]);if(!c.length)return null;if(c.length===1)return c[0];const u=c.filter(f=>Le(De(f)[a.start],De(f)[a.end])(t[a.line]));return u.length===1?u[0]:u.length>1?u.sort((f,d)=>De(f)[a.start]-De(d)[a.start])[0]:c.sort((f,d)=>{const p=Gr(t,Wr(De(f))),m=Gr(t,Wr(De(d)));return p!==m?p-m:De(f)[a.start]-De(d)[a.start]})[0]};const qr=(e,t)=>{const n=e.page.borderBox.center;return Qe(e.descriptor.id,t)?Pe(n,t.displacedBy.point):n},dl=(e,t)=>{const n=e.page.borderBox;return Qe(e.descriptor.id,t)?Ut(n,Nt(t.displacedBy.point)):n};var ul=({pageBorderBoxCenter:e,viewport:t,destination:n,insideDestination:r,afterCritical:o})=>r.filter(a=>Fo({target:dl(a,o),destination:n,viewport:t.frame,withDroppableDisplacement:!0})).sort((a,s)=>{const c=Ft(e,zn(n,qr(a,o))),u=Ft(e,zn(n,qr(s,o)));return c<u?-1:u<c?1:a.descriptor.index-s.descriptor.index})[0]||null,jt=pe(function(t,n){const r=n[t.line];return{value:r,point:gt(t.line,r)}});const pl=(e,t,n)=>{const r=e.axis;if(e.descriptor.mode==="virtual")return gt(r.line,t[r.line]);const o=e.subject.page.contentBox[r.size],c=bt(e.descriptor.id,n).reduce((u,f)=>u+f.client.marginBox[r.size],0)+t[r.line]-o;return c<=0?null:gt(r.line,c)},Go=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),Wo=(e,t,n)=>{const r=e.frame;St(t,e)&&(process.env.NODE_ENV!=="production"?h(!1,"Should not add placeholder space to home list"):h()),e.subject.withPlaceholder&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot add placeholder size to a subject when it already has one"):h());const o=jt(e.axis,t.displaceBy).point,i=pl(e,o,n),a={placeholderSize:o,increasedBy:i,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!r){const f=Et({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:e.frame});return{...e,subject:f}}const s=i?he(r.scroll.max,i):r.scroll.max,c=Go(r,s),u=Et({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:c});return{...e,subject:u,frame:c}},fl=e=>{const t=e.subject.withPlaceholder;t||(process.env.NODE_ENV!=="production"?h(!1,"Cannot remove placeholder form subject when there was none"):h());const n=e.frame;if(!n){const a=Et({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:a}}const r=t.oldFrameMaxScroll;r||(process.env.NODE_ENV!=="production"?h(!1,"Expected droppable with frame to have old max frame scroll when removing placeholder"):h());const o=Go(n,r),i=Et({page:e.subject.page,axis:e.axis,frame:o,withPlaceholder:null});return{...e,subject:i,frame:o}};var ml=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:n,draggable:r,draggables:o,destination:i,viewport:a,afterCritical:s})=>{if(!t){if(n.length)return null;const d={displaced:Lt,displacedBy:$o,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:0}}},p=En({impact:d,draggable:r,droppable:i,draggables:o,afterCritical:s}),m=St(r,i)?i:Wo(i,r,o);return Mo({draggable:r,destination:m,newPageBorderBoxCenter:p,viewport:a.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?d:null}const c=e[i.axis.line]<=t.page.borderBox.center[i.axis.line],u=(()=>{const d=t.descriptor.index;return t.descriptor.id===r.descriptor.id||c?d:d+1})(),f=jt(i.axis,r.displaceBy);return pn({draggable:r,insideDestination:n,destination:i,viewport:a,displacedBy:f,last:Lt,index:u})},hl=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:n,isOver:r,draggables:o,droppables:i,viewport:a,afterCritical:s})=>{const c=cl({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:i,viewport:a});if(!c)return null;const u=bt(c.descriptor.id,o),f=ul({pageBorderBoxCenter:t,viewport:a,destination:c,insideDestination:u,afterCritical:s}),d=ml({previousPageBorderBoxCenter:t,destination:c,draggable:n,draggables:o,moveRelativeTo:f,insideDestination:u,viewport:a,afterCritical:s});if(!d)return null;const p=En({impact:d,draggable:n,droppable:c,draggables:o,afterCritical:s});return{clientSelection:cr({pageBorderBoxCenter:p,draggable:n,viewport:a}),impact:d,scrollJumpRequest:null}},Te=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const gl=(e,t)=>{const n=Te(e);return n?t[n]:null};var bl=({state:e,type:t})=>{const n=gl(e.impact,e.dimensions.droppables),r=!!n,o=e.dimensions.droppables[e.critical.droppable.id],i=n||o,a=i.axis.direction,s=a==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||a==="horizontal"&&(t==="MOVE_LEFT"||t==="MOVE_RIGHT");if(s&&!r)return null;const c=t==="MOVE_DOWN"||t==="MOVE_RIGHT",u=e.dimensions.draggables[e.critical.draggable.id],f=e.current.page.borderBoxCenter,{draggables:d,droppables:p}=e.dimensions;return s?ll({isMovingForward:c,previousPageBorderBoxCenter:f,draggable:u,destination:i,draggables:d,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):hl({isMovingForward:c,previousPageBorderBoxCenter:f,draggable:u,isOver:i,draggables:d,droppables:p,viewport:e.viewport,afterCritical:e.afterCritical})};function ft(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function zo(e){const t=Le(e.top,e.bottom),n=Le(e.left,e.right);return function(o){return t(o.y)&&n(o.x)}}function vl(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function yl({pageBorderBox:e,draggable:t,candidates:n}){const r=t.page.borderBox.center,o=n.map(i=>{const a=i.axis,s=gt(i.axis.line,e.center[a.line],i.page.borderBox.center[a.crossAxisLine]);return{id:i.descriptor.id,distance:Ft(r,s)}}).sort((i,a)=>a.distance-i.distance);return o[0]?o[0].id:null}function xl({pageBorderBox:e,draggable:t,droppables:n}){const r=yn(n).filter(o=>{if(!o.isEnabled)return!1;const i=o.subject.active;if(!i||!vl(e,i))return!1;if(zo(i)(e.center))return!0;const a=o.axis,s=i.center[a.crossAxisLine],c=e[a.crossAxisStart],u=e[a.crossAxisEnd],f=Le(i[a.crossAxisStart],i[a.crossAxisEnd]),d=f(c),p=f(u);return!d&&!p?!0:d?c<s:u>s});return r.length?r.length===1?r[0].descriptor.id:yl({pageBorderBox:e,draggable:t,candidates:r}):null}const Ho=(e,t)=>Me(Ut(e,t));var Dl=(e,t)=>{const n=e.frame;return n?Ho(t,n.scroll.diff.value):t};function Uo({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function El({draggable:e,closest:t,inHomeList:n}){return t?n&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var wl=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:n,insideDestination:r,last:o,viewport:i,afterCritical:a})=>{const s=n.axis,c=jt(n.axis,t.displaceBy),u=c.value,f=e[s.start],d=e[s.end],m=Dn(t,r).find(v=>{const y=v.descriptor.id,w=v.page.borderBox.center[s.line],O=Qe(y,a),U=Uo({displaced:o,id:y});return O?U?d<=w:f<w-u:U?d<=w+u:f<w})||null,b=El({draggable:t,closest:m,inHomeList:St(t,n)});return pn({draggable:t,insideDestination:r,destination:n,viewport:i,last:o,displacedBy:c,index:b})};const Cl=4;var Il=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:n,destination:r,insideDestination:o,afterCritical:i})=>{if(!r.isCombineEnabled)return null;const a=r.axis,s=jt(r.axis,e.displaceBy),c=s.value,u=t[a.start],f=t[a.end],p=Dn(e,o).find(b=>{const v=b.descriptor.id,y=b.page.borderBox,O=y[a.size]/Cl,U=Qe(v,i),T=Uo({displaced:n.displaced,id:v});return U?T?f>y[a.start]+O&&f<y[a.end]-O:u>y[a.start]-c+O&&u<y[a.end]-c-O:T?f>y[a.start]+c+O&&f<y[a.end]+c-O:u>y[a.start]+O&&u<y[a.end]-O});return p?{displacedBy:s,displaced:n.displaced,at:{type:"COMBINE",combine:{draggableId:p.descriptor.id,droppableId:r.descriptor.id}}}:null},jo=({pageOffset:e,draggable:t,draggables:n,droppables:r,previousImpact:o,viewport:i,afterCritical:a})=>{const s=Ho(t.page.borderBox,e),c=xl({pageBorderBox:s,draggable:t,droppables:r});if(!c)return Vs;const u=r[c],f=bt(u.descriptor.id,n),d=Dl(u,s);return Il({pageBorderBoxWithDroppableScroll:d,draggable:t,previousImpact:o,destination:u,insideDestination:f,afterCritical:a})||wl({pageBorderBoxWithDroppableScroll:d,draggable:t,destination:u,insideDestination:f,last:o.displaced,viewport:i,afterCritical:a})},dr=(e,t)=>({...e,[t.descriptor.id]:t});const Nl=({previousImpact:e,impact:t,droppables:n})=>{const r=Te(e),o=Te(t);if(!r||r===o)return n;const i=n[r];if(!i.subject.withPlaceholder)return n;const a=fl(i);return dr(n,a)};var Sl=({draggable:e,draggables:t,droppables:n,previousImpact:r,impact:o})=>{const i=Nl({previousImpact:r,impact:o,droppables:n}),a=Te(o);if(!a)return i;const s=n[a];if(St(e,s)||s.subject.withPlaceholder)return i;const c=Wo(s,e,t);return dr(i,c)},Bt=({state:e,clientSelection:t,dimensions:n,viewport:r,impact:o,scrollJumpRequest:i})=>{const a=r||e.viewport,s=n||e.dimensions,c=t||e.current.client.selection,u=Pe(c,e.initial.client.selection),f={offset:u,selection:c,borderBoxCenter:he(e.initial.client.borderBoxCenter,u)},d={selection:he(f.selection,a.scroll.current),borderBoxCenter:he(f.borderBoxCenter,a.scroll.current),offset:he(f.offset,a.scroll.diff.value)},p={client:f,page:d};if(e.phase==="COLLECTING")return{...e,dimensions:s,viewport:a,current:p};const m=s.draggables[e.critical.draggable.id],b=o||jo({pageOffset:d.offset,draggable:m,draggables:s.draggables,droppables:s.droppables,previousImpact:e.impact,viewport:a,afterCritical:e.afterCritical}),v=Sl({draggable:m,impact:b,previousImpact:e.impact,draggables:s.draggables,droppables:s.droppables});return{...e,current:p,dimensions:{draggables:s.draggables,droppables:v},impact:b,viewport:a,scrollJumpRequest:i||null,forceShouldAnimate:i?!1:null}};function Ol(e,t){return e.map(n=>t[n])}var qo=({impact:e,viewport:t,draggables:n,destination:r,forceShouldAnimate:o})=>{const i=e.displaced,a=Ol(i.all,n),s=Vt({afterDragging:a,destination:r,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:o,last:i});return{...e,displaced:s}},Yo=({impact:e,draggable:t,droppable:n,draggables:r,viewport:o,afterCritical:i})=>{const a=En({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:i});return cr({pageBorderBoxCenter:a,draggable:t,viewport:o})},Ko=({state:e,dimensions:t,viewport:n})=>{e.movementMode!=="SNAP"&&(process.env.NODE_ENV,h());const r=e.impact,o=n||e.viewport,i=t||e.dimensions,{draggables:a,droppables:s}=i,c=a[e.critical.draggable.id],u=Te(r);u||(process.env.NODE_ENV!=="production"?h(!1,"Must be over a destination in SNAP movement mode"):h());const f=s[u],d=qo({impact:r,viewport:o,destination:f,draggables:a}),p=Yo({impact:d,draggable:c,droppable:f,draggables:a,viewport:o,afterCritical:e.afterCritical});return Bt({impact:d,clientSelection:p,state:e,dimensions:i,viewport:o})},Al=e=>({index:e.index,droppableId:e.droppableId}),Xo=({draggable:e,home:t,draggables:n,viewport:r})=>{const o=jt(t.axis,e.displaceBy),i=bt(t.descriptor.id,n),a=i.indexOf(e);a===-1&&(process.env.NODE_ENV!=="production"?h(!1,"Expected draggable to be inside home list"):h());const s=i.slice(a+1),c=s.reduce((p,m)=>(p[m.descriptor.id]=!0,p),{}),u={inVirtualList:t.descriptor.mode==="virtual",displacedBy:o,effected:c};return{impact:{displaced:Vt({afterDragging:s,destination:t,displacedBy:o,last:null,viewport:r.frame,forceShouldAnimate:!1}),displacedBy:o,at:{type:"REORDER",destination:Al(e.descriptor)}},afterCritical:u}},Pl=(e,t)=>({draggables:e.draggables,droppables:dr(e.droppables,t)});const qt=e=>{process.env.NODE_ENV},Yt=e=>{process.env.NODE_ENV};var Rl=({draggable:e,offset:t,initialWindowScroll:n})=>{const r=cn(e.client,t),o=dn(r,n);return{...e,placeholder:{...e.placeholder,client:r},client:r,page:o}},Tl=e=>{const t=e.frame;return t||(process.env.NODE_ENV!=="production"?h(!1,"Expected Droppable to have a frame"):h()),t},Bl=({additions:e,updatedDroppables:t,viewport:n})=>{const r=n.scroll.diff.value;return e.map(o=>{const i=o.descriptor.droppableId,a=t[i],c=Tl(a).scroll.diff.value,u=he(r,c);return Rl({draggable:o,offset:u,initialWindowScroll:n.scroll.initial})})},$l=({state:e,published:t})=>{qt();const n=t.modified.map(w=>{const O=e.dimensions.droppables[w.droppableId];return or(O,w.scroll)}),r={...e.dimensions.droppables,...To(n)},o=Bo(Bl({additions:t.additions,updatedDroppables:r,viewport:e.viewport})),i={...e.dimensions.draggables,...o};t.removals.forEach(w=>{delete i[w]});const a={droppables:r,draggables:i},s=Te(e.impact),c=s?a.droppables[s]:null,u=a.draggables[e.critical.draggable.id],f=a.droppables[e.critical.droppable.id],{impact:d,afterCritical:p}=Xo({draggable:u,home:f,draggables:i,viewport:e.viewport}),m=c&&c.isCombineEnabled?e.impact:d,b=jo({pageOffset:e.current.page.offset,draggable:a.draggables[e.critical.draggable.id],draggables:a.draggables,droppables:a.droppables,previousImpact:m,viewport:e.viewport,afterCritical:p});Yt();const v={...e,phase:"DRAGGING",impact:b,onLiftImpact:d,dimensions:a,afterCritical:p,forceShouldAnimate:!1};return e.phase==="COLLECTING"?v:{...v,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const Hn=e=>e.movementMode==="SNAP",Pn=(e,t,n)=>{const r=Pl(e.dimensions,t);return!Hn(e)||n?Bt({state:e,dimensions:r}):Ko({state:e,dimensions:r})};function Rn(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const Yr={phase:"IDLE",completed:null,shouldFlush:!1};var _l=(e=Yr,t)=>{if(t.type==="FLUSH")return{...Yr,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&(process.env.NODE_ENV!=="production"?h(!1,"INITIAL_PUBLISH must come after a IDLE phase"):h());const{critical:n,clientSelection:r,viewport:o,dimensions:i,movementMode:a}=t.payload,s=i.draggables[n.draggable.id],c=i.droppables[n.droppable.id],u={selection:r,borderBoxCenter:s.client.borderBox.center,offset:fe},f={client:u,page:{selection:he(u.selection,o.scroll.initial),borderBoxCenter:he(u.selection,o.scroll.initial),offset:he(u.selection,o.scroll.diff.value)}},d=yn(i.droppables).every(v=>!v.isFixedOnPage),{impact:p,afterCritical:m}=Xo({draggable:s,home:c,draggables:i.draggables,viewport:o});return{phase:"DRAGGING",isDragging:!0,critical:n,movementMode:a,dimensions:i,initial:f,current:f,isWindowScrollAllowed:d,impact:p,afterCritical:m,onLiftImpact:p,viewport:o,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&(process.env.NODE_ENV!=="production"?h(!1,`Collection cannot start from phase ${e.phase}`):h()),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||(process.env.NODE_ENV!=="production"?h(!1,`Unexpected ${t.type} received in phase ${e.phase}`):h()),$l({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;ft(e)||(process.env.NODE_ENV!=="production"?h(!1,`${t.type} not permitted in phase ${e.phase}`):h());const{client:n}=t.payload;return Ze(n,e.current.client.selection)?e:Bt({state:e,clientSelection:n,impact:Hn(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return Rn(e);ft(e)||(process.env.NODE_ENV!=="production"?h(!1,`${t.type} not permitted in phase ${e.phase}`):h());const{id:n,newScroll:r}=t.payload,o=e.dimensions.droppables[n];if(!o)return e;const i=or(o,r);return Pn(e,i,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;ft(e)||(process.env.NODE_ENV!=="production"?h(!1,`Attempting to move in an unsupported phase ${e.phase}`):h());const{id:n,isEnabled:r}=t.payload,o=e.dimensions.droppables[n];o||(process.env.NODE_ENV!=="production"?h(!1,`Cannot find Droppable[id: ${n}] to toggle its enabled state`):h()),o.isEnabled===r&&(process.env.NODE_ENV!=="production"?h(!1,`Trying to set droppable isEnabled to ${String(r)}
|
|
47
47
|
but it is already ${String(o.isEnabled)}`):h());const i={...o,isEnabled:r};return Pn(e,i,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;ft(e)||(process.env.NODE_ENV!=="production"?h(!1,`Attempting to move in an unsupported phase ${e.phase}`):h());const{id:n,isCombineEnabled:r}=t.payload,o=e.dimensions.droppables[n];o||(process.env.NODE_ENV!=="production"?h(!1,`Cannot find Droppable[id: ${n}] to toggle its isCombineEnabled state`):h()),o.isCombineEnabled===r&&(process.env.NODE_ENV!=="production"?h(!1,`Trying to set droppable isCombineEnabled to ${String(r)}
|
|
48
|
-
but it is already ${String(o.isCombineEnabled)}`):h());const i={...o,isCombineEnabled:r};return Pn(e,i,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;ft(e)||(process.env.NODE_ENV!=="production"?h(!1,`Cannot move by window in phase ${e.phase}`):h()),e.isWindowScrollAllowed||(process.env.NODE_ENV!=="production"?h(!1,"Window scrolling is currently not supported for fixed lists"):h());const n=t.payload.newScroll;if(
|
|
48
|
+
but it is already ${String(o.isCombineEnabled)}`):h());const i={...o,isCombineEnabled:r};return Pn(e,i,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;ft(e)||(process.env.NODE_ENV!=="production"?h(!1,`Cannot move by window in phase ${e.phase}`):h()),e.isWindowScrollAllowed||(process.env.NODE_ENV!=="production"?h(!1,"Window scrolling is currently not supported for fixed lists"):h());const n=t.payload.newScroll;if(Ze(e.viewport.scroll.current,n))return Rn(e);const r=Vo(e.viewport,n);return Hn(e)?Ko({state:e,viewport:r}):Bt({state:e,viewport:r})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!ft(e))return e;const n=t.payload.maxScroll;if(Ze(n,e.viewport.scroll.max))return e;const r={...e.viewport,scroll:{...e.viewport.scroll,max:n}};return{...e,viewport:r}}if(t.type==="MOVE_UP"||t.type==="MOVE_DOWN"||t.type==="MOVE_LEFT"||t.type==="MOVE_RIGHT"){if(e.phase==="COLLECTING"||e.phase==="DROP_PENDING")return e;e.phase!=="DRAGGING"&&(process.env.NODE_ENV!=="production"?h(!1,`${t.type} received while not in DRAGGING phase`):h());const n=bl({state:e,type:t.type});return n?Bt({state:e,impact:n.impact,clientSelection:n.clientSelection,scrollJumpRequest:n.scrollJumpRequest}):e}if(t.type==="DROP_PENDING"){const n=t.payload.reason;return e.phase!=="COLLECTING"&&(process.env.NODE_ENV!=="production"?h(!1,"Can only move into the DROP_PENDING phase from the COLLECTING phase"):h()),{...e,phase:"DROP_PENDING",isWaiting:!0,reason:n}}if(t.type==="DROP_ANIMATE"){const{completed:n,dropDuration:r,newHomeClientOffset:o}=t.payload;return e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||(process.env.NODE_ENV!=="production"?h(!1,`Cannot animate drop from phase ${e.phase}`):h()),{phase:"DROP_ANIMATING",completed:n,dropDuration:r,newHomeClientOffset:o,dimensions:e.dimensions}}if(t.type==="DROP_COMPLETE"){const{completed:n}=t.payload;return{phase:"IDLE",completed:n,shouldFlush:!1}}return e};function Y(e,t){return e instanceof Object&&"type"in e&&e.type===t}const kl=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),Fl=e=>({type:"LIFT",payload:e}),Ll=e=>({type:"INITIAL_PUBLISH",payload:e}),Vl=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),Ml=()=>({type:"COLLECTION_STARTING",payload:null}),Gl=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),Wl=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),zl=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),Jo=e=>({type:"MOVE",payload:e}),Hl=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),Ul=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),jl=()=>({type:"MOVE_UP",payload:null}),ql=()=>({type:"MOVE_DOWN",payload:null}),Yl=()=>({type:"MOVE_RIGHT",payload:null}),Kl=()=>({type:"MOVE_LEFT",payload:null}),ur=()=>({type:"FLUSH",payload:null}),Xl=e=>({type:"DROP_ANIMATE",payload:e}),pr=e=>({type:"DROP_COMPLETE",payload:e}),Zo=e=>({type:"DROP",payload:e}),Jl=e=>({type:"DROP_PENDING",payload:e}),Qo=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});function Zl(e){if(e.length<=1)return;const t=e.map(o=>o.descriptor.index),n={};for(let o=1;o<t.length;o++){const i=t[o],a=t[o-1];i!==a+1&&(n[i]=!0)}if(!Object.keys(n).length)return;const r=t.map(o=>!!n[o]?`[🔥${o}]`:`${o}`).join(", ");process.env.NODE_ENV!=="production"&&Z(`
|
|
49
49
|
Detected non-consecutive <Draggable /> indexes.
|
|
50
50
|
|
|
51
51
|
(This can cause unexpected bugs)
|
|
52
52
|
|
|
53
53
|
${r}
|
|
54
|
-
`)}function Ql(e,t){if(process.env.NODE_ENV!=="production"){const n=bt(e.droppable.id,t.draggables);Zl(n)}}var ec=e=>({getState:t,dispatch:n})=>r=>o=>{if(!
|
|
54
|
+
`)}function Ql(e,t){if(process.env.NODE_ENV!=="production"){const n=bt(e.droppable.id,t.draggables);Zl(n)}}var ec=e=>({getState:t,dispatch:n})=>r=>o=>{if(!Y(o,"LIFT")){r(o);return}const{id:i,clientSelection:a,movementMode:s}=o.payload,c=t();c.phase==="DROP_ANIMATING"&&n(pr({completed:c.completed})),t().phase!=="IDLE"&&(process.env.NODE_ENV!=="production"?h(!1,"Unexpected phase to start a drag"):h()),n(ur()),n(kl({draggableId:i,movementMode:s}));const f={draggableId:i,scrollOptions:{shouldPublishImmediately:s==="SNAP"}},{critical:d,dimensions:p,viewport:m}=e.startPublishing(f);Ql(d,p),n(Ll({critical:d,dimensions:p,clientSelection:a,movementMode:s,viewport:m}))},tc=e=>()=>t=>n=>{Y(n,"INITIAL_PUBLISH")&&e.dragging(),Y(n,"DROP_ANIMATE")&&e.dropping(n.payload.completed.result.reason),(Y(n,"FLUSH")||Y(n,"DROP_COMPLETE"))&&e.resting(),t(n)};const fr={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},Mt={opacity:{drop:0,combining:.7},scale:{drop:.75}},ei={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},pt=`${ei.outOfTheWay}s ${fr.outOfTheWay}`,$t={fluid:`opacity ${pt}`,snap:`transform ${pt}, opacity ${pt}`,drop:e=>{const t=`${e}s ${fr.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${pt}`,placeholder:`height ${pt}, width ${pt}, margin ${pt}`},Kr=e=>Ze(e,fe)?void 0:`translate(${e.x}px, ${e.y}px)`,Un={moveTo:Kr,drop:(e,t)=>{const n=Kr(e);if(n)return t?`${n} scale(${Mt.scale.drop})`:n}},{minDropTime:jn,maxDropTime:ti}=ei,nc=ti-jn,Xr=1500,rc=.6;var oc=({current:e,destination:t,reason:n})=>{const r=Ft(e,t);if(r<=0)return jn;if(r>=Xr)return ti;const o=r/Xr,i=jn+nc*o,a=n==="CANCEL"?i*rc:i;return Number(a.toFixed(2))},ic=({impact:e,draggable:t,dimensions:n,viewport:r,afterCritical:o})=>{const{draggables:i,droppables:a}=n,s=Te(e),c=s?a[s]:null,u=a[t.descriptor.droppableId],f=Yo({impact:e,draggable:t,draggables:i,afterCritical:o,droppable:c||u,viewport:r});return Pe(f,t.client.borderBox.center)},ac=({draggables:e,reason:t,lastImpact:n,home:r,viewport:o,onLiftImpact:i})=>!n.at||t!=="DROP"?{impact:qo({draggables:e,impact:i,destination:r,viewport:o,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:n.at.type==="REORDER"?{impact:n,didDropInsideDroppable:!0}:{impact:{...n,displaced:Lt},didDropInsideDroppable:!0};const sc=({getState:e,dispatch:t})=>n=>r=>{if(!Y(r,"DROP")){n(r);return}const o=e(),i=r.payload.reason;if(o.phase==="COLLECTING"){t(Jl({reason:i}));return}if(o.phase==="IDLE")return;o.phase==="DROP_PENDING"&&o.isWaiting&&(process.env.NODE_ENV!=="production"?h(!1,"A DROP action occurred while DROP_PENDING and still waiting"):h()),o.phase==="DRAGGING"||o.phase==="DROP_PENDING"||(process.env.NODE_ENV!=="production"?h(!1,`Cannot drop in phase: ${o.phase}`):h());const s=o.critical,c=o.dimensions,u=c.draggables[o.critical.draggable.id],{impact:f,didDropInsideDroppable:d}=ac({reason:i,lastImpact:o.impact,afterCritical:o.afterCritical,onLiftImpact:o.onLiftImpact,home:o.dimensions.droppables[o.critical.droppable.id],viewport:o.viewport,draggables:o.dimensions.draggables}),p=d?ir(f):null,m=d?xn(f):null,b={index:s.draggable.index,droppableId:s.droppable.id},v={draggableId:u.descriptor.id,type:u.descriptor.type,source:b,reason:i,mode:o.movementMode,destination:p,combine:m},y=ic({impact:f,draggable:u,dimensions:c,viewport:o.viewport,afterCritical:o.afterCritical}),w={critical:o.critical,afterCritical:o.afterCritical,result:v,impact:f};if(!(!Ze(o.current.client.offset,y)||!!v.combine)){t(pr({completed:w}));return}const U=oc({current:o.current.client.offset,destination:y,reason:i});t(Xl({newHomeClientOffset:y,dropDuration:U,completed:w}))};var ni=()=>({x:window.pageXOffset,y:window.pageYOffset});function lc(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function cc({onWindowScroll:e}){function t(){e(ni())}const n=_t(t),r=lc(n);let o=Je;function i(){return o!==Je}function a(){i()&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot start scroll listener when already active"):h()),o=ke(window,[r])}function s(){i()||(process.env.NODE_ENV!=="production"?h(!1,"Cannot stop scroll listener when not active"):h()),n.cancel(),o(),o=Je}return{start:a,stop:s,isActive:i}}const dc=e=>Y(e,"DROP_COMPLETE")||Y(e,"DROP_ANIMATE")||Y(e,"FLUSH"),uc=e=>{const t=cc({onWindowScroll:n=>{e.dispatch(Hl({newScroll:n}))}});return n=>r=>{!t.isActive()&&Y(r,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&dc(r)&&t.stop(),n(r)}};var pc=e=>{let t=!1,n=!1;const r=setTimeout(()=>{n=!0}),o=i=>{if(t){process.env.NODE_ENV!=="production"&&Z("Announcement already made. Not making a second announcement");return}if(n){process.env.NODE_ENV!=="production"&&Z(`
|
|
55
55
|
Announcements cannot be made asynchronously.
|
|
56
56
|
Default message has already been announced.
|
|
57
|
-
`);return}t=!0,e(i),clearTimeout(r)};return o.wasCalled=()=>t,o},fc=()=>{const e=[],t=o=>{const i=e.findIndex(s=>s.timerId===o);i===-1&&(process.env.NODE_ENV!=="production"?h(!1,"Could not find timer"):h());const[a]=e.splice(i,1);a.callback()};return{add:o=>{const i=setTimeout(()=>t(i)),a={timerId:i,callback:o};e.push(a)},flush:()=>{if(!e.length)return;const o=[...e];e.length=0,o.forEach(i=>{clearTimeout(i.timerId),i.callback()})}}};const mc=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,hc=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,gc=(e,t)=>{if(e===t)return!0;const n=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,r=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return n&&r},
|
|
57
|
+
`);return}t=!0,e(i),clearTimeout(r)};return o.wasCalled=()=>t,o},fc=()=>{const e=[],t=o=>{const i=e.findIndex(s=>s.timerId===o);i===-1&&(process.env.NODE_ENV!=="production"?h(!1,"Could not find timer"):h());const[a]=e.splice(i,1);a.callback()};return{add:o=>{const i=setTimeout(()=>t(i)),a={timerId:i,callback:o};e.push(a)},flush:()=>{if(!e.length)return;const o=[...e];e.length=0,o.forEach(i=>{clearTimeout(i.timerId),i.callback()})}}};const mc=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,hc=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,gc=(e,t)=>{if(e===t)return!0;const n=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,r=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return n&&r},At=(e,t)=>{qt(),t(),Yt()},rn=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function Tn(e,t,n,r){if(!e){n(r(t));return}const o=pc(n);e(t,{announce:o}),o.wasCalled()||n(r(t))}var bc=(e,t)=>{const n=fc();let r=null;const o=(d,p)=>{r&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot fire onBeforeCapture as a drag start has already been published"):h()),At("onBeforeCapture",()=>{const m=e().onBeforeCapture;m&&m({draggableId:d,mode:p})})},i=(d,p)=>{r&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot fire onBeforeDragStart as a drag start has already been published"):h()),At("onBeforeDragStart",()=>{const m=e().onBeforeDragStart;m&&m(rn(d,p))})},a=(d,p)=>{r&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot fire onBeforeDragStart as a drag start has already been published"):h());const m=rn(d,p);r={mode:p,lastCritical:d,lastLocation:m.source,lastCombine:null},n.add(()=>{At("onDragStart",()=>Tn(e().onDragStart,m,t,sn.onDragStart))})},s=(d,p)=>{const m=ir(p),b=xn(p);r||(process.env.NODE_ENV!=="production"?h(!1,"Cannot fire onDragMove when onDragStart has not been called"):h());const v=!gc(d,r.lastCritical);v&&(r.lastCritical=d);const y=!mc(r.lastLocation,m);y&&(r.lastLocation=m);const w=!hc(r.lastCombine,b);if(w&&(r.lastCombine=b),!v&&!y&&!w)return;const O={...rn(d,r.mode),combine:b,destination:m};n.add(()=>{At("onDragUpdate",()=>Tn(e().onDragUpdate,O,t,sn.onDragUpdate))})},c=()=>{r||(process.env.NODE_ENV!=="production"?h(!1,"Can only flush responders while dragging"):h()),n.flush()},u=d=>{r||(process.env.NODE_ENV!=="production"?h(!1,"Cannot fire onDragEnd when there is no matching onDragStart"):h()),r=null,At("onDragEnd",()=>Tn(e().onDragEnd,d,t,sn.onDragEnd))};return{beforeCapture:o,beforeStart:i,start:a,update:s,flush:c,drop:u,abort:()=>{if(!r)return;const d={...rn(r.lastCritical,r.mode),combine:null,destination:null,reason:"CANCEL"};u(d)}}},vc=(e,t)=>{const n=bc(e,t);return r=>o=>i=>{if(Y(i,"BEFORE_INITIAL_CAPTURE")){n.beforeCapture(i.payload.draggableId,i.payload.movementMode);return}if(Y(i,"INITIAL_PUBLISH")){const s=i.payload.critical;n.beforeStart(s,i.payload.movementMode),o(i),n.start(s,i.payload.movementMode);return}if(Y(i,"DROP_COMPLETE")){const s=i.payload.completed.result;n.flush(),o(i),n.drop(s);return}if(o(i),Y(i,"FLUSH")){n.abort();return}const a=r.getState();a.phase==="DRAGGING"&&n.update(a.critical,a.impact)}};const yc=e=>t=>n=>{if(!Y(n,"DROP_ANIMATION_FINISHED")){t(n);return}const r=e.getState();r.phase!=="DROP_ANIMATING"&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot finish a drop animating when no drop is occurring"):h()),e.dispatch(pr({completed:r.completed}))},xc=e=>{let t=null,n=null;function r(){n&&(cancelAnimationFrame(n),n=null),t&&(t(),t=null)}return o=>i=>{if((Y(i,"FLUSH")||Y(i,"DROP_COMPLETE")||Y(i,"DROP_ANIMATION_FINISHED"))&&r(),o(i),!Y(i,"DROP_ANIMATE"))return;const a={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(Qo())}};n=requestAnimationFrame(()=>{n=null,t=ke(window,[a])})}};var Dc=e=>()=>t=>n=>{(Y(n,"DROP_COMPLETE")||Y(n,"FLUSH")||Y(n,"DROP_ANIMATE"))&&e.stopPublishing(),t(n)},Ec=e=>{let t=!1;return()=>n=>r=>{if(Y(r,"INITIAL_PUBLISH")){t=!0,e.tryRecordFocus(r.payload.critical.draggable.id),n(r),e.tryRestoreFocusRecorded();return}if(n(r),!!t){if(Y(r,"FLUSH")){t=!1,e.tryRestoreFocusRecorded();return}if(Y(r,"DROP_COMPLETE")){t=!1;const o=r.payload.completed.result;o.combine&&e.tryShiftRecord(o.draggableId,o.combine.draggableId),e.tryRestoreFocusRecorded()}}}};const wc=e=>Y(e,"DROP_COMPLETE")||Y(e,"DROP_ANIMATE")||Y(e,"FLUSH");var Cc=e=>t=>n=>r=>{if(wc(r)){e.stop(),n(r);return}if(Y(r,"INITIAL_PUBLISH")){n(r);const o=t.getState();o.phase!=="DRAGGING"&&(process.env.NODE_ENV!=="production"?h(!1,"Expected phase to be DRAGGING after INITIAL_PUBLISH"):h()),e.start(o);return}n(r),e.scroll(t.getState())};const Ic=e=>t=>n=>{if(t(n),!Y(n,"PUBLISH_WHILE_DRAGGING"))return;const r=e.getState();r.phase==="DROP_PENDING"&&(r.isWaiting||e.dispatch(Zo({reason:r.reason})))},Nc=process.env.NODE_ENV!=="production"&&typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({name:"@hello-pangea/dnd"}):ia;var Sc=({dimensionMarshal:e,focusMarshal:t,styleMarshal:n,getResponders:r,announce:o,autoScroller:i})=>oa(_l,Nc(aa(tc(n),Dc(e),ec(e),sc,yc,xc,Ic,Cc(i),uc,Ec(t),vc(r,o))));const Bn=()=>({additions:{},removals:{},modified:{}});function Oc({registry:e,callbacks:t}){let n=Bn(),r=null;const o=()=>{r||(t.collectionStarting(),r=requestAnimationFrame(()=>{r=null,qt();const{additions:c,removals:u,modified:f}=n,d=Object.keys(c).map(b=>e.draggable.getById(b).getDimension(fe)).sort((b,v)=>b.descriptor.index-v.descriptor.index),p=Object.keys(f).map(b=>{const y=e.droppable.getById(b).callbacks.getScrollWhileDragging();return{droppableId:b,scroll:y}}),m={additions:d,removals:Object.keys(u),modified:p};n=Bn(),Yt(),t.publish(m)}))};return{add:c=>{const u=c.descriptor.id;n.additions[u]=c,n.modified[c.descriptor.droppableId]=!0,n.removals[u]&&delete n.removals[u],o()},remove:c=>{const u=c.descriptor;n.removals[u.id]=!0,n.modified[u.droppableId]=!0,n.additions[u.id]&&delete n.additions[u.id],o()},stop:()=>{r&&(cancelAnimationFrame(r),r=null,n=Bn())}}}var ri=({scrollHeight:e,scrollWidth:t,height:n,width:r})=>{const o=Pe({x:t,y:e},{x:r,y:n});return{x:Math.max(0,o.x),y:Math.max(0,o.y)}},oi=()=>{const e=document.documentElement;return e||(process.env.NODE_ENV!=="production"?h(!1,"Cannot find document.documentElement"):h()),e},ii=()=>{const e=oi();return ri({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},Ac=()=>{const e=ni(),t=ii(),n=e.y,r=e.x,o=oi(),i=o.clientWidth,a=o.clientHeight,s=r+i,c=n+a;return{frame:Me({top:n,left:r,right:s,bottom:c}),scroll:{initial:e,current:e,max:t,diff:{value:fe,displacement:fe}}}},Pc=({critical:e,scrollOptions:t,registry:n})=>{qt();const r=Ac(),o=r.scroll.current,i=e.droppable,a=n.droppable.getAllByType(i.type).map(f=>f.callbacks.getDimensionAndWatchScroll(o,t)),s=n.draggable.getAllByType(e.draggable.type).map(f=>f.getDimension(o)),c={draggables:Bo(s),droppables:To(a)};return Yt(),{dimensions:c,critical:e,viewport:r}};function Jr(e,t,n){return n.descriptor.id===t.id||n.descriptor.type!==t.type?!1:e.droppable.getById(n.descriptor.droppableId).descriptor.mode!=="virtual"?(process.env.NODE_ENV!=="production"&&Z(`
|
|
58
58
|
You are attempting to add or remove a Draggable [id: ${n.descriptor.id}]
|
|
59
59
|
while a drag is occurring. This is only supported for virtual lists.
|
|
60
60
|
|
|
61
61
|
See https://github.com/hello-pangea/dnd/blob/main/docs/patterns/virtual-lists.md
|
|
62
|
-
`),!1):!0}var Rc=(e,t)=>{let n=null;const r=Oc({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),o=(p,m)=>{e.droppable.exists(p)||(process.env.NODE_ENV!=="production"?h(!1,`Cannot update is enabled flag of Droppable ${p} as it is not registered`):h()),n&&t.updateDroppableIsEnabled({id:p,isEnabled:m})},i=(p,m)=>{n&&(e.droppable.exists(p)||(process.env.NODE_ENV!=="production"?h(!1,`Cannot update isCombineEnabled flag of Droppable ${p} as it is not registered`):h()),t.updateDroppableIsCombineEnabled({id:p,isCombineEnabled:m}))},a=(p,m)=>{n&&(e.droppable.exists(p)||(process.env.NODE_ENV!=="production"?h(!1,`Cannot update the scroll on Droppable ${p} as it is not registered`):h()),t.updateDroppableScroll({id:p,newScroll:m}))},s=(p,m)=>{n&&e.droppable.getById(p).callbacks.scroll(m)},c=()=>{if(!n)return;r.stop();const p=n.critical.droppable;e.droppable.getAllByType(p.type).forEach(m=>m.callbacks.dragStopped()),n.unsubscribe(),n=null},u=p=>{n||(process.env.NODE_ENV!=="production"?h(!1,"Should only be subscribed when a collection is occurring"):h());const m=n.critical.draggable;p.type==="ADDITION"&&Jr(e,m,p.value)&&r.add(p.value),p.type==="REMOVAL"&&Jr(e,m,p.value)&&r.remove(p.value)};return{updateDroppableIsEnabled:o,updateDroppableIsCombineEnabled:i,scrollDroppable:s,updateDroppableScroll:a,startPublishing:p=>{n&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot start capturing critical dimensions as there is already a collection"):h());const m=e.draggable.getById(p.draggableId),b=e.droppable.getById(m.descriptor.droppableId),v={draggable:m.descriptor,droppable:b.descriptor},y=e.subscribe(u);return n={critical:v,unsubscribe:y},Pc({critical:v,registry:e,scrollOptions:p.scrollOptions})},stopPublishing:c}},ai=(e,t)=>e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP",Tc=e=>{window.scrollBy(e.x,e.y)};const Bc=pe(e=>yn(e).filter(t=>!(!t.isEnabled||!t.frame))),$c=(e,t)=>Bc(t).find(r=>(r.frame||(process.env.NODE_ENV!=="production"?h(!1,"Invalid result"):h()),zo(r.frame.pageMarginBox)(e)))||null;var
|
|
62
|
+
`),!1):!0}var Rc=(e,t)=>{let n=null;const r=Oc({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),o=(p,m)=>{e.droppable.exists(p)||(process.env.NODE_ENV!=="production"?h(!1,`Cannot update is enabled flag of Droppable ${p} as it is not registered`):h()),n&&t.updateDroppableIsEnabled({id:p,isEnabled:m})},i=(p,m)=>{n&&(e.droppable.exists(p)||(process.env.NODE_ENV!=="production"?h(!1,`Cannot update isCombineEnabled flag of Droppable ${p} as it is not registered`):h()),t.updateDroppableIsCombineEnabled({id:p,isCombineEnabled:m}))},a=(p,m)=>{n&&(e.droppable.exists(p)||(process.env.NODE_ENV!=="production"?h(!1,`Cannot update the scroll on Droppable ${p} as it is not registered`):h()),t.updateDroppableScroll({id:p,newScroll:m}))},s=(p,m)=>{n&&e.droppable.getById(p).callbacks.scroll(m)},c=()=>{if(!n)return;r.stop();const p=n.critical.droppable;e.droppable.getAllByType(p.type).forEach(m=>m.callbacks.dragStopped()),n.unsubscribe(),n=null},u=p=>{n||(process.env.NODE_ENV!=="production"?h(!1,"Should only be subscribed when a collection is occurring"):h());const m=n.critical.draggable;p.type==="ADDITION"&&Jr(e,m,p.value)&&r.add(p.value),p.type==="REMOVAL"&&Jr(e,m,p.value)&&r.remove(p.value)};return{updateDroppableIsEnabled:o,updateDroppableIsCombineEnabled:i,scrollDroppable:s,updateDroppableScroll:a,startPublishing:p=>{n&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot start capturing critical dimensions as there is already a collection"):h());const m=e.draggable.getById(p.draggableId),b=e.droppable.getById(m.descriptor.droppableId),v={draggable:m.descriptor,droppable:b.descriptor},y=e.subscribe(u);return n={critical:v,unsubscribe:y},Pc({critical:v,registry:e,scrollOptions:p.scrollOptions})},stopPublishing:c}},ai=(e,t)=>e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP",Tc=e=>{window.scrollBy(e.x,e.y)};const Bc=pe(e=>yn(e).filter(t=>!(!t.isEnabled||!t.frame))),$c=(e,t)=>Bc(t).find(r=>(r.frame||(process.env.NODE_ENV!=="production"?h(!1,"Invalid result"):h()),zo(r.frame.pageMarginBox)(e)))||null;var _c=({center:e,destination:t,droppables:n})=>{if(t){const o=n[t];return o.frame?o:null}return $c(e,n)};const Gt={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>e**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var kc=(e,t,n=()=>Gt)=>{const r=n(),o=e[t.size]*r.startFromPercentage,i=e[t.size]*r.maxScrollAtPercentage;return{startScrollingFrom:o,maxScrollValueAt:i}},si=({startOfRange:e,endOfRange:t,current:n})=>{const r=t-e;return r===0?(process.env.NODE_ENV!=="production"&&Z(`
|
|
63
63
|
Detected distance range of 0 in the fluid auto scroller
|
|
64
64
|
This is unexpected and would cause a divide by 0 issue.
|
|
65
65
|
Not allowing an auto scroll
|
|
66
|
-
`),0):(n-e)/r},mr=1,Fc=(e,t,n=()=>
|
|
66
|
+
`),0):(n-e)/r},mr=1,Fc=(e,t,n=()=>Gt)=>{const r=n();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return r.maxPixelScroll;if(e===t.startScrollingFrom)return mr;const i=1-si({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),a=r.maxPixelScroll*r.ease(i);return Math.ceil(a)},Lc=(e,t,n)=>{const r=n(),o=r.durationDampening.accelerateAt,i=r.durationDampening.stopDampeningAt,a=t,s=i,u=Date.now()-a;if(u>=i)return e;if(u<o)return mr;const f=si({startOfRange:o,endOfRange:s,current:u}),d=e*r.ease(f);return Math.ceil(d)},Zr=({distanceToEdge:e,thresholds:t,dragStartTime:n,shouldUseTimeDampening:r,getAutoScrollerOptions:o})=>{const i=Fc(e,t,o);return i===0?0:r?Math.max(Lc(i,n,o),mr):i},Qr=({container:e,distanceToEdges:t,dragStartTime:n,axis:r,shouldUseTimeDampening:o,getAutoScrollerOptions:i})=>{const a=kc(e,r,i);return t[r.end]<t[r.start]?Zr({distanceToEdge:t[r.end],thresholds:a,dragStartTime:n,shouldUseTimeDampening:o,getAutoScrollerOptions:i}):-1*Zr({distanceToEdge:t[r.start],thresholds:a,dragStartTime:n,shouldUseTimeDampening:o,getAutoScrollerOptions:i})},Vc=({container:e,subject:t,proposedScroll:n})=>{const r=t.height>e.height,o=t.width>e.width;return!o&&!r?n:o&&r?null:{x:o?0:n.x,y:r?0:n.y}};const Mc=Ro(e=>e===0?0:e);var li=({dragStartTime:e,container:t,subject:n,center:r,shouldUseTimeDampening:o,getAutoScrollerOptions:i})=>{const a={top:r.y-t.top,right:t.right-r.x,bottom:t.bottom-r.y,left:r.x-t.left},s=Qr({container:t,distanceToEdges:a,dragStartTime:e,axis:ar,shouldUseTimeDampening:o,getAutoScrollerOptions:i}),c=Qr({container:t,distanceToEdges:a,dragStartTime:e,axis:ko,shouldUseTimeDampening:o,getAutoScrollerOptions:i}),u=Mc({x:c,y:s});if(Ze(u,fe))return null;const f=Vc({container:t,subject:n,proposedScroll:u});return f?Ze(f,fe)?null:f:null};const Gc=Ro(e=>e===0?0:e>0?1:-1),hr=(()=>{const e=(t,n)=>t<0?t:t>n?t-n:0;return({current:t,max:n,change:r})=>{const o=he(t,r),i={x:e(o.x,n.x),y:e(o.y,n.y)};return Ze(i,fe)?null:i}})(),ci=({max:e,current:t,change:n})=>{const r={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},o=Gc(n),i=hr({max:r,current:t,change:o});return!i||o.x!==0&&i.x===0||o.y!==0&&i.y===0},gr=(e,t)=>ci({current:e.scroll.current,max:e.scroll.max,change:t}),Wc=(e,t)=>{if(!gr(e,t))return null;const n=e.scroll.max,r=e.scroll.current;return hr({current:r,max:n,change:t})},br=(e,t)=>{const n=e.frame;return n?ci({current:n.scroll.current,max:n.scroll.max,change:t}):!1},zc=(e,t)=>{const n=e.frame;return!n||!br(e,t)?null:hr({current:n.scroll.current,max:n.scroll.max,change:t})};var Hc=({viewport:e,subject:t,center:n,dragStartTime:r,shouldUseTimeDampening:o,getAutoScrollerOptions:i})=>{const a=li({dragStartTime:r,container:e.frame,subject:t,center:n,shouldUseTimeDampening:o,getAutoScrollerOptions:i});return a&&gr(e,a)?a:null},Uc=({droppable:e,subject:t,center:n,dragStartTime:r,shouldUseTimeDampening:o,getAutoScrollerOptions:i})=>{const a=e.frame;if(!a)return null;const s=li({dragStartTime:r,container:a.pageMarginBox,subject:t,center:n,shouldUseTimeDampening:o,getAutoScrollerOptions:i});return s&&br(e,s)?s:null},eo=({state:e,dragStartTime:t,shouldUseTimeDampening:n,scrollWindow:r,scrollDroppable:o,getAutoScrollerOptions:i})=>{const a=e.current.page.borderBoxCenter,c=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const d=e.viewport,p=Hc({dragStartTime:t,viewport:d,subject:c,center:a,shouldUseTimeDampening:n,getAutoScrollerOptions:i});if(p){r(p);return}}const u=_c({center:a,destination:Te(e.impact),droppables:e.dimensions.droppables});if(!u)return;const f=Uc({dragStartTime:t,droppable:u,subject:c,center:a,shouldUseTimeDampening:n,getAutoScrollerOptions:i});f&&o(u.descriptor.id,f)},jc=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:n=()=>Gt})=>{const r=_t(e),o=_t(t);let i=null;const a=u=>{i||(process.env.NODE_ENV!=="production"?h(!1,"Cannot fluid scroll if not dragging"):h());const{shouldUseTimeDampening:f,dragStartTime:d}=i;eo({state:u,scrollWindow:r,scrollDroppable:o,dragStartTime:d,shouldUseTimeDampening:f,getAutoScrollerOptions:n})};return{start:u=>{qt(),i&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot start auto scrolling when already started"):h());const f=Date.now();let d=!1;const p=()=>{d=!0};eo({state:u,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:p,scrollDroppable:p,getAutoScrollerOptions:n}),i={dragStartTime:f,shouldUseTimeDampening:d},Yt(),d&&a(u)},stop:()=>{i&&(r.cancel(),o.cancel(),i=null)},scroll:a}},qc=({move:e,scrollDroppable:t,scrollWindow:n})=>{const r=(s,c)=>{const u=he(s.current.client.selection,c);e({client:u})},o=(s,c)=>{if(!br(s,c))return c;const u=zc(s,c);if(!u)return t(s.descriptor.id,c),null;const f=Pe(c,u);return t(s.descriptor.id,f),Pe(c,f)},i=(s,c,u)=>{if(!s||!gr(c,u))return u;const f=Wc(c,u);if(!f)return n(u),null;const d=Pe(u,f);return n(d),Pe(u,d)};return s=>{const c=s.scrollJumpRequest;if(!c)return;const u=Te(s.impact);u||(process.env.NODE_ENV!=="production"?h(!1,"Cannot perform a jump scroll when there is no destination"):h());const f=o(s.dimensions.droppables[u],c);if(!f)return;const d=s.viewport,p=i(s.isWindowScrollAllowed,d,f);p&&r(s,p)}},Yc=({scrollDroppable:e,scrollWindow:t,move:n,getAutoScrollerOptions:r})=>{const o=jc({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:r}),i=qc({move:n,scrollWindow:t,scrollDroppable:e});return{scroll:c=>{if(!(r().disabled||c.phase!=="DRAGGING")){if(c.movementMode==="FLUID"){o.scroll(c);return}c.scrollJumpRequest&&i(c)}},start:o.start,stop:o.stop}};const wt="data-rfd",Ct=(()=>{const e=`${wt}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),qn=(()=>{const e=`${wt}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),Kc=(()=>{const e=`${wt}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),to={contextId:`${wt}-scroll-container-context-id`},Xc=e=>t=>`[${t}="${e}"]`,Pt=(e,t)=>e.map(n=>{const r=n.styles[t];return r?`${n.selector} { ${r} }`:""}).join(" "),Jc="pointer-events: none;";var Zc=e=>{const t=Xc(e),n=(()=>{const s=`
|
|
67
67
|
cursor: -webkit-grab;
|
|
68
68
|
cursor: grab;
|
|
69
69
|
`;return{selector:t(Ct.contextId),styles:{always:`
|
|
@@ -71,8 +71,8 @@ import{jsxs as D,Fragment as Xn,jsx as l}from"react/jsx-runtime";import ee,{useR
|
|
|
71
71
|
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
|
72
72
|
touch-action: manipulation;
|
|
73
73
|
`,resting:s,dragging:Jc,dropAnimating:s}}})(),r=(()=>{const s=`
|
|
74
|
-
transition: ${
|
|
75
|
-
`;return{selector:t(qn.contextId),styles:{dragging:s,dropAnimating:s,userCancel:s}}})(),o={selector:t(
|
|
74
|
+
transition: ${$t.outOfTheWay};
|
|
75
|
+
`;return{selector:t(qn.contextId),styles:{dragging:s,dropAnimating:s,userCancel:s}}})(),o={selector:t(Kc.contextId),styles:{always:"overflow-anchor: none;"}},a=[r,n,o,{selector:"body",styles:{dragging:`
|
|
76
76
|
cursor: grabbing;
|
|
77
77
|
cursor: -webkit-grabbing;
|
|
78
78
|
user-select: none;
|
|
@@ -80,7 +80,7 @@ import{jsxs as D,Fragment as Xn,jsx as l}from"react/jsx-runtime";import ee,{useR
|
|
|
80
80
|
-moz-user-select: none;
|
|
81
81
|
-ms-user-select: none;
|
|
82
82
|
overflow-anchor: none;
|
|
83
|
-
`}}];return{always:
|
|
83
|
+
`}}];return{always:Pt(a,"always"),resting:Pt(a,"resting"),dragging:Pt(a,"dragging"),dropAnimating:Pt(a,"dropAnimating"),userCancel:Pt(a,"userCancel")}};const Be=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Hi:Ne,$n=()=>{const e=document.querySelector("head");return e||(process.env.NODE_ENV!=="production"?h(!1,"Cannot find the head to append a style to"):h()),e},no=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function Qc(e,t){const n=V(()=>Zc(e),[e]),r=J(null),o=J(null),i=D(pe(d=>{const p=o.current;p||(process.env.NODE_ENV!=="production"?h(!1,"Cannot set dynamic style element if it is not set"):h()),p.textContent=d}),[]),a=D(d=>{const p=r.current;p||(process.env.NODE_ENV!=="production"?h(!1,"Cannot set dynamic style element if it is not set"):h()),p.textContent=d},[]);Be(()=>{!r.current&&!o.current||(process.env.NODE_ENV!=="production"?h(!1,"style elements already mounted"):h());const d=no(t),p=no(t);return r.current=d,o.current=p,d.setAttribute(`${wt}-always`,e),p.setAttribute(`${wt}-dynamic`,e),$n().appendChild(d),$n().appendChild(p),a(n.always),i(n.resting),()=>{const m=b=>{const v=b.current;v||(process.env.NODE_ENV!=="production"?h(!1,"Cannot unmount ref as it is not set"):h()),$n().removeChild(v),b.current=null};m(r),m(o)}},[t,a,i,n.always,n.resting,e]);const s=D(()=>i(n.dragging),[i,n.dragging]),c=D(d=>{if(d==="DROP"){i(n.dropAnimating);return}i(n.userCancel)},[i,n.dropAnimating,n.userCancel]),u=D(()=>{o.current&&i(n.resting)},[i,n.resting]);return V(()=>({dragging:s,dropping:c,resting:u}),[s,c,u])}function di(e,t){return Array.from(e.querySelectorAll(t))}var ui=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function Kt(e){return e instanceof ui(e).HTMLElement}function pi(e,t){const n=`[${Ct.contextId}="${e}"]`,r=di(document,n);if(!r.length)return process.env.NODE_ENV!=="production"&&Z(`Unable to find any drag handles in the context "${e}"`),null;const o=r.find(i=>i.getAttribute(Ct.draggableId)===t);return o?Kt(o)?o:(process.env.NODE_ENV!=="production"&&Z("drag handle needs to be a HTMLElement"),null):(process.env.NODE_ENV!=="production"&&Z(`Unable to find drag handle with id "${t}" as no handle with a matching id was found`),null)}function ed(e){const t=J({}),n=J(null),r=J(null),o=J(!1),i=D(function(p,m){const b={id:p,focus:m};return t.current[p]=b,function(){const y=t.current;y[p]!==b&&delete y[p]}},[]),a=D(function(p){const m=pi(e,p);m&&m!==document.activeElement&&m.focus()},[e]),s=D(function(p,m){n.current===p&&(n.current=m)},[]),c=D(function(){r.current||o.current&&(r.current=requestAnimationFrame(()=>{r.current=null;const p=n.current;p&&a(p)}))},[a]),u=D(function(p){n.current=null;const m=document.activeElement;m&&m.getAttribute(Ct.draggableId)===p&&(n.current=p)},[]);return Be(()=>(o.current=!0,function(){o.current=!1;const p=r.current;p&&cancelAnimationFrame(p)}),[]),V(()=>({register:i,tryRecordFocus:u,tryRestoreFocusRecorded:c,tryShiftRecord:s}),[i,u,c,s])}function td(){const e={draggables:{},droppables:{}},t=[];function n(d){return t.push(d),function(){const m=t.indexOf(d);m!==-1&&t.splice(m,1)}}function r(d){t.length&&t.forEach(p=>p(d))}function o(d){return e.draggables[d]||null}function i(d){const p=o(d);return p||(process.env.NODE_ENV!=="production"?h(!1,`Cannot find draggable entry with id [${d}]`):h()),p}const a={register:d=>{e.draggables[d.descriptor.id]=d,r({type:"ADDITION",value:d})},update:(d,p)=>{const m=e.draggables[p.descriptor.id];m&&m.uniqueId===d.uniqueId&&(delete e.draggables[p.descriptor.id],e.draggables[d.descriptor.id]=d)},unregister:d=>{const p=d.descriptor.id,m=o(p);m&&d.uniqueId===m.uniqueId&&(delete e.draggables[p],e.droppables[d.descriptor.droppableId]&&r({type:"REMOVAL",value:d}))},getById:i,findById:o,exists:d=>!!o(d),getAllByType:d=>Object.values(e.draggables).filter(p=>p.descriptor.type===d)};function s(d){return e.droppables[d]||null}function c(d){const p=s(d);return p||(process.env.NODE_ENV!=="production"?h(!1,`Cannot find droppable entry with id [${d}]`):h()),p}const u={register:d=>{e.droppables[d.descriptor.id]=d},unregister:d=>{const p=s(d.descriptor.id);p&&d.uniqueId===p.uniqueId&&delete e.droppables[d.descriptor.id]},getById:c,findById:s,exists:d=>!!s(d),getAllByType:d=>Object.values(e.droppables).filter(p=>p.descriptor.type===d)};function f(){e.draggables={},e.droppables={},t.length=0}return{draggable:a,droppable:u,subscribe:n,clean:f}}function nd(){const e=V(td,[]);return Ne(()=>function(){e.clean()},[e]),e}var vr=ee.createContext(null),Wt=()=>{const e=document.body;return e||(process.env.NODE_ENV!=="production"?h(!1,"Cannot find document.body"):h()),e};const rd={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},od=e=>`rfd-announcement-${e}`;function id(e){const t=V(()=>od(e),[e]),n=J(null);return Ne(function(){const i=document.createElement("div");return n.current=i,i.id=t,i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),xo(i.style,rd),Wt().appendChild(i),function(){setTimeout(function(){const c=Wt();c.contains(i)&&c.removeChild(i),i===n.current&&(n.current=null)})}},[t]),D(o=>{const i=n.current;if(i){i.textContent=o;return}process.env.NODE_ENV!=="production"&&Z(`
|
|
84
84
|
A screen reader message was trying to be announced but it was unable to do so.
|
|
85
85
|
This can occur if you unmount your <DragDropContext /> in your onDragEnd.
|
|
86
86
|
Consider calling provided.announce() before the unmount so that the instruction will
|
|
@@ -89,12 +89,12 @@ import{jsxs as D,Fragment as Xn,jsx as l}from"react/jsx-runtime";import ee,{useR
|
|
|
89
89
|
Message not passed to screen reader:
|
|
90
90
|
|
|
91
91
|
"${o}"
|
|
92
|
-
`)},[])}const ad={separator:"::"};function yr(e,t=ad){const n=ee.useId();return
|
|
92
|
+
`)},[])}const ad={separator:"::"};function yr(e,t=ad){const n=ee.useId();return V(()=>`${e}${t.separator}${n}`,[t.separator,e,n])}function sd({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function ld({contextId:e,text:t}){const n=yr("hidden-text",{separator:"-"}),r=V(()=>sd({contextId:e,uniqueId:n}),[n,e]);return Ne(function(){const i=document.createElement("div");return i.id=r,i.textContent=t,i.style.display="none",Wt().appendChild(i),function(){const s=Wt();s.contains(i)&&s.removeChild(i)}},[r,t]),r}var wn=ee.createContext(null),cd={react:"^18.0.0 || ^19.0.0"};const dd=/(\d+)\.(\d+)\.(\d+)/,ro=e=>{const t=dd.exec(e);t==null&&(process.env.NODE_ENV!=="production"?h(!1,`Unable to parse React version ${e}`):h());const n=Number(t[1]),r=Number(t[2]),o=Number(t[3]);return{major:n,minor:r,patch:o,raw:e}},ud=(e,t)=>t.major>e.major?!0:t.major<e.major?!1:t.minor>e.minor?!0:t.minor<e.minor?!1:t.patch>=e.patch;var pd=(e,t)=>{const n=ro(e),r=ro(t);ud(n,r)||process.env.NODE_ENV!=="production"&&Z(`
|
|
93
93
|
React version: [${r.raw}]
|
|
94
94
|
does not satisfy expected peer dependency version: [${n.raw}]
|
|
95
95
|
|
|
96
96
|
This can result in run time bugs, and even fatal crashes
|
|
97
|
-
`)};const
|
|
97
|
+
`)};const _n=`
|
|
98
98
|
We expect a html5 doctype: <!doctype html>
|
|
99
99
|
This is to ensure consistent browser layout and measurement
|
|
100
100
|
|
|
@@ -102,21 +102,21 @@ import{jsxs as D,Fragment as Xn,jsx as l}from"react/jsx-runtime";import ee,{useR
|
|
|
102
102
|
`;var fd=e=>{const t=e.doctype;if(!t){process.env.NODE_ENV!=="production"&&Z(`
|
|
103
103
|
No <!doctype html> found.
|
|
104
104
|
|
|
105
|
-
${
|
|
105
|
+
${_n}
|
|
106
106
|
`);return}t.name.toLowerCase()!=="html"&&process.env.NODE_ENV!=="production"&&Z(`
|
|
107
107
|
Unexpected <!doctype> found: (${t.name})
|
|
108
108
|
|
|
109
|
-
${
|
|
109
|
+
${_n}
|
|
110
110
|
`),t.publicId!==""&&process.env.NODE_ENV!=="production"&&Z(`
|
|
111
111
|
Unexpected <!doctype> publicId found: (${t.publicId})
|
|
112
112
|
A html5 doctype does not have a publicId
|
|
113
113
|
|
|
114
|
-
${
|
|
115
|
-
`)};function
|
|
114
|
+
${_n}
|
|
115
|
+
`)};function xr(e){process.env.NODE_ENV!=="production"&&e()}function Xt(e,t){xr(()=>{Ne(()=>{try{e()}catch(n){Wn(`
|
|
116
116
|
A setup problem was encountered.
|
|
117
117
|
|
|
118
118
|
> ${n.message}
|
|
119
|
-
`)}},t)})}function md(){
|
|
119
|
+
`)}},t)})}function md(){Xt(()=>{pd(cd.react,ee.version),fd(document)},[])}function Dr(e){const t=J(e);return Ne(()=>{t.current=e}),t}function hd(){let e=null;function t(){return!!e}function n(a){return a===e}function r(a){e&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot claim lock as it is already claimed"):h());const s={abandon:a};return e=s,s}function o(){e||(process.env.NODE_ENV!=="production"?h(!1,"Cannot release lock when there is no lock"):h()),e=null}function i(){e&&(e.abandon(),o())}return{isClaimed:t,isActive:n,claim:r,release:o,tryAbandon:i}}function zt(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const gd=9,bd=13,Er=27,fi=32,vd=33,yd=34,xd=35,Dd=36,Ed=37,wd=38,Cd=39,Id=40,Nd={[bd]:!0,[gd]:!0};var mi=e=>{Nd[e.keyCode]&&e.preventDefault()};const Cn=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(r=>`on${r}`in document)||e})(),hi=0,oo=5;function Sd(e,t){return Math.abs(t.x-e.x)>=oo||Math.abs(t.y-e.y)>=oo}const io={type:"IDLE"};function Od({cancel:e,completed:t,getPhase:n,setPhase:r}){return[{eventName:"mousemove",fn:o=>{const{button:i,clientX:a,clientY:s}=o;if(i!==hi)return;const c={x:a,y:s},u=n();if(u.type==="DRAGGING"){o.preventDefault(),u.actions.move(c);return}u.type!=="PENDING"&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot be IDLE"):h());const f=u.point;if(!Sd(f,c))return;o.preventDefault();const d=u.actions.fluidLift(c);r({type:"DRAGGING",actions:d})}},{eventName:"mouseup",fn:o=>{const i=n();if(i.type!=="DRAGGING"){e();return}o.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:o=>{n().type==="DRAGGING"&&o.preventDefault(),e()}},{eventName:"keydown",fn:o=>{if(n().type==="PENDING"){e();return}if(o.keyCode===Er){o.preventDefault(),e();return}mi(o)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{n().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:o=>{const i=n();if(i.type==="IDLE"&&(process.env.NODE_ENV!=="production"?h(!1,"Unexpected phase"):h()),i.actions.shouldRespectForcePress()){e();return}o.preventDefault()}},{eventName:Cn,fn:e}]}function Ad(e){const t=J(io),n=J(Je),r=V(()=>({eventName:"mousedown",fn:function(d){if(d.defaultPrevented||d.button!==hi||d.ctrlKey||d.metaKey||d.shiftKey||d.altKey)return;const p=e.findClosestDraggableId(d);if(!p)return;const m=e.tryGetLock(p,a,{sourceEvent:d});if(!m)return;d.preventDefault();const b={x:d.clientX,y:d.clientY};n.current(),u(m,b)}}),[e]),o=V(()=>({eventName:"webkitmouseforcewillbegin",fn:f=>{if(f.defaultPrevented)return;const d=e.findClosestDraggableId(f);if(!d)return;const p=e.findOptionsForDraggable(d);p&&(p.shouldRespectForcePress||e.canGetLock(d)&&f.preventDefault())}}),[e]),i=D(function(){const d={passive:!1,capture:!0};n.current=ke(window,[o,r],d)},[o,r]),a=D(()=>{t.current.type!=="IDLE"&&(t.current=io,n.current(),i())},[i]),s=D(()=>{const f=t.current;a(),f.type==="DRAGGING"&&f.actions.cancel({shouldBlockNextClick:!0}),f.type==="PENDING"&&f.actions.abort()},[a]),c=D(function(){const d={capture:!0,passive:!1},p=Od({cancel:s,completed:a,getPhase:()=>t.current,setPhase:m=>{t.current=m}});n.current=ke(window,p,d)},[s,a]),u=D(function(d,p){t.current.type!=="IDLE"&&(process.env.NODE_ENV!=="production"?h(!1,"Expected to move from IDLE to PENDING drag"):h()),t.current={type:"PENDING",point:p,actions:d},c()},[c]);Be(function(){return i(),function(){n.current()}},[i])}function Pd(){}const Rd={[yd]:!0,[vd]:!0,[Dd]:!0,[xd]:!0};function Td(e,t){function n(){t(),e.cancel()}function r(){t(),e.drop()}return[{eventName:"keydown",fn:o=>{if(o.keyCode===Er){o.preventDefault(),n();return}if(o.keyCode===fi){o.preventDefault(),r();return}if(o.keyCode===Id){o.preventDefault(),e.moveDown();return}if(o.keyCode===wd){o.preventDefault(),e.moveUp();return}if(o.keyCode===Cd){o.preventDefault(),e.moveRight();return}if(o.keyCode===Ed){o.preventDefault(),e.moveLeft();return}if(Rd[o.keyCode]){o.preventDefault();return}mi(o)}},{eventName:"mousedown",fn:n},{eventName:"mouseup",fn:n},{eventName:"click",fn:n},{eventName:"touchstart",fn:n},{eventName:"resize",fn:n},{eventName:"wheel",fn:n,options:{passive:!0}},{eventName:Cn,fn:n}]}function Bd(e){const t=J(Pd),n=V(()=>({eventName:"keydown",fn:function(i){if(i.defaultPrevented||i.keyCode!==fi)return;const a=e.findClosestDraggableId(i);if(!a)return;const s=e.tryGetLock(a,f,{sourceEvent:i});if(!s)return;i.preventDefault();let c=!0;const u=s.snapLift();t.current();function f(){c||(process.env.NODE_ENV!=="production"?h(!1,"Cannot stop capturing a keyboard drag when not capturing"):h()),c=!1,t.current(),r()}t.current=ke(window,Td(u,f),{capture:!0,passive:!1})}}),[e]),r=D(function(){const i={passive:!1,capture:!0};t.current=ke(window,[n],i)},[n]);Be(function(){return r(),function(){t.current()}},[r])}const kn={type:"IDLE"},$d=120,_d=.15;function kd({cancel:e,getPhase:t}){return[{eventName:"orientationchange",fn:e},{eventName:"resize",fn:e},{eventName:"contextmenu",fn:n=>{n.preventDefault()}},{eventName:"keydown",fn:n=>{if(t().type!=="DRAGGING"){e();return}n.keyCode===Er&&n.preventDefault(),e()}},{eventName:Cn,fn:e}]}function Fd({cancel:e,completed:t,getPhase:n}){return[{eventName:"touchmove",options:{capture:!1},fn:r=>{const o=n();if(o.type!=="DRAGGING"){e();return}o.hasMoved=!0;const{clientX:i,clientY:a}=r.touches[0],s={x:i,y:a};r.preventDefault(),o.actions.move(s)}},{eventName:"touchend",fn:r=>{const o=n();if(o.type!=="DRAGGING"){e();return}r.preventDefault(),o.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:r=>{if(n().type!=="DRAGGING"){e();return}r.preventDefault(),e()}},{eventName:"touchforcechange",fn:r=>{const o=n();o.type==="IDLE"&&(process.env.NODE_ENV,h());const i=r.touches[0];if(!i||!(i.force>=_d))return;const s=o.actions.shouldRespectForcePress();if(o.type==="PENDING"){s&&e();return}if(s){if(o.hasMoved){r.preventDefault();return}e();return}r.preventDefault()}},{eventName:Cn,fn:e}]}function Ld(e){const t=J(kn),n=J(Je),r=D(function(){return t.current},[]),o=D(function(m){t.current=m},[]),i=V(()=>({eventName:"touchstart",fn:function(m){if(m.defaultPrevented)return;const b=e.findClosestDraggableId(m);if(!b)return;const v=e.tryGetLock(b,s,{sourceEvent:m});if(!v)return;const y=m.touches[0],{clientX:w,clientY:O}=y,U={x:w,y:O};n.current(),d(v,U)}}),[e]),a=D(function(){const m={capture:!0,passive:!1};n.current=ke(window,[i],m)},[i]),s=D(()=>{const p=t.current;p.type!=="IDLE"&&(p.type==="PENDING"&&clearTimeout(p.longPressTimerId),o(kn),n.current(),a())},[a,o]),c=D(()=>{const p=t.current;s(),p.type==="DRAGGING"&&p.actions.cancel({shouldBlockNextClick:!0}),p.type==="PENDING"&&p.actions.abort()},[s]),u=D(function(){const m={capture:!0,passive:!1},b={cancel:c,completed:s,getPhase:r},v=ke(window,Fd(b),m),y=ke(window,kd(b),m);n.current=function(){v(),y()}},[c,r,s]),f=D(function(){const m=r();m.type!=="PENDING"&&(process.env.NODE_ENV!=="production"?h(!1,`Cannot start dragging from phase ${m.type}`):h());const b=m.actions.fluidLift(m.point);o({type:"DRAGGING",actions:b,hasMoved:!1})},[r,o]),d=D(function(m,b){r().type!=="IDLE"&&(process.env.NODE_ENV!=="production"?h(!1,"Expected to move from IDLE to PENDING drag"):h());const v=setTimeout(f,$d);o({type:"PENDING",point:b,actions:m,longPressTimerId:v}),u()},[u,r,o,f]);Be(function(){return a(),function(){n.current();const b=r();b.type==="PENDING"&&(clearTimeout(b.longPressTimerId),o(kn))}},[r,a,o]),Be(function(){return ke(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}function Vd(e){xr(()=>{const t=Dr(e);Xt(()=>{t.current.length!==e.length&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot change the amount of sensor hooks after mounting"):h(!1))})})}const Md=["input","button","textarea","select","option","optgroup","video","audio"];function gi(e,t){if(t==null)return!1;if(Md.includes(t.tagName.toLowerCase()))return!0;const r=t.getAttribute("contenteditable");return r==="true"||r===""?!0:t===e?!1:gi(e,t.parentElement)}function Gd(e,t){const n=t.target;return Kt(n)?gi(e,n):!1}var Wd=e=>Me(e.getBoundingClientRect()).center;function zd(e){return e instanceof ui(e).Element}const Hd=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(r=>r in Element.prototype)||e})();function bi(e,t){return e==null?null:e[Hd](t)?e:bi(e.parentElement,t)}function Ud(e,t){return e.closest?e.closest(t):bi(e,t)}function jd(e){return`[${Ct.contextId}="${e}"]`}function qd(e,t){const n=t.target;if(!zd(n))return process.env.NODE_ENV!=="production"&&Z("event.target must be a Element"),null;const r=jd(e),o=Ud(n,r);return o?Kt(o)?o:(process.env.NODE_ENV!=="production"&&Z("drag handle must be a HTMLElement"),null):null}function Yd(e,t){const n=qd(e,t);return n?n.getAttribute(Ct.draggableId):null}function Kd(e,t){const n=`[${qn.contextId}="${e}"]`,o=di(document,n).find(i=>i.getAttribute(qn.id)===t);return o?Kt(o)?o:(process.env.NODE_ENV!=="production"&&Z("Draggable element is not a HTMLElement"),null):null}function Xd(e){e.preventDefault()}function on({expected:e,phase:t,isLockActive:n,shouldWarn:r}){return n()?e!==t?(r&&process.env.NODE_ENV!=="production"&&Z(`
|
|
120
120
|
Cannot perform action.
|
|
121
121
|
The actions you used belong to an outdated phase
|
|
122
122
|
|
|
@@ -134,13 +134,13 @@ import{jsxs as D,Fragment as Xn,jsx as l}from"react/jsx-runtime";import ee,{useR
|
|
|
134
134
|
|
|
135
135
|
- Throw away your action handlers when forceStop() is called
|
|
136
136
|
- Check actions.isActive() if you really need to
|
|
137
|
-
`),!1)}function vi({lockAPI:e,store:t,registry:n,draggableId:r}){if(e.isClaimed())return!1;const o=n.draggable.findById(r);return o?!(!o.options.isEnabled||!ai(t.getState(),r)):(process.env.NODE_ENV!=="production"&&Z(`Unable to find draggable with id: ${r}`),!1)}function Jd({lockAPI:e,contextId:t,store:n,registry:r,draggableId:o,forceSensorStop:i,sourceEvent:a}){if(!vi({lockAPI:e,store:n,registry:r,draggableId:o}))return null;const c=r.draggable.getById(o),u=
|
|
137
|
+
`),!1)}function vi({lockAPI:e,store:t,registry:n,draggableId:r}){if(e.isClaimed())return!1;const o=n.draggable.findById(r);return o?!(!o.options.isEnabled||!ai(t.getState(),r)):(process.env.NODE_ENV!=="production"&&Z(`Unable to find draggable with id: ${r}`),!1)}function Jd({lockAPI:e,contextId:t,store:n,registry:r,draggableId:o,forceSensorStop:i,sourceEvent:a}){if(!vi({lockAPI:e,store:n,registry:r,draggableId:o}))return null;const c=r.draggable.getById(o),u=Kd(t,c.descriptor.id);if(!u)return process.env.NODE_ENV!=="production"&&Z(`Unable to find draggable element with id: ${o}`),null;if(a&&!c.options.canDragInteractiveElements&&Gd(u,a))return null;const f=e.claim(i||Je);let d="PRE_DRAG";function p(){return c.options.shouldRespectForcePress}function m(){return e.isActive(f)}function b(B,k){on({expected:B,phase:d,isLockActive:m,shouldWarn:!0})&&n.dispatch(k())}const v=b.bind(null,"DRAGGING");function y(B){function k(){e.release(),d="COMPLETED"}d!=="PRE_DRAG"&&(k(),process.env.NODE_ENV!=="production"?h(!1,`Cannot lift in phase ${d}`):h()),n.dispatch(Fl(B.liftActionArgs)),d="DRAGGING";function P(te,N={shouldBlockNextClick:!1}){if(B.cleanup(),N.shouldBlockNextClick){const A=ke(window,[{eventName:"click",fn:Xd,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(A)}k(),n.dispatch(Zo({reason:te}))}return{isActive:()=>on({expected:"DRAGGING",phase:d,isLockActive:m,shouldWarn:!1}),shouldRespectForcePress:p,drop:te=>P("DROP",te),cancel:te=>P("CANCEL",te),...B.actions}}function w(B){const k=_t(te=>{v(()=>Jo({client:te}))});return{...y({liftActionArgs:{id:o,clientSelection:B,movementMode:"FLUID"},cleanup:()=>k.cancel(),actions:{move:k}}),move:k}}function O(){const B={moveUp:()=>v(jl),moveRight:()=>v(Yl),moveDown:()=>v(ql),moveLeft:()=>v(Kl)};return y({liftActionArgs:{id:o,clientSelection:Wd(u),movementMode:"SNAP"},cleanup:Je,actions:B})}function U(){on({expected:"PRE_DRAG",phase:d,isLockActive:m,shouldWarn:!0})&&e.release()}return{isActive:()=>on({expected:"PRE_DRAG",phase:d,isLockActive:m,shouldWarn:!1}),shouldRespectForcePress:p,fluidLift:w,snapLift:O,abort:U}}const Zd=[Ad,Bd,Ld];function Qd({contextId:e,store:t,registry:n,customSensors:r,enableDefaultSensors:o}){const i=[...o?Zd:[],...r||[]],a=Ee(()=>hd())[0],s=D(function(y,w){zt(y)&&!zt(w)&&a.tryAbandon()},[a]);Be(function(){let y=t.getState();return t.subscribe(()=>{const O=t.getState();s(y,O),y=O})},[a,t,s]),Be(()=>a.tryAbandon,[a.tryAbandon]);const c=D(v=>vi({lockAPI:a,registry:n,store:t,draggableId:v}),[a,n,t]),u=D((v,y,w)=>Jd({lockAPI:a,registry:n,contextId:e,store:t,draggableId:v,forceSensorStop:y||null,sourceEvent:w&&w.sourceEvent?w.sourceEvent:null}),[e,a,n,t]),f=D(v=>Yd(e,v),[e]),d=D(v=>{const y=n.draggable.findById(v);return y?y.options:null},[n.draggable]),p=D(function(){a.isClaimed()&&(a.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(ur()))},[a,t]),m=D(()=>a.isClaimed(),[a]),b=V(()=>({canGetLock:c,tryGetLock:u,findClosestDraggableId:f,findOptionsForDraggable:d,tryReleaseLock:p,isLockClaimed:m}),[c,u,f,d,p,m]);Vd(i);for(let v=0;v<i.length;v++)i[v](b)}const eu=e=>({onBeforeCapture:t=>{vo(()=>{e.onBeforeCapture&&e.onBeforeCapture(t)})},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),tu=e=>({...Gt,...e.autoScrollerOptions,durationDampening:{...Gt.durationDampening,...e.autoScrollerOptions}});function Rt(e){return e.current||(process.env.NODE_ENV!=="production"?h(!1,"Could not find store from lazy ref"):h()),e.current}function nu(e){const{contextId:t,setCallbacks:n,sensors:r,nonce:o,dragHandleUsageInstructions:i}=e,a=J(null);md();const s=Dr(e),c=D(()=>eu(s.current),[s]),u=D(()=>tu(s.current),[s]),f=id(t),d=ld({contextId:t,text:i}),p=Qc(t,o),m=D(A=>{Rt(a).dispatch(A)},[]),b=V(()=>Br({publishWhileDragging:Vl,updateDroppableScroll:Gl,updateDroppableIsEnabled:Wl,updateDroppableIsCombineEnabled:zl,collectionStarting:Ml},m),[m]),v=nd(),y=V(()=>Rc(v,b),[v,b]),w=V(()=>Yc({scrollWindow:Tc,scrollDroppable:y.scrollDroppable,getAutoScrollerOptions:u,...Br({move:Jo},m)}),[y.scrollDroppable,m,u]),O=ed(t),U=V(()=>Sc({announce:f,autoScroller:w,dimensionMarshal:y,focusMarshal:O,getResponders:c,styleMarshal:p}),[f,w,y,O,c,p]);process.env.NODE_ENV!=="production"&&a.current&&a.current!==U&&process.env.NODE_ENV!=="production"&&Z("unexpected store change"),a.current=U;const T=D(()=>{const A=Rt(a);A.getState().phase!=="IDLE"&&A.dispatch(ur())},[]),B=D(()=>{const A=Rt(a).getState();return A.phase==="DROP_ANIMATING"?!0:A.phase==="IDLE"?!1:A.isDragging},[]),k=V(()=>({isDragging:B,tryAbort:T}),[B,T]);n(k);const P=D(A=>ai(Rt(a).getState(),A),[]),te=D(()=>ft(Rt(a).getState()),[]),N=V(()=>({marshal:y,focus:O,contextId:t,canLift:P,isMovementAllowed:te,dragHandleUsageInstructionsId:d,registry:v}),[t,y,d,O,P,te,v]);return Qd({contextId:t,store:U,registry:v,customSensors:r||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),Ne(()=>T,[T]),ee.createElement(wn.Provider,{value:N},ee.createElement(sa,{context:vr,store:U},e.children))}function ru(){return ee.useId()}function yi(e){const t=ru(),n=e.dragHandleUsageInstructions||sn.dragHandleUsageInstructions;return ee.createElement(Ns,null,r=>ee.createElement(nu,{nonce:e.nonce,contextId:t,setCallbacks:r,dragHandleUsageInstructions:n,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd,autoScrollerOptions:e.autoScrollerOptions},e.children))}const ao={dragging:5e3,dropAnimating:4500},ou=(e,t)=>t?$t.drop(t.duration):e?$t.snap:$t.fluid,iu=(e,t)=>{if(e)return t?Mt.opacity.drop:Mt.opacity.combining},au=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function su(e){const n=e.dimension.client,{offset:r,combineWith:o,dropping:i}=e,a=!!o,s=au(e),c=!!i,u=c?Un.drop(r,a):Un.moveTo(r);return{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:ou(s,i),transform:u,opacity:iu(a,c),zIndex:c?ao.dropAnimating:ao.dragging,pointerEvents:"none"}}function lu(e){return{transform:Un.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function cu(e){return e.type==="DRAGGING"?su(e):lu(e)}function du(e,t,n=fe){const r=window.getComputedStyle(t),o=t.getBoundingClientRect(),i=Io(o,r),a=dn(i,n),s={client:i,tagName:t.tagName.toLowerCase(),display:r.display},c={x:i.marginBox.width,y:i.marginBox.height};return{descriptor:e,placeholder:s,displaceBy:c,client:i,page:a}}function uu(e){const t=yr("draggable"),{descriptor:n,registry:r,getDraggableRef:o,canDragInteractiveElements:i,shouldRespectForcePress:a,isEnabled:s}=e,c=V(()=>({canDragInteractiveElements:i,shouldRespectForcePress:a,isEnabled:s}),[i,s,a]),u=D(m=>{const b=o();return b||(process.env.NODE_ENV!=="production"?h(!1,"Cannot get dimension when no ref is set"):h()),du(n,b,m)},[n,o]),f=V(()=>({uniqueId:t,descriptor:n,options:c,getDimension:u}),[n,u,c,t]),d=J(f),p=J(!0);Be(()=>(r.draggable.register(d.current),()=>r.draggable.unregister(d.current)),[r.draggable]),Be(()=>{if(p.current){p.current=!1;return}const m=d.current;d.current=f,r.draggable.update(f,m)},[f,r.draggable])}var wr=ee.createContext(null);function xi(e){e&&Kt(e)||(process.env.NODE_ENV!=="production"?h(!1,`
|
|
138
138
|
provided.innerRef has not been provided with a HTMLElement.
|
|
139
139
|
|
|
140
140
|
You can find a guide on using the innerRef callback functions at:
|
|
141
141
|
https://github.com/hello-pangea/dnd/blob/main/docs/guides/using-inner-ref.md
|
|
142
|
-
`):h())}function pu(e,t,n){
|
|
143
|
-
Provided: [type: ${typeof o}] (value: ${o})`):h(!1)),Number.isInteger(e.index)||(process.env.NODE_ENV!=="production"?h(!1,`${r(o)} requires an integer index prop`):h(!1)),e.mapped.type!=="DRAGGING"&&(
|
|
142
|
+
`):h())}function pu(e,t,n){Xt(()=>{function r(i){return`Draggable[id: ${i}]: `}const o=e.draggableId;o||(process.env.NODE_ENV!=="production"?h(!1,"Draggable requires a draggableId"):h(!1)),typeof o!="string"&&(process.env.NODE_ENV!=="production"?h(!1,`Draggable requires a [string] draggableId.
|
|
143
|
+
Provided: [type: ${typeof o}] (value: ${o})`):h(!1)),Number.isInteger(e.index)||(process.env.NODE_ENV!=="production"?h(!1,`${r(o)} requires an integer index prop`):h(!1)),e.mapped.type!=="DRAGGING"&&(xi(n()),e.isEnabled&&(pi(t,o)||(process.env.NODE_ENV!=="production"?h(!1,`${r(o)} Unable to find drag handle`):h(!1))))})}function fu(e){xr(()=>{const t=J(e);Xt(()=>{e!==t.current&&(process.env.NODE_ENV!=="production"?h(!1,"Draggable isClone prop value changed during component life"):h(!1))},[e])})}function fn(e){const t=mo(e);return t||(process.env.NODE_ENV!=="production"?h(!1,"Could not find required context"):h()),t}function mu(e){e.preventDefault()}const hu=e=>{const t=J(null),n=D((k=null)=>{t.current=k},[]),r=D(()=>t.current,[]),{contextId:o,dragHandleUsageInstructionsId:i,registry:a}=fn(wn),{type:s,droppableId:c}=fn(wr),u=V(()=>({id:e.draggableId,index:e.index,type:s,droppableId:c}),[e.draggableId,e.index,s,c]),{children:f,draggableId:d,isEnabled:p,shouldRespectForcePress:m,canDragInteractiveElements:b,isClone:v,mapped:y,dropAnimationFinished:w}=e;if(pu(e,o,r),fu(v),!v){const k=V(()=>({descriptor:u,registry:a,getDraggableRef:r,canDragInteractiveElements:b,shouldRespectForcePress:m,isEnabled:p}),[u,a,r,b,m,p]);uu(k)}const O=V(()=>p?{tabIndex:0,role:"button","aria-describedby":i,"data-rfd-drag-handle-draggable-id":d,"data-rfd-drag-handle-context-id":o,draggable:!1,onDragStart:mu}:null,[o,i,d,p]),U=D(k=>{y.type==="DRAGGING"&&y.dropping&&k.propertyName==="transform"&&vo(w)},[w,y]),T=V(()=>{const k=cu(y),P=y.type==="DRAGGING"&&y.dropping?U:void 0;return{innerRef:n,draggableProps:{"data-rfd-draggable-context-id":o,"data-rfd-draggable-id":d,style:k,onTransitionEnd:P},dragHandleProps:O}},[o,O,d,y,U,n]),B=V(()=>({draggableId:u.id,type:u.type,source:{index:u.index,droppableId:u.droppableId}}),[u.droppableId,u.id,u.index,u.type]);return ee.createElement(ee.Fragment,null,f(T,y.snapshot,B))};var Di=(e,t)=>e===t,Ei=e=>{const{combine:t,destination:n}=e;return n?n.droppableId:t?t.droppableId:null};const gu=e=>e.combine?e.combine.draggableId:null,bu=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function vu(){const e=pe((o,i)=>({x:o,y:i})),t=pe((o,i,a=null,s=null,c=null)=>({isDragging:!0,isClone:i,isDropAnimating:!!c,dropAnimation:c,mode:o,draggingOver:a,combineWith:s,combineTargetFor:null})),n=pe((o,i,a,s,c=null,u=null,f=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:c,combineWith:u,mode:i,offset:o,dimension:a,forceShouldAnimate:f,snapshot:t(i,s,c,u,null)}}));return(o,i)=>{if(zt(o)){if(o.critical.draggable.id!==i.draggableId)return null;const a=o.current.client.offset,s=o.dimensions.draggables[i.draggableId],c=Te(o.impact),u=bu(o.impact),f=o.forceShouldAnimate;return n(e(a.x,a.y),o.movementMode,s,i.isClone,c,u,f)}if(o.phase==="DROP_ANIMATING"){const a=o.completed;if(a.result.draggableId!==i.draggableId)return null;const s=i.isClone,c=o.dimensions.draggables[i.draggableId],u=a.result,f=u.mode,d=Ei(u),p=gu(u),b={duration:o.dropDuration,curve:fr.drop,moveTo:o.newHomeClientOffset,opacity:p?Mt.opacity.drop:null,scale:p?Mt.scale.drop:null};return{mapped:{type:"DRAGGING",offset:o.newHomeClientOffset,dimension:c,dropping:b,draggingOver:d,combineWith:p,mode:f,forceShouldAnimate:null,snapshot:t(f,s,d,p,b)}}}return null}}function wi(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const yu={mapped:{type:"SECONDARY",offset:fe,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:wi(null)}};function xu(){const e=pe((a,s)=>({x:a,y:s})),t=pe(wi),n=pe((a,s=null,c)=>({mapped:{type:"SECONDARY",offset:a,combineTargetFor:s,shouldAnimateDisplacement:c,snapshot:t(s)}})),r=a=>a?n(fe,a,!0):null,o=(a,s,c,u)=>{const f=c.displaced.visible[a],d=!!(u.inVirtualList&&u.effected[a]),p=xn(c),m=p&&p.draggableId===a?s:null;if(!f){if(!d)return r(m);if(c.displaced.invisible[a])return null;const y=Nt(u.displacedBy.point),w=e(y.x,y.y);return n(w,m,!0)}if(d)return r(m);const b=c.displacedBy.point,v=e(b.x,b.y);return n(v,m,f.shouldAnimate)};return(a,s)=>{if(zt(a))return a.critical.draggable.id===s.draggableId?null:o(s.draggableId,a.critical.draggable.id,a.impact,a.afterCritical);if(a.phase==="DROP_ANIMATING"){const c=a.completed;return c.result.draggableId===s.draggableId?null:o(s.draggableId,c.result.draggableId,c.impact,c.afterCritical)}return null}}const Du=()=>{const e=vu(),t=xu();return(r,o)=>e(r,o)||t(r,o)||yu},Eu={dropAnimationFinished:Qo},wu=yo(Du,Eu,null,{context:vr,areStatePropsEqual:Di})(hu);function Ci(e){return fn(wr).isUsingCloneFor===e.draggableId&&!e.isClone?null:ee.createElement(wu,e)}function Cr(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,n=!!e.disableInteractiveElementBlocking,r=!!e.shouldRespectForcePress;return ee.createElement(Ci,xo({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:n,shouldRespectForcePress:r}))}const Ir=e=>t=>e===t,Cu=Ir("scroll"),Iu=Ir("auto"),Nu=Ir("visible"),so=(e,t)=>t(e.overflowX)||t(e.overflowY),Su=(e,t)=>t(e.overflowX)&&t(e.overflowY),Ii=e=>{const t=window.getComputedStyle(e),n={overflowX:t.overflowX,overflowY:t.overflowY};return so(n,Cu)||so(n,Iu)},Ou=()=>{if(process.env.NODE_ENV==="production")return!1;const e=Wt(),t=document.documentElement;if(t||(process.env.NODE_ENV,h()),!Ii(e))return!1;const n=window.getComputedStyle(t),r={overflowX:n.overflowX,overflowY:n.overflowY};return Su(r,Nu)||process.env.NODE_ENV!=="production"&&Z(`
|
|
144
144
|
We have detected that your <body> element might be a scroll container.
|
|
145
145
|
We have found no reliable way of detecting whether the <body> element is a scroll container.
|
|
146
146
|
Under most circumstances a <body> scroll bar will be on the <html> element (document.documentElement)
|
|
@@ -155,57 +155,57 @@ import{jsxs as D,Fragment as Xn,jsx as l}from"react/jsx-runtime";import ee,{useR
|
|
|
155
155
|
Nested scroll containers are currently not supported.
|
|
156
156
|
|
|
157
157
|
We hope to support nested scroll containers soon: https://github.com/atlassian/react-beautiful-dnd/issues/131
|
|
158
|
-
`)},
|
|
158
|
+
`)},Yn=e=>({x:e.scrollLeft,y:e.scrollTop});const Ni=e=>e?window.getComputedStyle(e).position==="fixed"?!0:Ni(e.parentElement):!1;var Pu=e=>{const t=Nr(e),n=Ni(e);return{closestScrollable:t,isFixedOnPage:n}},Ru=({descriptor:e,isEnabled:t,isCombineEnabled:n,isFixedOnPage:r,direction:o,client:i,page:a,closest:s})=>{const c=(()=>{if(!s)return null;const{scrollSize:p,client:m}=s,b=ri({scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth,height:m.paddingBox.height,width:m.paddingBox.width});return{pageMarginBox:s.page.marginBox,frameClient:m,scrollSize:p,shouldClipSubject:s.shouldClipSubject,scroll:{initial:s.scroll,current:s.scroll,max:b,diff:{value:fe,displacement:fe}}}})(),u=o==="vertical"?ar:ko,f=Et({page:a,withPlaceholder:null,axis:u,frame:c});return{descriptor:e,isCombineEnabled:n,isFixedOnPage:r,axis:u,isEnabled:t,client:i,page:a,frame:c,subject:f}};const Tu=(e,t)=>{const n=No(e);if(!t||e!==t)return n;const r=n.paddingBox.top-t.scrollTop,o=n.paddingBox.left-t.scrollLeft,i=r+t.scrollHeight,a=o+t.scrollWidth,c=nr({top:r,right:a,bottom:i,left:o},n.border);return rr({borderBox:c,margin:n.margin,border:n.border,padding:n.padding})};var Bu=({ref:e,descriptor:t,env:n,windowScroll:r,direction:o,isDropDisabled:i,isCombineEnabled:a,shouldClipSubject:s})=>{const c=n.closestScrollable,u=Tu(e,c),f=dn(u,r),d=(()=>{if(!c)return null;const m=No(c),b={scrollHeight:c.scrollHeight,scrollWidth:c.scrollWidth};return{client:m,page:dn(m,r),scroll:Yn(c),scrollSize:b,shouldClipSubject:s}})();return Ru({descriptor:t,isEnabled:!i,isCombineEnabled:a,isFixedOnPage:n.isFixedOnPage,direction:o,client:u,page:f,closest:d})};const $u={passive:!1},_u={passive:!0};var lo=e=>e.shouldPublishImmediately?$u:_u;const an=e=>e&&e.env.closestScrollable||null;function ku(e){const t=J(null),n=fn(wn),r=yr("droppable"),{registry:o,marshal:i}=n,a=Dr(e),s=V(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),c=J(s),u=V(()=>pe((T,B)=>{t.current||(process.env.NODE_ENV!=="production"?h(!1,"Can only update scroll when dragging"):h());const k={x:T,y:B};i.updateDroppableScroll(s.id,k)}),[s.id,i]),f=D(()=>{const T=t.current;return!T||!T.env.closestScrollable?fe:Yn(T.env.closestScrollable)},[]),d=D(()=>{const T=f();u(T.x,T.y)},[f,u]),p=V(()=>_t(d),[d]),m=D(()=>{const T=t.current,B=an(T);if(T&&B||(process.env.NODE_ENV!=="production"?h(!1,"Could not find scroll options while scrolling"):h()),T.scrollOptions.shouldPublishImmediately){d();return}p()},[p,d]),b=D((T,B)=>{t.current&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot collect a droppable while a drag is occurring"):h());const k=a.current,P=k.getDroppableRef();P||(process.env.NODE_ENV!=="production"?h(!1,"Cannot collect without a droppable ref"):h());const te=Pu(P),N={ref:P,descriptor:s,env:te,scrollOptions:B};t.current=N;const A=Bu({ref:P,descriptor:s,env:te,windowScroll:T,direction:k.direction,isDropDisabled:k.isDropDisabled,isCombineEnabled:k.isCombineEnabled,shouldClipSubject:!k.ignoreContainerClipping}),ne=te.closestScrollable;return ne&&(ne.setAttribute(to.contextId,n.contextId),ne.addEventListener("scroll",m,lo(N.scrollOptions)),process.env.NODE_ENV!=="production"&&Au(ne)),A},[n.contextId,s,m,a]),v=D(()=>{const T=t.current,B=an(T);return T&&B||(process.env.NODE_ENV!=="production"?h(!1,"Can only recollect Droppable client for Droppables that have a scroll container"):h()),Yn(B)},[]),y=D(()=>{const T=t.current;T||(process.env.NODE_ENV!=="production"?h(!1,"Cannot stop drag when no active drag"):h());const B=an(T);t.current=null,B&&(p.cancel(),B.removeAttribute(to.contextId),B.removeEventListener("scroll",m,lo(T.scrollOptions)))},[m,p]),w=D(T=>{const B=t.current;B||(process.env.NODE_ENV!=="production"?h(!1,"Cannot scroll when there is no drag"):h());const k=an(B);k||(process.env.NODE_ENV!=="production"?h(!1,"Cannot scroll a droppable with no closest scrollable"):h()),k.scrollTop+=T.y,k.scrollLeft+=T.x},[]),O=V(()=>({getDimensionAndWatchScroll:b,getScrollWhileDragging:v,dragStopped:y,scroll:w}),[y,b,v,w]),U=V(()=>({uniqueId:r,descriptor:s,callbacks:O}),[O,s,r]);Be(()=>(c.current=U.descriptor,o.droppable.register(U),()=>{t.current&&(process.env.NODE_ENV!=="production"&&Z("Unsupported: changing the droppableId or type of a Droppable during a drag"),y()),o.droppable.unregister(U)}),[O,s,y,U,i,o.droppable]),Be(()=>{t.current&&i.updateDroppableIsEnabled(c.current.id,!e.isDropDisabled)},[e.isDropDisabled,i]),Be(()=>{t.current&&i.updateDroppableIsCombineEnabled(c.current.id,e.isCombineEnabled)},[e.isCombineEnabled,i])}function Fn(){}const co={width:0,height:0,margin:Bs},Fu=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>e||n==="close"?co:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},Lu=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>{const r=Fu({isAnimatingOpenOnMount:e,placeholder:t,animate:n});return{display:t.display,boxSizing:"border-box",width:r.width,height:r.height,marginTop:r.margin.top,marginRight:r.margin.right,marginBottom:r.margin.bottom,marginLeft:r.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:n!=="none"?$t.placeholder:null}},Vu=e=>{const t=J(null),n=D(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:r,onTransitionEnd:o,onClose:i,contextId:a}=e,[s,c]=Ee(e.animate==="open");Ne(()=>s?r!=="open"?(n(),c(!1),Fn):t.current?Fn:(t.current=setTimeout(()=>{t.current=null,c(!1)}),n):Fn,[r,s,n]);const u=D(d=>{d.propertyName==="height"&&(o(),r==="close"&&i())},[r,i,o]),f=Lu({isAnimatingOpenOnMount:s,animate:e.animate,placeholder:e.placeholder});return ee.createElement(e.placeholder.tagName,{style:f,"data-rfd-placeholder-context-id":a,onTransitionEnd:u,ref:e.innerRef})};var Mu=ee.memo(Vu);function Ln(e){return typeof e=="boolean"}function Vn(e,t){t.forEach(n=>n(e))}const Gu=[function({props:t}){t.droppableId||(process.env.NODE_ENV!=="production"?h(!1,"A Droppable requires a droppableId prop"):h()),typeof t.droppableId!="string"&&(process.env.NODE_ENV!=="production"?h(!1,`A Droppable requires a [string] droppableId. Provided: [${typeof t.droppableId}]`):h())},function({props:t}){Ln(t.isDropDisabled)||(process.env.NODE_ENV!=="production"?h(!1,"isDropDisabled must be a boolean"):h()),Ln(t.isCombineEnabled)||(process.env.NODE_ENV!=="production"?h(!1,"isCombineEnabled must be a boolean"):h()),Ln(t.ignoreContainerClipping)||(process.env.NODE_ENV!=="production"?h(!1,"ignoreContainerClipping must be a boolean"):h())},function({getDroppableRef:t}){xi(t())}],Wu=[function({props:t,getPlaceholderRef:n}){!t.placeholder||n()||process.env.NODE_ENV!=="production"&&Z(`
|
|
159
159
|
Droppable setup issue [droppableId: "${t.droppableId}"]:
|
|
160
160
|
DroppableProvided > placeholder could not be found.
|
|
161
161
|
|
|
162
162
|
Please be sure to add the {provided.placeholder} React Node as a child of your Droppable.
|
|
163
163
|
More information: https://github.com/hello-pangea/dnd/blob/main/docs/api/droppable.md
|
|
164
|
-
`)}],zu=[function({props:t}){t.renderClone||(process.env.NODE_ENV!=="production"?h(!1,"Must provide a clone render function (renderClone) for virtual lists"):h())},function({getPlaceholderRef:t}){t()&&(process.env.NODE_ENV!=="production"?h(!1,"Expected virtual list to not have a placeholder"):h())}];function Hu(e){
|
|
164
|
+
`)}],zu=[function({props:t}){t.renderClone||(process.env.NODE_ENV!=="production"?h(!1,"Must provide a clone render function (renderClone) for virtual lists"):h())},function({getPlaceholderRef:t}){t()&&(process.env.NODE_ENV!=="production"?h(!1,"Expected virtual list to not have a placeholder"):h())}];function Hu(e){Xt(()=>{Vn(e,Gu),e.props.mode==="standard"&&Vn(e,Wu),e.props.mode==="virtual"&&Vn(e,zu)})}class Uu extends ee.PureComponent{constructor(...t){super(...t),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(t,n){return t.shouldAnimate?t.on?{isVisible:!0,data:t.on,animate:"open"}:n.isVisible?{isVisible:!0,data:n.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!t.on,data:t.on,animate:"none"}}render(){if(!this.state.isVisible)return null;const t={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(t)}}const ju=e=>{const t=mo(wn);t||(process.env.NODE_ENV!=="production"?h(!1,"Could not find app context"):h());const{contextId:n,isMovementAllowed:r}=t,o=J(null),i=J(null),{children:a,droppableId:s,type:c,mode:u,direction:f,ignoreContainerClipping:d,isDropDisabled:p,isCombineEnabled:m,snapshot:b,useClone:v,updateViewportMaxScroll:y,getContainerForClone:w}=e,O=D(()=>o.current,[]),U=D((de=null)=>{o.current=de},[]),T=D(()=>i.current,[]),B=D((de=null)=>{i.current=de},[]);Hu({props:e,getDroppableRef:O,getPlaceholderRef:T});const k=D(()=>{r()&&y({maxScroll:ii()})},[r,y]);ku({droppableId:s,type:c,mode:u,direction:f,isDropDisabled:p,isCombineEnabled:m,ignoreContainerClipping:d,getDroppableRef:O});const P=V(()=>ee.createElement(Uu,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:de,data:dt,animate:Ce})=>ee.createElement(Mu,{placeholder:dt,onClose:de,innerRef:B,animate:Ce,contextId:n,onTransitionEnd:k})),[n,k,e.placeholder,e.shouldAnimatePlaceholder,B]),te=V(()=>({innerRef:U,placeholder:P,droppableProps:{"data-rfd-droppable-id":s,"data-rfd-droppable-context-id":n}}),[n,s,P,U]),N=v?v.dragging.draggableId:null,A=V(()=>({droppableId:s,type:c,isUsingCloneFor:N}),[s,N,c]);function ne(){if(!v)return null;const{dragging:de,render:dt}=v,Ce=ee.createElement(Ci,{draggableId:de.draggableId,index:de.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(Se,Ke)=>dt(Se,Ke,de));return ra.createPortal(Ce,w())}return ee.createElement(wr.Provider,{value:A},a(te,b),ne())};function qu(){return document.body||(process.env.NODE_ENV!=="production"?h(!1,"document.body is not ready"):h()),document.body}const uo={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:qu},Si=e=>{let t={...e},n;for(n in uo)e[n]===void 0&&(t={...t,[n]:uo[n]});return t},Mn=(e,t)=>e===t.droppable.type,po=(e,t)=>t.draggables[e.draggable.id],Yu=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},n=pe(i=>({draggableId:i.id,type:i.type,source:{index:i.index,droppableId:i.droppableId}})),r=pe((i,a,s,c,u,f)=>{const d=u.descriptor.id;if(u.descriptor.droppableId===i){const b=f?{render:f,dragging:n(u.descriptor)}:null,v={isDraggingOver:s,draggingOverWith:s?d:null,draggingFromThisWith:d,isUsingPlaceholder:!0};return{placeholder:u.placeholder,shouldAnimatePlaceholder:!1,snapshot:v,useClone:b}}if(!a)return t;if(!c)return e;const m={isDraggingOver:s,draggingOverWith:d,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:u.placeholder,shouldAnimatePlaceholder:!0,snapshot:m,useClone:null}});return(i,a)=>{const s=Si(a),c=s.droppableId,u=s.type,f=!s.isDropDisabled,d=s.renderClone;if(zt(i)){const p=i.critical;if(!Mn(u,p))return t;const m=po(p,i.dimensions),b=Te(i.impact)===c;return r(c,f,b,b,m,d)}if(i.phase==="DROP_ANIMATING"){const p=i.completed;if(!Mn(u,p.critical))return t;const m=po(p.critical,i.dimensions);return r(c,f,Ei(p.result)===c,Te(p.impact)===c,m,d)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){const p=i.completed;if(!Mn(u,p.critical))return t;const m=Te(p.impact)===c,b=!!(p.impact.at&&p.impact.at.type==="COMBINE"),v=p.critical.droppable.id===c;return m?b?e:t:v?e:t}return t}},Ku={updateViewportMaxScroll:Ul},mn=yo(Yu,Ku,(e,t,n)=>({...Si(n),...e,...t}),{context:vr,areStatePropsEqual:Di})(ju),In=G.div`
|
|
165
165
|
overflow-block: auto;
|
|
166
166
|
border-radius: 12px;
|
|
167
167
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
168
168
|
background-color: #fff;
|
|
169
169
|
padding: 1.5rem;
|
|
170
|
-
`,rt=It(Zn)(({theme:e,$hasOrigin:t})=>({display:"flex",alignItems:"flex-start",padding:e.spacing(2),marginBottom:e.spacing(1),gap:e.spacing(2),animation:"fadeIn 0.3s ease-in",borderLeft:t?`4px solid ${e.palette.info.main}`:void 0,backgroundColor:t?`${e.palette.info.light}22`:void 0,"@keyframes fadeIn":{from:{opacity:0,transform:"translateY(10px)"},to:{opacity:1,transform:"translateY(0)"}}})),ot=It(V)(({theme:e})=>({fontWeight:"bold",fontSize:"1.2em",color:e.palette.primary.main,minWidth:30})),it=It(be)({flexGrow:1}),vt=({path:e})=>D(V,{variant:"caption",color:"info.main",sx:{display:"block",fontFamily:"monospace"},children:["from ",e]}),at=It(V)(({statuscolor:e})=>({fontSize:"0.8em",marginTop:4,color:e||"#666",fontWeight:500})),st=It(be)({display:"flex",alignItems:"center",gap:4}),Oi=It("img")(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:4,boxShadow:e.shadows[2],width:60,height:60,objectFit:"cover"})),Q=(e,t)=>{C.setState(n=>({...n,test:{...n.test,steps:n.test.steps.map(r=>r.id===e?{...r,...t}:r)}}))},Xu=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>D(rt,{elevation:1,children:[l(ot,{children:t}),D(it,{children:[l(V,{variant:"body2",color:"text.secondary",fontFamily:"monospace",children:"📄 File Reference"}),l(V,{fontWeight:"bold",children:e.descriptionText||"Add steps from file"}),D(V,{variant:"body2",children:["Path: ",e.path]}),e.overrides&&Object.keys(e.overrides).length>0&&D(be,{sx:{mt:.5,display:"flex",alignItems:"center",flexWrap:"wrap",gap:.5},children:[l(V,{variant:"caption",color:"text.secondary",children:"Overrides:"}),Object.keys(e.overrides).map(a=>l(He,{size:"small",label:`${a}`},a))]}),e.status&&l(at,{statuscolor:e.statusColor,children:e.status}),l(Ce,{control:l($e,{size:"small",checked:e.optional??!1,onChange:(a,s)=>Q(e.id,{optional:s})}),label:"Optional"}),l(z,{size:"small",label:"File path (relative to tests)",value:e.path??"",onChange:a=>Q(e.id,{path:a.target.value}),fullWidth:!0,margin:"dense"})]}),D(st,{children:[r&&l(k,{onClick:r,size:"small","aria-label":"Play",children:l(et,{fontSize:"small"})}),r&&l(k,{onClick:r,size:"small","aria-label":"Play from here",children:l(tt,{fontSize:"small"})}),o&&l(k,{onClick:o,size:"small","aria-label":"Edit",children:l(nt,{fontSize:"small"})}),i&&l(k,{onClick:i,size:"small","aria-label":"Delete",children:l(qe,{fontSize:"small"})})]})]}),Ju=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>D(rt,{elevation:1,$hasOrigin:!!e.originRef,children:[l(ot,{children:t}),e.cropBase64&&l(Oi,{src:e.cropBase64,alt:"tap target"}),D(it,{children:[e.originRef?.path&&l(vt,{path:e.originRef?.path}),D(V,{variant:"body2",color:"text.secondary",fontFamily:"monospace",children:["👆 X: ",Math.round(e.x),", Y: ",Math.round(e.y)]}),l(V,{fontWeight:"bold",children:e.descriptionText||"Tap Interaction"}),e.status&&l(at,{statuscolor:e.statusColor,children:e.status}),l(Ce,{control:l($e,{size:"small",checked:e.optional??!1,onChange:(a,s)=>Q(e.id,{optional:s})}),label:"Optional"}),l(Ce,{control:l($e,{size:"small",checked:e.useLlmOnly??!1,onChange:(a,s)=>Q(e.id,{useLlmOnly:s})}),label:"LLM Only"}),l(z,{size:"small",label:"Element ID",value:e.elementId??"",onChange:a=>Q(e.id,{elementId:a.target.value}),fullWidth:!0,margin:"dense"}),l(z,{size:"small",label:"Timeout (ms)",type:"number",value:e.timeout??"",placeholder:"3000",onChange:a=>Q(e.id,{timeout:a.target.value?parseInt(a.target.value):void 0}),fullWidth:!0,margin:"dense"})]}),D(st,{children:[l(k,{size:"small",onClick:n,title:"Play this step",children:l(et,{})}),l(k,{size:"small",onClick:r,title:"Play from here",children:l(tt,{})}),l(k,{size:"small",onClick:o,title:"Edit",children:l(nt,{})}),l(k,{size:"small",onClick:i,title:"Delete",children:l(qe,{})})]})]}),Zu=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>D(rt,{elevation:1,$hasOrigin:!!e.originRef,children:[l(ot,{children:t}),e.cropBase64&&l(Oi,{src:e.cropBase64,alt:"assert target",sx:{border:2,borderColor:"warning.main"}}),D(it,{children:[e.originRef?.path&&l(vt,{path:e.originRef?.path}),D(V,{variant:"body2",color:"text.secondary",fontFamily:"monospace",children:["👁️ X: ",Math.round(e.x),", Y: ",Math.round(e.y)]}),l(V,{fontWeight:"bold",children:e.descriptionText||"Assert Element"}),e.status&&l(at,{statuscolor:e.statusColor,children:e.status}),l(Ce,{control:l($e,{size:"small",checked:e.optional??!1,onChange:(a,s)=>Q(e.id,{optional:s})}),label:"Optional"}),l(Ce,{control:l($e,{size:"small",checked:e.useLlmOnly??!1,onChange:(a,s)=>Q(e.id,{useLlmOnly:s})}),label:"LLM Only"}),l(z,{size:"small",label:"Element ID",value:e.elementId??"",onChange:a=>Q(e.id,{elementId:a.target.value}),fullWidth:!0,margin:"dense"}),l(z,{size:"small",label:"Timeout (ms)",type:"number",value:e.timeout??"",placeholder:"3000",onChange:a=>Q(e.id,{timeout:a.target.value?parseInt(a.target.value):void 0}),fullWidth:!0,margin:"dense"})]}),D(st,{children:[l(k,{size:"small",onClick:n,title:"Play this step",children:l(et,{})}),l(k,{size:"small",onClick:r,title:"Play from here",children:l(tt,{})}),l(k,{size:"small",onClick:o,title:"Edit",children:l(nt,{})}),l(k,{size:"small",onClick:i,title:"Delete",children:l(qe,{})})]})]}),Qu=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>D(rt,{elevation:1,$hasOrigin:!!e.originRef,children:[l(ot,{children:t}),l(He,{icon:l(ba,{}),label:"Type",color:"primary",variant:"outlined"}),D(it,{children:[e.originRef?.path&&l(vt,{path:e.originRef?.path}),l(V,{fontWeight:"bold",children:e.descriptionText||`Type "${e.text}"`}),e.status&&l(at,{statuscolor:e.statusColor,children:e.status}),l(z,{size:"small",label:"Text to type",value:e.text,onChange:a=>Q(e.id,{text:a.target.value,descriptionText:`Type "${a.target.value}"`}),fullWidth:!0,margin:"dense"}),l(Ce,{control:l($e,{size:"small",checked:e.optional??!1,onChange:(a,s)=>Q(e.id,{optional:s})}),label:"Optional"})]}),D(st,{children:[l(k,{size:"small",onClick:n,title:"Play this step",children:l(et,{})}),l(k,{size:"small",onClick:r,title:"Play from here",children:l(tt,{})}),l(k,{size:"small",onClick:o,title:"Edit",children:l(nt,{})}),l(k,{size:"small",onClick:i,title:"Delete",children:l(qe,{})})]})]}),ep=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>D(rt,{elevation:1,$hasOrigin:!!e.originRef,children:[l(ot,{children:t}),l(He,{icon:l(va,{}),label:"Scroll",color:"secondary",variant:"outlined"}),D(it,{children:[e.originRef?.path&&l(vt,{path:e.originRef?.path}),l(V,{fontWeight:"bold",children:e.descriptionText||`Scroll ${e.direction}`}),e.status&&l(at,{statuscolor:e.statusColor,children:e.status}),D(be,{display:"flex",gap:1,mt:1,children:[l(He,{label:"↑ Up",size:"small",color:e.direction==="up"?"primary":"default",onClick:()=>Q(e.id,{direction:"up",descriptionText:"Scroll up"}),sx:{cursor:"pointer"}}),l(He,{label:"↓ Down",size:"small",color:e.direction==="down"?"primary":"default",onClick:()=>Q(e.id,{direction:"down",descriptionText:"Scroll down"}),sx:{cursor:"pointer"}})]}),l(Ce,{control:l($e,{size:"small",checked:e.optional??!1,onChange:(a,s)=>Q(e.id,{optional:s})}),label:"Optional",sx:{display:"block",mt:1}})]}),D(st,{children:[l(k,{size:"small",onClick:n,title:"Play this step",children:l(et,{})}),l(k,{size:"small",onClick:r,title:"Play from here",children:l(tt,{})}),l(k,{size:"small",onClick:o,title:"Edit",children:l(nt,{})}),l(k,{size:"small",onClick:i,title:"Delete",children:l(qe,{})})]})]}),tp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>D(rt,{elevation:1,$hasOrigin:!!e.originRef,children:[l(ot,{children:t}),l(He,{icon:l(ya,{}),label:"Scroll Until",color:"info",variant:"outlined"}),D(it,{children:[e.originRef?.path&&l(vt,{path:e.originRef?.path}),l(V,{fontWeight:"bold",children:e.descriptionText||"Scroll Until Found"}),e.status&&l(at,{statuscolor:e.statusColor,children:e.status}),l(z,{size:"small",label:"Find text",value:e.text??"",onChange:a=>Q(e.id,{text:a.target.value}),fullWidth:!0,margin:"dense"}),l(z,{size:"small",label:"Element ID",value:e.elementId??"",onChange:a=>Q(e.id,{elementId:a.target.value}),fullWidth:!0,margin:"dense"}),D(be,{display:"flex",gap:1,mt:1,alignItems:"center",children:[l(He,{label:"↑ Up",size:"small",color:e.direction==="up"?"primary":"default",onClick:()=>Q(e.id,{direction:"up"}),sx:{cursor:"pointer"}}),l(He,{label:"↓ Down",size:"small",color:e.direction==="down"?"primary":"default",onClick:()=>Q(e.id,{direction:"down"}),sx:{cursor:"pointer"}}),l(z,{size:"small",label:"Max Scrolls",type:"number",value:e.maxScrolls,onChange:a=>Q(e.id,{maxScrolls:parseInt(a.target.value)||15}),sx:{width:120}})]}),l(Ce,{control:l($e,{size:"small",checked:e.optional??!1,onChange:(a,s)=>Q(e.id,{optional:s})}),label:"Optional",sx:{display:"block",mt:1}})]}),D(st,{children:[l(k,{size:"small",onClick:n,title:"Play this step",children:l(et,{})}),l(k,{size:"small",onClick:r,title:"Play from here",children:l(tt,{})}),l(k,{size:"small",onClick:o,title:"Edit",children:l(nt,{})}),l(k,{size:"small",onClick:i,title:"Delete",children:l(qe,{})})]})]}),np=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>D(rt,{elevation:1,$hasOrigin:!!e.originRef,children:[l(ot,{children:t}),l(He,{icon:l(Da,{}),label:"Deeplink",color:"success",variant:"outlined"}),D(it,{children:[e.originRef?.path&&l(vt,{path:e.originRef?.path}),l(V,{fontWeight:"bold",children:e.descriptionText||"Open Deep Link"}),e.status&&l(at,{statuscolor:e.statusColor,children:e.status}),l(z,{size:"small",label:"URL",value:e.url,onChange:a=>Q(e.id,{url:a.target.value,descriptionText:`Open Deep Link: ${a.target.value}`}),fullWidth:!0,margin:"dense",placeholder:"myapp://home"}),l(Ce,{control:l($e,{size:"small",checked:e.optional??!1,onChange:(a,s)=>Q(e.id,{optional:s})}),label:"Optional",sx:{display:"block"}})]}),D(st,{children:[l(k,{size:"small",onClick:n,title:"Play this step",children:l(et,{})}),l(k,{size:"small",onClick:r,title:"Play from here",children:l(tt,{})}),l(k,{size:"small",onClick:o,title:"Edit",children:l(nt,{})}),l(k,{size:"small",onClick:i,title:"Delete",children:l(qe,{})})]})]}),rp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>D(rt,{elevation:1,$hasOrigin:!!e.originRef,children:[l(ot,{children:t}),l(He,{icon:l(xa,{}),label:"AI",color:"secondary"}),D(it,{children:[e.originRef?.path&&l(vt,{path:e.originRef?.path}),l(V,{fontWeight:"bold",children:e.descriptionText||"AI Instruction"}),e.status&&l(at,{statuscolor:e.statusColor,children:e.status}),l(z,{size:"small",label:"Instruction",value:e.instruction,onChange:a=>Q(e.id,{instruction:a.target.value,descriptionText:`AI: ${a.target.value}`}),fullWidth:!0,margin:"dense",multiline:!0,rows:2}),l(Ce,{control:l($e,{size:"small",checked:e.optional??!1,onChange:(a,s)=>Q(e.id,{optional:s})}),label:"Optional",sx:{display:"block"}})]}),D(st,{children:[l(k,{size:"small",onClick:n,title:"Play this step",children:l(et,{})}),l(k,{size:"small",onClick:r,title:"Play from here",children:l(tt,{})}),l(k,{size:"small",onClick:o,title:"Edit",children:l(nt,{})}),l(k,{size:"small",onClick:i,title:"Delete",children:l(qe,{})})]})]}),ie=e=>{const t="/_serverFn/"+e;return Object.assign(async(...n)=>(await Ea(e))(...n),{url:t,functionId:e,[wa]:!0})},op=ie("605c05774def700303f9889c0f8a28fed026e0b5c36a1563cff2835ee01d26b1"),ip=oe({method:"POST"}).inputValidator(Ca).handler(op,async({data:e})=>(console.log(`Performing tap at ${e.x}, ${e.y}`),await Pa(e),{success:!0})),Ai=me({mutationKey:["device","tap"],mutationFn:e=>ip({data:e})}),ap=ie("07e23aa87e88d53c6c9e3d8e88de788d27d7b10930150bc4fd510d4447aaf3de"),sp=oe({method:"POST"}).inputValidator(Ia).handler(ap,async({data:e})=>(console.log(`Performing type: "${e.text}"`),await Ra(e),{success:!0})),lp=me({mutationKey:["device","type"],mutationFn:e=>sp({data:e})}),cp=ie("5c526b678a7596f28beca76784df0ac58acd292627c5770c0c8029e38e4681ec"),dp=oe({method:"POST"}).inputValidator(Na).handler(cp,async({data:e})=>(console.log(`Performing scroll: ${e.direction}`),await Eo(e),{success:!0})),up=me({mutationKey:["device","scroll"],mutationFn:e=>dp({data:e})}),pp=ie("2b4a002699960d578addbcf4dd83fedcec62444d7da4bf7c2359be991ed6207e"),fp=oe({method:"POST"}).inputValidator(Aa).handler(pp,async({data:e})=>(console.log(`Performing swipe: ${e.x1},${e.y1} -> ${e.x2},${e.y2}`),await $a(e),{success:!0}));me({mutationKey:["device","swipe"],mutationFn:e=>fp({data:e})});const mp=ie("10b616f4aacf11bb275166e4ae03f441f1d7c9a68a670dfadb03b74e1d012900"),hp=oe({method:"POST"}).inputValidator(Sa).handler(mp,async({data:e})=>{console.log(`Performing scroll until: text="${e.text}", id="${e.elementId}", dir=${e.direction}`);for(let t=0;t<(e.maxScrolls??15);t++){console.log(`Scroll Until Loop: ${t+1}/${e.maxScrolls}`);const n=await er(),r=await tr(n);let o=r.hierarchy?.node?.[0];const i=r.hierarchy?.node;if(i){const s=i.find(c=>c.$&&c.$.package!=="com.android.systemui");s&&(o=s)}let a=!1;if(e.elementId&&wo(o,e.elementId)&&(a=!0),!a&&e.text&&ka(o,e.text)&&(a=!0),a)return console.log("Target found!"),{success:!0,scrolls:t};t<(e.maxScrolls??15)-1&&(await Eo({direction:e.direction}),await new Promise(s=>setTimeout(s,1e3)))}return console.log("Target NOT found after max scrolls"),{success:!1}}),gp=me({mutationKey:["device","scrollUntil"],mutationFn:e=>hp({data:e})}),bp=ie("566ee4344553ab6300f847f5de346e037f92d986cb824ba1c313346e62345fbe"),vp=oe({method:"POST"}).inputValidator(Oa).handler(bp,async({data:e})=>(console.log(`Performing deep link: "${e.url}"`),await Ta(e.url),{success:!0})),yp=me({mutationKey:["device","deepLink"],mutationFn:e=>vp({data:e})}),Dp=ie("eea1073a910f7f023004366aafcef05a8c47a3a1a4a09721f71a2efe311ee70f"),xp=oe({method:"POST"}).handler(Dp,async e=>{const{platform:t="android",deviceId:n}=Qn.parse(e.data);return await Ba(t,n),{success:!0}}),Ep=me({mutationKey:["device","appium","start"],mutationFn:e=>xp({data:e})}),wp=ie("6dbdc2968dc27a948c345034d1e55082b86918953b61da020ea8dd5836c79db3"),Cp=oe({method:"GET"}).handler(wp,async e=>{const{platform:t="android",deviceId:n}=Qn.parse(e.data),{isAppiumConnected:r}=await import("./appium-client-D-NjeB35.mjs");return{connected:r(t,n)}}),Ip=(e={})=>hn({queryKey:["device","appium","status",e],queryFn:()=>Cp({data:e}),refetchInterval:2e3}),Np=ie("c5aeaa72b9b3303af5d82ee2fa59e3e90ffef3c3f0fb32707cee49e78ff41066"),Pi=oe({method:"GET"}).handler(Np,async e=>{const t=Qn.parse(e.data),{platform:n="android",deviceId:r}=t,o=async()=>({success:!0,base64:`data:image/png;base64,${(await Ga(r)).toString("base64")}`,format:"base64",platform:"android",deviceId:r}),i=async()=>({success:!0,base64:`data:image/jpeg;base64,${(await Ha(r)).toString("base64")}`,format:"base64",platform:"ios",deviceId:r});try{return n==="android"?await o():await i()}catch(a){return console.error(`Screenshot failed for ${n} ${r||""}:`,a),{success:!1,error:a.message}}}),fo=(e={})=>hn({queryKey:["device","screenshot",e],queryFn:()=>Pi({data:e}),staleTime:0,gcTime:0}),Sp=me({mutationKey:["device","screenshot_mutation"],mutationFn:e=>Pi({data:e})}),Op=ie("05faf0772038a170c70083fd8de4a8b77a40e4ec46e0bbf6878670f02621b5df"),Ap=oe({method:"POST"}).inputValidator(ja).handler(Op,async({data:e})=>{console.log(`Getting element ID at ${e.x}, ${e.y}`);const t=await er(),n=(await tr(t))?.hierarchy?.node?.[0];if(!n)return console.log("No root node found in hierarchy"),{elementId:""};const r=La(n,e.x,e.y);if(!r)return console.log("No element found at coordinates"),{elementId:""};if(r.$&&r.$["resource-id"]?.trim()){let o=r.$["resource-id"];const i=Va(n,r,o);return i>=0?(o=`${o}[${i}]`,console.log(`Found duplicate IDs, using indexed ID: ${o}`)):console.log("Found unique element ID:",o),{elementId:o}}return console.log("Element found but has no resource-id"),{elementId:""}}),Pp=me({mutationKey:["device","hierarchy","getElementId"],mutationFn:e=>Ap({data:e})}),Rp=ie("9bcbf5303827d2a25f347c2054b0121655a82322fa07108653f43246875348f7"),Tp=oe({method:"POST"}).inputValidator(Ua).handler(Rp,async({data:e})=>{console.log(`Looking for element with ID: ${e.elementId}`);const t=await er(),n=(await tr(t))?.hierarchy?.node?.[0];if(!n)return{found:!1};let r=e.elementId,o=null;const i=e.elementId.match(/^(.+)\[(\d+)\]$/);i&&(r=i[1],o=parseInt(i[2]),console.log(`Parsed indexed ID: base="${r}", index=${o}`));let a=null;if(o!==null){const s=_a(n,r);o<s.length&&(a=s[o],console.log(`Found element at index ${o}`))}else a=wo(n,e.elementId);if(a){const s=Fa(a);if(s)return console.log(`Found element at center: ${s.x}, ${s.y}`),{found:!0,x:s.x,y:s.y}}return console.log("Element not found or no bounds"),{found:!1}}),Bp=me({mutationKey:["device","hierarchy","findElementById"],mutationFn:e=>Tp({data:e})}),$p=ie("9f335634267a450fc9f34b1ab33c55da00cb1efc709604b2e3114602020075a2"),kp=oe({method:"POST"}).handler($p,async()=>(console.log("Disabling Android animations..."),await Wa(),{success:!0})),_p=me({mutationKey:["device","adb","disableAnimations"],mutationFn:()=>kp()}),Fp=ie("33557b2fcc5cedc5814d20bca9cd9cde2e45318755de1da4d613e8fa84ee38d1"),Lp=oe({method:"GET"}).handler(Fp,async()=>{const[e,t]=await Promise.all([Ma(),za()]);return[...e,...t]}),Ri=hn({queryKey:["devices"],queryFn:()=>Lp()}),Ti="http://localhost:8080";function Bi(){const e=Re.join(process.cwd(),"mobileboost.config.json");if(!_r.existsSync(e))throw new Error("mobileboost.config.json not found");const t=_r.readFileSync(e,"utf-8");return JSON.parse(t)}function $i(e,t,n,r,o,i){const a=i?`${i.width}x${i.height}`:"",s=`${e}${t||""}${n}${r}${o||""}${a}`;return qa.createHash("sha256").update(s).digest("hex")}function ki(e){const t=atob(e.replace(/^data:image\/\w+;base64,/,"")),n=new ArrayBuffer(t.length),r=new Uint8Array(n);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return new Blob([n],{type:"image/png"})}const Vp=ie("fcbe7e11d05240fa28a1dd79ec8c395f6c03682edbaeb19f469bd78d6399cdde"),Mp=oe({method:"POST"}).inputValidator(e=>Xa.parse(e)).handler(Vp,async({data:e})=>{try{const t=Bi().apiKey;if(!t)throw new Error("API Key missing");const n=$i(t,e.filepath,e.stepNumber,e.stepDescription,e.platform,e.screenResolution),r=new FormData;r.append("hash",n),r.append("screenshot",ki(e.screenshot),"screenshot.png"),r.append("interactionCoordinates",JSON.stringify(e.interactionCoordinates));const o=await fetch(`${Ti}/populate-cache`,{method:"POST",body:r});return o.ok?{success:!0}:(console.error("Failed to populate cache:",await o.text()),{success:!1})}catch(t){return console.error("Error populating cache:",t),{success:!1,error:String(t)}}}),Gp=ie("7d2aacaab26ab11cdc66f03a4ed01b8b38186abf16ab1f9306801ea7769aaa2a"),Wp=oe({method:"POST"}).inputValidator(e=>Ka.parse(e)).handler(Gp,async({data:e})=>{try{const t=Bi().apiKey;if(!t)throw new Error("API Key missing");const n=$i(t,e.filepath,e.stepNumber,e.stepDescription,e.platform,e.screenResolution),r=new FormData;r.append("hash",n),r.append("screenshot",ki(e.screenshot),"screenshot.png");const o=await fetch(`${Ti}/execute-from-cache`,{method:"POST",body:r});if(!o.ok){const s=await o.text();return console.warn("Cache lookup failed:",s),{found:!1}}const i=await o.json(),a=Ya.safeParse(i);return a.success?a.data:(console.error("Invalid cache response:",i),{found:!1})}catch(t){return console.error("Error executing from cache:",t),{found:!1,error:String(t)}}}),zp={mutationFn:e=>Wp({data:e})},Hp={mutationFn:e=>Mp({data:e})},Up=ie("5918013064f9b88efb265b30a770275d6c9d52bf42318f451bab8a47bc850917"),jp=oe({method:"POST"}).inputValidator(Ja).handler(Up,async({data:e})=>await Za(e)),qp=me({mutationKey:["ai","executeAgentStep"],mutationFn:e=>jp({data:e})});async function Xt(){const e=Re.join(process.cwd(),"mobileboost.config.json");let t="./tests";if(await Le.pathExists(e))try{const n=await Le.readJSON(e);n.testDir&&(t=n.testDir)}catch(n){console.error("Error reading config, using default testDir",n)}return Re.resolve(process.cwd(),t)}async function Nn(e){const t=await Xt(),n=Re.resolve(t,e);if(!n.startsWith(t))throw new Error("Invalid path: must be within test directory");return n}j.object({name:j.string(),type:j.enum(["file","directory"]),path:j.string()});const Kp=ie("00fb1fe03e9689cf8c179ba0d5cadc5eeaa6879def224ac38037d70a1a51300d"),Yp=oe({method:"GET"}).handler(Kp,async()=>{const e=await Xt();await Le.ensureDir(e);async function t(n){let r=[];const o=await Le.readdir(n,{withFileTypes:!0});for(const i of o){const a=Re.join(n,i.name),s=Re.relative(e,a);i.isDirectory()?(r.push({name:i.name,type:"directory",path:s}),r=r.concat(await t(a))):r.push({name:i.name,type:"file",path:s})}return r}return{files:await t(e)}}),Sr=hn({queryKey:["files"],queryFn:()=>Yp()}),Xp=j.object({name:j.string(),type:j.enum(["file","directory"]),parentPath:j.string().optional()}),Jp=ie("ac7bf7f1d727949cd28713a8f36bb77e7bd8fc0e48854ed8cb1ee93ce80fb6d0"),Zp=oe({method:"POST"}).inputValidator(Xp).handler(Jp,async({data:e})=>{const t=await Xt(),n=e.parentPath?Re.join(t,e.parentPath):t;if(!Re.resolve(n).startsWith(t))throw new Error("Invalid parent path");const r=Re.join(n,e.name);if(e.type==="directory")await Le.ensureDir(r);else{if(await Le.pathExists(r))throw new Error("File already exists");await Le.writeJSON(r,[],{spaces:2})}return{success:!0}}),Qp=me({mutationKey:["createFile"],mutationFn:e=>Zp({data:e})}),ef=j.object({path:j.string()}),tf=ie("b41e844ce533c224e7c720e69d821468deffcbf208fc008a7f5af83cb0596b15"),nf=oe({method:"POST"}).inputValidator(ef).handler(tf,async({data:e})=>{const t=await Nn(e.path);try{return{content:await Le.readJSON(t),path:e.path}}catch(n){throw console.error("Failed to read file",n),new Error("Failed to read file or invalid format")}}),Or=me({mutationKey:["readFile"],mutationFn:e=>nf({data:e})}),rf=j.object({path:j.string(),content:ga}),of=ie("1b2a0d276d9ce90b2a1d72134c1bf95b9f6b7b049a8f415e8f0da3e6fc5ce4ae"),af=oe({method:"POST"}).inputValidator(rf).handler(of,async({data:e})=>{const t=await Nn(e.path);return await Le.writeJSON(t,e.content,{spaces:2}),{success:!0}}),sf=me({mutationKey:["saveFile"],mutationFn:e=>af({data:e})}),lf=j.object({oldPath:j.string(),newPath:j.string()}),cf=ie("098d52adf25ea567d43facba347871f887828c6ab804021bbfa0f2759209c0c6"),df=oe({method:"POST"}).inputValidator(lf).handler(cf,async({data:e})=>{const t=await Nn(e.oldPath),n=await Xt(),r=Re.resolve(n,e.newPath);if(!r.startsWith(n))throw new Error("Invalid new path");return await Le.rename(t,r),{success:!0}}),uf=me({mutationKey:["renameFile"],mutationFn:e=>df({data:e})}),pf=j.object({sourcePath:j.string(),targetPath:j.string()}),ff=ie("efbbc22c41cf491631b07076417c9ec65d5ac71debfcc00b5a7e0d368772104f"),mf=oe({method:"POST"}).inputValidator(pf).handler(ff,async({data:e})=>{const t=await Nn(e.sourcePath),n=await Xt(),r=Re.resolve(n,e.targetPath);if(!r.startsWith(n))throw new Error("Invalid target path");await Le.ensureDir(r);const o=Re.basename(t),i=Re.join(r,o);return await Le.move(t,i,{overwrite:!1}),{success:!0}});me({mutationKey:["moveFile"],mutationFn:e=>mf({data:e})});const hf=/\{\{\s*([a-zA-Z0-9_.-]+)\s*\}\}/g,gf=e=>{if(!e)return[];const t=new Set;let n;const r=new RegExp(hf);for(;(n=r.exec(e))!==null;)n[1]&&t.add(n[1]);return Array.from(t)};j.number({invalid_type_error:"Must be a number"});const ht=j.number().min(0,"Must be 0 or greater"),bf=j.string().min(1,"This field is required");j.enum(["up","down","left","right"],{errorMap:()=>({message:"Invalid direction"})});const _i=j.enum(["up","down"],{errorMap:()=>({message:"Invalid direction"})}),vf=j.string().min(1,"URL is required").regex(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/.+$/,"Invalid deeplink format (e.g., myapp://screen)"),ve=e=>e?.length?e.map(t=>typeof t=="string"?t:t?.message).filter(Boolean).join(", "):null,yf=({step:e,onSave:t,onCancel:n})=>{const r=ho(()=>({id:Date.now(),type:"tap",descriptionText:"",optional:!1,x:0,y:0,timeout:0,useLlmOnly:!1,text:"",elementId:"",maxScrolls:15,direction:"down",url:"",instruction:"",path:""}),[]),{data:o}=mt(Sr),i=new Set((o?.files||[]).filter(s=>s.type==="file").map(s=>s.path)),a=ts({defaultValues:e??r(),onSubmit:({value:s})=>{if(s.type==="fileRef"){const u=(s.path||"").trim();if(!u||o&&!i.has(u)){alert("The specified file does not exist in your tests directory.");return}}let c;switch(s.type){case"tap":c=ha.parse(s);break;case"assert":c=ma.parse(s);break;case"type":c=fa.parse(s);break;case"scroll":c=pa.parse(s);break;case"scrollUntil":c=ua.parse(s);break;case"deeplink":c=da.parse(s);break;case"ai":c=ca.parse(s);break;case"fileRef":c=la.parse(s);break;default:c=xo.parse(s)}if(!e)C.setState(u=>({...u,test:{...u.test,steps:[...u.test.steps,c]}}));else{const u=c.id;C.setState(f=>({...f,test:{...f.test,steps:f.test.steps.map(d=>d.id===u?c:d)}}))}t()}});return D(Af,{elevation:2,children:[l(V,{variant:"h6",gutterBottom:!0,children:e?"Edit Step":"Add New Step"}),l("form",{onSubmit:s=>{s.preventDefault(),s.stopPropagation(),a.handleSubmit()},children:D(Pf,{children:[l(a.Field,{name:"type",validators:{onChange:kr},children:s=>{const c=s.state.meta.errors?.length>0;return D(gn,{fullWidth:!0,error:c,children:[l(bn,{id:"step-type",children:"Step type"}),l(vn,{labelId:"step-type",id:"step-type",value:s.state.value,label:"Step type",onChange:u=>{const f=u.target.value,d=a.state.values.id;a.reset(),a.setFieldValue("id",d),a.setFieldValue("type",f)},onBlur:s.handleBlur,children:kr.options.map(u=>l(xt,{value:u,children:u},u))}),c&&l(Jn,{children:ve(s.state.meta.errors)})]})}}),l(zt,{sx:{mb:1}}),D(Rf,{children:[l(Ue,{children:"General Settings"}),l(a.Field,{name:"descriptionText",validators:{onChange:j.string().optional()},children:s=>l(z,{id:"description-text",label:"Description",value:s.state.value??"",onChange:c=>s.handleChange(c.target.value),onBlur:s.handleBlur,placeholder:"Enter a description"})}),l(a.Field,{name:"optional",validators:{onChange:j.boolean().optional()},children:s=>l(Ce,{control:l($e,{checked:s.state.value??!1,onChange:c=>s.handleChange(c.target.checked)}),label:"Optional"})})]}),l(a.Subscribe,{selector:s=>s.values.type,children:s=>{switch(s){case"tap":return l(Ef,{form:a});case"assert":return l(wf,{form:a});case"type":return l(Cf,{form:a});case"scroll":return l(If,{form:a});case"scrollUntil":return l(Nf,{form:a});case"deeplink":return l(Sf,{form:a});case"ai":return l(Of,{form:a});case"fileRef":return l(Df,{form:a});default:return null}}}),D(Tf,{children:[l(Ae,{startIcon:l(ns,{}),variant:"contained",type:"submit",children:"Save"}),l(Ae,{startIcon:l(rs,{}),variant:"outlined",color:"error",onClick:n,children:"Cancel"})]})]})})]})},Df=({form:e})=>{const{data:t,isLoading:n}=mt(Sr),r=new Set((t?.files||[]).filter(o=>o.type==="file").map(o=>o.path));return D(lt,{children:[l(Ue,{children:"File Reference"}),l(e.Field,{name:"path",validators:{onChange:({value:o})=>{const i=String(o??"").trim();if(!i)return"This field is required";if(!n&&t&&!r.has(i))return"File not found in tests directory"}},children:o=>{const i=o.state.meta.errors?.length>0,a=i?ve(o.state.meta.errors):n?"Checking files...":"Path is relative to your tests directory";return l(z,{id:"file-path",label:"File path",placeholder:"e.g., test2.json or subfolder/flow.json",value:o.state.value??"",onChange:s=>o.handleChange(s.target.value),onBlur:o.handleBlur,error:i,helperText:a,fullWidth:!0})}}),l(e.Subscribe,{selector:o=>({path:o.values.path,overrides:o.values.overrides}),children:({path:o,overrides:i})=>l(xf,{path:o,overrides:i,onChange:a=>e.setFieldValue("overrides",a),validPaths:r})})]})},xf=({path:e,overrides:t,onChange:n,validPaths:r})=>{const[o,i]=ee.useState(!1),[a,s]=ee.useState({}),c=ce(Or);ee.useEffect(()=>{let p=!1;return(async()=>{if(!e||!r.has(e)){s({});return}i(!0);try{const m=(await c.mutateAsync({path:e}))?.content;Array.isArray(m)?s({}):s(m&&typeof m=="object"?m.params||{}:{})}catch{s({})}finally{p||i(!1)}})(),()=>{p=!0}},[e]);const u=t||{},f=(p,m)=>{const b={...u};m?b[p]=m:delete b[p],n(b)},d=Object.keys(a);return e?D(be,{sx:{mt:2},children:[l(V,{variant:"subtitle2",children:"Param overrides"}),o?l(V,{variant:"caption",color:"text.secondary",children:"Loading referenced test…"}):d.length===0?l(V,{variant:"caption",color:"text.secondary",children:"Referenced test has no params"}):l(be,{sx:{display:"flex",flexDirection:"column",gap:1,mt:1},children:d.map(p=>D(be,{sx:{display:"grid",gridTemplateColumns:"160px 1fr",gap:1,alignItems:"center"},children:[l(z,{size:"small",label:"Key",value:p,disabled:!0}),D(be,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[l(z,{size:"small",label:"Default",value:a[p]??"",disabled:!0}),l(z,{size:"small",label:"Override (optional)",value:u[p]??"",onChange:m=>f(p,m.target.value)})]})]},p))})]}):null},Ef=({form:e})=>D(lt,{children:[l(Ue,{children:"Tap Configuration"}),D(Li,{children:[l(e.Field,{name:"x",validators:{onChange:ht},children:t=>{const n=t.state.meta.errors?.length>0;return l(z,{sx:{flex:1},type:"number",id:"x",label:"X",value:t.state.value??0,onChange:r=>t.handleChange(parseInt(r.target.value)||0),onBlur:t.handleBlur,placeholder:"X coordinate",error:n,helperText:ve(t.state.meta.errors)})}}),l(e.Field,{name:"y",validators:{onChange:ht},children:t=>{const n=t.state.meta.errors?.length>0;return l(z,{sx:{flex:1},type:"number",id:"y",label:"Y",value:t.state.value??0,onChange:r=>t.handleChange(parseInt(r.target.value)||0),onBlur:t.handleBlur,placeholder:"Y coordinate",error:n,helperText:ve(t.state.meta.errors)})}})]}),l(e.Field,{name:"timeout",validators:{onChange:ht},children:t=>{const n=t.state.meta.errors?.length>0;return l(z,{type:"number",id:"timeout",label:"Timeout (ms)",value:t.state.value??0,onChange:r=>t.handleChange(parseInt(r.target.value)||0),onBlur:t.handleBlur,placeholder:"Enter timeout",error:n,helperText:ve(t.state.meta.errors)})}}),l(e.Field,{name:"useLlmOnly",validators:{onChange:j.boolean().optional()},children:t=>l(Ce,{control:l($e,{checked:t.state.value??!1,onChange:n=>t.handleChange(n.target.checked)}),label:"Use LLM only"})})]}),wf=({form:e})=>D(lt,{children:[l(Ue,{children:"Assert Configuration"}),D(Li,{children:[l(e.Field,{name:"x",validators:{onChange:ht},children:t=>{const n=t.state.meta.errors?.length>0;return l(z,{sx:{flex:1},type:"number",id:"x",label:"X",value:t.state.value??0,onChange:r=>t.handleChange(parseInt(r.target.value)||0),onBlur:t.handleBlur,placeholder:"X coordinate",error:n,helperText:ve(t.state.meta.errors)})}}),l(e.Field,{name:"y",validators:{onChange:ht},children:t=>{const n=t.state.meta.errors?.length>0;return l(z,{sx:{flex:1},type:"number",id:"y",label:"Y",value:t.state.value??0,onChange:r=>t.handleChange(parseInt(r.target.value)||0),onBlur:t.handleBlur,placeholder:"Y coordinate",error:n,helperText:ve(t.state.meta.errors)})}})]}),l(e.Field,{name:"timeout",validators:{onChange:ht},children:t=>{const n=t.state.meta.errors?.length>0;return l(z,{type:"number",id:"timeout",label:"Timeout (ms)",value:t.state.value??0,onChange:r=>t.handleChange(parseInt(r.target.value)||0),onBlur:t.handleBlur,placeholder:"Enter timeout",error:n,helperText:ve(t.state.meta.errors)})}}),l(e.Field,{name:"useLlmOnly",validators:{onChange:j.boolean().optional()},children:t=>l(Ce,{control:l($e,{checked:t.state.value??!1,onChange:n=>t.handleChange(n.target.checked)}),label:"Use LLM only"})})]}),Cf=({form:e})=>D(lt,{children:[l(Ue,{children:"Type Configuration"}),l(e.Field,{name:"text",validators:{onChange:({value:t})=>{const n=String(t??"");if(!n||n.trim().length===0)return"This field is required";const r=gf(n);if(r.length===0)return;const o=C.state.test.params||{},i=r.filter(a=>!Object.prototype.hasOwnProperty.call(o,a));if(i.length>0)return`Undefined params: ${i.join(", ")}`}},children:t=>{const n=t.state.meta.errors?.length>0;return l(z,{id:"text",label:"Text to type",value:t.state.value??"",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,placeholder:"Enter text to type (you can use {{param}})",multiline:!0,rows:3,error:n,helperText:ve(t.state.meta.errors)??"Use {{key}} to insert a param value"})}})]}),If=({form:e})=>D(lt,{children:[l(Ue,{children:"Scroll Configuration"}),l(e.Field,{name:"direction",validators:{onChange:_i},children:t=>{const n=t.state.meta.errors?.length>0;return D(gn,{fullWidth:!0,error:n,children:[l(bn,{id:"scroll-direction",children:"Direction"}),D(vn,{labelId:"scroll-direction",id:"scroll-direction",value:t.state.value??"down",label:"Direction",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,children:[l(xt,{value:"up",children:"Up"}),l(xt,{value:"down",children:"Down"})]}),n&&l(Jn,{children:ve(t.state.meta.errors)})]})}})]}),Nf=({form:e})=>D(lt,{children:[l(Ue,{children:"Scroll Until Configuration"}),l(e.Field,{name:"direction",validators:{onChange:_i},children:t=>{const n=t.state.meta.errors?.length>0;return D(gn,{fullWidth:!0,error:n,children:[l(bn,{id:"scroll-until-direction",children:"Direction"}),D(vn,{labelId:"scroll-until-direction",id:"scroll-until-direction",value:t.state.value??"down",label:"Direction",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,children:[l(xt,{value:"up",children:"Up"}),l(xt,{value:"down",children:"Down"})]}),n&&l(Jn,{children:ve(t.state.meta.errors)})]})}}),l(e.Field,{name:"maxScrolls",validators:{onChange:ht},children:t=>{const n=t.state.meta.errors?.length>0;return l(z,{type:"number",id:"max-scrolls",label:"Max Scrolls",value:t.state.value??15,onChange:r=>t.handleChange(parseInt(r.target.value)||15),onBlur:t.handleBlur,placeholder:"Maximum scroll attempts",error:n,helperText:ve(t.state.meta.errors)??"Maximum number of scroll attempts (default: 15)"})}}),l(Ue,{sx:{mt:1},children:"Stop Condition (at least one)"}),l(e.Field,{name:"text",validators:{onChange:j.string().optional()},children:t=>{const n=t.state.meta.errors?.length>0;return l(z,{id:"scroll-until-text",label:"Text to find",value:t.state.value??"",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,placeholder:"Text content to scroll until visible",error:n,helperText:ve(t.state.meta.errors)??"Scroll until this text is visible on screen"})}}),l(e.Field,{name:"elementId",validators:{onChange:j.string().optional()},children:t=>{const n=t.state.meta.errors?.length>0;return l(z,{id:"scroll-until-element-id",label:"Element ID",value:t.state.value??"",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,placeholder:"Element ID to scroll until visible",error:n,helperText:ve(t.state.meta.errors)??"Scroll until element with this ID is visible"})}})]}),Sf=({form:e})=>D(lt,{children:[l(Ue,{children:"Deeplink Configuration"}),l(e.Field,{name:"url",validators:{onChange:vf},children:t=>{const n=t.state.meta.errors?.length>0;return l(z,{id:"url",label:"URL",value:t.state.value??"",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,placeholder:"Enter deeplink URL (e.g., myapp://screen)",fullWidth:!0,error:n,helperText:ve(t.state.meta.errors)})}})]}),Of=({form:e})=>D(lt,{children:[l(Ue,{children:"AI Configuration"}),l(e.Field,{name:"instruction",validators:{onChange:bf},children:t=>{const n=t.state.meta.errors?.length>0;return l(z,{id:"instruction",label:"AI Instruction",value:t.state.value??"",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,placeholder:"Enter instruction for AI to execute",multiline:!0,rows:4,error:n,helperText:ve(t.state.meta.errors)})}})]}),Af=Qe(Zn)`
|
|
170
|
+
`,ot=It(Zn)(({theme:e,$hasOrigin:t})=>({display:"flex",alignItems:"flex-start",padding:e.spacing(2),marginBottom:e.spacing(1),gap:e.spacing(2),animation:"fadeIn 0.3s ease-in",borderLeft:t?`4px solid ${e.palette.info.main}`:void 0,backgroundColor:t?`${e.palette.info.light}22`:void 0,"@keyframes fadeIn":{from:{opacity:0,transform:"translateY(10px)"},to:{opacity:1,transform:"translateY(0)"}}})),it=It(M)(({theme:e})=>({fontWeight:"bold",fontSize:"1.2em",color:e.palette.primary.main,minWidth:30})),at=It(ge)({flexGrow:1}),vt=({path:e})=>x(M,{variant:"caption",color:"info.main",sx:{display:"block",fontFamily:"monospace"},children:["from ",e]}),st=It(M)(({statuscolor:e})=>({fontSize:"0.8em",marginTop:4,color:e||"#666",fontWeight:500})),lt=It(ge)({display:"flex",alignItems:"center",gap:4}),Oi=It("img")(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:4,boxShadow:e.shadows[2],width:60,height:60,objectFit:"cover"})),Q=(e,t)=>{C.setState(n=>({...n,test:{...n.test,steps:n.test.steps.map(r=>r.id===e?{...r,...t}:r)}}))},Xu=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>x(ot,{elevation:1,children:[l(it,{children:t}),x(at,{children:[l(M,{variant:"body2",color:"text.secondary",fontFamily:"monospace",children:"📄 File Reference"}),l(M,{fontWeight:"bold",children:e.descriptionText||"Add steps from file"}),x(M,{variant:"body2",children:["Path: ",e.path]}),e.overrides&&Object.keys(e.overrides).length>0&&x(ge,{sx:{mt:.5,display:"flex",alignItems:"center",flexWrap:"wrap",gap:.5},children:[l(M,{variant:"caption",color:"text.secondary",children:"Overrides:"}),Object.keys(e.overrides).map(a=>l(He,{size:"small",label:`${a}`},a))]}),e.status&&l(st,{statuscolor:e.statusColor,children:e.status}),l(we,{control:l($e,{size:"small",checked:e.optional??!1,onChange:(a,s)=>Q(e.id,{optional:s})}),label:"Optional"}),l(H,{size:"small",label:"File path (relative to tests)",value:e.path??"",onChange:a=>Q(e.id,{path:a.target.value}),fullWidth:!0,margin:"dense"})]}),x(lt,{children:[r&&l(_,{onClick:r,size:"small","aria-label":"Play",children:l(tt,{fontSize:"small"})}),r&&l(_,{onClick:r,size:"small","aria-label":"Play from here",children:l(nt,{fontSize:"small"})}),o&&l(_,{onClick:o,size:"small","aria-label":"Edit",children:l(rt,{fontSize:"small"})}),i&&l(_,{onClick:i,size:"small","aria-label":"Delete",children:l(Ye,{fontSize:"small"})})]})]}),Ju=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>x(ot,{elevation:1,$hasOrigin:!!e.originRef,children:[l(it,{children:t}),e.cropBase64&&l(Oi,{src:e.cropBase64,alt:"tap target"}),x(at,{children:[e.originRef?.path&&l(vt,{path:e.originRef?.path}),x(M,{variant:"body2",color:"text.secondary",fontFamily:"monospace",children:["👆 X: ",Math.round(e.x),", Y: ",Math.round(e.y)]}),l(M,{fontWeight:"bold",children:e.descriptionText||"Tap Interaction"}),e.status&&l(st,{statuscolor:e.statusColor,children:e.status}),l(we,{control:l($e,{size:"small",checked:e.optional??!1,onChange:(a,s)=>Q(e.id,{optional:s})}),label:"Optional"}),l(we,{control:l($e,{size:"small",checked:e.useLlmOnly??!1,onChange:(a,s)=>Q(e.id,{useLlmOnly:s})}),label:"LLM Only"}),l(H,{size:"small",label:"Element ID",value:e.elementId??"",onChange:a=>Q(e.id,{elementId:a.target.value}),fullWidth:!0,margin:"dense"}),l(H,{size:"small",label:"Timeout (ms)",type:"number",value:e.timeout??"",placeholder:"3000",onChange:a=>Q(e.id,{timeout:a.target.value?parseInt(a.target.value):void 0}),fullWidth:!0,margin:"dense"})]}),x(lt,{children:[l(_,{size:"small",onClick:n,title:"Play this step",children:l(tt,{})}),l(_,{size:"small",onClick:r,title:"Play from here",children:l(nt,{})}),l(_,{size:"small",onClick:o,title:"Edit",children:l(rt,{})}),l(_,{size:"small",onClick:i,title:"Delete",children:l(Ye,{})})]})]}),Zu=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>x(ot,{elevation:1,$hasOrigin:!!e.originRef,children:[l(it,{children:t}),e.cropBase64&&l(Oi,{src:e.cropBase64,alt:"assert target",sx:{border:2,borderColor:"warning.main"}}),x(at,{children:[e.originRef?.path&&l(vt,{path:e.originRef?.path}),x(M,{variant:"body2",color:"text.secondary",fontFamily:"monospace",children:["👁️ X: ",Math.round(e.x),", Y: ",Math.round(e.y)]}),l(M,{fontWeight:"bold",children:e.descriptionText||"Assert Element"}),e.status&&l(st,{statuscolor:e.statusColor,children:e.status}),l(we,{control:l($e,{size:"small",checked:e.optional??!1,onChange:(a,s)=>Q(e.id,{optional:s})}),label:"Optional"}),l(we,{control:l($e,{size:"small",checked:e.useLlmOnly??!1,onChange:(a,s)=>Q(e.id,{useLlmOnly:s})}),label:"LLM Only"}),l(H,{size:"small",label:"Element ID",value:e.elementId??"",onChange:a=>Q(e.id,{elementId:a.target.value}),fullWidth:!0,margin:"dense"}),l(H,{size:"small",label:"Timeout (ms)",type:"number",value:e.timeout??"",placeholder:"3000",onChange:a=>Q(e.id,{timeout:a.target.value?parseInt(a.target.value):void 0}),fullWidth:!0,margin:"dense"})]}),x(lt,{children:[l(_,{size:"small",onClick:n,title:"Play this step",children:l(tt,{})}),l(_,{size:"small",onClick:r,title:"Play from here",children:l(nt,{})}),l(_,{size:"small",onClick:o,title:"Edit",children:l(rt,{})}),l(_,{size:"small",onClick:i,title:"Delete",children:l(Ye,{})})]})]}),Qu=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>x(ot,{elevation:1,$hasOrigin:!!e.originRef,children:[l(it,{children:t}),l(He,{icon:l(ba,{}),label:"Type",color:"primary",variant:"outlined"}),x(at,{children:[e.originRef?.path&&l(vt,{path:e.originRef?.path}),l(M,{fontWeight:"bold",children:e.descriptionText||`Type "${e.text}"`}),e.status&&l(st,{statuscolor:e.statusColor,children:e.status}),l(H,{size:"small",label:"Text to type",value:e.text,onChange:a=>Q(e.id,{text:a.target.value,descriptionText:`Type "${a.target.value}"`}),fullWidth:!0,margin:"dense"}),l(we,{control:l($e,{size:"small",checked:e.optional??!1,onChange:(a,s)=>Q(e.id,{optional:s})}),label:"Optional"})]}),x(lt,{children:[l(_,{size:"small",onClick:n,title:"Play this step",children:l(tt,{})}),l(_,{size:"small",onClick:r,title:"Play from here",children:l(nt,{})}),l(_,{size:"small",onClick:o,title:"Edit",children:l(rt,{})}),l(_,{size:"small",onClick:i,title:"Delete",children:l(Ye,{})})]})]}),ep=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>x(ot,{elevation:1,$hasOrigin:!!e.originRef,children:[l(it,{children:t}),l(He,{icon:l(va,{}),label:"Scroll",color:"secondary",variant:"outlined"}),x(at,{children:[e.originRef?.path&&l(vt,{path:e.originRef?.path}),l(M,{fontWeight:"bold",children:e.descriptionText||`Scroll ${e.direction}`}),e.status&&l(st,{statuscolor:e.statusColor,children:e.status}),x(ge,{display:"flex",gap:1,mt:1,children:[l(He,{label:"↑ Up",size:"small",color:e.direction==="up"?"primary":"default",onClick:()=>Q(e.id,{direction:"up",descriptionText:"Scroll up"}),sx:{cursor:"pointer"}}),l(He,{label:"↓ Down",size:"small",color:e.direction==="down"?"primary":"default",onClick:()=>Q(e.id,{direction:"down",descriptionText:"Scroll down"}),sx:{cursor:"pointer"}})]}),l(we,{control:l($e,{size:"small",checked:e.optional??!1,onChange:(a,s)=>Q(e.id,{optional:s})}),label:"Optional",sx:{display:"block",mt:1}})]}),x(lt,{children:[l(_,{size:"small",onClick:n,title:"Play this step",children:l(tt,{})}),l(_,{size:"small",onClick:r,title:"Play from here",children:l(nt,{})}),l(_,{size:"small",onClick:o,title:"Edit",children:l(rt,{})}),l(_,{size:"small",onClick:i,title:"Delete",children:l(Ye,{})})]})]}),tp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>x(ot,{elevation:1,$hasOrigin:!!e.originRef,children:[l(it,{children:t}),l(He,{icon:l(ya,{}),label:"Scroll Until",color:"info",variant:"outlined"}),x(at,{children:[e.originRef?.path&&l(vt,{path:e.originRef?.path}),l(M,{fontWeight:"bold",children:e.descriptionText||"Scroll Until Found"}),e.status&&l(st,{statuscolor:e.statusColor,children:e.status}),l(H,{size:"small",label:"Find text",value:e.text??"",onChange:a=>Q(e.id,{text:a.target.value}),fullWidth:!0,margin:"dense"}),l(H,{size:"small",label:"Element ID",value:e.elementId??"",onChange:a=>Q(e.id,{elementId:a.target.value}),fullWidth:!0,margin:"dense"}),x(ge,{display:"flex",gap:1,mt:1,alignItems:"center",children:[l(He,{label:"↑ Up",size:"small",color:e.direction==="up"?"primary":"default",onClick:()=>Q(e.id,{direction:"up"}),sx:{cursor:"pointer"}}),l(He,{label:"↓ Down",size:"small",color:e.direction==="down"?"primary":"default",onClick:()=>Q(e.id,{direction:"down"}),sx:{cursor:"pointer"}}),l(H,{size:"small",label:"Max Scrolls",type:"number",value:e.maxScrolls,onChange:a=>Q(e.id,{maxScrolls:parseInt(a.target.value)||15}),sx:{width:120}})]}),l(we,{control:l($e,{size:"small",checked:e.optional??!1,onChange:(a,s)=>Q(e.id,{optional:s})}),label:"Optional",sx:{display:"block",mt:1}})]}),x(lt,{children:[l(_,{size:"small",onClick:n,title:"Play this step",children:l(tt,{})}),l(_,{size:"small",onClick:r,title:"Play from here",children:l(nt,{})}),l(_,{size:"small",onClick:o,title:"Edit",children:l(rt,{})}),l(_,{size:"small",onClick:i,title:"Delete",children:l(Ye,{})})]})]}),np=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>x(ot,{elevation:1,$hasOrigin:!!e.originRef,children:[l(it,{children:t}),l(He,{icon:l(xa,{}),label:"Deeplink",color:"success",variant:"outlined"}),x(at,{children:[e.originRef?.path&&l(vt,{path:e.originRef?.path}),l(M,{fontWeight:"bold",children:e.descriptionText||"Open Deep Link"}),e.status&&l(st,{statuscolor:e.statusColor,children:e.status}),l(H,{size:"small",label:"URL",value:e.url,onChange:a=>Q(e.id,{url:a.target.value,descriptionText:`Open Deep Link: ${a.target.value}`}),fullWidth:!0,margin:"dense",placeholder:"myapp://home"}),l(we,{control:l($e,{size:"small",checked:e.optional??!1,onChange:(a,s)=>Q(e.id,{optional:s})}),label:"Optional",sx:{display:"block"}})]}),x(lt,{children:[l(_,{size:"small",onClick:n,title:"Play this step",children:l(tt,{})}),l(_,{size:"small",onClick:r,title:"Play from here",children:l(nt,{})}),l(_,{size:"small",onClick:o,title:"Edit",children:l(rt,{})}),l(_,{size:"small",onClick:i,title:"Delete",children:l(Ye,{})})]})]}),rp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>x(ot,{elevation:1,$hasOrigin:!!e.originRef,children:[l(it,{children:t}),l(He,{icon:l(Da,{}),label:"AI",color:"secondary"}),x(at,{children:[e.originRef?.path&&l(vt,{path:e.originRef?.path}),l(M,{fontWeight:"bold",children:e.descriptionText||"AI Instruction"}),e.status&&l(st,{statuscolor:e.statusColor,children:e.status}),l(H,{size:"small",label:"Instruction",value:e.instruction,onChange:a=>Q(e.id,{instruction:a.target.value,descriptionText:`AI: ${a.target.value}`}),fullWidth:!0,margin:"dense",multiline:!0,rows:2}),l(we,{control:l($e,{size:"small",checked:e.optional??!1,onChange:(a,s)=>Q(e.id,{optional:s})}),label:"Optional",sx:{display:"block"}})]}),x(lt,{children:[l(_,{size:"small",onClick:n,title:"Play this step",children:l(tt,{})}),l(_,{size:"small",onClick:r,title:"Play from here",children:l(nt,{})}),l(_,{size:"small",onClick:o,title:"Edit",children:l(rt,{})}),l(_,{size:"small",onClick:i,title:"Delete",children:l(Ye,{})})]})]}),ae=e=>{const t="/_serverFn/"+e;return Object.assign(async(...n)=>(await Ea(e))(...n),{url:t,functionId:e,[wa]:!0})},op=ae("605c05774def700303f9889c0f8a28fed026e0b5c36a1563cff2835ee01d26b1"),ip=ie({method:"POST"}).inputValidator(Ca).handler(op,async({data:e})=>(console.log(`Performing tap at ${e.x}, ${e.y}`),await Pa(e),{success:!0})),Ai=me({mutationKey:["device","tap"],mutationFn:e=>ip({data:e})}),ap=ae("07e23aa87e88d53c6c9e3d8e88de788d27d7b10930150bc4fd510d4447aaf3de"),sp=ie({method:"POST"}).inputValidator(Ia).handler(ap,async({data:e})=>(console.log(`Performing type: "${e.text}"`),await Ra(e),{success:!0})),lp=me({mutationKey:["device","type"],mutationFn:e=>sp({data:e})}),cp=ae("5c526b678a7596f28beca76784df0ac58acd292627c5770c0c8029e38e4681ec"),dp=ie({method:"POST"}).inputValidator(Na).handler(cp,async({data:e})=>(console.log(`Performing scroll: ${e.direction}`),await Eo(e),{success:!0})),up=me({mutationKey:["device","scroll"],mutationFn:e=>dp({data:e})}),pp=ae("2b4a002699960d578addbcf4dd83fedcec62444d7da4bf7c2359be991ed6207e"),fp=ie({method:"POST"}).inputValidator(Aa).handler(pp,async({data:e})=>(console.log(`Performing swipe: ${e.x1},${e.y1} -> ${e.x2},${e.y2}`),await $a(e),{success:!0}));me({mutationKey:["device","swipe"],mutationFn:e=>fp({data:e})});const mp=ae("10b616f4aacf11bb275166e4ae03f441f1d7c9a68a670dfadb03b74e1d012900"),hp=ie({method:"POST"}).inputValidator(Sa).handler(mp,async({data:e})=>{console.log(`Performing scroll until: text="${e.text}", id="${e.elementId}", dir=${e.direction}`);for(let t=0;t<(e.maxScrolls??15);t++){console.log(`Scroll Until Loop: ${t+1}/${e.maxScrolls}`);const n=await er(),r=await tr(n);let o=r.hierarchy?.node?.[0];const i=r.hierarchy?.node;if(i){const s=i.find(c=>c.$&&c.$.package!=="com.android.systemui");s&&(o=s)}let a=!1;if(e.elementId&&wo(o,e.elementId)&&(a=!0),!a&&e.text&&_a(o,e.text)&&(a=!0),a)return console.log("Target found!"),{success:!0,scrolls:t};t<(e.maxScrolls??15)-1&&(await Eo({direction:e.direction}),await new Promise(s=>setTimeout(s,1e3)))}return console.log("Target NOT found after max scrolls"),{success:!1}}),gp=me({mutationKey:["device","scrollUntil"],mutationFn:e=>hp({data:e})}),bp=ae("566ee4344553ab6300f847f5de346e037f92d986cb824ba1c313346e62345fbe"),vp=ie({method:"POST"}).inputValidator(Oa).handler(bp,async({data:e})=>(console.log(`Performing deep link: "${e.url}"`),await Ta(e.url),{success:!0})),yp=me({mutationKey:["device","deepLink"],mutationFn:e=>vp({data:e})}),xp=ae("eea1073a910f7f023004366aafcef05a8c47a3a1a4a09721f71a2efe311ee70f"),Dp=ie({method:"POST"}).handler(xp,async e=>{const{platform:t="android",deviceId:n}=Qn.parse(e.data);return await Ba(t,n),{success:!0}}),Ep=me({mutationKey:["device","appium","start"],mutationFn:e=>Dp({data:e})}),wp=ae("6dbdc2968dc27a948c345034d1e55082b86918953b61da020ea8dd5836c79db3"),Cp=ie({method:"GET"}).handler(wp,async e=>{const{platform:t="android",deviceId:n}=Qn.parse(e.data),{isAppiumConnected:r}=await import("./appium-client-D-NjeB35.mjs");return{connected:r(t,n)}}),Ip=(e={})=>hn({queryKey:["device","appium","status",e],queryFn:()=>Cp({data:e}),refetchInterval:2e3}),Np=ae("c5aeaa72b9b3303af5d82ee2fa59e3e90ffef3c3f0fb32707cee49e78ff41066"),Pi=ie({method:"GET"}).handler(Np,async e=>{const t=Qn.parse(e.data),{platform:n="android",deviceId:r}=t,o=async()=>({success:!0,base64:`data:image/png;base64,${(await Ga(r)).toString("base64")}`,format:"base64",platform:"android",deviceId:r}),i=async()=>({success:!0,base64:`data:image/jpeg;base64,${(await Ha(r)).toString("base64")}`,format:"base64",platform:"ios",deviceId:r});try{return n==="android"?await o():await i()}catch(a){return console.error(`Screenshot failed for ${n} ${r||""}:`,a),{success:!1,error:a.message}}}),fo=(e={})=>hn({queryKey:["device","screenshot",e],queryFn:()=>Pi({data:e}),staleTime:0,gcTime:0}),Sp=me({mutationKey:["device","screenshot_mutation"],mutationFn:e=>Pi({data:e})}),Op=ae("05faf0772038a170c70083fd8de4a8b77a40e4ec46e0bbf6878670f02621b5df"),Ap=ie({method:"POST"}).inputValidator(ja).handler(Op,async({data:e})=>{console.log(`Getting element ID at ${e.x}, ${e.y}`);const t=await er(),n=(await tr(t))?.hierarchy?.node?.[0];if(!n)return console.log("No root node found in hierarchy"),{elementId:""};const r=La(n,e.x,e.y);if(!r)return console.log("No element found at coordinates"),{elementId:""};if(r.$&&r.$["resource-id"]?.trim()){let o=r.$["resource-id"];const i=Va(n,r,o);return i>=0?(o=`${o}[${i}]`,console.log(`Found duplicate IDs, using indexed ID: ${o}`)):console.log("Found unique element ID:",o),{elementId:o}}return console.log("Element found but has no resource-id"),{elementId:""}}),Pp=me({mutationKey:["device","hierarchy","getElementId"],mutationFn:e=>Ap({data:e})}),Rp=ae("9bcbf5303827d2a25f347c2054b0121655a82322fa07108653f43246875348f7"),Tp=ie({method:"POST"}).inputValidator(Ua).handler(Rp,async({data:e})=>{console.log(`Looking for element with ID: ${e.elementId}`);const t=await er(),n=(await tr(t))?.hierarchy?.node?.[0];if(!n)return{found:!1};let r=e.elementId,o=null;const i=e.elementId.match(/^(.+)\[(\d+)\]$/);i&&(r=i[1],o=parseInt(i[2]),console.log(`Parsed indexed ID: base="${r}", index=${o}`));let a=null;if(o!==null){const s=ka(n,r);o<s.length&&(a=s[o],console.log(`Found element at index ${o}`))}else a=wo(n,e.elementId);if(a){const s=Fa(a);if(s)return console.log(`Found element at center: ${s.x}, ${s.y}`),{found:!0,x:s.x,y:s.y}}return console.log("Element not found or no bounds"),{found:!1}}),Bp=me({mutationKey:["device","hierarchy","findElementById"],mutationFn:e=>Tp({data:e})}),$p=ae("9f335634267a450fc9f34b1ab33c55da00cb1efc709604b2e3114602020075a2"),_p=ie({method:"POST"}).handler($p,async()=>(console.log("Disabling Android animations..."),await Wa(),{success:!0})),kp=me({mutationKey:["device","adb","disableAnimations"],mutationFn:()=>_p()}),Fp=ae("33557b2fcc5cedc5814d20bca9cd9cde2e45318755de1da4d613e8fa84ee38d1"),Lp=ie({method:"GET"}).handler(Fp,async()=>{const[e,t]=await Promise.all([Ma(),za()]);return[...e,...t]}),Ri=hn({queryKey:["devices"],queryFn:()=>Lp()}),Ti="https://cache.mobileboost.io";function Bi(){const e=Re.join(process.cwd(),"mobileboost.config.json");if(!kr.existsSync(e))throw new Error("mobileboost.config.json not found");const t=kr.readFileSync(e,"utf-8");return JSON.parse(t)}function $i(e,t,n,r,o,i){const a=i?`${i.width}x${i.height}`:"",s=`${e}${t||""}${n}${r}${o||""}${a}`;return qa.createHash("sha256").update(s).digest("hex")}function Vp(e){const t=atob(e.replace(/^data:image\/\w+;base64,/,"")),n=new ArrayBuffer(t.length),r=new Uint8Array(n);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return new Blob([n],{type:"image/png"})}const Mp=ae("fcbe7e11d05240fa28a1dd79ec8c395f6c03682edbaeb19f469bd78d6399cdde"),Gp=ie({method:"POST"}).inputValidator(e=>Xa.parse(e)).handler(Mp,async({data:e})=>{try{const t=Bi().apiKey;if(!t)throw new Error("API Key missing");const n=$i(t,e.filepath,e.stepNumber,e.stepDescription,e.platform,e.screenResolution),r=e.screenshot.replace(/^data:image\/\w+;base64,/,""),o=`tap on x=${e.interactionCoordinates.x} y=${e.interactionCoordinates.y}`,i=[{screenshot:r,commands:[o]}],a=await fetch(`${Ti}/populate-cache?hash=${n}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return a.ok?{success:!0}:(console.error("Failed to populate cache:",await a.text()),{success:!1})}catch(t){return console.error("Error populating cache:",t),{success:!1,error:String(t)}}}),Wp=ae("7d2aacaab26ab11cdc66f03a4ed01b8b38186abf16ab1f9306801ea7769aaa2a"),zp=ie({method:"POST"}).inputValidator(e=>Ya.parse(e)).handler(Wp,async({data:e})=>{try{const t=Bi().apiKey;if(!t)throw new Error("API Key missing");const n=$i(t,e.filepath,e.stepNumber,e.stepDescription,e.platform,e.screenResolution),r=new FormData;r.append("hash",n),r.append("screenshot",Vp(e.screenshot),"screenshot.png"),e.highest_used_index!==void 0&&e.highest_used_index!==null&&r.append("highest_used_index",String(e.highest_used_index));const o=await fetch(`${Ti}/execute-from-cache`,{method:"POST",body:r});if(!o.ok){const s=await o.text();return console.warn("Cache lookup failed:",s),{found:!1}}const i=await o.json(),a=Ka.safeParse(i);return a.success?a.data:(console.error("Invalid cache response:",i),{found:!1})}catch(t){return console.error("Error executing from cache:",t),{found:!1,error:String(t)}}}),Hp={mutationFn:e=>zp({data:e})},Up={mutationFn:e=>Gp({data:e})},jp=ae("5918013064f9b88efb265b30a770275d6c9d52bf42318f451bab8a47bc850917"),qp=ie({method:"POST"}).inputValidator(Ja).handler(jp,async({data:e})=>await Za(e)),Yp=me({mutationKey:["ai","executeAgentStep"],mutationFn:e=>qp({data:e})});async function Jt(){const e=Re.join(process.cwd(),"mobileboost.config.json");let t="./tests";if(await Fe.pathExists(e))try{const n=await Fe.readJSON(e);n.testDir&&(t=n.testDir)}catch(n){console.error("Error reading config, using default testDir",n)}return Re.resolve(process.cwd(),t)}async function Nn(e){const t=await Jt(),n=Re.resolve(t,e);if(!n.startsWith(t))throw new Error("Invalid path: must be within test directory");return n}q.object({name:q.string(),type:q.enum(["file","directory"]),path:q.string()});const Kp=ae("00fb1fe03e9689cf8c179ba0d5cadc5eeaa6879def224ac38037d70a1a51300d"),Xp=ie({method:"GET"}).handler(Kp,async()=>{const e=await Jt();await Fe.ensureDir(e);async function t(n){let r=[];const o=await Fe.readdir(n,{withFileTypes:!0});for(const i of o){const a=Re.join(n,i.name),s=Re.relative(e,a);i.isDirectory()?(r.push({name:i.name,type:"directory",path:s}),r=r.concat(await t(a))):r.push({name:i.name,type:"file",path:s})}return r}return{files:await t(e)}}),Sr=hn({queryKey:["files"],queryFn:()=>Xp()}),Jp=q.object({name:q.string(),type:q.enum(["file","directory"]),parentPath:q.string().optional()}),Zp=ae("ac7bf7f1d727949cd28713a8f36bb77e7bd8fc0e48854ed8cb1ee93ce80fb6d0"),Qp=ie({method:"POST"}).inputValidator(Jp).handler(Zp,async({data:e})=>{const t=await Jt(),n=e.parentPath?Re.join(t,e.parentPath):t;if(!Re.resolve(n).startsWith(t))throw new Error("Invalid parent path");const r=Re.join(n,e.name);if(e.type==="directory")await Fe.ensureDir(r);else{if(await Fe.pathExists(r))throw new Error("File already exists");await Fe.writeJSON(r,[],{spaces:2})}return{success:!0}}),ef=me({mutationKey:["createFile"],mutationFn:e=>Qp({data:e})}),tf=q.object({path:q.string()}),nf=ae("b41e844ce533c224e7c720e69d821468deffcbf208fc008a7f5af83cb0596b15"),rf=ie({method:"POST"}).inputValidator(tf).handler(nf,async({data:e})=>{const t=await Nn(e.path);try{return{content:await Fe.readJSON(t),path:e.path}}catch(n){throw console.error("Failed to read file",n),new Error("Failed to read file or invalid format")}}),Or=me({mutationKey:["readFile"],mutationFn:e=>rf({data:e})}),of=q.object({path:q.string(),content:ga}),af=ae("1b2a0d276d9ce90b2a1d72134c1bf95b9f6b7b049a8f415e8f0da3e6fc5ce4ae"),sf=ie({method:"POST"}).inputValidator(of).handler(af,async({data:e})=>{const t=await Nn(e.path);return await Fe.writeJSON(t,e.content,{spaces:2}),{success:!0}}),lf=me({mutationKey:["saveFile"],mutationFn:e=>sf({data:e})}),cf=q.object({oldPath:q.string(),newPath:q.string()}),df=ae("098d52adf25ea567d43facba347871f887828c6ab804021bbfa0f2759209c0c6"),uf=ie({method:"POST"}).inputValidator(cf).handler(df,async({data:e})=>{const t=await Nn(e.oldPath),n=await Jt(),r=Re.resolve(n,e.newPath);if(!r.startsWith(n))throw new Error("Invalid new path");return await Fe.rename(t,r),{success:!0}}),pf=me({mutationKey:["renameFile"],mutationFn:e=>uf({data:e})}),ff=q.object({sourcePath:q.string(),targetPath:q.string()}),mf=ae("efbbc22c41cf491631b07076417c9ec65d5ac71debfcc00b5a7e0d368772104f"),hf=ie({method:"POST"}).inputValidator(ff).handler(mf,async({data:e})=>{const t=await Nn(e.sourcePath),n=await Jt(),r=Re.resolve(n,e.targetPath);if(!r.startsWith(n))throw new Error("Invalid target path");await Fe.ensureDir(r);const o=Re.basename(t),i=Re.join(r,o);return await Fe.move(t,i,{overwrite:!1}),{success:!0}});me({mutationKey:["moveFile"],mutationFn:e=>hf({data:e})});const gf=/\{\{\s*([a-zA-Z0-9_.-]+)\s*\}\}/g,bf=e=>{if(!e)return[];const t=new Set;let n;const r=new RegExp(gf);for(;(n=r.exec(e))!==null;)n[1]&&t.add(n[1]);return Array.from(t)};q.number({invalid_type_error:"Must be a number"});const ht=q.number().min(0,"Must be 0 or greater"),vf=q.string().min(1,"This field is required");q.enum(["up","down","left","right"],{errorMap:()=>({message:"Invalid direction"})});const _i=q.enum(["up","down"],{errorMap:()=>({message:"Invalid direction"})}),yf=q.string().min(1,"URL is required").regex(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/.+$/,"Invalid deeplink format (e.g., myapp://screen)"),be=e=>e?.length?e.map(t=>typeof t=="string"?t:t?.message).filter(Boolean).join(", "):null,xf=({step:e,onSave:t,onCancel:n})=>{const r=ho(()=>({id:Date.now(),type:"tap",descriptionText:"",optional:!1,x:0,y:0,timeout:0,useLlmOnly:!1,text:"",elementId:"",maxScrolls:15,direction:"down",url:"",instruction:"",path:""}),[]),{data:o}=mt(Sr),i=new Set((o?.files||[]).filter(s=>s.type==="file").map(s=>s.path)),a=ts({defaultValues:e??r(),onSubmit:({value:s})=>{if(s.type==="fileRef"){const u=(s.path||"").trim();if(!u||o&&!i.has(u)){alert("The specified file does not exist in your tests directory.");return}}let c;switch(s.type){case"tap":c=ha.parse(s);break;case"assert":c=ma.parse(s);break;case"type":c=fa.parse(s);break;case"scroll":c=pa.parse(s);break;case"scrollUntil":c=ua.parse(s);break;case"deeplink":c=da.parse(s);break;case"ai":c=ca.parse(s);break;case"fileRef":c=la.parse(s);break;default:c=Do.parse(s)}if(!e)C.setState(u=>({...u,test:{...u.test,steps:[...u.test.steps,c]}}));else{const u=c.id;C.setState(f=>({...f,test:{...f.test,steps:f.test.steps.map(d=>d.id===u?c:d)}}))}t()}});return x(Pf,{elevation:2,children:[l(M,{variant:"h6",gutterBottom:!0,children:e?"Edit Step":"Add New Step"}),l("form",{onSubmit:s=>{s.preventDefault(),s.stopPropagation(),a.handleSubmit()},children:x(Rf,{children:[l(a.Field,{name:"type",validators:{onChange:_r},children:s=>{const c=s.state.meta.errors?.length>0;return x(gn,{fullWidth:!0,error:c,children:[l(bn,{id:"step-type",children:"Step type"}),l(vn,{labelId:"step-type",id:"step-type",value:s.state.value,label:"Step type",onChange:u=>{const f=u.target.value,d=a.state.values.id;a.reset(),a.setFieldValue("id",d),a.setFieldValue("type",f)},onBlur:s.handleBlur,children:_r.options.map(u=>l(Dt,{value:u,children:u},u))}),c&&l(Jn,{children:be(s.state.meta.errors)})]})}}),l(Ht,{sx:{mb:1}}),x(Tf,{children:[l(Ue,{children:"General Settings"}),l(a.Field,{name:"descriptionText",validators:{onChange:q.string().optional()},children:s=>l(H,{id:"description-text",label:"Description",value:s.state.value??"",onChange:c=>s.handleChange(c.target.value),onBlur:s.handleBlur,placeholder:"Enter a description"})}),l(a.Field,{name:"optional",validators:{onChange:q.boolean().optional()},children:s=>l(we,{control:l($e,{checked:s.state.value??!1,onChange:c=>s.handleChange(c.target.checked)}),label:"Optional"})})]}),l(a.Subscribe,{selector:s=>s.values.type,children:s=>{switch(s){case"tap":return l(wf,{form:a});case"assert":return l(Cf,{form:a});case"type":return l(If,{form:a});case"scroll":return l(Nf,{form:a});case"scrollUntil":return l(Sf,{form:a});case"deeplink":return l(Of,{form:a});case"ai":return l(Af,{form:a});case"fileRef":return l(Df,{form:a});default:return null}}}),x(Bf,{children:[l(Ae,{startIcon:l(ns,{}),variant:"contained",type:"submit",children:"Save"}),l(Ae,{startIcon:l(rs,{}),variant:"outlined",color:"error",onClick:n,children:"Cancel"})]})]})})]})},Df=({form:e})=>{const{data:t,isLoading:n}=mt(Sr),r=new Set((t?.files||[]).filter(o=>o.type==="file").map(o=>o.path));return x(ct,{children:[l(Ue,{children:"File Reference"}),l(e.Field,{name:"path",validators:{onChange:({value:o})=>{const i=String(o??"").trim();if(!i)return"This field is required";if(!n&&t&&!r.has(i))return"File not found in tests directory"}},children:o=>{const i=o.state.meta.errors?.length>0,a=i?be(o.state.meta.errors):n?"Checking files...":"Path is relative to your tests directory";return l(H,{id:"file-path",label:"File path",placeholder:"e.g., test2.json or subfolder/flow.json",value:o.state.value??"",onChange:s=>o.handleChange(s.target.value),onBlur:o.handleBlur,error:i,helperText:a,fullWidth:!0})}}),l(e.Subscribe,{selector:o=>({path:o.values.path,overrides:o.values.overrides}),children:({path:o,overrides:i})=>l(Ef,{path:o,overrides:i,onChange:a=>e.setFieldValue("overrides",a),validPaths:r})})]})},Ef=({path:e,overrides:t,onChange:n,validPaths:r})=>{const[o,i]=ee.useState(!1),[a,s]=ee.useState({}),c=ce(Or);ee.useEffect(()=>{let p=!1;return(async()=>{if(!e||!r.has(e)){s({});return}i(!0);try{const m=(await c.mutateAsync({path:e}))?.content;Array.isArray(m)?s({}):s(m&&typeof m=="object"?m.params||{}:{})}catch{s({})}finally{p||i(!1)}})(),()=>{p=!0}},[e]);const u=t||{},f=(p,m)=>{const b={...u};m?b[p]=m:delete b[p],n(b)},d=Object.keys(a);return e?x(ge,{sx:{mt:2},children:[l(M,{variant:"subtitle2",children:"Param overrides"}),o?l(M,{variant:"caption",color:"text.secondary",children:"Loading referenced test…"}):d.length===0?l(M,{variant:"caption",color:"text.secondary",children:"Referenced test has no params"}):l(ge,{sx:{display:"flex",flexDirection:"column",gap:1,mt:1},children:d.map(p=>x(ge,{sx:{display:"grid",gridTemplateColumns:"160px 1fr",gap:1,alignItems:"center"},children:[l(H,{size:"small",label:"Key",value:p,disabled:!0}),x(ge,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[l(H,{size:"small",label:"Default",value:a[p]??"",disabled:!0}),l(H,{size:"small",label:"Override (optional)",value:u[p]??"",onChange:m=>f(p,m.target.value)})]})]},p))})]}):null},wf=({form:e})=>x(ct,{children:[l(Ue,{children:"Tap Configuration"}),x(Fi,{children:[l(e.Field,{name:"x",validators:{onChange:ht},children:t=>{const n=t.state.meta.errors?.length>0;return l(H,{sx:{flex:1},type:"number",id:"x",label:"X",value:t.state.value??0,onChange:r=>t.handleChange(parseInt(r.target.value)||0),onBlur:t.handleBlur,placeholder:"X coordinate",error:n,helperText:be(t.state.meta.errors)})}}),l(e.Field,{name:"y",validators:{onChange:ht},children:t=>{const n=t.state.meta.errors?.length>0;return l(H,{sx:{flex:1},type:"number",id:"y",label:"Y",value:t.state.value??0,onChange:r=>t.handleChange(parseInt(r.target.value)||0),onBlur:t.handleBlur,placeholder:"Y coordinate",error:n,helperText:be(t.state.meta.errors)})}})]}),l(e.Field,{name:"timeout",validators:{onChange:ht},children:t=>{const n=t.state.meta.errors?.length>0;return l(H,{type:"number",id:"timeout",label:"Timeout (ms)",value:t.state.value??0,onChange:r=>t.handleChange(parseInt(r.target.value)||0),onBlur:t.handleBlur,placeholder:"Enter timeout",error:n,helperText:be(t.state.meta.errors)})}}),l(e.Field,{name:"useLlmOnly",validators:{onChange:q.boolean().optional()},children:t=>l(we,{control:l($e,{checked:t.state.value??!1,onChange:n=>t.handleChange(n.target.checked)}),label:"Use LLM only"})})]}),Cf=({form:e})=>x(ct,{children:[l(Ue,{children:"Assert Configuration"}),x(Fi,{children:[l(e.Field,{name:"x",validators:{onChange:ht},children:t=>{const n=t.state.meta.errors?.length>0;return l(H,{sx:{flex:1},type:"number",id:"x",label:"X",value:t.state.value??0,onChange:r=>t.handleChange(parseInt(r.target.value)||0),onBlur:t.handleBlur,placeholder:"X coordinate",error:n,helperText:be(t.state.meta.errors)})}}),l(e.Field,{name:"y",validators:{onChange:ht},children:t=>{const n=t.state.meta.errors?.length>0;return l(H,{sx:{flex:1},type:"number",id:"y",label:"Y",value:t.state.value??0,onChange:r=>t.handleChange(parseInt(r.target.value)||0),onBlur:t.handleBlur,placeholder:"Y coordinate",error:n,helperText:be(t.state.meta.errors)})}})]}),l(e.Field,{name:"timeout",validators:{onChange:ht},children:t=>{const n=t.state.meta.errors?.length>0;return l(H,{type:"number",id:"timeout",label:"Timeout (ms)",value:t.state.value??0,onChange:r=>t.handleChange(parseInt(r.target.value)||0),onBlur:t.handleBlur,placeholder:"Enter timeout",error:n,helperText:be(t.state.meta.errors)})}}),l(e.Field,{name:"useLlmOnly",validators:{onChange:q.boolean().optional()},children:t=>l(we,{control:l($e,{checked:t.state.value??!1,onChange:n=>t.handleChange(n.target.checked)}),label:"Use LLM only"})})]}),If=({form:e})=>x(ct,{children:[l(Ue,{children:"Type Configuration"}),l(e.Field,{name:"text",validators:{onChange:({value:t})=>{const n=String(t??"");if(!n||n.trim().length===0)return"This field is required";const r=bf(n);if(r.length===0)return;const o=C.state.test.params||{},i=r.filter(a=>!Object.prototype.hasOwnProperty.call(o,a));if(i.length>0)return`Undefined params: ${i.join(", ")}`}},children:t=>{const n=t.state.meta.errors?.length>0;return l(H,{id:"text",label:"Text to type",value:t.state.value??"",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,placeholder:"Enter text to type (you can use {{param}})",multiline:!0,rows:3,error:n,helperText:be(t.state.meta.errors)??"Use {{key}} to insert a param value"})}})]}),Nf=({form:e})=>x(ct,{children:[l(Ue,{children:"Scroll Configuration"}),l(e.Field,{name:"direction",validators:{onChange:_i},children:t=>{const n=t.state.meta.errors?.length>0;return x(gn,{fullWidth:!0,error:n,children:[l(bn,{id:"scroll-direction",children:"Direction"}),x(vn,{labelId:"scroll-direction",id:"scroll-direction",value:t.state.value??"down",label:"Direction",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,children:[l(Dt,{value:"up",children:"Up"}),l(Dt,{value:"down",children:"Down"})]}),n&&l(Jn,{children:be(t.state.meta.errors)})]})}})]}),Sf=({form:e})=>x(ct,{children:[l(Ue,{children:"Scroll Until Configuration"}),l(e.Field,{name:"direction",validators:{onChange:_i},children:t=>{const n=t.state.meta.errors?.length>0;return x(gn,{fullWidth:!0,error:n,children:[l(bn,{id:"scroll-until-direction",children:"Direction"}),x(vn,{labelId:"scroll-until-direction",id:"scroll-until-direction",value:t.state.value??"down",label:"Direction",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,children:[l(Dt,{value:"up",children:"Up"}),l(Dt,{value:"down",children:"Down"})]}),n&&l(Jn,{children:be(t.state.meta.errors)})]})}}),l(e.Field,{name:"maxScrolls",validators:{onChange:ht},children:t=>{const n=t.state.meta.errors?.length>0;return l(H,{type:"number",id:"max-scrolls",label:"Max Scrolls",value:t.state.value??15,onChange:r=>t.handleChange(parseInt(r.target.value)||15),onBlur:t.handleBlur,placeholder:"Maximum scroll attempts",error:n,helperText:be(t.state.meta.errors)??"Maximum number of scroll attempts (default: 15)"})}}),l(Ue,{sx:{mt:1},children:"Stop Condition (at least one)"}),l(e.Field,{name:"text",validators:{onChange:q.string().optional()},children:t=>{const n=t.state.meta.errors?.length>0;return l(H,{id:"scroll-until-text",label:"Text to find",value:t.state.value??"",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,placeholder:"Text content to scroll until visible",error:n,helperText:be(t.state.meta.errors)??"Scroll until this text is visible on screen"})}}),l(e.Field,{name:"elementId",validators:{onChange:q.string().optional()},children:t=>{const n=t.state.meta.errors?.length>0;return l(H,{id:"scroll-until-element-id",label:"Element ID",value:t.state.value??"",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,placeholder:"Element ID to scroll until visible",error:n,helperText:be(t.state.meta.errors)??"Scroll until element with this ID is visible"})}})]}),Of=({form:e})=>x(ct,{children:[l(Ue,{children:"Deeplink Configuration"}),l(e.Field,{name:"url",validators:{onChange:yf},children:t=>{const n=t.state.meta.errors?.length>0;return l(H,{id:"url",label:"URL",value:t.state.value??"",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,placeholder:"Enter deeplink URL (e.g., myapp://screen)",fullWidth:!0,error:n,helperText:be(t.state.meta.errors)})}})]}),Af=({form:e})=>x(ct,{children:[l(Ue,{children:"AI Configuration"}),l(e.Field,{name:"instruction",validators:{onChange:vf},children:t=>{const n=t.state.meta.errors?.length>0;return l(H,{id:"instruction",label:"AI Instruction",value:t.state.value??"",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,placeholder:"Enter instruction for AI to execute",multiline:!0,rows:4,error:n,helperText:be(t.state.meta.errors)})}})]}),Pf=et(Zn)`
|
|
171
171
|
padding: 1.5rem;
|
|
172
172
|
margin-bottom: 1.5rem;
|
|
173
173
|
border: 1px solid #e0e0e0;
|
|
174
174
|
border-radius: 8px;
|
|
175
|
-
`,
|
|
175
|
+
`,Rf=et(ge)`
|
|
176
176
|
display: flex;
|
|
177
177
|
flex-direction: column;
|
|
178
178
|
gap: 1.25rem;
|
|
179
|
-
`,
|
|
179
|
+
`,ki=et(ge)`
|
|
180
180
|
display: flex;
|
|
181
181
|
flex-direction: column;
|
|
182
182
|
gap: 1rem;
|
|
183
183
|
padding: 1rem;
|
|
184
184
|
border-radius: 6px;
|
|
185
|
-
`,
|
|
185
|
+
`,Tf=et(ki)`
|
|
186
186
|
background-color: #fafafa;
|
|
187
187
|
border: 1px solid #e0e0e0;
|
|
188
|
-
`,
|
|
188
|
+
`,ct=et(ki)`
|
|
189
189
|
background-color: #f5f5f5;
|
|
190
190
|
border: 1px dashed #bdbdbd;
|
|
191
|
-
`,Ue=
|
|
191
|
+
`,Ue=et(M)`
|
|
192
192
|
font-size: 0.75rem;
|
|
193
193
|
color: #757575;
|
|
194
194
|
text-transform: uppercase;
|
|
195
195
|
letter-spacing: 0.5px;
|
|
196
196
|
margin-bottom: 0.5rem;
|
|
197
|
-
`,
|
|
197
|
+
`,Fi=et(ge)`
|
|
198
198
|
display: flex;
|
|
199
199
|
gap: 1rem;
|
|
200
200
|
& > * {
|
|
201
201
|
flex: 1;
|
|
202
202
|
min-width: 120px;
|
|
203
203
|
}
|
|
204
|
-
`,
|
|
204
|
+
`,Bf=et(ge)`
|
|
205
205
|
display: flex;
|
|
206
206
|
gap: 0.5rem;
|
|
207
207
|
justify-content: center;
|
|
208
|
-
`,
|
|
208
|
+
`,Li=48,$f=()=>{const[e,t]=Ee(!1),[n,r]=Ee(!1),o=Ie(C,s=>s.executionLog),i=Ie(C,s=>s.isPlaying);if(o.length===0&&!i)return null;const a=()=>{r(!n)};return x(_f,{$isMaximized:n,children:[x(kf,{onClick:a,children:[x(M,{variant:"subtitle2",children:["Execution Log (",o.length," steps)"]}),l(_,{size:"small",onClick:s=>{s.stopPropagation(),a()},children:n?l(is,{}):l(os,{})})]}),n&&l(Ff,{children:l(Lf,{children:o.map(s=>x(Vf,{children:[l(Mf,{src:s.screenshot,alt:`Step ${s.stepNumber}`}),x(Gf,{children:[x(Wf,{children:["#",s.stepNumber]}),l(zf,{children:s.cacheHit?l(ln,{title:"Cache Hit",children:l(as,{color:"success",fontSize:"small"})}):l(ln,{title:"Cache Miss / Fresh Execution",children:l(ss,{color:"info",fontSize:"small"})})})]})]},s.stepId))})})]})},_f=G(Zn)`
|
|
209
209
|
position: fixed;
|
|
210
210
|
bottom: 0;
|
|
211
211
|
left: 0;
|
|
@@ -215,13 +215,13 @@ import{jsxs as D,Fragment as Xn,jsx as l}from"react/jsx-runtime";import ee,{useR
|
|
|
215
215
|
border-top-right-radius: 8px;
|
|
216
216
|
overflow: hidden;
|
|
217
217
|
transition: height 0.3s ease;
|
|
218
|
-
height: ${({$isMaximized:e})=>e?"400px":`${
|
|
218
|
+
height: ${({$isMaximized:e})=>e?"400px":`${Li}px`};
|
|
219
219
|
display: flex;
|
|
220
220
|
flex-direction: column;
|
|
221
221
|
background-color: ${({theme:e})=>e.palette?.background?.paper||"#fff"};
|
|
222
222
|
box-shadow: 0px -2px 10px rgba(0,0,0,0.1);
|
|
223
|
-
`,kf=
|
|
224
|
-
height: ${
|
|
223
|
+
`,kf=G.div`
|
|
224
|
+
height: ${Li}px;
|
|
225
225
|
padding: 0 16px;
|
|
226
226
|
display: flex;
|
|
227
227
|
align-items: center;
|
|
@@ -232,18 +232,18 @@ import{jsxs as D,Fragment as Xn,jsx as l}from"react/jsx-runtime";import ee,{useR
|
|
|
232
232
|
background-color: rgba(0, 0, 0, 0.08);
|
|
233
233
|
}
|
|
234
234
|
flex-shrink: 0;
|
|
235
|
-
`,
|
|
235
|
+
`,Ff=G.div`
|
|
236
236
|
flex: 1;
|
|
237
237
|
overflow-x: auto;
|
|
238
238
|
overflow-y: hidden;
|
|
239
239
|
padding: 16px;
|
|
240
240
|
background-color: rgba(0,0,0,0.02);
|
|
241
|
-
`,
|
|
241
|
+
`,Lf=G.div`
|
|
242
242
|
display: flex;
|
|
243
243
|
gap: 16px;
|
|
244
244
|
height: 100%;
|
|
245
245
|
align-items: center;
|
|
246
|
-
`,
|
|
246
|
+
`,Vf=G.div`
|
|
247
247
|
position: relative;
|
|
248
248
|
height: 100%;
|
|
249
249
|
aspect-ratio: 9/16; // Assumes mobile portrait roughly, will adjust to image
|
|
@@ -252,11 +252,11 @@ import{jsxs as D,Fragment as Xn,jsx as l}from"react/jsx-runtime";import ee,{useR
|
|
|
252
252
|
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
|
253
253
|
background: #000;
|
|
254
254
|
flex-shrink: 0;
|
|
255
|
-
`,
|
|
255
|
+
`,Mf=G.img`
|
|
256
256
|
width: 100%;
|
|
257
257
|
height: 100%;
|
|
258
258
|
object-fit: contain;
|
|
259
|
-
`,
|
|
259
|
+
`,Gf=G.div`
|
|
260
260
|
position: absolute;
|
|
261
261
|
top: 0;
|
|
262
262
|
left: 0;
|
|
@@ -266,26 +266,26 @@ import{jsxs as D,Fragment as Xn,jsx as l}from"react/jsx-runtime";import ee,{useR
|
|
|
266
266
|
justify-content: space-between;
|
|
267
267
|
align-items: start;
|
|
268
268
|
background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
|
|
269
|
-
`,
|
|
269
|
+
`,Wf=G.span`
|
|
270
270
|
color: white;
|
|
271
271
|
font-weight: bold;
|
|
272
272
|
font-size: 14px;
|
|
273
273
|
text-shadow: 0 1px 2px rgba(0,0,0,0.8);
|
|
274
|
-
`,
|
|
274
|
+
`,zf=G.div`
|
|
275
275
|
display: flex;
|
|
276
276
|
align-items: center;
|
|
277
277
|
justify-content: center;
|
|
278
278
|
background: rgba(255,255,255,0.9);
|
|
279
279
|
border-radius: 50%;
|
|
280
280
|
padding: 2px;
|
|
281
|
-
`,Jt=new na({open:!1,maintainDisplayed:!1});function zf(){Jt.setState(e=>({...e,open:!1}))}function Mi(e,t){Jt.setState({type:"success",title:t?.title??"Success",description:e,listContent:t?.listContent,open:!0,maintainDisplayed:t?.maintainDisplayed??!1})}function Yn(e,t){Jt.setState({type:"error",title:t?.title??"Error",description:e,listContent:t?.listContent,open:!0,maintainDisplayed:t?.maintainDisplayed??!1})}function Hf(e,t){Jt.setState({type:"info",title:t?.title,description:e,listContent:t?.listContent,open:!0,maintainDisplayed:t?.maintainDisplayed??!1})}const Uf=/\{\{\s*([a-zA-Z0-9_.-]+)\s*\}\}/g;function jf(e,t){const n=new Set;return{value:e.replace(Uf,(r,o)=>Object.prototype.hasOwnProperty.call(t,o)?t[o]??"":(n.add(o),"")),missing:Array.from(n)}}function Rt(e,t){const n={...e},r={},o=i=>{const a=n[i];if(typeof a=="string"&&a.includes("{{")){const{value:s,missing:c}=jf(a,t);n[i]=s,c.length&&(r[i]=c)}};return o("descriptionText"),o("text"),o("url"),o("instruction"),{step:n,missingMap:r}}const qf=({step:e,index:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>{const a={stepNumber:t+1,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i};switch(e.type){case"tap":return l(Ju,{step:e,...a});case"assert":return l(Zu,{step:e,...a});case"type":return l(Qu,{step:e,...a});case"scroll":return l(ep,{step:e,...a});case"scrollUntil":return l(tp,{step:e,...a});case"deeplink":return l(np,{step:e,...a});case"ai":return l(rp,{step:e,...a});case"fileRef":return l(Xu,{step:e,...a});default:return null}},Kf=({onSave:e,canSave:t})=>{const[n,r]=we(!1),[o,i]=we(void 0),a=Ne(C,g=>g.isRecording),s=Ne(C,g=>g.test.steps),c=Ne(C,g=>g.isPlaying),u=Ne(C,g=>g.selectedPlatform),f=Ne(C,g=>g.selectedDeviceId),{data:d=[]}=mt(Ri),p=J(null),m=ce(Ai),b=ce(lp),v=ce(up),y=ce(gp),w=ce(yp),O=ce(Bp),H=ce(Sp),T=ce(zp),B=ce(qp),_=ce(Or),P=(g,I,R)=>{C.setState(E=>({...E,test:{...E.test,steps:E.test.steps.map(S=>S.id===g?{...S,status:I,statusColor:R}:S)}}))},te=g=>{C.setState(I=>({...I,currentStepId:g}))},N=g=>new Promise(I=>setTimeout(I,g)),A=async()=>{try{const g=await H.mutateAsync({platform:u,deviceId:f});if(!g.success||!g.base64)throw new Error(g.error||"Failed to capture screenshot");return g.base64}catch(g){throw console.error("Screenshot failed:",g),g}},ne=g=>new Promise(I=>{const R=new Image;R.onload=()=>I({width:R.naturalWidth,height:R.naturalHeight}),R.src=g}),de=async(g,I,R,E=[])=>{P(g,"Starting AI Agent Loop...","purple");try{let S=0;const re=5;let F=[...E];for(;S<re;){if(p.current?.signal.aborted)throw new Error("Aborted");const G=await A();C.setState(Y=>({...Y,executionLog:[...Y.executionLog,{stepId:g,stepNumber:I,screenshot:G,cacheHit:!1,timestamp:Date.now()}]})),P(g,`AI Agent Thinking (${S+1})...`,"purple");const W=await B.mutateAsync({base64_screenshot:G.replace(/^data:image\/\w+;base64,/,""),instruction:R,action_history:F});console.log("Agent Response:",W);const xe=W;xe.actionHistory&&(F=xe.actionHistory);const $=xe.gptCommands||[],X=xe.appetizeCommands||[],K=$.findIndex(Y=>Y.startsWith("reasoning:"));if(K!==-1){const Y=$.slice(K),le=Y.filter(U=>U.startsWith("remember:"));le.length>0&&E.push(...le),F=[...F,...Y]}const se=$.some(Y=>Y.toLowerCase().includes("task complete:")),ge=$.find(Y=>Y.toLowerCase().includes("error detected:"));if(ge)throw new Error(`AI reported error: ${ge}`);if(se)return P(g,"AI Task Completed","green"),!0;let ae=!1;if(X.length>0){for(const Y of X){if(p.current?.signal.aborted)throw new Error("Aborted");if(Y.match(/^t(ap|ab)On:/)){let le,U;const ke=Y.match(/x=(\d+)/),dt=Y.match(/y=(\d+)/);if(ke&&dt)le=parseInt(ke[1],10),U=parseInt(dt[1],10);else{const je=Y.split(";");if(je.length>=3){const ut=parseInt(je[1],10),tn=parseInt(je[2],10);!isNaN(ut)&&!isNaN(tn)&&(le=ut,U=tn)}}le!==void 0&&U!==void 0&&(P(g,`Exec: Tap ${le},${U}`,"blue"),await m.mutateAsync({x:le,y:U,platform:u,deviceId:f}),ae=!0)}else if(Y.startsWith("wait:")){const le=Y.match(/wait:\s*(\d+)/);if(le){const U=parseInt(le[1],10);P(g,`Exec: Wait ${U}s`,"blue"),await N(U*1e3),ae=!0}}else if(Y.startsWith("scroll:")){const le=Y.match(/scroll:\s*(up|down)/i);if(le){const U=le[1].toLowerCase();P(g,`Exec: Scroll ${U}`,"blue"),await v.mutateAsync({direction:U,platform:u,deviceId:f}),ae=!0}}}await N(3e3)}!ae&&!se&&(P(g,"AI Thinking...","blue"),await N(2e3)),S++}throw new Error("AI Agent loop timeout")}catch(S){throw S}},ct=async(g,I,R,E=[])=>{if(R.aborted)return!1;te(g.id),P(g.id,"Executing...","blue");const S={platform:u,deviceId:f},re=Date.now();try{let F,G=!1;const W=()=>C.state.currentScreenshot||void 0;switch(g.type){case"tap":{let $=g.x,X=g.y;const K=`mobileboost_step_${g.id}_${g.type}`;let se=!1;const ge=Date.now(),ae=g.timeout??3e3;if(g.cropBase64)for(console.log(`[Step ${g.id}] Cache check start`);Date.now()-ge<ae;){if(R.aborted)return!1;const U=Date.now(),ke=await A();F||(F=ke);const dt=Date.now()-U;console.log(`[Step ${g.id}] Screenshot captured in ${dt}ms`);try{const je=Date.now(),{width:ut,height:tn}=await ne(ke),nn=await T.mutateAsync({stepNumber:I,stepDescription:g.descriptionText||g.type,filepath:void 0,screenshot:ke,platform:u,screenResolution:{width:ut,height:tn}}),Wi=Date.now()-je;if(console.log(`[Step ${g.id}] Cache endpoint responded in ${Wi}ms`),nn.found&&nn.interactionCoordinates){$=nn.interactionCoordinates.x,X=nn.interactionCoordinates.y,se=!0,G=!0;const zi=Date.now()-ge;console.log(`[Step ${g.id}] Cache Hit! Total cache loop duration: ${zi}ms`),P(g.id,`Cache Hit! Executing at ${$},${X}`,"green");break}}catch(je){console.warn("Cache check failed:",je)}await N(500)}if(se||F||(F=W()),!se){const U=Date.now()-ge;console.log(`[Step ${g.id}] Cache Miss. Duration: ${U}ms`)}if(!se&&g.cropBase64){if(console.log("Cache miss"),g.descriptionText){P(g.id,"Cache miss, trying AI fallback...","orange");try{return await de(g.id,I,g.descriptionText,E),!0}catch(U){throw new Error(`Cache miss and AI failed: ${U.message}`)}}}else if(g.elementId){P(g.id,"Finding element...","blue");try{const U=await O.mutateAsync({elementId:g.elementId,...S});U.found&&($=U.x,X=U.y,P(g.id,"Element found, tapping...","blue"))}catch{console.log("Element ID not found, using original coordinates")}}const Y=Date.now();await m.mutateAsync({x:$,y:X,screenWidth:g.screenWidth,screenHeight:g.screenHeight,...S});const le=Date.now()-Y;console.log(`[Step ${g.id}] Tap executed in ${le}ms`),P(g.id,"Tapped","green");break}case"assert":{if(g.cropBase64){let $=!1;const X=g.timeout??3e3,K=Date.now(),se=`mobileboost_step_${g.id}_${g.type}`;for(;Date.now()-K<X;){if(R.aborted)return!1;const ge=await A();F||(F=ge);try{const{width:ae,height:Y}=await ne(ge);if((await T.mutateAsync({stepNumber:I,stepDescription:g.descriptionText||g.type,filepath:void 0,screenshot:ge,platform:u,screenResolution:{width:ae,height:Y}})).found){$=!0,G=!0;break}}catch(ae){console.warn("Assert cache check failed:",ae)}await N(500)}if($)P(g.id,"Assertion passed (Cache Match)","green");else if(g.descriptionText)await de(g.id,I,`Verify that: ${g.descriptionText}`,E),P(g.id,"Assertion passed (AI)","green");else throw new Error("Assertion failed: Image not found")}if(!F)F=W();else if(g.elementId)if(P(g.id,"Checking element...","blue"),(await O.mutateAsync({elementId:g.elementId,...S})).found)P(g.id,"Assertion passed","green");else throw new Error("Element not found");else P(g.id,"Assertion passed (No conditions)","green");break}case"type":{F=W();const $=C.state.test.params||{},{step:X,missingMap:K}=Rt(g,$);if(Object.keys(K).length){const se=Object.entries(K).map(([ge,ae])=>`${ge}: ${ae.join(", ")}`).join("; ");throw new Error(`Missing params for placeholders -> ${se}`)}await b.mutateAsync({text:X.text,...S}),P(g.id,"Typed","green");break}case"scroll":{F=W(),await v.mutateAsync({direction:g.direction,...S}),P(g.id,"Scrolled","green");break}case"scrollUntil":{F=W();const $=C.state.test.params||{},{step:X,missingMap:K}=Rt(g,$);if(K.text?.length)throw new Error(`Missing params for placeholders -> text: ${K.text.join(", ")}`);P(g.id,"Scrolling until found...","blue");const se=await y.mutateAsync({text:X.text,elementId:X.elementId,direction:X.direction,maxScrolls:X.maxScrolls,...S});if(se.success)P(g.id,`Found after ${se.scrolls??0} scrolls`,"green");else throw new Error("Target not found after scrolling");break}case"deeplink":{F=W();const $=C.state.test.params||{},{step:X,missingMap:K}=Rt(g,$);if(K.url?.length)throw new Error(`Missing params for placeholders -> url: ${K.url.join(", ")}`);await w.mutateAsync({url:X.url,...S}),P(g.id,"Opened deeplink","green");break}case"fileRef":{P(g.id,"Loading steps from file...","blue");const $=(await _.mutateAsync({path:g.path}))?.content;let X=[],K={};if(Array.isArray($))X=$;else if($&&Array.isArray($.steps))X=$.steps,K=$.params||{};else throw new Error("Referenced file must be an array or an object with steps");const se={...K,...g.overrides};console.debug("fileRef params",{refParams:K,overrides:g.overrides,effectiveParams:se});const ge=xo.array().parse(X).map((ae,Y)=>{const le=typeof ae.id=="number"?ae.id:Date.now()+Y,{step:U,missingMap:ke}=Rt(ae,se);if(U.type==="type"&&ke.text?.length||U.type==="scrollUntil"&&ke.text?.length||U.type==="deeplink"&&ke.url?.length||U.type==="ai"&&ke.instruction?.length){const dt=[];for(const[je,ut]of Object.entries(ke))ut.length&&dt.push(`${je}: ${ut.join(", ")}`);throw new Error(`Referenced step has missing params -> ${dt.join("; ")}`)}return{id:le,...U,originRef:{refId:g.id,path:g.path,descriptionText:g.descriptionText,optional:g.optional,overrides:g.overrides}}});C.setState(ae=>{const Y=ae.test.steps.findIndex(U=>U.id===g.id);if(Y===-1)return ae;const le=[...ae.test.steps];return le.splice(Y,1,...ge),{...ae,test:{...ae.test,steps:le}}}),P(g.id,"Expanded steps from file","green");break}case"ai":{const $=C.state.test.params||{},{step:X,missingMap:K}=Rt(g,$);if(K.instruction?.length)throw new Error(`Missing params for placeholders -> instruction: ${K.instruction.join(", ")}`);await de(g.id,I,X.instruction,E);break}}await N(100);const xe=Date.now()-re;return console.log(`[Step ${g.id}] Execution Finished. Total Duration: ${xe}ms`),F&&C.setState($=>({...$,executionLog:[...$.executionLog,{stepId:g.id,stepNumber:I,screenshot:F,cacheHit:G,timestamp:Date.now()}]})),!0}catch(F){const G=F instanceof Error?F.message:"Unknown error";return g.optional?(P(g.id,`Failed (optional): ${G}`,"orange"),!0):(P(g.id,`Error: ${G}`,"red"),!1)}},Ie=()=>{C.setState(g=>{const I=g.test.steps,R=[],E=new Set,S=new Set;let re=0;for(;re<I.length;){const G=I[re];if(G?.type==="fileRef"){const W=G.path;if(S.has(W)){re++;continue}E.add(G.id),S.add(W),R.push(G),re++;continue}if(G&&G.originRef){const W=G.originRef.refId,xe=G.originRef.path,$=G.originRef.descriptionText,X=G.originRef.optional;let K=re;for(;K<I.length&&I[K]?.originRef?.refId===W;)K++;if(E.has(W)||S.has(xe)){re=K;continue}const se={id:W,type:"fileRef",path:xe,descriptionText:$,optional:X,overrides:G?.originRef?.overrides};R.some(ge=>ge.id===se.id)&&(se.id=Date.now()),R.push(se),E.add(se.id),S.add(xe),re=K;continue}R.push(G),re++}const F=[];for(const G of R){const W=F[F.length-1];W?.type==="fileRef"&&G?.type==="fileRef"&&W.path===G.path||F.push(G)}return{...g,test:{...g.test,steps:F}}})},Oe=async(g,I)=>{if(C.state.test.steps.length===0){alert("No steps to play!");return}p.current=new AbortController;const R=p.current.signal;C.setState(W=>({...W,isPlaying:!0})),C.setState(W=>({...W,test:{...W.test,steps:W.test.steps.map((xe,$)=>$>=g?{...xe,status:"",statusColor:""}:xe)},executionLog:[]}));let E=g;const S=g+1,re=[];let F=!1,G;for(;!R.aborted;){const W=C.state.test.steps,xe=I?S:W.length;if(E>=xe)break;const $=W[E],X=$.type;if(!await ct($,E+1,R,re)&&!$.optional){F=!0,G=C.state.test.steps.find(K=>K.id===$.id)?.status||"Execution failed";break}if(X==="fileRef"){if(I)break;continue}E++}await N(500),Ie(),te(null),C.setState(W=>({...W,isPlaying:!1})),p.current=null,R.aborted||(F?Yn(G||"Playback failed",{title:"Execution Failed"}):Mi("Playback finished successfully",{title:"Execution Completed"}))},Ke=()=>Oe(0,!1),yt=g=>{const I=s.findIndex(R=>R.id===g);I!==-1&&Oe(I,!0)},Ye=g=>{const I=s.findIndex(R=>R.id===g);I!==-1&&Oe(I,!1)},Dt=()=>{p.current?.abort(),Ie(),C.setState(g=>({...g,isPlaying:!1})),te(null),Hf("Playback stopped",{title:"Stopped"})},We=g=>{i(g),r(!1)},Zt=()=>{r(!1),i(void 0)},Qt=()=>{r(!1),i(void 0)},en=g=>{confirm("Delete this step?")&&C.setState(I=>({...I,test:{...I.test,steps:I.test.steps.filter(R=>R.id!==g)}}))},Sn=()=>{confirm("Are you sure you want to clear all steps?")&&C.setState(g=>({...g,test:{...g.test,steps:[]}}))},ze=()=>{if(s.length===0){alert("No steps to export!");return}const g=s.map(({statusDiv:E,element:S,status:re,statusColor:F,...G})=>G),I="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(g,null,2)),R=document.createElement("a");R.href=I,R.download="steps.json",R.click()},ue=()=>{const g=document.createElement("input");g.type="file",g.accept=".json",g.onchange=I=>{const R=I.target.files?.[0];if(!R)return;const E=new FileReader;E.onload=S=>{try{const re=JSON.parse(S.target?.result);if(!Array.isArray(re))throw new Error("Invalid format");C.setState(F=>({...F,test:{...F.test,steps:re.map((G,W)=>({...G,id:Date.now()+W}))}}))}catch(re){alert("Error importing steps: "+re.message)}},E.readAsText(R)},g.click()},ye=()=>{if(s.length===0){alert("No steps to generate code from!");return}let g=`import { gptdriver } from 'gpt-driver-node';
|
|
281
|
+
`,Zt=new na({open:!1,maintainDisplayed:!1});function Hf(){Zt.setState(e=>({...e,open:!1}))}function Vi(e,t){Zt.setState({type:"success",title:t?.title??"Success",description:e,listContent:t?.listContent,open:!0,maintainDisplayed:t?.maintainDisplayed??!1})}function Kn(e,t){Zt.setState({type:"error",title:t?.title??"Error",description:e,listContent:t?.listContent,open:!0,maintainDisplayed:t?.maintainDisplayed??!1})}function Uf(e,t){Zt.setState({type:"info",title:t?.title,description:e,listContent:t?.listContent,open:!0,maintainDisplayed:t?.maintainDisplayed??!1})}const jf=/\{\{\s*([a-zA-Z0-9_.-]+)\s*\}\}/g;function qf(e,t){const n=new Set;return{value:e.replace(jf,(r,o)=>Object.prototype.hasOwnProperty.call(t,o)?t[o]??"":(n.add(o),"")),missing:Array.from(n)}}function Tt(e,t){const n={...e},r={},o=i=>{const a=n[i];if(typeof a=="string"&&a.includes("{{")){const{value:s,missing:c}=qf(a,t);n[i]=s,c.length&&(r[i]=c)}};return o("descriptionText"),o("text"),o("url"),o("instruction"),{step:n,missingMap:r}}const Yf=({step:e,index:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>{const a={stepNumber:t+1,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i};switch(e.type){case"tap":return l(Ju,{step:e,...a});case"assert":return l(Zu,{step:e,...a});case"type":return l(Qu,{step:e,...a});case"scroll":return l(ep,{step:e,...a});case"scrollUntil":return l(tp,{step:e,...a});case"deeplink":return l(np,{step:e,...a});case"ai":return l(rp,{step:e,...a});case"fileRef":return l(Xu,{step:e,...a});default:return null}},Kf=({onSave:e,canSave:t})=>{const[n,r]=Ee(!1),[o,i]=Ee(void 0),a=Ie(C,g=>g.isRecording),s=Ie(C,g=>g.test.steps),c=Ie(C,g=>g.isPlaying),u=Ie(C,g=>g.selectedPlatform),f=Ie(C,g=>g.selectedDeviceId),{data:d=[]}=mt(Ri),p=J(null),m=ce(Ai),b=ce(lp),v=ce(up),y=ce(gp),w=ce(yp),O=ce(Bp),U=ce(Sp),T=ce(Hp),B=ce(Yp),k=ce(Or),P=(g,I,R)=>{C.setState(E=>({...E,test:{...E.test,steps:E.test.steps.map(S=>S.id===g?{...S,status:I,statusColor:R}:S)}}))},te=g=>{C.setState(I=>({...I,currentStepId:g}))},N=g=>new Promise(I=>setTimeout(I,g)),A=async()=>{try{const g=await U.mutateAsync({platform:u,deviceId:f});if(!g.success||!g.base64)throw new Error(g.error||"Failed to capture screenshot");return g.base64}catch(g){throw console.error("Screenshot failed:",g),g}},ne=g=>new Promise(I=>{const R=new Image;R.onload=()=>I({width:R.naturalWidth,height:R.naturalHeight}),R.src=g}),de=async(g,I,R,E=[])=>{P(g,"Starting AI Agent Loop...","purple");try{let S=0;const re=5;let L=[...E];for(;S<re;){if(p.current?.signal.aborted)throw new Error("Aborted");const W=await A();C.setState(j=>({...j,executionLog:[...j.executionLog,{stepId:g,stepNumber:I,screenshot:W,cacheHit:!1,timestamp:Date.now()}]})),P(g,`AI Agent Thinking (${S+1})...`,"purple");const z=await B.mutateAsync({base64_screenshot:W.replace(/^data:image\/\w+;base64,/,""),instruction:R,action_history:L});console.log("Agent Response:",z);const xe=z;xe.actionHistory&&(L=xe.actionHistory);const $=xe.gptCommands||[],K=xe.appetizeCommands||[],X=$.findIndex(j=>j.startsWith("reasoning:"));if(X!==-1){const j=$.slice(X),oe=j.filter(F=>F.startsWith("remember:"));oe.length>0&&E.push(...oe),L=[...L,...j]}const se=$.some(j=>j.toLowerCase().includes("task complete:")),Oe=$.find(j=>j.toLowerCase().includes("error detected:"));if(Oe)throw new Error(`AI reported error: ${Oe}`);if(se)return P(g,"AI Task Completed","green"),!0;let le=!1;if(K.length>0){for(const j of K){if(p.current?.signal.aborted)throw new Error("Aborted");if(j.match(/^t(ap|ab)On:/)){let oe,F;const ze=j.match(/x=(\d+)/),je=j.match(/y=(\d+)/);if(ze&&je)oe=parseInt(ze[1],10),F=parseInt(je[1],10);else{const ut=j.split(";");if(ut.length>=3){const qe=parseInt(ut[1],10),nn=parseInt(ut[2],10);!isNaN(qe)&&!isNaN(nn)&&(oe=qe,F=nn)}}oe!==void 0&&F!==void 0&&(P(g,`Exec: Tap ${oe},${F}`,"blue"),await m.mutateAsync({x:oe,y:F,platform:u,deviceId:f}),le=!0)}else if(j.startsWith("wait:")){const oe=j.match(/wait:\s*(\d+)/);if(oe){const F=parseInt(oe[1],10);P(g,`Exec: Wait ${F}s`,"blue"),await N(F*1e3),le=!0}}else if(j.startsWith("scroll:")){const oe=j.match(/scroll:\s*(up|down)/i);if(oe){const F=oe[1].toLowerCase();P(g,`Exec: Scroll ${F}`,"blue"),await v.mutateAsync({direction:F,platform:u,deviceId:f}),le=!0}}}await N(3e3)}!le&&!se&&(P(g,"AI Thinking...","blue"),await N(2e3)),S++}throw new Error("AI Agent loop timeout")}catch(S){throw S}},dt=async(g,I,R,E=[])=>{if(R.aborted)return!1;te(g.id),P(g.id,"Executing...","blue");const S={platform:u,deviceId:f},re=Date.now();try{let L,W=!1;const z=()=>C.state.currentScreenshot||void 0;switch(g.type){case"tap":{let $=g.x,K=g.y;const X=`mobileboost_step_${g.id}_${g.type}`;let se=!1;const Oe=Date.now(),le=g.timeout??3e3;if(g.cropBase64){console.log(`[Step ${g.id}] Cache check start`);let F;for(;Date.now()-Oe<le;){if(R.aborted)return!1;const ze=Date.now(),je=await A();L||(L=je);const ut=Date.now()-ze;console.log(`[Step ${g.id}] Screenshot captured in ${ut}ms`);try{const qe=Date.now(),{width:nn,height:Gi}=await ne(je),Ot=await T.mutateAsync({stepNumber:I,stepDescription:g.descriptionText||g.type,filepath:void 0,screenshot:je,platform:u,screenResolution:{width:nn,height:Gi},highest_used_index:F}),Wi=Date.now()-qe;if(console.log(`[Step ${g.id}] Cache endpoint responded in ${Wi}ms`),Ot.found&&Ot.interactionCoordinates){$=Ot.interactionCoordinates.x,K=Ot.interactionCoordinates.y,se=!0,W=!0,F=Ot.cacheIndex;const zi=Date.now()-Oe;console.log(`[Step ${g.id}] Cache Hit! Total cache loop duration: ${zi}ms`),P(g.id,`Cache Hit! Executing at ${$},${K}`,"green");break}}catch(qe){console.warn("Cache check failed:",qe)}await N(500)}}if(se||L||(L=z()),!se){const F=Date.now()-Oe;console.log(`[Step ${g.id}] Cache Miss. Duration: ${F}ms`)}if(!se&&g.cropBase64){if(console.log("Cache miss"),g.descriptionText){P(g.id,"Cache miss, trying AI fallback...","orange");try{return await de(g.id,I,g.descriptionText,E),!0}catch(F){throw new Error(`Cache miss and AI failed: ${F.message}`)}}}else if(g.elementId){P(g.id,"Finding element...","blue");try{const F=await O.mutateAsync({elementId:g.elementId,...S});F.found&&($=F.x,K=F.y,P(g.id,"Element found, tapping...","blue"))}catch{console.log("Element ID not found, using original coordinates")}}const j=Date.now();await m.mutateAsync({x:$,y:K,screenWidth:g.screenWidth,screenHeight:g.screenHeight,...S});const oe=Date.now()-j;console.log(`[Step ${g.id}] Tap executed in ${oe}ms`),P(g.id,"Tapped","green");break}case"assert":{if(g.cropBase64){let $=!1,K;const X=g.timeout??3e3,se=Date.now(),Oe=`mobileboost_step_${g.id}_${g.type}`;for(;Date.now()-se<X;){if(R.aborted)return!1;const le=await A();L||(L=le);try{const{width:j,height:oe}=await ne(le),F=await T.mutateAsync({stepNumber:I,stepDescription:g.descriptionText||g.type,filepath:void 0,screenshot:le,platform:u,screenResolution:{width:j,height:oe},highest_used_index:K});if(F.found){$=!0,W=!0,K=F.cacheIndex;break}}catch(j){console.warn("Assert cache check failed:",j)}await N(500)}if($)P(g.id,"Assertion passed (Cache Match)","green");else if(g.descriptionText)await de(g.id,I,`Verify that: ${g.descriptionText}`,E),P(g.id,"Assertion passed (AI)","green");else throw new Error("Assertion failed: Image not found")}if(!L)L=z();else if(g.elementId)if(P(g.id,"Checking element...","blue"),(await O.mutateAsync({elementId:g.elementId,...S})).found)P(g.id,"Assertion passed","green");else throw new Error("Element not found");else P(g.id,"Assertion passed (No conditions)","green");break}case"type":{L=z();const $=C.state.test.params||{},{step:K,missingMap:X}=Tt(g,$);if(Object.keys(X).length){const se=Object.entries(X).map(([Oe,le])=>`${Oe}: ${le.join(", ")}`).join("; ");throw new Error(`Missing params for placeholders -> ${se}`)}await b.mutateAsync({text:K.text,...S}),P(g.id,"Typed","green");break}case"scroll":{L=z(),await v.mutateAsync({direction:g.direction,...S}),P(g.id,"Scrolled","green");break}case"scrollUntil":{L=z();const $=C.state.test.params||{},{step:K,missingMap:X}=Tt(g,$);if(X.text?.length)throw new Error(`Missing params for placeholders -> text: ${X.text.join(", ")}`);P(g.id,"Scrolling until found...","blue");const se=await y.mutateAsync({text:K.text,elementId:K.elementId,direction:K.direction,maxScrolls:K.maxScrolls,...S});if(se.success)P(g.id,`Found after ${se.scrolls??0} scrolls`,"green");else throw new Error("Target not found after scrolling");break}case"deeplink":{L=z();const $=C.state.test.params||{},{step:K,missingMap:X}=Tt(g,$);if(X.url?.length)throw new Error(`Missing params for placeholders -> url: ${X.url.join(", ")}`);await w.mutateAsync({url:K.url,...S}),P(g.id,"Opened deeplink","green");break}case"fileRef":{P(g.id,"Loading steps from file...","blue");const $=(await k.mutateAsync({path:g.path}))?.content;let K=[],X={};if(Array.isArray($))K=$;else if($&&Array.isArray($.steps))K=$.steps,X=$.params||{};else throw new Error("Referenced file must be an array or an object with steps");const se={...X,...g.overrides};console.debug("fileRef params",{refParams:X,overrides:g.overrides,effectiveParams:se});const Oe=Do.array().parse(K).map((le,j)=>{const oe=typeof le.id=="number"?le.id:Date.now()+j,{step:F,missingMap:ze}=Tt(le,se);if(F.type==="type"&&ze.text?.length||F.type==="scrollUntil"&&ze.text?.length||F.type==="deeplink"&&ze.url?.length||F.type==="ai"&&ze.instruction?.length){const je=[];for(const[ut,qe]of Object.entries(ze))qe.length&&je.push(`${ut}: ${qe.join(", ")}`);throw new Error(`Referenced step has missing params -> ${je.join("; ")}`)}return{id:oe,...F,originRef:{refId:g.id,path:g.path,descriptionText:g.descriptionText,optional:g.optional,overrides:g.overrides}}});C.setState(le=>{const j=le.test.steps.findIndex(F=>F.id===g.id);if(j===-1)return le;const oe=[...le.test.steps];return oe.splice(j,1,...Oe),{...le,test:{...le.test,steps:oe}}}),P(g.id,"Expanded steps from file","green");break}case"ai":{const $=C.state.test.params||{},{step:K,missingMap:X}=Tt(g,$);if(X.instruction?.length)throw new Error(`Missing params for placeholders -> instruction: ${X.instruction.join(", ")}`);await de(g.id,I,K.instruction,E);break}}await N(100);const xe=Date.now()-re;return console.log(`[Step ${g.id}] Execution Finished. Total Duration: ${xe}ms`),L&&C.setState($=>({...$,executionLog:[...$.executionLog,{stepId:g.id,stepNumber:I,screenshot:L,cacheHit:W,timestamp:Date.now()}]})),!0}catch(L){const W=L instanceof Error?L.message:"Unknown error";return g.optional?(P(g.id,`Failed (optional): ${W}`,"orange"),!0):(P(g.id,`Error: ${W}`,"red"),!1)}},Ce=()=>{C.setState(g=>{const I=g.test.steps,R=[],E=new Set,S=new Set;let re=0;for(;re<I.length;){const W=I[re];if(W?.type==="fileRef"){const z=W.path;if(S.has(z)){re++;continue}E.add(W.id),S.add(z),R.push(W),re++;continue}if(W&&W.originRef){const z=W.originRef.refId,xe=W.originRef.path,$=W.originRef.descriptionText,K=W.originRef.optional;let X=re;for(;X<I.length&&I[X]?.originRef?.refId===z;)X++;if(E.has(z)||S.has(xe)){re=X;continue}const se={id:z,type:"fileRef",path:xe,descriptionText:$,optional:K,overrides:W?.originRef?.overrides};R.some(Oe=>Oe.id===se.id)&&(se.id=Date.now()),R.push(se),E.add(se.id),S.add(xe),re=X;continue}R.push(W),re++}const L=[];for(const W of R){const z=L[L.length-1];z?.type==="fileRef"&&W?.type==="fileRef"&&z.path===W.path||L.push(W)}return{...g,test:{...g.test,steps:L}}})},Se=async(g,I)=>{if(C.state.test.steps.length===0){alert("No steps to play!");return}p.current=new AbortController;const R=p.current.signal;C.setState(z=>({...z,isPlaying:!0})),C.setState(z=>({...z,test:{...z.test,steps:z.test.steps.map((xe,$)=>$>=g?{...xe,status:"",statusColor:""}:xe)},executionLog:[]}));let E=g;const S=g+1,re=[];let L=!1,W;for(;!R.aborted;){const z=C.state.test.steps,xe=I?S:z.length;if(E>=xe)break;const $=z[E],K=$.type;if(!await dt($,E+1,R,re)&&!$.optional){L=!0,W=C.state.test.steps.find(X=>X.id===$.id)?.status||"Execution failed";break}if(K==="fileRef"){if(I)break;continue}E++}await N(500),Ce(),te(null),C.setState(z=>({...z,isPlaying:!1})),p.current=null,R.aborted||(L?Kn(W||"Playback failed",{title:"Execution Failed"}):Vi("Playback finished successfully",{title:"Execution Completed"}))},Ke=()=>Se(0,!1),yt=g=>{const I=s.findIndex(R=>R.id===g);I!==-1&&Se(I,!0)},Xe=g=>{const I=s.findIndex(R=>R.id===g);I!==-1&&Se(I,!1)},xt=()=>{p.current?.abort(),Ce(),C.setState(g=>({...g,isPlaying:!1})),te(null),Uf("Playback stopped",{title:"Stopped"})},Ge=g=>{i(g),r(!1)},Qt=()=>{r(!1),i(void 0)},en=()=>{r(!1),i(void 0)},tn=g=>{confirm("Delete this step?")&&C.setState(I=>({...I,test:{...I.test,steps:I.test.steps.filter(R=>R.id!==g)}}))},Sn=()=>{confirm("Are you sure you want to clear all steps?")&&C.setState(g=>({...g,test:{...g.test,steps:[]}}))},We=()=>{if(s.length===0){alert("No steps to export!");return}const g=s.map(({statusDiv:E,element:S,status:re,statusColor:L,...W})=>W),I="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(g,null,2)),R=document.createElement("a");R.href=I,R.download="steps.json",R.click()},ue=()=>{const g=document.createElement("input");g.type="file",g.accept=".json",g.onchange=I=>{const R=I.target.files?.[0];if(!R)return;const E=new FileReader;E.onload=S=>{try{const re=JSON.parse(S.target?.result);if(!Array.isArray(re))throw new Error("Invalid format");C.setState(L=>({...L,test:{...L.test,steps:re.map((W,z)=>({...W,id:Date.now()+z}))}}))}catch(re){alert("Error importing steps: "+re.message)}},E.readAsText(R)},g.click()},ve=()=>{if(s.length===0){alert("No steps to generate code from!");return}let g=`import { gptdriver } from 'gpt-driver-node';
|
|
282
282
|
|
|
283
283
|
export async function runTest() {
|
|
284
284
|
`;s.forEach(E=>{const S={type:E.type,description:E.descriptionText||"No description"};switch(E.optional&&(S.optional=!0),E.type){case"tap":case"assert":S.x=Math.round(E.x),S.y=Math.round(E.y),E.cropBase64&&(S.template=E.cropBase64),E.elementId&&(S.elementId=E.elementId),E.timeout&&(S.matchTimeout=E.timeout),E.useLlmOnly&&(S.useLlmOnly=!0);break;case"type":S.text=E.text;break;case"scroll":S.direction=E.direction;break;case"scrollUntil":E.text&&(S.text=E.text),E.elementId&&(S.elementId=E.elementId),S.direction=E.direction,S.maxScrolls=E.maxScrolls;break;case"deeplink":S.url=E.url;break;case"ai":S.instruction=E.instruction;break}g+=` await gptdriver.execute(${JSON.stringify(S,null,2).replace(/\n/g,`
|
|
285
285
|
`)});
|
|
286
286
|
|
|
287
287
|
`}),g+=`}
|
|
288
|
-
`;const I="data:text/plain;charset=utf-8,"+encodeURIComponent(g),R=document.createElement("a");R.href=I,R.download="generated_test.ts",R.click()},
|
|
288
|
+
`;const I="data:text/plain;charset=utf-8,"+encodeURIComponent(g),R=document.createElement("a");R.href=I,R.download="generated_test.ts",R.click()},ye=c||a,Ve=n||!!o;return x(Xf,{$hasForm:Ve,children:[l(M,{variant:"h5",children:"Recorded Steps"}),l(Ht,{}),x(Jf,{children:[e&&l(Ae,{variant:"contained",color:"primary",onClick:e,disabled:!t||c,children:"Save"}),c?l(Ae,{variant:"contained",color:"error",onClick:xt,children:"Stop"}):l(Ae,{variant:"contained",disabled:a||s.length===0,onClick:Ke,children:"Play Recording"}),l(Ae,{variant:"contained",disabled:ye||Ve,onClick:()=>r(!0),children:"+ Add Step"}),l(Ae,{variant:"outlined",disabled:ye||s.length===0,onClick:Sn,children:"Clear All"}),l(Ae,{variant:"contained",disabled:s.length===0,onClick:We,children:"Export Steps"}),l(Ae,{variant:"contained",disabled:c,onClick:ue,children:"Import Steps"}),l(Ae,{variant:"contained",color:"secondary",disabled:s.length===0,onClick:ve,children:"Generate Code"})]}),(o||Ve)&&l(Qf,{children:l(xf,{step:o,onSave:Qt,onCancel:en})}),l(Zf,{children:s.length===0?l(em,{children:l(M,{color:"text.secondary",children:"No steps recorded yet. Enable recording and click on the device screen to add steps."})}):l(yi,{onDragEnd:g=>{const{source:I,destination:R}=g;if(!R||I.index===R.index)return;const E=[...C.state.test.steps],[S]=E.splice(I.index,1);E.splice(R.index,0,S),C.setState(re=>({...re,test:{...re.test,steps:E}}))},children:l(mn,{droppableId:"steps-droppable",children:g=>x("div",{ref:g.innerRef,...g.droppableProps,children:[s.map((I,R)=>l(Cr,{draggableId:String(I.id),index:R,children:(E,S)=>l("div",{ref:E.innerRef,...E.draggableProps,...E.dragHandleProps,style:{...E.draggableProps.style,opacity:S.isDragging?.9:1},children:l(Yf,{step:I,index:R,onPlay:()=>yt(I.id),onPlayFromHere:()=>Xe(I.id),onEdit:()=>Ge(I),onDelete:()=>tn(I.id)})})},I.id)),g.placeholder]})})})}),l($f,{})]})},Xf=G(In)`
|
|
289
289
|
display: grid;
|
|
290
290
|
grid-template-areas:
|
|
291
291
|
'title'
|
|
@@ -296,25 +296,25 @@ export async function runTest() {
|
|
|
296
296
|
grid-template-rows: auto auto auto ${({$hasForm:e})=>e?"auto":""} minmax(0, 1fr);
|
|
297
297
|
row-gap: 0.75rem;
|
|
298
298
|
overflow: hidden;
|
|
299
|
-
`,
|
|
299
|
+
`,Jf=G.div`
|
|
300
300
|
display: flex;
|
|
301
301
|
gap: 0.5rem;
|
|
302
302
|
flex-wrap: wrap;
|
|
303
|
-
`,
|
|
303
|
+
`,Zf=G.div`
|
|
304
304
|
overflow-y: auto;
|
|
305
305
|
padding-right: 0.5rem;
|
|
306
|
-
`,
|
|
306
|
+
`,Qf=G.div`
|
|
307
307
|
grid-area: form;
|
|
308
308
|
max-height: 50vh;
|
|
309
309
|
overflow-y: auto;
|
|
310
|
-
`,
|
|
310
|
+
`,em=G.div`
|
|
311
311
|
display: flex;
|
|
312
312
|
align-items: center;
|
|
313
313
|
justify-content: center;
|
|
314
314
|
height: 100%;
|
|
315
315
|
padding: 2rem;
|
|
316
316
|
text-align: center;
|
|
317
|
-
`,
|
|
317
|
+
`,tm=ae("f8084cb106c8126bb2deaeef7c98992d9ff9475ad3dc85c6ced04f08c3962b6e"),nm=ie({method:"POST"}).inputValidator(Qa).handler(tm,async({data:e})=>({description:await es(e)})),rm=me({mutationKey:["ai","describe"],mutationFn:e=>nm({data:e})}),om=()=>{const e=Ie(C,N=>N.mode),t=Ie(C,N=>N.isRecording),n=Ie(C,N=>N.enableAnimations),r=ji(),o=J(null),{data:i=[]}=mt(Ri),a=Ie(C,N=>N.selectedDeviceId);Ie(C,N=>N.selectedPlatform),Ne(()=>{if(!a&&i.length>0){const N=i[0];C.setState(A=>({...A,selectedDeviceId:N.id,selectedPlatform:N.platform}))}},[i,a]);const s=i.find(N=>N.id===a),{data:c,isError:u,isLoading:f}=mt({...fo({platform:s?.platform,deviceId:s?.id}),refetchInterval:250,enabled:!!s});Ne(()=>{const N=c?.base64;N&&C.setState(A=>({...A,currentScreenshot:N}))},[c]);const{data:d}=mt({...Ip({platform:s?.platform,deviceId:s?.id}),enabled:!!s,refetchInterval:1e3}),p=ce(Ep);Ne(()=>{s?.id&&d?.connected===!1&&!p.isPending&&p.mutate({platform:s.platform,deviceId:s.id})},[s,d?.connected]);const m=c?.success??!1,b=d?.connected??!1,v=m&&b,y=c?.base64,w=ce(kp),O=ce(Ai),U=ce(Pp),T=ce(rm),B=ce(Up),k=async(N,A)=>{C.setState(ne=>({...ne,enableAnimations:A})),A||await w.mutateAsync()},P=async N=>{const A=o.current;if(!A)return;const ne=A.getBoundingClientRect(),de=A.naturalWidth/ne.width,dt=A.naturalHeight/ne.height,Ce=Math.round((N.clientX-ne.left)*de),Se=Math.round((N.clientY-ne.top)*dt),Ke={platform:s?.platform??"android",deviceId:s?.id,screenWidth:A.naturalWidth,screenHeight:A.naturalHeight},yt=y;let Xe=null;if(t){const xt=document.createElement("canvas"),Ge=100;xt.width=Ge,xt.height=Ge;const Qt=xt.getContext("2d");if(Qt){Qt.drawImage(A,Ce-Ge/2,Se-Ge/2,Ge,Ge,0,0,Ge,Ge);const en=xt.toDataURL("image/jpeg",.8);let tn="";try{tn=(await U.mutateAsync({x:Ce,y:Se,...Ke})).elementId||""}catch(We){console.error("Failed to get element ID:",We)}Xe=Date.now();const Sn={id:Xe,type:e==="assert"?"assert":"tap",x:Ce,y:Se,cropBase64:en,elementId:tn,descriptionText:"Generating description...",optional:!1,useLlmOnly:!1,...Ke};C.setState(We=>({...We,test:{...We.test,steps:[...We.test.steps,Sn]}})),(async()=>{let We=yt;if(e==="interact"&&(await O.mutateAsync({x:Ce,y:Se,...Ke}),await new Promise(ue=>setTimeout(ue,2e3)),s?.id))try{const ue=await r.fetchQuery({...fo({platform:s.platform,deviceId:s.id}),staleTime:0});ue?.base64&&(We=ue.base64)}catch(ue){console.error("Failed to fetch post-action screenshot",ue)}try{const ue=await T.mutateAsync({fullImage:yt??"",croppedImage:en,targetImage:We??"",type:e==="assert"?"assert":"interaction"});C.setState(ve=>({...ve,test:{...ve.test,steps:ve.test.steps.map(ye=>ye.id===Xe?{...ye,descriptionText:ue.description}:ye)}}));try{const ve=C.state.test.steps,ye=ve.findIndex(g=>g.id===Xe),Ve=ye!==-1?ye+1:ve.length;B.mutate({stepNumber:Ve,stepDescription:ue.description,filepath:void 0,screenshot:yt,interactionCoordinates:{x:Ce,y:Se,action:"tap"},platform:s?.platform,screenResolution:{width:A.naturalWidth,height:A.naturalHeight}})}catch(ve){console.error("Error populating cache:",ve)}}catch(ue){console.error("Failed to describe interaction",ue);const ve=e==="assert"?"Assert Element":"Tap Interaction";C.setState(ye=>({...ye,test:{...ye.test,steps:ye.test.steps.map(Ve=>Ve.id===Xe?{...Ve,descriptionText:ve}:Ve)}}))}try{const ue=C.state.test.steps,ve=ue.findIndex(g=>g.id===Xe),ye=ve!==-1?ve+1:ue.length,Ve=e==="assert"?"Assert Element":"Tap Interaction";B.mutate({stepNumber:ye,stepDescription:Ve,filepath:void 0,screenshot:yt,interactionCoordinates:{x:Ce,y:Se,action:"tap"},platform:s?.platform,screenResolution:{width:A.naturalWidth,height:A.naturalHeight}})}catch(ue){console.error("Error populating cache (fallback):",ue)}})()}}else await O.mutateAsync({x:Ce,y:Se,...Ke})},te=f?"Connecting...":u?"Error":v?"Connected":m&&!b?"Starting Appium...":"Disconnected";return x(im,{children:[l(M,{variant:"h5",children:"Device"}),l(Ht,{}),x(am,{children:[x(gn,{size:"small",sx:{minWidth:150},children:[l(bn,{children:"Device"}),l(vn,{value:a||"",label:"Device",onChange:N=>{const A=N.target.value,ne=i.find(de=>de.id===A);C.setState(de=>({...de,selectedDeviceId:A,selectedPlatform:ne?.platform||"android"}))},children:i.map(N=>x(Dt,{value:N.id,children:[N.name," (",N.platform,")"]},N.id))})]}),l(we,{control:l(Ar,{checked:t}),label:"Recording",onChange:(N,A)=>{C.setState(ne=>({...ne,isRecording:A}))}}),l(we,{control:l(Ar,{checked:n}),label:"Animations",onChange:k}),x(Ji,{color:"primary",exclusive:!0,value:e,onChange:(N,A)=>{A&&C.setState(ne=>({...ne,mode:A}))},"aria-label":"Mode",children:[l(Pr,{value:"interact",children:"Interact"}),l(Pr,{value:"assert",children:"Assert"})]}),l(sm,{connected:v,children:te})]}),l(lm,{children:y?l(cm,{ref:o,src:y,alt:"Device Screen",draggable:!1,onClick:P,recording:t}):l(dm,{children:i.length===0?l(M,{variant:"body2",color:"text.secondary",children:"No devices found."}):a?x(Xn,{children:[l(go,{}),l(M,{variant:"body2",color:"text.secondary",children:"Connecting to device..."})]}):l(M,{variant:"body2",color:"text.secondary",children:"Select a device."})})})]})},im=G(In)`
|
|
318
318
|
display: grid;
|
|
319
319
|
grid-template-areas:
|
|
320
320
|
'title'
|
|
@@ -324,23 +324,23 @@ export async function runTest() {
|
|
|
324
324
|
grid-template-rows: auto auto auto 1fr;
|
|
325
325
|
row-gap: 0.75rem;
|
|
326
326
|
overflow: hidden;
|
|
327
|
-
`,
|
|
327
|
+
`,am=G.div`
|
|
328
328
|
display: flex;
|
|
329
329
|
gap: 0.5rem;
|
|
330
330
|
flex-wrap: wrap;
|
|
331
331
|
align-items: center;
|
|
332
|
-
`,
|
|
332
|
+
`,sm=G(M)`
|
|
333
333
|
font-size: 0.875rem;
|
|
334
334
|
color: ${({connected:e})=>e?"#4caf50":"#f44336"};
|
|
335
335
|
margin-left: auto;
|
|
336
|
-
`,
|
|
336
|
+
`,lm=G.div`
|
|
337
337
|
display: flex;
|
|
338
338
|
justify-content: center;
|
|
339
339
|
align-items: center;
|
|
340
340
|
overflow: hidden;
|
|
341
341
|
flex: 1;
|
|
342
342
|
min-height: 0;
|
|
343
|
-
`,
|
|
343
|
+
`,cm=G.img`
|
|
344
344
|
max-height: 100%;
|
|
345
345
|
max-width: 100%;
|
|
346
346
|
object-fit: contain;
|
|
@@ -352,52 +352,52 @@ export async function runTest() {
|
|
|
352
352
|
border-color: #2196f3;
|
|
353
353
|
box-shadow: 0 0 20px rgba(33, 150, 243, 0.4);
|
|
354
354
|
`}
|
|
355
|
-
`,
|
|
355
|
+
`,dm=G(ge)`
|
|
356
356
|
display: flex;
|
|
357
357
|
flex-direction: column;
|
|
358
358
|
align-items: center;
|
|
359
359
|
gap: 1rem;
|
|
360
|
-
`;function
|
|
360
|
+
`;function um(e){const t={};return e.forEach(n=>{const r=n.path.split("/");let o=t,i="";r.forEach((a,s)=>{i=i?`${i}/${a}`:a,o[a]||(o[a]={name:a,fullPath:i,type:s===r.length-1?n.type:"directory",children:{}}),s===r.length-1&&(o[a].type=n.type,o[a].fullPath=i),o=o[a].children})}),t}const Mi=({item:e,level:t,onSelect:n,selectedFile:r,onRename:o})=>{const[i,a]=Ee(!1),[s,c]=Ee(!1),[u,f]=Ee(e.name),d=()=>{u&&u!==e.name&&o(e.fullPath,u),c(!1)},p=Object.keys(e.children).length>0,m=Object.values(e.children).sort((b,v)=>b.type===v.type?b.name.localeCompare(v.name):b.type==="directory"?-1:1);return s?l(On,{sx:{pl:t*2},children:l(H,{value:u,onChange:b=>f(b.target.value),size:"small",autoFocus:!0,onBlur:d,onKeyDown:b=>{b.key==="Enter"&&d(),b.key==="Escape"&&c(!1)},InputProps:{endAdornment:l(ea,{position:"end",children:l(_,{size:"small",onMouseDown:d,children:l(ms,{fontSize:"small"})})})}})}):x(Xn,{children:[e.type==="directory"?l(mn,{droppableId:`FOLDER_ROW::${e.fullPath}`,children:(b,v)=>x("div",{ref:b.innerRef,...b.droppableProps,children:[x(On,{button:!0,onClick:y=>{a(!i)},onDoubleClick:()=>{f(e.name),c(!0)},selected:r===e.fullPath,sx:{pl:t*2,bgcolor:v.isDraggingOver?"action.hover":void 0},children:[l(Rr,{sx:{minWidth:32},children:l(ds,{fontSize:"small",color:"primary"})}),l(Tr,{primary:e.name,primaryTypographyProps:{variant:"body2",noWrap:!0}}),p&&(i?l(ps,{fontSize:"small"}):l(fs,{fontSize:"small"}))]}),b.placeholder]})}):x(On,{button:!0,onClick:()=>n(e.fullPath),onDoubleClick:()=>{f(e.name),c(!0)},selected:r===e.fullPath,sx:{pl:t*2},children:[l(Rr,{sx:{minWidth:32},children:l(us,{fontSize:"small",color:"action"})}),l(Tr,{primary:e.name,primaryTypographyProps:{variant:"body2",noWrap:!0}})]}),e.type==="directory"&&l(ta,{in:i,timeout:"auto",unmountOnExit:!0,children:l(mn,{droppableId:e.fullPath,children:b=>x(bo,{component:"div",disablePadding:!0,ref:b.innerRef,...b.droppableProps,children:[m.map((v,y)=>l(Cr,{draggableId:v.fullPath,index:y,children:(w,O)=>l("div",{ref:w.innerRef,...w.draggableProps,...w.dragHandleProps,style:{...w.draggableProps.style,opacity:O.isDragging?.9:1},children:l(Mi,{item:v,level:t+1,onSelect:n,selectedFile:r,onRename:o})})},v.fullPath)),b.placeholder]})})})]})};function pm({files:e,onSelect:t,selectedFile:n,refetch:r}){const o=um(e),i=Object.values(o).sort((c,u)=>c.type===u.type?c.name.localeCompare(u.name):c.type==="directory"?-1:1),a=ce(pf),s=async(c,u)=>{try{const f=c.split("/");f.pop();const d=f.join("/"),p=d?`${d}/${u}`:u;await a.mutateAsync({oldPath:c,newPath:p}),r()}catch(f){alert("Rename failed: "+f.message)}};return l(yi,{onDragEnd:async c=>{const{destination:u,draggableId:f}=c;if(!u)return;const d=u.droppableId;let p="";d==="ROOT"?p="":d.startsWith("FOLDER_ROW::")?p=d.slice(12):p=d;const m=f;if(!m||p&&(m===p||p.startsWith(m+"/")))return;const b=m.lastIndexOf("/"),v=b>=0?m.slice(0,b):"";if((p||"")===v)return;const y=b>=0?m.slice(b+1):m,w=p?`${p}/${y}`:y;try{await a.mutateAsync({oldPath:m,newPath:w}),r()}catch(O){alert("Move failed: "+O.message)}},children:l(mn,{droppableId:"ROOT",children:c=>x(bo,{dense:!0,ref:c.innerRef,...c.droppableProps,children:[i.map((u,f)=>l(Cr,{draggableId:u.fullPath||u.name,index:f,children:(d,p)=>l("div",{ref:d.innerRef,...d.draggableProps,...d.dragHandleProps,style:{...d.draggableProps.style,opacity:p.isDragging?.9:1},children:l(Mi,{item:u,level:1,onSelect:t,selectedFile:n,onRename:s})})},u.fullPath||u.name)),c.placeholder]})})})}function fm({onSelectFile:e,selectedFile:t}){const{data:n,isLoading:r,error:o,refetch:i}=mt({...Sr,refetchInterval:2e3}),[a,s]=Ee(!1),[c,u]=Ee("file"),[f,d]=Ee(""),p=ce(ef),m=async()=>{if(!f)return;let y=f;c==="file"&&!y.endsWith(".json")&&(y+=".json");try{await p.mutateAsync({name:y,type:c}),s(!1),d(""),i()}catch(w){alert("Failed to create: "+w.message)}},b=y=>{u(y),d(""),s(!0)};if(r&&!n)return l(Gn,{children:l(go,{})});if(o)return l(Gn,{children:l(M,{color:"error",children:"Error loading files"})});const v=n?.files||[];return x(Gn,{children:[x(mm,{children:[l(M,{variant:"h6",children:"Tests"}),x(ge,{children:[l(_,{onClick:()=>i(),size:"small",title:"Refresh",children:l(ls,{})}),l(_,{onClick:()=>b("directory"),size:"small",title:"New Folder",children:l(cs,{})}),l(_,{onClick:()=>b("file"),size:"small",color:"primary",title:"New Test",children:l(Co,{})})]})]}),l(Ht,{}),l(hm,{children:v.length===0?l(M,{variant:"caption",sx:{p:2,display:"block",textAlign:"center",color:"text.secondary"},children:"No tests found"}):l(pm,{files:v,onSelect:e,selectedFile:t,refetch:i})}),x(qi,{open:a,onClose:()=>s(!1),children:[x(Yi,{children:["Create New ",c==="file"?"Test":"Folder"]}),l(Ki,{children:l(H,{autoFocus:!0,margin:"dense",label:"Name",fullWidth:!0,value:f,onChange:y=>d(y.target.value),placeholder:c==="file"?"my-test":"my-folder"})}),x(Xi,{children:[l(Ae,{onClick:()=>s(!1),children:"Cancel"}),l(Ae,{onClick:m,variant:"contained",children:"Create"})]})]})]})}const Gn=G(In)`
|
|
361
361
|
display: flex;
|
|
362
362
|
flex-direction: column;
|
|
363
363
|
padding: 0;
|
|
364
364
|
overflow: hidden;
|
|
365
365
|
height: 100%;
|
|
366
|
-
`,
|
|
366
|
+
`,mm=G.div`
|
|
367
367
|
padding: 1rem;
|
|
368
368
|
display: flex;
|
|
369
369
|
align-items: center;
|
|
370
370
|
justify-content: space-between;
|
|
371
|
-
`,
|
|
371
|
+
`,hm=G.div`
|
|
372
372
|
flex: 1;
|
|
373
373
|
overflow-y: auto;
|
|
374
374
|
padding: 0.5rem 0;
|
|
375
|
-
`;function
|
|
375
|
+
`;function gm({disabled:e}){const t=Ie(C,u=>u.test.params),[n,r]=Ee(()=>Object.entries(t||{}).map(([u,f])=>({key:u,value:f})));Ne(()=>{r(Object.entries(t||{}).map(([u,f])=>({key:u,value:f})))},[t]),Ui(()=>new Set(n.map(u=>u.key)),[n]);const o=u=>{const f={};for(const d of u)d.key&&(f[d.key]=d.value);C.setState(d=>({...d,test:{...d.test,params:f}}))},i=()=>{const u=[...n,{key:"",value:""}];r(u)},a=u=>{const f=n.filter((d,p)=>p!==u);r(f),o(f)},s=(u,f)=>{const d=n.map((p,m)=>m===u?{...p,key:f}:p);r(d),o(d)},c=(u,f)=>{const d=n.map((p,m)=>m===u?{...p,value:f}:p);r(d),o(d)};return x(bm,{children:[x(vm,{children:[l(M,{variant:"subtitle1",children:"Test Params"}),l(ln,{title:e?"Select a test to edit params":"Add parameter",children:l("span",{children:l(_,{size:"small",disabled:e,onClick:i,color:"primary",children:l(Co,{})})})})]}),l(Ht,{}),x(ym,{children:[n.length===0&&l(Dm,{children:l(M,{variant:"caption",color:"text.secondary",children:e?"No test selected":"No params. Click + to add"})}),n.map((u,f)=>{const d=u.key&&n.some((p,m)=>m!==f&&p.key===u.key);return x(xm,{children:[l(H,{size:"small",label:"Key",value:u.key,onChange:p=>s(f,p.target.value),disabled:e,error:!!d,helperText:d?"Duplicate key":" "}),l(H,{size:"small",label:"Value",value:u.value,onChange:p=>c(f,p.target.value),disabled:e}),l(ln,{title:e?"":"Remove",children:l("span",{children:l(_,{size:"small",disabled:e,onClick:()=>a(f),children:l(Ye,{})})})})]},f)})]}),!e&&n.length>0&&l(ge,{sx:{p:1,display:"flex",justifyContent:"flex-end"},children:l(Ae,{size:"small",onClick:()=>o(n),children:"Apply"})})]})}const bm=G(In)`
|
|
376
376
|
display: flex;
|
|
377
377
|
flex-direction: column;
|
|
378
378
|
padding: 0;
|
|
379
379
|
height: 100%;
|
|
380
380
|
overflow: hidden;
|
|
381
|
-
`,
|
|
381
|
+
`,vm=G.div`
|
|
382
382
|
padding: 0.75rem 1rem;
|
|
383
383
|
display: flex;
|
|
384
384
|
align-items: center;
|
|
385
385
|
justify-content: space-between;
|
|
386
|
-
`,
|
|
386
|
+
`,ym=G.div`
|
|
387
387
|
padding: 0.5rem 0.75rem;
|
|
388
388
|
display: flex;
|
|
389
389
|
flex-direction: column;
|
|
390
390
|
gap: 0.5rem;
|
|
391
391
|
overflow: auto;
|
|
392
|
-
`,
|
|
392
|
+
`,xm=G.div`
|
|
393
393
|
display: grid;
|
|
394
394
|
grid-template-columns: 1fr 1fr auto;
|
|
395
395
|
gap: 0.5rem;
|
|
396
396
|
align-items: center;
|
|
397
|
-
`,Dm=
|
|
397
|
+
`,Dm=G.div`
|
|
398
398
|
padding: 0.75rem;
|
|
399
399
|
text-align: center;
|
|
400
|
-
`;function
|
|
400
|
+
`;function Em(){const e=Ie(Zt,n=>n),t=ho(()=>{Hf()},[]);return l(Zi,{open:e.open,onClose:t,className:"absolute z-10",style:{maxWidth:"384px"},anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:e.maintainDisplayed?null:3e3,children:x(Qi,{severity:e.type,onClose:t,children:[e.title!==void 0&&l(hs,{sx:{...e.description==null&&e.listContent==null&&{marginBottom:0}},children:e.title}),e.description!==void 0&&e.description,e.listContent!==void 0&&e.listContent.length>0&&l("ul",{className:"mt-2 ml-2 list-disc list-inside",children:e.listContent.map((n,r)=>l("li",{children:n},r))})]})})}function Uh(){const[e,t]=Ee(),n=ce(Or),r=ce(lf);return Ne(()=>{e&&n.mutateAsync({path:e}).then(o=>{const i=o.content;let a=[],s={};Array.isArray(i)?(a=i,s={}):i&&Array.isArray(i.steps)&&(a=i.steps,s=i.params||{});const c=a.map((u,f)=>({...u,id:u.id||Date.now()+f}));C.setState(u=>({...u,test:{name:o.path,steps:c,params:s}}))}).catch(o=>{o instanceof Error?o.message:String(o),Kn("Failed to read file",{title:"Read Error"})})},[e]),x(Xn,{children:[x(wm,{children:[l(Cm,{children:l(fm,{onSelectFile:t,selectedFile:e})}),l(Im,{children:l(gm,{disabled:!e})}),l(Nm,{children:l(Kf,{onSave:async()=>{if(e)try{const o=C.state.test.steps.map(({statusDiv:a,element:s,status:c,statusColor:u,originRef:f,...d})=>d),i={...C.state.test,steps:o};await r.mutateAsync({path:e,content:i}),Vi("File saved",{title:"Saved"})}catch(o){Kn(o?.message?String(o.message):"Failed to save",{title:"Save Error"})}},canSave:!!e})}),l(Sm,{children:l(om,{})})]}),l(Em,{})]})}const wm=G.div`
|
|
401
401
|
display: grid;
|
|
402
402
|
grid-template-areas:
|
|
403
403
|
'files editor simulator'
|
|
@@ -409,18 +409,18 @@ export async function runTest() {
|
|
|
409
409
|
padding: 1rem;
|
|
410
410
|
column-gap: 1rem;
|
|
411
411
|
row-gap: 1rem;
|
|
412
|
-
`,
|
|
412
|
+
`,Cm=G.div`
|
|
413
413
|
grid-area: files;
|
|
414
414
|
min-height: 0; /* allow internal scroll */
|
|
415
|
-
`,
|
|
415
|
+
`,Im=G.div`
|
|
416
416
|
grid-area: params;
|
|
417
417
|
min-height: 0;
|
|
418
|
-
`,
|
|
418
|
+
`,Nm=G.div`
|
|
419
419
|
grid-area: editor;
|
|
420
420
|
min-height: 0;
|
|
421
421
|
height: 100%;
|
|
422
422
|
overflow-y: auto;
|
|
423
|
-
`,
|
|
423
|
+
`,Sm=G.div`
|
|
424
424
|
grid-area: simulator;
|
|
425
425
|
min-height: 0;
|
|
426
|
-
`;export{
|
|
426
|
+
`;export{Uh as component};
|