RoboticsArdioGen2App.react",["ix","CurrentUser","DateTime","GeoFlexbox.react","Image.react","RelayHooks","RoboticsArdioGen2AlertModal.react","RoboticsArdioGen2AppCancelTaskMutation.graphql","RoboticsArdioGen2AppCreateTaskMutation.graphql","RoboticsArdioGen2AppQuery.graphql","RoboticsArdioGen2Header.react","RoboticsArdioGen2HelpModal.react","RoboticsArdioGen2Selectors","RoboticsArdioGen2StateContainer","RoboticsArdioGen2TaskCard.react","RoboticsArdioGen2WaitModal.react","RoboticsDesignSystemButton.react","RoboticsDesignSystemSpinner.react","RoboticsDesignSystemText.react","RoboticsROSGen2Interface","RoboticsStateContainerROSModuleActions","RoboticsZenonJoinHandler","Timezone","react","useCountdownSeconds","useRoboticsLazyLoadQuery"],(function(a,b,c,d,e,f,g,h){"use strict";var i,j,k,l,m=l||(l=d("react"));e=l;var n=e.useCallback,o=e.useEffect,p=e.useState,aa=3,q=600,ba=60,ca=i!==void 0?i:i=b("RoboticsArdioGen2AppCreateTaskMutation.graphql"),da=j!==void 0?j:j=b("RoboticsArdioGen2AppCancelTaskMutation.graphql"),ea=k!==void 0?k:k=b("RoboticsArdioGen2AppQuery.graphql");function a(){o(function(){var a=c("RoboticsZenonJoinHandler")();return function(){a==null||a.release()}},[]);var a=d("RoboticsArdioGen2StateContainer").useDispatch();o(function(){a(d("RoboticsStateContainerROSModuleActions").rosConnectionRequested())},[a]);var b=p(!1),e=b[0],g=b[1];b=p(!1);var i=b[0],j=b[1];b=p(!1);var k=b[0],l=b[1],t=d("RoboticsArdioGen2StateContainer").useTopic(d("RoboticsROSGen2Interface").ROSTopic.RobotStatus,d("RoboticsArdioGen2Selectors").getRobotStatus);b=d("RoboticsArdioGen2StateContainer").useTopic(d("RoboticsROSGen2Interface").ROSTopic.BaseStatus,d("RoboticsArdioGen2Selectors").getIsMotorsEnabled);var u=t===d("RoboticsROSGen2Interface").RobotStatus.Pause,v=p(!1),fa=v[0],w=v[1];v=p(!1);var x=v[0],y=v[1];v=p(null);var z=v[0],ga=v[1];v=p(null);var ha=v[0],A=v[1];v=p(!1);var ia=v[0];v=v[1];var B=p(!1),C=B[0],D=B[1];B=p(null);var E=B[0],F=B[1];B=p(!1);var G=B[0],H=B[1],I=c("CurrentUser").getID();B=c("useRoboticsLazyLoadQuery")(ea,{query_params:{robot_id:I,source:"ARDIO"}});B=B[0].tasks;var J=B==null?void 0:B.nodes.find(function(a){return a.isRobotHold===!0}),K=d("RoboticsArdioGen2StateContainer").useTopic(d("RoboticsROSGen2Interface").ROSTopic.Battery,d("RoboticsArdioGen2Selectors").getBatteryStatus),L=K.isCharging;o(function(){a(d("RoboticsStateContainerROSModuleActions").rosParamRequested({paramName:d("RoboticsROSGen2Interface").ROSParam.LowBatteryThreshold}))},[a]);var M=d("RoboticsArdioGen2StateContainer").useTopic(d("RoboticsROSGen2Interface").ROSTopic.Battery,d("RoboticsArdioGen2Selectors").getIsBatteryCritical);K=p(!1);var N=K[0],O=K[1];K=p(!1);var ja=K[0],P=K[1];K=p(null);var Q=K[0],R=K[1];c("useCountdownSeconds")(function(){P(!1),R(null)},Q);o(function(){M===!0&&N===!1?O(!0):N===!0&&L===!0&&(P(!0),O(!1),R(10),a(d("RoboticsStateContainerROSModuleActions").rosServiceRequested({serviceName:d("RoboticsROSGen2Interface").ROSService.SetBaseMode,requestPayload:{enable:!0}})))},[a,M,N,L]);o(function(){if(J!=null){A(J.expirationTime);g(!1);return}C||(A(null),i&&j(!1))},[i,C,J,u]);c("useCountdownSeconds")(function(){y(!1)},z);var S=n(function(a){ga(a?ba:null),y(a)},[]);K=d("RelayHooks").useMutation(ca);var ka=K[0],la=K[1],ma=n(function(){g(!0),ka({onError:function(){g(!1),D(!0),A(c("DateTime").now(d("Timezone").UTC).addSeconds(q).instant)},variables:{input:{robot_id:I,workflow_id:"",priority:"P0",owner_id:I,expiration_time:c("DateTime").now(d("Timezone").UTC).addSeconds(q).instant,source:"ARDIO",is_repeat_workflow:!1,not_run_before_time:0}}})},[ka,I]);Q=d("RelayHooks").useMutation(da);var na=Q[0],oa=Q[1];z=n(function(){var b;G&&H(!1);x&&S(!1);j(!0);a(d("RoboticsStateContainerROSModuleActions").rosServiceRequested({serviceName:d("RoboticsROSGen2Interface").ROSService.Resume,requestPayload:null}));if(C&&J==null){A(null);D(!1);F(null);j(!1);return}na({onCompleted:function(){j(!1),F(null)},onError:function(){j(!1),F(null)},variables:{input:{task_record_ids:[(b=J==null?void 0:J.id)!=null?b:""]}}})},[na,a,S,G,x,C,J]);var T=c("useCountdownSeconds")(z,E),pa=n(function(){C&&D(!1),L&&S(!0),a(d("RoboticsStateContainerROSModuleActions").rosServiceRequested({serviceName:d("RoboticsROSGen2Interface").ROSService.Pause,requestPayload:null})),ma()},[a,ma,S,L,C]),U=n(function(){j(!0),F(aa)},[]),V=d("RoboticsArdioGen2StateContainer").useTopic(d("RoboticsROSGen2Interface").ROSTopic.EStop,d("RoboticsArdioGen2Selectors").getRobotEStopStatus);K=p(null);var W=K[0],X=K[1];Q=p(null);E=Q[0];var qa=Q[1];K=n(function(){a(d("RoboticsStateContainerROSModuleActions").rosServiceRequested({serviceName:d("RoboticsROSGen2Interface").ROSService.ResetBase,requestPayload:{}}))},[a]);var Y=c("useCountdownSeconds")(K,E),ra=n(function(){l(!0),qa(5)},[]);o(function(){(W===null||W===0||W===3)&&V===2?(X(2),ra()):W===2&&V!==2?(X(V),l(!1),qa(null)):(W===null||W===0||W===2)&&V===3&&X(3)},[ra,V,W]);function Z(){var a=Math.max(T!=null&&T>0?T:0,Y!=null&&Y>0?Y:0)||null;if((V===3||V===2)&&k)return m.jsx(r,{countdownDisplay:a});if(u||J!=null&&(t!==d("RoboticsROSGen2Interface").RobotStatus.Docking||L&&t===d("RoboticsROSGen2Interface").RobotStatus.Docking)){if(i)return m.jsx(r,{countdownDisplay:a});return L?m.jsxs(c("RoboticsDesignSystemButton.react"),{isDisabled:oa||la||ia,onPress:U,use:"success",direction:"column",grow:1,children:[m.jsx(c("RoboticsDesignSystemText.react"),{size:"large",color:"light",weight:"emphasized",children:"RESUME"}),m.jsx(c("Image.react"),{src:h("870359")})]}):m.jsxs(c("GeoFlexbox.react"),{xstyle:s.pausedButtons,direction:"column",children:[m.jsxs(c("RoboticsDesignSystemButton.react"),{use:"success",grow:1,onPress:function(){S(!0)},children:[m.jsx(c("RoboticsDesignSystemText.react"),{color:"light",size:"small",textAlign:"center",weight:"emphasized",children:"GO TO DOCK AND WAIT"}),m.jsx(c("GeoFlexbox.react"),{shrink:0,children:m.jsx(c("Image.react"),{src:h("835543")})})]}),m.jsxs(c("RoboticsDesignSystemButton.react"),{use:"success",onPress:U,children:[m.jsx(c("RoboticsDesignSystemText.react"),{size:"medium",color:"light",weight:"emphasized",children:"RESUME"}),m.jsx(c("Image.react"),{src:h("835544")})]})]})}if(e)return m.jsxs(c("RoboticsDesignSystemButton.react"),{use:"disabled",direction:"column",grow:1,children:[m.jsx(c("RoboticsDesignSystemText.react"),{size:"large",color:"light",weight:"emphasized",children:"PAUSING"}),m.jsx(c("RoboticsDesignSystemSpinner.react"),{})]});return J!=null&&t===d("RoboticsROSGen2Interface").RobotStatus.Docking?m.jsx(c("RoboticsDesignSystemButton.react"),{onPress:pa,use:"warning",isDisabled:!0,direction:"column",grow:1,children:m.jsx(c("RoboticsDesignSystemText.react"),{size:"medium",color:"light",weight:"emphasized",textAlign:"center",children:"RETURNING TO DOCK"})}):m.jsxs(c("RoboticsDesignSystemButton.react"),{onPress:pa,use:"danger",direction:"column",grow:1,children:[m.jsx(c("RoboticsDesignSystemText.react"),{size:"extra_large",color:"light",weight:"emphasized",children:"PAUSE"}),m.jsx(c("Image.react"),{src:h("433512")})]})}Z.displayName=Z.name+" [from "+f.id+"]";var $;M&&b?$=m.jsx(d("RoboticsArdioGen2AlertModal.react").RoboticsArdioGen2AlertModal,{actionButton:m.jsx(c("GeoFlexbox.react"),{xstyle:s.deactivateMotorsButton,grow:1,children:m.jsx(c("RoboticsDesignSystemButton.react"),{use:"warning",onPress:function(){a(d("RoboticsStateContainerROSModuleActions").rosServiceRequested({serviceName:d("RoboticsROSGen2Interface").ROSService.SetBaseMode,requestPayload:{enable:!1}}))},children:m.jsx(c("RoboticsDesignSystemText.react"),{color:"light",weight:"emphasized",children:"Deactivate Motors"})})}),modalUse:d("RoboticsArdioGen2AlertModal.react").RoboticsArdioGen2AlertModalUse.DeactivateMotors}):M&&!b?$=m.jsx(d("RoboticsArdioGen2AlertModal.react").RoboticsArdioGen2AlertModal,{modalUse:d("RoboticsArdioGen2AlertModal.react").RoboticsArdioGen2AlertModalUse.PushToDock}):ja?$=m.jsx(d("RoboticsArdioGen2AlertModal.react").RoboticsArdioGen2AlertModal,{modalUse:d("RoboticsArdioGen2AlertModal.react").RoboticsArdioGen2AlertModalUse.Docked}):V===3?$=m.jsx(d("RoboticsArdioGen2AlertModal.react").RoboticsArdioGen2AlertModal,{modalUse:d("RoboticsArdioGen2AlertModal.react").RoboticsArdioGen2AlertModalUse.EStop}):x?$=m.jsx(c("RoboticsArdioGen2WaitModal.react"),{handleResume:U,handleShowWaitModal:S,isCreateTaskMutationInFlight:la,isUsePauseFallback:C,setIsDurationChangeRequested:v,setIsUsePauseFallback:D,setHoldExpirationTime:A,setIsResumeImmediately:H}):fa&&($=m.jsx(c("RoboticsArdioGen2HelpModal.react"),{setIsShowHelpModal:w}));return m.jsxs(m.Fragment,{children:[$,m.jsxs(c("GeoFlexbox.react"),{xstyle:s.root,direction:"column",children:[m.jsx(c("RoboticsArdioGen2Header.react"),{handleCancelPause:z,holdExpirationTime:ha}),m.jsxs(c("GeoFlexbox.react"),{xstyle:s.body,children:[m.jsx(c("GeoFlexbox.react"),{xstyle:s.taskCardContainer,grow:4,justifyContent:"center",alignItems:"center",children:m.jsx(c("RoboticsArdioGen2TaskCard.react"),{taskRef:B==null?void 0:B.nodes[0]})}),m.jsxs(c("GeoFlexbox.react"),{xstyle:s.buttonContainer,direction:"column",justifyContent:"space-between",alignItems:"center",grow:1,children:[m.jsx(c("GeoFlexbox.react"),{xstyle:s.fullWidth,children:m.jsxs(c("RoboticsDesignSystemButton.react"),{onPress:function(){w(!0)},use:"warning",children:[m.jsx(c("RoboticsDesignSystemText.react"),{size:"large",color:"light",weight:"emphasized",children:"Help"}),m.jsx(c("Image.react"),{src:h("433511")})]})}),Z()]})]}),m.jsxs("div",babelHelpers["extends"]({className:"x1s85apg"},{children:[m.jsx(c("Image.react"),{src:h("1270829")}),m.jsx(c("Image.react"),{src:h("432345")}),m.jsx(c("Image.react"),{src:h("432346")}),m.jsx(c("Image.react"),{src:h("432347")}),m.jsx(c("Image.react"),{src:h("432348")}),m.jsx(c("Image.react"),{src:h("432349")}),m.jsx(c("Image.react"),{src:h("109756")}),m.jsx(c("Image.react"),{src:h("109761")}),m.jsx(c("Image.react"),{src:h("835542")}),m.jsx(c("Image.react"),{src:h("835543")}),m.jsx(c("Image.react"),{src:h("848504")}),m.jsx(c("Image.react"),{src:h("848368")}),m.jsx(c("Image.react"),{src:h("432350")}),m.jsx(c("Image.react"),{src:h("145800")}),m.jsx(c("Image.react"),{src:h("149973")}),m.jsx(c("Image.react"),{src:h("433512")}),m.jsx(c("Image.react"),{src:h("150850")}),m.jsx(c("Image.react"),{src:h("150852")}),m.jsx(c("Image.react"),{src:h("835545")}),m.jsx(c("Image.react"),{src:h("150854")}),m.jsx(c("Image.react"),{src:h("191985")}),m.jsx(c("Image.react"),{src:h("432351")}),m.jsx(c("Image.react"),{src:h("432352")}),m.jsx(c("Image.react"),{src:h("432353")}),m.jsx(c("Image.react"),{src:h("432378")}),m.jsx(c("Image.react"),{src:h("848505")})]}))]})]})}a.displayName=a.name+" [from "+f.id+"]";function r(a){a=a.countdownDisplay;return m.jsxs(c("RoboticsDesignSystemButton.react"),{use:"disabled",direction:"column",grow:1,children:[m.jsx(c("RoboticsDesignSystemText.react"),{size:"medium",color:"light",weight:"emphasized",children:"RESUMING"}),a!=null&&a>0?m.jsx(c("RoboticsDesignSystemText.react"),{size:"countdown",color:"light",weight:"emphasized",children:a!=null?a===0?1:a:""}):m.jsx(c("RoboticsDesignSystemSpinner.react"),{})]})}r.displayName=r.name+" [from "+f.id+"]";var s={root:{boxSizing:"x9f619",paddingTop:"x1p5oq8j",paddingInlineEnd:"x64bnmy",paddingBottom:"xwxc41k",paddingInlineStart:"x13jy36j",rowGap:"x1na6gtj",height:"x5yr21d",width:"xh8yej3",$$css:!0},body:{boxSizing:"x9f619",columnGap:"x1qgv0r9",height:"x5yr21d",width:"xh8yej3",$$css:!0},buttonContainer:{boxSizing:"x9f619",rowGap:"x1na6gtj",flexBasis:"x3j32gy",$$css:!0},deactivateMotorsButton:{marginBottom:"x13ihpsm",$$css:!0},fullWidth:{width:"xh8yej3",$$css:!0},pausedButtons:{rowGap:"x1na6gtj",height:"x5yr21d",width:"xh8yej3",$$css:!0},taskCardContainer:{flexBasis:"x4pfjvb",background:"x10u7ui4",borderStartStartRadius:"xbjudin",borderStartEndRadius:"xnlwouz",borderEndEndRadius:"xpp8er5",borderEndStartRadius:"xs9wviy",height:"x5yr21d",width:"xh8yej3",$$css:!0}};g["default"]=a}),98);
-----
RoboticsArdioGen2AppCreateTaskMutation.graphql",["RoboticsArdioGen2AppCreateTaskMutation_facebookRelayOperation"],(function(a,b,c,d,e,f){"use strict";a=function(){var a=[{defaultValue:null,kind:"LocalArgument",name:"input"}],c=[{alias:"task",args:[{kind:"Variable",name:"params",variableName:"input"}],concreteType:"RobotTaskRecord",kind:"LinkedField",name:"xfb_robotics_create_robot_task_record",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:a,kind:"Fragment",metadata:null,name:"RoboticsArdioGen2AppCreateTaskMutation",selections:c,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:a,kind:"Operation",name:"RoboticsArdioGen2AppCreateTaskMutation",selections:c},params:{id:b("RoboticsArdioGen2AppCreateTaskMutation_facebookRelayOperation"),metadata:{},name:"RoboticsArdioGen2AppCreateTaskMutation",operationKind:"mutation",text:null}}}();e.exports=a}),null);
-----
RoboticsArdioGen2AppCreateTaskMutation_facebookRelayOperation",[],(function(a,b,c,d,e,f){e.exports="23966343439734378"}),null);
-----
-----
RoboticsArdioGen2AppCreateTaskMutation.graphql",["RoboticsArdioGen2AppCreateTaskMutation_facebookRelayOperation"],(function(a,b,c,d,e,f){"use strict";a=function(){var a=[{defaultValue:null,kind:"LocalArgument",name:"input"}],c=[{alias:"task",args:[{kind:"Variable",name:"params",variableName:"input"}],concreteType:"RobotTaskRecord",kind:"LinkedField",name:"xfb_robotics_create_robot_task_record",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:a,kind:"Fragment",metadata:null,name:"RoboticsArdioGen2AppCreateTaskMutation",selections:c,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:a,kind:"Operation",name:"RoboticsArdioGen2AppCreateTaskMutation",selections:c},params:{id:b("RoboticsArdioGen2AppCreateTaskMutation_facebookRelayOperation"),metadata:{},name:"RoboticsArdioGen2AppCreateTaskMutation",operationKind:"mutation",text:null}}}();e.exports=a}),null);
-----
RoboticsArdioGen2AppCreateTaskMutation_facebookRelayOperation",[],(function(a,b,c,d,e,f){e.exports="23966343439734378"}),null);
-----