@opentrons/step-generation 0.3.22-alpha.0 → 0.3.24-alpha.0

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.
Files changed (36) hide show
  1. package/README.md +1 -1
  2. package/lib/commandCreators/atomic/disengageMagnet.d.ts +2 -3
  3. package/lib/commandCreators/atomic/dropTipInPlace.d.ts +2 -3
  4. package/lib/commandCreators/atomic/engageMagnet.d.ts +2 -3
  5. package/lib/commandCreators/atomic/liquidProbe.d.ts +2 -3
  6. package/lib/commandCreators/atomic/moveLabware.d.ts +2 -3
  7. package/lib/commandCreators/atomic/moveRelative.d.ts +2 -3
  8. package/lib/commandCreators/atomic/moveToAddressableAreaForDropTip.d.ts +2 -3
  9. package/lib/commandCreators/atomic/moveToCoordinates.d.ts +2 -3
  10. package/lib/commandCreators/atomic/moveToWell.d.ts +2 -3
  11. package/lib/commandCreators/atomic/thermocyclerCloseLid.d.ts +2 -3
  12. package/lib/commandCreators/atomic/thermocyclerDeactivateBlock.d.ts +2 -3
  13. package/lib/commandCreators/atomic/thermocyclerDeactivateLid.d.ts +2 -3
  14. package/lib/commandCreators/atomic/thermocyclerOpenLid.d.ts +2 -3
  15. package/lib/commandCreators/atomic/thermocyclerSetTargetBlockTemperature.d.ts +2 -3
  16. package/lib/commandCreators/atomic/thermocyclerSetTargetLidTemperature.d.ts +2 -3
  17. package/lib/commandCreators/atomic/thermocyclerStartRunExtendedProfile.d.ts +2 -3
  18. package/lib/commandCreators/atomic/tryLiquidProbe.d.ts +2 -3
  19. package/lib/getNextRobotStateAndWarnings/absorbanceReaderUpdates.d.ts +4 -5
  20. package/lib/getNextRobotStateAndWarnings/forConfigureNozzleLayout.d.ts +2 -11
  21. package/lib/getNextRobotStateAndWarnings/forDropTip.d.ts +2 -3
  22. package/lib/getNextRobotStateAndWarnings/forMoveLabware.d.ts +2 -3
  23. package/lib/getNextRobotStateAndWarnings/forMoveToAddressableArea.d.ts +4 -2
  24. package/lib/getNextRobotStateAndWarnings/forMoveToWell.d.ts +2 -3
  25. package/lib/getNextRobotStateAndWarnings/forPickUpTip.d.ts +2 -3
  26. package/lib/getNextRobotStateAndWarnings/heaterShakerUpdates.d.ts +8 -9
  27. package/lib/getNextRobotStateAndWarnings/inPlaceCommandUpdates.d.ts +3 -3
  28. package/lib/getNextRobotStateAndWarnings/magnetUpdates.d.ts +3 -4
  29. package/lib/getNextRobotStateAndWarnings/stackerUpdates.d.ts +22 -7
  30. package/lib/getNextRobotStateAndWarnings/temperatureUpdates.d.ts +4 -5
  31. package/lib/getNextRobotStateAndWarnings/thermocyclerUpdates.d.ts +32 -15
  32. package/lib/getNextRobotStateAndWarnings/vacuumUpdates.d.ts +13 -8
  33. package/lib/index.cjs +100 -100
  34. package/lib/index.mjs +8305 -7383
  35. package/lib/types.d.ts +87 -0
  36. package/package.json +2 -2
package/lib/index.cjs CHANGED
@@ -1,155 +1,155 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@opentrons/shared-data");function Zb(){return{type:"INSUFFICIENT_TIPS",message:"Not enough tips to complete action"}}function Xb(){return{type:"MISSING_96_CHANNEL_TIPRACK_ADAPTER",message:"A 96-channel cannot pick up tips fully without an adapter"}}function Qb(){return{type:"REMOVE_96_CHANNEL_TIPRACK_ADAPTER",message:"A 96-channel cannot pick up tips partially with an adapter"}}function zt(e){const{actionName:t,pipette:r,labware:n,well:a}=e;return{message:n==null||a==null?`Attempted to ${t} with no tip on pipette: ${r} in place`:`Attempted to ${t} with no tip on pipette: ${r} from ${n}'s well ${a}`,type:"NO_TIP_ON_PIPETTE"}}function Jb(){return{message:"One or more of the pipettes has a tip",type:"PIPETTE_HAS_TIP"}}function ft(e){const{pipette:t}=e;return{message:`This step tries to use the ${t}. Add the pipette to your protocol or change the step to use a different pipette.`,type:"PIPETTE_DOES_NOT_EXIST"}}function mt(e){const{actionName:t,labware:r}=e;return console.warn(`Attempted to ${t} with labware id "${r}", this labware was not found under "labware"`),{message:`This step tries to use ${r}. Add the labware to your protocol or change the step to use a different labware.`,type:"LABWARE_DOES_NOT_EXIST"}}function re(){return{message:"This step requires a module, but none is selected",type:"MISSING_MODULE"}}function eT(){return{message:"This module is not changing temperature because it has either been deactivated or is already holding a temperature. In order to pause the protocol and wait for your module to reach a temperature, you must first use a Temperature step to tell the module to start changing to a new temperature",type:"MISSING_TEMPERATURE_STEP"}}function Ep(){return{message:"This module is not currently running a profile.",type:"MISSING_PROFILE_STEP"}}function tT(e){const{volume:t,maxVolume:r,actionName:n}=e;return{message:`This step tries to ${n} ${t}µL, but the tip can only hold ${r}µL.`,type:"TIP_VOLUME_EXCEEDED"}}function H(e){const{parameterName:t}=e;return{message:`Runtime parameter "${t}" is missing`,type:"INVALID_RUNTIME_PARAMETER"}}function mo(e){const{actionName:t,volume:r,maxVolume:n,disposalVolume:a}=e;return{message:a!=null?`Attemped to ${t} volume + disposal volume greater than pipette max volume (${r} + ${a} > ${n})`:`This step tries to ${t} ${r}µL, but the tip can only hold ${n}µL.`,type:"PIPETTE_VOLUME_EXCEEDED"}}const rT=()=>({type:"MOVE_LOCATION_NOT_SPECIFIED",message:"This step is missing a move location."}),Aa=()=>({type:"MODULE_PIPETTE_COLLISION_DANGER",message:"Gen 1 8-Channel pipettes cannot access labware or tip racks in slot 4 or 6 because they are adjacent to modules."}),nT=()=>({type:"THERMOCYCLER_BUSY_WITH_PROFILE",message:"This step cannot run while the Thermocycler is running a profile. Move the step outside the profile."}),Sn=()=>({type:"THERMOCYCLER_LID_CLOSED",message:"Attempted to interact with contents of a thermocycler with the lid closed."}),To=()=>({type:"HEATER_SHAKER_LATCH_OPEN",message:"Attempted to interact with contents of a heater-shaker with the latch open."}),gp=()=>({type:"HEATER_SHAKER_LATCH_CLOSED",message:"Attempted to move the contents of a heater-shaker with the latch closed."}),qr=()=>({type:"ABSORBANCE_READER_LID_CLOSED",message:"Attempted to interact with contents of an absorbance plate reader with the lid closed."}),aT=()=>({type:"ABSORBANCE_READER_NO_INITIALIZATION",message:"This step tries to read labware without initializing the Plate Reader first. Initialize the Plate Reader module or remove this step in order to proceed."}),Mh=()=>({type:"ABSORBANCE_READER_NO_GRIPPER",message:"This step involves opening or closing the Absorbance Plate Reader lid with a gripper. Add a gripper or remove step to proceed."}),oT=()=>({type:"HOPPER_EMPTY",message:"Cannot retrieve labware from empty stacker"}),sT=()=>({type:"SHUTTLE_FULL",message:"Shuttle must be empty in order to retrieve labware from the stacker"}),iT=()=>({type:"SHUTTLE_EMPTY",message:"Shuttle must have labware in order to store it in the stacker"}),Fh=()=>({type:"MISMATCHED_STACKER_LABWARE_TYPE",message:"The stacker can only store a single type of labware at a time"}),lT=()=>({type:"MISSING_STACKER_LABWARE_TYPE",message:"Add labware to the stacker in the starting deck so that you can refill it later"}),Uh=()=>({type:"HOPPER_FULL",message:"The hopper has reached capacity"}),An=()=>({type:"HEATER_SHAKER_IS_SHAKING",message:"Attempted to interact with the contents of a heater-shaker when it is shaking."}),uT=e=>({type:"TALL_LABWARE_EAST_WEST_OF_HEATER_SHAKER",message:`Labware over 53 mm is ${e} of this Heater-Shaker module.`}),Bt=e=>{const{unsafePipetteMovementReason:t}=e;switch(t.type){case"thermocyclerLidCollision":return{type:"POSSIBLE_PIPETTE_COLLISION_THERMOCYCLER_LID",message:"There is a possibility that the Pipette will collide with the Thermocycler lid"};case"outsidePipetteExtents":return{type:"POSSIBLE_PIPETTE_COLLISION_OUTSIDE_DECK_EXTENTS",message:"There is a possibility that the pipette will move outside the deck extents."};case"adjacentAdressableAreaCollision":return{type:"POSSIBLE_PIPETTE_COLLISION_ADJACENT_ADDRESSABLE_AREA",message:`There is a possibility that the pipette will collide with adjacent items in ${t.addressableAreaCausingCollision.displayName}`,translationParams:{addressableAreaCausingCollisionDisplayName:t.addressableAreaCausingCollision.displayName}}}},La=()=>({type:"HEATER_SHAKER_EAST_WEST_LATCH_OPEN",message:"The Heater-Shaker labware latch is open"}),Oa=()=>({type:"HEATER_SHAKER_NORTH_SOUTH_EAST_WEST_SHAKING",message:"The Heater-Shaker is shaking"}),Ra=()=>({type:"HEATER_SHAKER_EAST_WEST_MULTI_CHANNEL",message:"The Heater-Shaker is shaking"}),Io=()=>({type:"HEATER_SHAKER_NORTH_SOUTH__OF_NON_TIPRACK_WITH_MULTI_CHANNEL",message:"8-Channel pipette cannot access labware"}),Ln=()=>({type:"LABWARE_OFF_DECK",message:"Attempted to interact with labware off deck"}),cT=()=>({type:"LABWARE_ON_ANOTHER_ENTITY",message:"Attempted to move labware onto another entity with the same slotName"}),Cn=()=>({type:"DROP_TIP_LOCATION_DOES_NOT_EXIST",message:"The destination for dropping tip does not exist"}),qh=()=>({type:"EQUIPMENT_DOES_NOT_EXIST",message:"Equipment does not exist."}),pT=()=>({type:"GRIPPER_REQUIRED",message:"The gripper is required to fulfill this action"}),xt=e=>({type:"PIPETTING_INTO_COLUMN_4",message:`Cannot ${e.typeOfStep} into a column 4 slot.`}),dT=()=>({type:"CANNOT_MOVE_WITH_GRIPPER",message:"The gripper cannot move aluminum blocks"}),fT=()=>({type:"NO_TIP_SELECTED",message:"No tips were selected for this step"}),va=()=>({type:"LABWARE_DISCARDED_IN_TRASH",message:"The labware was discarded in trash in a previous step."}),Vh=()=>({type:"SUBMERGE_BELOW_ASPIRATE",message:"The submerge position must be above the aspirate position"}),$h=()=>({type:"RETRACT_BELOW_ASPIRATE",message:"The retract position must be above the aspirate position"}),mT=()=>({type:"SUBMERGE_BELOW_DISPENSE",message:"The submerge position must be above the dispense position"}),hT=()=>({type:"RETRACT_BELOW_DISPENSE",message:"The retract position must be above the dispense position"}),_T=()=>({type:"MULTI_ASPIRATE_VOLUME_TOO_HIGH",message:"Consolidate pipette path was selected but cannot fit volume for more than 1 well in the tip"}),yT=()=>({type:"MULTI_DISPENSE_VOLUME_TOO_HIGH",message:"Distribute pipette path was selected but cannot fit volume for more than 1 well in the tip"}),bT=e=>({type:"CLOSING_THERMOCYCLER_WITH_INVALID_LABWARE_LID",message:`Closing the Thermocycler lid with ${e.lidDisplayName} in place will cause damage`}),wp=()=>({type:"RETURN_TIP_UNAVAILABLE",message:"Current tip does not have a known location to return to"}),TT=()=>({type:"TIPRACK_LID_NOT_ALLOWED_ON_DECK",message:"The tip rack lid is not supported directly on the deck"}),IT=()=>({type:"NEXT_TIPRACK_HAS_LID",message:"A pipette cannot pick up tips from a tip rack with a lid"}),ET=e=>({type:"STACK_TOO_HIGH",message:`The stack on slot ${e.slot} is too high`}),gT=()=>({type:"TOO_MANY_TIPS",message:"Action will pick up too many tips"}),wT=()=>({type:"INCOMPLETE_PICKUP",message:"At least one of the selected tips is empty"}),ST=()=>({type:"LABWARE_ON_HOPPER",message:"Labware cannot be moved from the Flex Stacker Hopper"}),AT=()=>({type:"MISSING_PUMP_ACTIVITY",message:"This module is not currently running a pump activity."}),LT=e=>({type:"INVALID_WAIT_CONDITION",message:`Invalid wait condition: ${e}`}),ka=()=>({type:"LIVE_TASK_ERROR",message:"This module is currently running a live task. Please wait for it to complete before performing this action."}),Sp=()=>({type:"VACUUM_UNDER_PRESSURE",message:"The vacuum module is under pressure. Deactivate the pump to move labware to or from it."});function Ge(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zo,Ap;function Bh(){if(Ap)return Zo;Ap=1;var e=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis;return Zo=e,Zo}var Xo,Lp;function jt(){if(Lp)return Xo;Lp=1;var e=Bh(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Xo=r,Xo}var Qo,Op;function Dn(){if(Op)return Qo;Op=1;var e=jt(),t=e.Symbol;return Qo=t,Qo}var Jo,Rp;function OT(){if(Rp)return Jo;Rp=1;var e=Dn(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,a=e?e.toStringTag:void 0;function o(s){var i=r.call(s,a),l=s[a];try{s[a]=void 0;var u=!0}catch{}var p=n.call(s);return u&&(i?s[a]=l:delete s[a]),p}return Jo=o,Jo}var es,vp;function RT(){if(vp)return es;vp=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return es=r,es}var ts,kp;function Mn(){if(kp)return ts;kp=1;var e=Dn(),t=OT(),r=RT(),n="[object Null]",a="[object Undefined]",o=e?e.toStringTag:void 0;function s(i){return i==null?i===void 0?a:n:o&&o in Object(i)?t(i):r(i)}return ts=s,ts}var rs,Pp;function sr(){if(Pp)return rs;Pp=1;function e(t){return t!=null&&typeof t=="object"}return rs=e,rs}var ns,Np;function Pa(){if(Np)return ns;Np=1;var e=Mn(),t=sr(),r="[object Symbol]";function n(a){return typeof a=="symbol"||t(a)&&e(a)==r}return ns=n,ns}var as,Cp;function xh(){if(Cp)return as;Cp=1;var e=Pa();function t(r,n,a){for(var o=-1,s=r.length;++o<s;){var i=r[o],l=n(i);if(l!=null&&(u===void 0?l===l&&!e(l):a(l,u)))var u=l,p=i}return p}return as=t,as}var os,Dp;function vT(){if(Dp)return os;Dp=1;function e(t,r){return t<r}return os=e,os}var ss,Mp;function Na(){if(Mp)return ss;Mp=1;function e(t){return t}return ss=e,ss}var is,Fp;function kT(){if(Fp)return is;Fp=1;var e=xh(),t=vT(),r=Na();function n(a){return a&&a.length?e(a,r,t):void 0}return is=n,is}var PT=kT();const NT=Ge(PT),Ca="TEMPERATURE_DEACTIVATED",yc="TEMPERATURE_AT_TARGET",bc="TEMPERATURE_APPROACHING_TARGET",Zu=1,Hh=[c.MAGNETIC_MODULE_V1,c.TEMPERATURE_MODULE_V1],Xu="fixedTrash",zh={type:c.MAGNETIC_MODULE_TYPE,engaged:!1},jh={type:c.TEMPERATURE_MODULE_TYPE,status:Ca,targetTemperature:null},Gh={type:c.THERMOCYCLER_MODULE_TYPE,currentBlockActivity:{type:"blockDeactivated"},lidTargetTemp:null,lidOpen:null,numProfilesStarted:0},Wh={type:c.HEATERSHAKER_MODULE_TYPE,targetTemp:null,targetSpeed:null,latchOpen:null},Yh={type:"absorbanceReaderType",lidOpen:null,initialization:null},Kh={type:"magneticBlockType"},Zh={type:c.FLEX_STACKER_MODULE_TYPE,storedLabwareDetails:null,labwareInHopper:null,labwareOnShuttle:null,setStoredLabwareCount:1,fillCount:1},Xh={type:c.VACUUM_MODULE_TYPE,ventStatus:null,numPumpActivitiesStarted:0,currentPumpActivity:{type:"pumpDeactivated"}},Qh={[c.MAGNETIC_MODULE_TYPE]:zh,[c.TEMPERATURE_MODULE_TYPE]:jh,[c.THERMOCYCLER_MODULE_TYPE]:Gh,[c.HEATERSHAKER_MODULE_TYPE]:Wh,[c.ABSORBANCE_READER_TYPE]:Yh,[c.MAGNETIC_BLOCK_TYPE]:Kh,[c.FLEX_STACKER_MODULE_TYPE]:Zh,[c.VACUUM_MODULE_TYPE]:Xh},CT="opentrons/opentrons_1_trash_1100ml_fixed/1",DT="opentrons/opentrons_1_trash_3200ml_fixed/1",De=["A4","B4","C4","D4"],At={x:0,y:0,z:0},Jh="mounted",Da="CLEAN",er="DIRTY",de="EMPTY",Tc="automatic",Lt="manual",e_=["A4","B4","C4","D4"],MT=["7","8","10","11"],et="hopper",t_=["hopperA4","hopperB4","hopperC4","hopperD4"],r_={hopperA4:"A4",hopperB4:"B4",hopperC4:"C4",hopperD4:"D4"},tr=["adapterLabwareId","primaryLabwareId","lidLabwareId"],FT=["adapterLabwareURI","primaryLabwareURI","lidLabwareURI"],UT={A4:"hopperA4",B4:"hopperB4",C4:"hopperC4",D4:"hopperD4"},Ic="vacuumDock",n_=c.VACUUM_MODULE_DOCK_A4_ADDRESSABLE_AREA,Ec="opened",Ma="closed",Qu="power",Ju="pressure",qT="state",VT="profile",$T="pumpOff",BT="pumpOn",xT="vent",HT="open",zT="closed",jT="VACUUM_DEACTIVATED",GT="VACUUM_AT_TARGET",a_=["opentrons_vacuum_manifold_spacer_short","opentrons_vacuum_manifold_spacer_tall","opentrons_vacuum_manifold_spacer_3.2mm","opentrons_vacuum_manifold_spacer_5.2mm","opentrons_vacuum_manifold_spacer_7.25mm","opentrons_vacuum_manifold_spacer_12.8mm"],o_=3,s_="A4",i_=[c.ALL,c.COLUMN,c.SINGLE,c.ROW,c.QUADRANT,c.PARTIAL_COLUMN],l_=[c.A1_NOZZLE,c.A12_NOZZLE,c.B1_NOZZLE,c.C1_NOZZLE,c.D1_NOZZLE,c.E1_NOZZLE,c.F1_NOZZLE,c.G1_NOZZLE,c.H1_NOZZLE,c.H12_NOZZLE],u_=[c.B1_NOZZLE,c.C1_NOZZLE,c.D1_NOZZLE,c.E1_NOZZLE,c.F1_NOZZLE,c.G1_NOZZLE],ze=[];for(let e=0;e<256;++e)ze.push((e+256).toString(16).slice(1));function WT(e,t=0){return(ze[e[t+0]]+ze[e[t+1]]+ze[e[t+2]]+ze[e[t+3]]+"-"+ze[e[t+4]]+ze[e[t+5]]+"-"+ze[e[t+6]]+ze[e[t+7]]+"-"+ze[e[t+8]]+ze[e[t+9]]+"-"+ze[e[t+10]]+ze[e[t+11]]+ze[e[t+12]]+ze[e[t+13]]+ze[e[t+14]]+ze[e[t+15]]).toLowerCase()}const YT=new Uint8Array(16);function KT(){return crypto.getRandomValues(YT)}function ZT(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():XT(e,t,r)}function XT(e,t,r){e=e||{};const n=e.random??e.rng?.()??KT();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let a=0;a<16;++a)t[r+a]=n[a];return t}return WT(n)}var ls,Up;function gc(){if(Up)return ls;Up=1;function e(t,r){for(var n=-1,a=r.length,o=t.length;++n<a;)t[o+n]=r[n];return t}return ls=e,ls}var us,qp;function QT(){if(qp)return us;qp=1;var e=Mn(),t=sr(),r="[object Arguments]";function n(a){return t(a)&&e(a)==r}return us=n,us}var cs,Vp;function Eo(){if(Vp)return cs;Vp=1;var e=QT(),t=sr(),r=Object.prototype,n=r.hasOwnProperty,a=r.propertyIsEnumerable,o=e((function(){return arguments})())?e:function(s){return t(s)&&n.call(s,"callee")&&!a.call(s,"callee")};return cs=o,cs}var ps,$p;function tt(){if($p)return ps;$p=1;var e=Array.isArray;return ps=e,ps}var ds,Bp;function JT(){if(Bp)return ds;Bp=1;var e=Dn(),t=Eo(),r=tt(),n=e?e.isConcatSpreadable:void 0;function a(o){return r(o)||t(o)||!!(n&&o&&o[n])}return ds=a,ds}var fs,xp;function c_(){if(xp)return fs;xp=1;var e=gc(),t=JT();function r(n,a,o,s,i){var l=-1,u=n.length;for(o||(o=t),i||(i=[]);++l<u;){var p=n[l];a>0&&o(p)?a>1?r(p,a-1,o,s,i):e(i,p):s||(i[i.length]=p)}return i}return fs=r,fs}var ms,Hp;function Fa(){if(Hp)return ms;Hp=1;function e(t,r){for(var n=-1,a=t==null?0:t.length,o=Array(a);++n<a;)o[n]=r(t[n],n,t);return o}return ms=e,ms}var hs,zp;function eI(){if(zp)return hs;zp=1;function e(){this.__data__=[],this.size=0}return hs=e,hs}var _s,jp;function go(){if(jp)return _s;jp=1;function e(t,r){return t===r||t!==t&&r!==r}return _s=e,_s}var ys,Gp;function wo(){if(Gp)return ys;Gp=1;var e=go();function t(r,n){for(var a=r.length;a--;)if(e(r[a][0],n))return a;return-1}return ys=t,ys}var bs,Wp;function tI(){if(Wp)return bs;Wp=1;var e=wo(),t=Array.prototype,r=t.splice;function n(a){var o=this.__data__,s=e(o,a);if(s<0)return!1;var i=o.length-1;return s==i?o.pop():r.call(o,s,1),--this.size,!0}return bs=n,bs}var Ts,Yp;function rI(){if(Yp)return Ts;Yp=1;var e=wo();function t(r){var n=this.__data__,a=e(n,r);return a<0?void 0:n[a][1]}return Ts=t,Ts}var Is,Kp;function nI(){if(Kp)return Is;Kp=1;var e=wo();function t(r){return e(this.__data__,r)>-1}return Is=t,Is}var Es,Zp;function aI(){if(Zp)return Es;Zp=1;var e=wo();function t(r,n){var a=this.__data__,o=e(a,r);return o<0?(++this.size,a.push([r,n])):a[o][1]=n,this}return Es=t,Es}var gs,Xp;function So(){if(Xp)return gs;Xp=1;var e=eI(),t=tI(),r=rI(),n=nI(),a=aI();function o(s){var i=-1,l=s==null?0:s.length;for(this.clear();++i<l;){var u=s[i];this.set(u[0],u[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=r,o.prototype.has=n,o.prototype.set=a,gs=o,gs}var ws,Qp;function oI(){if(Qp)return ws;Qp=1;var e=So();function t(){this.__data__=new e,this.size=0}return ws=t,ws}var Ss,Jp;function sI(){if(Jp)return Ss;Jp=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return Ss=e,Ss}var As,ed;function iI(){if(ed)return As;ed=1;function e(t){return this.__data__.get(t)}return As=e,As}var Ls,td;function lI(){if(td)return Ls;td=1;function e(t){return this.__data__.has(t)}return Ls=e,Ls}var Os,rd;function ir(){if(rd)return Os;rd=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Os=e,Os}var Rs,nd;function p_(){if(nd)return Rs;nd=1;var e=Mn(),t=ir(),r="[object AsyncFunction]",n="[object Function]",a="[object GeneratorFunction]",o="[object Proxy]";function s(i){if(!t(i))return!1;var l=e(i);return l==n||l==a||l==r||l==o}return Rs=s,Rs}var vs,ad;function uI(){if(ad)return vs;ad=1;var e=jt(),t=e["__core-js_shared__"];return vs=t,vs}var ks,od;function cI(){if(od)return ks;od=1;var e=uI(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return ks=r,ks}var Ps,sd;function d_(){if(sd)return Ps;sd=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return Ps=r,Ps}var Ns,id;function pI(){if(id)return Ns;id=1;var e=p_(),t=cI(),r=ir(),n=d_(),a=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,s=Function.prototype,i=Object.prototype,l=s.toString,u=i.hasOwnProperty,p=RegExp("^"+l.call(u).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(f){if(!r(f)||t(f))return!1;var m=e(f)?p:o;return m.test(n(f))}return Ns=d,Ns}var Cs,ld;function dI(){if(ld)return Cs;ld=1;function e(t,r){return t?.[r]}return Cs=e,Cs}var Ds,ud;function zr(){if(ud)return Ds;ud=1;var e=pI(),t=dI();function r(n,a){var o=t(n,a);return e(o)?o:void 0}return Ds=r,Ds}var Ms,cd;function wc(){if(cd)return Ms;cd=1;var e=zr(),t=jt(),r=e(t,"Map");return Ms=r,Ms}var Fs,pd;function Ao(){if(pd)return Fs;pd=1;var e=zr(),t=e(Object,"create");return Fs=t,Fs}var Us,dd;function fI(){if(dd)return Us;dd=1;var e=Ao();function t(){this.__data__=e?e(null):{},this.size=0}return Us=t,Us}var qs,fd;function mI(){if(fd)return qs;fd=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return qs=e,qs}var Vs,md;function hI(){if(md)return Vs;md=1;var e=Ao(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function a(o){var s=this.__data__;if(e){var i=s[o];return i===t?void 0:i}return n.call(s,o)?s[o]:void 0}return Vs=a,Vs}var $s,hd;function _I(){if(hd)return $s;hd=1;var e=Ao(),t=Object.prototype,r=t.hasOwnProperty;function n(a){var o=this.__data__;return e?o[a]!==void 0:r.call(o,a)}return $s=n,$s}var Bs,_d;function yI(){if(_d)return Bs;_d=1;var e=Ao(),t="__lodash_hash_undefined__";function r(n,a){var o=this.__data__;return this.size+=this.has(n)?0:1,o[n]=e&&a===void 0?t:a,this}return Bs=r,Bs}var xs,yd;function bI(){if(yd)return xs;yd=1;var e=fI(),t=mI(),r=hI(),n=_I(),a=yI();function o(s){var i=-1,l=s==null?0:s.length;for(this.clear();++i<l;){var u=s[i];this.set(u[0],u[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=r,o.prototype.has=n,o.prototype.set=a,xs=o,xs}var Hs,bd;function TI(){if(bd)return Hs;bd=1;var e=bI(),t=So(),r=wc();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Hs=n,Hs}var zs,Td;function II(){if(Td)return zs;Td=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return zs=e,zs}var js,Id;function Lo(){if(Id)return js;Id=1;var e=II();function t(r,n){var a=r.__data__;return e(n)?a[typeof n=="string"?"string":"hash"]:a.map}return js=t,js}var Gs,Ed;function EI(){if(Ed)return Gs;Ed=1;var e=Lo();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Gs=t,Gs}var Ws,gd;function gI(){if(gd)return Ws;gd=1;var e=Lo();function t(r){return e(this,r).get(r)}return Ws=t,Ws}var Ys,wd;function wI(){if(wd)return Ys;wd=1;var e=Lo();function t(r){return e(this,r).has(r)}return Ys=t,Ys}var Ks,Sd;function SI(){if(Sd)return Ks;Sd=1;var e=Lo();function t(r,n){var a=e(this,r),o=a.size;return a.set(r,n),this.size+=a.size==o?0:1,this}return Ks=t,Ks}var Zs,Ad;function Sc(){if(Ad)return Zs;Ad=1;var e=TI(),t=EI(),r=gI(),n=wI(),a=SI();function o(s){var i=-1,l=s==null?0:s.length;for(this.clear();++i<l;){var u=s[i];this.set(u[0],u[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=r,o.prototype.has=n,o.prototype.set=a,Zs=o,Zs}var Xs,Ld;function AI(){if(Ld)return Xs;Ld=1;var e=So(),t=wc(),r=Sc(),n=200;function a(o,s){var i=this.__data__;if(i instanceof e){var l=i.__data__;if(!t||l.length<n-1)return l.push([o,s]),this.size=++i.size,this;i=this.__data__=new r(l)}return i.set(o,s),this.size=i.size,this}return Xs=a,Xs}var Qs,Od;function Ac(){if(Od)return Qs;Od=1;var e=So(),t=oI(),r=sI(),n=iI(),a=lI(),o=AI();function s(i){var l=this.__data__=new e(i);this.size=l.size}return s.prototype.clear=t,s.prototype.delete=r,s.prototype.get=n,s.prototype.has=a,s.prototype.set=o,Qs=s,Qs}var Js,Rd;function LI(){if(Rd)return Js;Rd=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return Js=t,Js}var ei,vd;function OI(){if(vd)return ei;vd=1;function e(t){return this.__data__.has(t)}return ei=e,ei}var ti,kd;function f_(){if(kd)return ti;kd=1;var e=Sc(),t=LI(),r=OI();function n(a){var o=-1,s=a==null?0:a.length;for(this.__data__=new e;++o<s;)this.add(a[o])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,ti=n,ti}var ri,Pd;function m_(){if(Pd)return ri;Pd=1;function e(t,r){for(var n=-1,a=t==null?0:t.length;++n<a;)if(r(t[n],n,t))return!0;return!1}return ri=e,ri}var ni,Nd;function h_(){if(Nd)return ni;Nd=1;function e(t,r){return t.has(r)}return ni=e,ni}var ai,Cd;function __(){if(Cd)return ai;Cd=1;var e=f_(),t=m_(),r=h_(),n=1,a=2;function o(s,i,l,u,p,d){var f=l&n,m=s.length,h=i.length;if(m!=h&&!(f&&h>m))return!1;var _=d.get(s),b=d.get(i);if(_&&b)return _==i&&b==s;var T=-1,y=!0,I=l&a?new e:void 0;for(d.set(s,i),d.set(i,s);++T<m;){var w=s[T],E=i[T];if(u)var A=f?u(E,w,T,i,s,d):u(w,E,T,s,i,d);if(A!==void 0){if(A)continue;y=!1;break}if(I){if(!t(i,function(L,S){if(!r(I,S)&&(w===L||p(w,L,l,u,d)))return I.push(S)})){y=!1;break}}else if(!(w===E||p(w,E,l,u,d))){y=!1;break}}return d.delete(s),d.delete(i),y}return ai=o,ai}var oi,Dd;function y_(){if(Dd)return oi;Dd=1;var e=jt(),t=e.Uint8Array;return oi=t,oi}var si,Md;function RI(){if(Md)return si;Md=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(a,o){n[++r]=[o,a]}),n}return si=e,si}var ii,Fd;function Lc(){if(Fd)return ii;Fd=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(a){n[++r]=a}),n}return ii=e,ii}var li,Ud;function vI(){if(Ud)return li;Ud=1;var e=Dn(),t=y_(),r=go(),n=__(),a=RI(),o=Lc(),s=1,i=2,l="[object Boolean]",u="[object Date]",p="[object Error]",d="[object Map]",f="[object Number]",m="[object RegExp]",h="[object Set]",_="[object String]",b="[object Symbol]",T="[object ArrayBuffer]",y="[object DataView]",I=e?e.prototype:void 0,w=I?I.valueOf:void 0;function E(A,L,S,g,k,v,D){switch(S){case y:if(A.byteLength!=L.byteLength||A.byteOffset!=L.byteOffset)return!1;A=A.buffer,L=L.buffer;case T:return!(A.byteLength!=L.byteLength||!v(new t(A),new t(L)));case l:case u:case f:return r(+A,+L);case p:return A.name==L.name&&A.message==L.message;case m:case _:return A==L+"";case d:var q=a;case h:var Q=g&s;if(q||(q=o),A.size!=L.size&&!Q)return!1;var fe=D.get(A);if(fe)return fe==L;g|=i,D.set(A,L);var _e=n(q(A),q(L),g,k,v,D);return D.delete(A),_e;case b:if(w)return w.call(A)==w.call(L)}return!1}return li=E,li}var ui,qd;function b_(){if(qd)return ui;qd=1;var e=gc(),t=tt();function r(n,a,o){var s=a(n);return t(n)?s:e(s,o(n))}return ui=r,ui}var ci,Vd;function T_(){if(Vd)return ci;Vd=1;function e(t,r){for(var n=-1,a=t==null?0:t.length,o=0,s=[];++n<a;){var i=t[n];r(i,n,t)&&(s[o++]=i)}return s}return ci=e,ci}var pi,$d;function I_(){if($d)return pi;$d=1;function e(){return[]}return pi=e,pi}var di,Bd;function Oc(){if(Bd)return di;Bd=1;var e=T_(),t=I_(),r=Object.prototype,n=r.propertyIsEnumerable,a=Object.getOwnPropertySymbols,o=a?function(s){return s==null?[]:(s=Object(s),e(a(s),function(i){return n.call(s,i)}))}:t;return di=o,di}var fi,xd;function E_(){if(xd)return fi;xd=1;function e(t,r){for(var n=-1,a=Array(t);++n<t;)a[n]=r(n);return a}return fi=e,fi}var ha={exports:{}},mi,Hd;function kI(){if(Hd)return mi;Hd=1;function e(){return!1}return mi=e,mi}ha.exports;var zd;function Oo(){return zd||(zd=1,(function(e,t){var r=jt(),n=kI(),a=t&&!t.nodeType&&t,o=a&&!0&&e&&!e.nodeType&&e,s=o&&o.exports===a,i=s?r.Buffer:void 0,l=i?i.isBuffer:void 0,u=l||n;e.exports=u})(ha,ha.exports)),ha.exports}var hi,jd;function Ro(){if(jd)return hi;jd=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(n,a){var o=typeof n;return a=a??e,!!a&&(o=="number"||o!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<a}return hi=r,hi}var _i,Gd;function Rc(){if(Gd)return _i;Gd=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return _i=t,_i}var yi,Wd;function PI(){if(Wd)return yi;Wd=1;var e=Mn(),t=Rc(),r=sr(),n="[object Arguments]",a="[object Array]",o="[object Boolean]",s="[object Date]",i="[object Error]",l="[object Function]",u="[object Map]",p="[object Number]",d="[object Object]",f="[object RegExp]",m="[object Set]",h="[object String]",_="[object WeakMap]",b="[object ArrayBuffer]",T="[object DataView]",y="[object Float32Array]",I="[object Float64Array]",w="[object Int8Array]",E="[object Int16Array]",A="[object Int32Array]",L="[object Uint8Array]",S="[object Uint8ClampedArray]",g="[object Uint16Array]",k="[object Uint32Array]",v={};v[y]=v[I]=v[w]=v[E]=v[A]=v[L]=v[S]=v[g]=v[k]=!0,v[n]=v[a]=v[b]=v[o]=v[T]=v[s]=v[i]=v[l]=v[u]=v[p]=v[d]=v[f]=v[m]=v[h]=v[_]=!1;function D(q){return r(q)&&t(q.length)&&!!v[e(q)]}return yi=D,yi}var bi,Yd;function vc(){if(Yd)return bi;Yd=1;function e(t){return function(r){return t(r)}}return bi=e,bi}var _a={exports:{}};_a.exports;var Kd;function kc(){return Kd||(Kd=1,(function(e,t){var r=Bh(),n=t&&!t.nodeType&&t,a=n&&!0&&e&&!e.nodeType&&e,o=a&&a.exports===n,s=o&&r.process,i=(function(){try{var l=a&&a.require&&a.require("util").types;return l||s&&s.binding&&s.binding("util")}catch{}})();e.exports=i})(_a,_a.exports)),_a.exports}var Ti,Zd;function Pc(){if(Zd)return Ti;Zd=1;var e=PI(),t=vc(),r=kc(),n=r&&r.isTypedArray,a=n?t(n):e;return Ti=a,Ti}var Ii,Xd;function g_(){if(Xd)return Ii;Xd=1;var e=E_(),t=Eo(),r=tt(),n=Oo(),a=Ro(),o=Pc(),s=Object.prototype,i=s.hasOwnProperty;function l(u,p){var d=r(u),f=!d&&t(u),m=!d&&!f&&n(u),h=!d&&!f&&!m&&o(u),_=d||f||m||h,b=_?e(u.length,String):[],T=b.length;for(var y in u)(p||i.call(u,y))&&!(_&&(y=="length"||m&&(y=="offset"||y=="parent")||h&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||a(y,T)))&&b.push(y);return b}return Ii=l,Ii}var Ei,Qd;function vo(){if(Qd)return Ei;Qd=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,a=typeof n=="function"&&n.prototype||e;return r===a}return Ei=t,Ei}var gi,Jd;function w_(){if(Jd)return gi;Jd=1;function e(t,r){return function(n){return t(r(n))}}return gi=e,gi}var wi,ef;function NI(){if(ef)return wi;ef=1;var e=w_(),t=e(Object.keys,Object);return wi=t,wi}var Si,tf;function S_(){if(tf)return Si;tf=1;var e=vo(),t=NI(),r=Object.prototype,n=r.hasOwnProperty;function a(o){if(!e(o))return t(o);var s=[];for(var i in Object(o))n.call(o,i)&&i!="constructor"&&s.push(i);return s}return Si=a,Si}var Ai,rf;function jr(){if(rf)return Ai;rf=1;var e=p_(),t=Rc();function r(n){return n!=null&&t(n.length)&&!e(n)}return Ai=r,Ai}var Li,nf;function Ua(){if(nf)return Li;nf=1;var e=g_(),t=S_(),r=jr();function n(a){return r(a)?e(a):t(a)}return Li=n,Li}var Oi,af;function A_(){if(af)return Oi;af=1;var e=b_(),t=Oc(),r=Ua();function n(a){return e(a,r,t)}return Oi=n,Oi}var Ri,of;function CI(){if(of)return Ri;of=1;var e=A_(),t=1,r=Object.prototype,n=r.hasOwnProperty;function a(o,s,i,l,u,p){var d=i&t,f=e(o),m=f.length,h=e(s),_=h.length;if(m!=_&&!d)return!1;for(var b=m;b--;){var T=f[b];if(!(d?T in s:n.call(s,T)))return!1}var y=p.get(o),I=p.get(s);if(y&&I)return y==s&&I==o;var w=!0;p.set(o,s),p.set(s,o);for(var E=d;++b<m;){T=f[b];var A=o[T],L=s[T];if(l)var S=d?l(L,A,T,s,o,p):l(A,L,T,o,s,p);if(!(S===void 0?A===L||u(A,L,i,l,p):S)){w=!1;break}E||(E=T=="constructor")}if(w&&!E){var g=o.constructor,k=s.constructor;g!=k&&"constructor"in o&&"constructor"in s&&!(typeof g=="function"&&g instanceof g&&typeof k=="function"&&k instanceof k)&&(w=!1)}return p.delete(o),p.delete(s),w}return Ri=a,Ri}var vi,sf;function DI(){if(sf)return vi;sf=1;var e=zr(),t=jt(),r=e(t,"DataView");return vi=r,vi}var ki,lf;function MI(){if(lf)return ki;lf=1;var e=zr(),t=jt(),r=e(t,"Promise");return ki=r,ki}var Pi,uf;function L_(){if(uf)return Pi;uf=1;var e=zr(),t=jt(),r=e(t,"Set");return Pi=r,Pi}var Ni,cf;function FI(){if(cf)return Ni;cf=1;var e=zr(),t=jt(),r=e(t,"WeakMap");return Ni=r,Ni}var Ci,pf;function qa(){if(pf)return Ci;pf=1;var e=DI(),t=wc(),r=MI(),n=L_(),a=FI(),o=Mn(),s=d_(),i="[object Map]",l="[object Object]",u="[object Promise]",p="[object Set]",d="[object WeakMap]",f="[object DataView]",m=s(e),h=s(t),_=s(r),b=s(n),T=s(a),y=o;return(e&&y(new e(new ArrayBuffer(1)))!=f||t&&y(new t)!=i||r&&y(r.resolve())!=u||n&&y(new n)!=p||a&&y(new a)!=d)&&(y=function(I){var w=o(I),E=w==l?I.constructor:void 0,A=E?s(E):"";if(A)switch(A){case m:return f;case h:return i;case _:return u;case b:return p;case T:return d}return w}),Ci=y,Ci}var Di,df;function UI(){if(df)return Di;df=1;var e=Ac(),t=__(),r=vI(),n=CI(),a=qa(),o=tt(),s=Oo(),i=Pc(),l=1,u="[object Arguments]",p="[object Array]",d="[object Object]",f=Object.prototype,m=f.hasOwnProperty;function h(_,b,T,y,I,w){var E=o(_),A=o(b),L=E?p:a(_),S=A?p:a(b);L=L==u?d:L,S=S==u?d:S;var g=L==d,k=S==d,v=L==S;if(v&&s(_)){if(!s(b))return!1;E=!0,g=!1}if(v&&!g)return w||(w=new e),E||i(_)?t(_,b,T,y,I,w):r(_,b,L,T,y,I,w);if(!(T&l)){var D=g&&m.call(_,"__wrapped__"),q=k&&m.call(b,"__wrapped__");if(D||q){var Q=D?_.value():_,fe=q?b.value():b;return w||(w=new e),I(Q,fe,T,y,w)}}return v?(w||(w=new e),n(_,b,T,y,I,w)):!1}return Di=h,Di}var Mi,ff;function Nc(){if(ff)return Mi;ff=1;var e=UI(),t=sr();function r(n,a,o,s,i){return n===a?!0:n==null||a==null||!t(n)&&!t(a)?n!==n&&a!==a:e(n,a,o,s,r,i)}return Mi=r,Mi}var Fi,mf;function qI(){if(mf)return Fi;mf=1;var e=Ac(),t=Nc(),r=1,n=2;function a(o,s,i,l){var u=i.length,p=u,d=!l;if(o==null)return!p;for(o=Object(o);u--;){var f=i[u];if(d&&f[2]?f[1]!==o[f[0]]:!(f[0]in o))return!1}for(;++u<p;){f=i[u];var m=f[0],h=o[m],_=f[1];if(d&&f[2]){if(h===void 0&&!(m in o))return!1}else{var b=new e;if(l)var T=l(h,_,m,o,s,b);if(!(T===void 0?t(_,h,r|n,l,b):T))return!1}}return!0}return Fi=a,Fi}var Ui,hf;function O_(){if(hf)return Ui;hf=1;var e=ir();function t(r){return r===r&&!e(r)}return Ui=t,Ui}var qi,_f;function VI(){if(_f)return qi;_f=1;var e=O_(),t=Ua();function r(n){for(var a=t(n),o=a.length;o--;){var s=a[o],i=n[s];a[o]=[s,i,e(i)]}return a}return qi=r,qi}var Vi,yf;function R_(){if(yf)return Vi;yf=1;function e(t,r){return function(n){return n==null?!1:n[t]===r&&(r!==void 0||t in Object(n))}}return Vi=e,Vi}var $i,bf;function $I(){if(bf)return $i;bf=1;var e=qI(),t=VI(),r=R_();function n(a){var o=t(a);return o.length==1&&o[0][2]?r(o[0][0],o[0][1]):function(s){return s===a||e(s,a,o)}}return $i=n,$i}var Bi,Tf;function Cc(){if(Tf)return Bi;Tf=1;var e=tt(),t=Pa(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function a(o,s){if(e(o))return!1;var i=typeof o;return i=="number"||i=="symbol"||i=="boolean"||o==null||t(o)?!0:n.test(o)||!r.test(o)||s!=null&&o in Object(s)}return Bi=a,Bi}var xi,If;function BI(){if(If)return xi;If=1;var e=Sc(),t="Expected a function";function r(n,a){if(typeof n!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var o=function(){var s=arguments,i=a?a.apply(this,s):s[0],l=o.cache;if(l.has(i))return l.get(i);var u=n.apply(this,s);return o.cache=l.set(i,u)||l,u};return o.cache=new(r.Cache||e),o}return r.Cache=e,xi=r,xi}var Hi,Ef;function xI(){if(Ef)return Hi;Ef=1;var e=BI(),t=500;function r(n){var a=e(n,function(s){return o.size===t&&o.clear(),s}),o=a.cache;return a}return Hi=r,Hi}var zi,gf;function HI(){if(gf)return zi;gf=1;var e=xI(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(a){var o=[];return a.charCodeAt(0)===46&&o.push(""),a.replace(t,function(s,i,l,u){o.push(l?u.replace(r,"$1"):i||s)}),o});return zi=n,zi}var ji,wf;function zI(){if(wf)return ji;wf=1;var e=Dn(),t=Fa(),r=tt(),n=Pa(),a=e?e.prototype:void 0,o=a?a.toString:void 0;function s(i){if(typeof i=="string")return i;if(r(i))return t(i,s)+"";if(n(i))return o?o.call(i):"";var l=i+"";return l=="0"&&1/i==-1/0?"-0":l}return ji=s,ji}var Gi,Sf;function jI(){if(Sf)return Gi;Sf=1;var e=zI();function t(r){return r==null?"":e(r)}return Gi=t,Gi}var Wi,Af;function Fn(){if(Af)return Wi;Af=1;var e=tt(),t=Cc(),r=HI(),n=jI();function a(o,s){return e(o)?o:t(o,s)?[o]:r(n(o))}return Wi=a,Wi}var Yi,Lf;function Un(){if(Lf)return Yi;Lf=1;var e=Pa();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Yi=t,Yi}var Ki,Of;function ko(){if(Of)return Ki;Of=1;var e=Fn(),t=Un();function r(n,a){a=e(a,n);for(var o=0,s=a.length;n!=null&&o<s;)n=n[t(a[o++])];return o&&o==s?n:void 0}return Ki=r,Ki}var Zi,Rf;function GI(){if(Rf)return Zi;Rf=1;var e=ko();function t(r,n,a){var o=r==null?void 0:e(r,n);return o===void 0?a:o}return Zi=t,Zi}var Xi,vf;function WI(){if(vf)return Xi;vf=1;function e(t,r){return t!=null&&r in Object(t)}return Xi=e,Xi}var Qi,kf;function YI(){if(kf)return Qi;kf=1;var e=Fn(),t=Eo(),r=tt(),n=Ro(),a=Rc(),o=Un();function s(i,l,u){l=e(l,i);for(var p=-1,d=l.length,f=!1;++p<d;){var m=o(l[p]);if(!(f=i!=null&&u(i,m)))break;i=i[m]}return f||++p!=d?f:(d=i==null?0:i.length,!!d&&a(d)&&n(m,d)&&(r(i)||t(i)))}return Qi=s,Qi}var Ji,Pf;function KI(){if(Pf)return Ji;Pf=1;var e=WI(),t=YI();function r(n,a){return n!=null&&t(n,a,e)}return Ji=r,Ji}var el,Nf;function ZI(){if(Nf)return el;Nf=1;var e=Nc(),t=GI(),r=KI(),n=Cc(),a=O_(),o=R_(),s=Un(),i=1,l=2;function u(p,d){return n(p)&&a(d)?o(s(p),d):function(f){var m=t(f,p);return m===void 0&&m===d?r(f,p):e(d,m,i|l)}}return el=u,el}var tl,Cf;function v_(){if(Cf)return tl;Cf=1;function e(t){return function(r){return r?.[t]}}return tl=e,tl}var rl,Df;function XI(){if(Df)return rl;Df=1;var e=ko();function t(r){return function(n){return e(n,r)}}return rl=t,rl}var nl,Mf;function QI(){if(Mf)return nl;Mf=1;var e=v_(),t=XI(),r=Cc(),n=Un();function a(o){return r(o)?e(n(o)):t(o)}return nl=a,nl}var al,Ff;function qn(){if(Ff)return al;Ff=1;var e=$I(),t=ZI(),r=Na(),n=tt(),a=QI();function o(s){return typeof s=="function"?s:s==null?r:typeof s=="object"?n(s)?t(s[0],s[1]):e(s):a(s)}return al=o,al}var ol,Uf;function JI(){if(Uf)return ol;Uf=1;function e(t){return function(r,n,a){for(var o=-1,s=Object(r),i=a(r),l=i.length;l--;){var u=i[t?l:++o];if(n(s[u],u,s)===!1)break}return r}}return ol=e,ol}var sl,qf;function eE(){if(qf)return sl;qf=1;var e=JI(),t=e();return sl=t,sl}var il,Vf;function k_(){if(Vf)return il;Vf=1;var e=eE(),t=Ua();function r(n,a){return n&&e(n,a,t)}return il=r,il}var ll,$f;function tE(){if($f)return ll;$f=1;var e=jr();function t(r,n){return function(a,o){if(a==null)return a;if(!e(a))return r(a,o);for(var s=a.length,i=n?s:-1,l=Object(a);(n?i--:++i<s)&&o(l[i],i,l)!==!1;);return a}}return ll=t,ll}var ul,Bf;function Dc(){if(Bf)return ul;Bf=1;var e=k_(),t=tE(),r=t(e);return ul=r,ul}var cl,xf;function rE(){if(xf)return cl;xf=1;var e=Dc(),t=jr();function r(n,a){var o=-1,s=t(n)?Array(n.length):[];return e(n,function(i,l,u){s[++o]=a(i,l,u)}),s}return cl=r,cl}var pl,Hf;function nE(){if(Hf)return pl;Hf=1;var e=Fa(),t=qn(),r=rE(),n=tt();function a(o,s){var i=n(o)?e:r;return i(o,t(s,3))}return pl=a,pl}var dl,zf;function aE(){if(zf)return dl;zf=1;var e=c_(),t=nE();function r(n,a){return e(t(n,a),1)}return dl=r,dl}var oE=aE();const On=Ge(oE);var fl,jf;function P_(){if(jf)return fl;jf=1;var e=zr(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return fl=t,fl}var ml,Gf;function Mc(){if(Gf)return ml;Gf=1;var e=P_();function t(r,n,a){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):r[n]=a}return ml=t,ml}var hl,Wf;function sE(){if(Wf)return hl;Wf=1;var e=Mc(),t=k_(),r=qn();function n(a,o){var s={};return o=r(o,3),t(a,function(i,l,u){e(s,l,o(i,l,u))}),s}return hl=n,hl}var iE=sE();const ar=Ge(iE);var _l,Yf;function lE(){if(Yf)return _l;Yf=1;var e=Math.ceil,t=Math.max;function r(n,a,o,s){for(var i=-1,l=t(e((a-n)/(o||1)),0),u=Array(l);l--;)u[s?l:++i]=n,n+=o;return u}return _l=r,_l}var yl,Kf;function Fc(){if(Kf)return yl;Kf=1;var e=go(),t=jr(),r=Ro(),n=ir();function a(o,s,i){if(!n(i))return!1;var l=typeof s;return(l=="number"?t(i)&&r(s,i.length):l=="string"&&s in i)?e(i[s],o):!1}return yl=a,yl}var bl,Zf;function uE(){if(Zf)return bl;Zf=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return bl=t,bl}var Tl,Xf;function cE(){if(Xf)return Tl;Xf=1;var e=uE(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return Tl=r,Tl}var Il,Qf;function pE(){if(Qf)return Il;Qf=1;var e=cE(),t=ir(),r=Pa(),n=NaN,a=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,i=parseInt;function l(u){if(typeof u=="number")return u;if(r(u))return n;if(t(u)){var p=typeof u.valueOf=="function"?u.valueOf():u;u=t(p)?p+"":p}if(typeof u!="string")return u===0?u:+u;u=e(u);var d=o.test(u);return d||s.test(u)?i(u.slice(2),d?2:8):a.test(u)?n:+u}return Il=l,Il}var El,Jf;function N_(){if(Jf)return El;Jf=1;var e=pE(),t=1/0,r=17976931348623157e292;function n(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var o=a<0?-1:1;return o*r}return a===a?a:0}return El=n,El}var gl,em;function dE(){if(em)return gl;em=1;var e=lE(),t=Fc(),r=N_();function n(a){return function(o,s,i){return i&&typeof i!="number"&&t(o,s,i)&&(s=i=void 0),o=r(o),s===void 0?(s=o,o=0):s=r(s),i=i===void 0?o<s?1:-1:r(i),e(o,s,i,a)}}return gl=n,gl}var wl,tm;function fE(){if(tm)return wl;tm=1;var e=dE(),t=e();return wl=t,wl}var mE=fE();const En=Ge(mE);var Sl,rm;function hE(){if(rm)return Sl;rm=1;function e(t,r,n,a){var o=-1,s=t==null?0:t.length;for(a&&s&&(n=t[++o]);++o<s;)n=r(n,t[o],o,t);return n}return Sl=e,Sl}var Al,nm;function _E(){if(nm)return Al;nm=1;function e(t,r,n,a,o){return o(t,function(s,i,l){n=a?(a=!1,s):r(n,s,i,l)}),n}return Al=e,Al}var Ll,am;function yE(){if(am)return Ll;am=1;var e=hE(),t=Dc(),r=qn(),n=_E(),a=tt();function o(s,i,l){var u=a(s)?e:n,p=arguments.length<3;return u(s,r(i,4),l,p,t)}return Ll=o,Ll}var bE=yE();const dt=Ge(bE),Po=(e,t,r)=>{const{gripperEntities:n,moduleEntities:a,runtimeParameters:o}=t,s=B(e.moduleId,o);if(s==null)return{errors:[H({parameterName:e.moduleId})]};const i=Kn(r,s),l=Object.keys(n).length>0,u=[];if(i==null&&u.push(re()),l||u.push(Mh()),u.length>0)return{errors:u};const p=a[s].pythonName;return{commands:[{commandType:"absorbanceReader/closeLid",key:M(),params:{moduleId:s}}],python:`${p}.close_lid()`}},C_=(e,t,r)=>{const{sampleWavelengths:n,measureMode:a,referenceWavelength:o}=e,{runtimeParameters:s}=t,i=B(e.moduleId,s),l=B(a,s),u=l==="single"||l==="multi"?l:null,p=n.map(y=>ie(y,s)),d=o==null?void 0:ie(o,s),f=[e.moduleId,a,...n,o],m=[i,u,...p,d],h=f.flatMap((y,I)=>typeof y=="string"&&m[I]===null?[H({parameterName:y})]:[]);if(h.length>0||i==null||u==null)return{errors:h};const _=t.moduleEntities[i].pythonName,b=s[a]!=null?a:C(a),T=o!=null?`, reference_wavelength=${o}`:"";return{commands:[{commandType:"absorbanceReader/initialize",key:M(),params:{moduleId:i,measureMode:u,sampleWavelengths:p,...d!=null?{referenceWavelength:d}:{}}}],python:`${_}.initialize(${b}, [${n.join(", ")}]${T})`}},D_=(e,t,r)=>{const{gripperEntities:n,moduleEntities:a,runtimeParameters:o}=t,s=B(e.moduleId,o);if(s==null)return{errors:[H({parameterName:e.moduleId})]};const i=Kn(r,s),l=Object.keys(n).length>0,u=[];if(i==null&&u.push(re()),l||u.push(Mh()),u.length>0)return{errors:u};const p=a[s].pythonName;return{commands:[{commandType:"absorbanceReader/openLid",key:M(),params:{moduleId:s}}],python:`${p}.open_lid()`}},M_=(e,t,r)=>{const{fileName:n}=e,{runtimeParameters:a}=t,o=B(e.moduleId,a),s=n==null?void 0:B(n,a),i=[];if(o==null&&i.push(H({parameterName:e.moduleId})),n!=null&&s==null&&i.push(H({parameterName:n})),o==null||i.length>0)return{errors:i};const l=Kn(r,o);if(l==null)return{errors:[re()]};l.initialization===null&&i.push(qr());const u=t.moduleEntities[o].pythonName,p=n==null||a[n]!=null?n:C(n),d=p!=null?`export_filename=${p}`:"";return i.length>0?{errors:i}:{commands:[{commandType:"absorbanceReader/read",key:M(),params:{moduleId:o,...s!=null?{fileName:s}:{}}}],python:`${u}.read(${d})`}},Ot=(e,t,r)=>{const{flowRate:n,pipetteId:a,volume:o,correctionVolume:s}=e,i=[];t.pipetteEntities[a]?.spec||i.push(ft({pipette:a}));const u=t.pipetteEntities[a].pythonName;return{commands:[{commandType:"airGapInPlace",key:M(),params:{flowRate:n,pipetteId:a,volume:o,...s!=null?{correctionVolume:s}:{}}}],python:`${u}.air_gap(${[`volume=${o}`,"in_place=True",`flow_rate=${n}`].join(", ")})`}},TE=(e,t,r)=>{const{pipetteId:n,volume:a,labwareId:o,wellName:s,flowRate:i,isAirGap:l,tipRack:u,wellLocation:p,primaryNozzle:d,nozzles:f}=e,m="aspirate",h=r.labware,_=[],b=t.pipetteEntities[n]?.spec,T=(b?.displayCategory==="FLEX"||b?.channels===96)??!1,y=Hn(o,r.labware);if(b||_.push(ft({pipette:n})),!o||!r.labware[o]?_.push(mt({actionName:m,labware:o})):K(r.labware[o].stack)==="offDeck"&&_.push(Ln()),De.includes(y))_.push(xt({typeOfStep:m}));else if(h[y]!=null){const k=K(h[y].stack);De.includes(k)&&_.push(xt({typeOfStep:m}))}jn({pipette:n,labware:o,invariantContext:t,prevRobotState:r})&&_.push(Aa()),r.tipState.pipettes[n]?.hasTip||_.push(zt({actionName:m,pipette:n,labware:o,well:s}));const I=t.pipetteEntities[n]?.spec.channels!==1,w=ht({robotState:r,invariantContext:t,pipetteId:n,labwareId:o,wellLocationOffset:p?.offset??{x:0,y:0,z:0},wellTargetName:s,primaryNozzle:d,nozzleConfiguration:f});if(I&&b&&!w.isSafe&&_.push(Bt({unsafePipetteMovementReason:w.reason})),Ga(r.modules,r.labware,o)&&_.push(Sn()),Ha(r.modules,r.labware,o)&&_.push(qr()),Ka(r.modules,r.labware,o)&&_.push(To()),Za(r.modules,r.labware,o)&&_.push(An()),Yn(r.modules,y,T?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&_.push(Oa()),T||(Gn(r.modules,y)&&_.push(La()),Wn(r.modules,y,b)&&_.push(Ra()),Ya(r.modules,y,b,t.labwareEntities[o])&&_.push(Io())),_.length===0&&b&&b.liquids.default.maxVolume<a&&_.push(mo({actionName:m,volume:a,maxVolume:b.liquids.default.maxVolume})),_.length===0&&b){const k=Wo(n,t,u);k<a&&_.push(tT({actionName:m,volume:a,maxVolume:k}))}if(_.length>0)return{errors:_};const E=[{commandType:"aspirate",key:M(),params:{pipetteId:n,volume:a,labwareId:o,wellName:s,wellLocation:p,flowRate:i},...l&&{meta:{isAirGap:l}}}],A=t.pipetteEntities[n].pythonName,L=t.labwareEntities[o].pythonName,S=[`volume=${a}`,`location=${L}[${C(s)}]${Ht(p)}`,`flow_rate=${i}`],g=`${A}.aspirate(
2
- ${Y(S.join(`,
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@opentrons/shared-data");function Qb(){return{type:"INSUFFICIENT_TIPS",message:"Not enough tips to complete action"}}function Jb(){return{type:"MISSING_96_CHANNEL_TIPRACK_ADAPTER",message:"A 96-channel cannot pick up tips fully without an adapter"}}function eT(){return{type:"REMOVE_96_CHANNEL_TIPRACK_ADAPTER",message:"A 96-channel cannot pick up tips partially with an adapter"}}function jt(e){const{actionName:t,pipette:r,labware:n,well:a}=e;return{message:n==null||a==null?`Attempted to ${t} with no tip on pipette: ${r} in place`:`Attempted to ${t} with no tip on pipette: ${r} from ${n}'s well ${a}`,type:"NO_TIP_ON_PIPETTE"}}function tT(){return{message:"One or more of the pipettes has a tip",type:"PIPETTE_HAS_TIP"}}function mt(e){const{pipette:t}=e;return{message:`This step tries to use the ${t}. Add the pipette to your protocol or change the step to use a different pipette.`,type:"PIPETTE_DOES_NOT_EXIST"}}function ht(e){const{actionName:t,labware:r}=e;return console.warn(`Attempted to ${t} with labware id "${r}", this labware was not found under "labware"`),{message:`This step tries to use ${r}. Add the labware to your protocol or change the step to use a different labware.`,type:"LABWARE_DOES_NOT_EXIST"}}function pe(){return{message:"This step requires a module, but none is selected",type:"MISSING_MODULE"}}function rT(){return{message:"This module is not changing temperature because it has either been deactivated or is already holding a temperature. In order to pause the protocol and wait for your module to reach a temperature, you must first use a Temperature step to tell the module to start changing to a new temperature",type:"MISSING_TEMPERATURE_STEP"}}function gp(){return{message:"This module is not currently running a profile.",type:"MISSING_PROFILE_STEP"}}function nT(e){const{volume:t,maxVolume:r,actionName:n}=e;return{message:`This step tries to ${n} ${t}µL, but the tip can only hold ${r}µL.`,type:"TIP_VOLUME_EXCEEDED"}}function C(e){const{parameterName:t}=e;return{message:`Runtime parameter "${t}" is missing`,type:"INVALID_RUNTIME_PARAMETER"}}function ho(e){const{actionName:t,volume:r,maxVolume:n,disposalVolume:a}=e;return{message:a!=null?`Attemped to ${t} volume + disposal volume greater than pipette max volume (${r} + ${a} > ${n})`:`This step tries to ${t} ${r}µL, but the tip can only hold ${n}µL.`,type:"PIPETTE_VOLUME_EXCEEDED"}}const aT=()=>({type:"MOVE_LOCATION_NOT_SPECIFIED",message:"This step is missing a move location."}),Oa=()=>({type:"MODULE_PIPETTE_COLLISION_DANGER",message:"Gen 1 8-Channel pipettes cannot access labware or tip racks in slot 4 or 6 because they are adjacent to modules."}),oT=()=>({type:"THERMOCYCLER_BUSY_WITH_PROFILE",message:"This step cannot run while the Thermocycler is running a profile. Move the step outside the profile."}),On=()=>({type:"THERMOCYCLER_LID_CLOSED",message:"Attempted to interact with contents of a thermocycler with the lid closed."}),Io=()=>({type:"HEATER_SHAKER_LATCH_OPEN",message:"Attempted to interact with contents of a heater-shaker with the latch open."}),Ep=()=>({type:"HEATER_SHAKER_LATCH_CLOSED",message:"Attempted to move the contents of a heater-shaker with the latch closed."}),qr=()=>({type:"ABSORBANCE_READER_LID_CLOSED",message:"Attempted to interact with contents of an absorbance plate reader with the lid closed."}),sT=()=>({type:"ABSORBANCE_READER_NO_INITIALIZATION",message:"This step tries to read labware without initializing the Plate Reader first. Initialize the Plate Reader module or remove this step in order to proceed."}),$h=()=>({type:"ABSORBANCE_READER_NO_GRIPPER",message:"This step involves opening or closing the Absorbance Plate Reader lid with a gripper. Add a gripper or remove step to proceed."}),iT=()=>({type:"HOPPER_EMPTY",message:"Cannot retrieve labware from empty stacker"}),lT=()=>({type:"SHUTTLE_FULL",message:"Shuttle must be empty in order to retrieve labware from the stacker"}),uT=()=>({type:"SHUTTLE_EMPTY",message:"Shuttle must have labware in order to store it in the stacker"}),qh=()=>({type:"MISMATCHED_STACKER_LABWARE_TYPE",message:"The stacker can only store a single type of labware at a time"}),cT=()=>({type:"MISSING_STACKER_LABWARE_TYPE",message:"Add labware to the stacker in the starting deck so that you can refill it later"}),Vh=()=>({type:"HOPPER_FULL",message:"The hopper has reached capacity"}),vn=()=>({type:"HEATER_SHAKER_IS_SHAKING",message:"Attempted to interact with the contents of a heater-shaker when it is shaking."}),pT=e=>({type:"TALL_LABWARE_EAST_WEST_OF_HEATER_SHAKER",message:`Labware over 53 mm is ${e} of this Heater-Shaker module.`}),xt=e=>{const{unsafePipetteMovementReason:t}=e;switch(t.type){case"thermocyclerLidCollision":return{type:"POSSIBLE_PIPETTE_COLLISION_THERMOCYCLER_LID",message:"There is a possibility that the Pipette will collide with the Thermocycler lid"};case"outsidePipetteExtents":return{type:"POSSIBLE_PIPETTE_COLLISION_OUTSIDE_DECK_EXTENTS",message:"There is a possibility that the pipette will move outside the deck extents."};case"adjacentAdressableAreaCollision":return{type:"POSSIBLE_PIPETTE_COLLISION_ADJACENT_ADDRESSABLE_AREA",message:`There is a possibility that the pipette will collide with adjacent items in ${t.addressableAreaCausingCollision.displayName}`,translationParams:{addressableAreaCausingCollisionDisplayName:t.addressableAreaCausingCollision.displayName}}}},va=()=>({type:"HEATER_SHAKER_EAST_WEST_LATCH_OPEN",message:"The Heater-Shaker labware latch is open"}),Pa=()=>({type:"HEATER_SHAKER_NORTH_SOUTH_EAST_WEST_SHAKING",message:"The Heater-Shaker is shaking"}),Ra=()=>({type:"HEATER_SHAKER_EAST_WEST_MULTI_CHANNEL",message:"The Heater-Shaker is shaking"}),wo=()=>({type:"HEATER_SHAKER_NORTH_SOUTH__OF_NON_TIPRACK_WITH_MULTI_CHANNEL",message:"8-Channel pipette cannot access labware"}),Pn=()=>({type:"LABWARE_OFF_DECK",message:"Attempted to interact with labware off deck"}),dT=()=>({type:"LABWARE_ON_ANOTHER_ENTITY",message:"Attempted to move labware onto another entity with the same slotName"}),Mn=()=>({type:"DROP_TIP_LOCATION_DOES_NOT_EXIST",message:"The destination for dropping tip does not exist"}),Bh=()=>({type:"EQUIPMENT_DOES_NOT_EXIST",message:"Equipment does not exist."}),fT=()=>({type:"GRIPPER_REQUIRED",message:"The gripper is required to fulfill this action"}),Ht=e=>({type:"PIPETTING_INTO_COLUMN_4",message:`Cannot ${e.typeOfStep} into a column 4 slot.`}),mT=()=>({type:"CANNOT_MOVE_WITH_GRIPPER",message:"The gripper cannot move aluminum blocks"}),hT=()=>({type:"NO_TIP_SELECTED",message:"No tips were selected for this step"}),ka=()=>({type:"LABWARE_DISCARDED_IN_TRASH",message:"The labware was discarded in trash in a previous step."}),xh=()=>({type:"SUBMERGE_BELOW_ASPIRATE",message:"The submerge position must be above the aspirate position"}),Hh=()=>({type:"RETRACT_BELOW_ASPIRATE",message:"The retract position must be above the aspirate position"}),_T=()=>({type:"SUBMERGE_BELOW_DISPENSE",message:"The submerge position must be above the dispense position"}),yT=()=>({type:"RETRACT_BELOW_DISPENSE",message:"The retract position must be above the dispense position"}),bT=()=>({type:"MULTI_ASPIRATE_VOLUME_TOO_HIGH",message:"Consolidate pipette path was selected but cannot fit volume for more than 1 well in the tip"}),TT=()=>({type:"MULTI_DISPENSE_VOLUME_TOO_HIGH",message:"Distribute pipette path was selected but cannot fit volume for more than 1 well in the tip"}),IT=e=>({type:"CLOSING_THERMOCYCLER_WITH_INVALID_LABWARE_LID",message:`Closing the Thermocycler lid with ${e.lidDisplayName} in place will cause damage`}),Ap=()=>({type:"RETURN_TIP_UNAVAILABLE",message:"Current tip does not have a known location to return to"}),wT=()=>({type:"TIPRACK_LID_NOT_ALLOWED_ON_DECK",message:"The tip rack lid is not supported directly on the deck"}),ST=()=>({type:"NEXT_TIPRACK_HAS_LID",message:"A pipette cannot pick up tips from a tip rack with a lid"}),gT=e=>({type:"STACK_TOO_HIGH",message:`The stack on slot ${e.slot} is too high`}),ET=()=>({type:"TOO_MANY_TIPS",message:"Action will pick up too many tips"}),AT=()=>({type:"INCOMPLETE_PICKUP",message:"At least one of the selected tips is empty"}),LT=()=>({type:"LABWARE_ON_HOPPER",message:"Labware cannot be moved from the Flex Stacker Hopper"}),OT=()=>({type:"MISSING_PUMP_ACTIVITY",message:"This module is not currently running a pump activity."}),vT=e=>({type:"INVALID_WAIT_CONDITION",message:`Invalid wait condition: ${e}`}),Na=()=>({type:"LIVE_TASK_ERROR",message:"This module is currently running a live task. Please wait for it to complete before performing this action."}),Lp=()=>({type:"VACUUM_UNDER_PRESSURE",message:"The vacuum module is under pressure. Deactivate the pump to move labware to or from it."});function Ge(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zo,Op;function zh(){if(Op)return Zo;Op=1;var e=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis;return Zo=e,Zo}var Xo,vp;function Wt(){if(vp)return Xo;vp=1;var e=zh(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Xo=r,Xo}var Qo,Pp;function Fn(){if(Pp)return Qo;Pp=1;var e=Wt(),t=e.Symbol;return Qo=t,Qo}var Jo,Rp;function PT(){if(Rp)return Jo;Rp=1;var e=Fn(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,a=e?e.toStringTag:void 0;function o(s){var i=r.call(s,a),l=s[a];try{s[a]=void 0;var u=!0}catch{}var p=n.call(s);return u&&(i?s[a]=l:delete s[a]),p}return Jo=o,Jo}var es,kp;function RT(){if(kp)return es;kp=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return es=r,es}var ts,Np;function Un(){if(Np)return ts;Np=1;var e=Fn(),t=PT(),r=RT(),n="[object Null]",a="[object Undefined]",o=e?e.toStringTag:void 0;function s(i){return i==null?i===void 0?a:n:o&&o in Object(i)?t(i):r(i)}return ts=s,ts}var rs,Cp;function ir(){if(Cp)return rs;Cp=1;function e(t){return t!=null&&typeof t=="object"}return rs=e,rs}var ns,Dp;function Ca(){if(Dp)return ns;Dp=1;var e=Un(),t=ir(),r="[object Symbol]";function n(a){return typeof a=="symbol"||t(a)&&e(a)==r}return ns=n,ns}var as,Mp;function jh(){if(Mp)return as;Mp=1;var e=Ca();function t(r,n,a){for(var o=-1,s=r.length;++o<s;){var i=r[o],l=n(i);if(l!=null&&(u===void 0?l===l&&!e(l):a(l,u)))var u=l,p=i}return p}return as=t,as}var os,Fp;function kT(){if(Fp)return os;Fp=1;function e(t,r){return t<r}return os=e,os}var ss,Up;function Da(){if(Up)return ss;Up=1;function e(t){return t}return ss=e,ss}var is,$p;function NT(){if($p)return is;$p=1;var e=jh(),t=kT(),r=Da();function n(a){return a&&a.length?e(a,r,t):void 0}return is=n,is}var CT=NT();const DT=Ge(CT),Ma="TEMPERATURE_DEACTIVATED",bc="TEMPERATURE_AT_TARGET",Tc="TEMPERATURE_APPROACHING_TARGET",Xu=1,Wh=[c.MAGNETIC_MODULE_V1,c.TEMPERATURE_MODULE_V1],Qu="fixedTrash",Gh={type:c.MAGNETIC_MODULE_TYPE,engaged:!1},Yh={type:c.TEMPERATURE_MODULE_TYPE,status:Ma,targetTemperature:null},Kh={type:c.THERMOCYCLER_MODULE_TYPE,currentBlockActivity:{type:"blockDeactivated"},lidTargetTemp:null,lidOpen:null,numProfilesStarted:0},Zh={type:c.HEATERSHAKER_MODULE_TYPE,targetTemp:null,targetSpeed:null,latchOpen:null},Xh={type:"absorbanceReaderType",lidOpen:null,initialization:null},Qh={type:"magneticBlockType"},Jh={type:c.FLEX_STACKER_MODULE_TYPE,storedLabwareDetails:null,labwareInHopper:null,labwareOnShuttle:null,setStoredLabwareCount:1,fillCount:1},e_={type:c.VACUUM_MODULE_TYPE,ventStatus:null,numPumpActivitiesStarted:0,currentPumpActivity:{type:"pumpDeactivated"}},t_={[c.MAGNETIC_MODULE_TYPE]:Gh,[c.TEMPERATURE_MODULE_TYPE]:Yh,[c.THERMOCYCLER_MODULE_TYPE]:Kh,[c.HEATERSHAKER_MODULE_TYPE]:Zh,[c.ABSORBANCE_READER_TYPE]:Xh,[c.MAGNETIC_BLOCK_TYPE]:Qh,[c.FLEX_STACKER_MODULE_TYPE]:Jh,[c.VACUUM_MODULE_TYPE]:e_},MT="opentrons/opentrons_1_trash_1100ml_fixed/1",FT="opentrons/opentrons_1_trash_3200ml_fixed/1",De=["A4","B4","C4","D4"],Lt={x:0,y:0,z:0},r_="mounted",Fa="CLEAN",tr="DIRTY",_e="EMPTY",Ic="automatic",Ot="manual",n_=["A4","B4","C4","D4"],UT=["7","8","10","11"],et="hopper",a_=["hopperA4","hopperB4","hopperC4","hopperD4"],o_={hopperA4:"A4",hopperB4:"B4",hopperC4:"C4",hopperD4:"D4"},rr=["adapterLabwareId","primaryLabwareId","lidLabwareId"],$T=["adapterLabwareURI","primaryLabwareURI","lidLabwareURI"],qT={A4:"hopperA4",B4:"hopperB4",C4:"hopperC4",D4:"hopperD4"},wc="vacuumDock",s_=c.VACUUM_MODULE_DOCK_A4_ADDRESSABLE_AREA,Sc="opened",Ua="closed",Ju="power",ec="pressure",VT="state",BT="profile",xT="pumpOff",HT="pumpOn",zT="vent",jT="open",WT="closed",GT="VACUUM_DEACTIVATED",YT="VACUUM_AT_TARGET",i_=["opentrons_vacuum_manifold_spacer_short","opentrons_vacuum_manifold_spacer_tall","opentrons_vacuum_manifold_spacer_3.2mm","opentrons_vacuum_manifold_spacer_5.2mm","opentrons_vacuum_manifold_spacer_7.25mm","opentrons_vacuum_manifold_spacer_12.8mm"],l_=3,u_="A4",gc=[c.ALL,c.COLUMN,c.SINGLE,c.ROW,c.QUADRANT,c.PARTIAL_COLUMN],Ec=[c.A1_NOZZLE,c.A12_NOZZLE,c.B1_NOZZLE,c.C1_NOZZLE,c.D1_NOZZLE,c.E1_NOZZLE,c.F1_NOZZLE,c.G1_NOZZLE,c.H1_NOZZLE,c.H12_NOZZLE],c_=[c.B1_NOZZLE,c.C1_NOZZLE,c.D1_NOZZLE,c.E1_NOZZLE,c.F1_NOZZLE,c.G1_NOZZLE],ze=[];for(let e=0;e<256;++e)ze.push((e+256).toString(16).slice(1));function KT(e,t=0){return(ze[e[t+0]]+ze[e[t+1]]+ze[e[t+2]]+ze[e[t+3]]+"-"+ze[e[t+4]]+ze[e[t+5]]+"-"+ze[e[t+6]]+ze[e[t+7]]+"-"+ze[e[t+8]]+ze[e[t+9]]+"-"+ze[e[t+10]]+ze[e[t+11]]+ze[e[t+12]]+ze[e[t+13]]+ze[e[t+14]]+ze[e[t+15]]).toLowerCase()}const ZT=new Uint8Array(16);function XT(){return crypto.getRandomValues(ZT)}function QT(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():JT(e,t,r)}function JT(e,t,r){e=e||{};const n=e.random??e.rng?.()??XT();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let a=0;a<16;++a)t[r+a]=n[a];return t}return KT(n)}var ls,qp;function Ac(){if(qp)return ls;qp=1;function e(t,r){for(var n=-1,a=r.length,o=t.length;++n<a;)t[o+n]=r[n];return t}return ls=e,ls}var us,Vp;function eI(){if(Vp)return us;Vp=1;var e=Un(),t=ir(),r="[object Arguments]";function n(a){return t(a)&&e(a)==r}return us=n,us}var cs,Bp;function So(){if(Bp)return cs;Bp=1;var e=eI(),t=ir(),r=Object.prototype,n=r.hasOwnProperty,a=r.propertyIsEnumerable,o=e((function(){return arguments})())?e:function(s){return t(s)&&n.call(s,"callee")&&!a.call(s,"callee")};return cs=o,cs}var ps,xp;function tt(){if(xp)return ps;xp=1;var e=Array.isArray;return ps=e,ps}var ds,Hp;function tI(){if(Hp)return ds;Hp=1;var e=Fn(),t=So(),r=tt(),n=e?e.isConcatSpreadable:void 0;function a(o){return r(o)||t(o)||!!(n&&o&&o[n])}return ds=a,ds}var fs,zp;function p_(){if(zp)return fs;zp=1;var e=Ac(),t=tI();function r(n,a,o,s,i){var l=-1,u=n.length;for(o||(o=t),i||(i=[]);++l<u;){var p=n[l];a>0&&o(p)?a>1?r(p,a-1,o,s,i):e(i,p):s||(i[i.length]=p)}return i}return fs=r,fs}var ms,jp;function $a(){if(jp)return ms;jp=1;function e(t,r){for(var n=-1,a=t==null?0:t.length,o=Array(a);++n<a;)o[n]=r(t[n],n,t);return o}return ms=e,ms}var hs,Wp;function rI(){if(Wp)return hs;Wp=1;function e(){this.__data__=[],this.size=0}return hs=e,hs}var _s,Gp;function go(){if(Gp)return _s;Gp=1;function e(t,r){return t===r||t!==t&&r!==r}return _s=e,_s}var ys,Yp;function Eo(){if(Yp)return ys;Yp=1;var e=go();function t(r,n){for(var a=r.length;a--;)if(e(r[a][0],n))return a;return-1}return ys=t,ys}var bs,Kp;function nI(){if(Kp)return bs;Kp=1;var e=Eo(),t=Array.prototype,r=t.splice;function n(a){var o=this.__data__,s=e(o,a);if(s<0)return!1;var i=o.length-1;return s==i?o.pop():r.call(o,s,1),--this.size,!0}return bs=n,bs}var Ts,Zp;function aI(){if(Zp)return Ts;Zp=1;var e=Eo();function t(r){var n=this.__data__,a=e(n,r);return a<0?void 0:n[a][1]}return Ts=t,Ts}var Is,Xp;function oI(){if(Xp)return Is;Xp=1;var e=Eo();function t(r){return e(this.__data__,r)>-1}return Is=t,Is}var ws,Qp;function sI(){if(Qp)return ws;Qp=1;var e=Eo();function t(r,n){var a=this.__data__,o=e(a,r);return o<0?(++this.size,a.push([r,n])):a[o][1]=n,this}return ws=t,ws}var Ss,Jp;function Ao(){if(Jp)return Ss;Jp=1;var e=rI(),t=nI(),r=aI(),n=oI(),a=sI();function o(s){var i=-1,l=s==null?0:s.length;for(this.clear();++i<l;){var u=s[i];this.set(u[0],u[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=r,o.prototype.has=n,o.prototype.set=a,Ss=o,Ss}var gs,ed;function iI(){if(ed)return gs;ed=1;var e=Ao();function t(){this.__data__=new e,this.size=0}return gs=t,gs}var Es,td;function lI(){if(td)return Es;td=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return Es=e,Es}var As,rd;function uI(){if(rd)return As;rd=1;function e(t){return this.__data__.get(t)}return As=e,As}var Ls,nd;function cI(){if(nd)return Ls;nd=1;function e(t){return this.__data__.has(t)}return Ls=e,Ls}var Os,ad;function lr(){if(ad)return Os;ad=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Os=e,Os}var vs,od;function d_(){if(od)return vs;od=1;var e=Un(),t=lr(),r="[object AsyncFunction]",n="[object Function]",a="[object GeneratorFunction]",o="[object Proxy]";function s(i){if(!t(i))return!1;var l=e(i);return l==n||l==a||l==r||l==o}return vs=s,vs}var Ps,sd;function pI(){if(sd)return Ps;sd=1;var e=Wt(),t=e["__core-js_shared__"];return Ps=t,Ps}var Rs,id;function dI(){if(id)return Rs;id=1;var e=pI(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return Rs=r,Rs}var ks,ld;function f_(){if(ld)return ks;ld=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return ks=r,ks}var Ns,ud;function fI(){if(ud)return Ns;ud=1;var e=d_(),t=dI(),r=lr(),n=f_(),a=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,s=Function.prototype,i=Object.prototype,l=s.toString,u=i.hasOwnProperty,p=RegExp("^"+l.call(u).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(f){if(!r(f)||t(f))return!1;var m=e(f)?p:o;return m.test(n(f))}return Ns=d,Ns}var Cs,cd;function mI(){if(cd)return Cs;cd=1;function e(t,r){return t?.[r]}return Cs=e,Cs}var Ds,pd;function Wr(){if(pd)return Ds;pd=1;var e=fI(),t=mI();function r(n,a){var o=t(n,a);return e(o)?o:void 0}return Ds=r,Ds}var Ms,dd;function Lc(){if(dd)return Ms;dd=1;var e=Wr(),t=Wt(),r=e(t,"Map");return Ms=r,Ms}var Fs,fd;function Lo(){if(fd)return Fs;fd=1;var e=Wr(),t=e(Object,"create");return Fs=t,Fs}var Us,md;function hI(){if(md)return Us;md=1;var e=Lo();function t(){this.__data__=e?e(null):{},this.size=0}return Us=t,Us}var $s,hd;function _I(){if(hd)return $s;hd=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return $s=e,$s}var qs,_d;function yI(){if(_d)return qs;_d=1;var e=Lo(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function a(o){var s=this.__data__;if(e){var i=s[o];return i===t?void 0:i}return n.call(s,o)?s[o]:void 0}return qs=a,qs}var Vs,yd;function bI(){if(yd)return Vs;yd=1;var e=Lo(),t=Object.prototype,r=t.hasOwnProperty;function n(a){var o=this.__data__;return e?o[a]!==void 0:r.call(o,a)}return Vs=n,Vs}var Bs,bd;function TI(){if(bd)return Bs;bd=1;var e=Lo(),t="__lodash_hash_undefined__";function r(n,a){var o=this.__data__;return this.size+=this.has(n)?0:1,o[n]=e&&a===void 0?t:a,this}return Bs=r,Bs}var xs,Td;function II(){if(Td)return xs;Td=1;var e=hI(),t=_I(),r=yI(),n=bI(),a=TI();function o(s){var i=-1,l=s==null?0:s.length;for(this.clear();++i<l;){var u=s[i];this.set(u[0],u[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=r,o.prototype.has=n,o.prototype.set=a,xs=o,xs}var Hs,Id;function wI(){if(Id)return Hs;Id=1;var e=II(),t=Ao(),r=Lc();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Hs=n,Hs}var zs,wd;function SI(){if(wd)return zs;wd=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return zs=e,zs}var js,Sd;function Oo(){if(Sd)return js;Sd=1;var e=SI();function t(r,n){var a=r.__data__;return e(n)?a[typeof n=="string"?"string":"hash"]:a.map}return js=t,js}var Ws,gd;function gI(){if(gd)return Ws;gd=1;var e=Oo();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Ws=t,Ws}var Gs,Ed;function EI(){if(Ed)return Gs;Ed=1;var e=Oo();function t(r){return e(this,r).get(r)}return Gs=t,Gs}var Ys,Ad;function AI(){if(Ad)return Ys;Ad=1;var e=Oo();function t(r){return e(this,r).has(r)}return Ys=t,Ys}var Ks,Ld;function LI(){if(Ld)return Ks;Ld=1;var e=Oo();function t(r,n){var a=e(this,r),o=a.size;return a.set(r,n),this.size+=a.size==o?0:1,this}return Ks=t,Ks}var Zs,Od;function Oc(){if(Od)return Zs;Od=1;var e=wI(),t=gI(),r=EI(),n=AI(),a=LI();function o(s){var i=-1,l=s==null?0:s.length;for(this.clear();++i<l;){var u=s[i];this.set(u[0],u[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=r,o.prototype.has=n,o.prototype.set=a,Zs=o,Zs}var Xs,vd;function OI(){if(vd)return Xs;vd=1;var e=Ao(),t=Lc(),r=Oc(),n=200;function a(o,s){var i=this.__data__;if(i instanceof e){var l=i.__data__;if(!t||l.length<n-1)return l.push([o,s]),this.size=++i.size,this;i=this.__data__=new r(l)}return i.set(o,s),this.size=i.size,this}return Xs=a,Xs}var Qs,Pd;function vc(){if(Pd)return Qs;Pd=1;var e=Ao(),t=iI(),r=lI(),n=uI(),a=cI(),o=OI();function s(i){var l=this.__data__=new e(i);this.size=l.size}return s.prototype.clear=t,s.prototype.delete=r,s.prototype.get=n,s.prototype.has=a,s.prototype.set=o,Qs=s,Qs}var Js,Rd;function vI(){if(Rd)return Js;Rd=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return Js=t,Js}var ei,kd;function PI(){if(kd)return ei;kd=1;function e(t){return this.__data__.has(t)}return ei=e,ei}var ti,Nd;function m_(){if(Nd)return ti;Nd=1;var e=Oc(),t=vI(),r=PI();function n(a){var o=-1,s=a==null?0:a.length;for(this.__data__=new e;++o<s;)this.add(a[o])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,ti=n,ti}var ri,Cd;function h_(){if(Cd)return ri;Cd=1;function e(t,r){for(var n=-1,a=t==null?0:t.length;++n<a;)if(r(t[n],n,t))return!0;return!1}return ri=e,ri}var ni,Dd;function __(){if(Dd)return ni;Dd=1;function e(t,r){return t.has(r)}return ni=e,ni}var ai,Md;function y_(){if(Md)return ai;Md=1;var e=m_(),t=h_(),r=__(),n=1,a=2;function o(s,i,l,u,p,d){var f=l&n,m=s.length,h=i.length;if(m!=h&&!(f&&h>m))return!1;var _=d.get(s),y=d.get(i);if(_&&y)return _==i&&y==s;var T=-1,b=!0,w=l&a?new e:void 0;for(d.set(s,i),d.set(i,s);++T<m;){var S=s[T],g=i[T];if(u)var L=f?u(g,S,T,i,s,d):u(S,g,T,s,i,d);if(L!==void 0){if(L)continue;b=!1;break}if(w){if(!t(i,function(I,A){if(!r(w,A)&&(S===I||p(S,I,l,u,d)))return w.push(A)})){b=!1;break}}else if(!(S===g||p(S,g,l,u,d))){b=!1;break}}return d.delete(s),d.delete(i),b}return ai=o,ai}var oi,Fd;function b_(){if(Fd)return oi;Fd=1;var e=Wt(),t=e.Uint8Array;return oi=t,oi}var si,Ud;function RI(){if(Ud)return si;Ud=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(a,o){n[++r]=[o,a]}),n}return si=e,si}var ii,$d;function Pc(){if($d)return ii;$d=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(a){n[++r]=a}),n}return ii=e,ii}var li,qd;function kI(){if(qd)return li;qd=1;var e=Fn(),t=b_(),r=go(),n=y_(),a=RI(),o=Pc(),s=1,i=2,l="[object Boolean]",u="[object Date]",p="[object Error]",d="[object Map]",f="[object Number]",m="[object RegExp]",h="[object Set]",_="[object String]",y="[object Symbol]",T="[object ArrayBuffer]",b="[object DataView]",w=e?e.prototype:void 0,S=w?w.valueOf:void 0;function g(L,I,A,E,O,k,D){switch(A){case b:if(L.byteLength!=I.byteLength||L.byteOffset!=I.byteOffset)return!1;L=L.buffer,I=I.buffer;case T:return!(L.byteLength!=I.byteLength||!k(new t(L),new t(I)));case l:case u:case f:return r(+L,+I);case p:return L.name==I.name&&L.message==I.message;case m:case _:return L==I+"";case d:var M=a;case h:var G=E&s;if(M||(M=o),L.size!=I.size&&!G)return!1;var Y=D.get(L);if(Y)return Y==I;E|=i,D.set(L,I);var ae=n(M(L),M(I),E,O,k,D);return D.delete(L),ae;case y:if(S)return S.call(L)==S.call(I)}return!1}return li=g,li}var ui,Vd;function T_(){if(Vd)return ui;Vd=1;var e=Ac(),t=tt();function r(n,a,o){var s=a(n);return t(n)?s:e(s,o(n))}return ui=r,ui}var ci,Bd;function I_(){if(Bd)return ci;Bd=1;function e(t,r){for(var n=-1,a=t==null?0:t.length,o=0,s=[];++n<a;){var i=t[n];r(i,n,t)&&(s[o++]=i)}return s}return ci=e,ci}var pi,xd;function w_(){if(xd)return pi;xd=1;function e(){return[]}return pi=e,pi}var di,Hd;function Rc(){if(Hd)return di;Hd=1;var e=I_(),t=w_(),r=Object.prototype,n=r.propertyIsEnumerable,a=Object.getOwnPropertySymbols,o=a?function(s){return s==null?[]:(s=Object(s),e(a(s),function(i){return n.call(s,i)}))}:t;return di=o,di}var fi,zd;function S_(){if(zd)return fi;zd=1;function e(t,r){for(var n=-1,a=Array(t);++n<t;)a[n]=r(n);return a}return fi=e,fi}var ya={exports:{}},mi,jd;function NI(){if(jd)return mi;jd=1;function e(){return!1}return mi=e,mi}ya.exports;var Wd;function vo(){return Wd||(Wd=1,(function(e,t){var r=Wt(),n=NI(),a=t&&!t.nodeType&&t,o=a&&!0&&e&&!e.nodeType&&e,s=o&&o.exports===a,i=s?r.Buffer:void 0,l=i?i.isBuffer:void 0,u=l||n;e.exports=u})(ya,ya.exports)),ya.exports}var hi,Gd;function Po(){if(Gd)return hi;Gd=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(n,a){var o=typeof n;return a=a??e,!!a&&(o=="number"||o!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<a}return hi=r,hi}var _i,Yd;function kc(){if(Yd)return _i;Yd=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return _i=t,_i}var yi,Kd;function CI(){if(Kd)return yi;Kd=1;var e=Un(),t=kc(),r=ir(),n="[object Arguments]",a="[object Array]",o="[object Boolean]",s="[object Date]",i="[object Error]",l="[object Function]",u="[object Map]",p="[object Number]",d="[object Object]",f="[object RegExp]",m="[object Set]",h="[object String]",_="[object WeakMap]",y="[object ArrayBuffer]",T="[object DataView]",b="[object Float32Array]",w="[object Float64Array]",S="[object Int8Array]",g="[object Int16Array]",L="[object Int32Array]",I="[object Uint8Array]",A="[object Uint8ClampedArray]",E="[object Uint16Array]",O="[object Uint32Array]",k={};k[b]=k[w]=k[S]=k[g]=k[L]=k[I]=k[A]=k[E]=k[O]=!0,k[n]=k[a]=k[y]=k[o]=k[T]=k[s]=k[i]=k[l]=k[u]=k[p]=k[d]=k[f]=k[m]=k[h]=k[_]=!1;function D(M){return r(M)&&t(M.length)&&!!k[e(M)]}return yi=D,yi}var bi,Zd;function Nc(){if(Zd)return bi;Zd=1;function e(t){return function(r){return t(r)}}return bi=e,bi}var ba={exports:{}};ba.exports;var Xd;function Cc(){return Xd||(Xd=1,(function(e,t){var r=zh(),n=t&&!t.nodeType&&t,a=n&&!0&&e&&!e.nodeType&&e,o=a&&a.exports===n,s=o&&r.process,i=(function(){try{var l=a&&a.require&&a.require("util").types;return l||s&&s.binding&&s.binding("util")}catch{}})();e.exports=i})(ba,ba.exports)),ba.exports}var Ti,Qd;function Dc(){if(Qd)return Ti;Qd=1;var e=CI(),t=Nc(),r=Cc(),n=r&&r.isTypedArray,a=n?t(n):e;return Ti=a,Ti}var Ii,Jd;function g_(){if(Jd)return Ii;Jd=1;var e=S_(),t=So(),r=tt(),n=vo(),a=Po(),o=Dc(),s=Object.prototype,i=s.hasOwnProperty;function l(u,p){var d=r(u),f=!d&&t(u),m=!d&&!f&&n(u),h=!d&&!f&&!m&&o(u),_=d||f||m||h,y=_?e(u.length,String):[],T=y.length;for(var b in u)(p||i.call(u,b))&&!(_&&(b=="length"||m&&(b=="offset"||b=="parent")||h&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||a(b,T)))&&y.push(b);return y}return Ii=l,Ii}var wi,ef;function Ro(){if(ef)return wi;ef=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,a=typeof n=="function"&&n.prototype||e;return r===a}return wi=t,wi}var Si,tf;function E_(){if(tf)return Si;tf=1;function e(t,r){return function(n){return t(r(n))}}return Si=e,Si}var gi,rf;function DI(){if(rf)return gi;rf=1;var e=E_(),t=e(Object.keys,Object);return gi=t,gi}var Ei,nf;function A_(){if(nf)return Ei;nf=1;var e=Ro(),t=DI(),r=Object.prototype,n=r.hasOwnProperty;function a(o){if(!e(o))return t(o);var s=[];for(var i in Object(o))n.call(o,i)&&i!="constructor"&&s.push(i);return s}return Ei=a,Ei}var Ai,af;function Gr(){if(af)return Ai;af=1;var e=d_(),t=kc();function r(n){return n!=null&&t(n.length)&&!e(n)}return Ai=r,Ai}var Li,of;function qa(){if(of)return Li;of=1;var e=g_(),t=A_(),r=Gr();function n(a){return r(a)?e(a):t(a)}return Li=n,Li}var Oi,sf;function L_(){if(sf)return Oi;sf=1;var e=T_(),t=Rc(),r=qa();function n(a){return e(a,r,t)}return Oi=n,Oi}var vi,lf;function MI(){if(lf)return vi;lf=1;var e=L_(),t=1,r=Object.prototype,n=r.hasOwnProperty;function a(o,s,i,l,u,p){var d=i&t,f=e(o),m=f.length,h=e(s),_=h.length;if(m!=_&&!d)return!1;for(var y=m;y--;){var T=f[y];if(!(d?T in s:n.call(s,T)))return!1}var b=p.get(o),w=p.get(s);if(b&&w)return b==s&&w==o;var S=!0;p.set(o,s),p.set(s,o);for(var g=d;++y<m;){T=f[y];var L=o[T],I=s[T];if(l)var A=d?l(I,L,T,s,o,p):l(L,I,T,o,s,p);if(!(A===void 0?L===I||u(L,I,i,l,p):A)){S=!1;break}g||(g=T=="constructor")}if(S&&!g){var E=o.constructor,O=s.constructor;E!=O&&"constructor"in o&&"constructor"in s&&!(typeof E=="function"&&E instanceof E&&typeof O=="function"&&O instanceof O)&&(S=!1)}return p.delete(o),p.delete(s),S}return vi=a,vi}var Pi,uf;function FI(){if(uf)return Pi;uf=1;var e=Wr(),t=Wt(),r=e(t,"DataView");return Pi=r,Pi}var Ri,cf;function UI(){if(cf)return Ri;cf=1;var e=Wr(),t=Wt(),r=e(t,"Promise");return Ri=r,Ri}var ki,pf;function O_(){if(pf)return ki;pf=1;var e=Wr(),t=Wt(),r=e(t,"Set");return ki=r,ki}var Ni,df;function $I(){if(df)return Ni;df=1;var e=Wr(),t=Wt(),r=e(t,"WeakMap");return Ni=r,Ni}var Ci,ff;function Va(){if(ff)return Ci;ff=1;var e=FI(),t=Lc(),r=UI(),n=O_(),a=$I(),o=Un(),s=f_(),i="[object Map]",l="[object Object]",u="[object Promise]",p="[object Set]",d="[object WeakMap]",f="[object DataView]",m=s(e),h=s(t),_=s(r),y=s(n),T=s(a),b=o;return(e&&b(new e(new ArrayBuffer(1)))!=f||t&&b(new t)!=i||r&&b(r.resolve())!=u||n&&b(new n)!=p||a&&b(new a)!=d)&&(b=function(w){var S=o(w),g=S==l?w.constructor:void 0,L=g?s(g):"";if(L)switch(L){case m:return f;case h:return i;case _:return u;case y:return p;case T:return d}return S}),Ci=b,Ci}var Di,mf;function qI(){if(mf)return Di;mf=1;var e=vc(),t=y_(),r=kI(),n=MI(),a=Va(),o=tt(),s=vo(),i=Dc(),l=1,u="[object Arguments]",p="[object Array]",d="[object Object]",f=Object.prototype,m=f.hasOwnProperty;function h(_,y,T,b,w,S){var g=o(_),L=o(y),I=g?p:a(_),A=L?p:a(y);I=I==u?d:I,A=A==u?d:A;var E=I==d,O=A==d,k=I==A;if(k&&s(_)){if(!s(y))return!1;g=!0,E=!1}if(k&&!E)return S||(S=new e),g||i(_)?t(_,y,T,b,w,S):r(_,y,I,T,b,w,S);if(!(T&l)){var D=E&&m.call(_,"__wrapped__"),M=O&&m.call(y,"__wrapped__");if(D||M){var G=D?_.value():_,Y=M?y.value():y;return S||(S=new e),w(G,Y,T,b,S)}}return k?(S||(S=new e),n(_,y,T,b,w,S)):!1}return Di=h,Di}var Mi,hf;function Mc(){if(hf)return Mi;hf=1;var e=qI(),t=ir();function r(n,a,o,s,i){return n===a?!0:n==null||a==null||!t(n)&&!t(a)?n!==n&&a!==a:e(n,a,o,s,r,i)}return Mi=r,Mi}var Fi,_f;function VI(){if(_f)return Fi;_f=1;var e=vc(),t=Mc(),r=1,n=2;function a(o,s,i,l){var u=i.length,p=u,d=!l;if(o==null)return!p;for(o=Object(o);u--;){var f=i[u];if(d&&f[2]?f[1]!==o[f[0]]:!(f[0]in o))return!1}for(;++u<p;){f=i[u];var m=f[0],h=o[m],_=f[1];if(d&&f[2]){if(h===void 0&&!(m in o))return!1}else{var y=new e;if(l)var T=l(h,_,m,o,s,y);if(!(T===void 0?t(_,h,r|n,l,y):T))return!1}}return!0}return Fi=a,Fi}var Ui,yf;function v_(){if(yf)return Ui;yf=1;var e=lr();function t(r){return r===r&&!e(r)}return Ui=t,Ui}var $i,bf;function BI(){if(bf)return $i;bf=1;var e=v_(),t=qa();function r(n){for(var a=t(n),o=a.length;o--;){var s=a[o],i=n[s];a[o]=[s,i,e(i)]}return a}return $i=r,$i}var qi,Tf;function P_(){if(Tf)return qi;Tf=1;function e(t,r){return function(n){return n==null?!1:n[t]===r&&(r!==void 0||t in Object(n))}}return qi=e,qi}var Vi,If;function xI(){if(If)return Vi;If=1;var e=VI(),t=BI(),r=P_();function n(a){var o=t(a);return o.length==1&&o[0][2]?r(o[0][0],o[0][1]):function(s){return s===a||e(s,a,o)}}return Vi=n,Vi}var Bi,wf;function Fc(){if(wf)return Bi;wf=1;var e=tt(),t=Ca(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function a(o,s){if(e(o))return!1;var i=typeof o;return i=="number"||i=="symbol"||i=="boolean"||o==null||t(o)?!0:n.test(o)||!r.test(o)||s!=null&&o in Object(s)}return Bi=a,Bi}var xi,Sf;function HI(){if(Sf)return xi;Sf=1;var e=Oc(),t="Expected a function";function r(n,a){if(typeof n!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var o=function(){var s=arguments,i=a?a.apply(this,s):s[0],l=o.cache;if(l.has(i))return l.get(i);var u=n.apply(this,s);return o.cache=l.set(i,u)||l,u};return o.cache=new(r.Cache||e),o}return r.Cache=e,xi=r,xi}var Hi,gf;function zI(){if(gf)return Hi;gf=1;var e=HI(),t=500;function r(n){var a=e(n,function(s){return o.size===t&&o.clear(),s}),o=a.cache;return a}return Hi=r,Hi}var zi,Ef;function jI(){if(Ef)return zi;Ef=1;var e=zI(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(a){var o=[];return a.charCodeAt(0)===46&&o.push(""),a.replace(t,function(s,i,l,u){o.push(l?u.replace(r,"$1"):i||s)}),o});return zi=n,zi}var ji,Af;function WI(){if(Af)return ji;Af=1;var e=Fn(),t=$a(),r=tt(),n=Ca(),a=e?e.prototype:void 0,o=a?a.toString:void 0;function s(i){if(typeof i=="string")return i;if(r(i))return t(i,s)+"";if(n(i))return o?o.call(i):"";var l=i+"";return l=="0"&&1/i==-1/0?"-0":l}return ji=s,ji}var Wi,Lf;function GI(){if(Lf)return Wi;Lf=1;var e=WI();function t(r){return r==null?"":e(r)}return Wi=t,Wi}var Gi,Of;function $n(){if(Of)return Gi;Of=1;var e=tt(),t=Fc(),r=jI(),n=GI();function a(o,s){return e(o)?o:t(o,s)?[o]:r(n(o))}return Gi=a,Gi}var Yi,vf;function qn(){if(vf)return Yi;vf=1;var e=Ca();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Yi=t,Yi}var Ki,Pf;function ko(){if(Pf)return Ki;Pf=1;var e=$n(),t=qn();function r(n,a){a=e(a,n);for(var o=0,s=a.length;n!=null&&o<s;)n=n[t(a[o++])];return o&&o==s?n:void 0}return Ki=r,Ki}var Zi,Rf;function YI(){if(Rf)return Zi;Rf=1;var e=ko();function t(r,n,a){var o=r==null?void 0:e(r,n);return o===void 0?a:o}return Zi=t,Zi}var Xi,kf;function KI(){if(kf)return Xi;kf=1;function e(t,r){return t!=null&&r in Object(t)}return Xi=e,Xi}var Qi,Nf;function ZI(){if(Nf)return Qi;Nf=1;var e=$n(),t=So(),r=tt(),n=Po(),a=kc(),o=qn();function s(i,l,u){l=e(l,i);for(var p=-1,d=l.length,f=!1;++p<d;){var m=o(l[p]);if(!(f=i!=null&&u(i,m)))break;i=i[m]}return f||++p!=d?f:(d=i==null?0:i.length,!!d&&a(d)&&n(m,d)&&(r(i)||t(i)))}return Qi=s,Qi}var Ji,Cf;function XI(){if(Cf)return Ji;Cf=1;var e=KI(),t=ZI();function r(n,a){return n!=null&&t(n,a,e)}return Ji=r,Ji}var el,Df;function QI(){if(Df)return el;Df=1;var e=Mc(),t=YI(),r=XI(),n=Fc(),a=v_(),o=P_(),s=qn(),i=1,l=2;function u(p,d){return n(p)&&a(d)?o(s(p),d):function(f){var m=t(f,p);return m===void 0&&m===d?r(f,p):e(d,m,i|l)}}return el=u,el}var tl,Mf;function R_(){if(Mf)return tl;Mf=1;function e(t){return function(r){return r?.[t]}}return tl=e,tl}var rl,Ff;function JI(){if(Ff)return rl;Ff=1;var e=ko();function t(r){return function(n){return e(n,r)}}return rl=t,rl}var nl,Uf;function ew(){if(Uf)return nl;Uf=1;var e=R_(),t=JI(),r=Fc(),n=qn();function a(o){return r(o)?e(n(o)):t(o)}return nl=a,nl}var al,$f;function Vn(){if($f)return al;$f=1;var e=xI(),t=QI(),r=Da(),n=tt(),a=ew();function o(s){return typeof s=="function"?s:s==null?r:typeof s=="object"?n(s)?t(s[0],s[1]):e(s):a(s)}return al=o,al}var ol,qf;function tw(){if(qf)return ol;qf=1;function e(t){return function(r,n,a){for(var o=-1,s=Object(r),i=a(r),l=i.length;l--;){var u=i[t?l:++o];if(n(s[u],u,s)===!1)break}return r}}return ol=e,ol}var sl,Vf;function rw(){if(Vf)return sl;Vf=1;var e=tw(),t=e();return sl=t,sl}var il,Bf;function k_(){if(Bf)return il;Bf=1;var e=rw(),t=qa();function r(n,a){return n&&e(n,a,t)}return il=r,il}var ll,xf;function nw(){if(xf)return ll;xf=1;var e=Gr();function t(r,n){return function(a,o){if(a==null)return a;if(!e(a))return r(a,o);for(var s=a.length,i=n?s:-1,l=Object(a);(n?i--:++i<s)&&o(l[i],i,l)!==!1;);return a}}return ll=t,ll}var ul,Hf;function Uc(){if(Hf)return ul;Hf=1;var e=k_(),t=nw(),r=t(e);return ul=r,ul}var cl,zf;function aw(){if(zf)return cl;zf=1;var e=Uc(),t=Gr();function r(n,a){var o=-1,s=t(n)?Array(n.length):[];return e(n,function(i,l,u){s[++o]=a(i,l,u)}),s}return cl=r,cl}var pl,jf;function ow(){if(jf)return pl;jf=1;var e=$a(),t=Vn(),r=aw(),n=tt();function a(o,s){var i=n(o)?e:r;return i(o,t(s,3))}return pl=a,pl}var dl,Wf;function sw(){if(Wf)return dl;Wf=1;var e=p_(),t=ow();function r(n,a){return e(t(n,a),1)}return dl=r,dl}var iw=sw();const Rn=Ge(iw);var fl,Gf;function N_(){if(Gf)return fl;Gf=1;var e=Wr(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return fl=t,fl}var ml,Yf;function $c(){if(Yf)return ml;Yf=1;var e=N_();function t(r,n,a){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):r[n]=a}return ml=t,ml}var hl,Kf;function lw(){if(Kf)return hl;Kf=1;var e=$c(),t=k_(),r=Vn();function n(a,o){var s={};return o=r(o,3),t(a,function(i,l,u){e(s,l,o(i,l,u))}),s}return hl=n,hl}var uw=lw();const or=Ge(uw);var _l,Zf;function cw(){if(Zf)return _l;Zf=1;var e=Math.ceil,t=Math.max;function r(n,a,o,s){for(var i=-1,l=t(e((a-n)/(o||1)),0),u=Array(l);l--;)u[s?l:++i]=n,n+=o;return u}return _l=r,_l}var yl,Xf;function qc(){if(Xf)return yl;Xf=1;var e=go(),t=Gr(),r=Po(),n=lr();function a(o,s,i){if(!n(i))return!1;var l=typeof s;return(l=="number"?t(i)&&r(s,i.length):l=="string"&&s in i)?e(i[s],o):!1}return yl=a,yl}var bl,Qf;function pw(){if(Qf)return bl;Qf=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return bl=t,bl}var Tl,Jf;function dw(){if(Jf)return Tl;Jf=1;var e=pw(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return Tl=r,Tl}var Il,em;function fw(){if(em)return Il;em=1;var e=dw(),t=lr(),r=Ca(),n=NaN,a=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,i=parseInt;function l(u){if(typeof u=="number")return u;if(r(u))return n;if(t(u)){var p=typeof u.valueOf=="function"?u.valueOf():u;u=t(p)?p+"":p}if(typeof u!="string")return u===0?u:+u;u=e(u);var d=o.test(u);return d||s.test(u)?i(u.slice(2),d?2:8):a.test(u)?n:+u}return Il=l,Il}var wl,tm;function C_(){if(tm)return wl;tm=1;var e=fw(),t=1/0,r=17976931348623157e292;function n(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var o=a<0?-1:1;return o*r}return a===a?a:0}return wl=n,wl}var Sl,rm;function mw(){if(rm)return Sl;rm=1;var e=cw(),t=qc(),r=C_();function n(a){return function(o,s,i){return i&&typeof i!="number"&&t(o,s,i)&&(s=i=void 0),o=r(o),s===void 0?(s=o,o=0):s=r(s),i=i===void 0?o<s?1:-1:r(i),e(o,s,i,a)}}return Sl=n,Sl}var gl,nm;function hw(){if(nm)return gl;nm=1;var e=mw(),t=e();return gl=t,gl}var _w=hw();const gn=Ge(_w);var El,am;function yw(){if(am)return El;am=1;function e(t,r,n,a){var o=-1,s=t==null?0:t.length;for(a&&s&&(n=t[++o]);++o<s;)n=r(n,t[o],o,t);return n}return El=e,El}var Al,om;function bw(){if(om)return Al;om=1;function e(t,r,n,a,o){return o(t,function(s,i,l){n=a?(a=!1,s):r(n,s,i,l)}),n}return Al=e,Al}var Ll,sm;function Tw(){if(sm)return Ll;sm=1;var e=yw(),t=Uc(),r=Vn(),n=bw(),a=tt();function o(s,i,l){var u=a(s)?e:n,p=arguments.length<3;return u(s,r(i,4),l,p,t)}return Ll=o,Ll}var Iw=Tw();const ft=Ge(Iw),No=(e,t,r)=>{const{gripperEntities:n,moduleEntities:a,runtimeParameters:o}=t,s=v(e.moduleId,o);if(s==null)return{errors:[C({parameterName:e.moduleId})]};const i=Xn(r,s),l=Object.keys(n).length>0,u=[];if(i==null&&u.push(pe()),l||u.push($h()),u.length>0)return{errors:u};const p=a[s].pythonName;return{commands:[{commandType:"absorbanceReader/closeLid",key:$(),params:{moduleId:s}}],python:`${p}.close_lid()`}},D_=(e,t,r)=>{const{sampleWavelengths:n,measureMode:a,referenceWavelength:o}=e,{runtimeParameters:s}=t,i=v(e.moduleId,s),l=v(a,s),u=l==="single"||l==="multi"?l:null,p=n.map(b=>U(b,s)),d=o==null?void 0:U(o,s),f=[e.moduleId,a,...n,o],m=[i,u,...p,d],h=f.flatMap((b,w)=>typeof b=="string"&&m[w]===null?[C({parameterName:b})]:[]);if(h.length>0||i==null||u==null)return{errors:h};const _=t.moduleEntities[i].pythonName,y=s[a]!=null?a:F(a),T=o!=null?`, reference_wavelength=${o}`:"";return{commands:[{commandType:"absorbanceReader/initialize",key:$(),params:{moduleId:i,measureMode:u,sampleWavelengths:p,...d!=null?{referenceWavelength:d}:{}}}],python:`${_}.initialize(${y}, [${n.join(", ")}]${T})`}},M_=(e,t,r)=>{const{gripperEntities:n,moduleEntities:a,runtimeParameters:o}=t,s=v(e.moduleId,o);if(s==null)return{errors:[C({parameterName:e.moduleId})]};const i=Xn(r,s),l=Object.keys(n).length>0,u=[];if(i==null&&u.push(pe()),l||u.push($h()),u.length>0)return{errors:u};const p=a[s].pythonName;return{commands:[{commandType:"absorbanceReader/openLid",key:$(),params:{moduleId:s}}],python:`${p}.open_lid()`}},F_=(e,t,r)=>{const{fileName:n}=e,{runtimeParameters:a}=t,o=v(e.moduleId,a),s=n==null?void 0:v(n,a),i=[];if(o==null&&i.push(C({parameterName:e.moduleId})),n!=null&&s==null&&i.push(C({parameterName:n})),o==null||i.length>0)return{errors:i};const l=Xn(r,o);if(l==null)return{errors:[pe()]};l.initialization===null&&i.push(qr());const u=t.moduleEntities[o].pythonName,p=n==null||a[n]!=null?n:F(n),d=p!=null?`export_filename=${p}`:"";return i.length>0?{errors:i}:{commands:[{commandType:"absorbanceReader/read",key:$(),params:{moduleId:o,...s!=null?{fileName:s}:{}}}],python:`${u}.read(${d})`}},vt=(e,t,r)=>{const{flowRate:n,pipetteId:a,volume:o,correctionVolume:s}=e,i=[];t.pipetteEntities[a]?.spec||i.push(mt({pipette:a}));const u=t.pipetteEntities[a].pythonName;return{commands:[{commandType:"airGapInPlace",key:$(),params:{flowRate:n,pipetteId:a,volume:o,...s!=null?{correctionVolume:s}:{}}}],python:`${u}.air_gap(${[`volume=${o}`,"in_place=True",`flow_rate=${n}`].join(", ")})`}},ww=(e,t,r)=>{const{pipetteId:n,volume:a,labwareId:o,wellName:s,flowRate:i,isAirGap:l,tipRack:u,wellLocation:p,primaryNozzle:d,nozzles:f}=e,m="aspirate",h=r.labware,_=[],y=t.pipetteEntities[n]?.spec,T=(y?.displayCategory==="FLEX"||y?.channels===96)??!1,b=jn(o,r.labware);if(y||_.push(mt({pipette:n})),!o||!r.labware[o]?_.push(ht({actionName:m,labware:o})):ee(r.labware[o].stack)==="offDeck"&&_.push(Pn()),De.includes(b))_.push(Ht({typeOfStep:m}));else if(h[b]!=null){const O=ee(h[b].stack);De.includes(O)&&_.push(Ht({typeOfStep:m}))}Gn({pipette:n,labware:o,invariantContext:t,prevRobotState:r})&&_.push(Oa()),r.tipState.pipettes[n]?.hasTip||_.push(jt({actionName:m,pipette:n,labware:o,well:s}));const w=t.pipetteEntities[n]?.spec.channels!==1,S=_t({robotState:r,invariantContext:t,pipetteId:n,labwareId:o,wellLocationOffset:p?.offset??{x:0,y:0,z:0},wellTargetName:s,primaryNozzle:d,nozzleConfiguration:f});if(w&&y&&!S.isSafe&&_.push(xt({unsafePipetteMovementReason:S.reason})),Ya(r.modules,r.labware,o)&&_.push(On()),ja(r.modules,r.labware,o)&&_.push(qr()),Xa(r.modules,r.labware,o)&&_.push(Io()),Qa(r.modules,r.labware,o)&&_.push(vn()),Zn(r.modules,b,T?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&_.push(Pa()),T||(Yn(r.modules,b)&&_.push(va()),Kn(r.modules,b,y)&&_.push(Ra()),Za(r.modules,b,y,t.labwareEntities[o])&&_.push(wo())),_.length===0&&y&&y.liquids.default.maxVolume<a&&_.push(ho({actionName:m,volume:a,maxVolume:y.liquids.default.maxVolume})),_.length===0&&y){const O=Go(n,t,u);O<a&&_.push(nT({actionName:m,volume:a,maxVolume:O}))}if(_.length>0)return{errors:_};const g=[{commandType:"aspirate",key:$(),params:{pipetteId:n,volume:a,labwareId:o,wellName:s,wellLocation:p,flowRate:i},...l&&{meta:{isAirGap:l}}}],L=t.pipetteEntities[n].pythonName,I=t.labwareEntities[o].pythonName,A=[`volume=${a}`,`location=${I}[${F(s)}]${zt(p)}`,`flow_rate=${i}`],E=`${L}.aspirate(
2
+ ${Q(A.join(`,
3
3
  `))},
4
- )`;return{commands:E,python:g}},Va=(e,t,r)=>{const{runtimeParameters:n}=t,a=B(e.pipetteId,n),o=ie(e.volume,n),s=ie(e.flowRate,n),i=e.correctionVolume==null?void 0:ie(e.correctionVolume,n),l=[e.pipetteId,e.volume,e.flowRate,e.correctionVolume],u=[a,o,s,i],p=l.flatMap((m,h)=>typeof m=="string"&&u[h]==null?[H({parameterName:m})]:[]);if(p.length>0||a==null||o==null||s==null)return{errors:p};if(r.tipState.pipettes[a]?.hasTip||p.push(zt({actionName:"aspirate",pipette:a})),p.length>0)return{errors:p};const d=t.pipetteEntities[a].pythonName,f=[`volume=${e.volume}`,`flow_rate=${e.flowRate}`];return{commands:[{commandType:"aspirateInPlace",key:M(),params:{pipetteId:a,volume:o,flowRate:s,...i!=null?{correctionVolume:i}:{}}}],python:`${d}.aspirate(${f.join(", ")})`}},Vn=(e,t,r)=>{const{runtimeParameters:n}=t,a=B(e.pipetteId,n),o=ie(e.flowRate,n),s=[e.pipetteId,e.flowRate],i=[a,o],l=s.flatMap((p,d)=>typeof p=="string"&&i[d]==null?[H({parameterName:p})]:[]);if(l.length>0||a==null||o==null)return{errors:l};if(r.tipState.pipettes[a]?.hasTip||l.push(zt({actionName:"blowout",pipette:a})),l.length>0)return{errors:l};const u=t.pipetteEntities[a].pythonName;return{commands:[{commandType:"blowOutInPlace",key:M(),params:{pipetteId:a,flowRate:o}}],python:`${u}.flow_rate.blow_out = ${e.flowRate}
5
- ${u}.blow_out()`}},Uc=(e,t,r)=>{const{pipetteEntities:n,labwareEntities:a,runtimeParameters:o}=t,s=B(e.pipetteId,o),i=B(e.labwareId,o),l=B(e.wellName,o),u=ie(e.flowRate,o),p=Pn(e.wellLocation,o),d=[e.pipetteId,e.labwareId,e.wellName,e.flowRate],f=[s,i,l,u],m=[...d.flatMap((D,q)=>typeof D=="string"&&f[q]==null?[H({parameterName:D})]:[]),...p.invalidParameterNames.map(D=>H({parameterName:D}))];if(m.length>0||s==null||i==null||l==null||u==null)return{errors:m};const h=p.location,_=n[s],b="blowout",T=[],y=_?.spec,I=(y?.displayCategory==="FLEX"||y?.channels===96)??!1,w=r.pipettes[s],E=r.labware,A=Hn(i,r.labware);if(w||T.push(ft({pipette:s})),y==null&&T.push(ft({pipette:s})),r.tipState.pipettes[s]?.hasTip||T.push(zt({actionName:b,pipette:s,labware:i,well:l})),!i||!r.labware[i]?T.push(mt({actionName:b,labware:i})):K(r.labware[i].stack)==="offDeck"&&T.push(Ln()),De.includes(A))T.push(xt({typeOfStep:b}));else if(E[A]!=null){const D=K(E[A].stack);De.includes(D)&&T.push(xt({typeOfStep:b}))}if(jn({pipette:s,labware:i,invariantContext:t,prevRobotState:r})&&T.push(Aa()),Ga(r.modules,r.labware,i)&&T.push(Sn()),Ha(r.modules,r.labware,i)&&T.push(qr()),Ka(r.modules,r.labware,i)&&T.push(To()),Za(r.modules,r.labware,i)&&T.push(An()),Yn(r.modules,A,I?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&T.push(Oa()),!I&&y!=null&&(Gn(r.modules,A)&&T.push(La()),Wn(r.modules,A,y)&&T.push(Ra()),Ya(r.modules,A,y,t.labwareEntities[i])&&T.push(Io())),T.length>0)return{errors:T};const L=_.pythonName,S=a[i].pythonName,g=o[e.wellName]!=null?e.wellName:C(l),k=Ht(e.wellLocation==null?void 0:{origin:h?.origin,offset:e.wellLocation.offset});return{commands:[{commandType:"blowout",key:M(),params:{pipetteId:s,labwareId:i,wellName:l,flowRate:u,wellLocation:h}}],python:`${L}.flow_rate.blow_out = ${e.flowRate}
6
- ${L}.blow_out(${S}[${g}]${k})`}},F_=(e,t,r)=>{const n={commandType:"captureImage",key:M(),params:{homeBefore:e.homeBefore,fileName:e.fileName,resolution:e.resolution,zoom:e.zoom,contrast:e.contrast,brightness:e.brightness,saturation:e.saturation}},a=`${we}.capture_image()`;return{commands:[n],python:a}},U_=(e,t,r)=>{const{message:n}=e,a=[{commandType:"comment",key:M(),params:{message:n}}],o=`${we}.comment(${C(n)})`;return{commands:a,python:o}},Rn=(e,t,r)=>{const{pipetteId:n,volume:a}=e,{runtimeParameters:o}=t,s=B(n,o),i=ie(a,o),l=[];if(s==null&&l.push(H({parameterName:n})),typeof a=="string"&&i==null&&l.push(H({parameterName:a})),s==null||i==null)return{errors:l};const u=t.pipetteEntities[s];return u==null?{commands:[]}:{commands:[{commandType:"configureForVolume",key:M(),params:{pipetteId:s,volume:i}}],python:`${u.pythonName}.configure_for_volume(${a})`}},q_=(e,t,r)=>{const{pipetteId:n,configurationParams:a}=e,{style:o,primaryNozzle:s,backLeftNozzle:i}=a,{runtimeParameters:l}=t,u=B(n,l),p=fo(o,i_,l),d=s==null?void 0:fo(s,l_,l),f=i==null?void 0:fo(i,u_,l),m=[];if(u==null&&m.push(H({parameterName:n})),p==null&&m.push(H({parameterName:o})),s!=null&&d==null&&m.push(H({parameterName:s})),i!=null&&f==null&&m.push(H({parameterName:i})),u==null||p==null||s!=null&&d==null||i!=null&&f==null)return{errors:m};const h=t.pipetteEntities[u].pythonName;let _=`protocol_api.${p}`;l[o]!=null&&(_=o);const b=[_];if(s!=null&&d!=null){const y=ac(s,d,l);p===c.PARTIAL_COLUMN?b.push(`start=${C(c.H1_NOZZLE)}, end=${y}`):b.push(`start=${y}`)}i!=null&&f!=null&&b.push(`back_left=${ac(i,f,l)}`);const T={style:p,...d!=null?{primaryNozzle:d}:{},...f!=null?{backLeftNozzle:f}:{}};return{commands:[{commandType:"configureNozzleLayout",key:M(),params:{pipetteId:u,configurationParams:T}}],python:`${h}.configure_nozzle_layout(
7
- ${Y(b.join(`,
4
+ )`;return{commands:g,python:E}},Ba=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.pipetteId,n),o=U(e.volume,n),s=U(e.flowRate,n),i=e.correctionVolume==null?void 0:U(e.correctionVolume,n),l=[e.pipetteId,e.volume,e.flowRate,e.correctionVolume],u=[a,o,s,i],p=l.flatMap((m,h)=>typeof m=="string"&&u[h]==null?[C({parameterName:m})]:[]);if(p.length>0||a==null||o==null||s==null)return{errors:p};if(r.tipState.pipettes[a]?.hasTip||p.push(jt({actionName:"aspirate",pipette:a})),p.length>0)return{errors:p};const d=t.pipetteEntities[a].pythonName,f=[`volume=${e.volume}`,`flow_rate=${e.flowRate}`];return{commands:[{commandType:"aspirateInPlace",key:$(),params:{pipetteId:a,volume:o,flowRate:s,...i!=null?{correctionVolume:i}:{}}}],python:`${d}.aspirate(${f.join(", ")})`}},Bn=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.pipetteId,n),o=U(e.flowRate,n),s=[e.pipetteId,e.flowRate],i=[a,o],l=s.flatMap((p,d)=>typeof p=="string"&&i[d]==null?[C({parameterName:p})]:[]);if(l.length>0||a==null||o==null)return{errors:l};if(r.tipState.pipettes[a]?.hasTip||l.push(jt({actionName:"blowout",pipette:a})),l.length>0)return{errors:l};const u=t.pipetteEntities[a].pythonName;return{commands:[{commandType:"blowOutInPlace",key:$(),params:{pipetteId:a,flowRate:o}}],python:`${u}.flow_rate.blow_out = ${e.flowRate}
5
+ ${u}.blow_out()`}},Vc=(e,t,r)=>{const{pipetteEntities:n,labwareEntities:a,runtimeParameters:o}=t,s=v(e.pipetteId,o),i=v(e.labwareId,o),l=v(e.wellName,o),u=U(e.flowRate,o),p=Cn(e.wellLocation,o),d=[e.pipetteId,e.labwareId,e.wellName,e.flowRate],f=[s,i,l,u],m=[...d.flatMap((D,M)=>typeof D=="string"&&f[M]==null?[C({parameterName:D})]:[]),...p.invalidParameterNames.map(D=>C({parameterName:D}))];if(m.length>0||s==null||i==null||l==null||u==null)return{errors:m};const h=p.location,_=n[s],y="blowout",T=[],b=_?.spec,w=(b?.displayCategory==="FLEX"||b?.channels===96)??!1,S=r.pipettes[s],g=r.labware,L=jn(i,r.labware);if(S||T.push(mt({pipette:s})),b==null&&T.push(mt({pipette:s})),r.tipState.pipettes[s]?.hasTip||T.push(jt({actionName:y,pipette:s,labware:i,well:l})),!i||!r.labware[i]?T.push(ht({actionName:y,labware:i})):ee(r.labware[i].stack)==="offDeck"&&T.push(Pn()),De.includes(L))T.push(Ht({typeOfStep:y}));else if(g[L]!=null){const D=ee(g[L].stack);De.includes(D)&&T.push(Ht({typeOfStep:y}))}if(Gn({pipette:s,labware:i,invariantContext:t,prevRobotState:r})&&T.push(Oa()),Ya(r.modules,r.labware,i)&&T.push(On()),ja(r.modules,r.labware,i)&&T.push(qr()),Xa(r.modules,r.labware,i)&&T.push(Io()),Qa(r.modules,r.labware,i)&&T.push(vn()),Zn(r.modules,L,w?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&T.push(Pa()),!w&&b!=null&&(Yn(r.modules,L)&&T.push(va()),Kn(r.modules,L,b)&&T.push(Ra()),Za(r.modules,L,b,t.labwareEntities[i])&&T.push(wo())),T.length>0)return{errors:T};const I=_.pythonName,A=a[i].pythonName,E=o[e.wellName]!=null?e.wellName:F(l),O=zt(e.wellLocation==null?void 0:{origin:h?.origin,offset:e.wellLocation.offset});return{commands:[{commandType:"blowout",key:$(),params:{pipetteId:s,labwareId:i,wellName:l,flowRate:u,wellLocation:h}}],python:`${I}.flow_rate.blow_out = ${e.flowRate}
6
+ ${I}.blow_out(${A}[${E}]${O})`}},U_=(e,t,r)=>{const n={commandType:"captureImage",key:$(),params:{homeBefore:e.homeBefore,fileName:e.fileName,resolution:e.resolution,zoom:e.zoom,contrast:e.contrast,brightness:e.brightness,saturation:e.saturation}},a=`${ge}.capture_image()`;return{commands:[n],python:a}},$_=(e,t,r)=>{const{message:n}=e,a=[{commandType:"comment",key:$(),params:{message:n}}],o=`${ge}.comment(${F(n)})`;return{commands:a,python:o}},kn=(e,t,r)=>{const{pipetteId:n,volume:a}=e,{runtimeParameters:o}=t,s=v(n,o),i=U(a,o),l=[];if(s==null&&l.push(C({parameterName:n})),typeof a=="string"&&i==null&&l.push(C({parameterName:a})),s==null||i==null)return{errors:l};const u=t.pipetteEntities[s];return u==null?{commands:[]}:{commands:[{commandType:"configureForVolume",key:$(),params:{pipetteId:s,volume:i}}],python:`${u.pythonName}.configure_for_volume(${a})`}},q_=(e,t,r)=>{const{pipetteId:n,configurationParams:a}=e,{style:o,primaryNozzle:s,backLeftNozzle:i}=a,{runtimeParameters:l}=t,u=v(n,l),p=En(o,gc,l),d=s==null?void 0:En(s,Ec,l),f=i==null?void 0:En(i,c_,l),m=[];if(u==null&&m.push(C({parameterName:n})),p==null&&m.push(C({parameterName:o})),s!=null&&d==null&&m.push(C({parameterName:s})),i!=null&&f==null&&m.push(C({parameterName:i})),u==null||p==null||s!=null&&d==null||i!=null&&f==null)return{errors:m};const h=t.pipetteEntities[u].pythonName;let _=`protocol_api.${p}`;l[o]!=null&&(_=o);const y=[_];if(s!=null&&d!=null){const b=oc(s,d,l);p===c.PARTIAL_COLUMN?y.push(`start=${F(c.H1_NOZZLE)}, end=${b}`):y.push(`start=${b}`)}i!=null&&f!=null&&y.push(`back_left=${oc(i,f,l)}`);const T={style:p,...d!=null?{primaryNozzle:d}:{},...f!=null?{backLeftNozzle:f}:{}};return{commands:[{commandType:"configureNozzleLayout",key:$(),params:{pipetteId:u,configurationParams:T}}],python:`${h}.configure_nozzle_layout(
7
+ ${Q(y.join(`,
8
8
  `))},
9
- )`}},V_=(e,t,r)=>{const{runtimeParameters:n}=t,a=B(e.moduleId,n);if(e.moduleId!=null&&a==null)return{errors:[H({parameterName:e.moduleId})]};if(a===null)return{errors:[re()]};const o=t.moduleEntities[a],s=o?.type,i=o?.pythonName,l={moduleId:a};return s===c.TEMPERATURE_MODULE_TYPE?{commands:[{commandType:"temperatureModule/deactivate",key:M(),params:l}],python:`${i}.deactivate()`}:s===c.THERMOCYCLER_MODULE_TYPE?{commands:[{commandType:"thermocycler/deactivateLid",key:M(),params:l},{commandType:"thermocycler/deactivateBlock",key:M(),params:l}],python:`${i}.deactivate_lid()
10
- ${i}.deactivate_block()`}:s===c.HEATERSHAKER_MODULE_TYPE?{commands:[{commandType:"heaterShaker/deactivateHeater",key:M(),params:l}],python:`${i}.deactivate_heater()`}:(console.error(`setTemperature expected module ${a} to be ${c.TEMPERATURE_MODULE_TYPE}, ${c.THERMOCYCLER_MODULE_TYPE} or ${c.HEATERSHAKER_MODULE_TYPE}, got ${s}`),{errors:[re()]})},be=(e,t,r)=>{const{message:n}=e;let a,o;if("seconds"in e){a={commandType:"waitForDuration",key:M(),params:{seconds:e.seconds,message:n}};const s=[`seconds=${e.seconds}`,...n?[`msg=${C(n)}`]:[]];o=`${we}.delay(${s.join(", ")})`}else a={commandType:"waitForResume",key:M(),params:{message:n}},o=`${we}.pause(${n?C(n):""})`;return{commands:[a],python:o}},$_=(e,t,r)=>{const{moduleId:n}=e,{moduleEntities:a}=t,o="magneticModule/disengage";if(n===null)return{errors:[re()]};if(a[n]?.type!==c.MAGNETIC_MODULE_TYPE)throw new Error(`expected module ${n} to be magdeck, got ${a[n]?.type}`);const s=a[n].pythonName;return{commands:[{commandType:o,key:M(),params:{moduleId:n}}],python:`${s}.disengage()`}},qc=(e,t,r)=>{const{pipetteId:n,volume:a,labwareId:o,wellName:s,flowRate:i,isAirGap:l,wellLocation:u,pushOut:p,primaryNozzle:d,nozzles:f}=e,m="dispense",h=r.labware,_=[],b=t.pipetteEntities[n]?.spec,T=(b?.displayCategory==="FLEX"||b?.channels===96)??!1,y=Hn(o,r.labware);if(b||_.push(ft({pipette:n})),jn({pipette:n,labware:o,invariantContext:t,prevRobotState:r})&&_.push(Aa()),r.tipState.pipettes[n]?.hasTip||_.push(zt({actionName:m,pipette:n,labware:o,well:s})),!o||!r.labware[o]?_.push(mt({actionName:m,labware:o})):K(r.labware[o].stack)==="offDeck"&&_.push(Ln()),De.includes(y))_.push(xt({typeOfStep:m}));else if(h[y]!=null){const k=K(h[y].stack);De.includes(k)&&_.push(xt({typeOfStep:m}))}const I=t.pipetteEntities[n]?.spec.channels!==1,w=ht({robotState:r,invariantContext:t,pipetteId:n,labwareId:o,wellLocationOffset:u?.offset??{x:0,y:0,z:0},wellTargetName:s,primaryNozzle:d,nozzleConfiguration:f});if(I&&!w.isSafe&&_.push(Bt({unsafePipetteMovementReason:w.reason})),Ga(r.modules,r.labware,o)&&_.push(Sn()),Ha(r.modules,r.labware,o)&&_.push(qr()),Ka(r.modules,r.labware,o)&&_.push(To()),Za(r.modules,r.labware,o)&&_.push(An()),Yn(r.modules,y,T?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&_.push(Oa()),T||(Gn(r.modules,y)&&_.push(La()),Wn(r.modules,y,b)&&_.push(Ra()),Ya(r.modules,y,b,t.labwareEntities[o])&&_.push(Io())),_.length>0)return{errors:_};const E=[{commandType:"dispense",key:M(),params:{pipetteId:n,volume:a,labwareId:o,wellName:s,wellLocation:u,flowRate:i,...p!=null?{pushOut:p}:{}},...l&&{meta:{isAirGap:l}}}],A=t.pipetteEntities[n].pythonName,L=t.labwareEntities[o].pythonName,S=[`volume=${a}`,`location=${L}[${C(s)}]${Ht(u)}`,`flow_rate=${i}`,...p!=null?[`push_out=${p}`]:[]],g=`${A}.dispense(
11
- ${Y(S.join(`,
9
+ )`}},V_=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.moduleId,n);if(e.moduleId!=null&&a==null)return{errors:[C({parameterName:e.moduleId})]};if(a===null)return{errors:[pe()]};const o=t.moduleEntities[a],s=o?.type,i=o?.pythonName,l={moduleId:a};return s===c.TEMPERATURE_MODULE_TYPE?{commands:[{commandType:"temperatureModule/deactivate",key:$(),params:l}],python:`${i}.deactivate()`}:s===c.THERMOCYCLER_MODULE_TYPE?{commands:[{commandType:"thermocycler/deactivateLid",key:$(),params:l},{commandType:"thermocycler/deactivateBlock",key:$(),params:l}],python:`${i}.deactivate_lid()
10
+ ${i}.deactivate_block()`}:s===c.HEATERSHAKER_MODULE_TYPE?{commands:[{commandType:"heaterShaker/deactivateHeater",key:$(),params:l}],python:`${i}.deactivate_heater()`}:(console.error(`setTemperature expected module ${a} to be ${c.TEMPERATURE_MODULE_TYPE}, ${c.THERMOCYCLER_MODULE_TYPE} or ${c.HEATERSHAKER_MODULE_TYPE}, got ${s}`),{errors:[pe()]})},Te=(e,t,r)=>{const{message:n}=e;let a,o;if("seconds"in e){a={commandType:"waitForDuration",key:$(),params:{seconds:e.seconds,message:n}};const s=[`seconds=${e.seconds}`,...n?[`msg=${F(n)}`]:[]];o=`${ge}.delay(${s.join(", ")})`}else a={commandType:"waitForResume",key:$(),params:{message:n}},o=`${ge}.pause(${n?F(n):""})`;return{commands:[a],python:o}},B_=(e,t,r)=>{const{moduleEntities:n,runtimeParameters:a}=t,o=v(e.moduleId,a);if(o==null)return console.error(`disengageMagnet: arg resolved to null (moduleId=${String(o)})`),{errors:[C({parameterName:e.moduleId})]};if(n[o]?.type!==c.MAGNETIC_MODULE_TYPE)throw new Error(`expected module ${o} to be magdeck, got ${n[o]?.type}`);const s=n[o].pythonName;return{commands:[{commandType:"magneticModule/disengage",key:$(),params:{moduleId:o}}],python:`${s}.disengage()`}},Bc=(e,t,r)=>{const{pipetteId:n,volume:a,labwareId:o,wellName:s,flowRate:i,isAirGap:l,wellLocation:u,pushOut:p,primaryNozzle:d,nozzles:f}=e,m="dispense",h=r.labware,_=[],y=t.pipetteEntities[n]?.spec,T=(y?.displayCategory==="FLEX"||y?.channels===96)??!1,b=jn(o,r.labware);if(y||_.push(mt({pipette:n})),Gn({pipette:n,labware:o,invariantContext:t,prevRobotState:r})&&_.push(Oa()),r.tipState.pipettes[n]?.hasTip||_.push(jt({actionName:m,pipette:n,labware:o,well:s})),!o||!r.labware[o]?_.push(ht({actionName:m,labware:o})):ee(r.labware[o].stack)==="offDeck"&&_.push(Pn()),De.includes(b))_.push(Ht({typeOfStep:m}));else if(h[b]!=null){const O=ee(h[b].stack);De.includes(O)&&_.push(Ht({typeOfStep:m}))}const w=t.pipetteEntities[n]?.spec.channels!==1,S=_t({robotState:r,invariantContext:t,pipetteId:n,labwareId:o,wellLocationOffset:u?.offset??{x:0,y:0,z:0},wellTargetName:s,primaryNozzle:d,nozzleConfiguration:f});if(w&&!S.isSafe&&_.push(xt({unsafePipetteMovementReason:S.reason})),Ya(r.modules,r.labware,o)&&_.push(On()),ja(r.modules,r.labware,o)&&_.push(qr()),Xa(r.modules,r.labware,o)&&_.push(Io()),Qa(r.modules,r.labware,o)&&_.push(vn()),Zn(r.modules,b,T?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&_.push(Pa()),T||(Yn(r.modules,b)&&_.push(va()),Kn(r.modules,b,y)&&_.push(Ra()),Za(r.modules,b,y,t.labwareEntities[o])&&_.push(wo())),_.length>0)return{errors:_};const g=[{commandType:"dispense",key:$(),params:{pipetteId:n,volume:a,labwareId:o,wellName:s,wellLocation:u,flowRate:i,...p!=null?{pushOut:p}:{}},...l&&{meta:{isAirGap:l}}}],L=t.pipetteEntities[n].pythonName,I=t.labwareEntities[o].pythonName,A=[`volume=${a}`,`location=${I}[${F(s)}]${zt(u)}`,`flow_rate=${i}`,...p!=null?[`push_out=${p}`]:[]],E=`${L}.dispense(
11
+ ${Q(A.join(`,
12
12
  `))},
13
- )`;return{commands:E,python:g}},Je=(e,t,r)=>{const{isAirGap:n}=e,{runtimeParameters:a}=t,o=B(e.pipetteId,a),s=ie(e.volume,a),i=ie(e.flowRate,a),l=e.pushOut==null?void 0:ie(e.pushOut,a),u=e.correctionVolume==null?void 0:ie(e.correctionVolume,a),p=[e.pipetteId,e.volume,e.flowRate,e.pushOut,e.correctionVolume],d=[o,s,i,l,u],f=p.flatMap((_,b)=>typeof _=="string"&&d[b]==null?[H({parameterName:_})]:[]);if(f.length>0||o==null||s==null||i==null)return{errors:f};if(r.tipState.pipettes[o]?.hasTip||f.push(zt({actionName:"dispense",pipette:o})),f.length>0)return{errors:f};const m=t.pipetteEntities[o].pythonName,h=[`volume=${e.volume}`,`flow_rate=${e.flowRate}`,...e.pushOut!=null?[`push_out=${e.pushOut}`]:[]];return{commands:[{commandType:"dispenseInPlace",key:M(),params:{pipetteId:o,volume:s,flowRate:i,...l!=null?{pushOut:l}:{},...u!=null?{correctionVolume:u}:{}},...n?{meta:{isAirGap:n}}:{}}],python:`${m}.dispense(${h.join(", ")})`}},Gr=(e,t,r)=>{const{isReturnTip:n}=e,{runtimeParameters:a}=t,o=B(e.pipette,a),s=e.dropTipLocation==null?void 0:B(e.dropTipLocation,a),i=e.wellName==null?void 0:B(e.wellName,a),l=[e.pipette,e.dropTipLocation,e.wellName],u=[o,s,i],p=l.flatMap((T,y)=>typeof T=="string"&&u[y]==null?[H({parameterName:T})]:[]);if(p.length>0||o==null)return{errors:p};if(!r.tipState.pipettes[o]?.hasTip)return{commands:[]};const d=r.pipettes[o].tiprackId,f=r.pipettes[o].tipWell,m=Object.values(t.labwareEntities).find(({id:T})=>T===d),h=m!=null&&f!=null;if(n&&!h)return{errors:[wp()]};let _=null;if(n&&h){const T=t.pipetteEntities[o].pythonName,I=`${m.pythonName}["${f}"]`;_=`${T}.drop_tip(location=${I})`}let b=[];if(n){if(d==null||f==null)return{errors:[wp()]};b=[{commandType:"dropTip",key:M(),params:{pipetteId:o,labwareId:d,wellName:f}}]}else{if(s==null||i==null)return{errors:[Cn()]};b=[{commandType:"dropTip",key:M(),params:{pipetteId:o,labwareId:s,wellName:i}}]}return{commands:b,..._!=null?{python:_}:{}}},No=(e,t,r)=>{const{pipetteId:n}=e;if(!r.tipState.pipettes[n]?.hasTip)return{commands:[]};const{pipetteEntities:a,trashBinEntities:o,wasteChuteEntities:s}=t,i=a[n].pythonName,l=r.pipettes[n]?.entityId??"",u=o[l],p=s[l],d=u!=null?`${u.pythonName}, alternate_drop_location=True`:p?.pythonName??"";return{commands:[{commandType:"dropTipInPlace",key:M(),params:{pipetteId:n}}],python:`${i}.drop_tip(${d})`}},B_=(e,t,r)=>{const{moduleId:n,height:a}=e,{moduleEntities:o}=t,s="magneticModule/engage";if(n===null)return{errors:[re()]};if(o[n]?.type!==c.MAGNETIC_MODULE_TYPE)throw new Error(`expected module ${n} to be magdeck, got ${o[n]?.type}`);const i=o[n].pythonName;return{commands:[{commandType:s,key:M(),params:{moduleId:n,height:a}}],python:`${i}.engage(height_from_base=${a})`}},x_=(e,t,r)=>{const{moduleEntities:n}=t,{moduleId:a,strategy:o,message:s,count:i}=e,l=_t(r,a);if(a==null||n[a]==null)return{errors:[re()]};const u=[];if(l==null&&u.push(re()),u.length>0)return{errors:u};const p=n[a].pythonName;return{commands:[{commandType:"flexStacker/empty",key:M(),params:{moduleId:a,strategy:o,message:s,count:i}}],python:`${p}.empty(${e.message?`message=${C(e.message)}`:""})`}},H_=(e,t,r)=>{const{moduleId:n,interventionMessage:a,fillLabwareIds:o}=e,{labwareEntities:s,moduleEntities:i}=t;if(n==null||i[n]==null)return{errors:[re()]};const l=_t(r,n),u=rp(l,t.labwareEntities),p=i[n].pythonName,d=o.filter(T=>!c.getIsLid(s[T].def)).map(T=>s[T]?.pythonName),m=Do(d,4).map(T=>Ba+T.join(", ")).join(`,
13
+ )`;return{commands:g,python:E}},Je=(e,t,r)=>{const{isAirGap:n}=e,{runtimeParameters:a}=t,o=v(e.pipetteId,a),s=U(e.volume,a),i=U(e.flowRate,a),l=e.pushOut==null?void 0:U(e.pushOut,a),u=e.correctionVolume==null?void 0:U(e.correctionVolume,a),p=[e.pipetteId,e.volume,e.flowRate,e.pushOut,e.correctionVolume],d=[o,s,i,l,u],f=p.flatMap((_,y)=>typeof _=="string"&&d[y]==null?[C({parameterName:_})]:[]);if(f.length>0||o==null||s==null||i==null)return{errors:f};if(r.tipState.pipettes[o]?.hasTip||f.push(jt({actionName:"dispense",pipette:o})),f.length>0)return{errors:f};const m=t.pipetteEntities[o].pythonName,h=[`volume=${e.volume}`,`flow_rate=${e.flowRate}`,...e.pushOut!=null?[`push_out=${e.pushOut}`]:[]];return{commands:[{commandType:"dispenseInPlace",key:$(),params:{pipetteId:o,volume:s,flowRate:i,...l!=null?{pushOut:l}:{},...u!=null?{correctionVolume:u}:{}},...n?{meta:{isAirGap:n}}:{}}],python:`${m}.dispense(${h.join(", ")})`}},Yr=(e,t,r)=>{const{isReturnTip:n}=e,{runtimeParameters:a}=t,o=v(e.pipette,a),s=e.dropTipLocation==null?void 0:v(e.dropTipLocation,a),i=e.wellName==null?void 0:v(e.wellName,a),l=[e.pipette,e.dropTipLocation,e.wellName],u=[o,s,i],p=l.flatMap((T,b)=>typeof T=="string"&&u[b]==null?[C({parameterName:T})]:[]);if(p.length>0||o==null)return{errors:p};if(!r.tipState.pipettes[o]?.hasTip)return{commands:[]};const d=r.pipettes[o].tiprackId,f=r.pipettes[o].tipWell,m=Object.values(t.labwareEntities).find(({id:T})=>T===d),h=m!=null&&f!=null;if(n&&!h)return{errors:[Ap()]};let _=null;if(n&&h){const T=t.pipetteEntities[o].pythonName,w=`${m.pythonName}["${f}"]`;_=`${T}.drop_tip(location=${w})`}let y=[];if(n){if(d==null||f==null)return{errors:[Ap()]};y=[{commandType:"dropTip",key:$(),params:{pipetteId:o,labwareId:d,wellName:f}}]}else{if(s==null||i==null)return{errors:[Mn()]};y=[{commandType:"dropTip",key:$(),params:{pipetteId:o,labwareId:s,wellName:i}}]}return{commands:y,..._!=null?{python:_}:{}}},Co=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.pipetteId,n),o=e.homeAfter==null?void 0:lt(e.homeAfter,n),s=[e.pipetteId,e.homeAfter],i=[a,o],l=s.flatMap((b,w)=>typeof b=="string"&&i[w]==null?[C({parameterName:b})]:[]);if(l.length>0||a==null)return{errors:l};if(!r.tipState.pipettes[a]?.hasTip)return{commands:[]};const{pipetteEntities:u,trashBinEntities:p,wasteChuteEntities:d}=t,f=u[a].pythonName,m=r.pipettes[a]?.entityId??"",h=p[m],_=d[m],y=[h!=null?`${h.pythonName}, alternate_drop_location=True`:_?.pythonName,...e.homeAfter!=null?[`home_after=${Vr(e.homeAfter)}`]:[]].filter(Boolean).join(", ");return{commands:[{commandType:"dropTipInPlace",key:$(),params:{pipetteId:a,...o!=null?{homeAfter:o}:{}}}],python:`${f}.drop_tip(${y})`}},x_=(e,t,r)=>{const{moduleEntities:n,runtimeParameters:a}=t,o=v(e.moduleId,a),s=U(e.height,a),i=[];if(o==null&&i.push(C({parameterName:e.moduleId})),typeof e.height=="string"&&s==null&&i.push(C({parameterName:e.height})),i.length>0||o==null||s==null)return console.error(`engageMagnet: arg resolved to null (moduleId=${String(o)}, height=${String(s)})`),{errors:i};if(n[o]?.type!==c.MAGNETIC_MODULE_TYPE)throw new Error(`expected module ${o} to be magdeck, got ${n[o]?.type}`);const l=n[o].pythonName;return{commands:[{commandType:"magneticModule/engage",key:$(),params:{moduleId:o,height:s}}],python:`${l}.engage(height_from_base=${e.height})`}},H_=(e,t,r)=>{const{moduleEntities:n}=t,{moduleId:a,strategy:o,message:s,count:i}=e,l=yt(r,a);if(a==null||n[a]==null)return{errors:[pe()]};const u=[];if(l==null&&u.push(pe()),u.length>0)return{errors:u};const p=n[a].pythonName;return{commands:[{commandType:"flexStacker/empty",key:$(),params:{moduleId:a,strategy:o,message:s,count:i}}],python:`${p}.empty(${e.message?`message=${F(e.message)}`:""})`}},z_=(e,t,r)=>{const{moduleId:n,interventionMessage:a,fillLabwareIds:o}=e,{labwareEntities:s,moduleEntities:i}=t;if(n==null||i[n]==null)return{errors:[pe()]};const l=yt(r,n),u=ap(l,t.labwareEntities),p=i[n].pythonName,d=o.filter(T=>!c.getIsLid(s[T].def)).map(T=>s[T]?.pythonName),m=Mo(d,4).map(T=>Ha+T.join(", ")).join(`,
14
14
  `),h=d.length<4?d.join(", "):`
15
15
  ${m}
16
- `;if(l!=null&&l.storedLabwareDetails===null&&l.labwareInHopper==null)return{errors:[lT()]};if(u){if(o.length>0&&!o.every(y=>tp(y,t,l)))return{errors:[Fh()]}}else return{errors:[Uh()]};const b=[...o.filter(T=>!c.getIsLid(s[T].def)).length>0?`labware=[${h}],
17
- `:[],...a!=null?[`message=${C(a)},
18
- `]:[]].join("");return{commands:[{commandType:"flexStacker/fillItems",key:M(),params:{moduleId:n,labware:o,message:a??void 0}}],python:`${p}.fill_items(
19
- ${Y(b)})`}},z_=(e,t,r)=>{const{moduleId:n}=e,{moduleEntities:a}=t;if(n==null||a[n]==null)return{errors:[re()]};const o=a[n].pythonName,s=_t(r,n),i=s?.labwareInHopper!=null&&s.labwareInHopper.length>0;return s!==null&&ep(s)?{errors:[sT()]}:i?{commands:[{commandType:"flexStacker/retrieve",key:M(),params:{moduleId:n}}],python:`${o}.retrieve()`}:{errors:[oT()]}},j_=(e,t,r)=>{const{moduleId:n}=e,{labwareEntities:a,moduleEntities:o}=t;if(n==null||o[n]==null)return{errors:[re()]};const s=o[n].pythonName,i=_t(r,n),l=i?.labwareOnShuttle?.primaryLabwareId??null,u=rp(i,a);return i!==null&&!ep(i)?{errors:[iT()]}:l!==null&&!tp(l,t,i)?{errors:[Fh()]}:u?{commands:[{commandType:"flexStacker/store",key:M(),params:{moduleId:n,strategy:"automatic"}}],python:`${s}.store()`}:{errors:[Uh()]}};function Ol(){return{type:"ASPIRATE_MORE_THAN_WELL_CONTENTS",message:"Not enough liquid"}}function Rl(){return{type:"ASPIRATE_FROM_PRISTINE_WELL",message:"This step tries to aspirate from an empty well."}}function IE(){return{type:"LABWARE_IN_WASTE_CHUTE_HAS_LIQUID",message:"Disposing of a labware with liquid"}}function EE(){return{type:"TIPRACK_IN_WASTE_CHUTE_HAS_TIPS",message:"Disposing unused tips"}}function gE(){return{type:"TEMPERATURE_IS_POTENTIALLY_UNREACHABLE",message:"The module set temperature is potentially unreachable."}}function wE(){return{type:"WAITING_FOR_NONEXISTENT_TASK",message:"This step is waiting for a task that was never started."}}const SE="opentrons_flex_tiprack_lid",G_=(e,t,r)=>{const{labwareId:n,strategy:a,newLocation:o}=e,s=a==="usingGripper",{gripperEntities:i,trashBinEntities:l,wasteChuteEntities:u,labwareEntities:p,moduleEntities:d}=t,f=Object.keys(i).length>0,m=Object.values(u).length>0,h=r.tipState!=null?_y(r.tipState,n):!1,_=r.liquidState!=null?yy(r.liquidState,n):!1,b=Object.values(r.tipState.pipettes).some(({hasTip:N})=>N),T="moveToLabware",y=[],I=[],w=c.locationIsOnAddressableArea(o)&&o.addressableAreaName==="gripperWasteChute";!n||!r.labware[n]?y.push(mt({actionName:T,labware:n})):K(r.labware[n].stack)==="offDeck"&&s?y.push(Ln()):r.labware[n].stack.includes(et)&&y.push(ST());const E=p[n]?.def.metadata.displayCategory==="aluminumBlock";s&&E&&y.push(dT()),(w&&f&&!s||!f&&s)&&y.push(pT()),b&&s&&y.push(Jb());const A=r.labware[n]!=null?K(r.labware[n].stack):null;(m&&A==="gripperWasteChute"||c.MOVABLE_TRASH_ADDRESSABLE_AREAS.includes(A)||A==="fixedTrash")&&y.push(va());const L=A!=null&&r.labware[A]!=null?K(r.labware[A].stack):null,S=L??A,g=N=>N==null?null:N in r.modules?r.modules[N].moduleState:Object.values(r.modules).find(({slot:P})=>P===N)?.moduleState??null,k=Object.entries(r.labware).filter(([N,P])=>P.stack.includes("offDeck")).map(([N])=>N),v=Object.values(o);k.some(N=>v.includes(N))&&s&&y.push(rT());const D=g(S);D!=null&&(D.type===c.THERMOCYCLER_MODULE_TYPE&&D.lidOpen!==!0?y.push(Sn()):D.type===c.HEATERSHAKER_MODULE_TYPE?D.latchOpen!==!0?y.push(gp()):D.targetSpeed!==null&&y.push(An()):D.type===c.ABSORBANCE_READER_TYPE&&D.lidOpen!==!0?y.push(qr()):D.type===c.VACUUM_MODULE_TYPE&&D.currentPumpActivity.type!=="pumpDeactivated"&&y.push(Sp()));const q=c.locationIsOnModule(o)&&"moduleId"in o?o.moduleId:null,Q=c.locationIsOnLabware(o)?o.labwareId:null,fe=Q!=null?r.labware[Q].stack[1]:null,_e=fe??q;o==="offDeck"&&s&&y.push(Ln()),h&&w&&m?I.push(EE()):_&&w&&m&&I.push(IE());const ne=g(_e);ne!=null&&(ne.type===c.THERMOCYCLER_MODULE_TYPE&&ne.lidOpen!==!0?y.push(Sn()):ne.type===c.HEATERSHAKER_MODULE_TYPE?(ne.latchOpen!==!0&&y.push(gp()),ne.targetSpeed!==null&&y.push(An())):ne.type===c.ABSORBANCE_READER_TYPE?ne.lidOpen!==!0&&y.push(qr()):ne.type===c.VACUUM_MODULE_TYPE&&ne.currentPumpActivity.type!=="pumpDeactivated"&&y.push(Sp())),p[n]?.def.parameters.loadName===SE&&o!=null&&c.locationIsOnDeck(o)&&("slotName"in o||"addressableAreaName"in o&&c.FLEX_STAGING_AREA_SLOT_ADDRESSABLE_AREAS.includes(o.addressableAreaName))&&y.push(TT());const Oe={labwareId:n,strategy:a,newLocation:o},Be=[{commandType:"moveLabware",key:M(),params:Oe}],Me=p[n]?.pythonName;let ae="",Re=null;if(o==="offDeck")ae=vn;else if(o==="systemLocation")ae="system_location";else if(o==="wasteChuteLocation")ae=vn;else if("labwareId"in o){ae=p[o.labwareId].pythonName;const N=r.labware[o.labwareId].stack;Re=N[N.length-1]}else if("moduleId"in o)Re=r.modules[o.moduleId].slot,ae=d[o.moduleId].pythonName;else if("slotName"in o){const{slotName:N}=o;if(N in p){const P=K(r.labware[N].stack);ae=c.getIsLid(p[N].def)?C(P):p[N].pythonName;const F=r.labware[N].stack;Re=F[F.length-1]}else ae=C(N),Re=N}else if("addressableAreaName"in o){const N=De.includes(o.addressableAreaName),P=c.WASTE_CHUTE_ADDRESSABLE_AREAS.includes(o.addressableAreaName),$=o.addressableAreaName==="fixedTrash",ue=c.MOVABLE_TRASH_ADDRESSABLE_AREAS.includes(o.addressableAreaName)||$?Object.values(l)?.map(U=>U.location):[],V=!P&&!N&&!Ia(o.addressableAreaName)?ly(o.addressableAreaName,$?"fixedTrashSlot":"trashBinAdapter",$?c.OT2_ROBOT_TYPE:c.FLEX_ROBOT_TYPE):null,G=ue.find(U=>U===V),z=G!=null?Object.values(l).find(U=>U.location===G)?.id:null;if(N)ae=C(o.addressableAreaName);else if(z!=null&&!P)ae=l[z]?.pythonName??"";else if(z==null&&P)ae=Object.values(u)[0]?.pythonName??"";else if(Ia(o.addressableAreaName)){const[U]=Object.entries(r.modules).find(([,j])=>j.moduleState.type===c.VACUUM_MODULE_TYPE)??[];if(U!=null&&d[U]!=null){const{pythonName:j}=d[U];ae=`${j}.manifold_dock`}}else ae=""}if(Re!=null){const N=ba({slot:Re,labwareState:r.labware,modulesState:r.modules}),P=K(N),{isCompatible:$,isAboveStackLimit:F}=Ey(n,N,p,d);$||y.push(cT()),F&&y.push(ET({slot:P}))}if(y.length>0)return{errors:y};ae===""&&console.error("expected to find a python new location but could not");const We=s?", use_gripper=True":"",Fe=c.getIsLid(p[n].def),Ae=r.labware[n].stack;let J="";if(Fe){const N=by(Ae);if(N==null)console.error("expected to find a parent for labware to move but could not");else{const P=p[N]!=null,$=P&&c.getIsLid(p[N].def);Ae.length===2||P&&$?J=C(K(Ae)):(P||!c.getIsLid(p[N].def))&&(J=p[N].pythonName)}}Fe&&J===""&&console.error("expected to find a valid lid move location but could not");const Z=Fe?`${we}.move_lid(${J}, ${ae}${We})`:`${we}.move_labware(${Me}, ${ae}${We})`;return{commands:Be,...I.length>0?{warnings:I}:{},python:Z}},$e=(e,t,r)=>{const{pipetteId:n,fixtureId:a,offset:o}=e,{pipetteEntities:s,trashBinEntities:i,wasteChuteEntities:l}=t,u=s[n],p=u.spec.channels,d=u.pythonName,f=i[a]??l[a],m=f.pythonName;let h=uy(p);return i[a]!=null&&(h=Kc(f.location)),{commands:[{commandType:"moveToAddressableArea",key:M(),params:{pipetteId:n,addressableAreaName:h,offset:o}}],python:`${d}.move_to(${m})`}},Vc=(e,t,r)=>{const{pipetteId:n,addressableAreaName:a}=e;return{commands:[{commandType:"moveToAddressableAreaForDropTip",key:M(),params:{pipetteId:n,addressableAreaName:a,offset:{x:0,y:0,z:0},alternateDropLocation:!0}}]}},x=(e,t,r)=>{const{pipetteId:n,labwareId:a,wellName:o,wellLocation:s,minimumZHeight:i,forceDirect:l,speed:u}=e,p="moveToWell",d=[],f=r.labware,{pipetteEntities:m,labwareEntities:h}=t,_=m[n]?.spec,b=r.pipettes[n]?.nozzles??c.ALL,T=r.pipettes[n]?.primaryNozzle??bo({nozzles:b,channels:_?.channels}),y=(_?.displayCategory==="FLEX"||_?.channels===96)??!1,I=Hn(a,r.labware);if(_||d.push(ft({pipette:n})),!a||!r.labware[a]?d.push(mt({actionName:p,labware:a})):K(r.labware[a].stack)==="offDeck"&&d.push(Ln()),De.includes(I))d.push(xt({typeOfStep:"move to well"}));else if(f[I]!=null){const v=K(f[I].stack);De.includes(v)&&d.push(xt({typeOfStep:p}))}jn({pipette:n,labware:a,invariantContext:t,prevRobotState:r})&&d.push(Aa()),Ga(r.modules,r.labware,a)&&d.push(Sn()),Ka(r.modules,r.labware,a)&&d.push(To()),Ha(r.modules,r.labware,a)&&d.push(qr()),Za(r.modules,r.labware,a)&&d.push(An()),Yn(r.modules,I,y?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&d.push(Oa()),y||(Gn(r.modules,I)&&d.push(La()),Wn(r.modules,I,_)&&d.push(Ra()),Ya(r.modules,I,_,h[a])&&d.push(Io()));const w=t.pipetteEntities[n]?.spec.channels!==1,E=t.pipetteEntities[n]?.spec,A=ht({robotState:r,invariantContext:t,pipetteId:n,labwareId:a,wellLocationOffset:s?.offset??{x:0,y:0,z:0},wellTargetName:o,nozzleConfiguration:b,primaryNozzle:T});if(w&&E&&!A.isSafe&&d.push(Bt({unsafePipetteMovementReason:A.reason})),d.length>0)return{errors:d};const L=m[n].pythonName,S=h[a].pythonName,g=[{commandType:"moveToWell",key:M(),params:{pipetteId:n,labwareId:a,wellName:o,wellLocation:s,...l!=null?{forceDirect:l}:{},...i!=null?{minimumZHeight:i}:{},...u!=null?{speed:u}:null}}],k=[`${S}[${C(o)}]${Ht(s)}`,...l?["force_direct=True"]:[],...i?[`minimum_z_height=${i}`]:[],...u?[`speed=${u}`]:[]];return{commands:g,python:`${L}.move_to(${k.join(", ")})`}},po=(e,t,r)=>{const{tipTrackingOption:n=Tc,nozzles:a,primaryNozzle:o}=e,{runtimeParameters:s}=t,i=B(e.pipetteId,s),l=B(e.labwareId,s),u=B(e.wellName,s),p=[e.pipetteId,e.labwareId,e.wellName],d=[i,l,u],f=p.flatMap((L,S)=>typeof L=="string"&&d[S]==null?[H({parameterName:L})]:[]);if(f.length>0||i==null||l==null||u==null)return{errors:f};const m=[],h=t.pipetteEntities[i].spec.channels,_=ht({robotState:r,invariantContext:t,pipetteId:i,labwareId:l,wellLocationOffset:{x:0,y:0},wellTargetName:u,nozzleConfiguration:a,primaryNozzle:o}),b=bp({tipState:r.tipState.tipracks[l],primaryNozzle:o,channels:h,nozzleConfiguration:a,wellName:u,tiprackDef:t.labwareEntities[l].def});_.isSafe||m.push(Bt({unsafePipetteMovementReason:_.reason})),b.isSafe||m.push(gT()),b.isComplete!==!0&&m.push(wT());const T=K(r.labware[l].stack);if(De.includes(T))m.push(xt({typeOfStep:"pick up tip"}));else if(r.labware[T]!=null){const L=K(r.labware[T].stack);De.includes(L)&&m.push(xt({typeOfStep:"pick up tip"}))}const y=t.pipetteEntities[i].pythonName,I=t.labwareEntities[l].pythonName,w=s[e.wellName]!=null?e.wellName:C(u),E=n===Lt?`[${w}]`:"",A=`${y}.pick_up_tip(location=${I}${E})`;return m.length>0?{errors:m}:{commands:[{commandType:"pickUpTip",key:M(),params:{pipetteId:i,labwareId:l,wellName:u}}],python:A}},W_=(e,t,r)=>{const{moduleId:n,taskId:a,profileElements:o,blockMaxVolumeUl:s}=e,i=t.moduleEntities[n].pythonName,l=Eb(e.profileElements),u=l.repeatingProfileSteps.map(h=>`{${C("temperature")}: ${h.celsius}, ${C("hold_time_seconds")}: ${h.holdSeconds}},`).join(`
20
- `),d=`${`[
21
- ${Y(u)}
16
+ `;if(l!=null&&l.storedLabwareDetails===null&&l.labwareInHopper==null)return{errors:[cT()]};if(u){if(o.length>0&&!o.every(b=>np(b,t,l)))return{errors:[qh()]}}else return{errors:[Vh()]};const y=[...o.filter(T=>!c.getIsLid(s[T].def)).length>0?`labware=[${h}],
17
+ `:[],...a!=null?[`message=${F(a)},
18
+ `]:[]].join("");return{commands:[{commandType:"flexStacker/fillItems",key:$(),params:{moduleId:n,labware:o,message:a??void 0}}],python:`${p}.fill_items(
19
+ ${Q(y)})`}},j_=(e,t,r)=>{const{moduleId:n}=e,{moduleEntities:a}=t;if(n==null||a[n]==null)return{errors:[pe()]};const o=a[n].pythonName,s=yt(r,n),i=s?.labwareInHopper!=null&&s.labwareInHopper.length>0;return s!==null&&rp(s)?{errors:[lT()]}:i?{commands:[{commandType:"flexStacker/retrieve",key:$(),params:{moduleId:n}}],python:`${o}.retrieve()`}:{errors:[iT()]}},W_=(e,t,r)=>{const{moduleId:n}=e,{labwareEntities:a,moduleEntities:o}=t;if(n==null||o[n]==null)return{errors:[pe()]};const s=o[n].pythonName,i=yt(r,n),l=i?.labwareOnShuttle?.primaryLabwareId??null,u=ap(i,a);return i!==null&&!rp(i)?{errors:[uT()]}:l!==null&&!np(l,t,i)?{errors:[qh()]}:u?{commands:[{commandType:"flexStacker/store",key:$(),params:{moduleId:n,strategy:"automatic"}}],python:`${s}.store()`}:{errors:[Vh()]}};function Ol(){return{type:"ASPIRATE_MORE_THAN_WELL_CONTENTS",message:"Not enough liquid"}}function vl(){return{type:"ASPIRATE_FROM_PRISTINE_WELL",message:"This step tries to aspirate from an empty well."}}function Sw(){return{type:"LABWARE_IN_WASTE_CHUTE_HAS_LIQUID",message:"Disposing of a labware with liquid"}}function gw(){return{type:"TIPRACK_IN_WASTE_CHUTE_HAS_TIPS",message:"Disposing unused tips"}}function Ew(){return{type:"TEMPERATURE_IS_POTENTIALLY_UNREACHABLE",message:"The module set temperature is potentially unreachable."}}function Aw(){return{type:"WAITING_FOR_NONEXISTENT_TASK",message:"This step is waiting for a task that was never started."}}const Lw="opentrons_flex_tiprack_lid",G_=(e,t,r)=>{const{gripperEntities:n,trashBinEntities:a,wasteChuteEntities:o,labwareEntities:s,moduleEntities:i,runtimeParameters:l}=t,u=v(e.labwareId,l),p=v(e.strategy,l),d=[];let f=null;if(u==null&&d.push(C({parameterName:e.labwareId})),p==null&&d.push(C({parameterName:e.strategy})),typeof e.newLocation=="string"){const N=v(e.newLocation,l);N==null?d.push(C({parameterName:e.newLocation})):f=N}else if("labwareId"in e.newLocation){const N=v(e.newLocation.labwareId,l);N==null?d.push(C({parameterName:e.newLocation.labwareId})):f={labwareId:N}}else if("moduleId"in e.newLocation){const N=v(e.newLocation.moduleId,l);N==null?d.push(C({parameterName:e.newLocation.moduleId})):f={moduleId:N}}else if("slotName"in e.newLocation){const N=v(e.newLocation.slotName,l);N==null?d.push(C({parameterName:e.newLocation.slotName})):f={slotName:N}}else{const N=v(e.newLocation.addressableAreaName,l);N==null?d.push(C({parameterName:e.newLocation.addressableAreaName})):f={addressableAreaName:N}}if(d.length>0||u==null||p==null||f==null)return{errors:d};const m=p==="usingGripper",h=Object.keys(n).length>0,_=Object.values(o).length>0,y=r.tipState!=null?by(r.tipState,u):!1,T=r.liquidState!=null?Ty(r.liquidState,u):!1,b=Object.values(r.tipState.pipettes).some(({hasTip:N})=>N),w="moveToLabware",S=[],g=c.locationIsOnAddressableArea(f)&&f.addressableAreaName==="gripperWasteChute";!u||!r.labware[u]?d.push(ht({actionName:w,labware:u})):ee(r.labware[u].stack)==="offDeck"&&m?d.push(Pn()):r.labware[u].stack.includes(et)&&d.push(LT());const L=s[u]?.def.metadata.displayCategory==="aluminumBlock";m&&L&&d.push(mT()),(g&&h&&!m||!h&&m)&&d.push(fT()),b&&m&&d.push(tT());const I=r.labware[u]!=null?ee(r.labware[u].stack):null;(_&&I==="gripperWasteChute"||c.MOVABLE_TRASH_ADDRESSABLE_AREAS.includes(I)||I==="fixedTrash")&&d.push(ka());const A=I!=null&&r.labware[I]!=null?ee(r.labware[I].stack):null,E=A??I,O=N=>N==null?null:N in r.modules?r.modules[N].moduleState:Object.values(r.modules).find(({slot:B})=>B===N)?.moduleState??null,k=Object.entries(r.labware).filter(([N,B])=>B.stack.includes("offDeck")).map(([N])=>N),D=Object.values(f);k.some(N=>D.includes(N))&&m&&d.push(aT());const M=O(E);M!=null&&(M.type===c.THERMOCYCLER_MODULE_TYPE&&M.lidOpen!==!0?d.push(On()):M.type===c.HEATERSHAKER_MODULE_TYPE?M.latchOpen!==!0?d.push(Ep()):M.targetSpeed!==null&&d.push(vn()):M.type===c.ABSORBANCE_READER_TYPE&&M.lidOpen!==!0?d.push(qr()):M.type===c.VACUUM_MODULE_TYPE&&M.currentPumpActivity.type!=="pumpDeactivated"&&d.push(Lp()));const G=c.locationIsOnModule(f)&&"moduleId"in f?f.moduleId:null,Y=c.locationIsOnLabware(f)?f.labwareId:null,ae=Y!=null?r.labware[Y].stack[1]:null,fe=ae??G;f==="offDeck"&&m&&d.push(Pn()),y&&g&&_?S.push(gw()):T&&g&&_&&S.push(Sw());const J=O(fe);J!=null&&(J.type===c.THERMOCYCLER_MODULE_TYPE&&J.lidOpen!==!0?d.push(On()):J.type===c.HEATERSHAKER_MODULE_TYPE?(J.latchOpen!==!0&&d.push(Ep()),J.targetSpeed!==null&&d.push(vn())):J.type===c.ABSORBANCE_READER_TYPE?J.lidOpen!==!0&&d.push(qr()):J.type===c.VACUUM_MODULE_TYPE&&J.currentPumpActivity.type!=="pumpDeactivated"&&d.push(Lp())),s[u]?.def.parameters.loadName===Lw&&f!=null&&c.locationIsOnDeck(f)&&("slotName"in f||"addressableAreaName"in f&&c.FLEX_STAGING_AREA_SLOT_ADDRESSABLE_AREAS.includes(f.addressableAreaName))&&d.push(wT());const Ve={labwareId:u,strategy:p,newLocation:f},Me=[{commandType:"moveLabware",key:$(),params:Ve}],je=s[u]?.pythonName;let ie="",ke=null;if(f==="offDeck")ie=Nn;else if(f==="systemLocation")ie="system_location";else if(f==="wasteChuteLocation")ie=Nn;else if("labwareId"in f){ie=s[f.labwareId].pythonName;const N=r.labware[f.labwareId].stack;ke=N[N.length-1]}else if("moduleId"in f)ke=r.modules[f.moduleId].slot,ie=i[f.moduleId].pythonName;else if("slotName"in f){const{slotName:N}=f;if(N in s){const B=ee(r.labware[N].stack);ie=c.getIsLid(s[N].def)?F(B):s[N].pythonName;const re=r.labware[N].stack;ke=re[re.length-1]}else{const B=typeof e.newLocation=="object"&&"slotName"in e.newLocation?e.newLocation.slotName:N;ie=l[B]!=null?B:F(N),ke=N}}else if("addressableAreaName"in f){const N=De.includes(f.addressableAreaName),B=c.WASTE_CHUTE_ADDRESSABLE_AREAS.includes(f.addressableAreaName),q=f.addressableAreaName==="fixedTrash",V=c.MOVABLE_TRASH_ADDRESSABLE_AREAS.includes(f.addressableAreaName)||q?Object.values(a)?.map(H=>H.location):[],Z=!B&&!N&&!Sa(f.addressableAreaName)?cy(f.addressableAreaName,q?"fixedTrashSlot":"trashBinAdapter",q?c.OT2_ROBOT_TYPE:c.FLEX_ROBOT_TYPE):null,W=V.find(H=>H===Z),x=W!=null?Object.values(a).find(H=>H.location===W)?.id:null;if(N){const H=typeof e.newLocation=="object"&&"addressableAreaName"in e.newLocation?e.newLocation.addressableAreaName:f.addressableAreaName;ie=l[H]!=null?H:F(f.addressableAreaName)}else if(x!=null&&!B)ie=a[x]?.pythonName??"";else if(x==null&&B)ie=Object.values(o)[0]?.pythonName??"";else if(Sa(f.addressableAreaName)){const[H]=Object.entries(r.modules).find(([,le])=>le.moduleState.type===c.VACUUM_MODULE_TYPE)??[];if(H!=null&&i[H]!=null){const{pythonName:le}=i[H];ie=`${le}.manifold_dock`}}else ie=""}if(ke!=null){const N=Ia({slot:ke,labwareState:r.labware,modulesState:r.modules}),B=ee(N),{isCompatible:q,isAboveStackLimit:re}=gy(u,N,s,i);q||d.push(dT()),re&&d.push(gT({slot:B}))}if(d.length>0)return{errors:d};ie===""&&console.error("expected to find a python new location but could not");const Be=m?", use_gripper=True":"",Ae=c.getIsLid(s[u].def),oe=r.labware[u].stack;let K="";if(Ae){const N=Iy(oe);if(N==null)console.error("expected to find a parent for labware to move but could not");else{const B=s[N]!=null,q=B&&c.getIsLid(s[N].def);oe.length===2||B&&q?K=F(ee(oe)):(B||!c.getIsLid(s[N].def))&&(K=s[N].pythonName)}}Ae&&K===""&&console.error("expected to find a valid lid move location but could not");const j=Ae?`${ge}.move_lid(${K}, ${ie}${Be})`:`${ge}.move_labware(${je}, ${ie}${Be})`;return{commands:Me,...S.length>0?{warnings:S}:{},python:j}},qe=(e,t,r)=>{const{pipetteId:n,fixtureId:a,offset:o}=e,{pipetteEntities:s,trashBinEntities:i,wasteChuteEntities:l}=t,u=s[n],p=u.spec.channels,d=u.pythonName,f=i[a]??l[a],m=f.pythonName;let h=py(p);return i[a]!=null&&(h=Xc(f.location)),{commands:[{commandType:"moveToAddressableArea",key:$(),params:{pipetteId:n,addressableAreaName:h,offset:o}}],python:`${d}.move_to(${m})`}},xc=(e,t,r)=>{const{runtimeParameters:n}=t,a=e.offset??{x:0,y:0,z:0},o=v(e.pipetteId,n),s=v(e.addressableAreaName,n),i=U(a.x,n),l=U(a.y,n),u=U(a.z,n),p=lt(e.alternateDropLocation??!0,n),d=e.speed==null?void 0:U(e.speed,n),f=e.minimumZHeight==null?void 0:U(e.minimumZHeight,n),m=e.forceDirect==null?void 0:lt(e.forceDirect,n),h=e.ignoreTipConfiguration==null?void 0:lt(e.ignoreTipConfiguration,n),_=[e.pipetteId,e.addressableAreaName,e.offset?.x,e.offset?.y,e.offset?.z,e.alternateDropLocation,e.speed,e.minimumZHeight,e.forceDirect,e.ignoreTipConfiguration],y=[o,s,i,l,u,p,d,f,m,h],T=_.flatMap((b,w)=>typeof b=="string"&&y[w]==null?[C({parameterName:b})]:[]);return T.length>0||o==null||s==null||i==null||l==null||u==null||p==null?{errors:T}:{commands:[{commandType:"moveToAddressableAreaForDropTip",key:$(),params:{pipetteId:o,addressableAreaName:s,offset:{x:i,y:l,z:u},alternateDropLocation:p,...d!=null?{speed:d}:{},...f!=null?{minimumZHeight:f}:{},...m!=null?{forceDirect:m}:{},...h!=null?{ignoreTipConfiguration:h}:{}}}]}},z=(e,t,r)=>{const{pipetteEntities:n,labwareEntities:a,runtimeParameters:o}=t,s=v(e.pipetteId,o),i=v(e.labwareId,o),l=v(e.wellName,o),u=e.wellLocation?.origin==null?void 0:v(e.wellLocation.origin,o),p=e.wellLocation?.offset?.x==null?void 0:U(e.wellLocation.offset.x,o),d=e.wellLocation?.offset?.y==null?void 0:U(e.wellLocation.offset.y,o),f=e.wellLocation?.offset?.z==null?void 0:U(e.wellLocation.offset.z,o),m=e.minimumZHeight==null?void 0:U(e.minimumZHeight,o),h=e.forceDirect==null?void 0:lt(e.forceDirect,o),_=e.speed==null?void 0:U(e.speed,o),y=[];if(s==null&&y.push(C({parameterName:e.pipetteId})),i==null&&y.push(C({parameterName:e.labwareId})),l==null&&y.push(C({parameterName:e.wellName})),e.wellLocation?.origin!=null&&u==null&&y.push(C({parameterName:e.wellLocation.origin})),typeof e.wellLocation?.offset?.x=="string"&&p==null&&y.push(C({parameterName:e.wellLocation.offset.x})),typeof e.wellLocation?.offset?.y=="string"&&d==null&&y.push(C({parameterName:e.wellLocation.offset.y})),typeof e.wellLocation?.offset?.z=="string"&&f==null&&y.push(C({parameterName:e.wellLocation.offset.z})),typeof e.minimumZHeight=="string"&&m==null&&y.push(C({parameterName:e.minimumZHeight})),typeof e.forceDirect=="string"&&h==null&&y.push(C({parameterName:e.forceDirect})),typeof e.speed=="string"&&_==null&&y.push(C({parameterName:e.speed})),y.length>0||s==null||i==null||l==null)return{errors:y};const T=e.wellLocation==null?void 0:{...u!=null?{origin:u}:{},...e.wellLocation.offset!=null?{offset:{...typeof p=="number"?{x:p}:{},...typeof d=="number"?{y:d}:{},...typeof f=="number"?{z:f}:{}}}:{}},b="moveToWell",w=r.labware,S=n[s]?.spec,g=r.pipettes[s]?.nozzles??c.ALL,L=r.pipettes[s]?.primaryNozzle??To({nozzles:g,channels:S?.channels}),I=(S?.displayCategory==="FLEX"||S?.channels===96)??!1,A=jn(i,r.labware);if(S||y.push(mt({pipette:s})),!i||!r.labware[i]?y.push(ht({actionName:b,labware:i})):ee(r.labware[i].stack)==="offDeck"&&y.push(Pn()),De.includes(A))y.push(Ht({typeOfStep:"move to well"}));else if(w[A]!=null){const J=ee(w[A].stack);De.includes(J)&&y.push(Ht({typeOfStep:b}))}Gn({pipette:s,labware:i,invariantContext:t,prevRobotState:r})&&y.push(Oa()),Ya(r.modules,r.labware,i)&&y.push(On()),Xa(r.modules,r.labware,i)&&y.push(Io()),ja(r.modules,r.labware,i)&&y.push(qr()),Qa(r.modules,r.labware,i)&&y.push(vn()),Zn(r.modules,A,I?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&y.push(Pa()),I||(Yn(r.modules,A)&&y.push(va()),Kn(r.modules,A,S)&&y.push(Ra()),Za(r.modules,A,S,a[i])&&y.push(wo()));const E=t.pipetteEntities[s]?.spec.channels!==1,O=t.pipetteEntities[s]?.spec,k=_t({robotState:r,invariantContext:t,pipetteId:s,labwareId:i,wellLocationOffset:T?.offset??{x:0,y:0,z:0},wellTargetName:l,nozzleConfiguration:g,primaryNozzle:L});if(E&&O&&!k.isSafe&&y.push(xt({unsafePipetteMovementReason:k.reason})),y.length>0)return{errors:y};const D=n[s].pythonName,M=a[i].pythonName,G=o[e.wellName]!=null?e.wellName:F(l),Y=zt({...u!=null?{origin:u}:{},...e.wellLocation?.offset!=null?{offset:e.wellLocation.offset}:{}}),ae=[{commandType:"moveToWell",key:$(),params:{pipetteId:s,labwareId:i,wellName:l,wellLocation:T,...h!=null?{forceDirect:h}:{},...m!=null?{minimumZHeight:m}:{},..._!=null?{speed:_}:{}}}],fe=[`${M}[${G}]${Y}`];return typeof e.forceDirect=="string"?fe.push(`force_direct=${e.forceDirect}`):e.forceDirect&&fe.push("force_direct=True"),e.minimumZHeight&&fe.push(`minimum_z_height=${e.minimumZHeight}`),e.speed&&fe.push(`speed=${e.speed}`),{commands:ae,python:`${D}.move_to(${fe.join(", ")})`}},mo=(e,t,r)=>{const{tipTrackingOption:n=Ic,nozzles:a,primaryNozzle:o}=e,{runtimeParameters:s}=t,i=v(e.pipetteId,s),l=v(e.labwareId,s),u=v(e.wellName,s),p=[e.pipetteId,e.labwareId,e.wellName],d=[i,l,u],f=p.flatMap((I,A)=>typeof I=="string"&&d[A]==null?[C({parameterName:I})]:[]);if(f.length>0||i==null||l==null||u==null)return{errors:f};const m=[],h=t.pipetteEntities[i].spec.channels,_=_t({robotState:r,invariantContext:t,pipetteId:i,labwareId:l,wellLocationOffset:{x:0,y:0},wellTargetName:u,nozzleConfiguration:a,primaryNozzle:o}),y=Ip({tipState:r.tipState.tipracks[l],primaryNozzle:o,channels:h,nozzleConfiguration:a,wellName:u,tiprackDef:t.labwareEntities[l].def});_.isSafe||m.push(xt({unsafePipetteMovementReason:_.reason})),y.isSafe||m.push(ET()),y.isComplete!==!0&&m.push(AT());const T=ee(r.labware[l].stack);if(De.includes(T))m.push(Ht({typeOfStep:"pick up tip"}));else if(r.labware[T]!=null){const I=ee(r.labware[T].stack);De.includes(I)&&m.push(Ht({typeOfStep:"pick up tip"}))}const b=t.pipetteEntities[i].pythonName,w=t.labwareEntities[l].pythonName,S=s[e.wellName]!=null?e.wellName:F(u),g=n===Ot?`[${S}]`:"",L=`${b}.pick_up_tip(location=${w}${g})`;return m.length>0?{errors:m}:{commands:[{commandType:"pickUpTip",key:$(),params:{pipetteId:i,labwareId:l,wellName:u}}],python:L}},Y_=(e,t,r)=>{const{taskId:n,profileElements:a,blockMaxVolumeUl:o}=e,{runtimeParameters:s}=t,i=v(e.moduleId,s),l=[];i==null&&l.push(C({parameterName:e.moduleId}));const u=g=>{const L=U(g,s);return typeof g=="string"&&L==null&&l.push(C({parameterName:g})),L},p=g=>({celsius:u(g.celsius),holdSeconds:u(g.holdSeconds)}),d=a.map(g=>"steps"in g?{steps:g.steps.map(p),repetitions:u(g.repetitions)}:p(g)),f=o==null?void 0:u(o);if(i==null||l.length>0)return{errors:l};const m=t.moduleEntities[i].pythonName,h=a.map(g=>"steps"in g&&a.length>1?{...g,repetitions:U(g.repetitions,s)}:g),_=gb(h),y=_.repeatingProfileSteps.map(g=>`{${F("temperature")}: ${g.celsius}, ${F("hold_time_seconds")}: ${g.holdSeconds}},`).join(`
20
+ `),b=`${`[
21
+ ${Q(y)}
22
22
  ],`}
23
- ${l.numRepetitions},
24
- `+(e.blockMaxVolumeUl!==void 0?`block_max_volume=${e.blockMaxVolumeUl},`:""),m=(a!=null?`${a} = `:"")+`${i}.start_execute_profile(
25
- ${Y(d)}
26
- )`;return{commands:[{commandType:"thermocycler/startRunExtendedProfile",key:M(),params:{moduleId:n,taskId:a,profileElements:o,blockMaxVolumeUl:s}}],python:m}},Rt=(e,t,r)=>{const{runtimeParameters:n}=t,a=B(e.pipetteId,n);if(a==null)return{errors:[H({parameterName:e.pipetteId})]};const o=t.pipetteEntities[a].pythonName;return{commands:[{commandType:"prepareToAspirate",key:M(),params:{pipetteId:a}}],python:`${o}.prepare_to_aspirate()`}},$c=(e,t,r)=>{const{runtimeParameters:n}=t,a=B(e.moduleId,n),o=ie(e.celsius,n),s=[];if(e.moduleId!=null&&a==null&&s.push(H({parameterName:e.moduleId})),typeof e.celsius=="string"&&o==null&&s.push(H({parameterName:e.celsius})),s.length>0||o==null)return{errors:s};if(a===null)return{errors:[re()]};const i=t.moduleEntities[a],l=i?.type;return l===c.TEMPERATURE_MODULE_TYPE?{commands:[{commandType:"temperatureModule/setTargetTemperature",key:M(),params:{moduleId:a,celsius:o}}],python:`${i?.pythonName}.start_set_temperature(${e.celsius})`}:l===c.THERMOCYCLER_MODULE_TYPE?(console.error("Thermocycler set temp not implemented!"),{commands:[]}):l===c.HEATERSHAKER_MODULE_TYPE?{commands:[{commandType:"heaterShaker/setTargetTemperature",key:M(),params:{moduleId:a,celsius:o}}],python:`${i?.pythonName}.set_target_temperature(${e.celsius})`}:(console.error(`setTemperature expected module ${a} to be ${c.TEMPERATURE_MODULE_TYPE}, ${c.THERMOCYCLER_MODULE_TYPE} or ${c.HEATERSHAKER_MODULE_TYPE}, got ${l}`),{errors:[re()]})},St=(e,t,r)=>{const n="touchTip",{runtimeParameters:a}=t,o=B(e.pipetteId,a),s=B(e.labwareId,a),i=B(e.wellName,a),l=ie(e.zOffsetFromTop,a),u=e.speed==null?void 0:ie(e.speed,a),p=e.mmFromEdge==null?void 0:ie(e.mmFromEdge,a),d=[e.pipetteId,e.labwareId,e.wellName,e.zOffsetFromTop,e.speed,e.mmFromEdge],f=[o,s,i,l,u,p],m=d.flatMap((E,A)=>typeof E=="string"&&f[A]==null?[H({parameterName:E})]:[]);if(m.length>0||o==null||s==null||i==null||l==null)return{errors:m};if(r.pipettes[o]||m.push(ft({pipette:o})),r.tipState.pipettes[o]?.hasTip||m.push(zt({actionName:n,pipette:o,labware:s,well:i})),m.length>0)return{errors:m};const _=t.pipetteEntities[o].pythonName,b=t.labwareEntities[s].pythonName,T=a[e.wellName]!=null?e.wellName:C(i),y=[`${b}[${T}]`,`v_offset=${e.zOffsetFromTop}`,...e.speed!=null?[`speed=${e.speed}`]:[],...e.mmFromEdge!=null?[`mm_from_edge=${e.mmFromEdge}`]:[]],I=`${_}.touch_tip(${y.join(", ")})`;return e.speed!=null&&u==null&&console.error(`touchTip: expected speed to resolve but got undefined (raw: ${String(e.speed)})`),e.mmFromEdge!=null&&p==null&&console.error(`touchTip: expected mmFromEdge to resolve but got undefined (raw: ${String(e.mmFromEdge)})`),{commands:[{commandType:"touchTip",key:M(),params:{pipetteId:o,labwareId:s,wellName:i,wellLocation:{origin:c.WELL_ORIGIN_TOP,offset:{z:l}},speed:u??void 0,mmFromEdge:p??void 0}}],python:I}},$a=(e,t,r)=>{const n=B(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[H({parameterName:e.moduleId})]};const a=t.moduleEntities[n],o=ut(r,n);if(a==null||o==null)return{errors:[re()]};if(zn(o))return{errors:[ka()]};const i=`${a.pythonName}.close_vent()`;return{commands:[{commandType:"vacuumModule/closeVent",key:M(),params:{moduleId:n}}],python:i}},Y_=(e,t,r)=>{const n=B(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[H({parameterName:e.moduleId})]};const a=t.moduleEntities[n],o=ut(r,n);if(a==null||o==null)return{errors:[re()]};if(zn(o))return{errors:[ka()]};const i=`${a.pythonName}.open_vent()`;return{commands:[{commandType:"vacuumModule/openVent",key:M(),params:{moduleId:n}}],python:i}},we="protocol",vn="protocol_api.OFF_DECK",Co="CUSTOM_LABWARE",Ba=" ";function Y(e){return e.split(`
27
- `).map(t=>t&&Ba+t).join(`
28
- `)}function or(e){switch(typeof e){case"undefined":return"None";case"boolean":return e?"True":"False";case"number":return Number.isFinite(e)?`${e}`:`float("${e}")`;case"string":return C(e);case"object":return e===null?"None":Array.isArray(e)?xc(e):Vr(e);default:throw Error("Cannot render value as Python",{cause:e})}}function kn(e){return typeof e=="string"?e:or(e)}function C(e){return JSON.stringify(e)}function Bc(e){return`(${e.map(t=>or(t)).join(", ")})`}function xc(e){return e.every(t=>Array.isArray(t)&&t.length===2&&t.every(r=>typeof r=="number"))?`[${e.map(t=>Bc(t)).join(", ")}]`:`[${e.map(t=>or(t)).join(", ")}]`}function AE(e){return["undefined","boolean","number","string"].includes(typeof e)||e===null}function Vr(e){const t=Object.entries(e),r=t.every(([n,a])=>AE(a));if(t.length<=1||r){const n=`{${t.map(([a,o])=>`${C(a)}: ${or(o)}`).join(", ")}}`;if(t.length<=1||n.length<64)return n}return`{
29
- ${Y(t.map(([n,a])=>`${C(n)}: ${or(a)}`).join(`,
23
+ ${_.numRepetitions},
24
+ `+(e.blockMaxVolumeUl!==void 0?`block_max_volume=${e.blockMaxVolumeUl},`:""),S=(n!=null?`${n} = `:"")+`${m}.start_execute_profile(
25
+ ${Q(b)}
26
+ )`;return{commands:[{commandType:"thermocycler/startRunExtendedProfile",key:$(),params:{moduleId:i,taskId:n,profileElements:d,blockMaxVolumeUl:f??void 0}}],python:S}},Pt=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.pipetteId,n);if(a==null)return{errors:[C({parameterName:e.pipetteId})]};const o=t.pipetteEntities[a].pythonName;return{commands:[{commandType:"prepareToAspirate",key:$(),params:{pipetteId:a}}],python:`${o}.prepare_to_aspirate()`}},Hc=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.moduleId,n),o=U(e.celsius,n),s=[];if(e.moduleId!=null&&a==null&&s.push(C({parameterName:e.moduleId})),typeof e.celsius=="string"&&o==null&&s.push(C({parameterName:e.celsius})),s.length>0||o==null)return{errors:s};if(a===null)return{errors:[pe()]};const i=t.moduleEntities[a],l=i?.type;return l===c.TEMPERATURE_MODULE_TYPE?{commands:[{commandType:"temperatureModule/setTargetTemperature",key:$(),params:{moduleId:a,celsius:o}}],python:`${i?.pythonName}.start_set_temperature(${e.celsius})`}:l===c.THERMOCYCLER_MODULE_TYPE?(console.error("Thermocycler set temp not implemented!"),{commands:[]}):l===c.HEATERSHAKER_MODULE_TYPE?{commands:[{commandType:"heaterShaker/setTargetTemperature",key:$(),params:{moduleId:a,celsius:o}}],python:`${i?.pythonName}.set_target_temperature(${e.celsius})`}:(console.error(`setTemperature expected module ${a} to be ${c.TEMPERATURE_MODULE_TYPE}, ${c.THERMOCYCLER_MODULE_TYPE} or ${c.HEATERSHAKER_MODULE_TYPE}, got ${l}`),{errors:[pe()]})},At=(e,t,r)=>{const n="touchTip",{runtimeParameters:a}=t,o=v(e.pipetteId,a),s=v(e.labwareId,a),i=v(e.wellName,a),l=U(e.zOffsetFromTop,a),u=e.speed==null?void 0:U(e.speed,a),p=e.mmFromEdge==null?void 0:U(e.mmFromEdge,a),d=[e.pipetteId,e.labwareId,e.wellName,e.zOffsetFromTop,e.speed,e.mmFromEdge],f=[o,s,i,l,u,p],m=d.flatMap((g,L)=>typeof g=="string"&&f[L]==null?[C({parameterName:g})]:[]);if(m.length>0||o==null||s==null||i==null||l==null)return{errors:m};if(r.pipettes[o]||m.push(mt({pipette:o})),r.tipState.pipettes[o]?.hasTip||m.push(jt({actionName:n,pipette:o,labware:s,well:i})),m.length>0)return{errors:m};const _=t.pipetteEntities[o].pythonName,y=t.labwareEntities[s].pythonName,T=a[e.wellName]!=null?e.wellName:F(i),b=[`${y}[${T}]`,`v_offset=${e.zOffsetFromTop}`,...e.speed!=null?[`speed=${e.speed}`]:[],...e.mmFromEdge!=null?[`mm_from_edge=${e.mmFromEdge}`]:[]],w=`${_}.touch_tip(${b.join(", ")})`;return e.speed!=null&&u==null&&console.error(`touchTip: expected speed to resolve but got undefined (raw: ${String(e.speed)})`),e.mmFromEdge!=null&&p==null&&console.error(`touchTip: expected mmFromEdge to resolve but got undefined (raw: ${String(e.mmFromEdge)})`),{commands:[{commandType:"touchTip",key:$(),params:{pipetteId:o,labwareId:s,wellName:i,wellLocation:{origin:c.WELL_ORIGIN_TOP,offset:{z:l}},speed:u??void 0,mmFromEdge:p??void 0}}],python:w}},xa=(e,t,r)=>{const n=v(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[C({parameterName:e.moduleId})]};const a=t.moduleEntities[n],o=ct(r,n);if(a==null||o==null)return{errors:[pe()]};if(Wn(o))return{errors:[Na()]};const i=`${a.pythonName}.close_vent()`;return{commands:[{commandType:"vacuumModule/closeVent",key:$(),params:{moduleId:n}}],python:i}},K_=(e,t,r)=>{const n=v(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[C({parameterName:e.moduleId})]};const a=t.moduleEntities[n],o=ct(r,n);if(a==null||o==null)return{errors:[pe()]};if(Wn(o))return{errors:[Na()]};const i=`${a.pythonName}.open_vent()`;return{commands:[{commandType:"vacuumModule/openVent",key:$(),params:{moduleId:n}}],python:i}},ge="protocol",Nn="protocol_api.OFF_DECK",Do="CUSTOM_LABWARE",Ha=" ";function Q(e){return e.split(`
27
+ `).map(t=>t&&Ha+t).join(`
28
+ `)}function sr(e){switch(typeof e){case"undefined":return"None";case"boolean":return e?"True":"False";case"number":return Number.isFinite(e)?`${e}`:`float("${e}")`;case"string":return F(e);case"object":return e===null?"None":Array.isArray(e)?zc(e):Br(e);default:throw Error("Cannot render value as Python",{cause:e})}}function Vr(e){return typeof e=="string"?e:sr(e)}function F(e){return JSON.stringify(e)}function Z_(e){return`(${e.map(t=>sr(t)).join(", ")})`}function zc(e){return e.every(t=>Array.isArray(t)&&t.length===2&&t.every(r=>typeof r=="number"))?`[${e.map(t=>Z_(t)).join(", ")}]`:`[${e.map(t=>sr(t)).join(", ")}]`}function Ow(e){return["undefined","boolean","number","string"].includes(typeof e)||e===null}function Br(e){const t=Object.entries(e),r=t.every(([n,a])=>Ow(a));if(t.length<=1||r){const n=`{${t.map(([a,o])=>`${F(a)}: ${sr(o)}`).join(", ")}}`;if(t.length<=1||n.length<64)return n}return`{
29
+ ${Q(t.map(([n,a])=>`${F(n)}: ${sr(a)}`).join(`,
30
30
  `))},
31
- }`}function Ht(e){const{x:t,y:r,z:n}=e?.offset||{};let a=!!n,o=e?.origin;!o&&(t||r||n)&&(o="top");let s="";if(o&&(s+=(()=>{switch(o){case"top":return a=!1,`.top(${n?`z=${n}`:""})`;case"bottom":return a=!1,`.bottom(${n?`z=${n}`:""})`;case"center":return".center()";case"meniscus":return a=!1,`.meniscus(${n?`z=${n}`:""})`;default:return""}})()),t||r||a){const i=[...t?[`x=${t}`]:[],...r?[`y=${r}`]:[],...a?[`z=${n}`]:[]];s+=`.move(types.Point(${i.join(", ")}))`}return s}function Do(e,t){const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}const K_=(e,t)=>[`duration_s=${kn(e)}`,...t!=null?[`vent_after=${kn(t)}`]:[]],Hc=(e,t,r)=>{const{percentPower:n,duration:a,ventAfter:o}=e,{runtimeParameters:s}=t,i=B(e.moduleId,s),l=ie(n,s),u=a==null?void 0:ie(a,s),p=o==null?void 0:qo(o,s),d=[e.moduleId,n,a,o],f=[i,l,u,p],m=d.flatMap((g,k)=>typeof g=="string"&&f[k]===null?[H({parameterName:g})]:[]);if(m.length>0||i==null||l==null||u===null||p===null)return{errors:m};const h=t.moduleEntities[i],_=ut(r,i);if(_==null||h==null)return{errors:[re()]};if(zn(_))return{errors:[ka()]};const T=a!=null,y=T?`${h.pythonName}_task_${_.numPumpActivitiesStarted+1}`:null,I=T?{duration:u,ventAfter:p,taskId:y}:null,w=`percent_power=${kn(n)}`,E=T?K_(a,o):[],A=[w,...E],S=`${T?`${y} = `:""}${h.pythonName}.start_set_vacuum_power(
32
- ${Y(A.join(`,
31
+ }`}function zt(e){const{x:t,y:r,z:n}=e?.offset||{};let a=!!n,o=e?.origin;!o&&(t||r||n)&&(o="top");let s="";if(o&&(s+=(()=>{switch(o){case"top":return a=!1,`.top(${n?`z=${n}`:""})`;case"bottom":return a=!1,`.bottom(${n?`z=${n}`:""})`;case"center":return".center()";case"meniscus":return a=!1,`.meniscus(${n?`z=${n}`:""})`;default:return""}})()),t||r||a){const i=[...t?[`x=${t}`]:[],...r?[`y=${r}`]:[],...a?[`z=${n}`]:[]];s+=`.move(types.Point(${i.join(", ")}))`}return s}function Mo(e,t){const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}const X_=(e,t)=>[`duration_s=${Vr(e)}`,...t!=null?[`vent_after=${Vr(t)}`]:[]],jc=(e,t,r)=>{const{percentPower:n,duration:a,ventAfter:o}=e,{runtimeParameters:s}=t,i=v(e.moduleId,s),l=U(n,s),u=a==null?void 0:U(a,s),p=o==null?void 0:lt(o,s),d=[e.moduleId,n,a,o],f=[i,l,u,p],m=d.flatMap((E,O)=>typeof E=="string"&&f[O]===null?[C({parameterName:E})]:[]);if(m.length>0||i==null||l==null||u===null||p===null)return{errors:m};const h=t.moduleEntities[i],_=ct(r,i);if(_==null||h==null)return{errors:[pe()]};if(Wn(_))return{errors:[Na()]};const T=a!=null,b=T?`${h.pythonName}_task_${_.numPumpActivitiesStarted+1}`:null,w=T?{duration:u,ventAfter:p,taskId:b}:null,S=`percent_power=${Vr(n)}`,g=T?X_(a,o):[],L=[S,...g],A=`${T?`${b} = `:""}${h.pythonName}.start_set_vacuum_power(
32
+ ${Q(L.join(`,
33
33
  `))}
34
- )`;return{commands:[{commandType:"vacuumModule/startSetVacuumPower",key:M(),params:{moduleId:i,percentPower:l,...I??{}}}],python:S}},zc=(e,t,r)=>{const{gaugePressure:n,duration:a,ventAfter:o}=e,{runtimeParameters:s}=t,i=B(e.moduleId,s),l=ie(n,s),u=a==null?void 0:ie(a,s),p=o==null?void 0:qo(o,s),d=[e.moduleId,n,a,o],f=[i,l,u,p],m=d.flatMap((g,k)=>typeof g=="string"&&f[k]===null?[H({parameterName:g})]:[]);if(m.length>0||i==null||l==null||u===null||p===null)return{errors:m};const h=t.moduleEntities[i],_=ut(r,i);if(_==null||h==null)return{errors:[re()]};if(zn(_))return{errors:[ka()]};const T=a!=null,y=T?`${h.pythonName}_task_${_.numPumpActivitiesStarted+1}`:null,I=T?{duration:u,ventAfter:p,taskId:y}:null,w=`gauge_pressure_mbar=${kn(n)}`,E=T?K_(a,o):[],A=[w,...E],S=`${T?`${y} = `:""}${h.pythonName}.start_set_vacuum_pressure(
35
- ${Y(A.join(`,
34
+ )`;return{commands:[{commandType:"vacuumModule/startSetVacuumPower",key:$(),params:{moduleId:i,percentPower:l,...w??{}}}],python:A}},Wc=(e,t,r)=>{const{gaugePressure:n,duration:a,ventAfter:o}=e,{runtimeParameters:s}=t,i=v(e.moduleId,s),l=U(n,s),u=a==null?void 0:U(a,s),p=o==null?void 0:lt(o,s),d=[e.moduleId,n,a,o],f=[i,l,u,p],m=d.flatMap((E,O)=>typeof E=="string"&&f[O]===null?[C({parameterName:E})]:[]);if(m.length>0||i==null||l==null||u===null||p===null)return{errors:m};const h=t.moduleEntities[i],_=ct(r,i);if(_==null||h==null)return{errors:[pe()]};if(Wn(_))return{errors:[Na()]};const T=a!=null,b=T?`${h.pythonName}_task_${_.numPumpActivitiesStarted+1}`:null,w=T?{duration:u,ventAfter:p,taskId:b}:null,S=`gauge_pressure_mbar=${Vr(n)}`,g=T?X_(a,o):[],L=[S,...g],A=`${T?`${b} = `:""}${h.pythonName}.start_set_vacuum_pressure(
35
+ ${Q(L.join(`,
36
36
  `))}
37
- )`;return{commands:[{commandType:"vacuumModule/startSetVacuumPressure",key:M(),params:{moduleId:i,gaugePressure:l,...I??{}}}],python:S}},LE=e=>{const{steps:t,repetitions:r}=e;return Array.from({length:r}).flatMap(()=>t)},OE=e=>e.reduce((t,r)=>{if("repetitions"in r){const n=LE(r);return[...t,...n]}return[...t,r]},[]),so=e=>{const{holdSeconds:t,ventAfter:r}=e,n={enable_pump:!0,hold_time_seconds:t,...r!=null?{vent_after:r}:{}};if("gaugePressureMbar"in e){const{gaugePressureMbar:o}=e;return Vr({gauge_pressure_mbar:o,...n,vent_after:r})}const{percentPower:a}=e;return Vr({percent_power:Number(a),...n})},RE=e=>{let t,r;if(e.length===1&&"repetitions"in e[0]){const{steps:a,repetitions:o}=e[0];return t=`steps=[
38
- ${Y(a.map((s,i)=>(i===a.length-1,so(s))).join(`,
37
+ )`;return{commands:[{commandType:"vacuumModule/startSetVacuumPressure",key:$(),params:{moduleId:i,gaugePressure:l,...w??{}}}],python:A}},vw=e=>{const{steps:t,repetitions:r}=e;return Array.from({length:r}).flatMap(()=>t)},Pw=e=>e.reduce((t,r)=>{if("repetitions"in r){const n=vw(r);return[...t,...n]}return[...t,r]},[]),lo=e=>{const{holdSeconds:t,ventAfter:r}=e,n={enable_pump:!0,hold_time_seconds:t,...r!=null?{vent_after:r}:{}};if("gaugePressureMbar"in e){const{gaugePressureMbar:o}=e;return Br({gauge_pressure_mbar:o,...n,vent_after:r})}const{percentPower:a}=e;return Br({percent_power:Number(a),...n})},Rw=e=>{let t,r;if(e.length===1&&"repetitions"in e[0]){const{steps:a,repetitions:o}=e[0];return t=`steps=[
38
+ ${Q(a.map((s,i)=>(i===a.length-1,lo(s))).join(`,
39
39
  `))}
40
- ]`,r=`repetitions=${or(o)}`,[t,r]}const n=OE(e);return t=`steps=[
41
- ${Y(n.map((a,o)=>(o===n.length-1,so(a))).join(`,
40
+ ]`,r=`repetitions=${sr(o)}`,[t,r]}const n=Pw(e);return t=`steps=[
41
+ ${Q(n.map((a,o)=>(o===n.length-1,lo(a))).join(`,
42
42
  `))}
43
- ]`,r=`repetitions=${or(1)}`,[t,r]},jc=(e,t,r)=>{const{profile:n,ventAfter:a}=e,{runtimeParameters:o}=t,s=B(e.moduleId,o),i=qo(a,o),l=[e.moduleId,a],u=[s,i],p=l.flatMap((I,w)=>typeof I=="string"&&u[w]===null?[H({parameterName:I})]:[]);if(p.length>0||s==null||i==null)return{errors:p};const d=ut(r,s);if(d===null)return{errors:[re()]};if(zn(d))return{errors:[ka()]};const m=t.moduleEntities[s].pythonName,h=`${m}_task_${d.numPumpActivitiesStarted+1}`,_=RE(n),b=`vent_after=${kn(a)}`,T=n.map((I,w)=>w===n.length-1?{...I,ventAfter:i}:I),y=`${h} = ${m}.start_execute_profile(
44
- ${Y([..._,b].join(`,
43
+ ]`,r=`repetitions=${sr(1)}`,[t,r]},Gc=(e,t,r)=>{const{profile:n,ventAfter:a}=e,{runtimeParameters:o}=t,s=v(e.moduleId,o),i=lt(a,o),l=[e.moduleId,a],u=[s,i],p=l.flatMap((w,S)=>typeof w=="string"&&u[S]===null?[C({parameterName:w})]:[]);if(p.length>0||s==null||i==null)return{errors:p};const d=ct(r,s);if(d===null)return{errors:[pe()]};if(Wn(d))return{errors:[Na()]};const m=t.moduleEntities[s].pythonName,h=`${m}_task_${d.numPumpActivitiesStarted+1}`,_=Rw(n),y=`vent_after=${Vr(a)}`,T=n.map((w,S)=>S===n.length-1?{...w,ventAfter:i}:w),b=`${h} = ${m}.start_execute_profile(
44
+ ${Q([..._,y].join(`,
45
45
  `))}
46
- )`;return{commands:[{commandType:"vacuumModule/startRunProfile",key:M(),params:{moduleId:s,steps:T,ventAfter:i,taskId:h}}],python:y}},Z_=(e,t,r)=>{const n=B(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[H({parameterName:e.moduleId})]};const a=t.moduleEntities[n];if(a==null)return{errors:[re()]};const o=`${a.pythonName}.stop_vacuum_pump()`;return{commands:[{commandType:"vacuumModule/stopVacuum",key:M(),params:{moduleId:n}}],python:o}},Gc=(e,t,r)=>{const{runtimeParameters:n}=t,a=B(e.moduleId,n),o=ie(e.celsius,n),s=[];if(e.moduleId!=null&&a==null&&s.push(H({parameterName:e.moduleId})),typeof e.celsius=="string"&&o==null&&s.push(H({parameterName:e.celsius})),s.length>0||o==null)return{errors:s};const i=a?vt(r,a):null,l=[];if(a===null||!i)return{errors:[re()]};if(i.type!==c.TEMPERATURE_MODULE_TYPE&&i.type!==c.HEATERSHAKER_MODULE_TYPE)return console.error(`expected module to be ${c.TEMPERATURE_MODULE_TYPE} but got ${i.type}`),{errors:[re()]};const u="status"in i&&i.status===yc&&i.targetTemperature!==o,p="status"in i&&i.status===bc&&i.targetTemperature!==o;if(u||"status"in i&&i.status===Ca||"targetTemp"in i&&i.targetTemp==null)return{errors:[eT()]};p&&l.push(gE());const d=t.moduleEntities[a],f=d?.type;switch(f){case c.TEMPERATURE_MODULE_TYPE:return{commands:[{commandType:"temperatureModule/waitForTemperature",key:M(),params:{moduleId:a,celsius:o}}],warnings:l.length>0?l:void 0,python:`${d?.pythonName}.await_temperature(${e.celsius})`};case c.HEATERSHAKER_MODULE_TYPE:return{commands:[{commandType:"heaterShaker/waitForTemperature",key:M(),params:{moduleId:a,celsius:o}}],warnings:l.length>0?l:void 0,python:`${d?.pythonName}.wait_for_temperature()`};default:return console.error(`awaitTemperature expected module ${a} to be ${c.TEMPERATURE_MODULE_TYPE} or ${c.HEATERSHAKER_MODULE_TYPE}, got ${f}`),{errors:[re()]}}},vE=(e,t,r)=>{const{runtimeParameters:n}=t,a=B(e.pipetteId,n),o=B(e.labwareId,n),s=B(e.wellName,n),i=ie(e.volume,n),l=ie(e.flowRate,n),u=Pn(e.trackFromLocation,n),p=Pn(e.trackToLocation,n),d=[e.pipetteId,e.labwareId,e.wellName,e.volume,e.flowRate],f=[a,o,s,i,l],m=[...d.flatMap((I,w)=>typeof I=="string"&&f[w]==null?[H({parameterName:I})]:[]),...[...u.invalidParameterNames,...p.invalidParameterNames].map(I=>H({parameterName:I}))];if(m.length>0||a==null||o==null||s==null||i==null||l==null||u.location==null||p.location==null)return{errors:m};const h=t.pipetteEntities[a].pythonName,_=t.labwareEntities[o].pythonName,b=n[e.wellName]!=null?e.wellName:C(s),T=`${_}[${b}]`,y=[`volume=${e.volume}`,`location=${T}${Ht({origin:u.location.origin,offset:e.trackFromLocation.offset})}`,`flow_rate=${e.flowRate}`,`end_location=${T}${Ht({origin:p.location.origin,offset:e.trackToLocation.offset})}`];return{commands:[{commandType:"aspirateWhileTracking",key:M(),params:{pipetteId:a,volume:i,flowRate:l,labwareId:o,wellName:s,trackFromLocation:u.location,trackToLocation:p.location}}],python:`${h}.aspirate(
47
- ${Y(y.join(`,
46
+ )`;return{commands:[{commandType:"vacuumModule/startRunProfile",key:$(),params:{moduleId:s,steps:T,ventAfter:i,taskId:h}}],python:b}},Q_=(e,t,r)=>{const n=v(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[C({parameterName:e.moduleId})]};const a=t.moduleEntities[n];if(a==null)return{errors:[pe()]};const o=`${a.pythonName}.stop_vacuum_pump()`;return{commands:[{commandType:"vacuumModule/stopVacuum",key:$(),params:{moduleId:n}}],python:o}},Yc=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.moduleId,n),o=U(e.celsius,n),s=[];if(e.moduleId!=null&&a==null&&s.push(C({parameterName:e.moduleId})),typeof e.celsius=="string"&&o==null&&s.push(C({parameterName:e.celsius})),s.length>0||o==null)return{errors:s};const i=a?Rt(r,a):null,l=[];if(a===null||!i)return{errors:[pe()]};if(i.type!==c.TEMPERATURE_MODULE_TYPE&&i.type!==c.HEATERSHAKER_MODULE_TYPE)return console.error(`expected module to be ${c.TEMPERATURE_MODULE_TYPE} but got ${i.type}`),{errors:[pe()]};const u="status"in i&&i.status===bc&&i.targetTemperature!==o,p="status"in i&&i.status===Tc&&i.targetTemperature!==o;if(u||"status"in i&&i.status===Ma||"targetTemp"in i&&i.targetTemp==null)return{errors:[rT()]};p&&l.push(Ew());const d=t.moduleEntities[a],f=d?.type;switch(f){case c.TEMPERATURE_MODULE_TYPE:return{commands:[{commandType:"temperatureModule/waitForTemperature",key:$(),params:{moduleId:a,celsius:o}}],warnings:l.length>0?l:void 0,python:`${d?.pythonName}.await_temperature(${e.celsius})`};case c.HEATERSHAKER_MODULE_TYPE:return{commands:[{commandType:"heaterShaker/waitForTemperature",key:$(),params:{moduleId:a,celsius:o}}],warnings:l.length>0?l:void 0,python:`${d?.pythonName}.wait_for_temperature()`};default:return console.error(`awaitTemperature expected module ${a} to be ${c.TEMPERATURE_MODULE_TYPE} or ${c.HEATERSHAKER_MODULE_TYPE}, got ${f}`),{errors:[pe()]}}},kw=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.pipetteId,n),o=v(e.labwareId,n),s=v(e.wellName,n),i=U(e.volume,n),l=U(e.flowRate,n),u=Cn(e.trackFromLocation,n),p=Cn(e.trackToLocation,n),d=[e.pipetteId,e.labwareId,e.wellName,e.volume,e.flowRate],f=[a,o,s,i,l],m=[...d.flatMap((w,S)=>typeof w=="string"&&f[S]==null?[C({parameterName:w})]:[]),...[...u.invalidParameterNames,...p.invalidParameterNames].map(w=>C({parameterName:w}))];if(m.length>0||a==null||o==null||s==null||i==null||l==null||u.location==null||p.location==null)return{errors:m};const h=t.pipetteEntities[a].pythonName,_=t.labwareEntities[o].pythonName,y=n[e.wellName]!=null?e.wellName:F(s),T=`${_}[${y}]`,b=[`volume=${e.volume}`,`location=${T}${zt({origin:u.location.origin,offset:e.trackFromLocation.offset})}`,`flow_rate=${e.flowRate}`,`end_location=${T}${zt({origin:p.location.origin,offset:e.trackToLocation.offset})}`];return{commands:[{commandType:"aspirateWhileTracking",key:$(),params:{pipetteId:a,volume:i,flowRate:l,labwareId:o,wellName:s,trackFromLocation:u.location,trackToLocation:p.location}}],python:`${h}.aspirate(
47
+ ${Q(b.join(`,
48
48
  `))},
49
- )`}},kE=(e,t,r)=>{const{runtimeParameters:n}=t,a=B(e.pipetteId,n),o=B(e.labwareId,n),s=B(e.wellName,n),i=ie(e.volume,n),l=ie(e.flowRate,n),u=e.pushOut==null?void 0:ie(e.pushOut,n),p=Pn(e.trackFromLocation,n),d=Pn(e.trackToLocation,n),f=[e.pipetteId,e.labwareId,e.wellName,e.volume,e.flowRate,e.pushOut],m=[a,o,s,i,l,u],h=[...f.flatMap((w,E)=>typeof w=="string"&&m[E]==null?[H({parameterName:w})]:[]),...[...p.invalidParameterNames,...d.invalidParameterNames].map(w=>H({parameterName:w}))];if(h.length>0||a==null||o==null||s==null||i==null||l==null||p.location==null||d.location==null)return{errors:h};const _=t.pipetteEntities[a].pythonName,b=t.labwareEntities[o].pythonName,T=n[e.wellName]!=null?e.wellName:C(s),y=`${b}[${T}]`,I=[`volume=${e.volume}`,`location=${y}${Ht({origin:p.location.origin,offset:e.trackFromLocation.offset})}`,`flow_rate=${e.flowRate}`,`end_location=${y}${Ht({origin:d.location.origin,offset:e.trackToLocation.offset})}`,...e.pushOut!=null?[`push_out=${e.pushOut}`]:[]];return{commands:[{commandType:"dispenseWhileTracking",key:M(),params:{pipetteId:a,volume:i,flowRate:l,labwareId:o,wellName:s,trackFromLocation:p.location,trackToLocation:d.location,...u!=null?{pushOut:u}:{}}}],python:`${_}.dispense(
50
- ${Y(I.join(`,
49
+ )`}},Nw=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.pipetteId,n),o=v(e.labwareId,n),s=v(e.wellName,n),i=U(e.volume,n),l=U(e.flowRate,n),u=e.pushOut==null?void 0:U(e.pushOut,n),p=Cn(e.trackFromLocation,n),d=Cn(e.trackToLocation,n),f=[e.pipetteId,e.labwareId,e.wellName,e.volume,e.flowRate,e.pushOut],m=[a,o,s,i,l,u],h=[...f.flatMap((S,g)=>typeof S=="string"&&m[g]==null?[C({parameterName:S})]:[]),...[...p.invalidParameterNames,...d.invalidParameterNames].map(S=>C({parameterName:S}))];if(h.length>0||a==null||o==null||s==null||i==null||l==null||p.location==null||d.location==null)return{errors:h};const _=t.pipetteEntities[a].pythonName,y=t.labwareEntities[o].pythonName,T=n[e.wellName]!=null?e.wellName:F(s),b=`${y}[${T}]`,w=[`volume=${e.volume}`,`location=${b}${zt({origin:p.location.origin,offset:e.trackFromLocation.offset})}`,`flow_rate=${e.flowRate}`,`end_location=${b}${zt({origin:d.location.origin,offset:e.trackToLocation.offset})}`,...e.pushOut!=null?[`push_out=${e.pushOut}`]:[]];return{commands:[{commandType:"dispenseWhileTracking",key:$(),params:{pipetteId:a,volume:i,flowRate:l,labwareId:o,wellName:s,trackFromLocation:p.location,trackToLocation:d.location,...u!=null?{pushOut:u}:{}}}],python:`${_}.dispense(
50
+ ${Q(w.join(`,
51
51
  `))},
52
- )`}},PE=(e,t,r)=>{const{axes:n,skipIfMountPositionOk:a}=e,o={commandType:"home",key:M(),params:{axes:n,skipIfMountPositionOk:a}},s=[...n!=null?[`axes=${xc(n)},
53
- `]:[],...a!=null?[`skipIfMountPositionOk=${C(a)},
54
- `]:[]],i=`${we}.home(${s.join(", ")})`;return{commands:[o],python:i}},NE=(e,t,r)=>{const{pipetteId:n,axis:a,distance:o}=e,{pipetteEntities:s}=t,i=s[n].pythonName,l=[{commandType:"moveRelative",key:M(),params:{pipetteId:n,axis:a,distance:o}}],u=[`axis=${C(a)}`,`distance=${o}`];return{commands:l,python:`${i}.move_axes_relative(${u.join(", ")})`}},CE=(e,t,r)=>{const{pipetteId:n,coordinates:a,minimumZHeight:o,forceDirect:s}=e,{pipetteEntities:i}=t,l=i[n].pythonName,u=[{commandType:"moveToCoordinates",key:M(),params:{pipetteId:n,coordinates:a,minimumZHeight:o,forceDirect:s}}],p=[`coordinates=${Bc([a.x,a.y,a.z])}`,...s?["force_direct=True"]:[],...o?[`minimum_z_height=${o}`]:[]];return{commands:u,python:`${l}.move_axes_to(${p.join(", ")})`}},DE=(e,t,r)=>{const{pipetteId:n,labwareId:a,wellName:o,wellLocation:s}=e,{pipetteEntities:i}=t,l=i[n].pythonName,u=t.labwareEntities[a].pythonName;return{commands:[{commandType:"tryLiquidProbe",key:M(),params:{pipetteId:n,labwareId:a,wellName:o,wellLocation:s}}],python:`${l}.detect_liquid_presence(${u}[${C(o)}])`}},X_=(e,t,r)=>{const{runtimeParameters:n}=t,a=B(e.moduleId,n);if(a==null)return{errors:[H({parameterName:e.moduleId})]};const o=t.moduleEntities[a].pythonName;return{commands:[{commandType:"heaterShaker/closeLabwareLatch",key:M(),params:{moduleId:a}}],python:`${o}.close_labware_latch()`}},ec=(e,t,r)=>{const{runtimeParameters:n}=t,a=B(e.moduleId,n);if(a==null)return{errors:[H({parameterName:e.moduleId})]};const o=t.moduleEntities[a].pythonName;return{commands:[{commandType:"heaterShaker/deactivateHeater",key:M(),params:{moduleId:a}}],python:`${o}.deactivate_heater()`}},ME=["1","4","7","10"],Q_=(e,t,r)=>{const{pipetteEntities:n,labwareEntities:a,moduleEntities:o,runtimeParameters:s}=t,i=B(e.moduleId,s);if(i==null)return{errors:[H({parameterName:e.moduleId})]};const l=r.modules[i].slot,u=Object.keys(n)[0],p=n[u]?.spec;if(!((p?.displayCategory==="FLEX"||p?.channels===96)??!1)&&Jy(r.labware,a,l)){const m=ME.includes(l)?"right":"left";return{errors:[uT(m)]}}const f=o[i].pythonName;return{commands:[{commandType:"heaterShaker/openLabwareLatch",key:M(),params:{moduleId:i}}],python:`${f}.open_labware_latch()`}},J_=(e,t,r)=>{const{moduleEntities:n,runtimeParameters:a}=t,o=B(e.moduleId,a),s=ie(e.rpm,a),i=[];if(o==null&&i.push(H({parameterName:e.moduleId})),typeof e.rpm=="string"&&s==null&&i.push(H({parameterName:e.rpm})),i.length>0||o==null||s==null)return{errors:i};if(n[o]?.type!==c.HEATERSHAKER_MODULE_TYPE)throw new Error(`expected module ${o} to be heaterShaker, got ${n[o]?.type}`);const l=n[o].pythonName;return{commands:[{commandType:"heaterShaker/setAndWaitForShakeSpeed",key:M(),params:{moduleId:o,rpm:s}}],python:`${l}.set_and_wait_for_shake_speed(${e.rpm})`}},tc=(e,t,r)=>{const{runtimeParameters:n}=t,a=B(e.moduleId,n);if(a==null)return{errors:[H({parameterName:e.moduleId})]};const o=t.moduleEntities[a].pythonName;return{commands:[{commandType:"heaterShaker/deactivateShaker",key:M(),params:{moduleId:a}}],python:`${o}.deactivate_shaker()`}},Wc=(e,t,r)=>{const{moduleId:n}=e,{moduleEntities:a,labwareEntities:o}=t,s=[],i=a[n].pythonName,u=Object.values(r.labware).filter(f=>f.stack.includes(n)).find(f=>f.stack.find(m=>o[m]?.def.allowedRoles?.includes("lid")&&o[m]?.def.parameters.loadName!=="opentrons_tough_pcr_auto_sealing_lid")),p=u!=null?Mo(u.stack):null,d=p!=null?o[p].def.metadata.displayName:null;return d!=null&&s.push(bT({lidDisplayName:d})),s.length>0?{errors:s}:{commands:[{commandType:"thermocycler/closeLid",key:M(),params:{moduleId:n}}],python:`${i}.close_lid()`}},ey=(e,t,r)=>{const n=t.moduleEntities[e.moduleId].pythonName;return{commands:[{commandType:"thermocycler/deactivateBlock",key:M(),params:{moduleId:e.moduleId}}],python:`${n}.deactivate_block()`}},ty=(e,t,r)=>{const n=t.moduleEntities[e.moduleId].pythonName;return{commands:[{commandType:"thermocycler/deactivateLid",key:M(),params:{moduleId:e.moduleId}}],python:`${n}.deactivate_lid()`}},ry=(e,t,r)=>{const n=t.moduleEntities[e.moduleId].pythonName;return{commands:[{commandType:"thermocycler/openLid",key:M(),params:{moduleId:e.moduleId}}],python:`${n}.open_lid()`}},ny=(e,t,r)=>{e.celsius!==void 0&&console.warn("'volume' param not implemented for thermocycler/setTargetBlockTemperature, should not be set!");const n=t.moduleEntities[e.moduleId].pythonName;return{commands:[{commandType:"thermocycler/setTargetBlockTemperature",key:M(),params:{moduleId:e.moduleId,celsius:e.celsius}}],python:`${n}.set_block_temperature(${e.celsius})`}},Yc=(e,t,r)=>{const{moduleId:n,celsius:a}=e,o=t.moduleEntities[n].pythonName;return{commands:[{commandType:"thermocycler/setTargetLidTemperature",key:M(),params:{moduleId:n,celsius:a}}],python:`${o}.set_lid_temperature(${a})`}};function O(e,t){return(r,n)=>e(t,r,n)}function R(e,t){return(r,n)=>{const a=e(t,r,n);if("python"in a){const{python:o,...s}=a;return s}return a}}const Ye="__air__",Wr="source_well",$n="dest_well";function ay(e){return a_.includes(e.parameters.loadName)}function Ta(e){return(e.parameters.quirks??[]).includes("vacuumSpacer")}function oy(e){return(e.parameters.quirks??[]).includes("vacuumSpacerSeat")}const sy=(e,t)=>e.filter(r=>r in t&&Ta(t[r].def)).map(r=>t[r].def.parameters.loadName),iy=(e,t,r)=>{if(!Ta(e))return{isCompatible:!1,isAboveStackLimit:!1};if(t.length===0)return{isCompatible:!0,isAboveStackLimit:!1};const n=sy(t,r),a=Mo(t);if(!(a in r))return{isCompatible:!0,isAboveStackLimit:!1};const o=r[a].def;if(!Ta(o)||oy(o))return{isCompatible:!1,isAboveStackLimit:!1};const s=e.parameters.loadName,i=o.parameters.loadName,l=n.includes(s),u=n.length>=o_,p=e.compatibleParentLabware?.includes(i)??!1,d=i in(e.stackingOffsetWithLabware??{}),f=p||d,m=l||u;return{isCompatible:f&&!m,isAboveStackLimit:m}},FE=e=>(e.parameters.quirks??[]).includes("vacuumModuleDock"),ly=(e,t,r)=>{const o=c.getDeckDefFromRobotType(r).cutoutFixtures.find(l=>l.id.includes(t))?.providesAddressableAreas,i=(l=>{if(o!=null){for(const u in o)if(o[u].includes(l))return u}return null})(e);if(i==null)throw Error(`expected to find cutoutId from addressableAreaName ${e} but could not`);return i};function uy(e){switch(e){case 1:return c.ONE_CHANNEL_WASTE_CHUTE_ADDRESSABLE_AREA;case 8:return c.EIGHT_CHANNEL_WASTE_CHUTE_ADDRESSABLE_AREA;case 96:return c.NINETY_SIX_CHANNEL_WASTE_CHUTE_ADDRESSABLE_AREA}}function Kc(e){const t=c.getDeckDefFromRobotType(e==="cutout12"?c.OT2_ROBOT_TYPE:c.FLEX_ROBOT_TYPE);let r=null;return t.robot.model===c.FLEX_ROBOT_TYPE&&(r=t.cutoutFixtures.find(n=>n.id==="trashBinAdapter")?.providesAddressableAreas??null),t.robot.model===c.FLEX_ROBOT_TYPE&&r==null&&console.error(`expected to find a list of cutouts for the Flex but could not with trashLocation ${e}`),r!=null?r[e]?.[0]:"fixedTrash"}function cy(e){if(e==="fixedTrash")return"cutout12";const r=c.getDeckDefFromRobotType(c.FLEX_ROBOT_TYPE).cutoutFixtures.find(n=>n.id==="trashBinAdapter")?.providesAddressableAreas??null;if(r==null)return console.error("Could not find trashBinAdapter cutouts for Flex"),null;for(const[n,a]of Object.entries(r))if(a.includes(e))return n;return console.error(`Could not find trashLocation for addressableAreaName ${e}`),null}function Bn(e,t,r,n){return e[n]!=null?"labware":t[n]!=null?"wasteChute":r[n]!=null?"trashBin":(console.error(`expected to determine if dest labware is a labware or waste chute with destLabware ${n} but could not`),null)}function py(e,t){return On(En(t),r=>e)}function yr(e){return dt(e,(t,r,n)=>n===Ye?t:t+r.volume,0)}function rr(e,t){const r=yr(t);if(r===0)return{source:t,dest:{[Ye]:{volume:e}}};if(e>r)return{source:ar(t,()=>({volume:0})),dest:{...t,[Ye]:{volume:e-r}}};const n=dt(t,(a,o,s)=>({...a,[s]:o.volume/r}),{});return Object.keys(t).reduce((a,o)=>{const s=n[o]*e;return{source:{...a.source,[o]:{volume:t[o].volume-s}},dest:{...a.dest,[o]:{volume:s}}}},{source:{},dest:{}})}function br(e,t){return{...t,...dt(e,(r,n,a)=>{const s=a in t?n.volume+t[a].volume:n.volume;return{...r,[a]:{volume:s}}},{})}}function Zc(e,t,r){const n=e===1?[r]:c.getWellNamePerMultiTip(t,r,e);if(!n)return console.warn(e===1?`Invalid well: ${r}`:`For labware def (URI ${c.getLabwareDefURI(t)}), with primary well ${r}, no wells are accessible by 8-channel's 1st tip`),{wellsForTips:[],allWellsShared:!1};const a=n.every(o=>o&&o===n[0]);return{wellsForTips:n,allWellsShared:a}}const dy=e=>{const{pipette:t,sourceLabwareId:r,sourceWell:n,destLabwareId:a,destWell:o,blowoutLocation:s,flowRate:i,offsetFromTopMm:l,invariantContext:u}=e;if(!s)return[];const{trashBinEntities:p,wasteChuteEntities:d}=u;let f=null,m=null;return s===Wr?(f=r,m=n):s===$n&&(f=a,m=o),m!=null&&f!=null?[O(Uc,{pipetteId:t,labwareId:f,wellName:m,flowRate:i,wellLocation:{origin:"top",offset:{z:l}}})]:d[s]!=null?[O(Ob,{pipetteId:t,flowRate:i,wasteChuteId:Object.keys(d)[0]})]:[O(Lb,{pipetteId:t,trashId:Object.keys(p)[0],flowRate:i})]};function fy(e){const{labwareEntities:t,pipetteEntities:r,wasteChuteEntities:n,trashBinEntities:a}=e;return{pipettes:dt(r,(o,s,i)=>{const l=s.spec;return{...o,[i]:my(l.channels,{})}},{}),labware:dt(t,(o,s,i)=>({...o,[i]:ar(s.def.wells,()=>({}))}),{}),trashBins:dt(a,(o,s,i)=>({...o,[i]:{}}),{}),wasteChute:dt(n,(o,s,i)=>({...o,[i]:{}}),{})}}function my(e,t){return En(e).reduce((r,n)=>({...r,[n]:t}),{})}const hy=e=>{const{blowoutLocation:t,sourceLabware:r,destLabware:n,sourceWell:a,destWell:o}=e;return t===Wr&&r!=null&&a!=null?{dispenseAirGapLabware:r,dispenseAirGapWell:a}:{dispenseAirGapLabware:n,dispenseAirGapWell:o}};function Xc(e){const{invariantContext:t,labwareLocations:r,moduleLocations:n={},pipetteLocations:a}=e;return{labware:r,modules:n,pipettes:a,liquidState:fy(t),tipState:{pipettes:dt(a,(o,s,i)=>s.mount?{...o,[i]:{hasTip:!1,tiprackURI:null}}:o,{}),tipracks:dt(r,(o,s,i)=>{const l=t.labwareEntities[i].def;if(!c.getIsTiprack(l))return o;const u=ar(l.wells,()=>Da);return{...o,[i]:u}},{})}}}const _y=(e,t)=>e.tipracks[t]!=null?Object.values(e.tipracks[t]).some(r=>r!==de):!1,yy=(e,t)=>e.labware[t]!=null?Object.values(e.labware[t]).some(r=>Object.values(r).some(n=>n.volume>0)):!1,UE=(e,t,r)=>{const{destinationId:n,pipetteId:a,volume:o,flowRate:s,offsetFromBottomMm:i,well:l,xOffset:u,yOffset:p,tipRack:d,primaryNozzle:f,nozzles:m}=e,{labwareEntities:h,trashBinEntities:_,wasteChuteEntities:b}=t,T=Bn(h,b,_,n);let y=[];return T==="labware"&&i!=null&&l!=null?y=[O(qc,{pipetteId:a,volume:o,labwareId:n,wellName:l,flowRate:s,wellLocation:{origin:"bottom",offset:{z:i,x:u,y:p}},tipRack:d,primaryNozzle:f,nozzles:m})]:T==="wasteChute"?y=[O(RA,{pipetteId:a,volume:o,flowRate:s,wasteChuteId:b[n].id})]:y=[O(OA,{pipetteId:a,volume:o,flowRate:s,trashId:_[n].id})],le(y,t,r)},qE=(e,t,r)=>{const{destinationId:n,pipetteId:a,zOffset:o,well:s}=e,{labwareEntities:i,wasteChuteEntities:l,trashBinEntities:u}=t,p=Bn(i,l,u,n);let d=[];return p==="labware"&&s!=null?d=[O(x,{pipetteId:a,labwareId:n,wellName:s,wellLocation:{origin:"bottom",offset:{x:0,y:0,z:o}}})]:p==="wasteChute"?d=[O($e,{pipetteId:a,fixtureId:l[n].id,offset:{x:0,y:0,z:0}})]:d=[O($e,{pipetteId:a,fixtureId:u[n].id,offset:At})],le(d,t,r)},VE=(e,t,r)=>{const{blowOutLocation:n,destinationId:a,destWell:o,flowRate:s,pipetteId:i,sourceId:l,sourceWell:u,volume:p}=e,{labwareEntities:d,trashBinEntities:f,wasteChuteEntities:m}=t,h=Bn(d,m,f,a);let _=[];if(h==="labware"&&o!=null){const{dispenseAirGapLabware:b,dispenseAirGapWell:T}=hy({blowoutLocation:n,sourceLabware:l,destLabware:a,sourceWell:u,destWell:o});_=[O(gA,{flowRate:s,pipetteId:i,labwareId:b,wellName:T,volume:p,type:"dispense"})]}else h==="wasteChute"?_=[O(EA,{pipetteId:i,volume:p,flowRate:s,wasteChuteId:m[a].id})]:_=[O(IA,{pipetteId:i,volume:p,flowRate:s,trashId:f[a].id})];return le(_,t,r)},$E=(e,t,r)=>{const{pipetteId:n,destinationId:a,well:o,zOffset:s,seconds:i}=e,{labwareEntities:l,trashBinEntities:u,wasteChuteEntities:p}=t,d=Bn(l,p,u,a);let f=[];return o!=null&&d==="labware"?f=[O(x,{pipetteId:n,labwareId:a,wellName:o,wellLocation:{origin:"bottom",offset:{x:0,y:0,z:s}}}),O(be,{seconds:i})]:d==="wasteChute"?f=[O($e,{pipetteId:n,fixtureId:a,offset:At}),O(be,{seconds:i})]:f=[O($e,{pipetteId:n,fixtureId:a,offset:At}),O(be,{seconds:i})],le(f,t,r)},K=(e,t=!1)=>{if(e==null)return console.error("expected to find stack but could not"),"unknown slot";{const r=e[e.length-1];return t?`STACKER ${r.slice(-2,-1)}`:r}},BE=e=>e===c.VACUUM_MODULE_DOCK_A4_ADDRESSABLE_AREA?s_:e,Mo=e=>e==null?(console.error("expected to find stack but could not"),"unknown top location"):e[0],by=e=>e.length>=2?e[1]:null,ba=e=>{const{slot:t,labwareState:r,modulesState:n}=e,a=Object.values(n).find(({slot:o,moduleState:s})=>o===t&&s.type===c.FLEX_STACKER_MODULE_TYPE);if(a!=null){const o=a.moduleState.labwareOnShuttle;return o==null?[]:[o.lidLabwareId,o.primaryLabwareId,o.adapterLabwareId].filter(i=>i!=null)}return Object.values(r).reduce((o,{stack:s})=>(s[s.length-1]===t&&s.length>o.length&&(o=s),o),[])},Qc=e=>c.FLEX_SINGLE_SLOT_BY_CUTOUT_ID[c.FLEX_CUTOUT_BY_SLOT_ID[e]],Ty=e=>{const t=c.FLEX_STACKER_ADDRESSABLE_AREAS.indexOf(e);return t===-1?null:De[t]},xE=e=>{const t=Ty(e);return t!=null?Qc(t):null},Iy=(e,t,r)=>{if(e==null)return null;if(De.includes(e)){const n=Qc(e);return Object.entries(t).some(([o,s])=>r[o]?.type===c.FLEX_STACKER_MODULE_TYPE&&s.slot===n)?n:e}return e},Fo=e=>{const t=c.getDeckDefFromRobotType(c.FLEX_ROBOT_TYPE),r=`${e[0]}3`,n=c.FLEX_CUTOUT_BY_SLOT_ID[r],a=t.cutoutFixtures.find(({id:o})=>o===c.FLEX_STACKER_V1_FIXTURE)?.providesAddressableAreas[n];return c.FLEX_STACKER_ADDRESSABLE_AREAS.find(o=>a?.includes(o))??null},Ey=(e,t,r,n)=>{if(t.length===0)return{isCompatible:!0,isAboveStackLimit:!1};let a=!1;const o=t.find(u=>u in n);o!=null&&(a=n[o].type===c.FLEX_STACKER_MODULE_TYPE&&t.includes(et));const s=Mo(t);let i=!0,l=!1;if(s in r){const u=r[e],p=r[s],d=t.filter(v=>r[v]!=null),f=d.filter(v=>r[v]?.def?.allowedRoles?.includes("lid"))[0],m=d.filter(v=>r[v]?.def?.allowedRoles?.includes("adapter"))[0],h=p.def.parameters.loadName,_=d.filter(v=>!r[v]?.def?.allowedRoles?.includes("adapter")&&!r[v]?.def?.allowedRoles?.includes("lid"))[0];if(a){const v=c.getMaxPoolCount({labwareDefinitions:{primary:r[_]?.def??null,adapter:r[m]?.def??null,lid:r[f]?.def??null},model:c.FLEX_STACKER_MODULE_V1});l=t.length>v}else{const v=p.def.stackLimit??1,D=h===u.def.parameters.loadName,q=t.filter(Q=>r[Q]?.def.parameters.loadName===h)?.length;l=D&&q>=v}const b=u.def.parameters.loadName==="opentrons_tough_universal_lid",T=p.def.metadata.displayCategory==="tubeRack",y=p.def.metadata.displayCategory==="aluminumBlock",I=p.def.parameters.isTiprack,E=(p.def.allowedRoles??[]).includes("lid"),A=ay(p.def),L=t.some(v=>v in r&&FE(r[v].def)),S=u.def.parameters.quirks?.includes("vacuumModuleDock")??!1,k=Ta(u.def)?iy(u.def,t,r):null;if(k!=null)l=k.isAboveStackLimit,i=k.isCompatible;else{const v=u.def,D=p.def,q=v.parameters.quirks?.includes("filterPlate")??!1,Q=D.parameters.quirks?.includes("filterPlate")??!1,fe=D.parameters.quirks?.includes("providesStackingDefault")??!1,_e=q&&!E&&!I&&!Q,ne=!L&&S,Te=fe&&!A,Oe=v.compatibleParentLabware?.includes(h)??!1,Be=h in(v.stackingOffsetWithLabware??{}),Me=D.parameters.loadName==="opentrons_tough_universal_lid";i=_e||ne||Te||Oe||Be||b&&!T&&!y&&!I&&(Me||!E)}}else if(s in n){const u=n[s],{model:p}=u;i=Object.keys(r[e].def.stackingOffsetWithModule??{}).some(d=>p===d)}return{isCompatible:i,isAboveStackLimit:l}},xa=(e,t)=>t?.find(r=>e[r]!=null)??null,HE=(e,t,r)=>t?e:r?r_[e]:e,Uo=(e,t,r)=>{if(t==="offDeck"&&r==null)return console.error("offDeck slot is not allowed to be used without an offDeckOverrideId"),[];const n=Ia(t),a=gy(t),o=HE(t,n,a),s=Object.values(e).filter(i=>i.stack.includes(o)&&(r==null||i.stack.includes(r))&&i.stack.includes(et)===a&&i.stack.includes(Ic)===n);return s.length===0?[]:a?s.at(-1)?.stack??[]:n?s.at(-1)?.stack??[]:s.toSorted((i,l)=>l.stack.length-i.stack.length)[0]?.stack??[]},zE=(e,t)=>Object.values(t).filter(r=>r.stack.includes(e)).sort((r,n)=>n.stack.length-r.stack.length)[0]?.stack[0],ma=(e,t,r,n=!0)=>{const a=c.linearInterpolate(e,t)??0,o=c.linearInterpolate(e,r)??0;return e+(n?a:0)+o},Jc=e=>{const{path:t,volume:r,pipetteSpecs:n,tiprackDefinition:a,conditioningByVolume:o,disposalByVolume:s,numDispenseWells:i,numAspirateWells:l,aspirateAirGapByVolume:u}=e,{liquids:p}=n,f=r<p.default.minVolume&&"lowVolumeDefault"in p?p.lowVolumeDefault.maxVolume:p.default.maxVolume,m=a?.wells.A1.totalLiquidVolume,h=m==null?f:Math.min(f,m),_=r*2,b=o!=null?c.linearInterpolate(_,o)??0:0,y=a?.namespace!=="opentrons"||o!=null&&s!=null&&h>=_+b+(c.linearInterpolate(_,s)??0)+(b===0?c.linearInterpolate(_,u)??0:0),I=h>=_;if(t==="multiAspirate"&&l<=i?console.warn("Invalid combination of source and destination wells for multiAspirate path"):t==="multiDispense"&&l>=i?console.warn("Invalid combination of source and destination wells for multiDispense path"):t==="single"&&l!==i&&console.warn("Invalid combination of source and destination wells for single path"),t==="single"||t==="multiDispense"&&!y||t==="multiAspirate"&&!I){const L=c.linearInterpolate(r,u)??0,S=Math.ceil((r+L)/h),g=r/S;return{referenceVolumes:{airGap:{aspirate:g,dispense:0},correction:{aspirate:g,dispense:g},pushOut:g,flowRate:{aspirate:g,dispense:g}},multiWellHandling:{isSupported:!1}}}if(t==="multiDispense"){let L=0,S=0;for(let g=0;g<i&&!(ma((g+1)*r,o??[],s??[])>h);g++)L=(g+1)*r,S+=1;return{referenceVolumes:{airGap:{aspirate:ma(L,o??[],s??[],!1),dispense:ma((S-1)*r,o??[],s??[],!1)},correction:{aspirate:ma(L,o??[],s??[]),dispense:r},flowRate:{aspirate:ma(L,o??[],s??[]),dispense:r},pushOut:r,conditioning:L,disposal:L},multiWellHandling:{isSupported:!0,numWellsToFitInTip:S}}}const w=Math.floor(h/r),E=Math.min(w,l),A=E*r;return{referenceVolumes:{airGap:{aspirate:A,dispense:0},pushOut:A,correction:{aspirate:A,dispense:A},flowRate:{aspirate:r,dispense:A}},multiWellHandling:{isSupported:!0,numWellsToFitInTip:E}}},$r=e=>{const{retractZOffset:t,retractPositionReference:r,labwareId:n,labwareEntities:a,well:o}=e;if(o==null)return!1;const s=a[n]?.def.wells[o]?.depth;if(s==null)return!1;const i=c.getMmFromBottom(t,r,s);return i==null?!1:i-s>=c.SAFE_MOVE_TO_WELL_OFFSET_FROM_TOP_MM},rc=e=>e.reduce((t,r)=>{const{kind:n}=r;return n==="onCutoutFixture"?t:n==="onLabware"?[...t,r.labwareId]:n==="onModule"||n==="inStackerHopper"?[...t,r.moduleId]:n==="onAddressableArea"?[...t,r.addressableAreaName]:[...t,r.logicalLocationName]},[]),jE={A4:"cutoutA3",B4:"cutoutB3",C4:"cutoutC3",D4:"cutoutD3"};function nc(e){if(e.location!=="offDeck"&&e.location!=="systemLocation"&&e.location!=="wasteChuteLocation"&&"addressableAreaName"in e.location&&e_.includes(e.location.addressableAreaName)){const t=M(),r=e.location.addressableAreaName,n=jE[r]??r;return{[t]:{id:t,location:n}}}return{}}const gy=e=>t_.includes(e),Ia=e=>e===c.VACUUM_MODULE_DOCK_A4_ADDRESSABLE_AREA,ep=e=>e.labwareOnShuttle?.primaryLabwareId??null,tp=(e,t,r)=>{if(r?.storedLabwareDetails==null)return!0;const n=Object.values(r?.storedLabwareDetails??{}).reduce((o,s)=>s!=null?[...o,s]:o,[]),a=t.labwareEntities[e];return n.some(o=>a?.labwareDefURI===o)},rp=(e,t)=>{const{storedLabwareDetails:r}=e??{};if(r==null)return!0;const{primaryLabwareURI:n,adapterLabwareURI:a,lidLabwareURI:o}=r,s=Object.values(t).find(({labwareDefURI:f})=>f===n),i=Object.values(t).find(({labwareDefURI:f})=>f===a),l=Object.values(t).find(({labwareDefURI:f})=>f===o);if(s==null)return console.error("Primary labware entity not found"),!1;const u=c.getMaxPoolCount({labwareDefinitions:{primary:s.def,adapter:i?.def??null,lid:l?.def??null},model:c.FLEX_STACKER_MODULE_V1}),d=e?.labwareInHopper?.length??0;return u>d},wy=e=>{const{labwareId:t,labwareRobotState:r,labwareEntities:n}=e;return Object.entries(r).some(([a,{stackedOnNode:o}])=>typeof o=="object"&&"labwareId"in o&&o.labwareId===t&&c.getIsLid(n[a].def))},Sy=e=>![vn,c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA,...De].some(t=>e===t);function ie(e,t){if(typeof e=="number")return e;const r=t[e];return r!=null&&(r.type==="float"||r.type==="int")?r.default:null}function B(e,t){const r=t[e];return r==null?e:r.type==="string"?r.default:null}function qo(e,t){if(typeof e=="boolean")return e;const r=t[e];return r!=null&&r.type==="boolean"?r.default:null}function fo(e,t,r){const n=B(e,r);return n==null||!t.includes(n)?null:n}function ac(e,t,r){return r[e]!=null?e:C(t)}function Pn(e,t){if(e==null)return{location:void 0,invalidParameterNames:[]};const r=[],n=e.origin==null?void 0:B(e.origin,t);e.origin!=null&&n==null&&r.push(e.origin);const a={};if(e.offset!=null)for(const o of["x","y","z"]){const s=e.offset[o];if(s==null)continue;const i=ie(s,t);i==null?r.push(String(s)):a[o]=i}return{location:{...n!=null?{origin:n}:{},...e.offset!=null?{offset:a}:{}},invalidParameterNames:r}}const Ha=(e,t,r)=>{const n=t[r]?.stack,a=xa(e,n),o=a!=null?e[a].moduleState:null;return!!(o&&o.type===c.ABSORBANCE_READER_TYPE&&o.lidOpen!==!0)};var vl,om;function Ay(){if(om)return vl;om=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return vl=e,vl}var GE=Ay();const np=Ge(GE);var Ly=Symbol.for("immer-nothing"),sm=Symbol.for("immer-draftable"),lt=Symbol.for("immer-state"),WE=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Qe(e,...t){if(process.env.NODE_ENV!=="production"){const r=WE[e],n=typeof r=="function"?r.apply(null,t):r;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ea=Object.getPrototypeOf;function Nn(e){return!!e&&!!e[lt]}function Br(e){return e?Oy(e)||Array.isArray(e)||!!e[sm]||!!e.constructor?.[sm]||za(e)||$o(e):!1}var YE=Object.prototype.constructor.toString(),im=new WeakMap;function Oy(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=im.get(r);return n===void 0&&(n=Function.toString.call(r),im.set(r,n)),n===YE}function ho(e,t,r=!0){Vo(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(a=>{t(a,e[a],e)}):e.forEach((n,a)=>t(a,n,e))}function Vo(e){const t=e[lt];return t?t.type_:Array.isArray(e)?1:za(e)?2:$o(e)?3:0}function oc(e,t){return Vo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ry(e,t,r){const n=Vo(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function KE(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function za(e){return e instanceof Map}function $o(e){return e instanceof Set}function Fr(e){return e.copy_||e.base_}function sc(e,t){if(za(e))return new Map(e);if($o(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=Oy(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[lt];let a=Reflect.ownKeys(n);for(let o=0;o<a.length;o++){const s=a[o],i=n[s];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[s]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[s]})}return Object.create(Ea(e),n)}else{const n=Ea(e);if(n!==null&&r)return{...e};const a=Object.create(n);return Object.assign(a,e)}}function ap(e,t=!1){return Bo(e)||Nn(e)||!Br(e)||(Vo(e)>1&&Object.defineProperties(e,{set:io,add:io,clear:io,delete:io}),Object.freeze(e),t&&Object.values(e).forEach(r=>ap(r,!0))),e}function ZE(){Qe(2)}var io={value:ZE};function Bo(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var XE={};function xr(e){const t=XE[e];return t||Qe(0,e),t}var ga;function vy(){return ga}function QE(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function lm(e,t){t&&(xr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ic(e){lc(e),e.drafts_.forEach(JE),e.drafts_=null}function lc(e){e===ga&&(ga=e.parent_)}function um(e){return ga=QE(ga,e)}function JE(e){const t=e[lt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function cm(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[lt].modified_&&(ic(t),Qe(4)),Br(e)&&(e=_o(t,e),t.parent_||yo(t,e)),t.patches_&&xr("Patches").generateReplacementPatches_(r[lt].base_,e,t.patches_,t.inversePatches_)):e=_o(t,r,[]),ic(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ly?e:void 0}function _o(e,t,r){if(Bo(t))return t;const n=e.immer_.shouldUseStrictIteration(),a=t[lt];if(!a)return ho(t,(o,s)=>pm(e,a,t,o,s,r),n),t;if(a.scope_!==e)return t;if(!a.modified_)return yo(e,a.base_,!0),a.base_;if(!a.finalized_){a.finalized_=!0,a.scope_.unfinalizedDrafts_--;const o=a.copy_;let s=o,i=!1;a.type_===3&&(s=new Set(o),o.clear(),i=!0),ho(s,(l,u)=>pm(e,a,o,l,u,r,i),n),yo(e,o,!1),r&&e.patches_&&xr("Patches").generatePatches_(a,r,e.patches_,e.inversePatches_)}return a.copy_}function pm(e,t,r,n,a,o,s){if(a==null||typeof a!="object"&&!s)return;const i=Bo(a);if(!(i&&!s)){if(process.env.NODE_ENV!=="production"&&a===r&&Qe(5),Nn(a)){const l=o&&t&&t.type_!==3&&!oc(t.assigned_,n)?o.concat(n):void 0,u=_o(e,a,l);if(Ry(r,n,u),Nn(u))e.canAutoFreeze_=!1;else return}else s&&r.add(a);if(Br(a)&&!i){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===a&&i)return;_o(e,a),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(za(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&yo(e,a)}}}function yo(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ap(t,r)}function eg(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:vy(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=n,o=op;r&&(a=[n],o=wa);const{revoke:s,proxy:i}=Proxy.revocable(a,o);return n.draft_=i,n.revoke_=s,i}var op={get(e,t){if(t===lt)return e;const r=Fr(e);if(!oc(r,t))return tg(e,r,t);const n=r[t];return e.finalized_||!Br(n)?n:n===kl(e.base_,t)?(Pl(e),e.copy_[t]=cc(n,e)):n},has(e,t){return t in Fr(e)},ownKeys(e){return Reflect.ownKeys(Fr(e))},set(e,t,r){const n=ky(Fr(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const a=kl(Fr(e),t),o=a?.[lt];if(o&&o.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(KE(r,a)&&(r!==void 0||oc(e.base_,t)))return!0;Pl(e),uc(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return kl(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Pl(e),uc(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Fr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){Qe(11)},getPrototypeOf(e){return Ea(e.base_)},setPrototypeOf(){Qe(12)}},wa={};ho(op,(e,t)=>{wa[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});wa.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Qe(13),wa.set.call(this,e,t,void 0)};wa.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Qe(14),op.set.call(this,e[0],t,r,e[0])};function kl(e,t){const r=e[lt];return(r?Fr(r):e)[t]}function tg(e,t,r){const n=ky(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}function ky(e,t){if(!(t in e))return;let r=Ea(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Ea(r)}}function uc(e){e.modified_||(e.modified_=!0,e.parent_&&uc(e.parent_))}function Pl(e){e.copy_||(e.copy_=sc(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var rg=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const o=r;r=t;const s=this;return function(l=o,...u){return s.produce(l,p=>r.call(this,p,...u))}}typeof r!="function"&&Qe(6),n!==void 0&&typeof n!="function"&&Qe(7);let a;if(Br(t)){const o=um(this),s=cc(t,void 0);let i=!0;try{a=r(s),i=!1}finally{i?ic(o):lc(o)}return lm(o,n),cm(a,o)}else if(!t||typeof t!="object"){if(a=r(t),a===void 0&&(a=t),a===Ly&&(a=void 0),this.autoFreeze_&&ap(a,!0),n){const o=[],s=[];xr("Patches").generateReplacementPatches_(t,a,o,s),n(o,s)}return a}else Qe(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(s,...i)=>this.produceWithPatches(s,l=>t(l,...i));let n,a;return[this.produce(t,r,(s,i)=>{n=s,a=i}),n,a]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Br(e)||Qe(8),Nn(e)&&(e=ng(e));const t=um(this),r=cc(e,void 0);return r[lt].isManual_=!0,lc(t),r}finishDraft(e,t){const r=e&&e[lt];(!r||!r.isManual_)&&Qe(9);const{scope_:n}=r;return lm(n,t),cm(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const a=t[r];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}r>-1&&(t=t.slice(r+1));const n=xr("Patches").applyPatches_;return Nn(e)?n(e,t):this.produce(e,a=>n(a,t))}};function cc(e,t){const r=za(e)?xr("MapSet").proxyMap_(e,t):$o(e)?xr("MapSet").proxySet_(e,t):eg(e,t);return(t?t.scope_:vy()).drafts_.push(r),r}function ng(e){return Nn(e)||Qe(10,e),Py(e)}function Py(e){if(!Br(e)||Bo(e))return e;const t=e[lt];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=sc(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=sc(e,!0);return ho(r,(a,o)=>{Ry(r,a,Py(o))},n),t&&(t.finalized_=!1),r}var ag=new rg,Ny=ag.produce;function og(e,t){let n=0;const a=[];for(;n+1<e.length;){const o=e[n],s=e[n+1];if(t(o,s)){n+=2;continue}else a.push(o),n+=1}return n+1===e.length&&a.push(e[n]),a}const sg=(e,t)=>["pipetteId","volume","labwareId","wellName"].every(n=>e[n]===t[n]),ig=e=>og(e,(t,r)=>t.commandType==="aspirate"&&r.commandType==="dispense"&&sg(t.params,r.params)),Cy=e=>ig(e),sp=(e,t)=>{const r=vt(e,t);return r.type===c.ABSORBANCE_READER_TYPE?r:(console.error(`Absorbance reader state updater expected ${t} moduleState to be absorbanceReader, but it was ${r.type}`),null)},lg=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,o=sp(n,a);o!=null&&(o.lidOpen=!0)},ug=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,o=sp(n,a);o!=null&&(o.lidOpen=!1)},cg=(e,t,r)=>{const{robotState:n}=r,{moduleId:a,measureMode:o,sampleWavelengths:s,referenceWavelength:i}=e,l=sp(n,a);l!=null&&(l.initialization={mode:o,wavelengths:s,referenceWavelength:i},l.lidOpen=!1)};function pg(e,t,r){const{pipetteId:n,volume:a}=e,{robotState:o}=r,s=o.pipettes[n].nozzles;let l=t.pipetteEntities[n].spec.channels;s===c.COLUMN?l=8:s===c.SINGLE&&(l=1),En(l).forEach(u=>{const p=o.liquidState.pipettes[n][u]??{},d=p[Ye]?.volume??0;o.liquidState.pipettes[n][u]={...p,[Ye]:{volume:d+a}}})}var Nl,dm;function dg(){if(dm)return Nl;dm=1;var e=S_(),t=qa(),r=Eo(),n=tt(),a=jr(),o=Oo(),s=vo(),i=Pc(),l="[object Map]",u="[object Set]",p=Object.prototype,d=p.hasOwnProperty;function f(m){if(m==null)return!0;if(a(m)&&(n(m)||typeof m=="string"||typeof m.splice=="function"||o(m)||i(m)||r(m)))return!m.length;var h=t(m);if(h==l||h==u)return!m.size;if(s(m))return!e(m).length;for(var _ in m)if(d.call(m,_))return!1;return!0}return Nl=f,Nl}var fg=dg();const Cl=Ge(fg);var Dl,fm;function mg(){if(fm)return Dl;fm=1;function e(t,r,n,a){for(var o=t.length,s=n+(a?1:-1);a?s--:++s<o;)if(r(t[s],s,t))return s;return-1}return Dl=e,Dl}var Ml,mm;function hg(){if(mm)return Ml;mm=1;function e(t){return t!==t}return Ml=e,Ml}var Fl,hm;function _g(){if(hm)return Fl;hm=1;function e(t,r,n){for(var a=n-1,o=t.length;++a<o;)if(t[a]===r)return a;return-1}return Fl=e,Fl}var Ul,_m;function yg(){if(_m)return Ul;_m=1;var e=mg(),t=hg(),r=_g();function n(a,o,s){return o===o?r(a,o,s):e(a,t,s)}return Ul=n,Ul}var ql,ym;function bg(){if(ym)return ql;ym=1;var e=yg();function t(r,n){var a=r==null?0:r.length;return!!a&&e(r,n,0)>-1}return ql=t,ql}var Vl,bm;function Tg(){if(bm)return Vl;bm=1;function e(t,r,n){for(var a=-1,o=t==null?0:t.length;++a<o;)if(n(r,t[a]))return!0;return!1}return Vl=e,Vl}var $l,Tm;function Ig(){if(Tm)return $l;Tm=1;function e(){}return $l=e,$l}var Bl,Im;function Eg(){if(Im)return Bl;Im=1;var e=L_(),t=Ig(),r=Lc(),n=1/0,a=e&&1/r(new e([,-0]))[1]==n?function(o){return new e(o)}:t;return Bl=a,Bl}var xl,Em;function gg(){if(Em)return xl;Em=1;var e=f_(),t=bg(),r=Tg(),n=h_(),a=Eg(),o=Lc(),s=200;function i(l,u,p){var d=-1,f=t,m=l.length,h=!0,_=[],b=_;if(p)h=!1,f=r;else if(m>=s){var T=u?null:a(l);if(T)return o(T);h=!1,f=n,b=new e}else b=u?[]:_;e:for(;++d<m;){var y=l[d],I=u?u(y):y;if(y=p||y!==0?y:0,h&&I===I){for(var w=b.length;w--;)if(b[w]===I)continue e;u&&b.push(I),_.push(y)}else f(b,I,p)||(b!==_&&b.push(I),_.push(y))}return _}return xl=i,xl}var Hl,gm;function wg(){if(gm)return Hl;gm=1;var e=gg();function t(r){return r&&r.length?e(r):[]}return Hl=t,Hl}var Sg=wg();const Ag=Ge(Sg),ip=e=>{const{nozzles:t,pipetteSpec:r,primaryNozzle:n}=e,a=r.channels;if(t==null)return a;switch(t){case c.ROW:return 12;case c.COLUMN:return 8;case c.SINGLE:return 1;case c.ALL:return a;case c.PARTIAL_COLUMN:return c.PARTIAL_NOZZLE_MAP[n];default:return a}};function Lg(e,t,r){const{pipetteId:n,volume:a}=e,{robotState:o,warnings:s}=r,i="labwareId"in e?e.labwareId:o.pipettes[n].entityId??"",l="wellName"in e?e.wellName:o.pipettes[n].wellName??"",{liquidState:u}=o,p=o.pipettes[n].nozzles,d=r.robotState.pipettes[n].primaryNozzle,f=t.pipetteEntities[n].spec,m=t.labwareEntities[i].def,h=m.metadata.displayCategory==="reservoir",_=ip({pipetteSpec:f,nozzles:p,primaryNozzle:d}),{allWellsShared:b,wellsForTips:T}=Zc(_,m,l);if(console.assert(Ag(T).length===b?1:T.length,`expected all wells to be shared, or no wells to be shared. Got: ${JSON.stringify(T)}`),_>1&&b){const I=T[0],w=u.labware[i][I],E=a*_>yr(w);Cl(w)?s.push(Rl()):E&&s.push(Ol());const A=E?yr(w)/_:a,L=rr(A,w).dest;En(_).forEach(S=>{const g=u.pipettes[n],k=S.toString(),v=g[k],D=E?br(v,{...L,[Ye]:{volume:a-A}}):br(v,L);g[k]=D}),u.labware[i][I]=rr(a*_,u.labware[i][I]).source;return}if(_===96&&h){T.forEach(I=>{const w=u.labware[i][I],E=a*8>yr(w);Cl(w)?s.push(Rl()):E&&s.push(Ol());const A=E?yr(w)/8:a,L=rr(A,w).dest;En(_).forEach(S=>{const g=u.pipettes[n],k=S.toString(),v=g[k],D=E?br(v,{...L,[Ye]:{volume:a-A}}):br(v,L);g[k]=D}),u.labware[i][I]=rr(A*8,u.labware[i][I]).source});return}En(_).forEach(I=>{const w=I.toString(),E=u.pipettes[n],A=E[w],L=u.labware[i][T[I]],S=rr(a,L).dest;Cl(L)?s.push(Rl()):a>yr(L)&&s.push(Ol()),E[w]=br(A,S)});const y=u.labware[i];T.forEach(I=>{y[I]=rr(a,y[I]).source}),"labwareId"in e&&(o.pipettes[n]={...o.pipettes[n],entityId:e.labwareId,wellName:l})}function xo(e){const{robotStateAndWarnings:t,invariantContext:r,entityId:n,pipetteId:a,prevLiquidState:o,useFullVolume:s,volume:i,wellName:l}=e,u=r.pipetteEntities[a].spec,p=t.robotState.pipettes[a].nozzles,d=t.robotState.pipettes[a].primaryNozzle,f=ip({pipetteSpec:u,nozzles:p,primaryNozzle:d}),m=l??null,h=r.labwareEntities[n]!=null?r.labwareEntities[n].def:null;console.assert(!(s&&typeof i=="number"),"dispenseUpdateLiquidState takes either `volume` or `useFullVolume`, but got both"),console.assert(typeof i=="number"||s,"in dispenseUpdateLiquidState, either volume or useFullVolume are required");const{wellsForTips:_,allWellsShared:b}=h!=null&&l!=null?Zc(f,h,l):{wellsForTips:null,allWellsShared:!0},T=o.labware[n]!=null?o.labware[n]:null;let y=null;o.trashBins[n]!=null?y=o.trashBins[n]:o.wasteChute[n]!=null&&(y=o.wasteChute[n]);const I=ar(o.pipettes[a],L=>{const{...S}=L;if(s){const g=yr(S);return g>0?rr(g,S):{source:{},dest:{}}}return rr(i||0,S)});let w=null;if(m!=null&&T!=null)w={[m]:dt(I,(L,S)=>br(L,S.dest),T[m])};else if(y!=null){const L=Object.values(o.pipettes[a]).reduce((S,g)=>S+(g[0]?.volume??0),0);y[0]={volume:L}}w==null&&y==null&&console.assert(!1,`expected to merge liquid to a single well with sourceId ${n}`);const E=m!=null&&T!=null&&_!=null?_.reduce((L,S,g)=>({...L,[S]:br(I[`${g}`].dest,T[S]||{})}),{}):{},A=b?w:E;o.pipettes[a]=ar(I,"source"),o.trashBins[n]!=null&&y!=null?Object.assign(o.trashBins[n],y):o.wasteChute[n]!=null&&y!=null?Object.assign(o.wasteChute[n],y):o.labware[n]!=null&&A!=null&&(o.labware[n]=Object.assign(T??{},A))}function Og(e,t,r){const{pipetteId:n,labwareId:a,wellName:o}=e,{robotState:s}=r;xo({pipetteId:n,entityId:a,useFullVolume:!0,wellName:o,prevLiquidState:s.liquidState,invariantContext:t,robotStateAndWarnings:r})}function Rg(e,t,r){const{pipetteId:n,configurationParams:a}=e,{robotState:o}=r;o.pipettes[n].nozzles=a.style,o.pipettes[n].primaryNozzle=a.primaryNozzle}function vg(e,t,r){const{pipetteId:n,volume:a}=e,{robotState:o}=r,s="labwareId"in e?e.labwareId:o.pipettes[n].entityId??"",i="wellName"in e?e.wellName:o.pipettes[n].wellName??"",l=o.liquidState.pipettes[n],p=Object.values(l)[0]?.[Ye]?.volume??0,d=r.robotState.pipettes[n].primaryNozzle;if(xo({invariantContext:t,entityId:s,pipetteId:n,prevLiquidState:o.liquidState,useFullVolume:!1,volume:a,wellName:i,robotStateAndWarnings:r}),p>0){const f=r.robotState.pipettes[n].nozzles,m=t.pipetteEntities[n].spec,h=ip({pipetteSpec:m,nozzles:f,primaryNozzle:d});Object.keys(l).slice(0,h).forEach(b=>{const T=l[b]??{};l[b]={...T,[Ye]:{volume:0}}})}"labwareId"in e&&(o.pipettes[n]={...o.pipettes[n],entityId:e.labwareId})}function kg(e,t,r){const{pipetteId:n,wellName:a,labwareId:o}=e,{robotState:s}=r;s.tipState.pipettes[n].hasTip=!1,s.tipState.pipettes[n].tiprackURI=null,s.pipettes[n].tiprackId=void 0;const i=s.tipState,l=t.pipetteEntities[n].spec,u=s.pipettes[n].nozzles,p=yp(u,l),d=(m,h)=>m.find(_=>_.includes(h)),f=t.labwareEntities[o]?.def;f==null||!c.getIsTiprack(f)?console.warn(`forDropTip expected ${o} to have definition and to be a tiprack`):(p===c.SINGLE?i.tipracks[o][a]=er:p===c.COLUMN?(d(f.ordering,a)??[]).forEach(h=>i.tipracks[o][h]=er):p===c.ALL?l.channels===96?f.ordering.reduce((h,_)=>h.concat(_),[]).forEach(function(h){i.tipracks[o][h]=er}):(d(f.ordering,a)??[]).forEach(h=>i.tipracks[o][h]=er):l.channels===1?i.tipracks[o][a]=er:l.channels===96?f.ordering.reduce((h,_)=>h.concat(_),[]).forEach(function(h){i.tipracks[o][h]=er}):(d(f.ordering,a)??[]).forEach(h=>i.tipracks[o][h]=er),s.pipettes[n].entityId=o,s.pipettes[n].wellName=a)}function Pg(e,t,r){const{labwareId:n,liquidId:a,volumeByWell:o}=e;Object.entries(o).forEach(([s,i])=>{r.robotState.liquidState.labware[n][s][a]={volume:i}})}var zl,wm;function Ng(){if(wm)return zl;wm=1;function e(t,r){for(var n=-1,a=t==null?0:t.length;++n<a&&r(t[n],n,t)!==!1;);return t}return zl=e,zl}var jl,Sm;function lp(){if(Sm)return jl;Sm=1;var e=Mc(),t=go(),r=Object.prototype,n=r.hasOwnProperty;function a(o,s,i){var l=o[s];(!(n.call(o,s)&&t(l,i))||i===void 0&&!(s in o))&&e(o,s,i)}return jl=a,jl}var Gl,Am;function ja(){if(Am)return Gl;Am=1;var e=lp(),t=Mc();function r(n,a,o,s){var i=!o;o||(o={});for(var l=-1,u=a.length;++l<u;){var p=a[l],d=s?s(o[p],n[p],p,o,n):void 0;d===void 0&&(d=n[p]),i?t(o,p,d):e(o,p,d)}return o}return Gl=r,Gl}var Wl,Lm;function Cg(){if(Lm)return Wl;Lm=1;var e=ja(),t=Ua();function r(n,a){return n&&e(a,t(a),n)}return Wl=r,Wl}var Yl,Om;function Dg(){if(Om)return Yl;Om=1;function e(t){var r=[];if(t!=null)for(var n in Object(t))r.push(n);return r}return Yl=e,Yl}var Kl,Rm;function Mg(){if(Rm)return Kl;Rm=1;var e=ir(),t=vo(),r=Dg(),n=Object.prototype,a=n.hasOwnProperty;function o(s){if(!e(s))return r(s);var i=t(s),l=[];for(var u in s)u=="constructor"&&(i||!a.call(s,u))||l.push(u);return l}return Kl=o,Kl}var Zl,vm;function up(){if(vm)return Zl;vm=1;var e=g_(),t=Mg(),r=jr();function n(a){return r(a)?e(a,!0):t(a)}return Zl=n,Zl}var Xl,km;function Fg(){if(km)return Xl;km=1;var e=ja(),t=up();function r(n,a){return n&&e(a,t(a),n)}return Xl=r,Xl}var ya={exports:{}};ya.exports;var Pm;function Ug(){return Pm||(Pm=1,(function(e,t){var r=jt(),n=t&&!t.nodeType&&t,a=n&&!0&&e&&!e.nodeType&&e,o=a&&a.exports===n,s=o?r.Buffer:void 0,i=s?s.allocUnsafe:void 0;function l(u,p){if(p)return u.slice();var d=u.length,f=i?i(d):new u.constructor(d);return u.copy(f),f}e.exports=l})(ya,ya.exports)),ya.exports}var Ql,Nm;function qg(){if(Nm)return Ql;Nm=1;function e(t,r){var n=-1,a=t.length;for(r||(r=Array(a));++n<a;)r[n]=t[n];return r}return Ql=e,Ql}var Jl,Cm;function Vg(){if(Cm)return Jl;Cm=1;var e=ja(),t=Oc();function r(n,a){return e(n,t(n),a)}return Jl=r,Jl}var eu,Dm;function cp(){if(Dm)return eu;Dm=1;var e=w_(),t=e(Object.getPrototypeOf,Object);return eu=t,eu}var tu,Mm;function Dy(){if(Mm)return tu;Mm=1;var e=gc(),t=cp(),r=Oc(),n=I_(),a=Object.getOwnPropertySymbols,o=a?function(s){for(var i=[];s;)e(i,r(s)),s=t(s);return i}:n;return tu=o,tu}var ru,Fm;function $g(){if(Fm)return ru;Fm=1;var e=ja(),t=Dy();function r(n,a){return e(n,t(n),a)}return ru=r,ru}var nu,Um;function pp(){if(Um)return nu;Um=1;var e=b_(),t=Dy(),r=up();function n(a){return e(a,r,t)}return nu=n,nu}var au,qm;function Bg(){if(qm)return au;qm=1;var e=Object.prototype,t=e.hasOwnProperty;function r(n){var a=n.length,o=new n.constructor(a);return a&&typeof n[0]=="string"&&t.call(n,"index")&&(o.index=n.index,o.input=n.input),o}return au=r,au}var ou,Vm;function dp(){if(Vm)return ou;Vm=1;var e=y_();function t(r){var n=new r.constructor(r.byteLength);return new e(n).set(new e(r)),n}return ou=t,ou}var su,$m;function xg(){if($m)return su;$m=1;var e=dp();function t(r,n){var a=n?e(r.buffer):r.buffer;return new r.constructor(a,r.byteOffset,r.byteLength)}return su=t,su}var iu,Bm;function Hg(){if(Bm)return iu;Bm=1;var e=/\w*$/;function t(r){var n=new r.constructor(r.source,e.exec(r));return n.lastIndex=r.lastIndex,n}return iu=t,iu}var lu,xm;function zg(){if(xm)return lu;xm=1;var e=Dn(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function n(a){return r?Object(r.call(a)):{}}return lu=n,lu}var uu,Hm;function jg(){if(Hm)return uu;Hm=1;var e=dp();function t(r,n){var a=n?e(r.buffer):r.buffer;return new r.constructor(a,r.byteOffset,r.length)}return uu=t,uu}var cu,zm;function Gg(){if(zm)return cu;zm=1;var e=dp(),t=xg(),r=Hg(),n=zg(),a=jg(),o="[object Boolean]",s="[object Date]",i="[object Map]",l="[object Number]",u="[object RegExp]",p="[object Set]",d="[object String]",f="[object Symbol]",m="[object ArrayBuffer]",h="[object DataView]",_="[object Float32Array]",b="[object Float64Array]",T="[object Int8Array]",y="[object Int16Array]",I="[object Int32Array]",w="[object Uint8Array]",E="[object Uint8ClampedArray]",A="[object Uint16Array]",L="[object Uint32Array]";function S(g,k,v){var D=g.constructor;switch(k){case m:return e(g);case o:case s:return new D(+g);case h:return t(g,v);case _:case b:case T:case y:case I:case w:case E:case A:case L:return a(g,v);case i:return new D;case l:case d:return new D(g);case u:return r(g);case p:return new D;case f:return n(g)}}return cu=S,cu}var pu,jm;function Wg(){if(jm)return pu;jm=1;var e=ir(),t=Object.create,r=(function(){function n(){}return function(a){if(!e(a))return{};if(t)return t(a);n.prototype=a;var o=new n;return n.prototype=void 0,o}})();return pu=r,pu}var du,Gm;function Yg(){if(Gm)return du;Gm=1;var e=Wg(),t=cp(),r=vo();function n(a){return typeof a.constructor=="function"&&!r(a)?e(t(a)):{}}return du=n,du}var fu,Wm;function Kg(){if(Wm)return fu;Wm=1;var e=qa(),t=sr(),r="[object Map]";function n(a){return t(a)&&e(a)==r}return fu=n,fu}var mu,Ym;function Zg(){if(Ym)return mu;Ym=1;var e=Kg(),t=vc(),r=kc(),n=r&&r.isMap,a=n?t(n):e;return mu=a,mu}var hu,Km;function Xg(){if(Km)return hu;Km=1;var e=qa(),t=sr(),r="[object Set]";function n(a){return t(a)&&e(a)==r}return hu=n,hu}var _u,Zm;function Qg(){if(Zm)return _u;Zm=1;var e=Xg(),t=vc(),r=kc(),n=r&&r.isSet,a=n?t(n):e;return _u=a,_u}var yu,Xm;function My(){if(Xm)return yu;Xm=1;var e=Ac(),t=Ng(),r=lp(),n=Cg(),a=Fg(),o=Ug(),s=qg(),i=Vg(),l=$g(),u=A_(),p=pp(),d=qa(),f=Bg(),m=Gg(),h=Yg(),_=tt(),b=Oo(),T=Zg(),y=ir(),I=Qg(),w=Ua(),E=up(),A=1,L=2,S=4,g="[object Arguments]",k="[object Array]",v="[object Boolean]",D="[object Date]",q="[object Error]",Q="[object Function]",fe="[object GeneratorFunction]",_e="[object Map]",ne="[object Number]",Te="[object Object]",Oe="[object RegExp]",Be="[object Set]",Me="[object String]",ae="[object Symbol]",Re="[object WeakMap]",We="[object ArrayBuffer]",Fe="[object DataView]",Ae="[object Float32Array]",J="[object Float64Array]",Z="[object Int8Array]",N="[object Int16Array]",P="[object Int32Array]",$="[object Uint8Array]",F="[object Uint8ClampedArray]",ue="[object Uint16Array]",V="[object Uint32Array]",G={};G[g]=G[k]=G[We]=G[Fe]=G[v]=G[D]=G[Ae]=G[J]=G[Z]=G[N]=G[P]=G[_e]=G[ne]=G[Te]=G[Oe]=G[Be]=G[Me]=G[ae]=G[$]=G[F]=G[ue]=G[V]=!0,G[q]=G[Q]=G[Re]=!1;function z(U,j,me,xe,rt,je){var he,nt=j&A,yt=j&L,kt=j&S;if(me&&(he=rt?me(U,xe,rt,je):me(U)),he!==void 0)return he;if(!y(U))return U;var bt=_(U);if(bt){if(he=f(U),!nt)return s(U,he)}else{var Ne=d(U),at=Ne==Q||Ne==fe;if(b(U))return o(U,nt);if(Ne==Te||Ne==g||at&&!rt){if(he=yt||at?{}:h(U),!nt)return yt?l(U,a(he,U)):i(U,n(he,U))}else{if(!G[Ne])return rt?U:{};he=m(U,Ne,nt)}}je||(je=new e);var Se=je.get(U);if(Se)return Se;je.set(U,he),I(U)?U.forEach(function(oe){he.add(z(oe,j,me,oe,U,je))}):T(U)&&U.forEach(function(oe,se){he.set(se,z(oe,j,me,se,U,je))});var Ce=kt?yt?p:u:yt?E:w,Ue=bt?void 0:Ce(U);return t(Ue||U,function(oe,se){Ue&&(se=oe,oe=U[se]),r(he,se,z(oe,j,me,se,U,je))}),he}return yu=z,yu}var bu,Qm;function Fy(){if(Qm)return bu;Qm=1;function e(t,r,n){var a=-1,o=t.length;r<0&&(r=-r>o?0:o+r),n=n>o?o:n,n<0&&(n+=o),o=r>n?0:n-r>>>0,r>>>=0;for(var s=Array(o);++a<o;)s[a]=t[a+r];return s}return bu=e,bu}var Tu,Jm;function Jg(){if(Jm)return Tu;Jm=1;var e=ko(),t=Fy();function r(n,a){return a.length<2?n:e(n,t(a,0,-1))}return Tu=r,Tu}var Iu,eh;function ew(){if(eh)return Iu;eh=1;var e=Fn(),t=Ay(),r=Jg(),n=Un(),a=Object.prototype,o=a.hasOwnProperty;function s(i,l){l=e(l,i);var u=-1,p=l.length;if(!p)return!0;for(;++u<p;){var d=n(l[u]);if(d==="__proto__"&&!o.call(i,"__proto__")||(d==="constructor"||d==="prototype")&&u<p-1)return!1}var f=r(i,l);return f==null||delete f[n(t(l))]}return Iu=s,Iu}var Eu,th;function tw(){if(th)return Eu;th=1;var e=Mn(),t=cp(),r=sr(),n="[object Object]",a=Function.prototype,o=Object.prototype,s=a.toString,i=o.hasOwnProperty,l=s.call(Object);function u(p){if(!r(p)||e(p)!=n)return!1;var d=t(p);if(d===null)return!0;var f=i.call(d,"constructor")&&d.constructor;return typeof f=="function"&&f instanceof f&&s.call(f)==l}return Eu=u,Eu}var gu,rh;function rw(){if(rh)return gu;rh=1;var e=tw();function t(r){return e(r)?void 0:r}return gu=t,gu}var wu,nh;function nw(){if(nh)return wu;nh=1;var e=c_();function t(r){var n=r==null?0:r.length;return n?e(r,1):[]}return wu=t,wu}var Su,ah;function aw(){if(ah)return Su;ah=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return Su=e,Su}var Au,oh;function Uy(){if(oh)return Au;oh=1;var e=aw(),t=Math.max;function r(n,a,o){return a=t(a===void 0?n.length-1:a,0),function(){for(var s=arguments,i=-1,l=t(s.length-a,0),u=Array(l);++i<l;)u[i]=s[a+i];i=-1;for(var p=Array(a+1);++i<a;)p[i]=s[i];return p[a]=o(u),e(n,this,p)}}return Au=r,Au}var Lu,sh;function ow(){if(sh)return Lu;sh=1;function e(t){return function(){return t}}return Lu=e,Lu}var Ou,ih;function sw(){if(ih)return Ou;ih=1;var e=ow(),t=P_(),r=Na(),n=t?function(a,o){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(o),writable:!0})}:r;return Ou=n,Ou}var Ru,lh;function iw(){if(lh)return Ru;lh=1;var e=800,t=16,r=Date.now;function n(a){var o=0,s=0;return function(){var i=r(),l=t-(i-s);if(s=i,l>0){if(++o>=e)return arguments[0]}else o=0;return a.apply(void 0,arguments)}}return Ru=n,Ru}var vu,uh;function qy(){if(uh)return vu;uh=1;var e=sw(),t=iw(),r=t(e);return vu=r,vu}var ku,ch;function lw(){if(ch)return ku;ch=1;var e=nw(),t=Uy(),r=qy();function n(a){return r(t(a,void 0,e),a+"")}return ku=n,ku}var Pu,ph;function uw(){if(ph)return Pu;ph=1;var e=Fa(),t=My(),r=ew(),n=Fn(),a=ja(),o=rw(),s=lw(),i=pp(),l=1,u=2,p=4,d=s(function(f,m){var h={};if(f==null)return h;var _=!1;m=e(m,function(T){return T=n(T,f),_||(_=T.length>1),T}),a(f,i(f),h),_&&(h=t(h,l|u|p,o));for(var b=m.length;b--;)r(h,m[b]);return h});return Pu=d,Pu}var cw=uw();const pw=Ge(cw),pc="TOUCHED_PIPETTABLE_LABWARE";var Nu,dh;function dw(){if(dh)return Nu;dh=1;var e=Nc();function t(r,n){return e(r,n)}return Nu=t,Nu}var fw=dw();const mw=Ge(fw),Ho=e=>{const{node:t,stack:r=[],robotState:n,memo:a=new Map}=e;let o=r;if(!(typeof t=="object"&&"labwareId"in t))return o=[...r,t],a.set(t,o),{stack:o,memo:a};const{labwareId:s}=t,i=n.labware[s];if(i!=null&&i.stackedOnNode!=null){const{stack:l,memo:u}=Ho({node:i.stackedOnNode,stack:[...r,t],robotState:n,memo:a});Vy(a,u),o=l,a.set(t,o)}return{stack:o,memo:a}},hw=e=>{const{node:t,robotState:r,deckDef:n,deckConfiguration:a}=e,{stack:o}=Ho({node:t,robotState:r}),{cutoutFixtures:s}=n,i=o.find(l=>typeof l=="object"&&"addressableAreaName"in l);if(i!=null&&typeof i=="object"&&"addressableAreaName"in i){const{addressableAreaName:l}=i;for(const{id:u,providesAddressableAreas:p}of s){const[d]=Object.entries(p).find(([f,m])=>m.includes(l))??[];if(d!=null){const f=a.find(({cutoutId:T})=>T===d),{cutoutFixtureId:m,cutoutId:h}=f,_=m===u&&h===d,b=Object.entries(r.modules).find(([T,{slot:y}])=>c.FLEX_CUTOUT_BY_SLOT_ID[y]===h);if(_&&b!=null)return b[0]}}}return null},Vy=(e,t)=>{t.forEach((r,n)=>{e.set(n,r)})},_w=(e,t)=>e.some(r=>mw(r,t)),$y=e=>{const{labwareId:t,robotState:r}=e,n=new Map,a={labwareId:t};let o=[];for(const[s,{stackedOnNode:i}]of Object.entries(r.labware)){const l={labwareId:s};if(i==null)continue;let u;const p=n.get(l);if(p!=null)u=p;else{const{stack:d,memo:f}=Ho({node:l,robotState:r,memo:n});if(Vy(n,f),!_w(d,a))continue;n.set(l,d),u=d}u.length>o.length&&(o=u)}return o},By=e=>{const t=[],r=new Set;for(const n of Object.keys(e.labware)){if(r.has(n))continue;const a=$y({labwareId:n,robotState:e});a.forEach(o=>{typeof o=="object"&&"labwareId"in o&&r.add(o.labwareId)}),t.push(a)}return t},fp=e=>{const{moduleId:t,robotState:r,moduleEntities:n,deckDef:a}=e,o=r.modules[t],s=n[t];if(o==null||s==null)return null;const{slot:i}=o,{model:l}=s,u=c.getAddressableAreaNamesFromLoadedModule(l,i,a);return u.length===0?null:u[0]},yw=e=>{const{location:t,robotState:r,moduleEntities:n,deckDef:a}=e;if(t==="offDeck"||t==="systemLocation"||t==="wasteChuteLocation")return null;if("slotName"in t)return t.slotName;if("addressableAreaName"in t)return t.addressableAreaName;if("moduleId"in t){const{moduleId:o}=t;return fp({moduleId:o,robotState:r,moduleEntities:n,deckDef:a})}return null},xy=e=>{const{deckConfiguration:t,deckDefinition:r}=e;return t.reduce((n,{cutoutFixtureId:a,cutoutId:o})=>((r.cutoutFixtures.find(({id:i})=>a===i)?.providesAddressableAreas[o]??[]).forEach(i=>{n.add(i)}),n),new Set)},bw=e=>{const{robotState:t,deckConfiguration:r,deckDefinition:n,moduleEntities:a}=e,o=xy({deckConfiguration:r,deckDefinition:n}),s=new Set(o),i=By(t);for(const l of i){const u=np(l);if(typeof u=="object"&&"addressableAreaName"in u){const{addressableAreaName:p}=u;s.delete(p)}if(typeof u=="object"&&"slotName"in u){const{slotName:p}=u;s.delete(p)}if(typeof u=="object"&&"moduleId"in u){const{moduleId:p}=u,d=fp({moduleId:p,robotState:t,moduleEntities:a,deckDef:n});d!=null&&s.delete(d)}}return s},Tw=e=>{const t=e.toLowerCase();return t.includes("chute")||t.includes("waste")||t.startsWith("gripper")||t==="96channelwastechute"},Hy=e=>{const{stack:t,subjectLabwareId:r,moduleEntities:n,labwareEntityIds:a,modules:o}=e;if(t.length===0||t[0]!==r||t.length<2)return;const s=t[1];if(s===et){const u=t[2];return u==null?void 0:{kind:"inStackerHopper",moduleId:u}}if(n[s]!=null)return{moduleId:s};if(a.has(s))return{labwareId:s};if(s==="offDeck")return"offDeck";if(s==="systemLocation")return"systemLocation";if(s==="wasteChuteLocation")return"wasteChuteLocation";if(Tw(s))return{addressableAreaName:s};const i=Iy(s,o,n)??s;if(Object.entries(o).some(([u,p])=>n[u]?.type===c.FLEX_STACKER_MODULE_TYPE&&p.slot===i)){const u=Fo(i);if(u!=null)return{addressableAreaName:u}}return{slotName:s}},Iw=e=>typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="inStackerHopper",Ew=e=>typeof e!="object"||e===null?!1:!Iw(e),gw=(e,t)=>{const{id:r,def:n}=e,{id:a,def:o}=t,s=n.dimensions.xDimension,i=n.dimensions.yDimension,l=o.dimensions.xDimension,u=o.dimensions.yDimension;return s>l&&i>u?{containerLabwareId:r,containedLabwareId:a}:l>s&&u>i?{containerLabwareId:a,containedLabwareId:r}:null},mp=(e,t)=>{const r=new Map;for(const a of Object.keys(e)){const o=e[a].stackedOnNode;if(o==null||!Ew(o))continue;const s=JSON.stringify(o),i=r.get(s)??[];i.push(a),r.set(s,i)}const n={};for(const a of r.values()){if(a.length!==2)continue;const[o,s]=a,i=t[o],l=t[s];if(i==null||l==null)continue;const u=gw(i,l);if(u==null)continue;const{containerLabwareId:p,containedLabwareId:d}=u;n[p]=d}return Object.keys(n).length===0?e:ar(e,(a,o)=>n[o]!=null?{...a,contains:n[o]}:a)},ww=(e,t,r)=>{const n=Object.keys(e.labware),a=new Set(n);let o=ar(e.labware,(s,i)=>{const l=s.stackedOnNode??Hy({stack:s.stack,subjectLabwareId:i,moduleEntities:t,labwareEntityIds:a,modules:e.modules});return l!=null?{...s,stackedOnNode:l}:{...s}});return o=mp(o,r),{...e,labware:o}};function Sw(e,t,r){const{labwareId:n,newLocation:a}=e,{robotState:o}=r,{labwareEntities:s}=t,{modules:i,labware:l}=o;if(l[n]==null)return;const u=K(l[n].stack),p=Uo(l,u,n),d=p.indexOf(n),f=p.slice(0,d+1),m=c.getIsLid(s[n].def);let h=!1;const _=Object.entries(i).find(([S,{slot:g}])=>{const{type:k}=t.moduleEntities[S]??{};return k===c.FLEX_STACKER_MODULE_TYPE&&g===u})??null,b=_!=null&&_[1].moduleState.type===c.FLEX_STACKER_MODULE_TYPE?tr.map(S=>_[1].moduleState.labwareOnShuttle?.[S]).filter(S=>S!=null):[],T=b.includes(n)?b.slice(0,b.indexOf(n)+1):[];if(_!=null&&_[1].moduleState.type===c.FLEX_STACKER_MODULE_TYPE){const S=_[1].moduleState,g=tr.findIndex(k=>S.labwareOnShuttle?.[k]===n);if(g!==-1&&S.labwareOnShuttle!=null)for(const k of tr.slice(g,tr.length))if(k==="primaryLabwareId"){S.labwareOnShuttle=null;break}else S.labwareOnShuttle[k]=null}const y=Object.entries(i).find(([S,{slot:g}])=>{const{type:k}=t.moduleEntities[S]??{};return k===c.FLEX_STACKER_MODULE_TYPE&&typeof a=="object"&&("moduleId"in a&&a.moduleId===S||"slotName"in a&&g===a.slotName)})??null,[I,w]=y??[];if(I!=null&&w!=null){const S=T.length>0?T:ba({slot:u,labwareState:l,modulesState:i}),g=S.indexOf(n),k=w.moduleState;if(g!==-1){const v=S.slice(0,g+1).toReversed();if(k.labwareOnShuttle==null&&(k.labwareOnShuttle={primaryLabwareId:"",adapterLabwareId:null,lidLabwareId:null}),v.length===3)for(let D=0;D<tr.length;D++){const q=tr[D];k.labwareOnShuttle[q]=v[D]}else if(v.length===2){const D=v.some(q=>t.labwareEntities[q].def.allowedRoles?.some(Q=>Q==="lid"))?["primaryLabwareId","lidLabwareId"]:["adapterLabwareId","primaryLabwareId"];for(let q=0;q<D.length;q++){const Q=D[q];k.labwareOnShuttle[Q]=v[q]}}else v.length===1&&(k.labwareOnShuttle.primaryLabwareId=v[0])}}const E=[];if(c.locationIsOffDeck(a))E.push(a);else if("moduleId"in a)if(i[a.moduleId].moduleState.type===c.FLEX_STACKER_MODULE_TYPE)E.push(i[a.moduleId].slot);else if(t.moduleEntities[a.moduleId]?.type===c.VACUUM_MODULE_TYPE){const S=i[a.moduleId].slot,g=ba({slot:S,labwareState:l,modulesState:i});g.length>0?E.push(...g):E.push(a.moduleId,S)}else E.push(a.moduleId,i[a.moduleId].slot);else if("slotName"in a){const{slotName:S}=a;S in l?(h=c.getIsPipettableLabware(s[S].def),E.push(...l[S].stack)):E.push(S)}else if("labwareId"in a){const S=a.labwareId;h=c.getIsPipettableLabware(s[S].def);const g=l[S].stack;E.push(...g)}else if("addressableAreaName"in a)if(Ia(a.addressableAreaName)){const S=Object.entries(i).find(([g])=>t.moduleEntities[g]?.type===c.VACUUM_MODULE_TYPE)?.[0];E.push(Ic),S!=null&&E.push(S),E.push(a.addressableAreaName)}else E.push(a.addressableAreaName);f.forEach((S,g)=>{if(l[S]!=null){const k=f.slice(g+1);o.labware[S]={...o.labware[S],stack:[S,...k,...E],...m&&h?{sterility:pc}:{}}}});const A=typeof a=="object"&&"labwareId"in a&&c.getIsPipettableLabware(s[a.labwareId].def);let L=a;if(typeof a=="object"&&a!==null&&"moduleId"in a&&i[a.moduleId].moduleState.type===c.FLEX_STACKER_MODULE_TYPE){const S=Fo(i[a.moduleId].slot);S!=null&&(L={addressableAreaName:S})}else if(typeof a=="object"&&a!==null&&"moduleId"in a&&t.moduleEntities[a.moduleId]?.type===c.VACUUM_MODULE_TYPE){const S=i[a.moduleId].slot,g=ba({slot:S,labwareState:l,modulesState:i}),k=g.length>0?g[0]:null;k!=null&&k in s&&(L={labwareId:k})}o.labware[n].stackedOnNode=L,A&&(o.labware[n].sterility=pc),o.labware=mp(ar(o.labware,S=>pw(S,"contains")),s)}function Aw(e,t,r){const{pipetteId:n,addressableAreaName:a}=e,{wasteChuteEntities:o,trashBinEntities:s}=t,i=c.WASTE_CHUTE_ADDRESSABLE_AREAS.includes(a),l=Object.values(s).find(d=>d.location===cy(a))?.id,u=i?Object.values(o)[0].id:l,{robotState:p}=r;p.pipettes[n]={...p.pipettes[n],entityId:u}}function Lw(e,t,r){const{pipetteId:n,labwareId:a,wellName:o}=e,{robotState:s}=r;s.pipettes[n]={...s.pipettes[n],entityId:a,wellName:o}}function Ow(e,t,r){const{pipetteId:n,labwareId:a,wellName:o}=e,s=t.pipetteEntities[n].spec,i=t.labwareEntities[a].def;if(!c.getIsTiprack(i))throw new Error(`forPickUpTip expected ${a} to be a tiprack`);const l=r.robotState.tipState,u=r.robotState.pipettes[n].nozzles,p=r.robotState.pipettes[n].primaryNozzle,d=yp(u,s),f=(_,b)=>_.find(T=>T.includes(b)),m=(_,b)=>{const T=_.findIndex(I=>I.includes(b));if(T===-1)return null;const y=_[T].indexOf(b);return _.map(I=>I[y])},h=(_,b)=>{const T=c.PARTIAL_NOZZLE_MAP[p],y=_.findIndex(L=>L.includes(b)),I=_[y].indexOf(b),w=_[y];if(w.length-I<T){const L=w.length-T;return w.slice(L,w.length)}const A=I+T;return w.slice(I,Math.min(A,w.length))};if(l.pipettes[n].hasTip=!0,l.pipettes[n].tiprackURI=a,d===c.SINGLE)l.tipracks[a][o]=de;else if(d===c.PARTIAL_COLUMN&&p){const _=h(i.ordering,o);_==null?console.error(`Invalid primary well for tip pick up for partial config: ${o}`):_.forEach(function(b){l.tipracks[a][b]=de})}else if(d===c.COLUMN){const _=f(i.ordering,o);_==null&&console.error(`Invalid primary well for tip pickup: ${o}`),_?.forEach(function(b){l.tipracks[a][b]=de})}else if(d===c.ROW){const _=m(i.ordering,o);_==null&&console.error("Invalid primary well for tip pickup: "+o),_?.forEach(function(b){l.tipracks[a][b]=de})}else if(d===c.ALL)if(s.channels===96)i.ordering.reduce((b,T)=>b.concat(T),[]).forEach(function(b){l.tipracks[a][b]=de});else{const _=f(i.ordering,o);_==null&&console.error(`Invalid primary well for tip pickup: ${o}`),_?.forEach(function(b){l.tipracks[a][b]=de})}else if(s.channels===1)l.tipracks[a][o]=de;else if(s.channels===96)i.ordering.reduce((b,T)=>b.concat(T),[]).forEach(function(b){l.tipracks[a][b]=de});else{const _=f(i.ordering,o);_==null&&console.error(`Invalid primary well for tip pickup: ${o}`),_?.forEach(function(b){l.tipracks[a][b]=de})}r.robotState.pipettes[n].tiprackId=a,r.robotState.pipettes[n].tipWell=o}const Rw={clean:Da,empty:de,used:er};function vw(e,t,r){const{labwareId:n,wellNames:a,tipWellState:o="clean"}=e,s=Rw[o],i=r.robotState.tipState.tipracks[n];i!=null&&a.forEach(l=>{i[l]=s})}const Yr=(e,t)=>{const r=vt(e,t);return r.type===c.THERMOCYCLER_MODULE_TYPE?r:(console.error(`Thermocycler state updater expected ${t} moduleState to be thermocycler, but it was ${r.type}`),{})},kw=(e,t,r)=>{const{moduleId:n,celsius:a}=e,{robotState:o}=r,s=Yr(o,n);s.currentBlockActivity={type:"blockTargetTemp",blockTargetTemp:a}},Pw=(e,t,r)=>{const{moduleId:n,celsius:a}=e,{robotState:o}=r,s=Yr(o,n);s.lidTargetTemp=a},Nw=(e,t,r)=>{},Cw=(e,t,r)=>{},Dw=(e,t,r)=>{},Mw=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,o=Yr(a,n);o.currentBlockActivity={type:"blockDeactivated"}},Fw=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,o=Yr(a,n);o.lidTargetTemp=null},Uw=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,o=Yr(a,n);o.lidOpen=!1},qw=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,o=Yr(a,n);o.lidOpen=!0},Vw=(e,t,r)=>{const{profile:n,...a}=e;zy({profileElements:n,...a},t,r)},zy=(e,t,r)=>{const n=NaN+M();jy({...e,taskId:n},t,r),Gy(n,r,c.THERMOCYCLER_MODULE_TYPE)},jy=(e,t,r)=>{const{moduleId:n,taskId:a,profileElements:o}=e,{robotState:s}=r,i=Yr(s,n);i.currentBlockActivity={type:"profile",profileElements:o,taskId:a??null},i.numProfilesStarted++},$w=e=>{if(e.currentBlockActivity.type==="profile"){const t=Bw(e.currentBlockActivity.profileElements);return e.currentBlockActivity=t!=null?{type:"blockTargetTemp",blockTargetTemp:t}:{type:"blockDeactivated"},!0}else return!1};function Bw(e){const t=np(Ip(e));return t!=null?t.celsius:null}const xw=(e,t)=>{const[r,n]=[e.ordering,t.ordering];if(r.length!==n.length)return!1;for(let a=0;a<r.length;a++){const[o,s]=[r[a],n[a]];if(o.length!==s.length)return!1}return!0},hp=(e,t,r)=>{const{labware:n,liquidState:a}=t,s=Uo(n,e).filter(i=>i in r&&c.getIsPipettableLabware(r[i].def));if(s.length===1){const i=a.labware[s[0]];Object.entries(i).forEach(([l,u])=>{i[l]={}});return}if(s.length===2){const i=s[0],l=s[1];if(!xw(r[i].def,r[l].def))return;const u=a.labware[i],p=a.labware[l];Object.entries(p).forEach(([d,f])=>{const m=u[d];Object.entries(m).forEach(([h,{volume:_}])=>{f[h]={volume:h in f?f[h].volume+_:_}}),u[d]={}})}},Hw=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,o=ut(a,n);o!=null&&(o.ventStatus=Ec)},zw=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,o=ut(a,n);o!=null&&(o.ventStatus=Ma)},jw=(e,t,r)=>{const{moduleId:n,gaugePressure:a,duration:o,ventAfter:s=!0,taskId:i}=e,{robotState:l}=r,{labwareEntities:u}=t,p=ut(l,n);p!=null&&(hp(n,l,u),o==null||i==null?p.currentPumpActivity={type:"indefiniteHold",mode:Ju,targetPressure:a}:(p.currentPumpActivity={type:"timedHold",mode:Ju,targetPressure:a,durationSeconds:o,taskId:i,ventAfter:s},p.numPumpActivitiesStarted++),p.ventStatus=Ma)},Gw=(e,t,r)=>{const{moduleId:n,percentPower:a,duration:o,ventAfter:s=!0,taskId:i}=e,{robotState:l}=r,{labwareEntities:u}=t,p=ut(l,n);p!=null&&(hp(n,l,u),o==null||i==null?p.currentPumpActivity={type:"indefiniteHold",mode:Qu,targetPower:a}:(p.currentPumpActivity={type:"timedHold",mode:Qu,targetPower:a,durationSeconds:o,taskId:i,ventAfter:s},p.numPumpActivitiesStarted++),p.ventStatus=Ma)},Ww=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,o=ut(a,n);o!=null&&(o.currentPumpActivity={type:"pumpDeactivated"})},Yw=(e,t,r)=>{const{moduleId:n,steps:a,taskId:o,ventAfter:s=!0}=e,{robotState:i}=r,{labwareEntities:l}=t,u=ut(i,n);u==null||o==null||(hp(n,i,l),u.currentPumpActivity={type:"profile",profileElements:a,taskId:o,ventAfter:s},u.numPumpActivitiesStarted++)},Kw=e=>{if(e.currentPumpActivity.type==="timedHold"||e.currentPumpActivity.type==="profile"){const t=e.currentPumpActivity.ventAfter;return e.currentPumpActivity={type:"pumpDeactivated"},e.ventStatus=t?Ec:Ma,!0}return!1};function Zw(e,t,r){for(const n of e.task_ids)Gy(n,r)||r.warnings.push(wE())}const Gy=(e,t,r)=>{const{robotState:n}=t,a=Object.values(n.modules).find(o=>{if(r&&o.moduleState.type!==r)return!1;const s=o.moduleState.type==="thermocyclerModuleType"&&o.moduleState.currentBlockActivity.type==="profile"&&o.moduleState.currentBlockActivity.taskId===e,i=o.moduleState.type==="vacuumModuleType"&&(o.moduleState.currentPumpActivity.type==="timedHold"||o.moduleState.currentPumpActivity.type==="profile")&&o.moduleState.currentPumpActivity.taskId===e;return s||i});return a==null?!1:a.moduleState.type==="thermocyclerModuleType"?$w(a.moduleState):a.moduleState.type==="vacuumModuleType"?Kw(a.moduleState):(console.log(`unexpected module type with task: ${a.moduleState.type}`),!1)},xn=(e,t)=>{const r=vt(e,t);return r.type===c.HEATERSHAKER_MODULE_TYPE?r:(console.error(`Heater-Shaker state updater expected ${t} moduleState to be heaterShaker, but it was ${r.type}`),{})},Xw=(e,t,r)=>{const{robotState:n}=r,{moduleId:a,celsius:o}=e,s=xn(n,a);s.targetTemp=o},Qw=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,o=xn(n,a);o.targetTemp=null},Jw=(e,t,r)=>{const{robotState:n}=r,{moduleId:a,rpm:o}=e,s=xn(n,a);s.targetSpeed=o},eS=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,o=xn(n,a);o.targetSpeed=null},tS=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,o=xn(n,a);o.latchOpen=!0},rS=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,o=xn(n,a);o.latchOpen=!1},nS=(e,t,r)=>{const{pipetteId:n}=e,{robotState:a}=r,o=a.pipettes[n].entityId??"";xo({invariantContext:t,pipetteId:n,prevLiquidState:a.liquidState,useFullVolume:!0,robotStateAndWarnings:r,entityId:o})},aS=(e,t,r)=>{const{pipetteId:n}=e,{robotState:a}=r,o=a.pipettes[n].entityId??"";a.tipState.pipettes[n]={hasTip:!1,tiprackURI:null},xo({invariantContext:t,prevLiquidState:a.liquidState,pipetteId:n,useFullVolume:!0,robotStateAndWarnings:r,entityId:o}),a.pipettes[n].tiprackId=void 0};function Wy(e,t){e.type===c.MAGNETIC_MODULE_TYPE&&(e.engaged=t)}function oS(e,t,r){const{moduleId:n}=e,{robotState:a}=r,o=vt(a,n);Wy(o,!0)}function sS(e,t,r){const{moduleId:n}=e,{robotState:a}=r,o=vt(a,n);Wy(o,!1)}const Cu=(e,t)=>{if(t==null)return console.error("expected to find defURI but could not in getLabwareByDefURI"),null;const r=e.findIndex(a=>a.labwareDefURI===t);if(r===-1)return null;const[n]=e.splice(r,1);return n.id},Yy=(e,t,r,n)=>{const a=e.labwareInHopper??[];t.forEach(o=>{const{primaryLabwareId:s,adapterLabwareId:i,lidLabwareId:l}=o;r.labware[s]={stack:[s,...l!=null?[l]:[],...n]},i!=null&&(r.labware[i]={stack:[i,s,...l!=null?[l]:[],...n]}),l!=null&&(r.labware[l]={stack:[l,...n]}),a.push({primaryLabwareId:s,adapterLabwareId:i??null,lidLabwareId:l??null})}),e.labwareInHopper=a},Ky=(e,t,r,n,a,o,s,i)=>{const u=Object.entries(e.labware).filter(([d,f])=>f[o]===t[o]).map(([d])=>d).map(d=>r[d]),p=[];for(let d=0;d<n;d++){const f=Cu(u,t.storedLabwareDetails?.primaryLabwareURI),m=s!=null?Cu(u,t.storedLabwareDetails?.adapterLabwareURI):null,h=i!=null?Cu(u,t.storedLabwareDetails?.lidLabwareURI):null;f!=null&&(e.labware[f]={stack:[f,...h!=null?[h]:[],...a]},m!=null&&(e.labware[m]={stack:[m,f,...h!=null?[h]:[],...a]}),h!=null&&(e.labware[h]={stack:[h,...a]}),p.push({primaryLabwareId:f,adapterLabwareId:m,lidLabwareId:h})),t.labwareInHopper=p}},iS=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,o=Object.entries(n.labware).filter(([,i])=>i.stack.includes(et)&&i.stack.includes(a)),s=_t(n,a);s!=null&&s.labwareInHopper!=null&&(e.count!=null?s.labwareInHopper=s.labwareInHopper.slice(0,e.count):s.labwareInHopper=[]),o.forEach(([i])=>{n.labware[i]={...n.labware[i],stack:[i,c.SYSTEM_LOCATION]}})},lS=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:a}=t,{moduleId:o,labware:s}=e,i=n.modules[o].slot,l=_t(n,o);if(l==null||l.storedLabwareDetails==null)return;const{primaryLabwareURI:u,adapterLabwareURI:p,lidLabwareURI:d}=l.storedLabwareDetails,f=[];for(const b of s){const T=a[b].labwareDefURI;if(T===u)f.push({primaryLabwareId:b,adapterLabwareId:null,lidLabwareId:null});else if(T===p){const y=f[f.length-1];y&&(y.adapterLabwareId=b)}else if(T===d){const y=f[f.length-1];y&&(y.lidLabwareId=b)}}const m=[et,o,i];for(const b of f){const T=[b.adapterLabwareId,b.primaryLabwareId,b.lidLabwareId,...m].filter(I=>I!=null);n.labware[b.primaryLabwareId]={...n.labware[b.primaryLabwareId],stack:T.slice(T.indexOf(b.primaryLabwareId))},b.adapterLabwareId!=null&&(n.labware[b.adapterLabwareId]={...n.labware[b.adapterLabwareId],stack:T.slice(T.indexOf(b.adapterLabwareId))}),b.lidLabwareId!=null&&(n.labware[b.lidLabwareId]={...n.labware[b.lidLabwareId],stack:T.slice(T.indexOf(b.lidLabwareId))});let y=null;for(const I of T)a[I]!=null&&(y==null?n.labware[I].stackedOnNode={kind:"inStackerHopper",moduleId:o}:n.labware[I].stackedOnNode={labwareId:y},y=I)}const h=l.labwareInHopper??[],_=f.map(({primaryLabwareId:b,adapterLabwareId:T,lidLabwareId:y})=>({primaryLabwareId:b,adapterLabwareId:T,lidLabwareId:y}));l.labwareInHopper=[...h,..._]},uS=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:a}=t,{moduleId:o,primaryLabware:s,initialCount:i,adapterLabware:l,lidLabware:u,initialStoredLabware:p}=e,d=n.modules[o].slot,f=_t(n,o),m=[et,o,d];f!=null&&(f.storedLabwareDetails={primaryLabwareURI:`${s.namespace}/${s.loadName}/${s.version}`,adapterLabwareURI:l!=null?`${l.namespace}/${l.loadName}/${l.version}`:null,lidLabwareURI:u!=null?`${u.namespace}/${u.loadName}/${u.version}`:null},i!=null?Ky(n,f,a,i,m,"setStoredLabwareCount",l?.loadName,u?.loadName):p!=null&&Yy(f,p,n,m),f.setStoredLabwareCount=(f?.setStoredLabwareCount??0)+1)},cS=(e,t,r)=>{const{robotState:n}=r,{moduleId:a,labware:o}=e,{labwareEntities:s}=t,i=n.modules[a].slot,l=_t(n,a);if(l==null)return;const u=o.map(E=>E.split(":")[1]),p=new Set(u),d=Array.from(p),f=d.find(E=>Object.values(s).find(A=>A.labwareDefURI===E&&!A.def.allowedRoles?.includes("lid")&&!A.def.allowedRoles?.includes("adapter"))),m=d.find(E=>Object.values(s).find(A=>A.labwareDefURI===E&&A.def.allowedRoles?.includes("adapter"))),h=d.find(E=>Object.values(s).find(A=>A.labwareDefURI===E&&A.def.allowedRoles?.includes("lid")));if(f==null)throw new Error(`expected to find primaryLabwareURI for storedLabwareDetails but could not with labware ${o}`);l.storedLabwareDetails={primaryLabwareURI:f,adapterLabwareURI:m??null,lidLabwareURI:h??null};const _=[];for(const E of o){const A=s[E].labwareDefURI;if(A===f)_.push({primary:E,adapter:null,lid:null});else if(A===m){const L=_[_.length-1];L&&(L.adapter=E)}else if(A===h){const L=_[_.length-1];L&&(L.lid=E)}}const b=[et,a,i];for(const E of _){const A=[E.adapter,E.primary,E.lid,...b].filter(L=>L!=null);n.labware[E.primary]={...n.labware[E.primary],stack:A.slice(A.indexOf(E.primary))},E.adapter!=null&&(n.labware[E.adapter]={...n.labware[E.adapter],stack:A.slice(A.indexOf(E.adapter))}),E.lid!=null&&(n.labware[E.lid]={...n.labware[E.lid],stack:A.slice(A.indexOf(E.lid))})}const T=l.labwareInHopper??[],y=_.map(E=>({primaryLabwareId:E.primary,adapterLabwareId:E.adapter,lidLabwareId:E.lid})),I=new Map(T.map(E=>[E.primaryLabwareId,E])),w=[];for(const E of y)w.push(E),I.delete(E.primaryLabwareId);for(const E of T)I.has(E.primaryLabwareId)&&w.push(E);l.labwareInHopper=w},pS=(e,t,r)=>{const{robotState:n}=r,{moduleId:a,count:o,labwareToStore:s}=e,{labwareEntities:i}=t,l=n.modules[a].slot,u=_t(n,a),p=[et,a,l];if(u!=null){const d=u.storedLabwareDetails?.adapterLabwareURI,f=u.storedLabwareDetails?.lidLabwareURI;o!=null?Ky(n,u,i,o,p,"fillCount",d,f):s!=null&&Yy(u,s,n,p),u.fillCount=(u?.fillCount??0)+1}},dS=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,o=_t(n,a),s=n.modules[a].slot;if(o!=null){const{labwareInHopper:i,labwareOnShuttle:l}=o;if(i!=null&&i.length>0&&l==null){const u=i[0];o.labwareOnShuttle=u,i.shift();const p=[s];let d=null;for(const f of tr){const m=u[f];if(m!=null){if(p.unshift(m),n.labware[m].stack=[...p],d==null){const h=Fo(s);h!=null?n.labware[m].stackedOnNode={addressableAreaName:h}:console.warn(`Could not find an addressable area for retrieved labware in stacker module ${a} at slot ${s}`)}else n.labware[m].stackedOnNode={labwareId:d};d=m}}}}},fS=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,o=_t(n,a),s=n.modules[a].slot;if(o!=null){const{labwareOnShuttle:i}=o;if(i!=null){o.labwareInHopper=[i,...o.labwareInHopper??[]],o.labwareOnShuttle=null;let l=null;for(const u of tr){const p=i[u];p!=null&&(n.labware[p].stack=[p,et,a,s],l==null?(n.labware[p].stackedOnNode={kind:"inStackerHopper",moduleId:a},l=p):n.labware[p].stackedOnNode={labwareId:l})}o.storedLabwareDetails==null&&(o.storedLabwareDetails={primaryLabwareURI:t.labwareEntities[i.primaryLabwareId].labwareDefURI,adapterLabwareURI:i.adapterLabwareId!=null?t.labwareEntities[i.adapterLabwareId].labwareDefURI:null,lidLabwareURI:i.lidLabwareId!=null?t.labwareEntities[i.lidLabwareId].labwareDefURI:null})}}};function Zy(e,t,r){e.type===c.TEMPERATURE_MODULE_TYPE&&(e.targetTemperature=t,e.status=r)}function mS(e,t,r){const{robotState:n}=r,{moduleId:a,celsius:o}=e,s=vt(n,a);Zy(s,o,bc)}function hS(e,t,r){const{robotState:n}=r,{moduleId:a,celsius:o}=e,s=vt(n,a);s.type===c.TEMPERATURE_MODULE_TYPE&&o===s.targetTemperature&&(s.status=yc)}function _S(e,t,r){const{robotState:n}=r,{moduleId:a}=e,o=vt(n,a);Zy(o,null,Ca)}function Xy(e,t,r){if(!e)throw new Error("undefined command passed to getNextRobotStateAndWarning");switch(e.commandType){case"aspirateWhileTracking":case"aspirate":case"aspirateInPlace":if(e.meta?.isAirGap===!0)break;Lg(e.params,t,r);break;case"airGapInPlace":pg(e.params,t,r);break;case"dispenseWhileTracking":case"dispense":case"dispenseInPlace":if(e.meta?.isAirGap===!0)break;vg(e.params,t,r);break;case"blowout":Og(e.params,t,r);break;case"dropTip":kg(e.params,t,r);break;case"pickUpTip":Ow(e.params,t,r);break;case"setTipState":vw(e.params,t,r);break;case"magneticModule/engage":oS(e.params,t,r);break;case"magneticModule/disengage":sS(e.params,t,r);break;case"moveLabware":Sw(e.params,t,r);break;case"waitForTasks":Zw(e.params,t,r);break;case"flexStacker/setStoredLabware":uS(e.params,t,r);break;case"flexStacker/setStoredLabwareItems":cS(e.params,t,r);break;case"flexStacker/prepareShuttle":case"flexStacker/closeLatch":case"flexStacker/openLatch":break;case"flexStacker/empty":iS(e.params,t,r);break;case"flexStacker/fill":pS(e.params,t,r);break;case"flexStacker/fillItems":lS(e.params,t,r);break;case"flexStacker/retrieve":dS(e.params,t,r);break;case"flexStacker/store":fS(e.params,t,r);break;case"setRailLights":case"touchTip":case"configureForVolume":case"loadPipette":case"loadLabware":case"loadModule":case"home":case"moveRelative":case"moveToSlot":case"moveToCoordinates":case"savePosition":case"waitForResume":case"waitForDuration":case"pause":case"delay":case"custom":case"comment":case"captureImage":case"prepareToAspirate":case"liquidProbe":case"loadLiquidClass":case"loadLidStack":case"loadLid":case"getTipPresence":case"identifyModule":case"getNextTip":case"retractAxis":case"sealPipetteToTip":case"tryLiquidProbe":case"unsealPipetteFromTip":case"verifyTipPresence":case"pressureDispense":case"createTimer":break;case"moveToAddressableArea":case"moveToAddressableAreaForDropTip":Aw(e.params,t,r);break;case"moveToWell":Lw(e.params,t,r);break;case"loadLiquid":Pg(e.params,t,r);break;case"dropTipInPlace":aS(e.params,t,r);break;case"blowOutInPlace":nS(e.params,t,r);break;case"configureNozzleLayout":Rg(e.params,t,r);break;case"temperatureModule/setTargetTemperature":mS(e.params,t,r);break;case"temperatureModule/deactivate":_S(e.params,t,r);break;case"temperatureModule/waitForTemperature":hS(e.params,t,r);break;case"thermocycler/setTargetBlockTemperature":kw(e.params,t,r);break;case"thermocycler/setTargetLidTemperature":Pw(e.params,t,r);break;case"thermocycler/waitForBlockTemperature":Nw(e.params);break;case"thermocycler/waitForLidTemperature":Cw(e.params);break;case"thermocycler/deactivateBlock":Mw(e.params,t,r);break;case"thermocycler/deactivateLid":Fw(e.params,t,r);break;case"thermocycler/closeLid":Uw(e.params,t,r);break;case"thermocycler/openLid":qw(e.params,t,r);break;case"thermocycler/runProfile":Vw(e.params,t,r);break;case"thermocycler/runExtendedProfile":zy(e.params,t,r);break;case"thermocycler/startRunExtendedProfile":jy(e.params,t,r);break;case"thermocycler/awaitProfileComplete":Dw(e.params);break;case"heaterShaker/deactivateHeater":Qw(e.params,t,r);break;case"heaterShaker/setTargetTemperature":Xw(e.params,t,r);break;case"heaterShaker/setAndWaitForShakeSpeed":case"heaterShaker/setShakeSpeed":Jw(e.params,t,r);break;case"heaterShaker/deactivateShaker":eS(e.params,t,r);break;case"heaterShaker/openLabwareLatch":tS(e.params,t,r);break;case"heaterShaker/closeLabwareLatch":rS(e.params,t,r);break;case"heaterShaker/waitForTemperature":break;case"absorbanceReader/openLid":lg(e.params,t,r);break;case"absorbanceReader/closeLid":ug(e.params,t,r);break;case"absorbanceReader/initialize":cg(e.params,t,r);break;case"absorbanceReader/read":break;case"vacuumModule/startSetVacuumPressure":jw(e.params,t,r);break;case"vacuumModule/startSetVacuumPower":Gw(e.params,t,r);break;case"vacuumModule/openVent":Hw(e.params,t,r);break;case"vacuumModule/closeVent":zw(e.params,t,r);break;case"vacuumModule/stopVacuum":Ww(e.params,t,r);break;case"vacuumModule/startRunProfile":Yw(e.params,t,r);break;default:console.error(`unknown command: ${e.commandType} passed to getNextRobotStateAndWarning`)}}function Qy(e,t,r){return Ny({warnings:[],robotState:r},a=>{Xy(e,t,a)})}function _p(e,t,r){const n=Cy(e);return Ny({warnings:[],robotState:r},o=>{n.forEach(s=>{Xy(s,t,o)})})}const yS=(e,t,r)=>{const n=e.reduce((a,o,s)=>{const i=a.timeline.length===0?r:np(a.timeline).robotState;if(a.errors!=null)return a;const l=o(t,i);if("errors"in l)return{timeline:a.timeline,errors:l.errors};const p=Cy(l.commands).reduce((f,m)=>Qy(m,t,f.robotState),{robotState:i,warnings:[]}),d={commands:l.commands,robotState:p.robotState,warnings:l.warnings,stepInfo:{stepNumber:l.stepNumber,name:l.name,description:l.description},python:l.python};return{timeline:[...a.timeline,d],errors:null}},{timeline:[],errors:null});return{timeline:n.timeline,errors:n.errors}},Hn=(e,t)=>{const r=t[e]?.stack;return r!=null?K(r):""},zn=e=>{if(e.type===c.VACUUM_MODULE_TYPE){const t=e;return t.currentPumpActivity.type==="timedHold"||t.currentPumpActivity.type==="profile"}if(e.type===c.THERMOCYCLER_MODULE_TYPE){const t=e;return t.currentBlockActivity.type==="profile"||t.currentBlockActivity.type==="blockTargetTemp"}return!1},jn=e=>{const{pipette:t,labware:r,invariantContext:n,prevRobotState:a}=e;if(n.config.OT_PD_DISABLE_MODULE_RESTRICTIONS)return!1;const o=t?n.pipetteEntities[t]:null,s=r?K(a.labware[r]?.stack):null;if(!t||!r||!o||!s)return!1;const i=Object.keys(n.moduleEntities).some(l=>{const u=n.moduleEntities[l].model;if(Hh.includes(u)){const p=a.modules[l]?.slot;return p==="1"&&s==="4"||p==="3"&&s==="6"}else return!1});return c.GEN_ONE_MULTI_PIPETTES.includes(o.name)&&i},le=(e,t,r)=>{const n=e.reduce((a,o)=>{if(a.errors.length>0)return a;const s=o(t,a.robotState);if("errors"in s)return{robotState:a.robotState,commands:a.commands,errors:s.errors,warnings:a.warnings};const i=[...a.commands,...s.commands],l=[...a.python?[a.python]:[],...s.python?[s.python]:[]].join(`
55
- `),u=_p(s.commands,t,a.robotState);return{...a,robotState:u.robotState,commands:i,warnings:[...a.warnings||[],...s.warnings||[],...u.warnings],...l&&{python:l}}},{robotState:r,commands:[],errors:[],warnings:[]});return n.errors.length>0?{errors:n.errors}:{commands:n.commands,warnings:n.warnings,...n.python&&{python:n.python}}},Ga=(e,t,r)=>{const n=xa(e,t[r]?.stack),a=n&&e[n].moduleState;return!!(a&&a.type===c.THERMOCYCLER_MODULE_TYPE&&a.lidOpen!==!0)},bS=e=>e.commandCreatorFnName!=="delay"&&e.commandCreatorFnName!=="engageMagnet"&&e.commandCreatorFnName!=="disengageMagnet"&&e.commandCreatorFnName!=="setTemperature"&&e.commandCreatorFnName!=="deactivateTemperature"&&"pipette"in e?e.pipette:null,TS=e=>e.commandCreatorFnName==="delay"||e.commandCreatorFnName==="engageMagnet"||e.commandCreatorFnName==="disengageMagnet"||e.commandCreatorFnName==="setTemperature"||e.commandCreatorFnName==="deactivateTemperature",IS=new Date("2025-03-19T00:00:00Z"),ES=2,gS=22;function wS(e,t,r){const{labware:n,modules:a,pipettes:o,commands:s,liquids:i}=e,l=t.protocolType==="python"?t.apiVersion:null,u=l!=null&&l[0]>=ES&&l[1]>=gS,p=t.protocolType==="json"&&r>=IS,d=c.getLabwareDefinitionsByURIForProtocol(s),f=i.reduce((y,I)=>{const{id:w,description:E,displayName:A,displayColor:L}=I;return{...y,[w]:{description:E,displayName:A??"Unknown Liquid",pythonName:"n/a",displayColor:L??"#B7B8B9",liquidGroupId:w}}},{}),m=a.reduce((y,I)=>{const{id:w,model:E}=I;return{...y,[w]:{id:w,type:c.getModuleType(E),model:E,pythonName:"n/a"}}},{}),h=n.reduce((y,I)=>{const{id:w,definitionUri:E}=I,A=d[E];return A==null||A.schemaVersion===3?y:{...y,[w]:{id:w,labwareDefURI:E,def:A,pythonName:"n/a"}}},{}),_=s.reduce((y,I)=>{if(I.commandType==="loadLidStack"&&I.result!=null){const{stackLabwareId:w,lidStackDefinition:E}=I.result;if(w!=null&&E!=null&&y[w]==null&&E.schemaVersion!==3)return{...y,[w]:{id:w,labwareDefURI:c.getLabwareDefURI(E),def:E,pythonName:"n/a"}}}return y},h),b=o.reduce((y,I)=>{const{id:w,pipetteName:E}=I,A=c.getPipetteSpecsV2(E),S=s.filter(v=>v.commandType==="pickUpTip"&&v.params.pipetteId===w).map(v=>_[v.params.labwareId]),g=Array.from(new Set(S.map(v=>v.labwareDefURI))),k=Array.from(new Set(S.map(v=>v.def)));return A==null||(y[w]={name:E,id:w,tiprackLabwareDef:k,tiprackDefURI:g,spec:A,pythonName:"n/a"}),y},{}),T=s.reduce((y,I)=>{if(I.commandType==="loadLidStack"&&I.result!=null){const{params:w}=I,E=nc(w);return{...y,stagingAreaEntities:{...y.stagingAreaEntities,...E}}}else if((I.commandType==="loadLabware"||I.commandType==="loadLid")&&I.result!=null){const{params:w}=I,E=nc(w);return{...y,stagingAreaEntities:{...y.stagingAreaEntities,...E}}}else if(I.commandType==="moveToAddressableArea"||I.commandType==="moveToAddressableAreaForDropTip"){const w=I.params.addressableAreaName,E=`${M()}:${w}`;let A=Jh;w==="fixedTrash"?A="cutout12":w.includes("WasteChute")?A="cutoutD3":w.includes("movableTrash")&&(A=`cutout${w.split("movableTrash")[1]}`);let L=y.trashBinEntities;Object.values(y.trashBinEntities).some(g=>g.location===A)||(w.includes("movableTrash")?L={...y.trashBinEntities,[E]:{pythonName:"trash_bin_1",id:E,location:A}}:w==="fixedTrash"&&(L={...y.trashBinEntities,[E]:{pythonName:"trash_bin_1",id:E,location:A}}));let S=y.wasteChuteEntities;return w.includes("WasteChute")&&(S={[E]:{pythonName:"waste_chute",id:E,location:A}}),{...y,trashBinEntities:L,wasteChuteEntities:S}}return y},{wasteChuteEntities:{},trashBinEntities:{},stagingAreaEntities:{},runtimeParameters:{},gripperEntities:{},config:{OT_PD_DISABLE_MODULE_RESTRICTIONS:!0}});return{labwareEntities:_,pipetteEntities:b,moduleEntities:m,liquidEntities:u||p?f:{},...T}}const SS={A3:"A4",B3:"B4",C3:"C4",D3:"D4"};function AS(e,t){const r=e.reduce((s,i)=>i.commandType==="loadPipette"&&i.result!=null?{...s,[i.result.pipetteId]:{mount:i.params.mount}}:s,{}),n=e.reduce((s,i)=>{if(i.commandType==="loadModule"&&i.result!=null){const l=c.getModuleDef(i.params.model).moduleType;return{...s,[i.result.moduleId]:{slot:l===c.FLEX_STACKER_MODULE_TYPE?SS[i.params.location.slotName]:i.params.location.slotName,moduleState:Qh[l]}}}return s},{}),a=e.reduce((s,i)=>{if(i.commandType==="loadLidStack"&&i.result!=null){const{result:l}=i,u=l.locationSequences,p=l.labwareIds,d=l.stackLabwareId,f=l.stackLocationSequence,m=h=>{if(c.locationIsOffDeck(h))return[h];if("slotName"in h)return[h.slotName];if("moduleId"in h){const _=n[h.moduleId]?.slot??"offDeck";return[h.moduleId,_]}else if("addressableAreaName"in h)return[h.addressableAreaName];return["offDeck"]};if(u!=null){const h=u.reduce((T,y)=>{const I=y.find(w=>w.kind==="onLabware");return I!=null&&(T[I.labwareId]=y),T},{}),_=p.reduce((T,y,I)=>{const w=h[y]??u[I];if(w!=null){const E=rc(w);T[y]={stack:E[0]===y?E:[y,...E]}}else{const E=i.params.location;c.locationIsOffDeck(E)?T[y]={stack:[y,E]}:"slotName"in E?T[y]={stack:[y,E.slotName]}:T[y]={stack:[y,"offDeck"]}}return T},{}),b=d!=null&&f!=null?[d,...rc(f)]:null;return{...s,..._,...d!=null&&b!=null?{[d]:{stack:b}}:{}}}else{const h=i.params.location,_=p.reduce((T,y)=>{if(c.locationIsOffDeck(h))T[y]={stack:[y,h]};else if("slotName"in h)T[y]={stack:[y,h.slotName]};else if("moduleId"in h){const I=h.moduleId;T[y]={stack:[y,I,n[I].slot]}}else T[y]={stack:[y,"offDeck"]};return T},{}),b=d!=null?[d,...m(h)]:null;return{...s,..._,...d!=null&&b!=null?{[d]:{stack:b}}:{}}}}else if((i.commandType==="loadLabware"||i.commandType==="loadLid")&&i.result!=null){const l=[i.result.labwareId];if(c.locationIsOffDeck(i.params.location))l.push(i.params.location);else if("slotName"in i.params.location)l.push(i.params.location.slotName);else if("moduleId"in i.params.location){const u=i.params.location.moduleId;if(n[u]==null)return console.warn(`Module ${u} not found when processing loadLabware/loadLid command. `),s;l.push(i.params.location.moduleId,n[i.params.location.moduleId].slot)}else if("labwareId"in i.params.location){const u=i.params.location.labwareId;s[u]==null&&(console.warn(`Parent labware ${u} not found when processing loadLabware/loadLid command. `),s[u]={stack:[u,"offDeck"]});const p=s[u].stack;l.push(u,...p)}else l.push(i.params.location.addressableAreaName);return{...s,[i.result.labwareId]:{stack:l}}}else{if(i.commandType==="flexStacker/setStoredLabware")return mh(i).forEach(u=>{fh(s,u,"setStoredLabwareCount")}),s;if(i.commandType==="flexStacker/fill")return mh(i).forEach(u=>{fh(s,u,"fillCount")}),s}return s},{}),o=Xc({invariantContext:t,labwareLocations:a,moduleLocations:n,pipetteLocations:r});return{frame:{..._p(e,t,o),command:e[e.length-1]},invariantContext:t}}const fh=(e,t,r)=>{const n=e[t]??{stack:[t,"offDeck"]};e[t]={...n,[r]:(n[r]??0)+1}},mh=e=>e.result?.storedLabware?.flatMap(r=>[r.primaryLabwareId,r.adapterLabwareId,r.lidLabwareId].filter(n=>n!=null))??[],yp=(e,t)=>e??(t.channels===1?c.SINGLE:t.channels===96?c.ALL:c.COLUMN);var Du,hh;function LS(){if(hh)return Du;hh=1;var e=Dc();function t(r,n){var a;return e(r,function(o,s,i){return a=n(o,s,i),!a}),!!a}return Du=t,Du}var Mu,_h;function OS(){if(_h)return Mu;_h=1;var e=m_(),t=qn(),r=LS(),n=tt(),a=Fc();function o(s,i,l){var u=n(s)?e:r;return l&&a(s,i,l)&&(i=void 0),u(s,t(i,3))}return Mu=o,Mu}var RS=OS();const Wa=Ge(RS),Gn=(e,t)=>Wa(e,r=>r.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&r.moduleState.latchOpen!==!1&&c.getAreSlotsHorizontallyAdjacent(r.slot,t)),Wn=(e,t,r)=>r.channels!==1&&Wa(e,n=>n.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&c.getAreSlotsHorizontallyAdjacent(n.slot,t)),Ya=(e,t,r,n)=>r.channels!==1&&!n.def.parameters.isTiprack&&Wa(e,a=>a.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&c.getAreSlotsVerticallyAdjacent(a.slot,t)),Jy=(e,t,r)=>Wa(e,(a,o)=>c.getAreSlotsHorizontallyAdjacent(r,K(a.stack))&&c.getIsLabwareAboveHeight(t[o].def,c.MAX_LABWARE_HEIGHT_EAST_WEST_HEATER_SHAKER_MM)),Ka=(e,t,r)=>{const n=xa(e,t[r]?.stack),a=n!=null?e[n].moduleState:null;return!!(a&&a.type===c.HEATERSHAKER_MODULE_TYPE&&a.latchOpen!==!1)},Yn=(e,t,r)=>Wa(e,n=>n.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&n.moduleState.targetSpeed!=null&&n.moduleState.targetSpeed>0&&(r===c.OT2_ROBOT_TYPE?c.getAreSlotsAdjacent(n.slot,t):c.getAreFlexSlotsAdjacent(n.slot,t))),Za=(e,t,r)=>{const n=xa(e,t[r]?.stack),a=n!=null?e[n].moduleState:null;return!!(a&&a.type===c.HEATERSHAKER_MODULE_TYPE&&a.targetSpeed!==null)},zo=e=>{const{args:t,pipetteName:r,tiprackUri:n,liquidClassValuesForTip:a}=e;let o=null;"mixBeforeAspirate"in t?o=t.mixBeforeAspirate:"mixFirstAspirate"in t&&(o=t.mixFirstAspirate);const s=vS(t),i={dispense_position:{offset:{x:t.dispenseXOffset,y:t.dispenseYOffset,z:t.dispenseZOffset},position_reference:t.dispensePositionReference},flow_rate_by_volume:[[0,t.dispenseFlowRateUlSec??0]],delay:{enabled:!!t.dispenseDelay?.seconds,...t.dispenseDelay?.seconds?{duration:t.dispenseDelay?.seconds}:{}},submerge:{delay:{enabled:!!t.dispenseSubmergeDelay?.seconds,...t.dispenseSubmergeDelay?.seconds?{duration:t.dispenseSubmergeDelay?.seconds}:{}},speed:t.dispenseSubmergeSpeed??void 0,start_position:{offset:{x:t.dispenseSubmergeXOffset,y:t.dispenseSubmergeYOffset,z:t.dispenseSubmergeZOffset},position_reference:t.dispenseSubmergePositionReference}},retract:{air_gap_by_volume:[[0,t.dispenseAirGapVolume??0]],delay:{enabled:!!t.dispenseRetractDelay?.seconds,...t.dispenseRetractDelay?.seconds?{duration:t.dispenseRetractDelay?.seconds}:{}},end_position:{offset:{x:t.dispenseRetractXOffset,y:t.dispenseRetractYOffset,z:t.dispenseRetractZOffset},position_reference:t.dispenseRetractPositionReference},speed:t.dispenseRetractSpeed??void 0,touch_tip:{enabled:t.touchTipAfterDispense,z_offset:t.touchTipAfterDispense?t.touchTipAfterDispenseOffsetMmFromTop:void 0,mm_from_edge:t.touchTipAfterDispense&&t.touchTipAfterDispenseMmFromEdge!=null?t.touchTipAfterDispenseMmFromEdge:void 0,speed:t.touchTipAfterDispense?t.touchTipAfterDispenseSpeed:void 0},blowout:{enabled:t.blowoutLocation!=null,location:eb(t.blowoutLocation),flow_rate:t.blowoutLocation!=null?t.blowoutFlowRateUlSec:void 0,...s!=null?{blowout_position:s}:{}}}},l={[r]:{[n]:{aspirate:{aspirate_position:{offset:{x:t.aspirateXOffset,y:t.aspirateYOffset,z:t.aspirateZOffset},position_reference:t.aspiratePositionReference},flow_rate_by_volume:[[0,t.aspirateFlowRateUlSec]],pre_wet:t.preWetTip,correction_by_volume:a?.aspirate.correctionByVolume??[[0,0]],delay:{enabled:!!t.aspirateDelay?.seconds,...t.aspirateDelay?.seconds?{duration:t.aspirateDelay?.seconds}:{}},mix:{enabled:!!o?.volume,...o?.times?{repetitions:o.times}:{},...o?.volume?{volume:o.volume}:{}},submerge:{delay:{enabled:!!t.aspirateSubmergeDelay?.seconds,...t.aspirateSubmergeDelay?.seconds?{duration:t.aspirateSubmergeDelay?.seconds}:{}},speed:t.aspirateSubmergeSpeed??void 0,start_position:{offset:{x:t.aspirateSubmergeXOffset,y:t.aspirateSubmergeYOffset,z:t.aspirateSubmergeZOffset},position_reference:t.aspirateSubmergePositionReference}},retract:{air_gap_by_volume:[[0,t.aspirateAirGapVolume??0]],delay:{enabled:!!t.aspirateRetractDelay?.seconds,...t.aspirateRetractDelay?.seconds?{duration:t.aspirateRetractDelay?.seconds}:{}},end_position:{offset:{x:t.aspirateRetractXOffset,y:t.aspirateRetractYOffset,z:t.aspirateRetractZOffset},position_reference:t.aspirateRetractPositionReference},speed:t.aspirateRetractSpeed??void 0,touch_tip:{enabled:t.touchTipAfterAspirate,z_offset:t.touchTipAfterAspirate?t.touchTipAfterAspirateOffsetMmFromTop:void 0,mm_from_edge:t.touchTipAfterAspirate&&t.touchTipAfterAspirateMmFromEdge!=null?t.touchTipAfterAspirateMmFromEdge:void 0,speed:t.touchTipAfterAspirate?t.touchTipAfterAspirateSpeed:void 0}}},dispense:{...i,correction_by_volume:a?.singleDispense.correctionByVolume??[[0,0]],push_out_by_volume:[[0,t.pushOut??0]],mix:{enabled:"mixInDestination"in t?t.mixInDestination!=null:!1,repetitions:"mixInDestination"in t?t.mixInDestination?.times??void 0:void 0,volume:"mixInDestination"in t?t.mixInDestination?.volume??void 0:void 0}},...t.commandCreatorFnName==="distribute"?{multi_dispense:{...i,correction_by_volume:a?.multiDispense?.correctionByVolume??[[0,0]],..."conditioningVolume"in t?{conditioning_by_volume:[[0,t.conditioningVolume??0]]}:{},..."disposalVolume"in t?{disposal_by_volume:[[0,t.disposalVolume??0]]}:{}}}:{}}}},u=JSON.parse(JSON.stringify(l));return Vr(u)},Xa=(e,t)=>`${c.getAllLiquidClassDefs()[e].liquidClassName}${t?"_base_class":""}`,eb=e=>{if(e!=null)return e===Wr?"source":e===$n?"destination":"trash"},vS=e=>{const t=eb(e.blowoutLocation);return!t||t==="trash"?null:{offset:{x:e.blowoutXPosition??0,y:e.blowoutYPosition??0,z:e.blowoutOffsetFromTopMm??1},position_reference:e.blowoutPositionReference??c.POSITION_REFERENCE_TOP}},jo=e=>{const{labwareEntities:t,tiprackIds:r}=e;return`tip_racks=[${r.map(a=>t[a].pythonName).join(", ")}]`};var Fu,yh;function kS(){if(yh)return Fu;yh=1;var e="Expected a function";function t(r){if(typeof r!="function")throw new TypeError(e);return function(){var n=arguments;switch(n.length){case 0:return!r.call(this);case 1:return!r.call(this,n[0]);case 2:return!r.call(this,n[0],n[1]);case 3:return!r.call(this,n[0],n[1],n[2])}return!r.apply(this,n)}}return Fu=t,Fu}var Uu,bh;function PS(){if(bh)return Uu;bh=1;var e=lp(),t=Fn(),r=Ro(),n=ir(),a=Un();function o(s,i,l,u){if(!n(s))return s;i=t(i,s);for(var p=-1,d=i.length,f=d-1,m=s;m!=null&&++p<d;){var h=a(i[p]),_=l;if(h==="__proto__"||h==="constructor"||h==="prototype")return s;if(p!=f){var b=m[h];_=u?u(b,h,m):void 0,_===void 0&&(_=n(b)?b:r(i[p+1])?[]:{})}e(m,h,_),m=m[h]}return s}return Uu=o,Uu}var qu,Th;function NS(){if(Th)return qu;Th=1;var e=ko(),t=PS(),r=Fn();function n(a,o,s){for(var i=-1,l=o.length,u={};++i<l;){var p=o[i],d=e(a,p);s(d,p)&&t(u,r(p,a),d)}return u}return qu=n,qu}var Vu,Ih;function CS(){if(Ih)return Vu;Ih=1;var e=Fa(),t=qn(),r=NS(),n=pp();function a(o,s){if(o==null)return{};var i=e(n(o),function(l){return[l]});return s=t(s),r(o,i,function(l,u){return s(l,u[0])})}return Vu=a,Vu}var $u,Eh;function DS(){if(Eh)return $u;Eh=1;var e=qn(),t=kS(),r=CS();function n(a,o){return r(a,t(e(o)))}return $u=n,$u}var MS=DS();const FS=Ge(MS);function tb(e){return Object.keys(e.wells)}const US=(e,t)=>{const r=Object.keys(e||{}).filter(n=>e[n]&&e[n].volume>0);return{wellName:t,groupIds:r,ingreds:FS(e,n=>!n||n.volume<=0)}},qS=(e,t)=>{const r=tb(t);return dt(r,(n,a)=>{const o=e&&e[a];return{...n,[a]:o?US(e[a],a):{}}},{})},VS=(e,t)=>{const r={};return t.forEach(n=>{const a=e!=null?Object.values(e).reduce((o,s)=>{if(s.groupIds.indexOf(n)!==-1){const l=s.ingreds[n];l?.volume!=null&&(o[s.wellName??"A1"]=l.volume)}return o},{}):{};r[n]=a}),r},$S=e=>{const t=e.flatMap(r=>r==null?[]:Object.values(r).flatMap(n=>n.groupIds.filter(a=>a!==Ye)));return Array.from(new Set(t))},BS=e=>{const t=e!=null?Object.values(e).flatMap(r=>r.groupIds)?.filter(r=>r!==Ye):[];return Array.from(new Set(t))},rb="#737578",nb=e=>{const t=Number(e);return Number.isInteger(t)?c.DEFAULT_LIQUID_COLORS[t%c.DEFAULT_LIQUID_COLORS.length]:(e!==Ye&&console.warn(`swatchColors expected an integer or ${Ye}, got ${e}`),"transparent")},xS=(e,t)=>{const r=e.filter(n=>n!==Ye);return r.length===0?null:r.length===1?t[r[0]]??nb(r[0]):rb},HS=(e,t)=>dt(e,(r,n,a)=>{const o=xS(n.groupIds,t);return o?{...r,[a]:o}:r},{});var Bu,gh;function zS(){if(gh)return Bu;gh=1;function e(t,r){return t>r}return Bu=e,Bu}var xu,wh;function jS(){if(wh)return xu;wh=1;var e=xh(),t=zS(),r=Na();function n(a){return a&&a.length?e(a,r,t):void 0}return xu=n,xu}var GS=jS();const WS=Ge(GS),ab="2.31",YS="9.0.1";function KS(){return["import json","from opentrons import protocol_api, types"].join(`
56
- `)}function ZS(e){function t(n){return n?new Date(n).toISOString():""}const r=Object.fromEntries(Object.entries({protocolName:e.protocolName,author:e.author,description:e.description,created:t(e.created),internalAppBuildDate:e.internalAppBuildDate,lastModified:t(e.lastModified),category:e.category,subcategory:e.subcategory,tags:e.tags?.length&&e.tags.join(", "),protocolDesigner:e.protocolDesigner,source:e.source}).filter(([n,a])=>a));return`metadata = ${Vr(r)}`}function XS(e){const r={robotType:{[c.OT2_ROBOT_TYPE]:"OT-2",[c.FLEX_ROBOT_TYPE]:"Flex"}[e],apiLevel:ab};return`requirements = ${Vr(r)}`}function ob(e,t){const r=Object.keys(e).length>0,n=r?Object.values(e).map(a=>`${a.pythonName} = ${we}.load_module(${C(a.model)}, ${C(t[a.id].slot)})`).join(`
52
+ )`}},Cw=(e,t,r)=>{const{axes:n,skipIfMountPositionOk:a}=e,o={commandType:"home",key:$(),params:{axes:n,skipIfMountPositionOk:a}},s=[...n!=null?[`axes=${zc(n)},
53
+ `]:[],...a!=null?[`skipIfMountPositionOk=${F(a)},
54
+ `]:[]],i=`${ge}.home(${s.join(", ")})`;return{commands:[o],python:i}},Dw=(e,t,r)=>{const{pipetteEntities:n,runtimeParameters:a}=t,o=v(e.pipetteId,a),s=v(e.axis,a),i=U(e.distance,a),l=[];if(o==null&&l.push(C({parameterName:e.pipetteId})),s==null&&l.push(C({parameterName:e.axis})),typeof e.distance=="string"&&i==null&&l.push(C({parameterName:e.distance})),l.length>0||o==null||s==null||i==null)return{errors:l};const u=n[o].pythonName,p=a[e.axis]!=null?e.axis:F(s),d=[{commandType:"moveRelative",key:$(),params:{pipetteId:o,axis:s,distance:i}}],f=[`axis=${p}`,`distance=${e.distance}`];return{commands:d,python:`${u}.move_axes_relative(${f.join(", ")})`}},Mw=(e,t,r)=>{const{pipetteEntities:n,runtimeParameters:a}=t,{coordinates:o}=e,s=v(e.pipetteId,a),i=U(o.x,a),l=U(o.y,a),u=U(o.z,a),p=e.minimumZHeight==null?void 0:U(e.minimumZHeight,a),d=e.forceDirect==null?void 0:lt(e.forceDirect,a),f=[];if(s==null&&f.push(C({parameterName:e.pipetteId})),typeof o.x=="string"&&i==null&&f.push(C({parameterName:o.x})),typeof o.y=="string"&&l==null&&f.push(C({parameterName:o.y})),typeof o.z=="string"&&u==null&&f.push(C({parameterName:o.z})),typeof e.minimumZHeight=="string"&&p==null&&f.push(C({parameterName:e.minimumZHeight})),typeof e.forceDirect=="string"&&d==null&&f.push(C({parameterName:e.forceDirect})),f.length>0||s==null||i==null||l==null||u==null)return{errors:f};const m=n[s].pythonName,h=[`coordinates=(${o.x}, ${o.y}, ${o.z})`];return typeof e.forceDirect=="string"?h.push(`force_direct=${e.forceDirect}`):e.forceDirect&&h.push("force_direct=True"),e.minimumZHeight&&h.push(`minimum_z_height=${e.minimumZHeight}`),{commands:[{commandType:"moveToCoordinates",key:$(),params:{pipetteId:s,coordinates:{x:i,y:l,z:u},minimumZHeight:p??void 0,forceDirect:d??void 0}}],python:`${m}.move_axes_to(${h.join(", ")})`}},Fw=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.pipetteId,n),o=v(e.labwareId,n),s=v(e.wellName,n),i=e.wellLocation?.origin,l=i==null?void 0:v(i,n),u=e.wellLocation?.offset,p=u?.x==null?void 0:U(u.x,n),d=u?.y==null?void 0:U(u.y,n),f=u?.z==null?void 0:U(u.z,n),m=[];for(const[b,w]of[[e.pipetteId,a],[e.labwareId,o],[e.wellName,s]])w==null&&m.push(C({parameterName:b}));i!=null&&l==null&&m.push(C({parameterName:i}));for(const[b,w]of[[u?.x,p],[u?.y,d],[u?.z,f]])typeof b=="string"&&w==null&&m.push(C({parameterName:b}));if(m.length>0||a==null||o==null||s==null)return{errors:m};const h=t.pipetteEntities[a].pythonName,_=t.labwareEntities[o].pythonName;let y;e.wellLocation!=null&&(y={},l!=null&&(y.origin=l),u!=null&&(y.offset={},p!=null&&(y.offset.x=p),d!=null&&(y.offset.y=d),f!=null&&(y.offset.z=f)));const T=n[e.wellName]!=null?e.wellName:F(s);return{commands:[{commandType:"tryLiquidProbe",key:$(),params:{pipetteId:a,labwareId:o,wellName:s,wellLocation:y}}],python:`${h}.detect_liquid_presence(${_}[${T}])`}},J_=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.moduleId,n);if(a==null)return{errors:[C({parameterName:e.moduleId})]};const o=t.moduleEntities[a].pythonName;return{commands:[{commandType:"heaterShaker/closeLabwareLatch",key:$(),params:{moduleId:a}}],python:`${o}.close_labware_latch()`}},tc=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.moduleId,n);if(a==null)return{errors:[C({parameterName:e.moduleId})]};const o=t.moduleEntities[a].pythonName;return{commands:[{commandType:"heaterShaker/deactivateHeater",key:$(),params:{moduleId:a}}],python:`${o}.deactivate_heater()`}},Uw=["1","4","7","10"],ey=(e,t,r)=>{const{pipetteEntities:n,labwareEntities:a,moduleEntities:o,runtimeParameters:s}=t,i=v(e.moduleId,s);if(i==null)return{errors:[C({parameterName:e.moduleId})]};const l=r.modules[i].slot,u=Object.keys(n)[0],p=n[u]?.spec;if(!((p?.displayCategory==="FLEX"||p?.channels===96)??!1)&&tb(r.labware,a,l)){const m=Uw.includes(l)?"right":"left";return{errors:[pT(m)]}}const f=o[i].pythonName;return{commands:[{commandType:"heaterShaker/openLabwareLatch",key:$(),params:{moduleId:i}}],python:`${f}.open_labware_latch()`}},ty=(e,t,r)=>{const{moduleEntities:n,runtimeParameters:a}=t,o=v(e.moduleId,a),s=U(e.rpm,a),i=[];if(o==null&&i.push(C({parameterName:e.moduleId})),typeof e.rpm=="string"&&s==null&&i.push(C({parameterName:e.rpm})),i.length>0||o==null||s==null)return{errors:i};if(n[o]?.type!==c.HEATERSHAKER_MODULE_TYPE)throw new Error(`expected module ${o} to be heaterShaker, got ${n[o]?.type}`);const l=n[o].pythonName;return{commands:[{commandType:"heaterShaker/setAndWaitForShakeSpeed",key:$(),params:{moduleId:o,rpm:s}}],python:`${l}.set_and_wait_for_shake_speed(${e.rpm})`}},rc=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.moduleId,n);if(a==null)return{errors:[C({parameterName:e.moduleId})]};const o=t.moduleEntities[a].pythonName;return{commands:[{commandType:"heaterShaker/deactivateShaker",key:$(),params:{moduleId:a}}],python:`${o}.deactivate_shaker()`}},Kc=(e,t,r)=>{const{moduleEntities:n,labwareEntities:a,runtimeParameters:o}=t,s=v(e.moduleId,o);if(s==null)return{errors:[C({parameterName:e.moduleId})]};const i=[],l=n[s].pythonName,p=Object.values(r.labware).filter(m=>m.stack.includes(s)).find(m=>m.stack.find(h=>a[h]?.def.allowedRoles?.includes("lid")&&a[h]?.def.parameters.loadName!=="opentrons_tough_pcr_auto_sealing_lid")),d=p!=null?Fo(p.stack):null,f=d!=null?a[d].def.metadata.displayName:null;return f!=null&&i.push(IT({lidDisplayName:f})),i.length>0?{errors:i}:{commands:[{commandType:"thermocycler/closeLid",key:$(),params:{moduleId:s}}],python:`${l}.close_lid()`}},ry=(e,t,r)=>{const n=v(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[C({parameterName:e.moduleId})]};const a=t.moduleEntities[n].pythonName;return{commands:[{commandType:"thermocycler/deactivateBlock",key:$(),params:{moduleId:n}}],python:`${a}.deactivate_block()`}},ny=(e,t,r)=>{const n=v(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[C({parameterName:e.moduleId})]};const a=t.moduleEntities[n].pythonName;return{commands:[{commandType:"thermocycler/deactivateLid",key:$(),params:{moduleId:n}}],python:`${a}.deactivate_lid()`}},ay=(e,t,r)=>{const n=v(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[C({parameterName:e.moduleId})]};const a=t.moduleEntities[n].pythonName;return{commands:[{commandType:"thermocycler/openLid",key:$(),params:{moduleId:n}}],python:`${a}.open_lid()`}},oy=(e,t,r)=>{e.celsius!==void 0&&console.warn("'volume' param not implemented for thermocycler/setTargetBlockTemperature, should not be set!");const{runtimeParameters:n}=t,a=v(e.moduleId,n),o=U(e.celsius,n),s=[];if(a==null&&s.push(C({parameterName:e.moduleId})),typeof e.celsius=="string"&&o==null&&s.push(C({parameterName:e.celsius})),a==null||o==null)return{errors:s};const i=t.moduleEntities[a].pythonName;return{commands:[{commandType:"thermocycler/setTargetBlockTemperature",key:$(),params:{moduleId:a,celsius:o}}],python:`${i}.set_block_temperature(${e.celsius})`}},Zc=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.moduleId,n),o=U(e.celsius,n),s=[];if(a==null&&s.push(C({parameterName:e.moduleId})),typeof e.celsius=="string"&&o==null&&s.push(C({parameterName:e.celsius})),a==null||o==null)return{errors:s};const i=t.moduleEntities[a].pythonName;return{commands:[{commandType:"thermocycler/setTargetLidTemperature",key:$(),params:{moduleId:a,celsius:o}}],python:`${i}.set_lid_temperature(${e.celsius})`}};function P(e,t){return(r,n)=>e(t,r,n)}function R(e,t){return(r,n)=>{const a=e(t,r,n);if("python"in a){const{python:o,...s}=a;return s}return a}}const Ye="__air__",Kr="source_well",xn="dest_well";function sy(e){return i_.includes(e.parameters.loadName)}function wa(e){return(e.parameters.quirks??[]).includes("vacuumSpacer")}function iy(e){return(e.parameters.quirks??[]).includes("vacuumSpacerSeat")}const ly=(e,t)=>e.filter(r=>r in t&&wa(t[r].def)).map(r=>t[r].def.parameters.loadName),uy=(e,t,r)=>{if(!wa(e))return{isCompatible:!1,isAboveStackLimit:!1};if(t.length===0)return{isCompatible:!0,isAboveStackLimit:!1};const n=ly(t,r),a=Fo(t);if(!(a in r))return{isCompatible:!0,isAboveStackLimit:!1};const o=r[a].def;if(!wa(o)||iy(o))return{isCompatible:!1,isAboveStackLimit:!1};const s=e.parameters.loadName,i=o.parameters.loadName,l=n.includes(s),u=n.length>=l_,p=e.compatibleParentLabware?.includes(i)??!1,d=i in(e.stackingOffsetWithLabware??{}),f=p||d,m=l||u;return{isCompatible:f&&!m,isAboveStackLimit:m}},$w=e=>(e.parameters.quirks??[]).includes("vacuumModuleDock"),cy=(e,t,r)=>{const o=c.getDeckDefFromRobotType(r).cutoutFixtures.find(l=>l.id.includes(t))?.providesAddressableAreas,i=(l=>{if(o!=null){for(const u in o)if(o[u].includes(l))return u}return null})(e);if(i==null)throw Error(`expected to find cutoutId from addressableAreaName ${e} but could not`);return i};function py(e){switch(e){case 1:return c.ONE_CHANNEL_WASTE_CHUTE_ADDRESSABLE_AREA;case 8:return c.EIGHT_CHANNEL_WASTE_CHUTE_ADDRESSABLE_AREA;case 96:return c.NINETY_SIX_CHANNEL_WASTE_CHUTE_ADDRESSABLE_AREA}}function Xc(e){const t=c.getDeckDefFromRobotType(e==="cutout12"?c.OT2_ROBOT_TYPE:c.FLEX_ROBOT_TYPE);let r=null;return t.robot.model===c.FLEX_ROBOT_TYPE&&(r=t.cutoutFixtures.find(n=>n.id==="trashBinAdapter")?.providesAddressableAreas??null),t.robot.model===c.FLEX_ROBOT_TYPE&&r==null&&console.error(`expected to find a list of cutouts for the Flex but could not with trashLocation ${e}`),r!=null?r[e]?.[0]:"fixedTrash"}function dy(e){if(e==="fixedTrash")return"cutout12";const r=c.getDeckDefFromRobotType(c.FLEX_ROBOT_TYPE).cutoutFixtures.find(n=>n.id==="trashBinAdapter")?.providesAddressableAreas??null;if(r==null)return console.error("Could not find trashBinAdapter cutouts for Flex"),null;for(const[n,a]of Object.entries(r))if(a.includes(e))return n;return console.error(`Could not find trashLocation for addressableAreaName ${e}`),null}function Hn(e,t,r,n){return e[n]!=null?"labware":t[n]!=null?"wasteChute":r[n]!=null?"trashBin":(console.error(`expected to determine if dest labware is a labware or waste chute with destLabware ${n} but could not`),null)}function fy(e,t){return Rn(gn(t),r=>e)}function br(e){return ft(e,(t,r,n)=>n===Ye?t:t+r.volume,0)}function nr(e,t){const r=br(t);if(r===0)return{source:t,dest:{[Ye]:{volume:e}}};if(e>r)return{source:or(t,()=>({volume:0})),dest:{...t,[Ye]:{volume:e-r}}};const n=ft(t,(a,o,s)=>({...a,[s]:o.volume/r}),{});return Object.keys(t).reduce((a,o)=>{const s=n[o]*e;return{source:{...a.source,[o]:{volume:t[o].volume-s}},dest:{...a.dest,[o]:{volume:s}}}},{source:{},dest:{}})}function Tr(e,t){return{...t,...ft(e,(r,n,a)=>{const s=a in t?n.volume+t[a].volume:n.volume;return{...r,[a]:{volume:s}}},{})}}function Qc(e,t,r){const n=e===1?[r]:c.getWellNamePerMultiTip(t,r,e);if(!n)return console.warn(e===1?`Invalid well: ${r}`:`For labware def (URI ${c.getLabwareDefURI(t)}), with primary well ${r}, no wells are accessible by 8-channel's 1st tip`),{wellsForTips:[],allWellsShared:!1};const a=n.every(o=>o&&o===n[0]);return{wellsForTips:n,allWellsShared:a}}const my=e=>{const{pipette:t,sourceLabwareId:r,sourceWell:n,destLabwareId:a,destWell:o,blowoutLocation:s,flowRate:i,offsetFromTopMm:l,invariantContext:u}=e;if(!s)return[];const{trashBinEntities:p,wasteChuteEntities:d}=u;let f=null,m=null;return s===Kr?(f=r,m=n):s===xn&&(f=a,m=o),m!=null&&f!=null?[P(Vc,{pipetteId:t,labwareId:f,wellName:m,flowRate:i,wellLocation:{origin:"top",offset:{z:l}}})]:d[s]!=null?[P(Pb,{pipetteId:t,flowRate:i,wasteChuteId:Object.keys(d)[0]})]:[P(vb,{pipetteId:t,trashId:Object.keys(p)[0],flowRate:i})]};function hy(e){const{labwareEntities:t,pipetteEntities:r,wasteChuteEntities:n,trashBinEntities:a}=e;return{pipettes:ft(r,(o,s,i)=>{const l=s.spec;return{...o,[i]:_y(l.channels,{})}},{}),labware:ft(t,(o,s,i)=>({...o,[i]:or(s.def.wells,()=>({}))}),{}),trashBins:ft(a,(o,s,i)=>({...o,[i]:{}}),{}),wasteChute:ft(n,(o,s,i)=>({...o,[i]:{}}),{})}}function _y(e,t){return gn(e).reduce((r,n)=>({...r,[n]:t}),{})}const yy=e=>{const{blowoutLocation:t,sourceLabware:r,destLabware:n,sourceWell:a,destWell:o}=e;return t===Kr&&r!=null&&a!=null?{dispenseAirGapLabware:r,dispenseAirGapWell:a}:{dispenseAirGapLabware:n,dispenseAirGapWell:o}};function Jc(e){const{invariantContext:t,labwareLocations:r,moduleLocations:n={},pipetteLocations:a}=e;return{labware:r,modules:n,pipettes:a,liquidState:hy(t),tipState:{pipettes:ft(a,(o,s,i)=>s.mount?{...o,[i]:{hasTip:!1,tiprackURI:null}}:o,{}),tipracks:ft(r,(o,s,i)=>{const l=t.labwareEntities[i].def;if(!c.getIsTiprack(l))return o;const u=or(l.wells,()=>Fa);return{...o,[i]:u}},{})}}}const by=(e,t)=>e.tipracks[t]!=null?Object.values(e.tipracks[t]).some(r=>r!==_e):!1,Ty=(e,t)=>e.labware[t]!=null?Object.values(e.labware[t]).some(r=>Object.values(r).some(n=>n.volume>0)):!1,qw=(e,t,r)=>{const{destinationId:n,pipetteId:a,volume:o,flowRate:s,offsetFromBottomMm:i,well:l,xOffset:u,yOffset:p,tipRack:d,primaryNozzle:f,nozzles:m}=e,{labwareEntities:h,trashBinEntities:_,wasteChuteEntities:y}=t,T=Hn(h,y,_,n);let b=[];return T==="labware"&&i!=null&&l!=null?b=[P(Bc,{pipetteId:a,volume:o,labwareId:n,wellName:l,flowRate:s,wellLocation:{origin:"bottom",offset:{z:i,x:u,y:p}},tipRack:d,primaryNozzle:f,nozzles:m})]:T==="wasteChute"?b=[P(kA,{pipetteId:a,volume:o,flowRate:s,wasteChuteId:y[n].id})]:b=[P(RA,{pipetteId:a,volume:o,flowRate:s,trashId:_[n].id})],de(b,t,r)},Vw=(e,t,r)=>{const{destinationId:n,pipetteId:a,zOffset:o,well:s}=e,{labwareEntities:i,wasteChuteEntities:l,trashBinEntities:u}=t,p=Hn(i,l,u,n);let d=[];return p==="labware"&&s!=null?d=[P(z,{pipetteId:a,labwareId:n,wellName:s,wellLocation:{origin:"bottom",offset:{x:0,y:0,z:o}}})]:p==="wasteChute"?d=[P(qe,{pipetteId:a,fixtureId:l[n].id,offset:{x:0,y:0,z:0}})]:d=[P(qe,{pipetteId:a,fixtureId:u[n].id,offset:Lt})],de(d,t,r)},Bw=(e,t,r)=>{const{blowOutLocation:n,destinationId:a,destWell:o,flowRate:s,pipetteId:i,sourceId:l,sourceWell:u,volume:p}=e,{labwareEntities:d,trashBinEntities:f,wasteChuteEntities:m}=t,h=Hn(d,m,f,a);let _=[];if(h==="labware"&&o!=null){const{dispenseAirGapLabware:y,dispenseAirGapWell:T}=yy({blowoutLocation:n,sourceLabware:l,destLabware:a,sourceWell:u,destWell:o});_=[P(AA,{flowRate:s,pipetteId:i,labwareId:y,wellName:T,volume:p,type:"dispense"})]}else h==="wasteChute"?_=[P(EA,{pipetteId:i,volume:p,flowRate:s,wasteChuteId:m[a].id})]:_=[P(gA,{pipetteId:i,volume:p,flowRate:s,trashId:f[a].id})];return de(_,t,r)},xw=(e,t,r)=>{const{pipetteId:n,destinationId:a,well:o,zOffset:s,seconds:i}=e,{labwareEntities:l,trashBinEntities:u,wasteChuteEntities:p}=t,d=Hn(l,p,u,a);let f=[];return o!=null&&d==="labware"?f=[P(z,{pipetteId:n,labwareId:a,wellName:o,wellLocation:{origin:"bottom",offset:{x:0,y:0,z:s}}}),P(Te,{seconds:i})]:d==="wasteChute"?f=[P(qe,{pipetteId:n,fixtureId:a,offset:Lt}),P(Te,{seconds:i})]:f=[P(qe,{pipetteId:n,fixtureId:a,offset:Lt}),P(Te,{seconds:i})],de(f,t,r)},ee=(e,t=!1)=>{if(e==null)return console.error("expected to find stack but could not"),"unknown slot";{const r=e[e.length-1];return t?`STACKER ${r.slice(-2,-1)}`:r}},Hw=e=>e===c.VACUUM_MODULE_DOCK_A4_ADDRESSABLE_AREA?u_:e,Fo=e=>e==null?(console.error("expected to find stack but could not"),"unknown top location"):e[0],Iy=e=>e.length>=2?e[1]:null,Ia=e=>{const{slot:t,labwareState:r,modulesState:n}=e,a=Object.values(n).find(({slot:o,moduleState:s})=>o===t&&s.type===c.FLEX_STACKER_MODULE_TYPE);if(a!=null){const o=a.moduleState.labwareOnShuttle;return o==null?[]:[o.lidLabwareId,o.primaryLabwareId,o.adapterLabwareId].filter(i=>i!=null)}return Object.values(r).reduce((o,{stack:s})=>(s[s.length-1]===t&&s.length>o.length&&(o=s),o),[])},ep=e=>c.FLEX_SINGLE_SLOT_BY_CUTOUT_ID[c.FLEX_CUTOUT_BY_SLOT_ID[e]],wy=e=>{const t=c.FLEX_STACKER_ADDRESSABLE_AREAS.indexOf(e);return t===-1?null:De[t]},zw=e=>{const t=wy(e);return t!=null?ep(t):null},Sy=(e,t,r)=>{if(e==null)return null;if(De.includes(e)){const n=ep(e);return Object.entries(t).some(([o,s])=>r[o]?.type===c.FLEX_STACKER_MODULE_TYPE&&s.slot===n)?n:e}return e},Uo=e=>{const t=c.getDeckDefFromRobotType(c.FLEX_ROBOT_TYPE),r=`${e[0]}3`,n=c.FLEX_CUTOUT_BY_SLOT_ID[r],a=t.cutoutFixtures.find(({id:o})=>o===c.FLEX_STACKER_V1_FIXTURE)?.providesAddressableAreas[n];return c.FLEX_STACKER_ADDRESSABLE_AREAS.find(o=>a?.includes(o))??null},gy=(e,t,r,n)=>{if(t.length===0)return{isCompatible:!0,isAboveStackLimit:!1};let a=!1;const o=t.find(u=>u in n);o!=null&&(a=n[o].type===c.FLEX_STACKER_MODULE_TYPE&&t.includes(et));const s=Fo(t);let i=!0,l=!1;if(s in r){const u=r[e],p=r[s],d=t.filter(k=>r[k]!=null),f=d.filter(k=>r[k]?.def?.allowedRoles?.includes("lid"))[0],m=d.filter(k=>r[k]?.def?.allowedRoles?.includes("adapter"))[0],h=p.def.parameters.loadName,_=d.filter(k=>!r[k]?.def?.allowedRoles?.includes("adapter")&&!r[k]?.def?.allowedRoles?.includes("lid"))[0];if(a){const k=c.getMaxPoolCount({labwareDefinitions:{primary:r[_]?.def??null,adapter:r[m]?.def??null,lid:r[f]?.def??null},model:c.FLEX_STACKER_MODULE_V1});l=t.length>k}else{const k=p.def.stackLimit??1,D=h===u.def.parameters.loadName,M=t.filter(G=>r[G]?.def.parameters.loadName===h)?.length;l=D&&M>=k}const y=u.def.parameters.loadName==="opentrons_tough_universal_lid",T=p.def.metadata.displayCategory==="tubeRack",b=p.def.metadata.displayCategory==="aluminumBlock",w=p.def.parameters.isTiprack,g=(p.def.allowedRoles??[]).includes("lid"),L=sy(p.def),I=t.some(k=>k in r&&$w(r[k].def)),A=u.def.parameters.quirks?.includes("vacuumModuleDock")??!1,O=wa(u.def)?uy(u.def,t,r):null;if(O!=null)l=O.isAboveStackLimit,i=O.isCompatible;else{const k=u.def,D=p.def,M=k.parameters.quirks?.includes("filterPlate")??!1,G=D.parameters.quirks?.includes("filterPlate")??!1,Y=D.parameters.quirks?.includes("providesStackingDefault")??!1,ae=M&&!g&&!w&&!G,fe=!I&&A,J=Y&&!L,Re=k.compatibleParentLabware?.includes(h)??!1,Ve=h in(k.stackingOffsetWithLabware??{}),Me=D.parameters.loadName==="opentrons_tough_universal_lid";i=ae||fe||J||Re||Ve||y&&!T&&!b&&!w&&(Me||!g)}}else if(s in n){const u=n[s],{model:p}=u;i=Object.keys(r[e].def.stackingOffsetWithModule??{}).some(d=>p===d)}return{isCompatible:i,isAboveStackLimit:l}},za=(e,t)=>t?.find(r=>e[r]!=null)??null,jw=(e,t,r)=>t?e:r?o_[e]:e,$o=(e,t,r)=>{if(t==="offDeck"&&r==null)return console.error("offDeck slot is not allowed to be used without an offDeckOverrideId"),[];const n=Sa(t),a=Ey(t),o=jw(t,n,a),s=Object.values(e).filter(i=>i.stack.includes(o)&&(r==null||i.stack.includes(r))&&i.stack.includes(et)===a&&i.stack.includes(wc)===n);return s.length===0?[]:a?s.at(-1)?.stack??[]:n?s.at(-1)?.stack??[]:s.toSorted((i,l)=>l.stack.length-i.stack.length)[0]?.stack??[]},Ww=(e,t)=>Object.values(t).filter(r=>r.stack.includes(e)).sort((r,n)=>n.stack.length-r.stack.length)[0]?.stack[0],_a=(e,t,r,n=!0)=>{const a=c.linearInterpolate(e,t)??0,o=c.linearInterpolate(e,r)??0;return e+(n?a:0)+o},tp=e=>{const{path:t,volume:r,pipetteSpecs:n,tiprackDefinition:a,conditioningByVolume:o,disposalByVolume:s,numDispenseWells:i,numAspirateWells:l,aspirateAirGapByVolume:u}=e,{liquids:p}=n,f=r<p.default.minVolume&&"lowVolumeDefault"in p?p.lowVolumeDefault.maxVolume:p.default.maxVolume,m=a?.wells.A1.totalLiquidVolume,h=m==null?f:Math.min(f,m),_=r*2,y=o!=null?c.linearInterpolate(_,o)??0:0,b=a?.namespace!=="opentrons"||o!=null&&s!=null&&h>=_+y+(c.linearInterpolate(_,s)??0)+(y===0?c.linearInterpolate(_,u)??0:0),w=h>=_;if(t==="multiAspirate"&&l<=i?console.warn("Invalid combination of source and destination wells for multiAspirate path"):t==="multiDispense"&&l>=i?console.warn("Invalid combination of source and destination wells for multiDispense path"):t==="single"&&l!==i&&console.warn("Invalid combination of source and destination wells for single path"),t==="single"||t==="multiDispense"&&!b||t==="multiAspirate"&&!w){const I=c.linearInterpolate(r,u)??0,A=Math.ceil((r+I)/h),E=r/A;return{referenceVolumes:{airGap:{aspirate:E,dispense:0},correction:{aspirate:E,dispense:E},pushOut:E,flowRate:{aspirate:E,dispense:E}},multiWellHandling:{isSupported:!1}}}if(t==="multiDispense"){let I=0,A=0;for(let E=0;E<i&&!(_a((E+1)*r,o??[],s??[])>h);E++)I=(E+1)*r,A+=1;return{referenceVolumes:{airGap:{aspirate:_a(I,o??[],s??[],!1),dispense:_a((A-1)*r,o??[],s??[],!1)},correction:{aspirate:_a(I,o??[],s??[]),dispense:r},flowRate:{aspirate:_a(I,o??[],s??[]),dispense:r},pushOut:r,conditioning:I,disposal:I},multiWellHandling:{isSupported:!0,numWellsToFitInTip:A}}}const S=Math.floor(h/r),g=Math.min(S,l),L=g*r;return{referenceVolumes:{airGap:{aspirate:L,dispense:0},pushOut:L,correction:{aspirate:L,dispense:L},flowRate:{aspirate:r,dispense:L}},multiWellHandling:{isSupported:!0,numWellsToFitInTip:g}}},xr=e=>{const{retractZOffset:t,retractPositionReference:r,labwareId:n,labwareEntities:a,well:o}=e;if(o==null)return!1;const s=a[n]?.def.wells[o]?.depth;if(s==null)return!1;const i=c.getMmFromBottom(t,r,s);return i==null?!1:i-s>=c.SAFE_MOVE_TO_WELL_OFFSET_FROM_TOP_MM},nc=e=>e.reduce((t,r)=>{const{kind:n}=r;return n==="onCutoutFixture"?t:n==="onLabware"?[...t,r.labwareId]:n==="onModule"||n==="inStackerHopper"?[...t,r.moduleId]:n==="onAddressableArea"?[...t,r.addressableAreaName]:[...t,r.logicalLocationName]},[]),Gw={A4:"cutoutA3",B4:"cutoutB3",C4:"cutoutC3",D4:"cutoutD3"};function ac(e){if(e.location!=="offDeck"&&e.location!=="systemLocation"&&e.location!=="wasteChuteLocation"&&"addressableAreaName"in e.location&&n_.includes(e.location.addressableAreaName)){const t=$(),r=e.location.addressableAreaName,n=Gw[r]??r;return{[t]:{id:t,location:n}}}return{}}const Ey=e=>a_.includes(e),Sa=e=>e===c.VACUUM_MODULE_DOCK_A4_ADDRESSABLE_AREA,rp=e=>e.labwareOnShuttle?.primaryLabwareId??null,np=(e,t,r)=>{if(r?.storedLabwareDetails==null)return!0;const n=Object.values(r?.storedLabwareDetails??{}).reduce((o,s)=>s!=null?[...o,s]:o,[]),a=t.labwareEntities[e];return n.some(o=>a?.labwareDefURI===o)},ap=(e,t)=>{const{storedLabwareDetails:r}=e??{};if(r==null)return!0;const{primaryLabwareURI:n,adapterLabwareURI:a,lidLabwareURI:o}=r,s=Object.values(t).find(({labwareDefURI:f})=>f===n),i=Object.values(t).find(({labwareDefURI:f})=>f===a),l=Object.values(t).find(({labwareDefURI:f})=>f===o);if(s==null)return console.error("Primary labware entity not found"),!1;const u=c.getMaxPoolCount({labwareDefinitions:{primary:s.def,adapter:i?.def??null,lid:l?.def??null},model:c.FLEX_STACKER_MODULE_V1}),d=e?.labwareInHopper?.length??0;return u>d},Ay=e=>{const{labwareId:t,labwareRobotState:r,labwareEntities:n}=e;return Object.entries(r).some(([a,{stackedOnNode:o}])=>typeof o=="object"&&"labwareId"in o&&o.labwareId===t&&c.getIsLid(n[a].def))},Ly=e=>![Nn,c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA,...De].some(t=>e===t);function U(e,t){if(typeof e=="number")return e;const r=t[e];return r!=null&&(r.type==="float"||r.type==="int")?r.default:null}function v(e,t){const r=t[e];return r==null?e:r.type==="string"?r.default:null}function lt(e,t){if(typeof e=="boolean")return e;const r=t[e];return r!=null&&r.type==="boolean"?r.default:null}function En(e,t,r){const n=v(e,r);return n==null||!t.includes(n)?null:n}function oc(e,t,r){return r[e]!=null?e:F(t)}function Cn(e,t){if(e==null)return{location:void 0,invalidParameterNames:[]};const r=[],n=e.origin==null?void 0:v(e.origin,t);e.origin!=null&&n==null&&r.push(e.origin);const a={};if(e.offset!=null)for(const o of["x","y","z"]){const s=e.offset[o];if(s==null)continue;const i=U(s,t);i==null?r.push(String(s)):a[o]=i}return{location:{...n!=null?{origin:n}:{},...e.offset!=null?{offset:a}:{}},invalidParameterNames:r}}const ja=(e,t,r)=>{const n=t[r]?.stack,a=za(e,n),o=a!=null?e[a].moduleState:null;return!!(o&&o.type===c.ABSORBANCE_READER_TYPE&&o.lidOpen!==!0)};var Pl,im;function Oy(){if(im)return Pl;im=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return Pl=e,Pl}var Yw=Oy();const op=Ge(Yw);var vy=Symbol.for("immer-nothing"),lm=Symbol.for("immer-draftable"),ut=Symbol.for("immer-state"),Kw=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Qe(e,...t){if(process.env.NODE_ENV!=="production"){const r=Kw[e],n=typeof r=="function"?r.apply(null,t):r;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ga=Object.getPrototypeOf;function Dn(e){return!!e&&!!e[ut]}function Hr(e){return e?Py(e)||Array.isArray(e)||!!e[lm]||!!e.constructor?.[lm]||Wa(e)||Vo(e):!1}var Zw=Object.prototype.constructor.toString(),um=new WeakMap;function Py(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=um.get(r);return n===void 0&&(n=Function.toString.call(r),um.set(r,n)),n===Zw}function _o(e,t,r=!0){qo(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(a=>{t(a,e[a],e)}):e.forEach((n,a)=>t(a,n,e))}function qo(e){const t=e[ut];return t?t.type_:Array.isArray(e)?1:Wa(e)?2:Vo(e)?3:0}function sc(e,t){return qo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ry(e,t,r){const n=qo(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function Xw(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Wa(e){return e instanceof Map}function Vo(e){return e instanceof Set}function Ur(e){return e.copy_||e.base_}function ic(e,t){if(Wa(e))return new Map(e);if(Vo(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=Py(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[ut];let a=Reflect.ownKeys(n);for(let o=0;o<a.length;o++){const s=a[o],i=n[s];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[s]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[s]})}return Object.create(ga(e),n)}else{const n=ga(e);if(n!==null&&r)return{...e};const a=Object.create(n);return Object.assign(a,e)}}function sp(e,t=!1){return Bo(e)||Dn(e)||!Hr(e)||(qo(e)>1&&Object.defineProperties(e,{set:uo,add:uo,clear:uo,delete:uo}),Object.freeze(e),t&&Object.values(e).forEach(r=>sp(r,!0))),e}function Qw(){Qe(2)}var uo={value:Qw};function Bo(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var Jw={};function zr(e){const t=Jw[e];return t||Qe(0,e),t}var Ea;function ky(){return Ea}function eS(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function cm(e,t){t&&(zr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function lc(e){uc(e),e.drafts_.forEach(tS),e.drafts_=null}function uc(e){e===Ea&&(Ea=e.parent_)}function pm(e){return Ea=eS(Ea,e)}function tS(e){const t=e[ut];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function dm(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[ut].modified_&&(lc(t),Qe(4)),Hr(e)&&(e=yo(t,e),t.parent_||bo(t,e)),t.patches_&&zr("Patches").generateReplacementPatches_(r[ut].base_,e,t.patches_,t.inversePatches_)):e=yo(t,r,[]),lc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==vy?e:void 0}function yo(e,t,r){if(Bo(t))return t;const n=e.immer_.shouldUseStrictIteration(),a=t[ut];if(!a)return _o(t,(o,s)=>fm(e,a,t,o,s,r),n),t;if(a.scope_!==e)return t;if(!a.modified_)return bo(e,a.base_,!0),a.base_;if(!a.finalized_){a.finalized_=!0,a.scope_.unfinalizedDrafts_--;const o=a.copy_;let s=o,i=!1;a.type_===3&&(s=new Set(o),o.clear(),i=!0),_o(s,(l,u)=>fm(e,a,o,l,u,r,i),n),bo(e,o,!1),r&&e.patches_&&zr("Patches").generatePatches_(a,r,e.patches_,e.inversePatches_)}return a.copy_}function fm(e,t,r,n,a,o,s){if(a==null||typeof a!="object"&&!s)return;const i=Bo(a);if(!(i&&!s)){if(process.env.NODE_ENV!=="production"&&a===r&&Qe(5),Dn(a)){const l=o&&t&&t.type_!==3&&!sc(t.assigned_,n)?o.concat(n):void 0,u=yo(e,a,l);if(Ry(r,n,u),Dn(u))e.canAutoFreeze_=!1;else return}else s&&r.add(a);if(Hr(a)&&!i){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===a&&i)return;yo(e,a),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(Wa(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&bo(e,a)}}}function bo(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&sp(t,r)}function rS(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:ky(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=n,o=ip;r&&(a=[n],o=Aa);const{revoke:s,proxy:i}=Proxy.revocable(a,o);return n.draft_=i,n.revoke_=s,i}var ip={get(e,t){if(t===ut)return e;const r=Ur(e);if(!sc(r,t))return nS(e,r,t);const n=r[t];return e.finalized_||!Hr(n)?n:n===Rl(e.base_,t)?(kl(e),e.copy_[t]=pc(n,e)):n},has(e,t){return t in Ur(e)},ownKeys(e){return Reflect.ownKeys(Ur(e))},set(e,t,r){const n=Ny(Ur(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const a=Rl(Ur(e),t),o=a?.[ut];if(o&&o.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(Xw(r,a)&&(r!==void 0||sc(e.base_,t)))return!0;kl(e),cc(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Rl(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,kl(e),cc(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Ur(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){Qe(11)},getPrototypeOf(e){return ga(e.base_)},setPrototypeOf(){Qe(12)}},Aa={};_o(ip,(e,t)=>{Aa[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Aa.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Qe(13),Aa.set.call(this,e,t,void 0)};Aa.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Qe(14),ip.set.call(this,e[0],t,r,e[0])};function Rl(e,t){const r=e[ut];return(r?Ur(r):e)[t]}function nS(e,t,r){const n=Ny(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}function Ny(e,t){if(!(t in e))return;let r=ga(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=ga(r)}}function cc(e){e.modified_||(e.modified_=!0,e.parent_&&cc(e.parent_))}function kl(e){e.copy_||(e.copy_=ic(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var aS=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const o=r;r=t;const s=this;return function(l=o,...u){return s.produce(l,p=>r.call(this,p,...u))}}typeof r!="function"&&Qe(6),n!==void 0&&typeof n!="function"&&Qe(7);let a;if(Hr(t)){const o=pm(this),s=pc(t,void 0);let i=!0;try{a=r(s),i=!1}finally{i?lc(o):uc(o)}return cm(o,n),dm(a,o)}else if(!t||typeof t!="object"){if(a=r(t),a===void 0&&(a=t),a===vy&&(a=void 0),this.autoFreeze_&&sp(a,!0),n){const o=[],s=[];zr("Patches").generateReplacementPatches_(t,a,o,s),n(o,s)}return a}else Qe(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(s,...i)=>this.produceWithPatches(s,l=>t(l,...i));let n,a;return[this.produce(t,r,(s,i)=>{n=s,a=i}),n,a]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Hr(e)||Qe(8),Dn(e)&&(e=oS(e));const t=pm(this),r=pc(e,void 0);return r[ut].isManual_=!0,uc(t),r}finishDraft(e,t){const r=e&&e[ut];(!r||!r.isManual_)&&Qe(9);const{scope_:n}=r;return cm(n,t),dm(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const a=t[r];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}r>-1&&(t=t.slice(r+1));const n=zr("Patches").applyPatches_;return Dn(e)?n(e,t):this.produce(e,a=>n(a,t))}};function pc(e,t){const r=Wa(e)?zr("MapSet").proxyMap_(e,t):Vo(e)?zr("MapSet").proxySet_(e,t):rS(e,t);return(t?t.scope_:ky()).drafts_.push(r),r}function oS(e){return Dn(e)||Qe(10,e),Cy(e)}function Cy(e){if(!Hr(e)||Bo(e))return e;const t=e[ut];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=ic(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=ic(e,!0);return _o(r,(a,o)=>{Ry(r,a,Cy(o))},n),t&&(t.finalized_=!1),r}var sS=new aS,Dy=sS.produce;function iS(e,t){let n=0;const a=[];for(;n+1<e.length;){const o=e[n],s=e[n+1];if(t(o,s)){n+=2;continue}else a.push(o),n+=1}return n+1===e.length&&a.push(e[n]),a}const lS=(e,t)=>["pipetteId","volume","labwareId","wellName"].every(n=>e[n]===t[n]),uS=e=>iS(e,(t,r)=>t.commandType==="aspirate"&&r.commandType==="dispense"&&lS(t.params,r.params)),My=e=>uS(e),lp=(e,t)=>{const r=Rt(e,t);return r.type===c.ABSORBANCE_READER_TYPE?r:(console.error(`Absorbance reader state updater expected ${t} moduleState to be absorbanceReader, but it was ${r.type}`),null)},cS=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:a}=t,o=v(e.moduleId,a);if(o==null){console.error(`forAbsorbanceReaderOpenLid: arg resolved to null (moduleId=${String(o)})`);return}const s=lp(n,o);s!=null&&(s.lidOpen=!0)},pS=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:a}=t,o=v(e.moduleId,a);if(o==null){console.error(`forAbsorbanceReaderCloseLid: arg resolved to null (moduleId=${String(o)})`);return}const s=lp(n,o);s!=null&&(s.lidOpen=!1)},dS=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:a}=t,{measureMode:o,sampleWavelengths:s,referenceWavelength:i}=e,l=v(e.moduleId,a),u=v(o,a),p=u==="single"||u==="multi"?u:null,d=s.map(h=>U(h,a)),f=i==null?void 0:U(i,a);if(l==null||p==null||d.some(h=>h==null)||f===null){console.error(`forAbsorbanceReaderInitialize: arg resolved to null (moduleId=${String(l)}, measureMode=${String(p)}, sampleWavelengths=${String(d)}, referenceWavelength=${String(f)})`);return}const m=lp(n,l);m!=null&&(m.initialization={mode:p,wavelengths:d,referenceWavelength:f},m.lidOpen=!1)};function fS(e,t,r){const{runtimeParameters:n}=t,a=v(e.pipetteId,n),o=U(e.volume,n);if(a==null||o==null){console.error(`forAirGapInPlace: arg resolved to null (pipetteId=${String(a)}, volume=${String(o)})`);return}const{robotState:s}=r,i=s.pipettes[a].nozzles;let u=t.pipetteEntities[a].spec.channels;i===c.COLUMN?u=8:i===c.SINGLE&&(u=1),gn(u).forEach(p=>{const d=s.liquidState.pipettes[a][p]??{},f=d[Ye]?.volume??0;s.liquidState.pipettes[a][p]={...d,[Ye]:{volume:f+o}}})}var Nl,mm;function mS(){if(mm)return Nl;mm=1;var e=A_(),t=Va(),r=So(),n=tt(),a=Gr(),o=vo(),s=Ro(),i=Dc(),l="[object Map]",u="[object Set]",p=Object.prototype,d=p.hasOwnProperty;function f(m){if(m==null)return!0;if(a(m)&&(n(m)||typeof m=="string"||typeof m.splice=="function"||o(m)||i(m)||r(m)))return!m.length;var h=t(m);if(h==l||h==u)return!m.size;if(s(m))return!e(m).length;for(var _ in m)if(d.call(m,_))return!1;return!0}return Nl=f,Nl}var hS=mS();const Cl=Ge(hS);var Dl,hm;function _S(){if(hm)return Dl;hm=1;function e(t,r,n,a){for(var o=t.length,s=n+(a?1:-1);a?s--:++s<o;)if(r(t[s],s,t))return s;return-1}return Dl=e,Dl}var Ml,_m;function yS(){if(_m)return Ml;_m=1;function e(t){return t!==t}return Ml=e,Ml}var Fl,ym;function bS(){if(ym)return Fl;ym=1;function e(t,r,n){for(var a=n-1,o=t.length;++a<o;)if(t[a]===r)return a;return-1}return Fl=e,Fl}var Ul,bm;function TS(){if(bm)return Ul;bm=1;var e=_S(),t=yS(),r=bS();function n(a,o,s){return o===o?r(a,o,s):e(a,t,s)}return Ul=n,Ul}var $l,Tm;function IS(){if(Tm)return $l;Tm=1;var e=TS();function t(r,n){var a=r==null?0:r.length;return!!a&&e(r,n,0)>-1}return $l=t,$l}var ql,Im;function wS(){if(Im)return ql;Im=1;function e(t,r,n){for(var a=-1,o=t==null?0:t.length;++a<o;)if(n(r,t[a]))return!0;return!1}return ql=e,ql}var Vl,wm;function SS(){if(wm)return Vl;wm=1;function e(){}return Vl=e,Vl}var Bl,Sm;function gS(){if(Sm)return Bl;Sm=1;var e=O_(),t=SS(),r=Pc(),n=1/0,a=e&&1/r(new e([,-0]))[1]==n?function(o){return new e(o)}:t;return Bl=a,Bl}var xl,gm;function ES(){if(gm)return xl;gm=1;var e=m_(),t=IS(),r=wS(),n=__(),a=gS(),o=Pc(),s=200;function i(l,u,p){var d=-1,f=t,m=l.length,h=!0,_=[],y=_;if(p)h=!1,f=r;else if(m>=s){var T=u?null:a(l);if(T)return o(T);h=!1,f=n,y=new e}else y=u?[]:_;e:for(;++d<m;){var b=l[d],w=u?u(b):b;if(b=p||b!==0?b:0,h&&w===w){for(var S=y.length;S--;)if(y[S]===w)continue e;u&&y.push(w),_.push(b)}else f(y,w,p)||(y!==_&&y.push(w),_.push(b))}return _}return xl=i,xl}var Hl,Em;function AS(){if(Em)return Hl;Em=1;var e=ES();function t(r){return r&&r.length?e(r):[]}return Hl=t,Hl}var LS=AS();const OS=Ge(LS),up=e=>{const{nozzles:t,pipetteSpec:r,primaryNozzle:n}=e,a=r.channels;if(t==null)return a;switch(t){case c.ROW:return 12;case c.COLUMN:return 8;case c.SINGLE:return 1;case c.ALL:return a;case c.PARTIAL_COLUMN:return c.PARTIAL_NOZZLE_MAP[n];default:return a}};function vS(e,t,r){const{pipetteId:n,volume:a}=e,{robotState:o,warnings:s}=r,i="labwareId"in e?e.labwareId:o.pipettes[n].entityId??"",l="wellName"in e?e.wellName:o.pipettes[n].wellName??"",{liquidState:u}=o,p=o.pipettes[n].nozzles,d=r.robotState.pipettes[n].primaryNozzle,f=t.pipetteEntities[n].spec,m=t.labwareEntities[i].def,h=m.metadata.displayCategory==="reservoir",_=up({pipetteSpec:f,nozzles:p,primaryNozzle:d}),{allWellsShared:y,wellsForTips:T}=Qc(_,m,l);if(console.assert(OS(T).length===y?1:T.length,`expected all wells to be shared, or no wells to be shared. Got: ${JSON.stringify(T)}`),_>1&&y){const w=T[0],S=u.labware[i][w],g=a*_>br(S);Cl(S)?s.push(vl()):g&&s.push(Ol());const L=g?br(S)/_:a,I=nr(L,S).dest;gn(_).forEach(A=>{const E=u.pipettes[n],O=A.toString(),k=E[O],D=g?Tr(k,{...I,[Ye]:{volume:a-L}}):Tr(k,I);E[O]=D}),u.labware[i][w]=nr(a*_,u.labware[i][w]).source;return}if(_===96&&h){T.forEach(w=>{const S=u.labware[i][w],g=a*8>br(S);Cl(S)?s.push(vl()):g&&s.push(Ol());const L=g?br(S)/8:a,I=nr(L,S).dest;gn(_).forEach(A=>{const E=u.pipettes[n],O=A.toString(),k=E[O],D=g?Tr(k,{...I,[Ye]:{volume:a-L}}):Tr(k,I);E[O]=D}),u.labware[i][w]=nr(L*8,u.labware[i][w]).source});return}gn(_).forEach(w=>{const S=w.toString(),g=u.pipettes[n],L=g[S],I=u.labware[i][T[w]],A=nr(a,I).dest;Cl(I)?s.push(vl()):a>br(I)&&s.push(Ol()),g[S]=Tr(L,A)});const b=u.labware[i];T.forEach(w=>{b[w]=nr(a,b[w]).source}),"labwareId"in e&&(o.pipettes[n]={...o.pipettes[n],entityId:e.labwareId,wellName:l})}function xo(e){const{robotStateAndWarnings:t,invariantContext:r,entityId:n,pipetteId:a,prevLiquidState:o,useFullVolume:s,volume:i,wellName:l}=e,u=r.pipetteEntities[a].spec,p=t.robotState.pipettes[a].nozzles,d=t.robotState.pipettes[a].primaryNozzle,f=up({pipetteSpec:u,nozzles:p,primaryNozzle:d}),m=l??null,h=r.labwareEntities[n]!=null?r.labwareEntities[n].def:null;console.assert(!(s&&typeof i=="number"),"dispenseUpdateLiquidState takes either `volume` or `useFullVolume`, but got both"),console.assert(typeof i=="number"||s,"in dispenseUpdateLiquidState, either volume or useFullVolume are required");const{wellsForTips:_,allWellsShared:y}=h!=null&&l!=null?Qc(f,h,l):{wellsForTips:null,allWellsShared:!0},T=o.labware[n]!=null?o.labware[n]:null;let b=null;o.trashBins[n]!=null?b=o.trashBins[n]:o.wasteChute[n]!=null&&(b=o.wasteChute[n]);const w=or(o.pipettes[a],I=>{const{...A}=I;if(s){const E=br(A);return E>0?nr(E,A):{source:{},dest:{}}}return nr(i||0,A)});let S=null;if(m!=null&&T!=null)S={[m]:ft(w,(I,A)=>Tr(I,A.dest),T[m])};else if(b!=null){const I=Object.values(o.pipettes[a]).reduce((A,E)=>A+(E[0]?.volume??0),0);b[0]={volume:I}}S==null&&b==null&&console.assert(!1,`expected to merge liquid to a single well with sourceId ${n}`);const g=m!=null&&T!=null&&_!=null?_.reduce((I,A,E)=>({...I,[A]:Tr(w[`${E}`].dest,T[A]||{})}),{}):{},L=y?S:g;o.pipettes[a]=or(w,"source"),o.trashBins[n]!=null&&b!=null?Object.assign(o.trashBins[n],b):o.wasteChute[n]!=null&&b!=null?Object.assign(o.wasteChute[n],b):o.labware[n]!=null&&L!=null&&(o.labware[n]=Object.assign(T??{},L))}function PS(e,t,r){const{pipetteId:n,labwareId:a,wellName:o}=e,{robotState:s}=r;xo({pipetteId:n,entityId:a,useFullVolume:!0,wellName:o,prevLiquidState:s.liquidState,invariantContext:t,robotStateAndWarnings:r})}function RS(e,t,r){const{pipetteId:n,configurationParams:a}=e,{style:o,primaryNozzle:s}=a,{runtimeParameters:i}=t,l=v(n,i),u=En(o,gc,i),p=s==null?void 0:En(s,Ec,i);if(l==null||u==null||s!=null&&p==null){console.error(`forConfigureNozzleLayout: arg resolved to null (pipetteId=${String(l)}, style=${String(u)}, primaryNozzle=${String(p)})`);return}const{robotState:d}=r;d.pipettes[l].nozzles=u,d.pipettes[l].primaryNozzle=p??void 0}function kS(e,t,r){const{pipetteId:n,volume:a}=e,{robotState:o}=r,s="labwareId"in e?e.labwareId:o.pipettes[n].entityId??"",i="wellName"in e?e.wellName:o.pipettes[n].wellName??"",l=o.liquidState.pipettes[n],p=Object.values(l)[0]?.[Ye]?.volume??0,d=r.robotState.pipettes[n].primaryNozzle;if(xo({invariantContext:t,entityId:s,pipetteId:n,prevLiquidState:o.liquidState,useFullVolume:!1,volume:a,wellName:i,robotStateAndWarnings:r}),p>0){const f=r.robotState.pipettes[n].nozzles,m=t.pipetteEntities[n].spec,h=up({pipetteSpec:m,nozzles:f,primaryNozzle:d});Object.keys(l).slice(0,h).forEach(y=>{const T=l[y]??{};l[y]={...T,[Ye]:{volume:0}}})}"labwareId"in e&&(o.pipettes[n]={...o.pipettes[n],entityId:e.labwareId})}function NS(e,t,r){const{runtimeParameters:n}=t,a=v(e.pipette,n),o=e.dropTipLocation==null?void 0:v(e.dropTipLocation,n),s=e.wellName==null?void 0:v(e.wellName,n);if(a==null||e.dropTipLocation!=null&&o==null||e.wellName!=null&&s==null){console.error(`forDropTip: arg resolved to null (pipetteId=${String(a)}, labwareId=${String(o)}, wellName=${String(s)})`);return}const{robotState:i}=r;i.tipState.pipettes[a].hasTip=!1,i.tipState.pipettes[a].tiprackURI=null,i.pipettes[a].tiprackId=void 0;const l=i.tipState,u=t.pipetteEntities[a].spec,p=i.pipettes[a].nozzles,d=Tp(p,u),f=(h,_)=>h.find(y=>y.includes(_)),m=o==null?void 0:t.labwareEntities[o]?.def;o==null||s==null||m==null||!c.getIsTiprack(m)?console.warn(`forDropTip expected ${o} to have definition and to be a tiprack`):(d===c.SINGLE?l.tipracks[o][s]=tr:d===c.COLUMN?(f(m.ordering,s)??[]).forEach(_=>l.tipracks[o][_]=tr):d===c.ALL?u.channels===96?m.ordering.reduce((_,y)=>_.concat(y),[]).forEach(function(_){l.tipracks[o][_]=tr}):(f(m.ordering,s)??[]).forEach(_=>l.tipracks[o][_]=tr):u.channels===1?l.tipracks[o][s]=tr:u.channels===96?m.ordering.reduce((_,y)=>_.concat(y),[]).forEach(function(_){l.tipracks[o][_]=tr}):(f(m.ordering,s)??[]).forEach(_=>l.tipracks[o][_]=tr),i.pipettes[a].entityId=o,i.pipettes[a].wellName=s)}function CS(e,t,r){const{labwareId:n,liquidId:a,volumeByWell:o}=e;Object.entries(o).forEach(([s,i])=>{r.robotState.liquidState.labware[n][s][a]={volume:i}})}var zl,Am;function DS(){if(Am)return zl;Am=1;function e(t,r){for(var n=-1,a=t==null?0:t.length;++n<a&&r(t[n],n,t)!==!1;);return t}return zl=e,zl}var jl,Lm;function cp(){if(Lm)return jl;Lm=1;var e=$c(),t=go(),r=Object.prototype,n=r.hasOwnProperty;function a(o,s,i){var l=o[s];(!(n.call(o,s)&&t(l,i))||i===void 0&&!(s in o))&&e(o,s,i)}return jl=a,jl}var Wl,Om;function Ga(){if(Om)return Wl;Om=1;var e=cp(),t=$c();function r(n,a,o,s){var i=!o;o||(o={});for(var l=-1,u=a.length;++l<u;){var p=a[l],d=s?s(o[p],n[p],p,o,n):void 0;d===void 0&&(d=n[p]),i?t(o,p,d):e(o,p,d)}return o}return Wl=r,Wl}var Gl,vm;function MS(){if(vm)return Gl;vm=1;var e=Ga(),t=qa();function r(n,a){return n&&e(a,t(a),n)}return Gl=r,Gl}var Yl,Pm;function FS(){if(Pm)return Yl;Pm=1;function e(t){var r=[];if(t!=null)for(var n in Object(t))r.push(n);return r}return Yl=e,Yl}var Kl,Rm;function US(){if(Rm)return Kl;Rm=1;var e=lr(),t=Ro(),r=FS(),n=Object.prototype,a=n.hasOwnProperty;function o(s){if(!e(s))return r(s);var i=t(s),l=[];for(var u in s)u=="constructor"&&(i||!a.call(s,u))||l.push(u);return l}return Kl=o,Kl}var Zl,km;function pp(){if(km)return Zl;km=1;var e=g_(),t=US(),r=Gr();function n(a){return r(a)?e(a,!0):t(a)}return Zl=n,Zl}var Xl,Nm;function $S(){if(Nm)return Xl;Nm=1;var e=Ga(),t=pp();function r(n,a){return n&&e(a,t(a),n)}return Xl=r,Xl}var Ta={exports:{}};Ta.exports;var Cm;function qS(){return Cm||(Cm=1,(function(e,t){var r=Wt(),n=t&&!t.nodeType&&t,a=n&&!0&&e&&!e.nodeType&&e,o=a&&a.exports===n,s=o?r.Buffer:void 0,i=s?s.allocUnsafe:void 0;function l(u,p){if(p)return u.slice();var d=u.length,f=i?i(d):new u.constructor(d);return u.copy(f),f}e.exports=l})(Ta,Ta.exports)),Ta.exports}var Ql,Dm;function VS(){if(Dm)return Ql;Dm=1;function e(t,r){var n=-1,a=t.length;for(r||(r=Array(a));++n<a;)r[n]=t[n];return r}return Ql=e,Ql}var Jl,Mm;function BS(){if(Mm)return Jl;Mm=1;var e=Ga(),t=Rc();function r(n,a){return e(n,t(n),a)}return Jl=r,Jl}var eu,Fm;function dp(){if(Fm)return eu;Fm=1;var e=E_(),t=e(Object.getPrototypeOf,Object);return eu=t,eu}var tu,Um;function Fy(){if(Um)return tu;Um=1;var e=Ac(),t=dp(),r=Rc(),n=w_(),a=Object.getOwnPropertySymbols,o=a?function(s){for(var i=[];s;)e(i,r(s)),s=t(s);return i}:n;return tu=o,tu}var ru,$m;function xS(){if($m)return ru;$m=1;var e=Ga(),t=Fy();function r(n,a){return e(n,t(n),a)}return ru=r,ru}var nu,qm;function fp(){if(qm)return nu;qm=1;var e=T_(),t=Fy(),r=pp();function n(a){return e(a,r,t)}return nu=n,nu}var au,Vm;function HS(){if(Vm)return au;Vm=1;var e=Object.prototype,t=e.hasOwnProperty;function r(n){var a=n.length,o=new n.constructor(a);return a&&typeof n[0]=="string"&&t.call(n,"index")&&(o.index=n.index,o.input=n.input),o}return au=r,au}var ou,Bm;function mp(){if(Bm)return ou;Bm=1;var e=b_();function t(r){var n=new r.constructor(r.byteLength);return new e(n).set(new e(r)),n}return ou=t,ou}var su,xm;function zS(){if(xm)return su;xm=1;var e=mp();function t(r,n){var a=n?e(r.buffer):r.buffer;return new r.constructor(a,r.byteOffset,r.byteLength)}return su=t,su}var iu,Hm;function jS(){if(Hm)return iu;Hm=1;var e=/\w*$/;function t(r){var n=new r.constructor(r.source,e.exec(r));return n.lastIndex=r.lastIndex,n}return iu=t,iu}var lu,zm;function WS(){if(zm)return lu;zm=1;var e=Fn(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function n(a){return r?Object(r.call(a)):{}}return lu=n,lu}var uu,jm;function GS(){if(jm)return uu;jm=1;var e=mp();function t(r,n){var a=n?e(r.buffer):r.buffer;return new r.constructor(a,r.byteOffset,r.length)}return uu=t,uu}var cu,Wm;function YS(){if(Wm)return cu;Wm=1;var e=mp(),t=zS(),r=jS(),n=WS(),a=GS(),o="[object Boolean]",s="[object Date]",i="[object Map]",l="[object Number]",u="[object RegExp]",p="[object Set]",d="[object String]",f="[object Symbol]",m="[object ArrayBuffer]",h="[object DataView]",_="[object Float32Array]",y="[object Float64Array]",T="[object Int8Array]",b="[object Int16Array]",w="[object Int32Array]",S="[object Uint8Array]",g="[object Uint8ClampedArray]",L="[object Uint16Array]",I="[object Uint32Array]";function A(E,O,k){var D=E.constructor;switch(O){case m:return e(E);case o:case s:return new D(+E);case h:return t(E,k);case _:case y:case T:case b:case w:case S:case g:case L:case I:return a(E,k);case i:return new D;case l:case d:return new D(E);case u:return r(E);case p:return new D;case f:return n(E)}}return cu=A,cu}var pu,Gm;function KS(){if(Gm)return pu;Gm=1;var e=lr(),t=Object.create,r=(function(){function n(){}return function(a){if(!e(a))return{};if(t)return t(a);n.prototype=a;var o=new n;return n.prototype=void 0,o}})();return pu=r,pu}var du,Ym;function ZS(){if(Ym)return du;Ym=1;var e=KS(),t=dp(),r=Ro();function n(a){return typeof a.constructor=="function"&&!r(a)?e(t(a)):{}}return du=n,du}var fu,Km;function XS(){if(Km)return fu;Km=1;var e=Va(),t=ir(),r="[object Map]";function n(a){return t(a)&&e(a)==r}return fu=n,fu}var mu,Zm;function QS(){if(Zm)return mu;Zm=1;var e=XS(),t=Nc(),r=Cc(),n=r&&r.isMap,a=n?t(n):e;return mu=a,mu}var hu,Xm;function JS(){if(Xm)return hu;Xm=1;var e=Va(),t=ir(),r="[object Set]";function n(a){return t(a)&&e(a)==r}return hu=n,hu}var _u,Qm;function eg(){if(Qm)return _u;Qm=1;var e=JS(),t=Nc(),r=Cc(),n=r&&r.isSet,a=n?t(n):e;return _u=a,_u}var yu,Jm;function Uy(){if(Jm)return yu;Jm=1;var e=vc(),t=DS(),r=cp(),n=MS(),a=$S(),o=qS(),s=VS(),i=BS(),l=xS(),u=L_(),p=fp(),d=Va(),f=HS(),m=YS(),h=ZS(),_=tt(),y=vo(),T=QS(),b=lr(),w=eg(),S=qa(),g=pp(),L=1,I=2,A=4,E="[object Arguments]",O="[object Array]",k="[object Boolean]",D="[object Date]",M="[object Error]",G="[object Function]",Y="[object GeneratorFunction]",ae="[object Map]",fe="[object Number]",J="[object Object]",Re="[object RegExp]",Ve="[object Set]",Me="[object String]",je="[object Symbol]",ie="[object WeakMap]",ke="[object ArrayBuffer]",Be="[object DataView]",Ae="[object Float32Array]",oe="[object Float64Array]",K="[object Int8Array]",j="[object Int16Array]",N="[object Int32Array]",B="[object Uint8Array]",q="[object Uint8ClampedArray]",re="[object Uint16Array]",V="[object Uint32Array]",Z={};Z[E]=Z[O]=Z[ke]=Z[Be]=Z[k]=Z[D]=Z[Ae]=Z[oe]=Z[K]=Z[j]=Z[N]=Z[ae]=Z[fe]=Z[J]=Z[Re]=Z[Ve]=Z[Me]=Z[je]=Z[B]=Z[q]=Z[re]=Z[V]=!0,Z[M]=Z[G]=Z[ie]=!1;function W(x,H,le,xe,rt,We){var ye,nt=H&L,bt=H&I,kt=H&A;if(le&&(ye=rt?le(x,xe,rt,We):le(x)),ye!==void 0)return ye;if(!b(x))return x;var Tt=_(x);if(Tt){if(ye=f(x),!nt)return s(x,ye)}else{var Ne=d(x),at=Ne==G||Ne==Y;if(y(x))return o(x,nt);if(Ne==J||Ne==E||at&&!rt){if(ye=bt||at?{}:h(x),!nt)return bt?l(x,a(ye,x)):i(x,n(ye,x))}else{if(!Z[Ne])return rt?x:{};ye=m(x,Ne,nt)}}We||(We=new e);var Ee=We.get(x);if(Ee)return Ee;We.set(x,ye),w(x)?x.forEach(function(ue){ye.add(W(ue,H,le,ue,x,We))}):T(x)&&x.forEach(function(ue,ce){ye.set(ce,W(ue,H,le,ce,x,We))});var Ce=kt?bt?p:u:bt?g:S,Fe=Tt?void 0:Ce(x);return t(Fe||x,function(ue,ce){Fe&&(ce=ue,ue=x[ce]),r(ye,ce,W(ue,H,le,ce,x,We))}),ye}return yu=W,yu}var bu,eh;function $y(){if(eh)return bu;eh=1;function e(t,r,n){var a=-1,o=t.length;r<0&&(r=-r>o?0:o+r),n=n>o?o:n,n<0&&(n+=o),o=r>n?0:n-r>>>0,r>>>=0;for(var s=Array(o);++a<o;)s[a]=t[a+r];return s}return bu=e,bu}var Tu,th;function tg(){if(th)return Tu;th=1;var e=ko(),t=$y();function r(n,a){return a.length<2?n:e(n,t(a,0,-1))}return Tu=r,Tu}var Iu,rh;function rg(){if(rh)return Iu;rh=1;var e=$n(),t=Oy(),r=tg(),n=qn(),a=Object.prototype,o=a.hasOwnProperty;function s(i,l){l=e(l,i);var u=-1,p=l.length;if(!p)return!0;for(;++u<p;){var d=n(l[u]);if(d==="__proto__"&&!o.call(i,"__proto__")||(d==="constructor"||d==="prototype")&&u<p-1)return!1}var f=r(i,l);return f==null||delete f[n(t(l))]}return Iu=s,Iu}var wu,nh;function ng(){if(nh)return wu;nh=1;var e=Un(),t=dp(),r=ir(),n="[object Object]",a=Function.prototype,o=Object.prototype,s=a.toString,i=o.hasOwnProperty,l=s.call(Object);function u(p){if(!r(p)||e(p)!=n)return!1;var d=t(p);if(d===null)return!0;var f=i.call(d,"constructor")&&d.constructor;return typeof f=="function"&&f instanceof f&&s.call(f)==l}return wu=u,wu}var Su,ah;function ag(){if(ah)return Su;ah=1;var e=ng();function t(r){return e(r)?void 0:r}return Su=t,Su}var gu,oh;function og(){if(oh)return gu;oh=1;var e=p_();function t(r){var n=r==null?0:r.length;return n?e(r,1):[]}return gu=t,gu}var Eu,sh;function sg(){if(sh)return Eu;sh=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return Eu=e,Eu}var Au,ih;function qy(){if(ih)return Au;ih=1;var e=sg(),t=Math.max;function r(n,a,o){return a=t(a===void 0?n.length-1:a,0),function(){for(var s=arguments,i=-1,l=t(s.length-a,0),u=Array(l);++i<l;)u[i]=s[a+i];i=-1;for(var p=Array(a+1);++i<a;)p[i]=s[i];return p[a]=o(u),e(n,this,p)}}return Au=r,Au}var Lu,lh;function ig(){if(lh)return Lu;lh=1;function e(t){return function(){return t}}return Lu=e,Lu}var Ou,uh;function lg(){if(uh)return Ou;uh=1;var e=ig(),t=N_(),r=Da(),n=t?function(a,o){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(o),writable:!0})}:r;return Ou=n,Ou}var vu,ch;function ug(){if(ch)return vu;ch=1;var e=800,t=16,r=Date.now;function n(a){var o=0,s=0;return function(){var i=r(),l=t-(i-s);if(s=i,l>0){if(++o>=e)return arguments[0]}else o=0;return a.apply(void 0,arguments)}}return vu=n,vu}var Pu,ph;function Vy(){if(ph)return Pu;ph=1;var e=lg(),t=ug(),r=t(e);return Pu=r,Pu}var Ru,dh;function cg(){if(dh)return Ru;dh=1;var e=og(),t=qy(),r=Vy();function n(a){return r(t(a,void 0,e),a+"")}return Ru=n,Ru}var ku,fh;function pg(){if(fh)return ku;fh=1;var e=$a(),t=Uy(),r=rg(),n=$n(),a=Ga(),o=ag(),s=cg(),i=fp(),l=1,u=2,p=4,d=s(function(f,m){var h={};if(f==null)return h;var _=!1;m=e(m,function(T){return T=n(T,f),_||(_=T.length>1),T}),a(f,i(f),h),_&&(h=t(h,l|u|p,o));for(var y=m.length;y--;)r(h,m[y]);return h});return ku=d,ku}var dg=pg();const fg=Ge(dg),dc="TOUCHED_PIPETTABLE_LABWARE";var Nu,mh;function mg(){if(mh)return Nu;mh=1;var e=Mc();function t(r,n){return e(r,n)}return Nu=t,Nu}var hg=mg();const _g=Ge(hg),Ho=e=>{const{node:t,stack:r=[],robotState:n,memo:a=new Map}=e;let o=r;if(!(typeof t=="object"&&"labwareId"in t))return o=[...r,t],a.set(t,o),{stack:o,memo:a};const{labwareId:s}=t,i=n.labware[s];if(i!=null&&i.stackedOnNode!=null){const{stack:l,memo:u}=Ho({node:i.stackedOnNode,stack:[...r,t],robotState:n,memo:a});By(a,u),o=l,a.set(t,o)}return{stack:o,memo:a}},yg=e=>{const{node:t,robotState:r,deckDef:n,deckConfiguration:a}=e,{stack:o}=Ho({node:t,robotState:r}),{cutoutFixtures:s}=n,i=o.find(l=>typeof l=="object"&&"addressableAreaName"in l);if(i!=null&&typeof i=="object"&&"addressableAreaName"in i){const{addressableAreaName:l}=i;for(const{id:u,providesAddressableAreas:p}of s){const[d]=Object.entries(p).find(([f,m])=>m.includes(l))??[];if(d!=null){const f=a.find(({cutoutId:T})=>T===d),{cutoutFixtureId:m,cutoutId:h}=f,_=m===u&&h===d,y=Object.entries(r.modules).find(([T,{slot:b}])=>c.FLEX_CUTOUT_BY_SLOT_ID[b]===h);if(_&&y!=null)return y[0]}}}return null},By=(e,t)=>{t.forEach((r,n)=>{e.set(n,r)})},bg=(e,t)=>e.some(r=>_g(r,t)),xy=e=>{const{labwareId:t,robotState:r}=e,n=new Map,a={labwareId:t};let o=[];for(const[s,{stackedOnNode:i}]of Object.entries(r.labware)){const l={labwareId:s};if(i==null)continue;let u;const p=n.get(l);if(p!=null)u=p;else{const{stack:d,memo:f}=Ho({node:l,robotState:r,memo:n});if(By(n,f),!bg(d,a))continue;n.set(l,d),u=d}u.length>o.length&&(o=u)}return o},Hy=e=>{const t=[],r=new Set;for(const n of Object.keys(e.labware)){if(r.has(n))continue;const a=xy({labwareId:n,robotState:e});a.forEach(o=>{typeof o=="object"&&"labwareId"in o&&r.add(o.labwareId)}),t.push(a)}return t},hp=e=>{const{moduleId:t,robotState:r,moduleEntities:n,deckDef:a}=e,o=r.modules[t],s=n[t];if(o==null||s==null)return null;const{slot:i}=o,{model:l}=s,u=c.getAddressableAreaNamesFromLoadedModule(l,i,a);return u.length===0?null:u[0]},Tg=e=>{const{location:t,robotState:r,moduleEntities:n,deckDef:a}=e;if(t==="offDeck"||t==="systemLocation"||t==="wasteChuteLocation")return null;if("slotName"in t)return t.slotName;if("addressableAreaName"in t)return t.addressableAreaName;if("moduleId"in t){const{moduleId:o}=t;return hp({moduleId:o,robotState:r,moduleEntities:n,deckDef:a})}return null},zy=e=>{const{deckConfiguration:t,deckDefinition:r}=e;return t.reduce((n,{cutoutFixtureId:a,cutoutId:o})=>((r.cutoutFixtures.find(({id:i})=>a===i)?.providesAddressableAreas[o]??[]).forEach(i=>{n.add(i)}),n),new Set)},Ig=e=>{const{robotState:t,deckConfiguration:r,deckDefinition:n,moduleEntities:a}=e,o=zy({deckConfiguration:r,deckDefinition:n}),s=new Set(o),i=Hy(t);for(const l of i){const u=op(l);if(typeof u=="object"&&"addressableAreaName"in u){const{addressableAreaName:p}=u;s.delete(p)}if(typeof u=="object"&&"slotName"in u){const{slotName:p}=u;s.delete(p)}if(typeof u=="object"&&"moduleId"in u){const{moduleId:p}=u,d=hp({moduleId:p,robotState:t,moduleEntities:a,deckDef:n});d!=null&&s.delete(d)}}return s},wg=e=>{const t=e.toLowerCase();return t.includes("chute")||t.includes("waste")||t.startsWith("gripper")||t==="96channelwastechute"},jy=e=>{const{stack:t,subjectLabwareId:r,moduleEntities:n,labwareEntityIds:a,modules:o}=e;if(t.length===0||t[0]!==r||t.length<2)return;const s=t[1];if(s===et){const u=t[2];return u==null?void 0:{kind:"inStackerHopper",moduleId:u}}if(n[s]!=null)return{moduleId:s};if(a.has(s))return{labwareId:s};if(s==="offDeck")return"offDeck";if(s==="systemLocation")return"systemLocation";if(s==="wasteChuteLocation")return"wasteChuteLocation";if(wg(s))return{addressableAreaName:s};const i=Sy(s,o,n)??s;if(Object.entries(o).some(([u,p])=>n[u]?.type===c.FLEX_STACKER_MODULE_TYPE&&p.slot===i)){const u=Uo(i);if(u!=null)return{addressableAreaName:u}}return{slotName:s}},Sg=e=>typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="inStackerHopper",gg=e=>typeof e!="object"||e===null?!1:!Sg(e),Eg=(e,t)=>{const{id:r,def:n}=e,{id:a,def:o}=t,s=n.dimensions.xDimension,i=n.dimensions.yDimension,l=o.dimensions.xDimension,u=o.dimensions.yDimension;return s>l&&i>u?{containerLabwareId:r,containedLabwareId:a}:l>s&&u>i?{containerLabwareId:a,containedLabwareId:r}:null},_p=(e,t)=>{const r=new Map;for(const a of Object.keys(e)){const o=e[a].stackedOnNode;if(o==null||!gg(o))continue;const s=JSON.stringify(o),i=r.get(s)??[];i.push(a),r.set(s,i)}const n={};for(const a of r.values()){if(a.length!==2)continue;const[o,s]=a,i=t[o],l=t[s];if(i==null||l==null)continue;const u=Eg(i,l);if(u==null)continue;const{containerLabwareId:p,containedLabwareId:d}=u;n[p]=d}return Object.keys(n).length===0?e:or(e,(a,o)=>n[o]!=null?{...a,contains:n[o]}:a)},Ag=(e,t,r)=>{const n=Object.keys(e.labware),a=new Set(n);let o=or(e.labware,(s,i)=>{const l=s.stackedOnNode??jy({stack:s.stack,subjectLabwareId:i,moduleEntities:t,labwareEntityIds:a,modules:e.modules});return l!=null?{...s,stackedOnNode:l}:{...s}});return o=_p(o,r),{...e,labware:o}};function Lg(e,t,r){const{runtimeParameters:n,labwareEntities:a}=t,o=v(e.labwareId,n);let s=null;if(typeof e.newLocation=="string"){const O=v(e.newLocation,n);O!=null&&(s=O)}else if("labwareId"in e.newLocation){const O=v(e.newLocation.labwareId,n);O!=null&&(s=O===e.newLocation.labwareId?e.newLocation:{labwareId:O})}else if("moduleId"in e.newLocation){const O=v(e.newLocation.moduleId,n);O!=null&&(s=O===e.newLocation.moduleId?e.newLocation:{moduleId:O})}else if("slotName"in e.newLocation){const O=v(e.newLocation.slotName,n);O!=null&&(s=O===e.newLocation.slotName?e.newLocation:{slotName:O})}else{const O=v(e.newLocation.addressableAreaName,n);O!=null&&(s=O===e.newLocation.addressableAreaName?e.newLocation:{addressableAreaName:O})}if(o==null||s==null){console.error(`forMoveLabware: arg resolved to null (labwareId=${String(o)}, newLocation=${String(s)})`);return}const{robotState:i}=r,{modules:l,labware:u}=i;if(u[o]==null)return;const p=ee(u[o].stack),d=$o(u,p,o),f=d.indexOf(o),m=d.slice(0,f+1),h=c.getIsLid(a[o].def);let _=!1;const y=Object.entries(l).find(([O,{slot:k}])=>{const{type:D}=t.moduleEntities[O]??{};return D===c.FLEX_STACKER_MODULE_TYPE&&k===p})??null,T=y!=null&&y[1].moduleState.type===c.FLEX_STACKER_MODULE_TYPE?rr.map(O=>y[1].moduleState.labwareOnShuttle?.[O]).filter(O=>O!=null):[],b=T.includes(o)?T.slice(0,T.indexOf(o)+1):[];if(y!=null&&y[1].moduleState.type===c.FLEX_STACKER_MODULE_TYPE){const O=y[1].moduleState,k=rr.findIndex(D=>O.labwareOnShuttle?.[D]===o);if(k!==-1&&O.labwareOnShuttle!=null)for(const D of rr.slice(k,rr.length))if(D==="primaryLabwareId"){O.labwareOnShuttle=null;break}else O.labwareOnShuttle[D]=null}const w=s,S=Object.entries(l).find(([O,{slot:k}])=>{const{type:D}=t.moduleEntities[O]??{};return D===c.FLEX_STACKER_MODULE_TYPE&&typeof w=="object"&&("moduleId"in w&&w.moduleId===O||"slotName"in w&&k===w.slotName)})??null,[g,L]=S??[];if(g!=null&&L!=null){const O=b.length>0?b:Ia({slot:p,labwareState:u,modulesState:l}),k=O.indexOf(o),D=L.moduleState;if(k!==-1){const M=O.slice(0,k+1).toReversed();if(D.labwareOnShuttle==null&&(D.labwareOnShuttle={primaryLabwareId:"",adapterLabwareId:null,lidLabwareId:null}),M.length===3)for(let G=0;G<rr.length;G++){const Y=rr[G];D.labwareOnShuttle[Y]=M[G]}else if(M.length===2){const G=M.some(Y=>t.labwareEntities[Y].def.allowedRoles?.some(ae=>ae==="lid"))?["primaryLabwareId","lidLabwareId"]:["adapterLabwareId","primaryLabwareId"];for(let Y=0;Y<G.length;Y++){const ae=G[Y];D.labwareOnShuttle[ae]=M[Y]}}else M.length===1&&(D.labwareOnShuttle.primaryLabwareId=M[0])}}const I=[];if(c.locationIsOffDeck(s))I.push(s);else if("moduleId"in s)if(l[s.moduleId].moduleState.type===c.FLEX_STACKER_MODULE_TYPE)I.push(l[s.moduleId].slot);else if(t.moduleEntities[s.moduleId]?.type===c.VACUUM_MODULE_TYPE){const O=l[s.moduleId].slot,k=Ia({slot:O,labwareState:u,modulesState:l});k.length>0?I.push(...k):I.push(s.moduleId,O)}else I.push(s.moduleId,l[s.moduleId].slot);else if("slotName"in s){const{slotName:O}=s;O in u?(_=c.getIsPipettableLabware(a[O].def),I.push(...u[O].stack)):I.push(O)}else if("labwareId"in s){const O=s.labwareId;_=c.getIsPipettableLabware(a[O].def);const k=u[O].stack;I.push(...k)}else if("addressableAreaName"in s)if(Sa(s.addressableAreaName)){const O=Object.entries(l).find(([k])=>t.moduleEntities[k]?.type===c.VACUUM_MODULE_TYPE)?.[0];I.push(wc),O!=null&&I.push(O),I.push(s.addressableAreaName)}else I.push(s.addressableAreaName);m.forEach((O,k)=>{if(u[O]!=null){const D=m.slice(k+1);i.labware[O]={...i.labware[O],stack:[O,...D,...I],...h&&_?{sterility:dc}:{}}}});const A=typeof s=="object"&&"labwareId"in s&&c.getIsPipettableLabware(a[s.labwareId].def);let E=s;if(typeof s=="object"&&s!==null&&"moduleId"in s&&l[s.moduleId].moduleState.type===c.FLEX_STACKER_MODULE_TYPE){const O=Uo(l[s.moduleId].slot);O!=null&&(E={addressableAreaName:O})}else if(typeof s=="object"&&s!==null&&"moduleId"in s&&t.moduleEntities[s.moduleId]?.type===c.VACUUM_MODULE_TYPE){const O=l[s.moduleId].slot,k=Ia({slot:O,labwareState:u,modulesState:l}),D=k.length>0?k[0]:null;D!=null&&D in a&&(E={labwareId:D})}i.labware[o].stackedOnNode=E,A&&(i.labware[o].sterility=dc),i.labware=_p(or(i.labware,O=>fg(O,"contains")),a)}function Og(e,t,r){const{runtimeParameters:n}=t,a=v(e.pipetteId,n),o=v(e.addressableAreaName,n);if(a==null||o==null){console.error(`forMoveToAddressableArea: arg resolved to null (pipetteId=${String(a)}, addressableAreaName=${String(o)})`);return}const{wasteChuteEntities:s,trashBinEntities:i}=t,l=o,u=c.WASTE_CHUTE_ADDRESSABLE_AREAS.includes(l),p=Object.values(i).find(m=>m.location===dy(l))?.id,d=u?Object.values(s)[0].id:p,{robotState:f}=r;f.pipettes[a]={...f.pipettes[a],entityId:d}}function vg(e,t,r){const{runtimeParameters:n}=t,a=v(e.pipetteId,n),o=v(e.labwareId,n),s=v(e.wellName,n);if(a==null||o==null||s==null){console.error(`forMoveToWell: arg resolved to null (pipetteId=${String(a)}, labwareId=${String(o)}, wellName=${String(s)})`);return}const{robotState:i}=r;i.pipettes[a]={...i.pipettes[a],entityId:o,wellName:s}}function Pg(e,t,r){const{runtimeParameters:n}=t,a=v(e.pipetteId,n),o=v(e.labwareId,n),s=v(e.wellName,n);if(a==null||o==null||s==null){console.error(`forPickUpTip: arg resolved to null (pipetteId=${String(a)}, labwareId=${String(o)}, wellName=${String(s)})`);return}const i=t.pipetteEntities[a].spec,l=t.labwareEntities[o].def;if(!c.getIsTiprack(l))throw new Error(`forPickUpTip expected ${o} to be a tiprack`);const u=r.robotState.tipState,p=r.robotState.pipettes[a].nozzles,d=r.robotState.pipettes[a].primaryNozzle,f=Tp(p,i),m=(y,T)=>y.find(b=>b.includes(T)),h=(y,T)=>{const b=y.findIndex(S=>S.includes(T));if(b===-1)return null;const w=y[b].indexOf(T);return y.map(S=>S[w])},_=(y,T)=>{const b=c.PARTIAL_NOZZLE_MAP[d],w=y.findIndex(A=>A.includes(T)),S=y[w].indexOf(T),g=y[w];if(g.length-S<b){const A=g.length-b;return g.slice(A,g.length)}const I=S+b;return g.slice(S,Math.min(I,g.length))};if(u.pipettes[a].hasTip=!0,u.pipettes[a].tiprackURI=o,f===c.SINGLE)u.tipracks[o][s]=_e;else if(f===c.PARTIAL_COLUMN&&d){const y=_(l.ordering,s);y==null?console.error(`Invalid primary well for tip pick up for partial config: ${s}`):y.forEach(function(T){u.tipracks[o][T]=_e})}else if(f===c.COLUMN){const y=m(l.ordering,s);y==null&&console.error(`Invalid primary well for tip pickup: ${s}`),y?.forEach(function(T){u.tipracks[o][T]=_e})}else if(f===c.ROW){const y=h(l.ordering,s);y==null&&console.error("Invalid primary well for tip pickup: "+s),y?.forEach(function(T){u.tipracks[o][T]=_e})}else if(f===c.ALL)if(i.channels===96)l.ordering.reduce((T,b)=>T.concat(b),[]).forEach(function(T){u.tipracks[o][T]=_e});else{const y=m(l.ordering,s);y==null&&console.error(`Invalid primary well for tip pickup: ${s}`),y?.forEach(function(T){u.tipracks[o][T]=_e})}else if(i.channels===1)u.tipracks[o][s]=_e;else if(i.channels===96)l.ordering.reduce((T,b)=>T.concat(b),[]).forEach(function(T){u.tipracks[o][T]=_e});else{const y=m(l.ordering,s);y==null&&console.error(`Invalid primary well for tip pickup: ${s}`),y?.forEach(function(T){u.tipracks[o][T]=_e})}r.robotState.pipettes[a].tiprackId=o,r.robotState.pipettes[a].tipWell=s}const Rg={clean:Fa,empty:_e,used:tr};function kg(e,t,r){const{labwareId:n,wellNames:a,tipWellState:o="clean"}=e,s=Rg[o],i=r.robotState.tipState.tipracks[n];i!=null&&a.forEach(l=>{i[l]=s})}const Zr=(e,t)=>{const r=Rt(e,t);return r.type===c.THERMOCYCLER_MODULE_TYPE?r:(console.error(`Thermocycler state updater expected ${t} moduleState to be thermocycler, but it was ${r.type}`),{})},Ng=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.moduleId,n),o=U(e.celsius,n);if(a==null||o==null){console.error(`forThermocyclerSetTargetBlockTemperature: arg resolved to null (moduleId=${String(a)}, celsius=${String(o)})`);return}const{robotState:s}=r,i=Zr(s,a);i.currentBlockActivity={type:"blockTargetTemp",blockTargetTemp:o}},Cg=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.moduleId,n),o=U(e.celsius,n);if(a==null||o==null){console.error(`forThermocyclerSetTargetLidTemperature: arg resolved to null (moduleId=${String(a)}, celsius=${String(o)})`);return}const{robotState:s}=r,i=Zr(s,a);i.lidTargetTemp=o},Dg=(e,t,r)=>{},Mg=(e,t,r)=>{},Fg=(e,t,r)=>{},Ug=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.moduleId,n);if(a==null){console.error(`forThermocyclerDeactivateBlock: arg resolved to null (moduleId=${String(a)})`);return}const{robotState:o}=r,s=Zr(o,a);s.currentBlockActivity={type:"blockDeactivated"}},$g=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.moduleId,n);if(a==null){console.error(`forThermocyclerDeactivateLid: arg resolved to null (moduleId=${String(a)})`);return}const{robotState:o}=r,s=Zr(o,a);s.lidTargetTemp=null},qg=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.moduleId,n);if(a==null){console.error(`forThermocyclerCloseLid: arg resolved to null (moduleId=${String(a)})`);return}const{robotState:o}=r,s=Zr(o,a);s.lidOpen=!1},Vg=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.moduleId,n);if(a==null){console.error(`forThermocyclerOpenLid: arg resolved to null (moduleId=${String(a)})`);return}const{robotState:o}=r,s=Zr(o,a);s.lidOpen=!0};function hh(e,t){const r=U(e.celsius,t),n=U(e.holdSeconds,t);return r==null||n==null?(console.error(`resolveProfileStep: arg resolved to null (celsius=${String(r)}, holdSeconds=${String(n)})`),null):{celsius:r,holdSeconds:n}}function Bg(e,t){const r=[];for(const n of e)if("steps"in n){const a=U(n.repetitions,t);if(a==null)return console.error(`resolveProfileElements: arg resolved to null (repetitions=${String(a)})`),null;const o=[];for(const s of n.steps){const i=hh(s,t);if(i==null)return console.error("resolveProfileElements: arg resolved to null (step=null)"),null;o.push(i)}r.push({steps:o,repetitions:a})}else{const a=hh(n,t);if(a==null)return console.error("resolveProfileElements: arg resolved to null (step=null)"),null;r.push(a)}return r}const xg=(e,t,r)=>{const{profile:n,...a}=e;Wy({profileElements:n,...a},t,r)},Wy=(e,t,r)=>{const n=NaN+$();Gy({...e,taskId:n},t,r)&&Yy(n,r,c.THERMOCYCLER_MODULE_TYPE)},Gy=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.moduleId,n),o=Bg(e.profileElements,n);if(a==null||o==null)return console.error(`forThermocyclerStartRunExtendedProfile: arg resolved to null (moduleId=${String(a)}, profileElements=${String(o)})`),!1;let s=null;if(e.taskId!=null){const u=v(e.taskId,n);if(u==null)return console.error(`forThermocyclerStartRunExtendedProfile: arg resolved to null (taskId=${String(u)})`),!1;s=u}const{robotState:i}=r,l=Zr(i,a);return l.currentBlockActivity={type:"profile",profileElements:o,taskId:s},l.numProfilesStarted++,!0},Hg=e=>{if(e.currentBlockActivity.type==="profile"){const t=zg(e.currentBlockActivity.profileElements);return e.currentBlockActivity=t!=null?{type:"blockTargetTemp",blockTargetTemp:t}:{type:"blockDeactivated"},!0}else return!1};function zg(e){const t=op(Sp(e));return t!=null?t.celsius:null}const jg=(e,t)=>{const[r,n]=[e.ordering,t.ordering];if(r.length!==n.length)return!1;for(let a=0;a<r.length;a++){const[o,s]=[r[a],n[a]];if(o.length!==s.length)return!1}return!0},yp=(e,t,r)=>{const{labware:n,liquidState:a}=t,s=$o(n,e).filter(i=>i in r&&c.getIsPipettableLabware(r[i].def));if(s.length===1){const i=a.labware[s[0]];Object.entries(i).forEach(([l,u])=>{i[l]={}});return}if(s.length===2){const i=s[0],l=s[1];if(!jg(r[i].def,r[l].def))return;const u=a.labware[i],p=a.labware[l];Object.entries(p).forEach(([d,f])=>{const m=u[d];Object.entries(m).forEach(([h,{volume:_}])=>{f[h]={volume:h in f?f[h].volume+_:_}}),u[d]={}})}},Wg=(e,t,r)=>{const n=v(e.moduleId,t.runtimeParameters);if(n==null){console.error(`forVacuumOpenVent: arg resolved to null (moduleId=${String(n)})`);return}const{robotState:a}=r,o=ct(a,n);o!=null&&(o.ventStatus=Sc)},Gg=(e,t,r)=>{const n=v(e.moduleId,t.runtimeParameters);if(n==null){console.error(`forVacuumCloseVent: arg resolved to null (moduleId=${String(n)})`);return}const{robotState:a}=r,o=ct(a,n);o!=null&&(o.ventStatus=Ua)},Yg=(e,t,r)=>{const{runtimeParameters:n,labwareEntities:a}=t,o=v(e.moduleId,n),s=U(e.gaugePressure,n),i=e.duration==null?void 0:U(e.duration,n),l=e.ventAfter==null?!0:lt(e.ventAfter,n);if(o==null||s==null||i===null||l==null){console.error(`forVacuumSetPumpPressure: arg resolved to null (moduleId=${String(o)}, gaugePressure=${String(s)}, duration=${String(i)}, ventAfter=${String(l)})`);return}const{taskId:u}=e,{robotState:p}=r,d=ct(p,o);d!=null&&(yp(o,p,a),i==null||u==null?d.currentPumpActivity={type:"indefiniteHold",mode:ec,targetPressure:s}:(d.currentPumpActivity={type:"timedHold",mode:ec,targetPressure:s,durationSeconds:i,taskId:u,ventAfter:l},d.numPumpActivitiesStarted++),d.ventStatus=Ua)},Kg=(e,t,r)=>{const{runtimeParameters:n,labwareEntities:a}=t,o=v(e.moduleId,n),s=U(e.percentPower,n),i=e.duration==null?void 0:U(e.duration,n),l=e.ventAfter==null?!0:lt(e.ventAfter,n);if(o==null||s==null||i===null||l==null){console.error(`forVacuumSetPumpPower: arg resolved to null (moduleId=${String(o)}, percentPower=${String(s)}, duration=${String(i)}, ventAfter=${String(l)})`);return}const{taskId:u}=e,{robotState:p}=r,d=ct(p,o);d!=null&&(yp(o,p,a),i==null||u==null?d.currentPumpActivity={type:"indefiniteHold",mode:Ju,targetPower:s}:(d.currentPumpActivity={type:"timedHold",mode:Ju,targetPower:s,durationSeconds:i,taskId:u,ventAfter:l},d.numPumpActivitiesStarted++),d.ventStatus=Ua)},Zg=(e,t,r)=>{const n=v(e.moduleId,t.runtimeParameters);if(n==null){console.error(`forVacuumStopPump: arg resolved to null (moduleId=${String(n)})`);return}const{robotState:a}=r,o=ct(a,n);o!=null&&(o.currentPumpActivity={type:"pumpDeactivated"})},Xg=(e,t,r)=>{const{runtimeParameters:n,labwareEntities:a}=t,o=v(e.moduleId,n),s=lt(e.ventAfter,n);if(o==null||s==null){console.error(`forVacuumStartRunProfile: arg resolved to null (moduleId=${String(o)}, ventAfter=${String(s)})`);return}const{robotState:i}=r,l=ct(i,o),{taskId:u,profile:p}=e;l==null||u==null||(yp(o,i,a),l.currentPumpActivity={type:"profile",profileElements:p,taskId:u,ventAfter:s},l.numPumpActivitiesStarted++)},Qg=e=>{if(e.currentPumpActivity.type==="timedHold"||e.currentPumpActivity.type==="profile"){const t=e.currentPumpActivity.ventAfter;return e.currentPumpActivity={type:"pumpDeactivated"},e.ventStatus=t?Sc:Ua,!0}return!1};function Jg(e,t,r){const{runtimeParameters:n}=t;for(const a of e.task_ids){const o=v(a,n);o==null&&console.error(`forWaitForTasks: arg resolved to null (taskId=${String(o)})`),o!=null&&Yy(o,r)||r.warnings.push(Aw())}}const Yy=(e,t,r)=>{const{robotState:n}=t,a=Object.values(n.modules).find(o=>{if(r&&o.moduleState.type!==r)return!1;const s=o.moduleState.type==="thermocyclerModuleType"&&o.moduleState.currentBlockActivity.type==="profile"&&o.moduleState.currentBlockActivity.taskId===e,i=o.moduleState.type==="vacuumModuleType"&&(o.moduleState.currentPumpActivity.type==="timedHold"||o.moduleState.currentPumpActivity.type==="profile")&&o.moduleState.currentPumpActivity.taskId===e;return s||i});return a==null?!1:a.moduleState.type==="thermocyclerModuleType"?Hg(a.moduleState):a.moduleState.type==="vacuumModuleType"?Qg(a.moduleState):(console.log(`unexpected module type with task: ${a.moduleState.type}`),!1)},zn=(e,t)=>{const r=Rt(e,t);return r.type===c.HEATERSHAKER_MODULE_TYPE?r:(console.error(`Heater-Shaker state updater expected ${t} moduleState to be heaterShaker, but it was ${r.type}`),{})},eE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:a}=t,o=v(e.moduleId,a),s=U(e.celsius,a);if(o==null||s==null){console.error(`forHeaterShakerSetTargetTemperature: arg resolved to null (moduleId=${String(o)}, celsius=${String(s)})`);return}const i=zn(n,o);i.targetTemp=s},tE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:a}=t,o=v(e.moduleId,a);if(o==null){console.error(`forHeaterShakerDeactivateHeater: arg resolved to null (moduleId=${String(o)})`);return}const s=zn(n,o);s.targetTemp=null},rE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:a}=t,o=v(e.moduleId,a),s=U(e.rpm,a);if(o==null||s==null){console.error(`forHeaterShakerSetTargetShakeSpeed: arg resolved to null (moduleId=${String(o)}, rpm=${String(s)})`);return}const i=zn(n,o);i.targetSpeed=s},nE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:a}=t,o=v(e.moduleId,a);if(o==null){console.error(`forHeaterShakerStopShake: arg resolved to null (moduleId=${String(o)})`);return}const s=zn(n,o);s.targetSpeed=null},aE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:a}=t,o=v(e.moduleId,a);if(o==null){console.error(`forHeaterShakerOpenLatch: arg resolved to null (moduleId=${String(o)})`);return}const s=zn(n,o);s.latchOpen=!0},oE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:a}=t,o=v(e.moduleId,a);if(o==null){console.error(`forHeaterShakerCloseLatch: arg resolved to null (moduleId=${String(o)})`);return}const s=zn(n,o);s.latchOpen=!1},sE=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.pipetteId,n);if(a==null){console.error(`forBlowOutInPlace: arg resolved to null (pipetteId=${String(a)})`);return}const{robotState:o}=r,s=o.pipettes[a].entityId??"";xo({invariantContext:t,pipetteId:a,prevLiquidState:o.liquidState,useFullVolume:!0,robotStateAndWarnings:r,entityId:s})},iE=(e,t,r)=>{const{runtimeParameters:n}=t,a=v(e.pipetteId,n);if(a==null){console.error(`forDropTipInPlace: arg resolved to null (pipetteId=${String(a)})`);return}const{robotState:o}=r,s=o.pipettes[a].entityId??"";o.tipState.pipettes[a]={hasTip:!1,tiprackURI:null},xo({invariantContext:t,prevLiquidState:o.liquidState,pipetteId:a,useFullVolume:!0,robotStateAndWarnings:r,entityId:s}),o.pipettes[a].tiprackId=void 0};function Ky(e,t){e.type===c.MAGNETIC_MODULE_TYPE&&(e.engaged=t)}function lE(e,t,r){const{robotState:n}=r,a=v(e.moduleId,t.runtimeParameters);if(a==null){console.error(`forEngageMagnet: arg resolved to null (moduleId=${String(a)})`);return}const o=Rt(n,a);Ky(o,!0)}function uE(e,t,r){const{robotState:n}=r,a=v(e.moduleId,t.runtimeParameters);if(a==null){console.error(`forDisengageMagnet: arg resolved to null (moduleId=${String(a)})`);return}const o=Rt(n,a);Ky(o,!1)}const Cu=(e,t)=>{if(t==null)return console.error("expected to find defURI but could not in getLabwareByDefURI"),null;const r=e.findIndex(a=>a.labwareDefURI===t);if(r===-1)return null;const[n]=e.splice(r,1);return n.id},Zy=(e,t,r,n)=>{const a=e.labwareInHopper??[];t.forEach(o=>{const{primaryLabwareId:s,adapterLabwareId:i,lidLabwareId:l}=o;r.labware[s]={stack:[s,...l!=null?[l]:[],...n]},i!=null&&(r.labware[i]={stack:[i,s,...l!=null?[l]:[],...n]}),l!=null&&(r.labware[l]={stack:[l,...n]}),a.push({primaryLabwareId:s,adapterLabwareId:i??null,lidLabwareId:l??null})}),e.labwareInHopper=a},Xy=(e,t,r,n,a,o,s,i)=>{const u=Object.entries(e.labware).filter(([d,f])=>f[o]===t[o]).map(([d])=>d).map(d=>r[d]),p=[];for(let d=0;d<n;d++){const f=Cu(u,t.storedLabwareDetails?.primaryLabwareURI),m=s!=null?Cu(u,t.storedLabwareDetails?.adapterLabwareURI):null,h=i!=null?Cu(u,t.storedLabwareDetails?.lidLabwareURI):null;f!=null&&(e.labware[f]={stack:[f,...h!=null?[h]:[],...a]},m!=null&&(e.labware[m]={stack:[m,f,...h!=null?[h]:[],...a]}),h!=null&&(e.labware[h]={stack:[h,...a]}),p.push({primaryLabwareId:f,adapterLabwareId:m,lidLabwareId:h})),t.labwareInHopper=p}},cE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:a}=t,o=v(e.moduleId,a),s=e.count==null?void 0:U(e.count,a);if(o==null||s===null){console.error(`forFlexStackerEmpty: arg resolved to null (moduleId=${String(o)}, count=${String(s)})`);return}const i=Object.entries(n.labware).filter(([,u])=>u.stack.includes(et)&&u.stack.includes(o)),l=yt(n,o);l!=null&&l.labwareInHopper!=null&&(s!=null?l.labwareInHopper=l.labwareInHopper.slice(0,s):l.labwareInHopper=[]),i.forEach(([u])=>{n.labware[u]={...n.labware[u],stack:[u,c.SYSTEM_LOCATION]}})},pE=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:a,runtimeParameters:o}=t,s=v(e.moduleId,o),i=e.labware.map(b=>v(b,o));if(s==null||i.some(b=>b==null)){console.error(`forFlexStackerFillItems: arg resolved to null (moduleId=${String(s)}, labware=${String(i)})`);return}const l=i,u=n.modules[s].slot,p=yt(n,s);if(p==null||p.storedLabwareDetails==null)return;const{primaryLabwareURI:d,adapterLabwareURI:f,lidLabwareURI:m}=p.storedLabwareDetails,h=[];for(const b of l){const w=a[b].labwareDefURI;if(w===d)h.push({primaryLabwareId:b,adapterLabwareId:null,lidLabwareId:null});else if(w===f){const S=h[h.length-1];S&&(S.adapterLabwareId=b)}else if(w===m){const S=h[h.length-1];S&&(S.lidLabwareId=b)}}const _=[et,s,u];for(const b of h){const w=[b.adapterLabwareId,b.primaryLabwareId,b.lidLabwareId,..._].filter(g=>g!=null);n.labware[b.primaryLabwareId]={...n.labware[b.primaryLabwareId],stack:w.slice(w.indexOf(b.primaryLabwareId))},b.adapterLabwareId!=null&&(n.labware[b.adapterLabwareId]={...n.labware[b.adapterLabwareId],stack:w.slice(w.indexOf(b.adapterLabwareId))}),b.lidLabwareId!=null&&(n.labware[b.lidLabwareId]={...n.labware[b.lidLabwareId],stack:w.slice(w.indexOf(b.lidLabwareId))});let S=null;for(const g of w)a[g]!=null&&(S==null?n.labware[g].stackedOnNode={kind:"inStackerHopper",moduleId:s}:n.labware[g].stackedOnNode={labwareId:S},S=g)}const y=p.labwareInHopper??[],T=h.map(({primaryLabwareId:b,adapterLabwareId:w,lidLabwareId:S})=>({primaryLabwareId:b,adapterLabwareId:w,lidLabwareId:S}));p.labwareInHopper=[...y,...T]},Du=(e,t)=>{const r=v(e.loadName,t),n=v(e.namespace,t),a=U(e.version,t);return r==null||n==null||a==null?null:{loadName:r,namespace:n,version:a}},dE=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:a,runtimeParameters:o}=t,s=v(e.moduleId,o),i=Du(e.primaryLabware,o),l=e.adapterLabware==null?null:Du(e.adapterLabware,o),u=e.lidLabware==null?null:Du(e.lidLabware,o),p=e.initialCount==null?void 0:U(e.initialCount,o);if(s==null||i==null||e.adapterLabware!=null&&l==null||e.lidLabware!=null&&u==null||p===null){console.error(`forFlexStackerSetStoredLabware: arg resolved to null (moduleId=${String(s)}, primaryLabware=${String(i)}, adapterLabware=${String(l)}, lidLabware=${String(u)}, initialCount=${String(p)})`);return}let d;if(p==null&&e.initialStoredLabware!=null){d=[];for(const _ of e.initialStoredLabware){const y=v(_.primaryLabwareId,o),T=_.adapterLabwareId==null?null:v(_.adapterLabwareId,o),b=_.lidLabwareId==null?null:v(_.lidLabwareId,o);if(y==null||_.adapterLabwareId!=null&&T==null||_.lidLabwareId!=null&&b==null){console.error(`forFlexStackerSetStoredLabware: arg resolved to null (primaryLabwareId=${String(y)}, adapterLabwareId=${String(T)}, lidLabwareId=${String(b)})`);return}d.push({primaryLabwareId:y,adapterLabwareId:T,lidLabwareId:b})}}const f=n.modules[s].slot,m=yt(n,s),h=[et,s,f];m!=null&&(m.storedLabwareDetails={primaryLabwareURI:`${i.namespace}/${i.loadName}/${i.version}`,adapterLabwareURI:l!=null?`${l.namespace}/${l.loadName}/${l.version}`:null,lidLabwareURI:u!=null?`${u.namespace}/${u.loadName}/${u.version}`:null},p!=null?Xy(n,m,a,p,h,"setStoredLabwareCount",l?.loadName,u?.loadName):d!=null&&Zy(m,d,n,h),m.setStoredLabwareCount=(m?.setStoredLabwareCount??0)+1)},fE=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:a,runtimeParameters:o}=t,s=v(e.moduleId,o),i=e.labware.map(I=>v(I,o));if(s==null||i.some(I=>I==null)){console.error(`forFlexStackerSetStoredLabwareItems: arg resolved to null (moduleId=${String(s)}, labware=${String(i)})`);return}const l=i,u=n.modules[s].slot,p=yt(n,s);if(p==null)return;const d=l.map(I=>I.split(":")[1]),f=new Set(d),m=Array.from(f),h=m.find(I=>Object.values(a).find(A=>A.labwareDefURI===I&&!A.def.allowedRoles?.includes("lid")&&!A.def.allowedRoles?.includes("adapter"))),_=m.find(I=>Object.values(a).find(A=>A.labwareDefURI===I&&A.def.allowedRoles?.includes("adapter"))),y=m.find(I=>Object.values(a).find(A=>A.labwareDefURI===I&&A.def.allowedRoles?.includes("lid")));if(h==null)throw new Error(`expected to find primaryLabwareURI for storedLabwareDetails but could not with labware ${l}`);p.storedLabwareDetails={primaryLabwareURI:h,adapterLabwareURI:_??null,lidLabwareURI:y??null};const T=[];for(const I of l){const A=a[I].labwareDefURI;if(A===h)T.push({primary:I,adapter:null,lid:null});else if(A===_){const E=T[T.length-1];E&&(E.adapter=I)}else if(A===y){const E=T[T.length-1];E&&(E.lid=I)}}const b=[et,s,u];for(const I of T){const A=[I.adapter,I.primary,I.lid,...b].filter(E=>E!=null);n.labware[I.primary]={...n.labware[I.primary],stack:A.slice(A.indexOf(I.primary))},I.adapter!=null&&(n.labware[I.adapter]={...n.labware[I.adapter],stack:A.slice(A.indexOf(I.adapter))}),I.lid!=null&&(n.labware[I.lid]={...n.labware[I.lid],stack:A.slice(A.indexOf(I.lid))})}const w=p.labwareInHopper??[],S=T.map(I=>({primaryLabwareId:I.primary,adapterLabwareId:I.adapter,lidLabwareId:I.lid})),g=new Map(w.map(I=>[I.primaryLabwareId,I])),L=[];for(const I of S)L.push(I),g.delete(I.primaryLabwareId);for(const I of w)g.has(I.primaryLabwareId)&&L.push(I);p.labwareInHopper=L},mE=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:a,runtimeParameters:o}=t,s=v(e.moduleId,o),i=e.count==null?void 0:U(e.count,o);if(s==null||i===null){console.error(`forFlexStackerFill: arg resolved to null (moduleId=${String(s)}, count=${String(i)})`);return}const l=n.modules[s].slot,u=yt(n,s),p=[et,s,l];if(u!=null){const d=u.storedLabwareDetails?.adapterLabwareURI,f=u.storedLabwareDetails?.lidLabwareURI;if(i!=null)Xy(n,u,a,i,p,"fillCount",d,f);else if(e.labwareToStore!=null){const m=[];for(const h of e.labwareToStore){const _=v(h.primaryLabwareId,o),y=h.adapterLabwareId==null?null:v(h.adapterLabwareId,o),T=h.lidLabwareId==null?null:v(h.lidLabwareId,o);if(_==null||h.adapterLabwareId!=null&&y==null||h.lidLabwareId!=null&&T==null){console.error(`forFlexStackerFill: arg resolved to null (primaryLabwareId=${String(_)}, adapterLabwareId=${String(y)}, lidLabwareId=${String(T)})`);return}m.push({primaryLabwareId:_,adapterLabwareId:y,lidLabwareId:T})}Zy(u,m,n,p)}u.fillCount=(u?.fillCount??0)+1}},hE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:a}=t,o=v(e.moduleId,a);if(o==null){console.error(`forFlexStackerRetrieve: arg resolved to null (moduleId=${String(o)})`);return}const s=yt(n,o),i=n.modules[o].slot;if(s!=null){const{labwareInHopper:l,labwareOnShuttle:u}=s;if(l!=null&&l.length>0&&u==null){const p=l[0];s.labwareOnShuttle=p,l.shift();const d=[i];let f=null;for(const m of rr){const h=p[m];if(h!=null){if(d.unshift(h),n.labware[h].stack=[...d],f==null){const _=Uo(i);_!=null?n.labware[h].stackedOnNode={addressableAreaName:_}:console.warn(`Could not find an addressable area for retrieved labware in stacker module ${o} at slot ${i}`)}else n.labware[h].stackedOnNode={labwareId:f};f=h}}}}},_E=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:a}=t,o=v(e.moduleId,a);if(o==null){console.error(`forFlexStackerStore: arg resolved to null (moduleId=${String(o)})`);return}const s=yt(n,o),i=n.modules[o].slot;if(s!=null){const{labwareOnShuttle:l}=s;if(l!=null){s.labwareInHopper=[l,...s.labwareInHopper??[]],s.labwareOnShuttle=null;let u=null;for(const p of rr){const d=l[p];d!=null&&(n.labware[d].stack=[d,et,o,i],u==null?(n.labware[d].stackedOnNode={kind:"inStackerHopper",moduleId:o},u=d):n.labware[d].stackedOnNode={labwareId:u})}s.storedLabwareDetails==null&&(s.storedLabwareDetails={primaryLabwareURI:t.labwareEntities[l.primaryLabwareId].labwareDefURI,adapterLabwareURI:l.adapterLabwareId!=null?t.labwareEntities[l.adapterLabwareId].labwareDefURI:null,lidLabwareURI:l.lidLabwareId!=null?t.labwareEntities[l.lidLabwareId].labwareDefURI:null})}}};function Qy(e,t,r){e.type===c.TEMPERATURE_MODULE_TYPE&&(e.targetTemperature=t,e.status=r)}function yE(e,t,r){const{robotState:n}=r,{runtimeParameters:a}=t,o=v(e.moduleId,a),s=U(e.celsius,a);if(o==null||s==null){console.error(`forSetTemperature: arg resolved to null (moduleId=${String(o)}, celsius=${String(s)})`);return}const i=Rt(n,o);Qy(i,s,Tc)}function bE(e,t,r){const{robotState:n}=r,{runtimeParameters:a}=t,o=v(e.moduleId,a),s=U(e.celsius,a);if(o==null||s==null){console.error(`forAwaitTemperature: arg resolved to null (moduleId=${String(o)}, celsius=${String(s)})`);return}const i=Rt(n,o);i.type===c.TEMPERATURE_MODULE_TYPE&&s===i.targetTemperature&&(i.status=bc)}function TE(e,t,r){const{robotState:n}=r,{runtimeParameters:a}=t,o=v(e.moduleId,a);if(o==null){console.error(`forDeactivateTemperature: arg resolved to null (moduleId=${String(o)})`);return}const s=Rt(n,o);Qy(s,null,Ma)}function Jy(e,t,r){if(!e)throw new Error("undefined command passed to getNextRobotStateAndWarning");switch(e.commandType){case"aspirateWhileTracking":case"aspirate":case"aspirateInPlace":if(e.meta?.isAirGap===!0)break;vS(e.params,t,r);break;case"airGapInPlace":fS(e.params,t,r);break;case"dispenseWhileTracking":case"dispense":case"dispenseInPlace":if(e.meta?.isAirGap===!0)break;kS(e.params,t,r);break;case"blowout":PS(e.params,t,r);break;case"dropTip":{const{pipetteId:n,labwareId:a,wellName:o}=e.params;NS({pipette:n,dropTipLocation:a,wellName:o},t,r);break}case"pickUpTip":Pg(e.params,t,r);break;case"setTipState":kg(e.params,t,r);break;case"magneticModule/engage":lE(e.params,t,r);break;case"magneticModule/disengage":uE(e.params,t,r);break;case"moveLabware":Lg(e.params,t,r);break;case"waitForTasks":Jg(e.params,t,r);break;case"flexStacker/setStoredLabware":dE(e.params,t,r);break;case"flexStacker/setStoredLabwareItems":fE(e.params,t,r);break;case"flexStacker/prepareShuttle":case"flexStacker/closeLatch":case"flexStacker/openLatch":break;case"flexStacker/empty":cE(e.params,t,r);break;case"flexStacker/fill":mE(e.params,t,r);break;case"flexStacker/fillItems":pE(e.params,t,r);break;case"flexStacker/retrieve":hE(e.params,t,r);break;case"flexStacker/store":_E(e.params,t,r);break;case"setRailLights":case"touchTip":case"configureForVolume":case"loadPipette":case"loadLabware":case"loadModule":case"home":case"moveRelative":case"moveToSlot":case"moveToCoordinates":case"savePosition":case"waitForResume":case"waitForDuration":case"pause":case"delay":case"custom":case"comment":case"captureImage":case"prepareToAspirate":case"liquidProbe":case"loadLiquidClass":case"loadLidStack":case"loadLid":case"getTipPresence":case"identifyModule":case"getNextTip":case"retractAxis":case"sealPipetteToTip":case"tryLiquidProbe":case"unsealPipetteFromTip":case"verifyTipPresence":case"pressureDispense":case"createTimer":break;case"moveToAddressableArea":case"moveToAddressableAreaForDropTip":Og(e.params,t,r);break;case"moveToWell":vg(e.params,t,r);break;case"loadLiquid":CS(e.params,t,r);break;case"dropTipInPlace":iE(e.params,t,r);break;case"blowOutInPlace":sE(e.params,t,r);break;case"configureNozzleLayout":RS(e.params,t,r);break;case"temperatureModule/setTargetTemperature":yE(e.params,t,r);break;case"temperatureModule/deactivate":TE(e.params,t,r);break;case"temperatureModule/waitForTemperature":{const{moduleId:n,celsius:a}=e.params;a!=null&&bE({moduleId:n,celsius:a},t,r);break}case"thermocycler/setTargetBlockTemperature":Ng(e.params,t,r);break;case"thermocycler/setTargetLidTemperature":Cg(e.params,t,r);break;case"thermocycler/waitForBlockTemperature":Dg(e.params);break;case"thermocycler/waitForLidTemperature":Mg(e.params);break;case"thermocycler/deactivateBlock":Ug(e.params,t,r);break;case"thermocycler/deactivateLid":$g(e.params,t,r);break;case"thermocycler/closeLid":qg(e.params,t,r);break;case"thermocycler/openLid":Vg(e.params,t,r);break;case"thermocycler/runProfile":xg(e.params,t,r);break;case"thermocycler/runExtendedProfile":Wy(e.params,t,r);break;case"thermocycler/startRunExtendedProfile":Gy(e.params,t,r);break;case"thermocycler/awaitProfileComplete":Fg(e.params);break;case"heaterShaker/deactivateHeater":tE(e.params,t,r);break;case"heaterShaker/setTargetTemperature":eE(e.params,t,r);break;case"heaterShaker/setAndWaitForShakeSpeed":case"heaterShaker/setShakeSpeed":rE(e.params,t,r);break;case"heaterShaker/deactivateShaker":nE(e.params,t,r);break;case"heaterShaker/openLabwareLatch":aE(e.params,t,r);break;case"heaterShaker/closeLabwareLatch":oE(e.params,t,r);break;case"heaterShaker/waitForTemperature":break;case"absorbanceReader/openLid":cS(e.params,t,r);break;case"absorbanceReader/closeLid":pS(e.params,t,r);break;case"absorbanceReader/initialize":dS(e.params,t,r);break;case"absorbanceReader/read":break;case"vacuumModule/startSetVacuumPressure":Yg(e.params,t,r);break;case"vacuumModule/startSetVacuumPower":Kg(e.params,t,r);break;case"vacuumModule/openVent":Wg(e.params,t,r);break;case"vacuumModule/closeVent":Gg(e.params,t,r);break;case"vacuumModule/stopVacuum":Zg(e.params,t,r);break;case"vacuumModule/startRunProfile":Xg({moduleId:e.params.moduleId,profile:e.params.steps,ventAfter:e.params.ventAfter??!0,taskId:e.params.taskId},t,r);break;default:console.error(`unknown command: ${e.commandType} passed to getNextRobotStateAndWarning`)}}function eb(e,t,r){return Dy({warnings:[],robotState:r},a=>{Jy(e,t,a)})}function bp(e,t,r){const n=My(e);return Dy({warnings:[],robotState:r},o=>{n.forEach(s=>{Jy(s,t,o)})})}const IE=(e,t,r)=>{const n=e.reduce((a,o,s)=>{const i=a.timeline.length===0?r:op(a.timeline).robotState;if(a.errors!=null)return a;const l=o(t,i);if("errors"in l)return{timeline:a.timeline,errors:l.errors};const p=My(l.commands).reduce((f,m)=>eb(m,t,f.robotState),{robotState:i,warnings:[]}),d={commands:l.commands,robotState:p.robotState,warnings:l.warnings,stepInfo:{stepNumber:l.stepNumber,name:l.name,description:l.description},python:l.python};return{timeline:[...a.timeline,d],errors:null}},{timeline:[],errors:null});return{timeline:n.timeline,errors:n.errors}},jn=(e,t)=>{const r=t[e]?.stack;return r!=null?ee(r):""},Wn=e=>{if(e.type===c.VACUUM_MODULE_TYPE){const t=e;return t.currentPumpActivity.type==="timedHold"||t.currentPumpActivity.type==="profile"}if(e.type===c.THERMOCYCLER_MODULE_TYPE){const t=e;return t.currentBlockActivity.type==="profile"||t.currentBlockActivity.type==="blockTargetTemp"}return!1},Gn=e=>{const{pipette:t,labware:r,invariantContext:n,prevRobotState:a}=e;if(n.config.OT_PD_DISABLE_MODULE_RESTRICTIONS)return!1;const o=t?n.pipetteEntities[t]:null,s=r?ee(a.labware[r]?.stack):null;if(!t||!r||!o||!s)return!1;const i=Object.keys(n.moduleEntities).some(l=>{const u=n.moduleEntities[l].model;if(Wh.includes(u)){const p=a.modules[l]?.slot;return p==="1"&&s==="4"||p==="3"&&s==="6"}else return!1});return c.GEN_ONE_MULTI_PIPETTES.includes(o.name)&&i},de=(e,t,r)=>{const n=e.reduce((a,o)=>{if(a.errors.length>0)return a;const s=o(t,a.robotState);if("errors"in s)return{robotState:a.robotState,commands:a.commands,errors:s.errors,warnings:a.warnings};const i=[...a.commands,...s.commands],l=[...a.python?[a.python]:[],...s.python?[s.python]:[]].join(`
55
+ `),u=bp(s.commands,t,a.robotState);return{...a,robotState:u.robotState,commands:i,warnings:[...a.warnings||[],...s.warnings||[],...u.warnings],...l&&{python:l}}},{robotState:r,commands:[],errors:[],warnings:[]});return n.errors.length>0?{errors:n.errors}:{commands:n.commands,warnings:n.warnings,...n.python&&{python:n.python}}},Ya=(e,t,r)=>{const n=za(e,t[r]?.stack),a=n&&e[n].moduleState;return!!(a&&a.type===c.THERMOCYCLER_MODULE_TYPE&&a.lidOpen!==!0)},wE=e=>e.commandCreatorFnName!=="delay"&&e.commandCreatorFnName!=="engageMagnet"&&e.commandCreatorFnName!=="disengageMagnet"&&e.commandCreatorFnName!=="setTemperature"&&e.commandCreatorFnName!=="deactivateTemperature"&&"pipette"in e?e.pipette:null,SE=e=>e.commandCreatorFnName==="delay"||e.commandCreatorFnName==="engageMagnet"||e.commandCreatorFnName==="disengageMagnet"||e.commandCreatorFnName==="setTemperature"||e.commandCreatorFnName==="deactivateTemperature",gE=new Date("2025-03-19T00:00:00Z"),EE=2,AE=22;function LE(e,t,r){const{labware:n,modules:a,pipettes:o,commands:s,liquids:i}=e,l=t.protocolType==="python"?t.apiVersion:null,u=l!=null&&l[0]>=EE&&l[1]>=AE,p=t.protocolType==="json"&&r>=gE,d=c.getLabwareDefinitionsByURIForProtocol(s),f=i.reduce((b,w)=>{const{id:S,description:g,displayName:L,displayColor:I}=w;return{...b,[S]:{description:g,displayName:L??"Unknown Liquid",pythonName:"n/a",displayColor:I??"#B7B8B9",liquidGroupId:S}}},{}),m=a.reduce((b,w)=>{const{id:S,model:g}=w;return{...b,[S]:{id:S,type:c.getModuleType(g),model:g,pythonName:"n/a"}}},{}),h=n.reduce((b,w)=>{const{id:S,definitionUri:g}=w,L=d[g];return L==null||L.schemaVersion===3?b:{...b,[S]:{id:S,labwareDefURI:g,def:L,pythonName:"n/a"}}},{}),_=s.reduce((b,w)=>{if(w.commandType==="loadLidStack"&&w.result!=null){const{stackLabwareId:S,lidStackDefinition:g}=w.result;if(S!=null&&g!=null&&b[S]==null&&g.schemaVersion!==3)return{...b,[S]:{id:S,labwareDefURI:c.getLabwareDefURI(g),def:g,pythonName:"n/a"}}}return b},h),y=o.reduce((b,w)=>{const{id:S,pipetteName:g}=w,L=c.getPipetteSpecsV2(g),A=s.filter(k=>k.commandType==="pickUpTip"&&k.params.pipetteId===S).map(k=>_[k.params.labwareId]),E=Array.from(new Set(A.map(k=>k.labwareDefURI))),O=Array.from(new Set(A.map(k=>k.def)));return L==null||(b[S]={name:g,id:S,tiprackLabwareDef:O,tiprackDefURI:E,spec:L,pythonName:"n/a"}),b},{}),T=s.reduce((b,w)=>{if(w.commandType==="loadLidStack"&&w.result!=null){const{params:S}=w,g=ac(S);return{...b,stagingAreaEntities:{...b.stagingAreaEntities,...g}}}else if((w.commandType==="loadLabware"||w.commandType==="loadLid")&&w.result!=null){const{params:S}=w,g=ac(S);return{...b,stagingAreaEntities:{...b.stagingAreaEntities,...g}}}else if(w.commandType==="moveToAddressableArea"||w.commandType==="moveToAddressableAreaForDropTip"){const S=w.params.addressableAreaName,g=`${$()}:${S}`;let L=r_;S==="fixedTrash"?L="cutout12":S.includes("WasteChute")?L="cutoutD3":S.includes("movableTrash")&&(L=`cutout${S.split("movableTrash")[1]}`);let I=b.trashBinEntities;Object.values(b.trashBinEntities).some(E=>E.location===L)||(S.includes("movableTrash")?I={...b.trashBinEntities,[g]:{pythonName:"trash_bin_1",id:g,location:L}}:S==="fixedTrash"&&(I={...b.trashBinEntities,[g]:{pythonName:"trash_bin_1",id:g,location:L}}));let A=b.wasteChuteEntities;return S.includes("WasteChute")&&(A={[g]:{pythonName:"waste_chute",id:g,location:L}}),{...b,trashBinEntities:I,wasteChuteEntities:A}}return b},{wasteChuteEntities:{},trashBinEntities:{},stagingAreaEntities:{},runtimeParameters:{},gripperEntities:{},config:{OT_PD_DISABLE_MODULE_RESTRICTIONS:!0}});return{labwareEntities:_,pipetteEntities:y,moduleEntities:m,liquidEntities:u||p?f:{},...T}}const OE={A3:"A4",B3:"B4",C3:"C4",D3:"D4"};function vE(e,t){const r=e.reduce((s,i)=>i.commandType==="loadPipette"&&i.result!=null?{...s,[i.result.pipetteId]:{mount:i.params.mount}}:s,{}),n=e.reduce((s,i)=>{if(i.commandType==="loadModule"&&i.result!=null){const l=c.getModuleDef(i.params.model).moduleType;return{...s,[i.result.moduleId]:{slot:l===c.FLEX_STACKER_MODULE_TYPE?OE[i.params.location.slotName]:i.params.location.slotName,moduleState:t_[l]}}}return s},{}),a=e.reduce((s,i)=>{if(i.commandType==="loadLidStack"&&i.result!=null){const{result:l}=i,u=l.locationSequences,p=l.labwareIds,d=l.stackLabwareId,f=l.stackLocationSequence,m=h=>{if(c.locationIsOffDeck(h))return[h];if("slotName"in h)return[h.slotName];if("moduleId"in h){const _=n[h.moduleId]?.slot??"offDeck";return[h.moduleId,_]}else if("addressableAreaName"in h)return[h.addressableAreaName];return["offDeck"]};if(u!=null){const h=u.reduce((T,b)=>{const w=b.find(S=>S.kind==="onLabware");return w!=null&&(T[w.labwareId]=b),T},{}),_=p.reduce((T,b,w)=>{const S=h[b]??u[w];if(S!=null){const g=nc(S);T[b]={stack:g[0]===b?g:[b,...g]}}else{const g=i.params.location;c.locationIsOffDeck(g)?T[b]={stack:[b,g]}:"slotName"in g?T[b]={stack:[b,g.slotName]}:T[b]={stack:[b,"offDeck"]}}return T},{}),y=d!=null&&f!=null?[d,...nc(f)]:null;return{...s,..._,...d!=null&&y!=null?{[d]:{stack:y}}:{}}}else{const h=i.params.location,_=p.reduce((T,b)=>{if(c.locationIsOffDeck(h))T[b]={stack:[b,h]};else if("slotName"in h)T[b]={stack:[b,h.slotName]};else if("moduleId"in h){const w=h.moduleId;T[b]={stack:[b,w,n[w].slot]}}else T[b]={stack:[b,"offDeck"]};return T},{}),y=d!=null?[d,...m(h)]:null;return{...s,..._,...d!=null&&y!=null?{[d]:{stack:y}}:{}}}}else if((i.commandType==="loadLabware"||i.commandType==="loadLid")&&i.result!=null){const l=[i.result.labwareId];if(c.locationIsOffDeck(i.params.location))l.push(i.params.location);else if("slotName"in i.params.location)l.push(i.params.location.slotName);else if("moduleId"in i.params.location){const u=i.params.location.moduleId;if(n[u]==null)return console.warn(`Module ${u} not found when processing loadLabware/loadLid command. `),s;l.push(i.params.location.moduleId,n[i.params.location.moduleId].slot)}else if("labwareId"in i.params.location){const u=i.params.location.labwareId;s[u]==null&&(console.warn(`Parent labware ${u} not found when processing loadLabware/loadLid command. `),s[u]={stack:[u,"offDeck"]});const p=s[u].stack;l.push(u,...p)}else l.push(i.params.location.addressableAreaName);return{...s,[i.result.labwareId]:{stack:l}}}else{if(i.commandType==="flexStacker/setStoredLabware")return yh(i).forEach(u=>{_h(s,u,"setStoredLabwareCount")}),s;if(i.commandType==="flexStacker/fill")return yh(i).forEach(u=>{_h(s,u,"fillCount")}),s}return s},{}),o=Jc({invariantContext:t,labwareLocations:a,moduleLocations:n,pipetteLocations:r});return{frame:{...bp(e,t,o),command:e[e.length-1]},invariantContext:t}}const _h=(e,t,r)=>{const n=e[t]??{stack:[t,"offDeck"]};e[t]={...n,[r]:(n[r]??0)+1}},yh=e=>e.result?.storedLabware?.flatMap(r=>[r.primaryLabwareId,r.adapterLabwareId,r.lidLabwareId].filter(n=>n!=null))??[],Tp=(e,t)=>e??(t.channels===1?c.SINGLE:t.channels===96?c.ALL:c.COLUMN);var Mu,bh;function PE(){if(bh)return Mu;bh=1;var e=Uc();function t(r,n){var a;return e(r,function(o,s,i){return a=n(o,s,i),!a}),!!a}return Mu=t,Mu}var Fu,Th;function RE(){if(Th)return Fu;Th=1;var e=h_(),t=Vn(),r=PE(),n=tt(),a=qc();function o(s,i,l){var u=n(s)?e:r;return l&&a(s,i,l)&&(i=void 0),u(s,t(i,3))}return Fu=o,Fu}var kE=RE();const Ka=Ge(kE),Yn=(e,t)=>Ka(e,r=>r.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&r.moduleState.latchOpen!==!1&&c.getAreSlotsHorizontallyAdjacent(r.slot,t)),Kn=(e,t,r)=>r.channels!==1&&Ka(e,n=>n.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&c.getAreSlotsHorizontallyAdjacent(n.slot,t)),Za=(e,t,r,n)=>r.channels!==1&&!n.def.parameters.isTiprack&&Ka(e,a=>a.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&c.getAreSlotsVerticallyAdjacent(a.slot,t)),tb=(e,t,r)=>Ka(e,(a,o)=>c.getAreSlotsHorizontallyAdjacent(r,ee(a.stack))&&c.getIsLabwareAboveHeight(t[o].def,c.MAX_LABWARE_HEIGHT_EAST_WEST_HEATER_SHAKER_MM)),Xa=(e,t,r)=>{const n=za(e,t[r]?.stack),a=n!=null?e[n].moduleState:null;return!!(a&&a.type===c.HEATERSHAKER_MODULE_TYPE&&a.latchOpen!==!1)},Zn=(e,t,r)=>Ka(e,n=>n.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&n.moduleState.targetSpeed!=null&&n.moduleState.targetSpeed>0&&(r===c.OT2_ROBOT_TYPE?c.getAreSlotsAdjacent(n.slot,t):c.getAreFlexSlotsAdjacent(n.slot,t))),Qa=(e,t,r)=>{const n=za(e,t[r]?.stack),a=n!=null?e[n].moduleState:null;return!!(a&&a.type===c.HEATERSHAKER_MODULE_TYPE&&a.targetSpeed!==null)},zo=e=>{const{args:t,pipetteName:r,tiprackUri:n,liquidClassValuesForTip:a}=e;let o=null;"mixBeforeAspirate"in t?o=t.mixBeforeAspirate:"mixFirstAspirate"in t&&(o=t.mixFirstAspirate);const s=NE(t),i={dispense_position:{offset:{x:t.dispenseXOffset,y:t.dispenseYOffset,z:t.dispenseZOffset},position_reference:t.dispensePositionReference},flow_rate_by_volume:[[0,t.dispenseFlowRateUlSec??0]],delay:{enabled:!!t.dispenseDelay?.seconds,...t.dispenseDelay?.seconds?{duration:t.dispenseDelay?.seconds}:{}},submerge:{delay:{enabled:!!t.dispenseSubmergeDelay?.seconds,...t.dispenseSubmergeDelay?.seconds?{duration:t.dispenseSubmergeDelay?.seconds}:{}},speed:t.dispenseSubmergeSpeed??void 0,start_position:{offset:{x:t.dispenseSubmergeXOffset,y:t.dispenseSubmergeYOffset,z:t.dispenseSubmergeZOffset},position_reference:t.dispenseSubmergePositionReference}},retract:{air_gap_by_volume:[[0,t.dispenseAirGapVolume??0]],delay:{enabled:!!t.dispenseRetractDelay?.seconds,...t.dispenseRetractDelay?.seconds?{duration:t.dispenseRetractDelay?.seconds}:{}},end_position:{offset:{x:t.dispenseRetractXOffset,y:t.dispenseRetractYOffset,z:t.dispenseRetractZOffset},position_reference:t.dispenseRetractPositionReference},speed:t.dispenseRetractSpeed??void 0,touch_tip:{enabled:t.touchTipAfterDispense,z_offset:t.touchTipAfterDispense?t.touchTipAfterDispenseOffsetMmFromTop:void 0,mm_from_edge:t.touchTipAfterDispense&&t.touchTipAfterDispenseMmFromEdge!=null?t.touchTipAfterDispenseMmFromEdge:void 0,speed:t.touchTipAfterDispense?t.touchTipAfterDispenseSpeed:void 0},blowout:{enabled:t.blowoutLocation!=null,location:rb(t.blowoutLocation),flow_rate:t.blowoutLocation!=null?t.blowoutFlowRateUlSec:void 0,...s!=null?{blowout_position:s}:{}}}},l={[r]:{[n]:{aspirate:{aspirate_position:{offset:{x:t.aspirateXOffset,y:t.aspirateYOffset,z:t.aspirateZOffset},position_reference:t.aspiratePositionReference},flow_rate_by_volume:[[0,t.aspirateFlowRateUlSec]],pre_wet:t.preWetTip,correction_by_volume:a?.aspirate.correctionByVolume??[[0,0]],delay:{enabled:!!t.aspirateDelay?.seconds,...t.aspirateDelay?.seconds?{duration:t.aspirateDelay?.seconds}:{}},mix:{enabled:!!o?.volume,...o?.times?{repetitions:o.times}:{},...o?.volume?{volume:o.volume}:{}},submerge:{delay:{enabled:!!t.aspirateSubmergeDelay?.seconds,...t.aspirateSubmergeDelay?.seconds?{duration:t.aspirateSubmergeDelay?.seconds}:{}},speed:t.aspirateSubmergeSpeed??void 0,start_position:{offset:{x:t.aspirateSubmergeXOffset,y:t.aspirateSubmergeYOffset,z:t.aspirateSubmergeZOffset},position_reference:t.aspirateSubmergePositionReference}},retract:{air_gap_by_volume:[[0,t.aspirateAirGapVolume??0]],delay:{enabled:!!t.aspirateRetractDelay?.seconds,...t.aspirateRetractDelay?.seconds?{duration:t.aspirateRetractDelay?.seconds}:{}},end_position:{offset:{x:t.aspirateRetractXOffset,y:t.aspirateRetractYOffset,z:t.aspirateRetractZOffset},position_reference:t.aspirateRetractPositionReference},speed:t.aspirateRetractSpeed??void 0,touch_tip:{enabled:t.touchTipAfterAspirate,z_offset:t.touchTipAfterAspirate?t.touchTipAfterAspirateOffsetMmFromTop:void 0,mm_from_edge:t.touchTipAfterAspirate&&t.touchTipAfterAspirateMmFromEdge!=null?t.touchTipAfterAspirateMmFromEdge:void 0,speed:t.touchTipAfterAspirate?t.touchTipAfterAspirateSpeed:void 0}}},dispense:{...i,correction_by_volume:a?.singleDispense.correctionByVolume??[[0,0]],push_out_by_volume:[[0,t.pushOut??0]],mix:{enabled:"mixInDestination"in t?t.mixInDestination!=null:!1,repetitions:"mixInDestination"in t?t.mixInDestination?.times??void 0:void 0,volume:"mixInDestination"in t?t.mixInDestination?.volume??void 0:void 0}},...t.commandCreatorFnName==="distribute"?{multi_dispense:{...i,correction_by_volume:a?.multiDispense?.correctionByVolume??[[0,0]],..."conditioningVolume"in t?{conditioning_by_volume:[[0,t.conditioningVolume??0]]}:{},..."disposalVolume"in t?{disposal_by_volume:[[0,t.disposalVolume??0]]}:{}}}:{}}}},u=JSON.parse(JSON.stringify(l));return Br(u)},Ja=(e,t)=>`${c.getAllLiquidClassDefs()[e].liquidClassName}${t?"_base_class":""}`,rb=e=>{if(e!=null)return e===Kr?"source":e===xn?"destination":"trash"},NE=e=>{const t=rb(e.blowoutLocation);return!t||t==="trash"?null:{offset:{x:e.blowoutXPosition??0,y:e.blowoutYPosition??0,z:e.blowoutOffsetFromTopMm??1},position_reference:e.blowoutPositionReference??c.POSITION_REFERENCE_TOP}},jo=e=>{const{labwareEntities:t,tiprackIds:r}=e;return`tip_racks=[${r.map(a=>t[a].pythonName).join(", ")}]`};var Uu,Ih;function CE(){if(Ih)return Uu;Ih=1;var e="Expected a function";function t(r){if(typeof r!="function")throw new TypeError(e);return function(){var n=arguments;switch(n.length){case 0:return!r.call(this);case 1:return!r.call(this,n[0]);case 2:return!r.call(this,n[0],n[1]);case 3:return!r.call(this,n[0],n[1],n[2])}return!r.apply(this,n)}}return Uu=t,Uu}var $u,wh;function DE(){if(wh)return $u;wh=1;var e=cp(),t=$n(),r=Po(),n=lr(),a=qn();function o(s,i,l,u){if(!n(s))return s;i=t(i,s);for(var p=-1,d=i.length,f=d-1,m=s;m!=null&&++p<d;){var h=a(i[p]),_=l;if(h==="__proto__"||h==="constructor"||h==="prototype")return s;if(p!=f){var y=m[h];_=u?u(y,h,m):void 0,_===void 0&&(_=n(y)?y:r(i[p+1])?[]:{})}e(m,h,_),m=m[h]}return s}return $u=o,$u}var qu,Sh;function ME(){if(Sh)return qu;Sh=1;var e=ko(),t=DE(),r=$n();function n(a,o,s){for(var i=-1,l=o.length,u={};++i<l;){var p=o[i],d=e(a,p);s(d,p)&&t(u,r(p,a),d)}return u}return qu=n,qu}var Vu,gh;function FE(){if(gh)return Vu;gh=1;var e=$a(),t=Vn(),r=ME(),n=fp();function a(o,s){if(o==null)return{};var i=e(n(o),function(l){return[l]});return s=t(s),r(o,i,function(l,u){return s(l,u[0])})}return Vu=a,Vu}var Bu,Eh;function UE(){if(Eh)return Bu;Eh=1;var e=Vn(),t=CE(),r=FE();function n(a,o){return r(a,t(e(o)))}return Bu=n,Bu}var $E=UE();const qE=Ge($E);function nb(e){return Object.keys(e.wells)}const VE=(e,t)=>{const r=Object.keys(e||{}).filter(n=>e[n]&&e[n].volume>0);return{wellName:t,groupIds:r,ingreds:qE(e,n=>!n||n.volume<=0)}},BE=(e,t)=>{const r=nb(t);return ft(r,(n,a)=>{const o=e&&e[a];return{...n,[a]:o?VE(e[a],a):{}}},{})},xE=(e,t)=>{const r={};return t.forEach(n=>{const a=e!=null?Object.values(e).reduce((o,s)=>{if(s.groupIds.indexOf(n)!==-1){const l=s.ingreds[n];l?.volume!=null&&(o[s.wellName??"A1"]=l.volume)}return o},{}):{};r[n]=a}),r},HE=e=>{const t=e.flatMap(r=>r==null?[]:Object.values(r).flatMap(n=>n.groupIds.filter(a=>a!==Ye)));return Array.from(new Set(t))},zE=e=>{const t=e!=null?Object.values(e).flatMap(r=>r.groupIds)?.filter(r=>r!==Ye):[];return Array.from(new Set(t))},ab="#737578",ob=e=>{const t=Number(e);return Number.isInteger(t)?c.DEFAULT_LIQUID_COLORS[t%c.DEFAULT_LIQUID_COLORS.length]:(e!==Ye&&console.warn(`swatchColors expected an integer or ${Ye}, got ${e}`),"transparent")},jE=(e,t)=>{const r=e.filter(n=>n!==Ye);return r.length===0?null:r.length===1?t[r[0]]??ob(r[0]):ab},WE=(e,t)=>ft(e,(r,n,a)=>{const o=jE(n.groupIds,t);return o?{...r,[a]:o}:r},{});var xu,Ah;function GE(){if(Ah)return xu;Ah=1;function e(t,r){return t>r}return xu=e,xu}var Hu,Lh;function YE(){if(Lh)return Hu;Lh=1;var e=jh(),t=GE(),r=Da();function n(a){return a&&a.length?e(a,r,t):void 0}return Hu=n,Hu}var KE=YE();const ZE=Ge(KE),sb="2.31",XE="9.0.1";function QE(){return["import json","from opentrons import protocol_api, types"].join(`
56
+ `)}function JE(e){function t(n){return n?new Date(n).toISOString():""}const r=Object.fromEntries(Object.entries({protocolName:e.protocolName,author:e.author,description:e.description,created:t(e.created),internalAppBuildDate:e.internalAppBuildDate,lastModified:t(e.lastModified),category:e.category,subcategory:e.subcategory,tags:e.tags?.length&&e.tags.join(", "),protocolDesigner:e.protocolDesigner,source:e.source}).filter(([n,a])=>a));return`metadata = ${Br(r)}`}function eA(e){const r={robotType:{[c.OT2_ROBOT_TYPE]:"OT-2",[c.FLEX_ROBOT_TYPE]:"Flex"}[e],apiLevel:sb};return`requirements = ${Br(r)}`}function ib(e,t){const r=Object.keys(e).length>0,n=r?Object.values(e).map(a=>`${a.pythonName} = ${ge}.load_module(${F(a.model)}, ${F(t[a.id].slot)})`).join(`
57
57
  `):"";return r?`# Load Modules:
58
- ${n}`:""}function sb(e,t,r){const n=Object.values(t).filter(o=>o.def.allowedRoles?.includes("adapter")),a=Object.values(n).toSorted((o,s)=>{const i=r[o.id].stack,l=r[s.id].stack;return i.includes(s.id)?1:l.includes(o.id)?-1:0}).map(o=>{const{id:s,def:i,pythonName:l}=o,{parameters:u,namespace:p,version:d}=i,f=r[s].stack[1],m=r[s].stack.find(I=>I in e),h=r[s].stack.some(I=>I===n_),_=f in t?t[f]:null;let b,T=null;if(_!=null)b=_.pythonName,T=null;else if(m!=null){const I=e[m];[b,T]=h?[we,`location=${I.pythonName}.manifold_dock`]:[I.pythonName,null]}else b=we,T=`location=${f==="offDeck"?vn:C(f)}`;if(c.getLabwareDefIsStandard(i)){const I=[`${C(u.loadName)}`,...T?[T]:[],`namespace=${C(p)}`,`version=${d}`].join(`,
59
- `);return`${l} = ${b}.load_adapter(
60
- ${Y(I)},
61
- )`}else{const I=[`${Co}[${C(c.getLabwareDefURI(i))}]`,...T?[T]:[]].join(`,
62
- `);return`${l} = ${b}.load_adapter_from_definition(
63
- ${Y(I)},
58
+ ${n}`:""}function lb(e,t,r){const n=Object.values(t).filter(o=>o.def.allowedRoles?.includes("adapter")),a=Object.values(n).toSorted((o,s)=>{const i=r[o.id].stack,l=r[s.id].stack;return i.includes(s.id)?1:l.includes(o.id)?-1:0}).map(o=>{const{id:s,def:i,pythonName:l}=o,{parameters:u,namespace:p,version:d}=i,f=r[s].stack[1],m=r[s].stack.find(w=>w in e),h=r[s].stack.some(w=>w===s_),_=f in t?t[f]:null;let y,T=null;if(_!=null)y=_.pythonName,T=null;else if(m!=null){const w=e[m];[y,T]=h?[ge,`location=${w.pythonName}.manifold_dock`]:[w.pythonName,null]}else y=ge,T=`location=${f==="offDeck"?Nn:F(f)}`;if(c.getLabwareDefIsStandard(i)){const w=[`${F(u.loadName)}`,...T?[T]:[],`namespace=${F(p)}`,`version=${d}`].join(`,
59
+ `);return`${l} = ${y}.load_adapter(
60
+ ${Q(w)},
61
+ )`}else{const w=[`${Do}[${F(c.getLabwareDefURI(i))}]`,...T?[T]:[]].join(`,
62
+ `);return`${l} = ${y}.load_adapter_from_definition(
63
+ ${Q(w)},
64
64
  )`}}).join(`
65
65
  `);return a?`# Load Adapters:
66
- ${a}`:""}const QS=(e,t,r)=>e.reduce((n,{id:a,labwareDefURI:o,def:s})=>{const{stack:i}=r[a],l=i.length-1,u=i.slice(1,l),p=u.find(T=>t[T]?.def.parameters.loadName==="opentrons_flex_deck_riser"),d=u.every(T=>t[T]?.labwareDefURI===o)||p!=null,f=s.parameters.loadName;if(!d)return n;const m=p!=null?t[p]?.pythonName:K(i),h=i.length-(p!=null?2:1);if(!(m in n))return{...n,[m]:{loadName:f,quantity:h}};const{quantity:_}=n[m],b=WS([_,h])??_;return{...n,[m]:{loadName:f,quantity:b}}},{}),ib=(e,t)=>{const r=Object.values(e).filter(o=>o.def.allowedRoles?.includes("lid")),n=QS(r,e,t),a=Object.entries(n).map(([o,{loadName:s,quantity:i}])=>{const l=Object.values(e).some(({pythonName:h})=>h===o),u=`load_name=${C(s)}`,p=`location=${l?o:C(o)}`,d=`quantity=${i}`,f=[u,p,d].join(`,
67
- `),m=Y(f);return`lid_stack_${o} = ${we}.load_lid_stack(
66
+ ${a}`:""}const tA=(e,t,r)=>e.reduce((n,{id:a,labwareDefURI:o,def:s})=>{const{stack:i}=r[a],l=i.length-1,u=i.slice(1,l),p=u.find(T=>t[T]?.def.parameters.loadName==="opentrons_flex_deck_riser"),d=u.every(T=>t[T]?.labwareDefURI===o)||p!=null,f=s.parameters.loadName;if(!d)return n;const m=p!=null?t[p]?.pythonName:ee(i),h=i.length-(p!=null?2:1);if(!(m in n))return{...n,[m]:{loadName:f,quantity:h}};const{quantity:_}=n[m],y=ZE([_,h])??_;return{...n,[m]:{loadName:f,quantity:y}}},{}),ub=(e,t)=>{const r=Object.values(e).filter(o=>o.def.allowedRoles?.includes("lid")),n=tA(r,e,t),a=Object.entries(n).map(([o,{loadName:s,quantity:i}])=>{const l=Object.values(e).some(({pythonName:h})=>h===o),u=`load_name=${F(s)}`,p=`location=${l?o:F(o)}`,d=`quantity=${i}`,f=[u,p,d].join(`,
67
+ `),m=Q(f);return`lid_stack_${o} = ${ge}.load_lid_stack(
68
68
  ${m},
69
69
  )`}).join(`
70
70
  `);return a?`# Load Lid Stacks:
71
- ${a}`:""},JS=e=>{const{parameters:t,namespace:r,version:n}=e;return[`lid=${C(t.loadName)}`,`lid_namespace=${C(r)}`,`lid_version=${n}`]};function lb(e,t,r,n,a){const o=Object.values(r).filter(l=>!l.def.allowedRoles?.includes("adapter")&&!l.def.allowedRoles?.includes("lid")),s=Object.values(r).filter(l=>l.def.allowedRoles?.includes("lid")),i=Object.values(o).reduce((l,u)=>{const{id:p,def:d,pythonName:f}=u,{metadata:m,parameters:h,namespace:_,version:b}=d,T=Object.values(s).find(q=>n[q.id].stack[1]===p),y=a[p]!=null&&a[p]!==m.displayName,I=n[p].stack.includes(et),w=n[p].stack[1],E=K(n[p].stack),A=Object.entries(e).find(([q,Q])=>Q.slot===E&&Q.moduleState.type===c.FLEX_STACKER_MODULE_TYPE),L=t[w]!=null||E===A?.[1].slot&&!I,S=r[w]!=null;let g,k;if(S&&!I)g=r[w].pythonName;else if(L){const q=A!=null?A?.[0]:w;g=t[q].pythonName}else g=we,k=`location=${w==="offDeck"||I?vn:C(w)}`;const v=y?`label=${C(a[p])}`:void 0;if(c.getLabwareDefIsStandard(d)){const q=[`${C(h.loadName)}`,...k?[k]:[],...v?[v]:[],`namespace=${C(_)}`,`version=${b}`,...T!=null?JS(T.def):[]].join(`,
72
- `);return[...l,`${f} = ${g}.load_labware(
73
- ${Y(q)},
74
- )`]}else{const q=[`${Co}[${C(c.getLabwareDefURI(d))}]`,...k?[k]:[],...v?[v]:[]].join(`,
75
- `);return[...l,`${f} = ${g}.load_labware_from_definition(
76
- ${Y(q)},
71
+ ${a}`:""},rA=e=>{const{parameters:t,namespace:r,version:n}=e;return[`lid=${F(t.loadName)}`,`lid_namespace=${F(r)}`,`lid_version=${n}`]};function cb(e,t,r,n,a){const o=Object.values(r).filter(l=>!l.def.allowedRoles?.includes("adapter")&&!l.def.allowedRoles?.includes("lid")),s=Object.values(r).filter(l=>l.def.allowedRoles?.includes("lid")),i=Object.values(o).reduce((l,u)=>{const{id:p,def:d,pythonName:f}=u,{metadata:m,parameters:h,namespace:_,version:y}=d,T=Object.values(s).find(M=>n[M.id].stack[1]===p),b=a[p]!=null&&a[p]!==m.displayName,w=n[p].stack.includes(et),S=n[p].stack[1],g=ee(n[p].stack),L=Object.entries(e).find(([M,G])=>G.slot===g&&G.moduleState.type===c.FLEX_STACKER_MODULE_TYPE),I=t[S]!=null||g===L?.[1].slot&&!w,A=r[S]!=null;let E,O;if(A&&!w)E=r[S].pythonName;else if(I){const M=L!=null?L?.[0]:S;E=t[M].pythonName}else E=ge,O=`location=${S==="offDeck"||w?Nn:F(S)}`;const k=b?`label=${F(a[p])}`:void 0;if(c.getLabwareDefIsStandard(d)){const M=[`${F(h.loadName)}`,...O?[O]:[],...k?[k]:[],`namespace=${F(_)}`,`version=${y}`,...T!=null?rA(T.def):[]].join(`,
72
+ `);return[...l,`${f} = ${E}.load_labware(
73
+ ${Q(M)},
74
+ )`]}else{const M=[`${Do}[${F(c.getLabwareDefURI(d))}]`,...O?[O]:[],...k?[k]:[]].join(`,
75
+ `);return[...l,`${f} = ${E}.load_labware_from_definition(
76
+ ${Q(M)},
77
77
  )`]}},[]).join(`
78
78
  `);return i?`# Load Labware:
79
- ${i}`:""}function ub(e,t){const r=Object.values(e).map(n=>{const{name:a,id:o,spec:s,pythonName:i}=n,l=s.channels===96?"":C(t[o].mount),u=c.isFlexPipette(a)?c.getFlexNameConversion(s):a;return`${i} = ${we}.load_instrument(${[C(u),...l?[l]:[]].join(", ")})`}).join(`
79
+ ${i}`:""}function pb(e,t){const r=Object.values(e).map(n=>{const{name:a,id:o,spec:s,pythonName:i}=n,l=s.channels===96?"":F(t[o].mount),u=c.isFlexPipette(a)?c.getFlexNameConversion(s):a;return`${i} = ${ge}.load_instrument(${[F(u),...l?[l]:[]].join(", ")})`}).join(`
80
80
  `);return r?`# Load Pipettes:
81
- ${r}`:""}function cb(e){const t=Object.values(e).map(r=>{const{pythonName:n,displayColor:a,displayName:o,description:s}=r,i=[`${C(o)}`,...s?[`description=${C(s)}`]:[],`display_color=${C(a)}`].join(`,
82
- `);return`${n} = ${we}.define_liquid(
83
- ${Y(i)},
81
+ ${r}`:""}function db(e){const t=Object.values(e).map(r=>{const{pythonName:n,displayColor:a,displayName:o,description:s}=r,i=[`${F(o)}`,...s?[`description=${F(s)}`]:[],`display_color=${F(a)}`].join(`,
82
+ `);return`${n} = ${ge}.define_liquid(
83
+ ${Q(i)},
84
84
  )`}).join(`
85
85
  `);return t?`# Define Liquids:
86
- ${t}`:""}function pb(e,t,r){const n=Object.entries(e).reduce((o,[s,i])=>{const l=r[s].pythonName;return Object.entries(i).forEach(([u,p])=>{Object.entries(p).forEach(([d,f])=>{const m=t[d].pythonName,h=`${l}__${m}__${f.volume}`;o[h]||(o[h]={labwarePythonName:l,liquidPythonName:m,volume:f.volume,wells:[]}),o[h].wells.push(u)})}),o},{}),a=Object.values(n).map(({labwarePythonName:o,liquidPythonName:s,volume:i,wells:l})=>{const u=l.map(h=>C(h)),d=Do(u,8).map(h=>Ba+h.join(", ")).join(`,
86
+ ${t}`:""}function fb(e,t,r){const n=Object.entries(e).reduce((o,[s,i])=>{const l=r[s].pythonName;return Object.entries(i).forEach(([u,p])=>{Object.entries(p).forEach(([d,f])=>{const m=t[d].pythonName,h=`${l}__${m}__${f.volume}`;o[h]||(o[h]={labwarePythonName:l,liquidPythonName:m,volume:f.volume,wells:[]}),o[h].wells.push(u)})}),o},{}),a=Object.values(n).map(({labwarePythonName:o,liquidPythonName:s,volume:i,wells:l})=>{const u=l.map(h=>F(h)),d=Mo(u,8).map(h=>Ha+h.join(", ")).join(`,
87
87
  `),m=[`wells=[${u.length<8?u.join(", "):`
88
88
  ${d}
89
89
  `}],
90
90
  liquid=${s},
91
91
  volume=${i},
92
92
  `].join();return`${o}.load_liquid(
93
- ${Y(m)})`}).join(`
93
+ ${Q(m)})`}).join(`
94
94
  `);return a?`# Load Liquids:
95
- ${a}`:""}function db(e){const t=c.getAllLiquidClassDefs(),r=e.map(n=>n==null?"":`${Xa(n,!0)} = ${we}.get_liquid_class(${C(t[n].liquidClassName)})`).join(`
95
+ ${a}`:""}function mb(e){const t=c.getAllLiquidClassDefs(),r=e.map(n=>n==null?"":`${Ja(n,!0)} = ${ge}.get_liquid_class(${F(t[n].liquidClassName)})`).join(`
96
96
  `);return e.length>0?`# Load Liquid Classes:
97
- ${r}`:""}function fb(e){const t=Object.values(e)?.map(r=>{const n=C(c.getCutoutDisplayName(r.location));return`${r.pythonName} = ${we}.load_trash_bin(${n})`}).join(`
97
+ ${r}`:""}function hb(e){const t=Object.values(e)?.map(r=>{const n=F(c.getCutoutDisplayName(r.location));return`${r.pythonName} = ${ge}.load_trash_bin(${n})`}).join(`
98
98
  `);return t?`# Load Trash Bins:
99
- ${t}`:""}function mb(e){const t=Object.values(e)?.map(r=>`${r.pythonName} = ${we}.load_waste_chute()`);return t.length>0?`# Load Waste Chute:
100
- ${t}`:""}const eA=e=>e?`
99
+ ${t}`:""}function _b(e){const t=Object.values(e)?.map(r=>`${r.pythonName} = ${ge}.load_waste_chute()`);return t.length>0?`# Load Waste Chute:
100
+ ${t}`:""}const nA=e=>e?`
101
101
  `+e.split(/\r\n|\r|\n/).map(t=>`# ${t}`).join(`
102
- `):"";function hb(e){return`# PROTOCOL STEPS
102
+ `):"";function yb(e){return`# PROTOCOL STEPS
103
103
 
104
- `+e.timeline.map(t=>{const{stepInfo:r}=t,n=r?.description;return`# Step ${r?.stepNumber}: ${r?.name}${eA(n)}
104
+ `+e.timeline.map(t=>{const{stepInfo:r}=t,n=r?.description;return`# Step ${r?.stepNumber}: ${r?.name}${nA(n)}
105
105
  ${t.python||"pass"}`}).join(`
106
106
 
107
- `)}function tA(e,t,r,n,a,o,s){const{moduleEntities:i,labwareEntities:l,pipetteEntities:u,liquidEntities:p,wasteChuteEntities:d,trashBinEntities:f}=e,{modules:m,labware:h,pipettes:_}=t,T=[ob(i,m),sb(i,l,h),ib(l,h),lb(m,i,l,h,a),ub(u,_),...o===c.FLEX_ROBOT_TYPE?[fb(f),mb(d)]:[],cb(p),pb(n,p,l),db(s),_b(i,l,h,m,r),hb(r)].filter(y=>y).join(`
107
+ `)}function aA(e,t,r,n,a,o,s){const{moduleEntities:i,labwareEntities:l,pipetteEntities:u,liquidEntities:p,wasteChuteEntities:d,trashBinEntities:f}=e,{modules:m,labware:h,pipettes:_}=t,T=[ib(i,m),lb(i,l,h),ub(l,h),cb(m,i,l,h,a),pb(u,_),...o===c.FLEX_ROBOT_TYPE?[hb(f),_b(d)]:[],db(p),fb(n,p,l),mb(s),bb(i,l,h,m,r),yb(r)].filter(b=>b).join(`
108
108
 
109
- `)||"pass";return`def run(${we}: protocol_api.ProtocolContext) -> None:
110
- ${Y(T)}`}function rA(e){const t=Object.values(e).filter(r=>!c.getLabwareDefIsStandard(r.def)).map(r=>r.def);if(t.length>0){const r=Object.fromEntries(t.map(n=>[c.getLabwareDefURI(n),n]));return`${Co} = json.loads("""${JSON.stringify(r)}""")`}else return""}const Go=e=>{switch(e){case"perDest":return"per destination";case"perSource":return"per source";default:return e}},_b=(e,t,r,n,a)=>{const s=Object.values(e).map(i=>{const{id:l,type:u,pythonName:p}=i;if(u===c.FLEX_STACKER_MODULE_TYPE){const d=n[l].slot,f=a.timeline.map(_=>_.robotState.labware),m=Object.entries(r).filter(([_,b])=>b.stack.includes(l)&&b.stack.includes(et)),h=[...Object.entries(r),...f.flatMap(_=>Object.entries(_))].filter(([_,b])=>K(b.stack)===d&&!b.stack.includes(et));if(m.length===0){if(h.length===0)return"";const _=h.find(([y])=>t[y].def.allowedRoles?.includes("lid")),b=h.find(([y])=>!t[y].def.allowedRoles?.includes("lid"));if(b==null)return"";const T=[`load_name=${C(t[b[0]].def.parameters.loadName)}`,`namespace=${C(t[b[0]].def.namespace)}`,`version=${t[b[0]].def.version}`,"count=0",..._!=null?[`lid=${C(t[_[0]].def.parameters.loadName)}`]:[]].join(`,
109
+ `)||"pass";return`def run(${ge}: protocol_api.ProtocolContext) -> None:
110
+ ${Q(T)}`}function oA(e){const t=Object.values(e).filter(r=>!c.getLabwareDefIsStandard(r.def)).map(r=>r.def);if(t.length>0){const r=Object.fromEntries(t.map(n=>[c.getLabwareDefURI(n),n]));return`${Do} = json.loads("""${JSON.stringify(r)}""")`}else return""}const Wo=e=>{switch(e){case"perDest":return"per destination";case"perSource":return"per source";default:return e}},bb=(e,t,r,n,a)=>{const s=Object.values(e).map(i=>{const{id:l,type:u,pythonName:p}=i;if(u===c.FLEX_STACKER_MODULE_TYPE){const d=n[l].slot,f=a.timeline.map(_=>_.robotState.labware),m=Object.entries(r).filter(([_,y])=>y.stack.includes(l)&&y.stack.includes(et)),h=[...Object.entries(r),...f.flatMap(_=>Object.entries(_))].filter(([_,y])=>ee(y.stack)===d&&!y.stack.includes(et));if(m.length===0){if(h.length===0)return"";const _=h.find(([b])=>t[b].def.allowedRoles?.includes("lid")),y=h.find(([b])=>!t[b].def.allowedRoles?.includes("lid"));if(y==null)return"";const T=[`load_name=${F(t[y[0]].def.parameters.loadName)}`,`namespace=${F(t[y[0]].def.namespace)}`,`version=${t[y[0]].def.version}`,"count=0",..._!=null?[`lid=${F(t[_[0]].def.parameters.loadName)}`]:[]].join(`,
111
111
  `);return`${p}.set_stored_labware(
112
- ${Y(T)}
113
- )`}else{const _=Object.values(m).filter(w=>!t[w[0]]?.def.allowedRoles?.includes("lid")).map(w=>t[w[0]].pythonName),T=Do(_,4).map(w=>Ba+w.join(", ")).join(`,
114
- `),I=`labware=[${_.length<4?_.join(", "):`
112
+ ${Q(T)}
113
+ )`}else{const _=Object.values(m).filter(S=>!t[S[0]]?.def.allowedRoles?.includes("lid")).map(S=>t[S[0]].pythonName),T=Mo(_,4).map(S=>Ha+S.join(", ")).join(`,
114
+ `),w=`labware=[${_.length<4?_.join(", "):`
115
115
  ${T}
116
116
  `}],
117
117
  `;return`${p}.set_stored_labware_items(
118
- ${Y(I)})`}}}).filter(Boolean);return s.length>0?`# Set Stored Labware:
118
+ ${Q(w)})`}}}).filter(Boolean);return s.length>0?`# Set Stored Labware:
119
119
  ${s.join(`
120
- `).trimStart()}`:""},nA={boolean:"add_bool",int:"add_int",float:"add_float",string:"add_str",csv:"add_csv_file"};function aA(e){const t=Object.values(e).map(r=>{const n="choices"in r?r.choices:void 0,a={variable_name:r.variableName,display_name:r.displayName,description:r.description||void 0,default:r.type==="csv"?void 0:r.default,choices:n?.map(s=>({display_name:String(s),value:s})),..."minimum"in r?{minimum:r.minimum,maximum:r.maximum,unit:n==null?r.unit:void 0}:{}},o=Object.entries(a).filter(([,s])=>s!=null).map(([s,i])=>`${s}=${or(i)}`).join(`,
121
- `);return`parameters.${nA[r.type]}(
122
- ${Y(o)},
120
+ `).trimStart()}`:""},sA={boolean:"add_bool",int:"add_int",float:"add_float",string:"add_str",csv:"add_csv_file"};function iA(e){const t=Object.values(e).map(r=>{const n="choices"in r?r.choices:void 0,a={variable_name:r.variableName,display_name:r.displayName,description:r.description||void 0,default:r.type==="csv"?void 0:r.default,choices:n?.map(s=>({display_name:String(s),value:s})),..."minimum"in r?{minimum:r.minimum,maximum:r.maximum,unit:n==null?r.unit:void 0}:{}},o=Object.entries(a).filter(([,s])=>s!=null).map(([s,i])=>`${s}=${sr(i)}`).join(`,
121
+ `);return`parameters.${sA[r.type]}(
122
+ ${Q(o)},
123
123
  )`}).join(`
124
124
  `);return t?`def add_parameters(parameters: protocol_api.ParameterContext) -> None:
125
- ${Y(t)}`:""}const oA=(e,t,r,n)=>{const{spec:a}=t,o=e===c.ROW,s=e===c.COLUMN||e===c.ALL&&a.channels===8,i=n.ordering[0].length===1;if(o&&i){const u=s?`H${r.slice(1)}`:`${r.charAt(0)}12`,p=a.nozzleMap[u],d=a.nozzleMap[r],f=p.map((_,b)=>_-d[b]),m=[f[0]/2,f[1]/2,0],h=d.map((_,b)=>_+m[b]);return{x:h[0],y:h[1],z:h[2]}}const l=a.nozzleMap[r];return{x:l[0],y:l[1],z:l[2]}},gn={back_left:{x:-43.25,y:454.9,z:211.91},front_right:{x:128.75,y:402,z:211.91}},Sh={x:gn.back_left.x,y:gn.back_left.y,z:gn.back_left.z},sA={x:gn.front_right.x,y:gn.front_right.y,z:gn.front_right.z},iA=49.5,yb=e=>{if(e.addressableArea?.areaType==="slot"){const t=`cutout${e.addressableArea?.id}`;if(t)return t}return null},lA=(e,t,r,n,a,o,s)=>{const{pipetteBoundingBoxOffsets:i}=e.spec,l=oA(o,e,a,n),u=i.backLeftCorner[0],p=i.frontRightCorner[0],d=i.backLeftCorner[1],f=i.frontRightCorner[1],m=r.x-(l.x-u),h=r.x+(p-l.x),_=r.y+(d-l.y),b=r.y-(l.y-f),T=(r.z??0)+t-s;return[{x:m,y:_,z:T},{x:h,y:b,z:T},{x:h,y:_,z:T},{x:m,y:b,z:T}]},bb=(e,t)=>{const r=e[1].x<t[0].x,n=e[0].x>t[1].x,a=e[0].y<t[1].y,o=e[1].y>t[0].y;return!(r||n||a||o)},Ah=(e,t)=>{if(t===c.FLEX_ROBOT_TYPE){const r=c.getDeckDefFromRobotType(t),{addressableAreas:n}=r.locations;return n.find(o=>o.id.includes(e))?.offsetFromCutoutFixture[2]??0}return c.getModuleDef(e).dimensions.bareOverallHeight},uA=e=>{const t=c.getDeckDefFromRobotType(e);return Object.values(t.cutoutFixtures).find(n=>c.WASTE_CHUTE_FIXTURES.includes(n.id))?.height??0},cA=(e,t,r,n)=>{const{modules:a,labware:o}=e,{moduleEntities:s,labwareEntities:i,wasteChuteEntities:l}=t;let u=0;const p=r?.addressableArea?.id;if(p){const d=Uo(o,p),f=Object.keys(a).find(h=>a[h].slot===p);Object.values(l).find(h=>h.location===yb(r))&&(u+=uA(n)),d.length>0?d.forEach(h=>{a[h]!=null&&(u+=Ah(s[h].model,n)),o[h]!=null&&(u+=i[h].def.dimensions.zDimension)}):f!=null&&(u+=Ah(s[f].model,n))}return u},pA=(e,t,r,n,a)=>{for(const o of t){const s=o.addressableArea?.boundingBox,i=o.position;if(i==null||s==null)continue;const l={x:i[0],y:s.yDimension+i[1],z:i[2]},u={x:i[0]+s.xDimension,y:i[1],z:i[2]};if(bb([e[0],e[1]],[l,u])&&e[0].z!=null&&cA(r,n,o,a)>=e[0]?.z&&o.addressableArea!=null)return{addressableAreaCausingCollision:o.addressableArea}}return null},dA=(e,t)=>Object.values(t).find(r=>r.type===c.THERMOCYCLER_MODULE_TYPE)?bb([Sh,sA],[e[0],e[1]])&&e[0].x<=Sh.z:!1,fA=(e,t,r,n)=>{const{wells:a}=e.def,o=a[t];return{x:o.x+r.x,y:o.y+r.y,z:n?o.z+(r.z??0):e.def.dimensions.zDimension}},ht=e=>{const{robotState:t,invariantContext:r,pipetteId:n,labwareId:a,wellLocationOffset:o={x:0,y:0,z:0},wellTargetName:s,primaryNozzle:i,nozzleConfiguration:l,tiprackId:u}=e,{pipetteEntities:p,labwareEntities:d,stagingAreaEntities:f,moduleEntities:m}=r,{labware:h,tipState:_}=t,b=p[n];if(b==null)return{isSafe:!0};const{spec:T}=b,{channels:y}=T,E=T?.displayCategory==="FLEX"?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE,A=c.getDeckDefFromRobotType(E);if(d[a]==null||s==null||y===1)return{isSafe:!0};const L=u?!0:_.pipettes[n]?.hasTip??!1,S=u??_.pipettes[n]?.tiprackURI,g=S!=null?d[S]:null,k=g!=null?g.def.parameters.tipLength:0,v=Object.values(f).map(P=>P.location),D=L?k??0:0,q=K(h[a].stack),Q=h[a].stack.some(P=>m[P]?.type===c.THERMOCYCLER_MODULE_TYPE),fe=c.getDeckDefFromRobotType(c.FLEX_ROBOT_TYPE),_e=(Q?c.getPositionFromSlotId(c.B1_ADDRESSABLE_AREA,fe):c.getPositionFromSlotId(q,A))??[0,0,0],ne=Q?fe.locations.addressableAreas.find(P=>P.id===c.THERMOCYCLER_MODULE_V2)?.offsetFromCutoutFixture??[0,0,0]:[0,0,0],Te={x:ne[0]+_e[0],y:ne[1]+_e[1],z:ne[2]+_e[2]},{def:Oe}=d[a],Be=Ib({wellTargetName:s,primaryNozzle:i,nozzleConfiguration:l,specs:T,labwareDef:Oe}),Me={x:o.x+Be.x+Te.x,y:o.y+Be.y+Te.y,z:(o.z??0)+(Te.z??0)},ae=fA(d[a],s,Me,L),Re=g!=null?mA({pipetteSpecs:T,tiprackUri:g.labwareDefURI,nozzles:l}):0,We=d[a].def,Fe=lA(b,D,ae,We,i,l,Re);if(!_A({channels:y,boundingBox:Fe,robotType:E}))return{isSafe:!1,reason:{type:"outsidePipetteExtents"}};const Z=(E===c.OT2_ROBOT_TYPE?c.getOt2SurroundingSlots(q):c.getFlexSurroundingSlots(q,v)).map(P=>{const $=c.getAddressableAreaFromSlotId(P,A),F=c.getPositionFromSlotId(P,A);return{addressableArea:$,position:F}});if(dA(Fe,m))return{isSafe:!1,reason:{type:"thermocyclerLidCollision"}};const N=pA(Fe,Z,t,r,E);return N!=null?{isSafe:!1,reason:{type:"adjacentAdressableAreaCollision",addressableAreaCausingCollision:N.addressableAreaCausingCollision}}:{isSafe:!0}},bp=e=>{const{tipState:t,primaryNozzle:r,channels:n,nozzleConfiguration:a,wellName:o,tiprackDef:s,tipsToIgnore:i=[]}=e,{ordering:l}=s;if(n===1)return{isSafe:!0,isComplete:t[o]!==de};if(n===8){const u=r!==c.A1_NOZZLE,p=dc(o),d=l[p],f=u?[...d].reverse():d;if(a===c.SINGLE){const m=f.indexOf(o);return{isSafe:f.slice(m+1).every(h=>t[h]===de||i.includes(h)),isComplete:t[o]!==de}}if(a===c.PARTIAL_COLUMN){const m=f.indexOf(o),h=c.PARTIAL_NOZZLE_MAP[r],_=u?f.slice(m-h+1,m+1):f.slice(m,m+h);return{isSafe:f.slice(m+1).every(b=>t[b]===de||i.includes(b)),isComplete:_.every(b=>t[b]!==de&&!i.includes(b))}}return{isSafe:!0,isComplete:f.every(m=>t[m]!==de)}}if(a===c.ALL)return{isSafe:!0,isComplete:Object.keys(s.wells).every(u=>t[u]!==de)};if(a===c.COLUMN){const u=r===c.A12_NOZZLE,p=dc(o),d=l[p],f=u?[...l].reverse():l,m=f.indexOf(d);return{isSafe:f.slice(m+1).flat().every(h=>t[h]===de||i.includes(h)),isComplete:f[m].every(h=>t[h]!==de)}}if(a===c.ROW){const u=l[0].map((m,h)=>l.map(_=>_[h])),d=r===c.H1_NOZZLE?[...u].reverse():u,f=d.findIndex(m=>m.some(h=>h===o));return{isSafe:d.slice(f+1).flat().every(m=>t[m]===de||i.includes(m)),isComplete:d[f].every(m=>t[m]!==de)}}if(a===c.SINGLE){const u=wn(r??bo({nozzles:a,channels:n})),p=Tp(r??bo({nozzles:a,channels:n})),d=u==="H",m=p==="12"?[...l].reverse():l,h=m.findIndex(_=>_.some(b=>b===o));return{isSafe:m.slice(h).every(_=>{const b=d?[..._].reverse():_,T=b.findIndex(y=>wn(y)===wn(o));return b.slice(T).every(y=>t[y]===de||i.includes(y)||y===o)}),isComplete:t[o]!==de}}return{isSafe:!1}},wn=e=>e.slice(0,1),Tp=e=>e.slice(1),dc=e=>parseInt(e.slice(1))-1,bo=e=>{const{nozzles:t,channels:r}=e;if(r===8&&t===c.SINGLE)return"H1";if(r===96){if(t===c.COLUMN)return"A12";if(t===c.SINGLE)return"H12"}return"A1"},Qa=e=>{const{wellSets:t,nozzles:r,channels:n,primaryNozzle:a}=e;return r===c.ROW?t.map(o=>o[0]):t.map(o=>n===96&&r===c.ALL?a:r===c.COLUMN||n===8&&r===c.ALL||n===8&&r===c.PARTIAL_COLUMN?wn(a)==="H"?o[o.length-1]:o[0]:(console.assert(o.length===1,"Well set for SINGLE nozzle configuration should have exactly 1 well"),o[0]))},mA=e=>{const{pipetteSpecs:t,tiprackUri:r,nozzles:n}=e,{channels:a}=t,o=hA(a,n),s=t.pickUpTipConfigurations.pressFit.configurationsByNozzleMap[o]?.default.tipOverlaps;if(s==null)return console.error(`No tip overlaps found for ${n} and ${o} overlap.`),0;const i=Math.max(...Object.keys(s).map(l=>Number(l.slice(1))));return s[`v${i}`]?.[r]??s[`v${i}`]?.default??0},hA=(e,t)=>{if(e===1)return"SingleA1";if(e===8)return t===c.SINGLE?"SingleH1":"Full";if(e===96){if(t===c.SINGLE)return"SingleH12";if(t===c.COLUMN)return"Column12";if(t===c.ROW)return"RowA"}return"Full"},_A=e=>{const{channels:t,boundingBox:r,robotType:n}=e,a=c.getRobotDefFromRobotType(n),{paddingOffsets:o}=a,{front:s,rear:i,leftSide:l,rightSide:u}=o,[p,d]=a.extents,[f,m]=r,{x:h,y:_}=f,{x:b,y:T}=m;if(t===96){if(b<l)return!1;const y=p+u;if(h>y)return!1}if(t!==1){if(_<s)return!1;const y=d+i;if(T>y)return!1}return!0},Tb=e=>{const{channels:t,nozzleMap:r}=e;if(t===1)return 0;const[n,a]=["A1","B1"].map(s=>r[s][1]);return Math.abs(n-a)},Ib=e=>{const t=yA(e),r=bA(e);return{x:t,y:r}},yA=e=>{const{primaryNozzle:t,nozzleConfiguration:r,specs:n,labwareDef:a}=e,{channels:o}=n;if(o!==96)return 0;const{ordering:s}=a,i=s.length===1;if(!i)return 0;let l;const u=Tp(t)==="12"?1:-1;if(r===c.ALL&&o===96||r===c.ROW)l=12;else if(r===c.QUADRANT)l=6;else return u*iA;const p=Tb(n);return i?(l-1)*p/2*u:0},bA=e=>{const{wellTargetName:t,primaryNozzle:r,nozzleConfiguration:n,specs:a,labwareDef:o}=e,{channels:s}=a;if(s===1)return 0;const i=Tb(a),{ordering:l}=o,u=l.findIndex(f=>f.includes(t));if(l[u].length!==1)return 0;if(n===c.PARTIAL_COLUMN){const m=-1*(8-c.PARTIAL_NOZZLE_MAP[r])*i,h=7*i/2;return m+h}const d=wn(r)==="H"?-1:1;return 7*i/2*d};function Eb(e){const t=e.length===1?e[0]:null;return t!=null&&"steps"in t?{numRepetitions:t.repetitions,repeatingProfileSteps:t.steps}:{numRepetitions:1,repeatingProfileSteps:Ip(e)}}function Ip(e){return e.flatMap(t=>"steps"in t?py(t.steps,t.repetitions):t)}const TA=e=>{switch(e.commandCreatorFnName){case"consolidate":return O(Nb,e);case"delay":return O(be,e);case"waitForModuleTask":return O(xb,e);case"distribute":return O(Cb,e);case"transfer":return O(Ub,e);case"mix":return O(Pb,e);case"moveLabware":return O(G_,e);case"captureImage":return O(F_,e);case"engageMagnet":return O(B_,e);case"disengageMagnet":return O($_,e);case"setTemperature":return O($c,e);case"deactivateTemperature":return O(V_,e);case"waitForTemperature":return O(Gc,e);case"thermocyclerProfile":return O(Mb,e);case"thermocyclerState":return O(Fb,e);case"heaterShaker":return O(Db,e);case"comment":return O(U_,e);case"absorbanceReaderOpenLid":return O(D_,e);case"absorbanceReaderCloseLid":return O(Po,e);case"absorbanceReaderRead":return O(Ab,e);case"absorbanceReaderInitialize":return O(Sb,e);case"flexStackerEmpty":return O(x_,{...e,strategy:"manualWithPause"});case"flexStackerFillItems":return O(H_,e);case"flexStackerRetrieve":return O(z_,e);case"flexStackerStore":return O(j_,{...e,strategy:"automatic"});case"vacuumCloseVent":return O($a,e);case"vacuumOpenVent":return O(Y_,e);case"vacuumSetPumpPower":return O(Hc,e);case"vacuumSetPumpPressure":return O(zc,e);case"vacuumStartRunProfile":return O(jc,e);case"vacuumStopPump":return O(Z_,e);case"vacuumCloseVentSetPumpPressure":return O(Vb,e);case"vacuumCloseVentSetPumpPower":return O(qb,e);case"vacuumCloseVentStartProfile":return O($b,e);case"airGapInPlace":return O(Ot,e);case"aspirate":return O(Ot,e);case"aspirateInPlace":return O(Va,e);case"aspirateWhileTracking":return O(vE,e);case"blowOutInPlace":return O(Vn,e);case"blowout":return O(Uc,e);case"configureForVolume":return O(Rn,e);case"configureNozzleLayout":return O(q_,e);case"dispense":return O(qc,e);case"dispenseInPlace":return O(Je,e);case"dispenseWhileTracking":return O(kE,e);case"dropTip":return O(Gr,e);case"dropTipInPlace":return O(No,e);case"home":return O(PE,e);case"moveRelative":return O(NE,e);case"moveToAddressableArea":return O($e,e);case"moveToAddressableAreaForDropTip":return O(Vc,e);case"moveToCoordinates":return O(CE,e);case"moveToWell":return O(x,e);case"pickUpTip":return O(po,e);case"prepareToAspirate":return O(Rt,e);case"touchTip":return O(St,e);case"tryLiquidProbe":return O(DE,e);case"heaterShaker/closeLabwareLatch":return O(X_,e);case"heaterShaker/openLabwareLatch":return O(Q_,e);case"heaterShaker/setAndWaitForShakeSpeed":return O(J_,e);case"heaterShaker/deactivateHeater":return O(ec,e);case"heaterShaker/deactivateShaker":return O(tc,e);case"thermocycler/closeLid":return O(Wc,e);case"thermocycler/openLid":return O(ry,e);case"thermocycler/deactivateBlock":return O(ey,e);case"thermocycler/deactivateLid":return O(ty,e);case"thermocycler/setTargetBlockTemperature":return O(ny,e);case"thermocycler/setTargetLidTemperature":return O(Yc,e);case"thermocycler/startRunExtendedProfile":return O(W_,e)}},M=ZT;function gb(e){return Object.keys(e).sort((r,n)=>{const a=K(e[r].stack),o=K(e[n].stack),s=parseInt(a),i=parseInt(o);return De.includes(a)&&De.includes(o)?r.localeCompare(n):De.includes(a)?1:De.includes(o)?-1:s-i})}function wb(e){const{pipetteId:t,tiprackId:r,invariantContext:n,robotState:a,nozzles:o,primaryNozzle:s}=e,i=n.pipetteEntities[t]?.spec?.channels,l=n.labwareEntities[r]?.def,u=a.tipState.tipracks[r];if(!i||!l||!u)return console.assert(!1,`Pipette ${t} missing channels/spec or tiprack definition`),null;const p=g=>u[g]===Da,d=c.orderWells(l.ordering,"t2b","l2r"),f=c.orderWells(l.ordering,"b2t","l2r"),m=g=>g.find(p)??null,h=g=>[...g].reverse().find(p)??null,_=g=>g.find(k=>k.every(p))??null,b=g=>[...g].reverse().find(k=>k.every(p))??null,T=i===8&&o===c.SINGLE,y=T&&s===c.H1_NOZZLE,I=T&&s===c.A1_NOZZLE,w=i===96&&o===c.SINGLE,E=w&&s===c.H12_NOZZLE,A=w&&s===c.A12_NOZZLE,L=w&&s===c.H1_NOZZLE,S=w&&s===c.A1_NOZZLE;if(i===1||y||E)return m(d);if(I)return m(f);if(o===c.PARTIAL_COLUMN){const g=m(d);if(!g)return null;const k=d.indexOf(g);return d[k]??null}if(o===c.ALL&&i===8)return _(l.ordering)?.[0]??null;if(S)return h(d);if(A)return m(f);if(L)return h(f);if(o===c.COLUMN){const g=l.ordering;return(s===c.A1_NOZZLE?b(g):_(g))?.[0]??null}if(o===c.ROW){const g=l.ordering,k=g[0].map((D,q)=>g.map(Q=>Q[q]));return(s===c.A1_NOZZLE?b(k):_(k))?.[0]??null}return o===c.ALL&&i===96?d.every(p)?d[0]:null:(console.assert(!1,`Unhandled _getNextTip case for pipette ${t}`),null)}function Ja(e,t,r,n,a,o){const s=r.pipetteEntities[e];if(!s)throw new Error(`cannot getNextTiprack, no pipette entity for pipette "${e}"`);const i=[],l=gb(n.labware).filter(h=>{console.assert(r.labwareEntities[h]?.labwareDefURI!=null,`cannot getNextTiprack, no labware entity for "${h}"`);const _=K(n.labware[h].stack),b=Sy(_),T=wy({labwareId:h,labwareRobotState:n.labware,labwareEntities:r.labwareEntities});if(b&&T&&c.getIsTiprack(r.labwareEntities[h].def))return i.push(h),!1;const y=r.labwareEntities[h].labwareDefURI;return b&&y===t});let u=l;const p=s.spec.channels===96,d=[];p&&(u=u.filter(h=>{const _=n.labware[h].stack[1],b=r.labwareEntities[_],T=b?.def.parameters.loadName==="opentrons_flex_96_tiprack_adapter"&&c.getLabwareDefIsStandard(b?.def),y=o===c.ALL?T:!T;return y||d.push(h),y}));let f=null,m=null;for(const h of u){const _=wb({pipetteId:e,tiprackId:h,nozzles:o,invariantContext:r,robotState:n,primaryNozzle:a}),{isSafe:b}=_!=null?ht({robotState:n,invariantContext:r,pipetteId:e,labwareId:h,wellTargetName:_,primaryNozzle:a,nozzleConfiguration:o}):{isSafe:!1},{isSafe:T,isComplete:y=!1}=_!=null?bp({tipState:n.tipState.tipracks[h],primaryNozzle:a,channels:s.spec.channels,nozzleConfiguration:o,wellName:_,tiprackDef:r.labwareEntities[h].def}):{isSafe:!1};if(_&&b&&T&&y){f=h,m=_;break}}return f&&m?{nextTiprack:{tiprackId:f,well:m},tipracks:{totalTipracks:l.length,excludedBy96Channel:d.length,excludedByLid:i.length,filteredSortedTiprackIds:u}}:{nextTiprack:null,tipracks:{totalTipracks:l.length,excludedBy96Channel:d.length,excludedByLid:i.length,filteredSortedTiprackIds:u}}}function Wo(e,t,r){const n=t.pipetteEntities[e],a=n.spec.liquids.default.maxVolume,o=n.tiprackLabwareDef;let s=null;for(const l of o)if(c.getLabwareDefURI(l)===r){s=l;break}const i=c.getTiprackVolume(s??o[0]);return!a||!i?(console.assert(!1,`getPipetteEffectiveMaxVol expected tiprackMaxVol and pipette maxVolume to be > 0, got',
126
- ${a}, ${i}`),NaN):NT([i,a])??NaN}function vt(e,t){return t in e.modules||console.warn(`getModuleState expected module id "${t}" to be in robot state`),e.modules[t]?.moduleState}const Yo=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.THERMOCYCLER_MODULE_TYPE?r:null},Kn=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.ABSORBANCE_READER_TYPE?r:null},_t=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.FLEX_STACKER_MODULE_TYPE?r:null},ut=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.VACUUM_MODULE_TYPE?r:null},Sb=(e,t,r)=>{const{moduleId:n,measureMode:a,sampleWavelengths:o,referenceWavelength:s}=e,i=Kn(r,n),l=[];if(i==null&&l.push(re()),l.length>0)return{errors:l};const u=[O(Po,{moduleId:n}),O(C_,{moduleId:n,measureMode:a,sampleWavelengths:o,referenceWavelength:s??void 0})];return le(u,t,r)},Ab=(e,t,r)=>{const n=[],a=Kn(r,e.moduleId);if((a==null||e.moduleId==null)&&n.push(re()),a?.initialization==null&&n.push(aT()),n.length>0)return{errors:n};const{moduleId:o,fileName:s}=e,i=[O(Po,{moduleId:o}),O(M_,{moduleId:o,fileName:s})];return le(i,t,r)},IA=(e,t,r)=>{const{pipetteId:n,trashId:a,flowRate:o,volume:s}=e,i=[O($e,{pipetteId:n,fixtureId:a,offset:At}),R(Rt,{pipetteId:n}),O(Ot,{pipetteId:n,volume:s,flowRate:o})];return le(i,t,r)},EA=(e,t,r)=>{const{pipetteId:n,volume:a,flowRate:o,wasteChuteId:s}=e,i=[O($e,{pipetteId:n,fixtureId:s,offset:At}),R(Rt,{pipetteId:n}),O(Ot,{pipetteId:n,flowRate:o,volume:a})];return le(i,t,r)},gA=(e,t,r)=>{const{labwareId:n,wellName:a,flowRate:o,pipetteId:s,volume:i,type:l}=e,u=t.pipetteEntities[s].pythonName,p=l==="aspirate"?[]:[R(Rt,{pipetteId:s})],d=()=>({commands:[],python:`${u}.air_gap(${[`volume=${i}`,`height=${Zu}`,`flow_rate=${o}`].join(", ")})`}),f=[R(x,{pipetteId:s,labwareId:n,wellName:a,wellLocation:{origin:"top",offset:{z:Zu,x:0,y:0}}}),...p,R(Ot,{pipetteId:s,volume:i,flowRate:o}),d];return le(f,t,r)},Lb=(e,t,r)=>{const{pipetteId:n,trashId:a,flowRate:o}=e,{pipetteEntities:s,trashBinEntities:i}=t,l=s[n].pythonName,u=i[a].pythonName,p=()=>({commands:[],python:`${l}.flow_rate.blow_out = ${o}
127
- ${l}.blow_out(${u})`}),d=[R($e,{pipetteId:n,fixtureId:a,offset:At}),R(Vn,{pipetteId:n,flowRate:o}),p];return le(d,t,r)},Ob=(e,t,r)=>{const{pipetteId:n,flowRate:a,wasteChuteId:o}=e,{pipetteEntities:s,wasteChuteEntities:i}=t,l=s[n].pythonName,u=i[o].pythonName,p=()=>({commands:[],python:`${l}.flow_rate.blow_out = ${a}
128
- ${l}.blow_out(${u})`}),d=[R($e,{pipetteId:n,fixtureId:o,offset:At}),R(Vn,{pipetteId:n,flowRate:a}),p];return le(d,t,r)};var Hu,Lh;function wA(){if(Lh)return Hu;Lh=1;var e=N_();function t(r){var n=e(r),a=n%1;return n===n?a?n-a:n:0}return Hu=t,Hu}var zu,Oh;function SA(){if(Oh)return zu;Oh=1;var e=Fy(),t=Fc(),r=wA(),n=Math.ceil,a=Math.max;function o(s,i,l){(l?t(s,i,l):i===void 0)?i=1:i=a(r(i),0);var u=s==null?0:s.length;if(!u||i<1)return[];for(var p=0,d=0,f=Array(n(u/i));p<u;)f[d++]=e(s,p,p+=i);return f}return zu=o,zu}var AA=SA();const Rb=Ge(AA),nr=e=>{const{labwareDef:t,wells:r,primaryNozzle:n}=e,a=c.PARTIAL_NOZZLE_MAP[n]-1,{ordering:o,parameters:s}=t;return r.map(i=>{const l=o.find(p=>p.includes(i));if(l==null)return console.warn(`Could not find column for ${i} in ${s.loadName}`),i;if(l.length===1)return i;const u=l.indexOf(i);return u===-1?(console.warn(`Could not find column index of ${i}`),i):l[u+a]})},vb=(e,t,r)=>{const{pipetteId:n,trashLocation:a}=e;let o=[];const s=Kc(a);if(r.tipState.pipettes[n]?.hasTip){const i=t.pipetteEntities[n].pythonName,l=()=>({commands:[],python:`${i}.drop_tip()`});o=[R(Vc,{pipetteId:n,addressableAreaName:s}),R(No,{pipetteId:n}),l]}return le(o,t,r)},kb=(e,t,r)=>{const n=At,{pipetteId:a,wasteChuteId:o}=e,{pipetteEntities:s,wasteChuteEntities:i}=t;let l=[];if(!r.tipState.pipettes[a].hasTip)l=[];else{const u=s[a].pythonName,p=i[o].pythonName,d=()=>({commands:[],python:`${u}.drop_tip(${p})`});l=[R($e,{pipetteId:a,fixtureId:o,offset:n}),R(No,{pipetteId:a}),d]}return le(l,t,r)},eo=(e,t,r)=>{const{pipette:n,dropTipLocation:a,nozzles:o,primaryNozzle:s,tipRack:i,isFromMixCommand:l=!1,tipSelectionArgs:u}=e,p=r.pipettes[n].nozzles,d=r.pipettes[n].tiprackId,f=t.pipetteEntities[n]?.spec,m=f?.channels;let h=null;if(u==null){if(i==null)return{errors:[fT()]};const g=Ja(n,i,t,r,s,o);h=g.nextTiprack;const k=g.tipracks,{excludedBy96Channel:v,excludedByLid:D}=k??{},q=h==null&&m===96&&v>0;if(o===c.ALL&&q)return{errors:[Xb()]};if(o===c.COLUMN&&q)return{errors:[Qb()]};if(D>0&&h==null)return{errors:[IT()]}}else h={tiprackId:u.tipRackId,well:u.tipWell};if(h==null)return{errors:[Zb()]};const _=(f?.displayCategory==="FLEX"||m===96)??!1;if(!f)return{errors:[ft({pipette:n})]};const b=t.labwareEntities[h.tiprackId]?.def,T=t.wasteChuteEntities[a]!=null,y=t.trashBinEntities[a]!=null;if(!b)return{errors:[mt({actionName:"replaceTip",labware:h.tiprackId})]};const I=r.tipState.pipettes[n]?.hasTip;if(!a||!T&&!y&&I)return{errors:[Cn()]};if(jn({pipette:n,labware:h.tiprackId,invariantContext:t,prevRobotState:r}))return{errors:[Aa()]};const w=Hn(h.tiprackId,r.labware);if(Yn(r.modules,w,_?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE))return{errors:[Oa()]};if(!_){if(Gn(r.modules,w))return{errors:[La()]};if(Wn(r.modules,w,f))return{errors:[Ra()]}}const E=l?O:R,A=[];m!==1&&e.nozzles!=null&&(e.nozzles!==p||h.tiprackId!==d)&&A.push(O(q_,{configurationParams:{primaryNozzle:s,style:e.nozzles},pipetteId:e.pipette}));const L=u?Lt:Tc;let S=[E(Gr,{pipette:n,dropTipLocation:a}),...A,E(po,{pipetteId:n,labwareId:h.tiprackId,wellName:h.well,nozzles:e.nozzles,tipTrackingOption:L,primaryNozzle:s})];return T&&(S=[E(kb,{pipetteId:e.pipette,wasteChuteId:t.wasteChuteEntities[e.dropTipLocation].id}),...A,E(po,{pipetteId:n,labwareId:h.tiprackId,wellName:h.well,nozzles:e.nozzles,tipTrackingOption:L,primaryNozzle:s})]),y&&(S=[E(vb,{pipetteId:n,trashLocation:t.trashBinEntities[e.dropTipLocation].location}),...A,E(po,{pipetteId:n,labwareId:h.tiprackId,wellName:h.well,nozzles:e.nozzles,tipTrackingOption:L,primaryNozzle:s})]),le(S,t,r)},Rh=(e=0)=>e>0?[R(be,{seconds:e})]:[],LA=e=>()=>{const{invariantContext:t,pipette:r,times:n,volume:a,aspirateDelaySeconds:o,dispenseDelaySeconds:s,finalPushOut:i,aspirateFlowRateUlSec:l,dispenseFlowRateUlSec:u,positionArgs:p}=e,{pipetteEntities:d,labwareEntities:f}=t,m=d[r].pythonName;let h=null;if(p!=null){const{labware:b,well:T,wellOrigin:y,xOffset:I,yOffset:w,zOffset:E}=p,A=f[b].pythonName,L={origin:y,offset:{x:I,y:w,z:E}};h=`location=${A}[${C(T)}]${Ht(L)}`}const _=[`repetitions=${n}`,`volume=${a}`,...h!=null?[h]:[],`aspirate_flow_rate=${l}`,`dispense_flow_rate=${u}`,...o!=null&&o!==0?[`aspirate_delay=${o}`]:[],...s!=null&&s!==0?[`dispense_delay=${s}`]:[],...i!=null?[`final_push_out=${i}`]:[]];return{commands:[],python:`${m}.mix(
129
- ${Y(_.join(`,
125
+ ${Q(t)}`:""}const lA=(e,t,r,n)=>{const{spec:a}=t,o=e===c.ROW,s=e===c.COLUMN||e===c.ALL&&a.channels===8,i=n.ordering[0].length===1;if(o&&i){const u=s?`H${r.slice(1)}`:`${r.charAt(0)}12`,p=a.nozzleMap[u],d=a.nozzleMap[r],f=p.map((_,y)=>_-d[y]),m=[f[0]/2,f[1]/2,0],h=d.map((_,y)=>_+m[y]);return{x:h[0],y:h[1],z:h[2]}}const l=a.nozzleMap[r];return{x:l[0],y:l[1],z:l[2]}},An={back_left:{x:-43.25,y:454.9,z:211.91},front_right:{x:128.75,y:402,z:211.91}},Oh={x:An.back_left.x,y:An.back_left.y,z:An.back_left.z},uA={x:An.front_right.x,y:An.front_right.y,z:An.front_right.z},cA=49.5,Tb=e=>{if(e.addressableArea?.areaType==="slot"){const t=`cutout${e.addressableArea?.id}`;if(t)return t}return null},pA=(e,t,r,n,a,o,s)=>{const{pipetteBoundingBoxOffsets:i}=e.spec,l=lA(o,e,a,n),u=i.backLeftCorner[0],p=i.frontRightCorner[0],d=i.backLeftCorner[1],f=i.frontRightCorner[1],m=r.x-(l.x-u),h=r.x+(p-l.x),_=r.y+(d-l.y),y=r.y-(l.y-f),T=(r.z??0)+t-s;return[{x:m,y:_,z:T},{x:h,y,z:T},{x:h,y:_,z:T},{x:m,y,z:T}]},Ib=(e,t)=>{const r=e[1].x<t[0].x,n=e[0].x>t[1].x,a=e[0].y<t[1].y,o=e[1].y>t[0].y;return!(r||n||a||o)},vh=(e,t)=>{if(t===c.FLEX_ROBOT_TYPE){const r=c.getDeckDefFromRobotType(t),{addressableAreas:n}=r.locations;return n.find(o=>o.id.includes(e))?.offsetFromCutoutFixture[2]??0}return c.getModuleDef(e).dimensions.bareOverallHeight},dA=e=>{const t=c.getDeckDefFromRobotType(e);return Object.values(t.cutoutFixtures).find(n=>c.WASTE_CHUTE_FIXTURES.includes(n.id))?.height??0},fA=(e,t,r,n)=>{const{modules:a,labware:o}=e,{moduleEntities:s,labwareEntities:i,wasteChuteEntities:l}=t;let u=0;const p=r?.addressableArea?.id;if(p){const d=$o(o,p),f=Object.keys(a).find(h=>a[h].slot===p);Object.values(l).find(h=>h.location===Tb(r))&&(u+=dA(n)),d.length>0?d.forEach(h=>{a[h]!=null&&(u+=vh(s[h].model,n)),o[h]!=null&&(u+=i[h].def.dimensions.zDimension)}):f!=null&&(u+=vh(s[f].model,n))}return u},mA=(e,t,r,n,a)=>{for(const o of t){const s=o.addressableArea?.boundingBox,i=o.position;if(i==null||s==null)continue;const l={x:i[0],y:s.yDimension+i[1],z:i[2]},u={x:i[0]+s.xDimension,y:i[1],z:i[2]};if(Ib([e[0],e[1]],[l,u])&&e[0].z!=null&&fA(r,n,o,a)>=e[0]?.z&&o.addressableArea!=null)return{addressableAreaCausingCollision:o.addressableArea}}return null},hA=(e,t)=>Object.values(t).find(r=>r.type===c.THERMOCYCLER_MODULE_TYPE)?Ib([Oh,uA],[e[0],e[1]])&&e[0].x<=Oh.z:!1,_A=(e,t,r,n)=>{const{wells:a}=e.def,o=a[t];return{x:o.x+r.x,y:o.y+r.y,z:n?o.z+(r.z??0):e.def.dimensions.zDimension}},_t=e=>{const{robotState:t,invariantContext:r,pipetteId:n,labwareId:a,wellLocationOffset:o={x:0,y:0,z:0},wellTargetName:s,primaryNozzle:i,nozzleConfiguration:l,tiprackId:u}=e,{pipetteEntities:p,labwareEntities:d,stagingAreaEntities:f,moduleEntities:m}=r,{labware:h,tipState:_}=t,y=p[n];if(y==null)return{isSafe:!0};const{spec:T}=y,{channels:b}=T,g=T?.displayCategory==="FLEX"?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE,L=c.getDeckDefFromRobotType(g);if(d[a]==null||s==null||b===1)return{isSafe:!0};const I=u?!0:_.pipettes[n]?.hasTip??!1,A=u??_.pipettes[n]?.tiprackURI,E=A!=null?d[A]:null,O=E!=null?E.def.parameters.tipLength:0,k=Object.values(f).map(N=>N.location),D=I?O??0:0,M=ee(h[a].stack),G=h[a].stack.some(N=>m[N]?.type===c.THERMOCYCLER_MODULE_TYPE),Y=c.getDeckDefFromRobotType(c.FLEX_ROBOT_TYPE),ae=(G?c.getPositionFromSlotId(c.B1_ADDRESSABLE_AREA,Y):c.getPositionFromSlotId(M,L))??[0,0,0],fe=G?Y.locations.addressableAreas.find(N=>N.id===c.THERMOCYCLER_MODULE_V2)?.offsetFromCutoutFixture??[0,0,0]:[0,0,0],J={x:fe[0]+ae[0],y:fe[1]+ae[1],z:fe[2]+ae[2]},{def:Re}=d[a],Ve=Sb({wellTargetName:s,primaryNozzle:i,nozzleConfiguration:l,specs:T,labwareDef:Re}),Me={x:o.x+Ve.x+J.x,y:o.y+Ve.y+J.y,z:(o.z??0)+(J.z??0)},je=_A(d[a],s,Me,I),ie=E!=null?yA({pipetteSpecs:T,tiprackUri:E.labwareDefURI,nozzles:l}):0,ke=d[a].def,Be=pA(y,D,je,ke,i,l,ie);if(!TA({channels:b,boundingBox:Be,robotType:g}))return{isSafe:!1,reason:{type:"outsidePipetteExtents"}};const K=(g===c.OT2_ROBOT_TYPE?c.getOt2SurroundingSlots(M):c.getFlexSurroundingSlots(M,k)).map(N=>{const B=c.getAddressableAreaFromSlotId(N,L),q=c.getPositionFromSlotId(N,L);return{addressableArea:B,position:q}});if(hA(Be,m))return{isSafe:!1,reason:{type:"thermocyclerLidCollision"}};const j=mA(Be,K,t,r,g);return j!=null?{isSafe:!1,reason:{type:"adjacentAdressableAreaCollision",addressableAreaCausingCollision:j.addressableAreaCausingCollision}}:{isSafe:!0}},Ip=e=>{const{tipState:t,primaryNozzle:r,channels:n,nozzleConfiguration:a,wellName:o,tiprackDef:s,tipsToIgnore:i=[]}=e,{ordering:l}=s;if(n===1)return{isSafe:!0,isComplete:t[o]!==_e};if(n===8){const u=r!==c.A1_NOZZLE,p=fc(o),d=l[p],f=u?[...d].reverse():d;if(a===c.SINGLE){const m=f.indexOf(o);return{isSafe:f.slice(m+1).every(h=>t[h]===_e||i.includes(h)),isComplete:t[o]!==_e}}if(a===c.PARTIAL_COLUMN){const m=f.indexOf(o),h=c.PARTIAL_NOZZLE_MAP[r],_=u?f.slice(m-h+1,m+1):f.slice(m,m+h);return{isSafe:f.slice(m+1).every(y=>t[y]===_e||i.includes(y)),isComplete:_.every(y=>t[y]!==_e&&!i.includes(y))}}return{isSafe:!0,isComplete:f.every(m=>t[m]!==_e)}}if(a===c.ALL)return{isSafe:!0,isComplete:Object.keys(s.wells).every(u=>t[u]!==_e)};if(a===c.COLUMN){const u=r===c.A12_NOZZLE,p=fc(o),d=l[p],f=u?[...l].reverse():l,m=f.indexOf(d);return{isSafe:f.slice(m+1).flat().every(h=>t[h]===_e||i.includes(h)),isComplete:f[m].every(h=>t[h]!==_e)}}if(a===c.ROW){const u=l[0].map((m,h)=>l.map(_=>_[h])),d=r===c.H1_NOZZLE?[...u].reverse():u,f=d.findIndex(m=>m.some(h=>h===o));return{isSafe:d.slice(f+1).flat().every(m=>t[m]===_e||i.includes(m)),isComplete:d[f].every(m=>t[m]!==_e)}}if(a===c.SINGLE){const u=Ln(r??To({nozzles:a,channels:n})),p=wp(r??To({nozzles:a,channels:n})),d=u==="H",m=p==="12"?[...l].reverse():l,h=m.findIndex(_=>_.some(y=>y===o));return{isSafe:m.slice(h).every(_=>{const y=d?[..._].reverse():_,T=y.findIndex(b=>Ln(b)===Ln(o));return y.slice(T).every(b=>t[b]===_e||i.includes(b)||b===o)}),isComplete:t[o]!==_e}}return{isSafe:!1}},Ln=e=>e.slice(0,1),wp=e=>e.slice(1),fc=e=>parseInt(e.slice(1))-1,To=e=>{const{nozzles:t,channels:r}=e;if(r===8&&t===c.SINGLE)return"H1";if(r===96){if(t===c.COLUMN)return"A12";if(t===c.SINGLE)return"H12"}return"A1"},eo=e=>{const{wellSets:t,nozzles:r,channels:n,primaryNozzle:a}=e;return r===c.ROW?t.map(o=>o[0]):t.map(o=>n===96&&r===c.ALL?a:r===c.COLUMN||n===8&&r===c.ALL||n===8&&r===c.PARTIAL_COLUMN?Ln(a)==="H"?o[o.length-1]:o[0]:(console.assert(o.length===1,"Well set for SINGLE nozzle configuration should have exactly 1 well"),o[0]))},yA=e=>{const{pipetteSpecs:t,tiprackUri:r,nozzles:n}=e,{channels:a}=t,o=bA(a,n),s=t.pickUpTipConfigurations.pressFit.configurationsByNozzleMap[o]?.default.tipOverlaps;if(s==null)return console.error(`No tip overlaps found for ${n} and ${o} overlap.`),0;const i=Math.max(...Object.keys(s).map(l=>Number(l.slice(1))));return s[`v${i}`]?.[r]??s[`v${i}`]?.default??0},bA=(e,t)=>{if(e===1)return"SingleA1";if(e===8)return t===c.SINGLE?"SingleH1":"Full";if(e===96){if(t===c.SINGLE)return"SingleH12";if(t===c.COLUMN)return"Column12";if(t===c.ROW)return"RowA"}return"Full"},TA=e=>{const{channels:t,boundingBox:r,robotType:n}=e,a=c.getRobotDefFromRobotType(n),{paddingOffsets:o}=a,{front:s,rear:i,leftSide:l,rightSide:u}=o,[p,d]=a.extents,[f,m]=r,{x:h,y:_}=f,{x:y,y:T}=m;if(t===96){if(y<l)return!1;const b=p+u;if(h>b)return!1}if(t!==1){if(_<s)return!1;const b=d+i;if(T>b)return!1}return!0},wb=e=>{const{channels:t,nozzleMap:r}=e;if(t===1)return 0;const[n,a]=["A1","B1"].map(s=>r[s][1]);return Math.abs(n-a)},Sb=e=>{const t=IA(e),r=wA(e);return{x:t,y:r}},IA=e=>{const{primaryNozzle:t,nozzleConfiguration:r,specs:n,labwareDef:a}=e,{channels:o}=n;if(o!==96)return 0;const{ordering:s}=a,i=s.length===1;if(!i)return 0;let l;const u=wp(t)==="12"?1:-1;if(r===c.ALL&&o===96||r===c.ROW)l=12;else if(r===c.QUADRANT)l=6;else return u*cA;const p=wb(n);return i?(l-1)*p/2*u:0},wA=e=>{const{wellTargetName:t,primaryNozzle:r,nozzleConfiguration:n,specs:a,labwareDef:o}=e,{channels:s}=a;if(s===1)return 0;const i=wb(a),{ordering:l}=o,u=l.findIndex(f=>f.includes(t));if(l[u].length!==1)return 0;if(n===c.PARTIAL_COLUMN){const m=-1*(8-c.PARTIAL_NOZZLE_MAP[r])*i,h=7*i/2;return m+h}const d=Ln(r)==="H"?-1:1;return 7*i/2*d};function gb(e){const t=e.length===1?e[0]:null;return t!=null&&"steps"in t?{numRepetitions:t.repetitions,repeatingProfileSteps:t.steps}:{numRepetitions:1,repeatingProfileSteps:Sp(e)}}function Sp(e){return e.flatMap(t=>"steps"in t?fy(t.steps,t.repetitions):t)}const SA=e=>{switch(e.commandCreatorFnName){case"consolidate":return P(Db,e);case"delay":return P(Te,e);case"waitForModuleTask":return P(zb,e);case"distribute":return P(Mb,e);case"transfer":return P(qb,e);case"mix":return P(Cb,e);case"moveLabware":return P(G_,e);case"captureImage":return P(U_,e);case"engageMagnet":return P(x_,e);case"disengageMagnet":return P(B_,e);case"setTemperature":return P(Hc,e);case"deactivateTemperature":return P(V_,e);case"waitForTemperature":return P(Yc,e);case"thermocyclerProfile":return P(Ub,e);case"thermocyclerState":return P($b,e);case"heaterShaker":return P(Fb,e);case"comment":return P($_,e);case"absorbanceReaderOpenLid":return P(M_,e);case"absorbanceReaderCloseLid":return P(No,e);case"absorbanceReaderRead":return P(Ob,e);case"absorbanceReaderInitialize":return P(Lb,e);case"flexStackerEmpty":return P(H_,{...e,strategy:"manualWithPause"});case"flexStackerFillItems":return P(z_,e);case"flexStackerRetrieve":return P(j_,e);case"flexStackerStore":return P(W_,{...e,strategy:"automatic"});case"vacuumCloseVent":return P(xa,e);case"vacuumOpenVent":return P(K_,e);case"vacuumSetPumpPower":return P(jc,e);case"vacuumSetPumpPressure":return P(Wc,e);case"vacuumStartRunProfile":return P(Gc,e);case"vacuumStopPump":return P(Q_,e);case"vacuumCloseVentSetPumpPressure":return P(Bb,e);case"vacuumCloseVentSetPumpPower":return P(Vb,e);case"vacuumCloseVentStartProfile":return P(xb,e);case"airGapInPlace":return P(vt,e);case"aspirate":return P(vt,e);case"aspirateInPlace":return P(Ba,e);case"aspirateWhileTracking":return P(kw,e);case"blowOutInPlace":return P(Bn,e);case"blowout":return P(Vc,e);case"configureForVolume":return P(kn,e);case"configureNozzleLayout":return P(q_,e);case"dispense":return P(Bc,e);case"dispenseInPlace":return P(Je,e);case"dispenseWhileTracking":return P(Nw,e);case"dropTip":return P(Yr,e);case"dropTipInPlace":return P(Co,e);case"home":return P(Cw,e);case"moveRelative":return P(Dw,e);case"moveToAddressableArea":return P(qe,e);case"moveToAddressableAreaForDropTip":return P(xc,e);case"moveToCoordinates":return P(Mw,e);case"moveToWell":return P(z,e);case"pickUpTip":return P(mo,e);case"prepareToAspirate":return P(Pt,e);case"touchTip":return P(At,e);case"tryLiquidProbe":return P(Fw,e);case"heaterShaker/closeLabwareLatch":return P(J_,e);case"heaterShaker/openLabwareLatch":return P(ey,e);case"heaterShaker/setAndWaitForShakeSpeed":return P(ty,e);case"heaterShaker/deactivateHeater":return P(tc,e);case"heaterShaker/deactivateShaker":return P(rc,e);case"thermocycler/closeLid":return P(Kc,e);case"thermocycler/openLid":return P(ay,e);case"thermocycler/deactivateBlock":return P(ry,e);case"thermocycler/deactivateLid":return P(ny,e);case"thermocycler/setTargetBlockTemperature":return P(oy,e);case"thermocycler/setTargetLidTemperature":return P(Zc,e);case"thermocycler/startRunExtendedProfile":return P(Y_,e)}},$=QT;function Eb(e){return Object.keys(e).sort((r,n)=>{const a=ee(e[r].stack),o=ee(e[n].stack),s=parseInt(a),i=parseInt(o);return De.includes(a)&&De.includes(o)?r.localeCompare(n):De.includes(a)?1:De.includes(o)?-1:s-i})}function Ab(e){const{pipetteId:t,tiprackId:r,invariantContext:n,robotState:a,nozzles:o,primaryNozzle:s}=e,i=n.pipetteEntities[t]?.spec?.channels,l=n.labwareEntities[r]?.def,u=a.tipState.tipracks[r];if(!i||!l||!u)return console.assert(!1,`Pipette ${t} missing channels/spec or tiprack definition`),null;const p=E=>u[E]===Fa,d=c.orderWells(l.ordering,"t2b","l2r"),f=c.orderWells(l.ordering,"b2t","l2r"),m=E=>E.find(p)??null,h=E=>[...E].reverse().find(p)??null,_=E=>E.find(O=>O.every(p))??null,y=E=>[...E].reverse().find(O=>O.every(p))??null,T=i===8&&o===c.SINGLE,b=T&&s===c.H1_NOZZLE,w=T&&s===c.A1_NOZZLE,S=i===96&&o===c.SINGLE,g=S&&s===c.H12_NOZZLE,L=S&&s===c.A12_NOZZLE,I=S&&s===c.H1_NOZZLE,A=S&&s===c.A1_NOZZLE;if(i===1||b||g)return m(d);if(w)return m(f);if(o===c.PARTIAL_COLUMN){const E=m(d);if(!E)return null;const O=d.indexOf(E);return d[O]??null}if(o===c.ALL&&i===8)return _(l.ordering)?.[0]??null;if(A)return h(d);if(L)return m(f);if(I)return h(f);if(o===c.COLUMN){const E=l.ordering;return(s===c.A1_NOZZLE?y(E):_(E))?.[0]??null}if(o===c.ROW){const E=l.ordering,O=E[0].map((D,M)=>E.map(G=>G[M]));return(s===c.A1_NOZZLE?y(O):_(O))?.[0]??null}return o===c.ALL&&i===96?d.every(p)?d[0]:null:(console.assert(!1,`Unhandled _getNextTip case for pipette ${t}`),null)}function to(e,t,r,n,a,o){const s=r.pipetteEntities[e];if(!s)throw new Error(`cannot getNextTiprack, no pipette entity for pipette "${e}"`);const i=[],l=Eb(n.labware).filter(h=>{console.assert(r.labwareEntities[h]?.labwareDefURI!=null,`cannot getNextTiprack, no labware entity for "${h}"`);const _=ee(n.labware[h].stack),y=Ly(_),T=Ay({labwareId:h,labwareRobotState:n.labware,labwareEntities:r.labwareEntities});if(y&&T&&c.getIsTiprack(r.labwareEntities[h].def))return i.push(h),!1;const b=r.labwareEntities[h].labwareDefURI;return y&&b===t});let u=l;const p=s.spec.channels===96,d=[];p&&(u=u.filter(h=>{const _=n.labware[h].stack[1],y=r.labwareEntities[_],T=y?.def.parameters.loadName==="opentrons_flex_96_tiprack_adapter"&&c.getLabwareDefIsStandard(y?.def),b=o===c.ALL?T:!T;return b||d.push(h),b}));let f=null,m=null;for(const h of u){const _=Ab({pipetteId:e,tiprackId:h,nozzles:o,invariantContext:r,robotState:n,primaryNozzle:a}),{isSafe:y}=_!=null?_t({robotState:n,invariantContext:r,pipetteId:e,labwareId:h,wellTargetName:_,primaryNozzle:a,nozzleConfiguration:o}):{isSafe:!1},{isSafe:T,isComplete:b=!1}=_!=null?Ip({tipState:n.tipState.tipracks[h],primaryNozzle:a,channels:s.spec.channels,nozzleConfiguration:o,wellName:_,tiprackDef:r.labwareEntities[h].def}):{isSafe:!1};if(_&&y&&T&&b){f=h,m=_;break}}return f&&m?{nextTiprack:{tiprackId:f,well:m},tipracks:{totalTipracks:l.length,excludedBy96Channel:d.length,excludedByLid:i.length,filteredSortedTiprackIds:u}}:{nextTiprack:null,tipracks:{totalTipracks:l.length,excludedBy96Channel:d.length,excludedByLid:i.length,filteredSortedTiprackIds:u}}}function Go(e,t,r){const n=t.pipetteEntities[e],a=n.spec.liquids.default.maxVolume,o=n.tiprackLabwareDef;let s=null;for(const l of o)if(c.getLabwareDefURI(l)===r){s=l;break}const i=c.getTiprackVolume(s??o[0]);return!a||!i?(console.assert(!1,`getPipetteEffectiveMaxVol expected tiprackMaxVol and pipette maxVolume to be > 0, got',
126
+ ${a}, ${i}`),NaN):DT([i,a])??NaN}function Rt(e,t){return t in e.modules||console.warn(`getModuleState expected module id "${t}" to be in robot state`),e.modules[t]?.moduleState}const Yo=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.THERMOCYCLER_MODULE_TYPE?r:null},Xn=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.ABSORBANCE_READER_TYPE?r:null},yt=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.FLEX_STACKER_MODULE_TYPE?r:null},ct=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.VACUUM_MODULE_TYPE?r:null},Lb=(e,t,r)=>{const{moduleId:n,measureMode:a,sampleWavelengths:o,referenceWavelength:s}=e,i=Xn(r,n),l=[];if(i==null&&l.push(pe()),l.length>0)return{errors:l};const u=[P(No,{moduleId:n}),P(D_,{moduleId:n,measureMode:a,sampleWavelengths:o,referenceWavelength:s??void 0})];return de(u,t,r)},Ob=(e,t,r)=>{const n=[],a=Xn(r,e.moduleId);if((a==null||e.moduleId==null)&&n.push(pe()),a?.initialization==null&&n.push(sT()),n.length>0)return{errors:n};const{moduleId:o,fileName:s}=e,i=[P(No,{moduleId:o}),P(F_,{moduleId:o,fileName:s})];return de(i,t,r)},gA=(e,t,r)=>{const{pipetteId:n,trashId:a,flowRate:o,volume:s}=e,i=[P(qe,{pipetteId:n,fixtureId:a,offset:Lt}),R(Pt,{pipetteId:n}),P(vt,{pipetteId:n,volume:s,flowRate:o})];return de(i,t,r)},EA=(e,t,r)=>{const{pipetteId:n,volume:a,flowRate:o,wasteChuteId:s}=e,i=[P(qe,{pipetteId:n,fixtureId:s,offset:Lt}),R(Pt,{pipetteId:n}),P(vt,{pipetteId:n,flowRate:o,volume:a})];return de(i,t,r)},AA=(e,t,r)=>{const{labwareId:n,wellName:a,flowRate:o,pipetteId:s,volume:i,type:l}=e,u=t.pipetteEntities[s].pythonName,p=l==="aspirate"?[]:[R(Pt,{pipetteId:s})],d=()=>({commands:[],python:`${u}.air_gap(${[`volume=${i}`,`height=${Xu}`,`flow_rate=${o}`].join(", ")})`}),f=[R(z,{pipetteId:s,labwareId:n,wellName:a,wellLocation:{origin:"top",offset:{z:Xu,x:0,y:0}}}),...p,R(vt,{pipetteId:s,volume:i,flowRate:o}),d];return de(f,t,r)},vb=(e,t,r)=>{const{pipetteId:n,trashId:a,flowRate:o}=e,{pipetteEntities:s,trashBinEntities:i}=t,l=s[n].pythonName,u=i[a].pythonName,p=()=>({commands:[],python:`${l}.flow_rate.blow_out = ${o}
127
+ ${l}.blow_out(${u})`}),d=[R(qe,{pipetteId:n,fixtureId:a,offset:Lt}),R(Bn,{pipetteId:n,flowRate:o}),p];return de(d,t,r)},Pb=(e,t,r)=>{const{pipetteId:n,flowRate:a,wasteChuteId:o}=e,{pipetteEntities:s,wasteChuteEntities:i}=t,l=s[n].pythonName,u=i[o].pythonName,p=()=>({commands:[],python:`${l}.flow_rate.blow_out = ${a}
128
+ ${l}.blow_out(${u})`}),d=[R(qe,{pipetteId:n,fixtureId:o,offset:Lt}),R(Bn,{pipetteId:n,flowRate:a}),p];return de(d,t,r)};var zu,Ph;function LA(){if(Ph)return zu;Ph=1;var e=C_();function t(r){var n=e(r),a=n%1;return n===n?a?n-a:n:0}return zu=t,zu}var ju,Rh;function OA(){if(Rh)return ju;Rh=1;var e=$y(),t=qc(),r=LA(),n=Math.ceil,a=Math.max;function o(s,i,l){(l?t(s,i,l):i===void 0)?i=1:i=a(r(i),0);var u=s==null?0:s.length;if(!u||i<1)return[];for(var p=0,d=0,f=Array(n(u/i));p<u;)f[d++]=e(s,p,p+=i);return f}return ju=o,ju}var vA=OA();const Rb=Ge(vA),ar=e=>{const{labwareDef:t,wells:r,primaryNozzle:n}=e,a=c.PARTIAL_NOZZLE_MAP[n]-1,{ordering:o,parameters:s}=t;return r.map(i=>{const l=o.find(p=>p.includes(i));if(l==null)return console.warn(`Could not find column for ${i} in ${s.loadName}`),i;if(l.length===1)return i;const u=l.indexOf(i);return u===-1?(console.warn(`Could not find column index of ${i}`),i):l[u+a]})},kb=(e,t,r)=>{const{pipetteId:n,trashLocation:a}=e;let o=[];const s=Xc(a);if(r.tipState.pipettes[n]?.hasTip){const i=t.pipetteEntities[n].pythonName,l=()=>({commands:[],python:`${i}.drop_tip()`});o=[R(xc,{pipetteId:n,addressableAreaName:s}),R(Co,{pipetteId:n}),l]}return de(o,t,r)},Nb=(e,t,r)=>{const n=Lt,{pipetteId:a,wasteChuteId:o}=e,{pipetteEntities:s,wasteChuteEntities:i}=t;let l=[];if(!r.tipState.pipettes[a].hasTip)l=[];else{const u=s[a].pythonName,p=i[o].pythonName,d=()=>({commands:[],python:`${u}.drop_tip(${p})`});l=[R(qe,{pipetteId:a,fixtureId:o,offset:n}),R(Co,{pipetteId:a}),d]}return de(l,t,r)},ro=(e,t,r)=>{const{pipette:n,dropTipLocation:a,nozzles:o,primaryNozzle:s,tipRack:i,isFromMixCommand:l=!1,tipSelectionArgs:u}=e,p=r.pipettes[n].nozzles,d=r.pipettes[n].tiprackId,f=t.pipetteEntities[n]?.spec,m=f?.channels;let h=null;if(u==null){if(i==null)return{errors:[hT()]};const E=to(n,i,t,r,s,o);h=E.nextTiprack;const O=E.tipracks,{excludedBy96Channel:k,excludedByLid:D}=O??{},M=h==null&&m===96&&k>0;if(o===c.ALL&&M)return{errors:[Jb()]};if(o===c.COLUMN&&M)return{errors:[eT()]};if(D>0&&h==null)return{errors:[ST()]}}else h={tiprackId:u.tipRackId,well:u.tipWell};if(h==null)return{errors:[Qb()]};const _=(f?.displayCategory==="FLEX"||m===96)??!1;if(!f)return{errors:[mt({pipette:n})]};const y=t.labwareEntities[h.tiprackId]?.def,T=t.wasteChuteEntities[a]!=null,b=t.trashBinEntities[a]!=null;if(!y)return{errors:[ht({actionName:"replaceTip",labware:h.tiprackId})]};const w=r.tipState.pipettes[n]?.hasTip;if(!a||!T&&!b&&w)return{errors:[Mn()]};if(Gn({pipette:n,labware:h.tiprackId,invariantContext:t,prevRobotState:r}))return{errors:[Oa()]};const S=jn(h.tiprackId,r.labware);if(Zn(r.modules,S,_?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE))return{errors:[Pa()]};if(!_){if(Yn(r.modules,S))return{errors:[va()]};if(Kn(r.modules,S,f))return{errors:[Ra()]}}const g=l?P:R,L=[];m!==1&&e.nozzles!=null&&(e.nozzles!==p||h.tiprackId!==d)&&L.push(P(q_,{configurationParams:{primaryNozzle:s,style:e.nozzles},pipetteId:e.pipette}));const I=u?Ot:Ic;let A=[g(Yr,{pipette:n,dropTipLocation:a}),...L,g(mo,{pipetteId:n,labwareId:h.tiprackId,wellName:h.well,nozzles:e.nozzles,tipTrackingOption:I,primaryNozzle:s})];return T&&(A=[g(Nb,{pipetteId:e.pipette,wasteChuteId:t.wasteChuteEntities[e.dropTipLocation].id}),...L,g(mo,{pipetteId:n,labwareId:h.tiprackId,wellName:h.well,nozzles:e.nozzles,tipTrackingOption:I,primaryNozzle:s})]),b&&(A=[g(kb,{pipetteId:n,trashLocation:t.trashBinEntities[e.dropTipLocation].location}),...L,g(mo,{pipetteId:n,labwareId:h.tiprackId,wellName:h.well,nozzles:e.nozzles,tipTrackingOption:I,primaryNozzle:s})]),de(A,t,r)},kh=(e=0)=>e>0?[R(Te,{seconds:e})]:[],PA=e=>()=>{const{invariantContext:t,pipette:r,times:n,volume:a,aspirateDelaySeconds:o,dispenseDelaySeconds:s,finalPushOut:i,aspirateFlowRateUlSec:l,dispenseFlowRateUlSec:u,positionArgs:p}=e,{pipetteEntities:d,labwareEntities:f}=t,m=d[r].pythonName;let h=null;if(p!=null){const{labware:y,well:T,wellOrigin:b,xOffset:w,yOffset:S,zOffset:g}=p,L=f[y].pythonName,I={origin:b,offset:{x:w,y:S,z:g}};h=`location=${L}[${F(T)}]${zt(I)}`}const _=[`repetitions=${n}`,`volume=${a}`,...h!=null?[h]:[],`aspirate_flow_rate=${l}`,`dispense_flow_rate=${u}`,...o!=null&&o!==0?[`aspirate_delay=${o}`]:[],...s!=null&&s!==0?[`dispense_delay=${s}`]:[],...i!=null?[`final_push_out=${i}`]:[]];return{commands:[],python:`${m}.mix(
129
+ ${Q(_.join(`,
130
130
  `))},
131
- )`}},Ur=e=>{const{pipette:t,volume:r,times:n,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:o,aspirateDelaySeconds:s=0,dispenseDelaySeconds:i=0,finalPushOut:l,invariantContext:u,liquidClass:p,tiprack:d,moveToWellParams:f,generatePython:m}=e,h=LA({invariantContext:u,pipette:t,volume:r,times:n,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:o,aspirateDelaySeconds:s,dispenseDelaySeconds:i,finalPushOut:l,positionArgs:f!=null?{labware:f.labwareId,well:f.wellName,wellOrigin:f.wellLocation?.origin??c.WELL_ORIGIN_BOTTOM,xOffset:f.wellLocation?.offset?.x??0,yOffset:f.wellLocation?.offset?.y??0,zOffset:f.wellLocation?.offset?.z??0}:void 0}),_=u.pipetteEntities[t].spec,b=c.getByVolumeValue({liquidClass:p,pipetteSpecs:_,tiprackDefUri:d,targetVolume:r,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,T=c.getByVolumeValue({liquidClass:p,pipetteSpecs:_,tiprackDefUri:d,targetVolume:r,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,I=f!=null?[R(x,{...f,wellLocation:{...f.wellLocation}})]:[];for(let w=0;w<n;w++)I.push(R(Va,{pipetteId:t,volume:r,flowRate:a,...b>0?{correctionVolume:b}:{}}),...Rh(s),R(Je,{pipetteId:t,volume:r,flowRate:o,...w<n-1?{pushOut:0}:l==null?{}:{pushOut:l},...T>0?{correctionVolume:T}:{}}),...Rh(i));return[...I,...m?[h]:[]]},Pb=(e,t,r)=>{const{pipette:a,labware:o,wells:s,volume:i,times:l,changeTip:u,aspirateFlowRateUlSec:p,dispenseFlowRateUlSec:d,blowoutFlowRateUlSec:f,blowoutOffsetFromTopMm:m,dropTipLocation:h,tipRack:_,positionReference:b,xOffset:T,yOffset:y,zOffset:I,finalPushOut:w,nozzles:E,primaryNozzle:A,tipsSelected:L,tiprackSelected:S,tipTracking:g}=e,k=e.aspirateDelaySeconds??0,v=e.dispenseDelaySeconds??0,D=t.pipetteEntities[a]?.spec.channels!==1;if(r.pipettes[a]==null||t.pipetteEntities[a]==null)return{errors:[ft({pipette:a})]};if(r.labware[o]==null)return{errors:[mt({actionName:"mix",labware:o})]};const q=K(r.labware[o]?.stack);if(Object.keys(t.wasteChuteEntities).length>0&&q===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)return{errors:[va()]};const fe=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],_e=fe.length>0?fe[0]:null,ne=Object.values(t.labwareEntities).find(({labwareDefURI:Z})=>Z===h),Te=ne!=null&&c.getIsTiprack(ne.def),Oe=t.wasteChuteEntities[h]!=null,Be=t.trashBinEntities[h]!=null,Me=r.pipettes[a]?.tipWell!=null;if(h==null||Te&&_e==null&&u!=="never"&&Me||!Te&&!Oe&&!Be)return{errors:[Cn()]};if(D){const Z=ht({robotState:r,invariantContext:t,pipetteId:a,labwareId:o,wellLocationOffset:{x:T,y},wellTargetName:s[0],primaryNozzle:A,nozzleConfiguration:E});if(!Z.isSafe)return{errors:[Bt({unsafePipetteMovementReason:Z.reason})]};const N=ht({robotState:r,invariantContext:t,pipetteId:a,labwareId:o,wellLocationOffset:{x:T,y},wellTargetName:s[0],primaryNozzle:A,nozzleConfiguration:E});if(!N.isSafe)return{errors:[Bt({unsafePipetteMovementReason:N.reason})]}}const ae=c.LOW_VOLUME_PIPETTES.includes(t.pipetteEntities[a].name),Re=ae?[O(Rn,{pipetteId:a,volume:i})]:[],We=t.pipetteEntities[a].spec,Ae=g===Lt&&S!=null&&L!=null&&L.length>0?Qa({wellSets:L,nozzles:E,channels:We.channels,primaryNozzle:A}):null,J=On(s,(Z,N)=>{let P=[];if(u==="always"||u==="once"&&N===0){const me=Ae?.shift();P=[O(eo,{pipette:a,primaryNozzle:A,dropTipLocation:Te&&_e!=null?_e:h,tipRack:_,nozzles:E,...g===Lt&&me!=null&&S!=null?{tipSelectionArgs:{tipRackId:S,tipWell:me}}:{},isFromMixCommand:!0})]}const $=ae||e.blowoutLocation!=null&&N>0?[O(Rt,{pipetteId:a})]:[],F=e.touchTip?[O(St,{pipetteId:a,labwareId:o,wellName:Z,zOffsetFromTop:e.touchTipMmFromTop})]:[],ue=dy({pipette:e.pipette,sourceLabwareId:e.labware,sourceWell:Z,destLabwareId:e.labware,destWell:Z,blowoutLocation:e.blowoutLocation,flowRate:f,offsetFromTopMm:m,invariantContext:t}),z=[...Object.keys(t.wasteChuteEntities),...Object.keys(t.trashBinEntities)].some(me=>me===e.blowoutLocation)?[...F,...ue]:[...ue,...F],U=Te&&(N===s.length-1||u==="always")?[O(Gr,{pipette:a,dropTipLocation:_,isReturnTip:Te})]:[],j=Ur({pipette:a,volume:i,times:l,aspirateFlowRateUlSec:p,dispenseFlowRateUlSec:d,invariantContext:t,liquidClass:null,tiprack:_,finalPushOut:w,aspirateDelaySeconds:k,dispenseDelaySeconds:v,moveToWellParams:{pipetteId:a,labwareId:o,wellName:Z,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[b],offset:{x:T,y,z:I}}},generatePython:!0});return[...P,...Re,...$,...j,...z,...U]});return le(J,t,r)},Nb=(e,t,r)=>{const{aspirateDelay:n,aspirateFlowRateUlSec:a,aspiratePositionReference:o,aspirateRetractDelay:s,aspirateRetractPositionReference:i,aspirateRetractSpeed:l,aspirateRetractXOffset:u,aspirateRetractYOffset:p,aspirateRetractZOffset:d,aspirateSubmergeDelay:f,aspirateSubmergePositionReference:m,aspirateSubmergeSpeed:h,aspirateSubmergeXOffset:_,aspirateSubmergeYOffset:b,aspirateSubmergeZOffset:T,aspirateXOffset:y,aspirateYOffset:I,aspirateZOffset:w,blowoutFlowRateUlSec:E,blowoutLocation:A,changeTip:L,destLabware:S,destWell:g,dispenseDelay:k,dispenseFlowRateUlSec:v,dispensePositionReference:D,dispenseRetractPositionReference:q,dispenseRetractXOffset:Q,dispenseRetractYOffset:fe,dispenseRetractZOffset:_e,dispenseSubmergeDelay:ne,dispenseSubmergePositionReference:Te,dispenseSubmergeSpeed:Oe,dispenseSubmergeXOffset:Be,dispenseSubmergeYOffset:Me,dispenseSubmergeZOffset:ae,dispenseXOffset:Re,dispenseYOffset:We,dispenseZOffset:Fe,dropTipLocation:Ae,liquidClass:J,mixInDestination:Z,nozzles:N,pipette:P,primaryNozzle:$,pushOut:F,sourceLabware:ue,sourceWells:V,tipRack:G,tipTracking:z,tiprackSelected:U,tipsSelected:j,touchTipAfterAspirate:me,touchTipAfterAspirateMmFromEdge:xe,touchTipAfterAspirateOffsetMmFromTop:rt,touchTipAfterAspirateSpeed:je,touchTipAfterDispense:he,touchTipAfterDispenseMmFromEdge:nt,touchTipAfterDispenseOffsetMmFromTop:yt,touchTipAfterDispenseSpeed:kt,stepNumber:bt,volume:Ne}=e,{pipetteEntities:at,labwareEntities:Se,trashBinEntities:Ce,wasteChuteEntities:Ue}=t,oe="consolidate",se=[],Pt=r.pipettes[P],Ke=at[P]?.spec.channels!==1,X=e.aspirateAirGapVolume??0,Ie=e.dispenseAirGapVolume??0;Pt==null&&se.push(ft({pipette:P})),(S==null||Se[S]==null&&Ce[S]==null&&Ue[S]==null)&&se.push(qh());const Tr=K(r.labware[S]?.stack),ot=K(r.labware[ue]?.stack);Object.keys(Ue).length>0&&(Tr===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA||ot===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)&&se.push(va());const Ee=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],st=Ee.length>0?Ee[0]:null,Zr=Object.values(t.labwareEntities).find(({labwareDefURI:ge})=>ge===Ae),Nt=Zr!=null&&c.getIsTiprack(Zr.def),to=t.wasteChuteEntities[Ae]!=null,Xr=t.trashBinEntities[Ae]!=null,lr=r.tipState.pipettes[P]?.hasTip;(Ae==null||Nt&&st==null&&L!=="never"&&lr||!Nt&&!to&&!Xr)&&se.push(Cn());let Ze,te;if(L==="never"){const ge=r.tipState.pipettes[P]?.tiprackURI;Ze=t.labwareEntities[ge??""],te=Ze?.labwareDefURI}else Ze=Object.values(Se).find(({labwareDefURI:ge})=>ge===G),te=G;Ze==null&&(L==="never"?se.push(zt({actionName:oe,pipette:P})):se.push(mt({actionName:oe,labware:te})));const{def:Ct=null}=Ze??{},{spec:Le,name:ct,pythonName:ee}=at[P],W=c.getAllLiquidClassDefs()[J===c.NONE_LIQUID_CLASS_NAME||J==null?c.WATER_LIQUID_CLASS_NAME:J].byPipette?.find(({pipetteModel:ge})=>ge===c.getFlexNameConversion(Le))?.byTipType.find(({tiprack:ge})=>ge===te)??null,{aspirate:pt}=W??{},{multiWellHandling:ye}=Jc({pipetteSpecs:Le,tiprackDefinition:Ct,volume:Ne,path:"multiAspirate",numAspirateWells:V.length,numDispenseWells:1,aspirateAirGapByVolume:pt?.retract.airGapByVolume??[],conditioningByVolume:null,disposalByVolume:null}),{numWellsToFitInTip:it}=ye;if((!ye.isSupported||it==null||it===1)&&se.push(_T()),Ke&&N!==c.ALL){const ge=ht({robotState:r,invariantContext:t,pipetteId:P,labwareId:ue,wellLocationOffset:{x:y,y:I},primaryNozzle:$,nozzleConfiguration:N});ge.isSafe||se.push(Bt({unsafePipetteMovementReason:ge.reason}));const ce=ht({robotState:r,invariantContext:t,pipetteId:P,labwareId:S,wellLocationOffset:{x:Re,y:We},primaryNozzle:$,nozzleConfiguration:N});ce.isSafe||se.push(Bt({unsafePipetteMovementReason:ce.reason}))}const Gt=g!=null?Se[ue]?.def.wells[g]?.depth:null,Dt=c.getMmFromBottom(Fe,D,Gt),Qr=c.getMmFromBottom(ae,Te,Gt),ur=c.getMmFromBottom(_e,q,Gt);if(Dt!=null&&Qr!=null&&Dt>Qr&&se.push(mT()),Dt!=null&&ur!=null&&Dt>ur&&se.push(hT()),se.length>0)return{errors:se};const{tipracks:Ir}=Ja(P,te,t,r,$,N),cr=c.getByVolumeValue({liquidClass:J,pipetteSpecs:Le,tiprackDefUri:te,targetVolume:Ne,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,ve=Ce[S]?.pythonName??Ue[S]?.pythonName,Mt=Ce[Ae]?.pythonName??Ue[Ae]?.pythonName,Er=A==null?null:Ce[A]?.pythonName??Ue[A]?.pythonName,gr=Se[ue].pythonName,Jr=Se[S]?.pythonName,wr=N===c.PARTIAL_COLUMN?nr({labwareDef:Se[ue].def,wells:V,primaryNozzle:$}):V,en=(N===c.PARTIAL_COLUMN&&g!=null&&Se[S]!=null?nr({labwareDef:Se[S].def,wells:[g],primaryNozzle:$}):[g])[0],tn=wr.map(ge=>`${gr}[${C(ge)}]`).join(", "),rn=en!=null&&Jr!=null?`${Jr}[${C(en)}]`:null,nn=[`name=${C(`${e.commandCreatorFnName}_step_${bt}`)}`,...J!=null?[`base_liquid_class=${Xa(J,!0)}`]:[],`properties=${zo({args:e,pipetteName:c.isFlexPipette(ct)?c.getFlexNameConversion(Le):ct,tiprackUri:te,liquidClassValuesForTip:W})}`],Xn=`${we}.define_liquid_class(
132
- ${Y(nn.join(`,
131
+ )`}},$r=e=>{const{pipette:t,volume:r,times:n,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:o,aspirateDelaySeconds:s=0,dispenseDelaySeconds:i=0,finalPushOut:l,invariantContext:u,liquidClass:p,tiprack:d,moveToWellParams:f,generatePython:m}=e,h=PA({invariantContext:u,pipette:t,volume:r,times:n,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:o,aspirateDelaySeconds:s,dispenseDelaySeconds:i,finalPushOut:l,positionArgs:f!=null?{labware:f.labwareId,well:f.wellName,wellOrigin:f.wellLocation?.origin??c.WELL_ORIGIN_BOTTOM,xOffset:f.wellLocation?.offset?.x??0,yOffset:f.wellLocation?.offset?.y??0,zOffset:f.wellLocation?.offset?.z??0}:void 0}),_=u.pipetteEntities[t].spec,y=c.getByVolumeValue({liquidClass:p,pipetteSpecs:_,tiprackDefUri:d,targetVolume:r,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,T=c.getByVolumeValue({liquidClass:p,pipetteSpecs:_,tiprackDefUri:d,targetVolume:r,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,w=f!=null?[R(z,{...f,wellLocation:{...f.wellLocation}})]:[];for(let S=0;S<n;S++)w.push(R(Ba,{pipetteId:t,volume:r,flowRate:a,...y>0?{correctionVolume:y}:{}}),...kh(s),R(Je,{pipetteId:t,volume:r,flowRate:o,...S<n-1?{pushOut:0}:l==null?{}:{pushOut:l},...T>0?{correctionVolume:T}:{}}),...kh(i));return[...w,...m?[h]:[]]},Cb=(e,t,r)=>{const{pipette:a,labware:o,wells:s,volume:i,times:l,changeTip:u,aspirateFlowRateUlSec:p,dispenseFlowRateUlSec:d,blowoutFlowRateUlSec:f,blowoutOffsetFromTopMm:m,dropTipLocation:h,tipRack:_,positionReference:y,xOffset:T,yOffset:b,zOffset:w,finalPushOut:S,nozzles:g,primaryNozzle:L,tipsSelected:I,tiprackSelected:A,tipTracking:E}=e,O=e.aspirateDelaySeconds??0,k=e.dispenseDelaySeconds??0,D=t.pipetteEntities[a]?.spec.channels!==1;if(r.pipettes[a]==null||t.pipetteEntities[a]==null)return{errors:[mt({pipette:a})]};if(r.labware[o]==null)return{errors:[ht({actionName:"mix",labware:o})]};const M=ee(r.labware[o]?.stack);if(Object.keys(t.wasteChuteEntities).length>0&&M===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)return{errors:[ka()]};const Y=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],ae=Y.length>0?Y[0]:null,fe=Object.values(t.labwareEntities).find(({labwareDefURI:K})=>K===h),J=fe!=null&&c.getIsTiprack(fe.def),Re=t.wasteChuteEntities[h]!=null,Ve=t.trashBinEntities[h]!=null,Me=r.pipettes[a]?.tipWell!=null;if(h==null||J&&ae==null&&u!=="never"&&Me||!J&&!Re&&!Ve)return{errors:[Mn()]};if(D){const K=_t({robotState:r,invariantContext:t,pipetteId:a,labwareId:o,wellLocationOffset:{x:T,y:b},wellTargetName:s[0],primaryNozzle:L,nozzleConfiguration:g});if(!K.isSafe)return{errors:[xt({unsafePipetteMovementReason:K.reason})]};const j=_t({robotState:r,invariantContext:t,pipetteId:a,labwareId:o,wellLocationOffset:{x:T,y:b},wellTargetName:s[0],primaryNozzle:L,nozzleConfiguration:g});if(!j.isSafe)return{errors:[xt({unsafePipetteMovementReason:j.reason})]}}const je=c.LOW_VOLUME_PIPETTES.includes(t.pipetteEntities[a].name),ie=je?[P(kn,{pipetteId:a,volume:i})]:[],ke=t.pipetteEntities[a].spec,Ae=E===Ot&&A!=null&&I!=null&&I.length>0?eo({wellSets:I,nozzles:g,channels:ke.channels,primaryNozzle:L}):null,oe=Rn(s,(K,j)=>{let N=[];if(u==="always"||u==="once"&&j===0){const le=Ae?.shift();N=[P(ro,{pipette:a,primaryNozzle:L,dropTipLocation:J&&ae!=null?ae:h,tipRack:_,nozzles:g,...E===Ot&&le!=null&&A!=null?{tipSelectionArgs:{tipRackId:A,tipWell:le}}:{},isFromMixCommand:!0})]}const B=je||e.blowoutLocation!=null&&j>0?[P(Pt,{pipetteId:a})]:[],q=e.touchTip?[P(At,{pipetteId:a,labwareId:o,wellName:K,zOffsetFromTop:e.touchTipMmFromTop})]:[],re=my({pipette:e.pipette,sourceLabwareId:e.labware,sourceWell:K,destLabwareId:e.labware,destWell:K,blowoutLocation:e.blowoutLocation,flowRate:f,offsetFromTopMm:m,invariantContext:t}),W=[...Object.keys(t.wasteChuteEntities),...Object.keys(t.trashBinEntities)].some(le=>le===e.blowoutLocation)?[...q,...re]:[...re,...q],x=J&&(j===s.length-1||u==="always")?[P(Yr,{pipette:a,dropTipLocation:_,isReturnTip:J})]:[],H=$r({pipette:a,volume:i,times:l,aspirateFlowRateUlSec:p,dispenseFlowRateUlSec:d,invariantContext:t,liquidClass:null,tiprack:_,finalPushOut:S,aspirateDelaySeconds:O,dispenseDelaySeconds:k,moveToWellParams:{pipetteId:a,labwareId:o,wellName:K,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[y],offset:{x:T,y:b,z:w}}},generatePython:!0});return[...N,...ie,...B,...H,...W,...x]});return de(oe,t,r)},Db=(e,t,r)=>{const{aspirateDelay:n,aspirateFlowRateUlSec:a,aspiratePositionReference:o,aspirateRetractDelay:s,aspirateRetractPositionReference:i,aspirateRetractSpeed:l,aspirateRetractXOffset:u,aspirateRetractYOffset:p,aspirateRetractZOffset:d,aspirateSubmergeDelay:f,aspirateSubmergePositionReference:m,aspirateSubmergeSpeed:h,aspirateSubmergeXOffset:_,aspirateSubmergeYOffset:y,aspirateSubmergeZOffset:T,aspirateXOffset:b,aspirateYOffset:w,aspirateZOffset:S,blowoutFlowRateUlSec:g,blowoutLocation:L,changeTip:I,destLabware:A,destWell:E,dispenseDelay:O,dispenseFlowRateUlSec:k,dispensePositionReference:D,dispenseRetractPositionReference:M,dispenseRetractXOffset:G,dispenseRetractYOffset:Y,dispenseRetractZOffset:ae,dispenseSubmergeDelay:fe,dispenseSubmergePositionReference:J,dispenseSubmergeSpeed:Re,dispenseSubmergeXOffset:Ve,dispenseSubmergeYOffset:Me,dispenseSubmergeZOffset:je,dispenseXOffset:ie,dispenseYOffset:ke,dispenseZOffset:Be,dropTipLocation:Ae,liquidClass:oe,mixInDestination:K,nozzles:j,pipette:N,primaryNozzle:B,pushOut:q,sourceLabware:re,sourceWells:V,tipRack:Z,tipTracking:W,tiprackSelected:x,tipsSelected:H,touchTipAfterAspirate:le,touchTipAfterAspirateMmFromEdge:xe,touchTipAfterAspirateOffsetMmFromTop:rt,touchTipAfterAspirateSpeed:We,touchTipAfterDispense:ye,touchTipAfterDispenseMmFromEdge:nt,touchTipAfterDispenseOffsetMmFromTop:bt,touchTipAfterDispenseSpeed:kt,stepNumber:Tt,volume:Ne}=e,{pipetteEntities:at,labwareEntities:Ee,trashBinEntities:Ce,wasteChuteEntities:Fe}=t,ue="consolidate",ce=[],Nt=r.pipettes[N],Ke=at[N]?.spec.channels!==1,te=e.aspirateAirGapVolume??0,Ie=e.dispenseAirGapVolume??0;Nt==null&&ce.push(mt({pipette:N})),(A==null||Ee[A]==null&&Ce[A]==null&&Fe[A]==null)&&ce.push(Bh());const Ir=ee(r.labware[A]?.stack),ot=ee(r.labware[re]?.stack);Object.keys(Fe).length>0&&(Ir===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA||ot===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)&&ce.push(ka());const we=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],st=we.length>0?we[0]:null,Qr=Object.values(t.labwareEntities).find(({labwareDefURI:Se})=>Se===Ae),Ct=Qr!=null&&c.getIsTiprack(Qr.def),no=t.wasteChuteEntities[Ae]!=null,Jr=t.trashBinEntities[Ae]!=null,ur=r.tipState.pipettes[N]?.hasTip;(Ae==null||Ct&&st==null&&I!=="never"&&ur||!Ct&&!no&&!Jr)&&ce.push(Mn());let Ze,se;if(I==="never"){const Se=r.tipState.pipettes[N]?.tiprackURI;Ze=t.labwareEntities[Se??""],se=Ze?.labwareDefURI}else Ze=Object.values(Ee).find(({labwareDefURI:Se})=>Se===Z),se=Z;Ze==null&&(I==="never"?ce.push(jt({actionName:ue,pipette:N})):ce.push(ht({actionName:ue,labware:se})));const{def:Dt=null}=Ze??{},{spec:Le,name:pt,pythonName:ne}=at[N],X=c.getAllLiquidClassDefs()[oe===c.NONE_LIQUID_CLASS_NAME||oe==null?c.WATER_LIQUID_CLASS_NAME:oe].byPipette?.find(({pipetteModel:Se})=>Se===c.getFlexNameConversion(Le))?.byTipType.find(({tiprack:Se})=>Se===se)??null,{aspirate:dt}=X??{},{multiWellHandling:be}=tp({pipetteSpecs:Le,tiprackDefinition:Dt,volume:Ne,path:"multiAspirate",numAspirateWells:V.length,numDispenseWells:1,aspirateAirGapByVolume:dt?.retract.airGapByVolume??[],conditioningByVolume:null,disposalByVolume:null}),{numWellsToFitInTip:it}=be;if((!be.isSupported||it==null||it===1)&&ce.push(bT()),Ke&&j!==c.ALL){const Se=_t({robotState:r,invariantContext:t,pipetteId:N,labwareId:re,wellLocationOffset:{x:b,y:w},primaryNozzle:B,nozzleConfiguration:j});Se.isSafe||ce.push(xt({unsafePipetteMovementReason:Se.reason}));const me=_t({robotState:r,invariantContext:t,pipetteId:N,labwareId:A,wellLocationOffset:{x:ie,y:ke},primaryNozzle:B,nozzleConfiguration:j});me.isSafe||ce.push(xt({unsafePipetteMovementReason:me.reason}))}const Gt=E!=null?Ee[re]?.def.wells[E]?.depth:null,Mt=c.getMmFromBottom(Be,D,Gt),en=c.getMmFromBottom(je,J,Gt),cr=c.getMmFromBottom(ae,M,Gt);if(Mt!=null&&en!=null&&Mt>en&&ce.push(_T()),Mt!=null&&cr!=null&&Mt>cr&&ce.push(yT()),ce.length>0)return{errors:ce};const{tipracks:wr}=to(N,se,t,r,B,j),pr=c.getByVolumeValue({liquidClass:oe,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:Ne,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Oe=Ce[A]?.pythonName??Fe[A]?.pythonName,Ft=Ce[Ae]?.pythonName??Fe[Ae]?.pythonName,Sr=L==null?null:Ce[L]?.pythonName??Fe[L]?.pythonName,gr=Ee[re].pythonName,tn=Ee[A]?.pythonName,Er=j===c.PARTIAL_COLUMN?ar({labwareDef:Ee[re].def,wells:V,primaryNozzle:B}):V,rn=(j===c.PARTIAL_COLUMN&&E!=null&&Ee[A]!=null?ar({labwareDef:Ee[A].def,wells:[E],primaryNozzle:B}):[E])[0],nn=Er.map(Se=>`${gr}[${F(Se)}]`).join(", "),an=rn!=null&&tn!=null?`${tn}[${F(rn)}]`:null,on=[`name=${F(`${e.commandCreatorFnName}_step_${Tt}`)}`,...oe!=null?[`base_liquid_class=${Ja(oe,!0)}`]:[],`properties=${zo({args:e,pipetteName:c.isFlexPipette(pt)?c.getFlexNameConversion(Le):pt,tiprackUri:se,liquidClassValuesForTip:X})}`],Jn=`${ge}.define_liquid_class(
132
+ ${Q(on.join(`,
133
133
  `))},
134
- )`,Wt=z===Lt&&U!=null&&j!=null&&j.length>0?Qa({wellSets:j,nozzles:N,channels:Le.channels,primaryNozzle:$}):null,on=Wt!=null&&Ze!=null&&N===c.PARTIAL_COLUMN?nr({labwareDef:Ze?.def,wells:Wt,primaryNozzle:$}):Wt,sn=U!=null?Se[U]?.pythonName:null,ln=on?.map(ge=>`${sn}[${C(ge)}]`).join(", "),Qn=[`volume=${Ne}`,`source=[${tn}]`,`dest=${rn!=null?`[${rn}]`:ve}`,`new_tip=${C(Go(L))}`,...Nt?["return_tip=True",...Er!=null?[`trash_location=${Er}`]:[]]:[`trash_location=${Mt}`,"keep_last_tip=True"],...Le.channels>1?["group_wells=False"]:[],...Ir.filteredSortedTiprackIds.length>0?[jo({labwareEntities:Se,tiprackIds:Ir.filteredSortedTiprackIds})]:[],`liquid_class=${Xn}`,...Wt!=null&&sn!=null?[`tips=[${ln}]`]:[]],Jn=()=>({commands:[],python:`${ee}.consolidate_with_liquid_class(
135
- ${Y(Qn.join(`,
134
+ )`,Yt=W===Ot&&x!=null&&H!=null&&H.length>0?eo({wellSets:H,nozzles:j,channels:Le.channels,primaryNozzle:B}):null,ln=Yt!=null&&Ze!=null&&j===c.PARTIAL_COLUMN?ar({labwareDef:Ze?.def,wells:Yt,primaryNozzle:B}):Yt,un=x!=null?Ee[x]?.pythonName:null,cn=ln?.map(Se=>`${un}[${F(Se)}]`).join(", "),ea=[`volume=${Ne}`,`source=[${nn}]`,`dest=${an!=null?`[${an}]`:Oe}`,`new_tip=${F(Wo(I))}`,...Ct?["return_tip=True",...Sr!=null?[`trash_location=${Sr}`]:[]]:[`trash_location=${Ft}`,"keep_last_tip=True"],...Le.channels>1?["group_wells=False"]:[],...wr.filteredSortedTiprackIds.length>0?[jo({labwareEntities:Ee,tiprackIds:wr.filteredSortedTiprackIds})]:[],`liquid_class=${Jn}`,...Yt!=null&&un!=null?[`tips=[${cn}]`]:[]],ta=()=>({commands:[],python:`${ne}.consolidate_with_liquid_class(
135
+ ${Q(ea.join(`,
136
136
  `))},
137
- )`}),un=Rb(V,it),Yt=c.LOW_VOLUME_PIPETTES.includes(ct)?[R(Rn,{pipetteId:P,volume:Ne})]:[],ea={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[Te],offset:{x:Be,y:Me,z:ae}},Ft={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[q],offset:{x:Q,y:fe,z:_e}},pr=n!=null?[R(be,{seconds:n.seconds})]:[],ta=c.getByVolumeValue({liquidClass:J,pipetteSpecs:Le,tiprackDefUri:te,targetVolume:Ie,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Sr=k!=null?[R(be,{seconds:k.seconds})]:[],ra=c.getByVolumeValue({liquidClass:J,pipetteSpecs:Le,tiprackDefUri:te,targetVolume:X,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,cn=c.getByVolumeValue({liquidClass:J,pipetteSpecs:Le,tiprackDefUri:te,targetVolume:X,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??v,na=c.getByVolumeValue({liquidClass:J,pipetteSpecs:Le,tiprackDefUri:te,targetVolume:Ie,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,pn=c.getByVolumeValue({liquidClass:J,pipetteSpecs:Le,tiprackDefUri:te,targetVolume:Ie,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??v,Ar=$r({retractZOffset:_e,retractPositionReference:q,labwareId:S,labwareEntities:Se,well:g}),Lr=!Ar&&g!=null?[R(x,{pipetteId:P,labwareId:S,wellName:g,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],ro=[...On(un,(ge,ce)=>{const Tt=(Pe,Xt=!0)=>Ie>0&&!(L==="never"&&qe&&Pe)?[...Xt?Lr:[],R(Rt,{pipetteId:P}),R(Ot,{pipetteId:P,volume:Ie,flowRate:na,...ta>0?{correctionVolume:ta}:{}}),...pr]:[],Ut=Pe=>g!=null&&he?[R(St,{pipetteId:P,labwareId:S,wellName:g,...nt!=null?{mmFromEdge:nt}:{},zOffsetFromTop:yt,...kt!=null?{speed:kt}:{}}),...Tt(Pe).length>0&&Ar?[R(x,{pipetteId:P,labwareId:S,wellName:g,wellLocation:Ft})]:[]]:[],ke=ce===0,qe=ce===un.length-1,oa=ge.length,pe=Ne*oa,Xe=L==="always"||L==="once"&&ke;let dr=[];if(Xe){const Pe=Wt?.shift();dr=[O(eo,{pipette:P,primaryNozzle:$,nozzles:N,dropTipLocation:Nt&&st!=null?st:Ae,tipRack:te,...z===Lt&&Pe!=null&&U!=null?{tipSelectionArgs:{tipRackId:U,tipWell:Pe}}:{}})]}const Or=On(ge,(Pe,Xt)=>{const Pr=Xt===0;let Et=0,Qt=v;Pr&&!Xe&&!ke?(Et=Ie,Qt=pn):Pr||(Et=X,Qt=cn);const la={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[m],offset:{x:_,y:b,z:T}},hn={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[i],offset:{x:u,y:p,z:d}},_n=$r({retractZOffset:d,retractPositionReference:i,labwareId:ue,labwareEntities:Se,well:Pe}),ua=!_n&&Pe!=null?[R(x,{pipetteId:P,labwareId:ue,wellName:Pe,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],yn=c.getByVolumeValue({liquidClass:J,pipetteSpecs:Le,tiprackDefUri:te,targetVolume:Et,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Nr=Pr?[...c.LOW_VOLUME_PIPETTES.includes(t.pipetteEntities[P].name)?[R(Rn,{pipetteId:P,volume:pe})]:[],R(Rt,{pipetteId:P})]:[],ca=Et>0?[R(Je,{pipetteId:P,volume:Et,flowRate:Qt,...yn>0?{correctionVolume:yn}:{},isAirGap:!0,pushOut:0}),...Sr]:[],Cr=[...[R(x,{pipetteId:P,labwareId:ue,wellName:Pe,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],...ca,...Nr],bn=[R(x,{pipetteId:P,labwareId:ue,wellName:Pe,wellLocation:la}),R(x,{pipetteId:P,labwareId:ue,...h!=null?{speed:h}:{},wellName:Pe,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[o],offset:{x:y,y:I,z:w}}}),...f!=null&&f.seconds>0?[R(be,{seconds:f.seconds})]:[]],hr=me?[R(St,{pipetteId:P,labwareId:ue,wellName:Pe,...xe!=null?{mmFromEdge:xe}:{},zOffsetFromTop:rt,...je!=null?{speed:je}:{}}),...X>0&&_n?[R(x,{pipetteId:P,labwareId:ue,wellName:Pe,wellLocation:hn})]:[]]:[],Dr=c.getByVolumeValue({liquidClass:J,pipetteSpecs:Le,tiprackDefUri:te,targetVolume:X,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Jt=X>0?[...ua,R(Ot,{pipetteId:P,volume:X,flowRate:ra,...Dr>0?{correctionVolume:Dr}:{}}),...pr]:[],_r=[R(Va,{pipetteId:P,volume:Ne,flowRate:a,correctionVolume:cr}),...pr],pa=[R(x,{pipetteId:P,labwareId:ue,...l!=null?{speed:l}:{},wellName:Pe,wellLocation:hn}),...s!=null&&s?.seconds>0?[R(be,{seconds:s.seconds})]:[]];return[...Cr,...bn,..._r,...pa,...hr,...Jt]}),Rr=g!=null?[R(x,{pipetteId:P,labwareId:S,wellName:g,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION}),R(x,{pipetteId:P,labwareId:S,wellName:g,wellLocation:ea,...Oe!=null?{speed:Oe}:{}})]:[R($e,{pipetteId:P,fixtureId:S,offset:{x:0,y:0,z:0}})],sa=c.getByVolumeValue({liquidClass:J,pipetteSpecs:Le,tiprackDefUri:te,targetVolume:X,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,dn=X>0?[R(Je,{pipetteId:P,volume:X,flowRate:cn,pushOut:0,correctionVolume:sa,isAirGap:!0}),...Sr]:[],It=g!=null?[R(x,{pipetteId:P,labwareId:S,wellName:g,wellLocation:ea}),R(x,{pipetteId:P,labwareId:S,...Oe!=null?{speed:Oe}:{},wellName:g,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[D],offset:{x:Re,y:We,z:Fe}}}),...ne!=null&&ne.seconds>0?[R(be,{seconds:ne.seconds})]:[]]:[],ia=c.getByVolumeValue({liquidClass:J,pipetteSpecs:Le,tiprackDefUri:te,targetVolume:pe,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,fr=Z!=null?0:F,vr=[R(Je,{pipetteId:P,volume:pe,flowRate:v,...fr!=null?{pushOut:fr}:{},correctionVolume:ia}),...Sr],Kt=(Z!=null?c.getByVolumeValue({liquidClass:J,pipetteSpecs:Le,tiprackDefUri:te,targetVolume:Z.volume,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null}):a)??a,Zt=(Z!=null?c.getByVolumeValue({liquidClass:J,pipetteSpecs:Le,tiprackDefUri:te,targetVolume:Z.volume,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null}):v)??v,fn=Z!=null?Ur({pipette:P,volume:Z.volume,times:Z.times,aspirateFlowRateUlSec:Kt,dispenseFlowRateUlSec:Zt,aspirateDelaySeconds:n?.seconds,dispenseDelaySeconds:k?.seconds,finalPushOut:F,invariantContext:t,liquidClass:J,tiprack:te,generatePython:!1}):[],kr=[R(Vn,{pipetteId:P,flowRate:E})];let mr=[];A==null||A===Wr?mr=[...Ut(!0),...Tt(!0)]:A===$n&&g!=null?mr=[R(x,{pipetteId:P,labwareId:S,wellName:g,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),...kr,...Ut(!0),...Tt(!0)]:mr=[...Ut(!1),...Tt(!1),R($e,{pipetteId:P,fixtureId:Object.values(Ce).length>0?Object.values(Ce)[0].id:Object.values(Ue)[0].id,offset:{x:0,y:0,z:0}}),...kr,...Tt(!0,!1)];const mn=Nt&&(ce===un.length-1||L==="always")?[R(Gr,{pipette:P,dropTipLocation:te,isReturnTip:Nt})]:[];return[...dr,...Yt,...Or,...Rr,...dn,...It,...vr,...fn,...mr,...mn]}),Jn];return le(ro,t,r)},OA=(e,t,r)=>{const{pipetteId:n,trashId:a,flowRate:o,volume:s}=e,{pipetteEntities:i,trashBinEntities:l}=t,u=l[a],p=i[n].pythonName,d=u.pythonName,f=[`volume=${s}`,`location=${d}`,`rate=${o} / ${p}.flow_rate.dispense`],m=()=>({commands:[],python:`${p}.dispense(
138
- ${Y(f.join(`,
137
+ )`}),pn=Rb(V,it),Kt=c.LOW_VOLUME_PIPETTES.includes(pt)?[R(kn,{pipetteId:N,volume:Ne})]:[],ra={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[J],offset:{x:Ve,y:Me,z:je}},Ut={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[M],offset:{x:G,y:Y,z:ae}},dr=n!=null?[R(Te,{seconds:n.seconds})]:[],na=c.getByVolumeValue({liquidClass:oe,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:Ie,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Ar=O!=null?[R(Te,{seconds:O.seconds})]:[],aa=c.getByVolumeValue({liquidClass:oe,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:te,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,dn=c.getByVolumeValue({liquidClass:oe,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:te,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??k,oa=c.getByVolumeValue({liquidClass:oe,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:Ie,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,fn=c.getByVolumeValue({liquidClass:oe,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:Ie,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??k,Lr=xr({retractZOffset:ae,retractPositionReference:M,labwareId:A,labwareEntities:Ee,well:E}),Or=!Lr&&E!=null?[R(z,{pipetteId:N,labwareId:A,wellName:E,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],ao=[...Rn(pn,(Se,me)=>{const It=(Pe,Qt=!0)=>Ie>0&&!(I==="never"&&Ue&&Pe)?[...Qt?Or:[],R(Pt,{pipetteId:N}),R(vt,{pipetteId:N,volume:Ie,flowRate:oa,...na>0?{correctionVolume:na}:{}}),...dr]:[],$t=Pe=>E!=null&&ye?[R(At,{pipetteId:N,labwareId:A,wellName:E,...nt!=null?{mmFromEdge:nt}:{},zOffsetFromTop:bt,...kt!=null?{speed:kt}:{}}),...It(Pe).length>0&&Lr?[R(z,{pipetteId:N,labwareId:A,wellName:E,wellLocation:Ut})]:[]]:[],ve=me===0,Ue=me===pn.length-1,ia=Se.length,he=Ne*ia,Xe=I==="always"||I==="once"&&ve;let fr=[];if(Xe){const Pe=Yt?.shift();fr=[P(ro,{pipette:N,primaryNozzle:B,nozzles:j,dropTipLocation:Ct&&st!=null?st:Ae,tipRack:se,...W===Ot&&Pe!=null&&x!=null?{tipSelectionArgs:{tipRackId:x,tipWell:Pe}}:{}})]}const vr=Rn(Se,(Pe,Qt)=>{const Nr=Qt===0;let St=0,Jt=k;Nr&&!Xe&&!ve?(St=Ie,Jt=fn):Nr||(St=te,Jt=dn);const ca={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[m],offset:{x:_,y,z:T}},yn={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[i],offset:{x:u,y:p,z:d}},bn=xr({retractZOffset:d,retractPositionReference:i,labwareId:re,labwareEntities:Ee,well:Pe}),pa=!bn&&Pe!=null?[R(z,{pipetteId:N,labwareId:re,wellName:Pe,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],Tn=c.getByVolumeValue({liquidClass:oe,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:St,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Cr=Nr?[...c.LOW_VOLUME_PIPETTES.includes(t.pipetteEntities[N].name)?[R(kn,{pipetteId:N,volume:he})]:[],R(Pt,{pipetteId:N})]:[],da=St>0?[R(Je,{pipetteId:N,volume:St,flowRate:Jt,...Tn>0?{correctionVolume:Tn}:{},isAirGap:!0,pushOut:0}),...Ar]:[],Dr=[...[R(z,{pipetteId:N,labwareId:re,wellName:Pe,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],...da,...Cr],In=[R(z,{pipetteId:N,labwareId:re,wellName:Pe,wellLocation:ca}),R(z,{pipetteId:N,labwareId:re,...h!=null?{speed:h}:{},wellName:Pe,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[o],offset:{x:b,y:w,z:S}}}),...f!=null&&f.seconds>0?[R(Te,{seconds:f.seconds})]:[]],_r=le?[R(At,{pipetteId:N,labwareId:re,wellName:Pe,...xe!=null?{mmFromEdge:xe}:{},zOffsetFromTop:rt,...We!=null?{speed:We}:{}}),...te>0&&bn?[R(z,{pipetteId:N,labwareId:re,wellName:Pe,wellLocation:yn})]:[]]:[],Mr=c.getByVolumeValue({liquidClass:oe,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:te,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,er=te>0?[...pa,R(vt,{pipetteId:N,volume:te,flowRate:aa,...Mr>0?{correctionVolume:Mr}:{}}),...dr]:[],yr=[R(Ba,{pipetteId:N,volume:Ne,flowRate:a,correctionVolume:pr}),...dr],fa=[R(z,{pipetteId:N,labwareId:re,...l!=null?{speed:l}:{},wellName:Pe,wellLocation:yn}),...s!=null&&s?.seconds>0?[R(Te,{seconds:s.seconds})]:[]];return[...Dr,...In,...yr,...fa,..._r,...er]}),Pr=E!=null?[R(z,{pipetteId:N,labwareId:A,wellName:E,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION}),R(z,{pipetteId:N,labwareId:A,wellName:E,wellLocation:ra,...Re!=null?{speed:Re}:{}})]:[R(qe,{pipetteId:N,fixtureId:A,offset:{x:0,y:0,z:0}})],la=c.getByVolumeValue({liquidClass:oe,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:te,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,mn=te>0?[R(Je,{pipetteId:N,volume:te,flowRate:dn,pushOut:0,correctionVolume:la,isAirGap:!0}),...Ar]:[],wt=E!=null?[R(z,{pipetteId:N,labwareId:A,wellName:E,wellLocation:ra}),R(z,{pipetteId:N,labwareId:A,...Re!=null?{speed:Re}:{},wellName:E,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[D],offset:{x:ie,y:ke,z:Be}}}),...fe!=null&&fe.seconds>0?[R(Te,{seconds:fe.seconds})]:[]]:[],ua=c.getByVolumeValue({liquidClass:oe,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:he,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,mr=K!=null?0:q,Rr=[R(Je,{pipetteId:N,volume:he,flowRate:k,...mr!=null?{pushOut:mr}:{},correctionVolume:ua}),...Ar],Zt=(K!=null?c.getByVolumeValue({liquidClass:oe,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:K.volume,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null}):a)??a,Xt=(K!=null?c.getByVolumeValue({liquidClass:oe,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:K.volume,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null}):k)??k,hn=K!=null?$r({pipette:N,volume:K.volume,times:K.times,aspirateFlowRateUlSec:Zt,dispenseFlowRateUlSec:Xt,aspirateDelaySeconds:n?.seconds,dispenseDelaySeconds:O?.seconds,finalPushOut:q,invariantContext:t,liquidClass:oe,tiprack:se,generatePython:!1}):[],kr=[R(Bn,{pipetteId:N,flowRate:g})];let hr=[];L==null||L===Kr?hr=[...$t(!0),...It(!0)]:L===xn&&E!=null?hr=[R(z,{pipetteId:N,labwareId:A,wellName:E,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),...kr,...$t(!0),...It(!0)]:hr=[...$t(!1),...It(!1),R(qe,{pipetteId:N,fixtureId:Object.values(Ce).length>0?Object.values(Ce)[0].id:Object.values(Fe)[0].id,offset:{x:0,y:0,z:0}}),...kr,...It(!0,!1)];const _n=Ct&&(me===pn.length-1||I==="always")?[R(Yr,{pipette:N,dropTipLocation:se,isReturnTip:Ct})]:[];return[...fr,...Kt,...vr,...Pr,...mn,...wt,...Rr,...hn,...hr,..._n]}),ta];return de(ao,t,r)},RA=(e,t,r)=>{const{pipetteId:n,trashId:a,flowRate:o,volume:s}=e,{pipetteEntities:i,trashBinEntities:l}=t,u=l[a],p=i[n].pythonName,d=u.pythonName,f=[`volume=${s}`,`location=${d}`,`rate=${o} / ${p}.flow_rate.dispense`],m=()=>({commands:[],python:`${p}.dispense(
138
+ ${Q(f.join(`,
139
139
  `))},
140
- )`}),h=[R($e,{pipetteId:n,fixtureId:a,offset:At}),R(Je,{pipetteId:n,volume:s,flowRate:o}),m];return le(h,t,r)},RA=(e,t,r)=>{const{pipetteId:n,flowRate:a,volume:o,wasteChuteId:s}=e,{pipetteEntities:i,wasteChuteEntities:l}=t,u=l[s].pythonName,p=i[n].pythonName,d=[`volume=${o}`,`location=${u}`,`rate=${a} / ${p}.flow_rate.dispense`],f=()=>({commands:[],python:`${p}.dispense(
141
- ${Y(d.join(`,
140
+ )`}),h=[R(qe,{pipetteId:n,fixtureId:a,offset:Lt}),R(Je,{pipetteId:n,volume:s,flowRate:o}),m];return de(h,t,r)},kA=(e,t,r)=>{const{pipetteId:n,flowRate:a,volume:o,wasteChuteId:s}=e,{pipetteEntities:i,wasteChuteEntities:l}=t,u=l[s].pythonName,p=i[n].pythonName,d=[`volume=${o}`,`location=${u}`,`rate=${a} / ${p}.flow_rate.dispense`],f=()=>({commands:[],python:`${p}.dispense(
141
+ ${Q(d.join(`,
142
142
  `))},
143
- )`}),m=[R($e,{pipetteId:n,fixtureId:s,offset:At}),R(Je,{pipetteId:n,flowRate:a,volume:o}),f];return le(m,t,r)},Cb=(e,t,r)=>{const{aspirateDelay:n,aspirateFlowRateUlSec:a,aspiratePositionReference:o,aspirateRetractDelay:s,aspirateRetractPositionReference:i,aspirateRetractSpeed:l,aspirateRetractXOffset:u,aspirateRetractYOffset:p,aspirateRetractZOffset:d,aspirateSubmergeDelay:f,aspirateSubmergePositionReference:m,aspirateSubmergeSpeed:h,aspirateSubmergeXOffset:_,aspirateSubmergeYOffset:b,aspirateSubmergeZOffset:T,aspirateXOffset:y,aspirateYOffset:I,aspirateZOffset:w,blowoutFlowRateUlSec:E,blowoutLocation:A,changeTip:L,destLabware:S,destWells:g,dispenseDelay:k,dispenseFlowRateUlSec:v,dispensePositionReference:D,dispenseRetractDelay:q,dispenseRetractPositionReference:Q,dispenseRetractSpeed:fe,dispenseRetractXOffset:_e,dispenseRetractYOffset:ne,dispenseRetractZOffset:Te,dispenseSubmergeDelay:Oe,dispenseSubmergePositionReference:Be,dispenseSubmergeSpeed:Me,dispenseSubmergeXOffset:ae,dispenseSubmergeYOffset:Re,dispenseSubmergeZOffset:We,dispenseXOffset:Fe,dispenseYOffset:Ae,dispenseZOffset:J,dropTipLocation:Z,liquidClass:N,mixBeforeAspirate:P,nozzles:$,pipette:F,preWetTip:ue,primaryNozzle:V,pushOut:G,sourceLabware:z,sourceWell:U,tipRack:j,tipTracking:me,tiprackSelected:xe,tipsSelected:rt,touchTipAfterAspirate:je,touchTipAfterAspirateMmFromEdge:he,touchTipAfterAspirateOffsetMmFromTop:nt,touchTipAfterAspirateSpeed:yt,touchTipAfterDispense:kt,touchTipAfterDispenseMmFromEdge:bt,touchTipAfterDispenseOffsetMmFromTop:Ne,touchTipAfterDispenseSpeed:at,stepNumber:Se,volume:Ce}=e,{pipetteEntities:Ue,labwareEntities:oe,trashBinEntities:se,wasteChuteEntities:Pt}=t,Ke="distribute",X=[],Ie=Ue[F]?.spec.channels!==1,Tr=oe[z]?.def.parameters.quirks?.includes("touchTipDisabled"),ot=e.aspirateAirGapVolume??0,He=e.dispenseAirGapVolume??0,Ee=e.disposalVolume!=null&&e.disposalVolume>0?e.disposalVolume:0,st=e.conditioningVolume!=null&&e.conditioningVolume>0?e.conditioningVolume:0;(r.pipettes[F]==null||Ue[F]==null)&&X.push(ft({pipette:F})),(!z||!r.labware[z])&&X.push(mt({actionName:Ke,labware:z}));const Zr=K(r.labware[S]?.stack),Nt=K(r.labware[z]?.stack);Object.keys(Pt).length>0&&(Zr===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA||Nt===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)&&X.push(va());const Xr=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],lr=Xr.length>0?Xr[0]:null,Ze=Object.values(t.labwareEntities).find(({labwareDefURI:pe})=>pe===Z),te=Ze!=null&&c.getIsTiprack(Ze.def),Ct=t.wasteChuteEntities[Z]!=null,Le=t.trashBinEntities[Z]!=null,ct=r.tipState.pipettes[F]?.hasTip;(Z==null||te&&lr==null&&L!=="never"&&ct||!te&&!Ct&&!Le)&&X.push(Cn());let ee,W;if(L==="never"){const pe=r.tipState.pipettes[F]?.tiprackURI;ee=t.labwareEntities[pe??""],W=ee?.labwareDefURI}else ee=Object.values(oe).find(({labwareDefURI:pe})=>pe===j),W=j;ee==null&&(L==="never"?X.push(zt({actionName:Ke,pipette:F})):X.push(mt({actionName:Ke,labware:W})));const{def:pt=null}=ee??{},{spec:ye,name:it,pythonName:Gt}=Ue[F],Dt=c.getAllLiquidClassDefs()[N===c.NONE_LIQUID_CLASS_NAME||N==null?c.WATER_LIQUID_CLASS_NAME:N].byPipette?.find(({pipetteModel:pe})=>pe===c.getFlexNameConversion(ye))?.byTipType.find(({tiprack:pe})=>pe===W)??null,{aspirate:Qr,multiDispense:ur}=Dt??{},{multiWellHandling:Ir}=Jc({pipetteSpecs:ye,tiprackDefinition:pt,volume:Ce,path:"multiDispense",numAspirateWells:1,numDispenseWells:g.length,conditioningByVolume:ur?.conditioningByVolume??[],disposalByVolume:ur?.disposalByVolume??[],aspirateAirGapByVolume:Qr?.retract.airGapByVolume??[]}),{numWellsToFitInTip:cr}=Ir;if((!Ir.isSupported||cr==null||cr===1)&&X.push(yT()),Ie&&$!==c.ALL){const pe=ht({robotState:r,invariantContext:t,pipetteId:F,labwareId:z,wellLocationOffset:{x:y,y:I},wellTargetName:U,primaryNozzle:V,nozzleConfiguration:$});pe.isSafe||X.push(Bt({unsafePipetteMovementReason:pe.reason}));const Xe=ht({robotState:r,invariantContext:t,pipetteId:F,labwareId:S,wellLocationOffset:{x:Fe,y:Ae},wellTargetName:g[0],primaryNozzle:V,nozzleConfiguration:$});Xe.isSafe||X.push(Bt({unsafePipetteMovementReason:Xe.reason}))}const ve=t.labwareEntities[z]?.def.wells[U]?.depth??null,Mt=c.getMmFromBottom(w,o,ve),Er=c.getMmFromBottom(T,m,ve),gr=c.getMmFromBottom(d,i,ve);Mt!=null&&Er!=null&&Mt>Er&&X.push(Vh()),Mt!=null&&gr!=null&&Mt>gr&&X.push($h());const Jr=[R(x,{pipetteId:F,labwareId:z,wellName:U,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],wr=Wo(F,t,W)-ot;if(Math.floor((wr-Ee)/Ce)===0&&X.push(mo({actionName:Ke,volume:Ce,maxVolume:wr,disposalVolume:Ee})),X.length>0)return{errors:X};const{tipracks:tn}=Ja(F,W,t,r,V,$),rn=c.getByVolumeValue({liquidClass:N,pipetteSpecs:ye,tiprackDefUri:W,targetVolume:Ce,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,nn=se[S]?.pythonName??Pt[S]?.pythonName,Xn=se[Z]?.pythonName??Pt[Z]?.pythonName,an=A==null?null:se[A]?.pythonName??Pt[A]?.pythonName,Wt=oe[z].pythonName,on=oe[S]?.pythonName,sn=($===c.PARTIAL_COLUMN?nr({labwareDef:oe[z].def,wells:[U],primaryNozzle:V}):[U])[0],ln=$===c.PARTIAL_COLUMN&&g!=null&&oe[S]!=null?nr({labwareDef:oe[S].def,wells:g,primaryNozzle:V}):g,Qn=`${Wt}[${C(sn)}]`,Jn=ln.map(pe=>`${on}[${C(pe)}]`).join(", "),un=[`name=${C(`${e.commandCreatorFnName}_step_${Se}`)}`,...N!=null?[`base_liquid_class=${Xa(N,!0)}`]:[],`properties=${zo({args:e,pipetteName:c.isFlexPipette(it)?c.getFlexNameConversion(ye):it,tiprackUri:W,liquidClassValuesForTip:Dt})}`],Yt=`${we}.define_liquid_class(
144
- ${Y(un.join(`,
143
+ )`}),m=[R(qe,{pipetteId:n,fixtureId:s,offset:Lt}),R(Je,{pipetteId:n,flowRate:a,volume:o}),f];return de(m,t,r)},Mb=(e,t,r)=>{const{aspirateDelay:n,aspirateFlowRateUlSec:a,aspiratePositionReference:o,aspirateRetractDelay:s,aspirateRetractPositionReference:i,aspirateRetractSpeed:l,aspirateRetractXOffset:u,aspirateRetractYOffset:p,aspirateRetractZOffset:d,aspirateSubmergeDelay:f,aspirateSubmergePositionReference:m,aspirateSubmergeSpeed:h,aspirateSubmergeXOffset:_,aspirateSubmergeYOffset:y,aspirateSubmergeZOffset:T,aspirateXOffset:b,aspirateYOffset:w,aspirateZOffset:S,blowoutFlowRateUlSec:g,blowoutLocation:L,changeTip:I,destLabware:A,destWells:E,dispenseDelay:O,dispenseFlowRateUlSec:k,dispensePositionReference:D,dispenseRetractDelay:M,dispenseRetractPositionReference:G,dispenseRetractSpeed:Y,dispenseRetractXOffset:ae,dispenseRetractYOffset:fe,dispenseRetractZOffset:J,dispenseSubmergeDelay:Re,dispenseSubmergePositionReference:Ve,dispenseSubmergeSpeed:Me,dispenseSubmergeXOffset:je,dispenseSubmergeYOffset:ie,dispenseSubmergeZOffset:ke,dispenseXOffset:Be,dispenseYOffset:Ae,dispenseZOffset:oe,dropTipLocation:K,liquidClass:j,mixBeforeAspirate:N,nozzles:B,pipette:q,preWetTip:re,primaryNozzle:V,pushOut:Z,sourceLabware:W,sourceWell:x,tipRack:H,tipTracking:le,tiprackSelected:xe,tipsSelected:rt,touchTipAfterAspirate:We,touchTipAfterAspirateMmFromEdge:ye,touchTipAfterAspirateOffsetMmFromTop:nt,touchTipAfterAspirateSpeed:bt,touchTipAfterDispense:kt,touchTipAfterDispenseMmFromEdge:Tt,touchTipAfterDispenseOffsetMmFromTop:Ne,touchTipAfterDispenseSpeed:at,stepNumber:Ee,volume:Ce}=e,{pipetteEntities:Fe,labwareEntities:ue,trashBinEntities:ce,wasteChuteEntities:Nt}=t,Ke="distribute",te=[],Ie=Fe[q]?.spec.channels!==1,Ir=ue[W]?.def.parameters.quirks?.includes("touchTipDisabled"),ot=e.aspirateAirGapVolume??0,He=e.dispenseAirGapVolume??0,we=e.disposalVolume!=null&&e.disposalVolume>0?e.disposalVolume:0,st=e.conditioningVolume!=null&&e.conditioningVolume>0?e.conditioningVolume:0;(r.pipettes[q]==null||Fe[q]==null)&&te.push(mt({pipette:q})),(!W||!r.labware[W])&&te.push(ht({actionName:Ke,labware:W}));const Qr=ee(r.labware[A]?.stack),Ct=ee(r.labware[W]?.stack);Object.keys(Nt).length>0&&(Qr===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA||Ct===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)&&te.push(ka());const Jr=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],ur=Jr.length>0?Jr[0]:null,Ze=Object.values(t.labwareEntities).find(({labwareDefURI:he})=>he===K),se=Ze!=null&&c.getIsTiprack(Ze.def),Dt=t.wasteChuteEntities[K]!=null,Le=t.trashBinEntities[K]!=null,pt=r.tipState.pipettes[q]?.hasTip;(K==null||se&&ur==null&&I!=="never"&&pt||!se&&!Dt&&!Le)&&te.push(Mn());let ne,X;if(I==="never"){const he=r.tipState.pipettes[q]?.tiprackURI;ne=t.labwareEntities[he??""],X=ne?.labwareDefURI}else ne=Object.values(ue).find(({labwareDefURI:he})=>he===H),X=H;ne==null&&(I==="never"?te.push(jt({actionName:Ke,pipette:q})):te.push(ht({actionName:Ke,labware:X})));const{def:dt=null}=ne??{},{spec:be,name:it,pythonName:Gt}=Fe[q],Mt=c.getAllLiquidClassDefs()[j===c.NONE_LIQUID_CLASS_NAME||j==null?c.WATER_LIQUID_CLASS_NAME:j].byPipette?.find(({pipetteModel:he})=>he===c.getFlexNameConversion(be))?.byTipType.find(({tiprack:he})=>he===X)??null,{aspirate:en,multiDispense:cr}=Mt??{},{multiWellHandling:wr}=tp({pipetteSpecs:be,tiprackDefinition:dt,volume:Ce,path:"multiDispense",numAspirateWells:1,numDispenseWells:E.length,conditioningByVolume:cr?.conditioningByVolume??[],disposalByVolume:cr?.disposalByVolume??[],aspirateAirGapByVolume:en?.retract.airGapByVolume??[]}),{numWellsToFitInTip:pr}=wr;if((!wr.isSupported||pr==null||pr===1)&&te.push(TT()),Ie&&B!==c.ALL){const he=_t({robotState:r,invariantContext:t,pipetteId:q,labwareId:W,wellLocationOffset:{x:b,y:w},wellTargetName:x,primaryNozzle:V,nozzleConfiguration:B});he.isSafe||te.push(xt({unsafePipetteMovementReason:he.reason}));const Xe=_t({robotState:r,invariantContext:t,pipetteId:q,labwareId:A,wellLocationOffset:{x:Be,y:Ae},wellTargetName:E[0],primaryNozzle:V,nozzleConfiguration:B});Xe.isSafe||te.push(xt({unsafePipetteMovementReason:Xe.reason}))}const Oe=t.labwareEntities[W]?.def.wells[x]?.depth??null,Ft=c.getMmFromBottom(S,o,Oe),Sr=c.getMmFromBottom(T,m,Oe),gr=c.getMmFromBottom(d,i,Oe);Ft!=null&&Sr!=null&&Ft>Sr&&te.push(xh()),Ft!=null&&gr!=null&&Ft>gr&&te.push(Hh());const tn=[R(z,{pipetteId:q,labwareId:W,wellName:x,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],Er=Go(q,t,X)-ot;if(Math.floor((Er-we)/Ce)===0&&te.push(ho({actionName:Ke,volume:Ce,maxVolume:Er,disposalVolume:we})),te.length>0)return{errors:te};const{tipracks:nn}=to(q,X,t,r,V,B),an=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:Ce,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,on=ce[A]?.pythonName??Nt[A]?.pythonName,Jn=ce[K]?.pythonName??Nt[K]?.pythonName,sn=L==null?null:ce[L]?.pythonName??Nt[L]?.pythonName,Yt=ue[W].pythonName,ln=ue[A]?.pythonName,un=(B===c.PARTIAL_COLUMN?ar({labwareDef:ue[W].def,wells:[x],primaryNozzle:V}):[x])[0],cn=B===c.PARTIAL_COLUMN&&E!=null&&ue[A]!=null?ar({labwareDef:ue[A].def,wells:E,primaryNozzle:V}):E,ea=`${Yt}[${F(un)}]`,ta=cn.map(he=>`${ln}[${F(he)}]`).join(", "),pn=[`name=${F(`${e.commandCreatorFnName}_step_${Ee}`)}`,...j!=null?[`base_liquid_class=${Ja(j,!0)}`]:[],`properties=${zo({args:e,pipetteName:c.isFlexPipette(it)?c.getFlexNameConversion(be):it,tiprackUri:X,liquidClassValuesForTip:Mt})}`],Kt=`${ge}.define_liquid_class(
144
+ ${Q(pn.join(`,
145
145
  `))},
146
- )`,Ft=me===Lt&&xe!=null&&rt!=null&&rt.length>0?Qa({wellSets:rt,nozzles:$,channels:ye.channels,primaryNozzle:V}):null,pr=xe!=null?oe[xe]?.pythonName:null,Sr=(Ft!=null&&ee!=null&&$===c.PARTIAL_COLUMN?nr({labwareDef:ee?.def,wells:Ft,primaryNozzle:V}):Ft)?.map(pe=>`${pr}[${C(pe)}]`).join(", "),ra=[`volume=${Ce}`,`source=[${Qn}]`,`dest=[${Jn??nn}]`,`new_tip=${C(Go(L))}`,...te?["return_tip=True",...an!=null?[`trash_location=${an}`]:[]]:[`trash_location=${Xn}`,"keep_last_tip=True"],...ye.channels>1?["group_wells=False"]:[],...tn.filteredSortedTiprackIds.length>0?[jo({labwareEntities:oe,tiprackIds:tn.filteredSortedTiprackIds})]:[],`liquid_class=${Yt}`,...Ft!=null&&pr!=null?[`tips=[${Sr}]`]:[]],cn=()=>({commands:[],python:`${Gt}.distribute_with_liquid_class(
147
- ${Y(ra.join(`,
146
+ )`,Ut=le===Ot&&xe!=null&&rt!=null&&rt.length>0?eo({wellSets:rt,nozzles:B,channels:be.channels,primaryNozzle:V}):null,dr=xe!=null?ue[xe]?.pythonName:null,Ar=(Ut!=null&&ne!=null&&B===c.PARTIAL_COLUMN?ar({labwareDef:ne?.def,wells:Ut,primaryNozzle:V}):Ut)?.map(he=>`${dr}[${F(he)}]`).join(", "),aa=[`volume=${Ce}`,`source=[${ea}]`,`dest=[${ta??on}]`,`new_tip=${F(Wo(I))}`,...se?["return_tip=True",...sn!=null?[`trash_location=${sn}`]:[]]:[`trash_location=${Jn}`,"keep_last_tip=True"],...be.channels>1?["group_wells=False"]:[],...nn.filteredSortedTiprackIds.length>0?[jo({labwareEntities:ue,tiprackIds:nn.filteredSortedTiprackIds})]:[],`liquid_class=${Kt}`,...Ut!=null&&dr!=null?[`tips=[${Ar}]`]:[]],dn=()=>({commands:[],python:`${Gt}.distribute_with_liquid_class(
147
+ ${Q(aa.join(`,
148
148
  `))},
149
- )`}),na={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[m],offset:{x:_,y:b,z:T}},pn={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[i],offset:{x:u,y:p,z:d}},Ar={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[Be],offset:{x:ae,y:Re,z:We}},Lr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[Q],offset:{x:_e,y:ne,z:Te}},aa=c.getByVolumeValue({liquidClass:N,pipetteSpecs:ye,tiprackDefUri:W,targetVolume:ot,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,ro=c.getByVolumeValue({liquidClass:N,pipetteSpecs:ye,tiprackDefUri:W,targetVolume:ot,liquidHandlingAction:"multiDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??v,ge=c.getByVolumeValue({liquidClass:N,pipetteSpecs:ye,tiprackDefUri:W,targetVolume:He,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,ce=c.getByVolumeValue({liquidClass:N,pipetteSpecs:ye,tiprackDefUri:W,targetVolume:He,liquidHandlingAction:"multiDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??v,Tt=Rb(g,cr),Ut=$r({retractZOffset:d,retractPositionReference:i,labwareId:z,labwareEntities:oe,well:U}),ke=!Ut&&U!=null?[R(x,{pipetteId:F,labwareId:z,wellName:U,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],oa=[...On(Tt,(pe,Xe)=>{const dr=pe.length,Or=Ce*dr,Rr=Or+Ee+st,sa=Xe===0,dn=Xe===Tt.length-1,It=L==="always"||L==="once"&&sa,ia=c.LOW_VOLUME_PIPETTES.includes(it)?[R(Rn,{pipetteId:F,volume:Rr})]:[];let fr=[];if(It){const Ve=Ft?.shift();fr=[O(eo,{pipette:F,nozzles:$,primaryNozzle:V,dropTipLocation:te&&lr!=null?lr:Z,tipRack:W,...me===Lt&&Ve!=null&&xe!=null?{tipSelectionArgs:{tipRackId:xe,tipWell:Ve}}:{}})]}const vr=[R(Rt,{pipetteId:F})],Kt=c.getByVolumeValue({liquidClass:N,pipetteSpecs:ye,tiprackDefUri:W,targetVolume:He,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Zt=k!=null?[R(be,{seconds:k.seconds})]:[],fn=He>0&&!It&&!sa&&Ee===0&&A==null?[R(Je,{isAirGap:!0,pipetteId:F,volume:He,flowRate:ce,...Kt>0?{correctionVolume:Kt}:{},pushOut:0}),...Zt]:[],kr=[...Jr,...fn,...ia,...vr],mr=[R(x,{pipetteId:F,labwareId:z,wellName:U,wellLocation:na}),R(x,{pipetteId:F,labwareId:z,...h!=null?{speed:h}:{},wellName:U,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[o],offset:{x:y,y:I,z:w}}}),...f!=null&&f.seconds>0?[R(be,{seconds:f.seconds})]:[]],mn=ue?Ur({pipette:F,volume:Or,times:1,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:v,aspirateDelaySeconds:n?.seconds??0,dispenseDelaySeconds:k?.seconds??0,finalPushOut:0,invariantContext:t,liquidClass:N,tiprack:W,generatePython:!1}):[],Pe=P!=null?Ur({pipette:F,volume:P.volume,times:P.times,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:v,aspirateDelaySeconds:n?.seconds,dispenseDelaySeconds:k?.seconds,finalPushOut:0,invariantContext:t,liquidClass:N,tiprack:W,generatePython:!1}):[],Xt=n!=null?[R(be,{seconds:n.seconds})]:[],Pr=je?[R(St,{pipetteId:F,labwareId:z,wellName:U,...he!=null?{mmFromEdge:he}:{},zOffsetFromTop:nt,...yt!=null?{speed:yt}:{}}),...ot>0&&Ut?[R(x,{pipetteId:F,labwareId:z,wellName:U,wellLocation:pn})]:[]]:[],Et=c.getByVolumeValue({liquidClass:N,pipetteSpecs:ye,tiprackDefUri:W,targetVolume:ot,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Qt=ot>0?[...ke,R(Ot,{pipetteId:F,volume:ot,flowRate:aa,...Et>0?{correctionVolume:Et}:{}}),...Xt]:[],la=c.getByVolumeValue({liquidClass:N,pipetteSpecs:ye,tiprackDefUri:W,targetVolume:Rr,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,hn=c.getByVolumeValue({liquidClass:N,pipetteSpecs:ye,tiprackDefUri:W,targetVolume:st,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,_n=st!=null&&st>0?[R(Je,{pipetteId:F,volume:st,flowRate:v,correctionVolume:hn,pushOut:0}),...Zt]:[],ua=[R(Va,{pipetteId:F,volume:Rr,flowRate:a,correctionVolume:la}),...Xt,..._n],yn=[R(x,{pipetteId:F,labwareId:z,...l!=null?{speed:l}:{},wellName:U,wellLocation:pn}),...s!=null&&s?.seconds>0?[R(be,{seconds:s.seconds})]:[]],Nr=On(pe,(Ve,Cr)=>{const bn=Cr===0,hr=Cr===pe.length-1,Dr=dn&&hr;let Jt=0,_r=v;bn&&ot>0?(Jt=ot,_r=ro):!bn&&He>0&&st===0&&(Jt=He,_r=ce);const pa=c.getByVolumeValue({liquidClass:N,pipetteSpecs:ye,tiprackDefUri:W,targetVolume:Jt,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,no=$r({retractZOffset:Te,retractPositionReference:Q,labwareId:S,labwareEntities:oe,well:Ve}),Ko=no?[]:[R(x,{pipetteId:F,labwareId:S,wellName:Ve,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],ao=Ve!=null?[R(x,{pipetteId:F,labwareId:S,wellName:Ve,wellLocation:Ar}),...Jt>0?[R(Je,{isAirGap:!0,pipetteId:F,volume:Jt,flowRate:_r,pushOut:0,correctionVolume:pa}),...Zt]:[],R(x,{pipetteId:F,labwareId:S,...Me!=null?{speed:Me}:{},wellName:Ve,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[D],offset:{x:Fe,y:Ae,z:J}}}),...Oe!=null&&Oe.seconds>0?[R(be,{seconds:Oe.seconds})]:[]]:[R($e,{fixtureId:S,pipetteId:F,offset:{x:0,y:0,z:0}})],da=Ee===0&&hr?G:0,gt=[R(Je,{pipetteId:F,volume:Ce,flowRate:v,...da!=null?{pushOut:da}:{},correctionVolume:rn}),...Zt],Tn=Ve!=null?[R(x,{pipetteId:F,labwareId:S,...fe!=null?{speed:fe}:{},wellName:Ve,wellLocation:Lr}),...q!=null&&q?.seconds>0?[R(be,{seconds:q.seconds})]:[]]:[],qt=hr?[R(Vn,{pipetteId:F,flowRate:E})]:[],oo=c.getByVolumeValue({liquidClass:N,pipetteSpecs:ye,tiprackDefUri:W,targetVolume:He,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Vt=(fa,Kb=!0)=>He>0&&!(Cr<pe.length-1&&st>0)&&!(L==="never"&&Dr&&fa)?[...Kb?Ko:[],R(Rt,{pipetteId:F}),R(Ot,{pipetteId:F,volume:He,flowRate:ge,...oo>0?{correctionVolume:oo}:{}}),...Xt]:[],wt=fa=>Ve!=null&&kt?[R(St,{pipetteId:F,labwareId:S,wellName:Ve,...bt!=null?{mmFromEdge:bt}:{},zOffsetFromTop:Ne,...at!=null?{speed:at}:{}}),...Vt(fa).length>0&&no?[R(x,{pipetteId:F,labwareId:S,wellName:Ve,wellLocation:Lr})]:[]]:[];let Mr=[];if(A==null||!hr)Mr=[...wt(!0),...Vt(!0)];else if(A===$n)Mr=[R(x,{pipetteId:F,labwareId:S,wellName:Ve,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),...qt,...wt(!0),...Vt(!0)];else if(A===Wr){const fa=Vt(!0);Mr=[...wt(!1),...Vt(!1),R(x,{pipetteId:F,labwareId:z,wellName:U,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),...qt,...kt&&!Tr?[R(St,{pipetteId:F,labwareId:z,wellName:U,...bt!=null?{mmFromEdge:bt}:{},zOffsetFromTop:Ne,...at!=null?{speed:at}:{}})]:[],...fa.length>0?[R(x,{pipetteId:F,labwareId:z,wellName:U,wellLocation:{origin:c.WELL_ORIGIN_TOP}})]:[],...Vt(!0,!1)]}else Mr=[...wt(!1),...Vt(!1),R($e,{pipetteId:F,fixtureId:Object.values(se).length>0?Object.values(se)[0].id:Object.values(Pt)[0].id,offset:{x:0,y:0,z:0}}),...qt,...Vt(!0,!1)];return[...ao,...gt,...Tn,...Mr]}),ca=te&&(Xe===Tt.length-1||L==="always")?[R(Gr,{pipette:F,dropTipLocation:W,isReturnTip:te})]:[];return[...fr,...kr,...mr,...Pe,...mn,...ua,...yn,...Pr,...Qt,...Nr,...ca]}),cn];return le(oa,t,r)},Db=(e,t,r)=>{const{timerHours:n,timerMinutes:a,timerSeconds:o,latchOpen:s,targetTemperature:i,rpm:l}=e;if(e.moduleId==null)return{errors:[re()]};const u=vt(r,e.moduleId),p=e.moduleId??"";if(u==null)return{errors:[re()]};const d=[];if(s||d.push(O(X_,{moduleId:p})),i===null?d.push(O(ec,{moduleId:p})):d.push(O($c,{moduleId:p,celsius:i})),l===null&&"targetSpeed"in u&&u.targetSpeed!==null?d.push(O(tc,{moduleId:p})):l!==null&&d.push(O(J_,{moduleId:p,rpm:l})),[n,a,o].some(m=>m!=null&&m!==0)){i!==null&&d.push(O(Gc,{moduleId:p,celsius:i}));const m=(n??0)*3600+(a??0)*60+(o??0);d.push(O(be,{seconds:m})),d.push(O(tc,{moduleId:p})),d.push(O(ec,{moduleId:p}))}return s&&d.push(O(Q_,{moduleId:p})),le(d,t,r)},Mb=(e,t,r)=>{const{moduleId:n,profileElements:a,profileTargetLidTemp:o,profileVolume:s}=e,i=Yo(r,n);if(i===null)return{errors:[re()]};const l=t.moduleEntities[n].pythonName,u=[];i.lidOpen!==!1&&u.push(O(Wc,{moduleId:n})),o!==i.lidTargetTemp&&u.push(O(Yc,{moduleId:n,celsius:o}));const p=`${l}_task_${i.numProfilesStarted+1}`;return u.push(O(W_,{moduleId:n,profileElements:a,blockMaxVolumeUl:s,taskId:p})),le(u,t,r)},vA=()=>({lidOpen:!1,lidClosed:!1,setBlockTemperature:!1,deactivateBlockTemperature:!1,setLidTemperature:!1,deactivateLidTemperature:!1}),kA=(e,t)=>!e.lidOpen&&t.lidOpen?{lidOpen:!0}:{},PA=(e,t)=>e.lidOpen&&!t.lidOpen||e.lidOpen===null&&!t.lidOpen?{lidClosed:!0}:{},NA=(e,t)=>t==null?e.currentBlockActivity.type==="blockDeactivated":e.currentBlockActivity.type==="blockTargetTemp"&&e.currentBlockActivity.blockTargetTemp===t,CA=(e,t)=>{const r={...kA(e,t)},n={...PA(e,t)},a=!NA(e,t.blockTargetTemp),o=a&&t.blockTargetTemp===null,s=a&&t.blockTargetTemp!==null,i=e.lidTargetTemp!==t.lidTargetTemp,l=i&&t.lidTargetTemp===null,u=i&&t.lidTargetTemp!==null;return{...vA(),...r,...n,setBlockTemperature:s,deactivateBlockTemperature:o,setLidTemperature:u,deactivateLidTemperature:l}},Fb=(e,t,r)=>{const n=Yo(r,e.moduleId);if(n===null)return{errors:[re()]};if(n.currentBlockActivity.type==="profile")return{errors:[nT()]};const{lidOpen:a,lidClosed:o,setBlockTemperature:s,deactivateBlockTemperature:i,setLidTemperature:l,deactivateLidTemperature:u}=CA(n,e),{blockTargetTemp:p,lidTargetTemp:d}=e,f=[];return a&&f.push(O(ry,{moduleId:e.moduleId})),o&&f.push(O(Wc,{moduleId:e.moduleId})),i&&f.push(O(ey,{moduleId:e.moduleId})),p!==null&&s&&f.push(O(ny,{moduleId:e.moduleId,celsius:p})),u&&f.push(O(ty,{moduleId:e.moduleId})),d!==null&&l&&f.push(O(Yc,{moduleId:e.moduleId,celsius:d})),le(f,t,r)};var ju,vh;function DA(){if(vh)return ju;vh=1;var e=Na(),t=Uy(),r=qy();function n(a,o){return r(t(a,o,e),a+"")}return ju=n,ju}var Gu,kh;function MA(){if(kh)return Gu;kh=1;var e=jr(),t=sr();function r(n){return t(n)&&e(n)}return Gu=r,Gu}var Wu,Ph;function FA(){if(Ph)return Wu;Ph=1;var e=T_(),t=Fa(),r=v_(),n=E_(),a=MA(),o=Math.max;function s(i){if(!(i&&i.length))return[];var l=0;return i=e(i,function(u){if(a(u))return l=o(u.length,l),!0}),n(l,function(u){return t(i,r(u))})}return Wu=s,Wu}var Yu,Nh;function UA(){if(Nh)return Yu;Nh=1;var e=DA(),t=FA(),r=e(t);return Yu=r,Yu}var qA=UA();const VA=Ge(qA),Ub=(e,t,r)=>{const{aspirateAirGapVolume:n,aspirateDelay:a,aspirateFlowRateUlSec:o,aspiratePositionReference:s,aspirateRetractDelay:i,aspirateRetractPositionReference:l,aspirateRetractSpeed:u,aspirateRetractXOffset:p,aspirateRetractYOffset:d,aspirateRetractZOffset:f,aspirateSubmergeDelay:m,aspirateSubmergePositionReference:h,aspirateSubmergeSpeed:_,aspirateSubmergeXOffset:b,aspirateSubmergeYOffset:T,aspirateSubmergeZOffset:y,aspirateXOffset:I,aspirateYOffset:w,aspirateZOffset:E,blowoutFlowRateUlSec:A,blowoutLocation:L,changeTip:S,destLabware:g,destWells:k,dispenseAirGapVolume:v,dispenseDelay:D,dispenseFlowRateUlSec:q,dispensePositionReference:Q,dispenseRetractDelay:fe,dispenseRetractPositionReference:_e,dispenseRetractSpeed:ne,dispenseRetractXOffset:Te,dispenseRetractYOffset:Oe,dispenseRetractZOffset:Be,dispenseSubmergeDelay:Me,dispenseSubmergePositionReference:ae,dispenseSubmergeSpeed:Re,dispenseSubmergeXOffset:We,dispenseSubmergeYOffset:Fe,dispenseSubmergeZOffset:Ae,dispenseXOffset:J,dispenseYOffset:Z,dispenseZOffset:N,dropTipLocation:P,liquidClass:$,mixBeforeAspirate:F,mixInDestination:ue,pipette:V,preWetTip:G,primaryNozzle:z,pushOut:U,sourceLabware:j,nozzles:me,sourceWells:xe,tipRack:rt,tipTracking:je,tiprackSelected:he,tipsSelected:nt,touchTipAfterAspirate:yt,touchTipAfterAspirateMmFromEdge:kt,touchTipAfterAspirateOffsetMmFromTop:bt,touchTipAfterAspirateSpeed:Ne,touchTipAfterDispense:at,touchTipAfterDispenseMmFromEdge:Se,touchTipAfterDispenseOffsetMmFromTop:Ce,touchTipAfterDispenseSpeed:Ue,volume:oe,stepNumber:se}=e,{pipetteEntities:Pt,trashBinEntities:Ke,wasteChuteEntities:X,labwareEntities:Ie}=t,Tr=Bn(Ie,X,Ke,g),ot=Ie[j]?.def.parameters.quirks?.includes("touchTipDisabled");if(!(Tr==="labware"&&k!=null&&xe.length===k.length||(Tr==="wasteChute"||Tr==="trashBin")&&k==null&&xe.length>=1))throw new Error(`Transfer command creator expected N:N source-to-dest wells ratio. Got ${xe.length}:${k?.length} in labware`);const He="transfer",Ee=[];(!r.pipettes[V]||!Pt[V])&&Ee.push(ft({pipette:V})),(!j||!r.labware[j])&&Ee.push(mt({actionName:He,labware:j}));const st=r.labware[g]!=null?K(r.labware[g].stack):"",Zr=K(r.labware[j]?.stack),Nt=Object.keys(X).length>0,to=X[P]!=null,Xr=Ke[P]!=null;Nt&&(st===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA||Zr===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)&&Ee.push(va());const lr=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],Ze=lr.length>0?lr[0]:null,te=Object.values(t.labwareEntities).find(({labwareDefURI:ce})=>ce===P),Ct=te!=null&&c.getIsTiprack(te.def),Le=r.tipState.pipettes[V]?.hasTip;if(P==null||Ct&&Ze==null&&S!=="never"&&Le||!Ct&&!to&&!Xr)return{errors:[Cn()]};(!g||!Ie[g]&&!X[g]&&!Ke[g])&&Ee.push(qh());let ct,ee;if(S==="never"){const ce=r.tipState.pipettes[V]?.tiprackURI;ct=t.labwareEntities[ce??""],ee=ct?.labwareDefURI}else ct=Object.values(Ie).find(({labwareDefURI:ce})=>ce===rt),ee=rt;if(ct==null&&(S==="never"?Ee.push(zt({actionName:He,pipette:V})):Ee.push(mt({actionName:He,labware:ee}))),Ee.length>0)return{errors:Ee};const W=n||0,pt=v||0,ye=Wo(V,t,ee)-W;if(ye<=0||!isFinite(ye))return Ee.push(mo({volume:oe,maxVolume:ye,actionName:He})),{errors:Ee};const it=Math.ceil(oe/ye);if(!isFinite(it)||it<=0)return Ee.push(mo({volume:oe,maxVolume:it,actionName:He})),{errors:Ee};const Gt=oe/it,Dt=Array(it).fill(Gt),Qr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[h],offset:{x:b,y:T,z:y}},ur={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[l],offset:{x:p,y:d,z:f}},Ir={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[ae],offset:{x:We,y:Fe,z:Ae}},cr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[_e],offset:{x:Te,y:Oe,z:Be}},{spec:ve,name:Mt,pythonName:Er}=Pt[V],{tipracks:gr}=Ja(V,ee,t,r,z,me),Jr=c.getAllLiquidClassDefs()[$===c.NONE_LIQUID_CLASS_NAME||$==null?c.WATER_LIQUID_CLASS_NAME:$].byPipette?.find(({pipetteModel:ce})=>ce===c.getFlexNameConversion(ve))?.byTipType.find(({tiprack:ce})=>ce===ee)??null,wr=c.getByVolumeValue({liquidClass:$,pipetteSpecs:ve,tiprackDefUri:ee,targetVolume:Gt,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,en=c.getByVolumeValue({liquidClass:$,pipetteSpecs:ve,tiprackDefUri:ee,targetVolume:Gt,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,tn=Ke[g]?.pythonName??X[g]?.pythonName,rn=Ke[P]?.pythonName??X[P]?.pythonName,nn=L==null?null:Ke[L]?.pythonName??X[L]?.pythonName,Xn=Ie[j].pythonName,an=Ie[g]?.pythonName,Wt=me===c.PARTIAL_COLUMN?nr({labwareDef:Ie[j].def,wells:xe,primaryNozzle:z}):xe,on=me===c.PARTIAL_COLUMN&&k!=null&&Ie[g]!=null?nr({labwareDef:Ie[g].def,wells:k,primaryNozzle:z}):k,sn=Wt.map(ce=>`${Xn}[${C(ce)}]`).join(", "),ln=on!=null&&an!=null?on.map(ce=>`${an}[${C(ce)}]`).join(", "):null,Qn=[`name=${C(`${e.commandCreatorFnName}_step_${se}`)}`,...$!=null?[`base_liquid_class=${Xa($,!0)}`]:[],`properties=${zo({args:e,pipetteName:c.isFlexPipette(Mt)?c.getFlexNameConversion(ve):Mt,tiprackUri:ee,liquidClassValuesForTip:Jr})}`],Jn=`${we}.define_liquid_class(
150
- ${Y(Qn.join(`,
149
+ )`}),oa={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[m],offset:{x:_,y,z:T}},fn={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[i],offset:{x:u,y:p,z:d}},Lr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[Ve],offset:{x:je,y:ie,z:ke}},Or={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[G],offset:{x:ae,y:fe,z:J}},sa=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:ot,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,ao=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:ot,liquidHandlingAction:"multiDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??k,Se=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:He,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,me=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:He,liquidHandlingAction:"multiDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??k,It=Rb(E,pr),$t=xr({retractZOffset:d,retractPositionReference:i,labwareId:W,labwareEntities:ue,well:x}),ve=!$t&&x!=null?[R(z,{pipetteId:q,labwareId:W,wellName:x,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],ia=[...Rn(It,(he,Xe)=>{const fr=he.length,vr=Ce*fr,Pr=vr+we+st,la=Xe===0,mn=Xe===It.length-1,wt=I==="always"||I==="once"&&la,ua=c.LOW_VOLUME_PIPETTES.includes(it)?[R(kn,{pipetteId:q,volume:Pr})]:[];let mr=[];if(wt){const $e=Ut?.shift();mr=[P(ro,{pipette:q,nozzles:B,primaryNozzle:V,dropTipLocation:se&&ur!=null?ur:K,tipRack:X,...le===Ot&&$e!=null&&xe!=null?{tipSelectionArgs:{tipRackId:xe,tipWell:$e}}:{}})]}const Rr=[R(Pt,{pipetteId:q})],Zt=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:He,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Xt=O!=null?[R(Te,{seconds:O.seconds})]:[],hn=He>0&&!wt&&!la&&we===0&&L==null?[R(Je,{isAirGap:!0,pipetteId:q,volume:He,flowRate:me,...Zt>0?{correctionVolume:Zt}:{},pushOut:0}),...Xt]:[],kr=[...tn,...hn,...ua,...Rr],hr=[R(z,{pipetteId:q,labwareId:W,wellName:x,wellLocation:oa}),R(z,{pipetteId:q,labwareId:W,...h!=null?{speed:h}:{},wellName:x,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[o],offset:{x:b,y:w,z:S}}}),...f!=null&&f.seconds>0?[R(Te,{seconds:f.seconds})]:[]],_n=re?$r({pipette:q,volume:vr,times:1,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:k,aspirateDelaySeconds:n?.seconds??0,dispenseDelaySeconds:O?.seconds??0,finalPushOut:0,invariantContext:t,liquidClass:j,tiprack:X,generatePython:!1}):[],Pe=N!=null?$r({pipette:q,volume:N.volume,times:N.times,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:k,aspirateDelaySeconds:n?.seconds,dispenseDelaySeconds:O?.seconds,finalPushOut:0,invariantContext:t,liquidClass:j,tiprack:X,generatePython:!1}):[],Qt=n!=null?[R(Te,{seconds:n.seconds})]:[],Nr=We?[R(At,{pipetteId:q,labwareId:W,wellName:x,...ye!=null?{mmFromEdge:ye}:{},zOffsetFromTop:nt,...bt!=null?{speed:bt}:{}}),...ot>0&&$t?[R(z,{pipetteId:q,labwareId:W,wellName:x,wellLocation:fn})]:[]]:[],St=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:ot,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Jt=ot>0?[...ve,R(vt,{pipetteId:q,volume:ot,flowRate:sa,...St>0?{correctionVolume:St}:{}}),...Qt]:[],ca=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:Pr,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,yn=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:st,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,bn=st!=null&&st>0?[R(Je,{pipetteId:q,volume:st,flowRate:k,correctionVolume:yn,pushOut:0}),...Xt]:[],pa=[R(Ba,{pipetteId:q,volume:Pr,flowRate:a,correctionVolume:ca}),...Qt,...bn],Tn=[R(z,{pipetteId:q,labwareId:W,...l!=null?{speed:l}:{},wellName:x,wellLocation:fn}),...s!=null&&s?.seconds>0?[R(Te,{seconds:s.seconds})]:[]],Cr=Rn(he,($e,Dr)=>{const In=Dr===0,_r=Dr===he.length-1,Mr=mn&&_r;let er=0,yr=k;In&&ot>0?(er=ot,yr=ao):!In&&He>0&&st===0&&(er=He,yr=me);const fa=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:er,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,oo=xr({retractZOffset:J,retractPositionReference:G,labwareId:A,labwareEntities:ue,well:$e}),Ko=oo?[]:[R(z,{pipetteId:q,labwareId:A,wellName:$e,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],so=$e!=null?[R(z,{pipetteId:q,labwareId:A,wellName:$e,wellLocation:Lr}),...er>0?[R(Je,{isAirGap:!0,pipetteId:q,volume:er,flowRate:yr,pushOut:0,correctionVolume:fa}),...Xt]:[],R(z,{pipetteId:q,labwareId:A,...Me!=null?{speed:Me}:{},wellName:$e,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[D],offset:{x:Be,y:Ae,z:oe}}}),...Re!=null&&Re.seconds>0?[R(Te,{seconds:Re.seconds})]:[]]:[R(qe,{fixtureId:A,pipetteId:q,offset:{x:0,y:0,z:0}})],ma=we===0&&_r?Z:0,gt=[R(Je,{pipetteId:q,volume:Ce,flowRate:k,...ma!=null?{pushOut:ma}:{},correctionVolume:an}),...Xt],wn=$e!=null?[R(z,{pipetteId:q,labwareId:A,...Y!=null?{speed:Y}:{},wellName:$e,wellLocation:Or}),...M!=null&&M?.seconds>0?[R(Te,{seconds:M.seconds})]:[]]:[],qt=_r?[R(Bn,{pipetteId:q,flowRate:g})]:[],io=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:He,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Vt=(ha,Xb=!0)=>He>0&&!(Dr<he.length-1&&st>0)&&!(I==="never"&&Mr&&ha)?[...Xb?Ko:[],R(Pt,{pipetteId:q}),R(vt,{pipetteId:q,volume:He,flowRate:Se,...io>0?{correctionVolume:io}:{}}),...Qt]:[],Et=ha=>$e!=null&&kt?[R(At,{pipetteId:q,labwareId:A,wellName:$e,...Tt!=null?{mmFromEdge:Tt}:{},zOffsetFromTop:Ne,...at!=null?{speed:at}:{}}),...Vt(ha).length>0&&oo?[R(z,{pipetteId:q,labwareId:A,wellName:$e,wellLocation:Or})]:[]]:[];let Fr=[];if(L==null||!_r)Fr=[...Et(!0),...Vt(!0)];else if(L===xn)Fr=[R(z,{pipetteId:q,labwareId:A,wellName:$e,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),...qt,...Et(!0),...Vt(!0)];else if(L===Kr){const ha=Vt(!0);Fr=[...Et(!1),...Vt(!1),R(z,{pipetteId:q,labwareId:W,wellName:x,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),...qt,...kt&&!Ir?[R(At,{pipetteId:q,labwareId:W,wellName:x,...Tt!=null?{mmFromEdge:Tt}:{},zOffsetFromTop:Ne,...at!=null?{speed:at}:{}})]:[],...ha.length>0?[R(z,{pipetteId:q,labwareId:W,wellName:x,wellLocation:{origin:c.WELL_ORIGIN_TOP}})]:[],...Vt(!0,!1)]}else Fr=[...Et(!1),...Vt(!1),R(qe,{pipetteId:q,fixtureId:Object.values(ce).length>0?Object.values(ce)[0].id:Object.values(Nt)[0].id,offset:{x:0,y:0,z:0}}),...qt,...Vt(!0,!1)];return[...so,...gt,...wn,...Fr]}),da=se&&(Xe===It.length-1||I==="always")?[R(Yr,{pipette:q,dropTipLocation:X,isReturnTip:se})]:[];return[...mr,...kr,...hr,...Pe,..._n,...pa,...Tn,...Nr,...Jt,...Cr,...da]}),dn];return de(ia,t,r)},Fb=(e,t,r)=>{const{timerHours:n,timerMinutes:a,timerSeconds:o,latchOpen:s,targetTemperature:i,rpm:l}=e;if(e.moduleId==null)return{errors:[pe()]};const u=Rt(r,e.moduleId),p=e.moduleId??"";if(u==null)return{errors:[pe()]};const d=[];if(s||d.push(P(J_,{moduleId:p})),i===null?d.push(P(tc,{moduleId:p})):d.push(P(Hc,{moduleId:p,celsius:i})),l===null&&"targetSpeed"in u&&u.targetSpeed!==null?d.push(P(rc,{moduleId:p})):l!==null&&d.push(P(ty,{moduleId:p,rpm:l})),[n,a,o].some(m=>m!=null&&m!==0)){i!==null&&d.push(P(Yc,{moduleId:p,celsius:i}));const m=(n??0)*3600+(a??0)*60+(o??0);d.push(P(Te,{seconds:m})),d.push(P(rc,{moduleId:p})),d.push(P(tc,{moduleId:p}))}return s&&d.push(P(ey,{moduleId:p})),de(d,t,r)},Ub=(e,t,r)=>{const{moduleId:n,profileElements:a,profileTargetLidTemp:o,profileVolume:s}=e,i=Yo(r,n);if(i===null)return{errors:[pe()]};const l=t.moduleEntities[n].pythonName,u=[];i.lidOpen!==!1&&u.push(P(Kc,{moduleId:n})),o!==i.lidTargetTemp&&u.push(P(Zc,{moduleId:n,celsius:o}));const p=`${l}_task_${i.numProfilesStarted+1}`;return u.push(P(Y_,{moduleId:n,profileElements:a,blockMaxVolumeUl:s,taskId:p})),de(u,t,r)},NA=()=>({lidOpen:!1,lidClosed:!1,setBlockTemperature:!1,deactivateBlockTemperature:!1,setLidTemperature:!1,deactivateLidTemperature:!1}),CA=(e,t)=>!e.lidOpen&&t.lidOpen?{lidOpen:!0}:{},DA=(e,t)=>e.lidOpen&&!t.lidOpen||e.lidOpen===null&&!t.lidOpen?{lidClosed:!0}:{},MA=(e,t)=>t==null?e.currentBlockActivity.type==="blockDeactivated":e.currentBlockActivity.type==="blockTargetTemp"&&e.currentBlockActivity.blockTargetTemp===t,FA=(e,t)=>{const r={...CA(e,t)},n={...DA(e,t)},a=!MA(e,t.blockTargetTemp),o=a&&t.blockTargetTemp===null,s=a&&t.blockTargetTemp!==null,i=e.lidTargetTemp!==t.lidTargetTemp,l=i&&t.lidTargetTemp===null,u=i&&t.lidTargetTemp!==null;return{...NA(),...r,...n,setBlockTemperature:s,deactivateBlockTemperature:o,setLidTemperature:u,deactivateLidTemperature:l}},$b=(e,t,r)=>{const n=Yo(r,e.moduleId);if(n===null)return{errors:[pe()]};if(n.currentBlockActivity.type==="profile")return{errors:[oT()]};const{lidOpen:a,lidClosed:o,setBlockTemperature:s,deactivateBlockTemperature:i,setLidTemperature:l,deactivateLidTemperature:u}=FA(n,e),{blockTargetTemp:p,lidTargetTemp:d}=e,f=[];return a&&f.push(P(ay,{moduleId:e.moduleId})),o&&f.push(P(Kc,{moduleId:e.moduleId})),i&&f.push(P(ry,{moduleId:e.moduleId})),p!==null&&s&&f.push(P(oy,{moduleId:e.moduleId,celsius:p})),u&&f.push(P(ny,{moduleId:e.moduleId})),d!==null&&l&&f.push(P(Zc,{moduleId:e.moduleId,celsius:d})),de(f,t,r)};var Wu,Nh;function UA(){if(Nh)return Wu;Nh=1;var e=Da(),t=qy(),r=Vy();function n(a,o){return r(t(a,o,e),a+"")}return Wu=n,Wu}var Gu,Ch;function $A(){if(Ch)return Gu;Ch=1;var e=Gr(),t=ir();function r(n){return t(n)&&e(n)}return Gu=r,Gu}var Yu,Dh;function qA(){if(Dh)return Yu;Dh=1;var e=I_(),t=$a(),r=R_(),n=S_(),a=$A(),o=Math.max;function s(i){if(!(i&&i.length))return[];var l=0;return i=e(i,function(u){if(a(u))return l=o(u.length,l),!0}),n(l,function(u){return t(i,r(u))})}return Yu=s,Yu}var Ku,Mh;function VA(){if(Mh)return Ku;Mh=1;var e=UA(),t=qA(),r=e(t);return Ku=r,Ku}var BA=VA();const xA=Ge(BA),qb=(e,t,r)=>{const{aspirateAirGapVolume:n,aspirateDelay:a,aspirateFlowRateUlSec:o,aspiratePositionReference:s,aspirateRetractDelay:i,aspirateRetractPositionReference:l,aspirateRetractSpeed:u,aspirateRetractXOffset:p,aspirateRetractYOffset:d,aspirateRetractZOffset:f,aspirateSubmergeDelay:m,aspirateSubmergePositionReference:h,aspirateSubmergeSpeed:_,aspirateSubmergeXOffset:y,aspirateSubmergeYOffset:T,aspirateSubmergeZOffset:b,aspirateXOffset:w,aspirateYOffset:S,aspirateZOffset:g,blowoutFlowRateUlSec:L,blowoutLocation:I,changeTip:A,destLabware:E,destWells:O,dispenseAirGapVolume:k,dispenseDelay:D,dispenseFlowRateUlSec:M,dispensePositionReference:G,dispenseRetractDelay:Y,dispenseRetractPositionReference:ae,dispenseRetractSpeed:fe,dispenseRetractXOffset:J,dispenseRetractYOffset:Re,dispenseRetractZOffset:Ve,dispenseSubmergeDelay:Me,dispenseSubmergePositionReference:je,dispenseSubmergeSpeed:ie,dispenseSubmergeXOffset:ke,dispenseSubmergeYOffset:Be,dispenseSubmergeZOffset:Ae,dispenseXOffset:oe,dispenseYOffset:K,dispenseZOffset:j,dropTipLocation:N,liquidClass:B,mixBeforeAspirate:q,mixInDestination:re,pipette:V,preWetTip:Z,primaryNozzle:W,pushOut:x,sourceLabware:H,nozzles:le,sourceWells:xe,tipRack:rt,tipTracking:We,tiprackSelected:ye,tipsSelected:nt,touchTipAfterAspirate:bt,touchTipAfterAspirateMmFromEdge:kt,touchTipAfterAspirateOffsetMmFromTop:Tt,touchTipAfterAspirateSpeed:Ne,touchTipAfterDispense:at,touchTipAfterDispenseMmFromEdge:Ee,touchTipAfterDispenseOffsetMmFromTop:Ce,touchTipAfterDispenseSpeed:Fe,volume:ue,stepNumber:ce}=e,{pipetteEntities:Nt,trashBinEntities:Ke,wasteChuteEntities:te,labwareEntities:Ie}=t,Ir=Hn(Ie,te,Ke,E),ot=Ie[H]?.def.parameters.quirks?.includes("touchTipDisabled");if(!(Ir==="labware"&&O!=null&&xe.length===O.length||(Ir==="wasteChute"||Ir==="trashBin")&&O==null&&xe.length>=1))throw new Error(`Transfer command creator expected N:N source-to-dest wells ratio. Got ${xe.length}:${O?.length} in labware`);const He="transfer",we=[];(!r.pipettes[V]||!Nt[V])&&we.push(mt({pipette:V})),(!H||!r.labware[H])&&we.push(ht({actionName:He,labware:H}));const st=r.labware[E]!=null?ee(r.labware[E].stack):"",Qr=ee(r.labware[H]?.stack),Ct=Object.keys(te).length>0,no=te[N]!=null,Jr=Ke[N]!=null;Ct&&(st===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA||Qr===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)&&we.push(ka());const ur=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],Ze=ur.length>0?ur[0]:null,se=Object.values(t.labwareEntities).find(({labwareDefURI:me})=>me===N),Dt=se!=null&&c.getIsTiprack(se.def),Le=r.tipState.pipettes[V]?.hasTip;if(N==null||Dt&&Ze==null&&A!=="never"&&Le||!Dt&&!no&&!Jr)return{errors:[Mn()]};(!E||!Ie[E]&&!te[E]&&!Ke[E])&&we.push(Bh());let pt,ne;if(A==="never"){const me=r.tipState.pipettes[V]?.tiprackURI;pt=t.labwareEntities[me??""],ne=pt?.labwareDefURI}else pt=Object.values(Ie).find(({labwareDefURI:me})=>me===rt),ne=rt;if(pt==null&&(A==="never"?we.push(jt({actionName:He,pipette:V})):we.push(ht({actionName:He,labware:ne}))),we.length>0)return{errors:we};const X=n||0,dt=k||0,be=Go(V,t,ne)-X;if(be<=0||!isFinite(be))return we.push(ho({volume:ue,maxVolume:be,actionName:He})),{errors:we};const it=Math.ceil(ue/be);if(!isFinite(it)||it<=0)return we.push(ho({volume:ue,maxVolume:it,actionName:He})),{errors:we};const Gt=ue/it,Mt=Array(it).fill(Gt),en={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[h],offset:{x:y,y:T,z:b}},cr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[l],offset:{x:p,y:d,z:f}},wr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[je],offset:{x:ke,y:Be,z:Ae}},pr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[ae],offset:{x:J,y:Re,z:Ve}},{spec:Oe,name:Ft,pythonName:Sr}=Nt[V],{tipracks:gr}=to(V,ne,t,r,W,le),tn=c.getAllLiquidClassDefs()[B===c.NONE_LIQUID_CLASS_NAME||B==null?c.WATER_LIQUID_CLASS_NAME:B].byPipette?.find(({pipetteModel:me})=>me===c.getFlexNameConversion(Oe))?.byTipType.find(({tiprack:me})=>me===ne)??null,Er=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:Gt,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,rn=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:Gt,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,nn=Ke[E]?.pythonName??te[E]?.pythonName,an=Ke[N]?.pythonName??te[N]?.pythonName,on=I==null?null:Ke[I]?.pythonName??te[I]?.pythonName,Jn=Ie[H].pythonName,sn=Ie[E]?.pythonName,Yt=le===c.PARTIAL_COLUMN?ar({labwareDef:Ie[H].def,wells:xe,primaryNozzle:W}):xe,ln=le===c.PARTIAL_COLUMN&&O!=null&&Ie[E]!=null?ar({labwareDef:Ie[E].def,wells:O,primaryNozzle:W}):O,un=Yt.map(me=>`${Jn}[${F(me)}]`).join(", "),cn=ln!=null&&sn!=null?ln.map(me=>`${sn}[${F(me)}]`).join(", "):null,ea=[`name=${F(`${e.commandCreatorFnName}_step_${ce}`)}`,...B!=null?[`base_liquid_class=${Ja(B,!0)}`]:[],`properties=${zo({args:e,pipetteName:c.isFlexPipette(Ft)?c.getFlexNameConversion(Oe):Ft,tiprackUri:ne,liquidClassValuesForTip:tn})}`],ta=`${ge}.define_liquid_class(
150
+ ${Q(ea.join(`,
151
151
  `))},
152
- )`,Yt=je===Lt&&he!=null&&nt!=null&&nt.length>0?Qa({wellSets:nt,nozzles:me,channels:ve.channels,primaryNozzle:z}):null,ea=Yt!=null&&ct!=null&&me===c.PARTIAL_COLUMN?nr({labwareDef:ct?.def,wells:Yt,primaryNozzle:z}):Yt,Ft=he!=null?Ie[he]?.pythonName:null,pr=ea?.map(ce=>`${Ft}[${C(ce)}]`).join(", "),ta=[`volume=${oe}`,`source=[${sn}]`,`dest=${ln!=null?`[${ln}]`:tn}`,`new_tip=${C(Go(S))}`,...Ct?["return_tip=True",...nn!=null?[`trash_location=${nn}`]:[]]:[`trash_location=${rn}`,"keep_last_tip=True"],...ve.channels>1?["group_wells=False"]:[],...gr.filteredSortedTiprackIds.length>0?[jo({labwareEntities:Ie,tiprackIds:gr.filteredSortedTiprackIds})]:[],`liquid_class=${Jn}`,...Yt!=null&&Ft!=null?[`tips=[${pr}]`]:[]],Sr=()=>({commands:[],python:`${Er}.transfer_with_liquid_class(
153
- ${Y(ta.join(`,
152
+ )`,Kt=We===Ot&&ye!=null&&nt!=null&&nt.length>0?eo({wellSets:nt,nozzles:le,channels:Oe.channels,primaryNozzle:W}):null,ra=Kt!=null&&pt!=null&&le===c.PARTIAL_COLUMN?ar({labwareDef:pt?.def,wells:Kt,primaryNozzle:W}):Kt,Ut=ye!=null?Ie[ye]?.pythonName:null,dr=ra?.map(me=>`${Ut}[${F(me)}]`).join(", "),na=[`volume=${ue}`,`source=[${un}]`,`dest=${cn!=null?`[${cn}]`:nn}`,`new_tip=${F(Wo(A))}`,...Dt?["return_tip=True",...on!=null?[`trash_location=${on}`]:[]]:[`trash_location=${an}`,"keep_last_tip=True"],...Oe.channels>1?["group_wells=False"]:[],...gr.filteredSortedTiprackIds.length>0?[jo({labwareEntities:Ie,tiprackIds:gr.filteredSortedTiprackIds})]:[],`liquid_class=${ta}`,...Kt!=null&&Ut!=null?[`tips=[${dr}]`]:[]],Ar=()=>({commands:[],python:`${Sr}.transfer_with_liquid_class(
153
+ ${Q(na.join(`,
154
154
  `))},
155
- )`}),ra=c.getByVolumeValue({liquidClass:$,pipetteSpecs:ve,tiprackDefUri:ee,targetVolume:W,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??o,cn=c.getByVolumeValue({liquidClass:$,pipetteSpecs:ve,tiprackDefUri:ee,targetVolume:W,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??q,na=c.getByVolumeValue({liquidClass:$,pipetteSpecs:ve,tiprackDefUri:ee,targetVolume:pt,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??o,pn=c.getByVolumeValue({liquidClass:$,pipetteSpecs:ve,tiprackDefUri:ee,targetVolume:pt,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??q,Ar=VA(xe,k);let Lr=null,aa=null;const ge=[...Ar.reduce((ce,Tt,Ut)=>{const[ke,qe]=Tt,oa=Dt.reduce((pe,Xe,dr)=>{const Or=Ut===0&&dr===0,Rr=Ut+1===Ar.length,dn=dr+1===Dt.length&&Rr;let It=!1;S==="always"?It=!0:S==="once"?It=Or:S==="perSource"?It=ke!==Lr:S==="perDest"&&(It=Or||qe!==aa);const ia=c.LOW_VOLUME_PIPETTES.includes(Mt)?[R(Rn,{pipetteId:V,volume:Xe})]:[];let fr=[];if(It){const wt=Yt?.shift();fr=[O(eo,{pipette:V,primaryNozzle:z,nozzles:me,dropTipLocation:Ct&&Ze!=null?Ze:P,tipRack:ee,...me!=null?{nozzles:me}:{},...je===Lt&&wt!=null&&he!=null?{tipSelectionArgs:{tipRackId:he,tipWell:wt}}:{}})]}const vr=Ie[j]?.def.wells[ke]?.depth??null,Kt=c.getMmFromBottom(E,s,vr),Zt=c.getMmFromBottom(y,h,vr),fn=c.getMmFromBottom(f,l,vr);Kt!=null&&Zt!=null&&Kt>Zt&&Ee.push(Vh());const kr=$r({retractZOffset:f,retractPositionReference:l,labwareId:j,labwareEntities:Ie,well:ke}),mr=!kr&&ke!=null?[R(x,{pipetteId:V,labwareId:j,wellName:ke,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],mn=$r({retractZOffset:Be,retractPositionReference:_e,labwareId:g,labwareEntities:Ie,well:qe}),Pe=!mn&&qe!=null?[R(x,{pipetteId:V,labwareId:g,wellName:qe,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[];Kt!=null&&fn!=null&&Kt>fn&&Ee.push($h());const Xt=[R(x,{pipetteId:V,labwareId:j,wellName:ke,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],Pr=[R(Rt,{pipetteId:V})],Et=c.getByVolumeValue({liquidClass:$,pipetteSpecs:ve,tiprackDefUri:ee,targetVolume:pt,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Qt=D!=null?[R(be,{seconds:D.seconds})]:[],la=pt>0&&!It&&(dr>0||Ut>0)?[R(Je,{isAirGap:!0,pipetteId:V,volume:pt,flowRate:pn,...Et>0?{correctionVolume:Et}:{},pushOut:0}),...Qt]:[],hn=[...Xt,...la,...ia,...Pr],_n=[R(x,{pipetteId:V,labwareId:j,wellName:ke,wellLocation:Qr}),R(x,{pipetteId:V,labwareId:j,..._!=null?{speed:_}:{},wellName:ke,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[s],offset:{x:I,y:w,z:E}}}),...m!=null&&m.seconds>0?[R(be,{seconds:m.seconds})]:[]],ua=G?Ur({pipette:V,volume:Xe,times:1,aspirateFlowRateUlSec:o,dispenseFlowRateUlSec:q,aspirateDelaySeconds:a?.seconds??0,dispenseDelaySeconds:D?.seconds??0,finalPushOut:0,invariantContext:t,liquidClass:$,tiprack:ee,generatePython:!1}):[],yn=F!=null?Ur({pipette:V,volume:F.volume,times:F.times,aspirateFlowRateUlSec:o,dispenseFlowRateUlSec:q,aspirateDelaySeconds:a?.seconds,dispenseDelaySeconds:D?.seconds,finalPushOut:0,invariantContext:t,liquidClass:$,tiprack:ee,generatePython:!1}):[],Nr=a!=null?[R(be,{seconds:a.seconds})]:[],ca=yt?[R(St,{pipetteId:V,labwareId:j,wellName:ke,...kt!=null?{mmFromEdge:kt}:{},zOffsetFromTop:bt,...Ne!=null?{speed:Ne}:{}}),...W>0&&kr?[R(x,{pipetteId:V,labwareId:j,wellName:ke,wellLocation:ur})]:[]]:[],Ve=c.getByVolumeValue({liquidClass:$,pipetteSpecs:ve,tiprackDefUri:ee,targetVolume:W,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Cr=W>0?[...mr,R(Ot,{pipetteId:V,volume:W,flowRate:ra,...Ve>0?{correctionVolume:Ve}:{}}),...Nr]:[],bn=[R(Va,{pipetteId:V,volume:Xe,flowRate:o,...en>0?{correctionVolume:en}:{}}),...Nr],hr=[R(x,{pipetteId:V,labwareId:j,...u!=null?{speed:u}:{},wellName:ke,wellLocation:ur}),...i!=null&&i?.seconds>0?[R(be,{seconds:i.seconds})]:[]],Dr=c.getByVolumeValue({liquidClass:$,pipetteSpecs:ve,tiprackDefUri:ee,targetVolume:W,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Jt=qe!=null?[R(x,{pipetteId:V,labwareId:g,wellName:qe,wellLocation:Ir}),...W>0?[R(Je,{isAirGap:!0,pipetteId:V,volume:W,flowRate:cn,pushOut:0,...Dr>0?{correctionVolume:Dr}:{}}),...Qt]:[],R(x,{pipetteId:V,labwareId:g,...Re!=null?{speed:Re}:{},wellName:qe,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[Q],offset:{x:J,y:Z,z:N}}}),...Me!=null&&Me.seconds>0?[R(be,{seconds:Me.seconds})]:[]]:[R($e,{fixtureId:g,pipetteId:V,offset:{x:0,y:0,z:0}})],_r=ue!=null&&qe!=null?0:U,pa=[R(Je,{pipetteId:V,volume:Xe,flowRate:q,..._r!=null?{pushOut:_r}:{},...wr>0?{correctionVolume:wr}:{}}),...Qt],no=ue!=null&&qe!=null?Ur({pipette:V,volume:ue.volume,times:ue.times,aspirateFlowRateUlSec:o,dispenseFlowRateUlSec:q,aspirateDelaySeconds:a?.seconds,dispenseDelaySeconds:D?.seconds,finalPushOut:U,invariantContext:t,liquidClass:$,tiprack:ee,generatePython:!1}):[],Ko=qe!=null?[R(x,{pipetteId:V,labwareId:g,...ne!=null?{speed:ne}:{},wellName:qe,wellLocation:cr}),...fe!=null&&fe?.seconds>0?[R(be,{seconds:fe.seconds})]:[]]:[],ao=R(Vn,{pipetteId:V,flowRate:A}),da=c.getByVolumeValue({liquidClass:$,pipetteSpecs:ve,tiprackDefUri:ee,targetVolume:pt,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,gt=(wt,Mr=!0)=>pt>0&&!(S==="never"&&dn&&wt)?[...Mr?Pe:[],R(Rt,{pipetteId:V}),R(Ot,{pipetteId:V,volume:pt,flowRate:na,...da>0?{correctionVolume:da}:{}}),...Nr]:[],Tn=wt=>qe!=null&&at?[R(St,{pipetteId:V,labwareId:g,wellName:qe,...Se!=null?{mmFromEdge:Se}:{},zOffsetFromTop:Ce,...Ue!=null?{speed:Ue}:{}}),...gt(wt).length>0&&mn?[R(x,{pipetteId:V,labwareId:g,wellName:qe,wellLocation:cr})]:[]]:[];let qt=[];switch(L){case null:case void 0:qt=[...Tn(!0),...gt(!0)];break;case $n:qt=[ao,...Tn(!0),...gt(!0)];break;case Wr:qt=[...Tn(!0),...gt(!1),R(x,{pipetteId:V,labwareId:j,wellName:ke,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),ao,...at&&!ot?[R(St,{pipetteId:V,labwareId:j,wellName:ke,...Se!=null?{mmFromEdge:Se}:{},zOffsetFromTop:Ce,...Ue!=null?{speed:Ue}:{}})]:[],...gt(!0).length>0?[R(x,{pipetteId:V,labwareId:j,wellName:ke,wellLocation:{origin:c.WELL_ORIGIN_TOP}})]:[],...gt(!0,!1)];break;default:L in Ke?qt=[...Tn(!1),...gt(!1),R(Lb,{pipetteId:V,flowRate:A,trashId:L}),...gt(!0,!1)]:L in X&&(qt=[R(Ob,{pipetteId:V,flowRate:A,wasteChuteId:L}),...gt(!0,!1)]);break}const oo=Ct&&(dn||S==="always")?[R(Gr,{pipette:V,dropTipLocation:ee,isReturnTip:Ct})]:[],Vt=[...fr,...hn,..._n,...yn,...ua,...bn,...hr,...ca,...Cr,...Jt,...pa,...no,...Ko,...qt,...oo];return Lr=ke,aa=qe,[...pe,...Vt]},[]);return[...ce,...oa]},[]),Sr];return le(ge,t,r)},qb=(e,t,r)=>le([O($a,{moduleId:e.moduleId}),O(Hc,{...e,commandCreatorFnName:"vacuumSetPumpPower"})],t,r),Vb=(e,t,r)=>le([O($a,{moduleId:e.moduleId}),O(zc,{...e,commandCreatorFnName:"vacuumSetPumpPressure"})],t,r),$b=(e,t,r)=>{const{ventAfter:n}=e;return le([O($a,{moduleId:e.moduleId}),O(jc,{...e,commandCreatorFnName:"vacuumStartRunProfile",ventAfter:n})],t,r)},Bb=(e,t,r)=>{const{runtimeParameters:n}=t,a=[],o=[];if(e.task_ids.forEach(l=>{const u=B(l,n);u==null?a.push(H({parameterName:l})):o.push(u)}),a.length>0)return{errors:a};const s=`[${o.join(", ")}]`,i=`${we}.wait_for_tasks(${s})`;return{commands:[{key:M(),commandType:"waitForTasks",params:{task_ids:o}}],python:i}},xb=(e,t,r)=>{const{waitCondition:n}=e;return n==="thermocyclerProfileComplete"?$A(e,t,r):n==="vacuumProfileComplete"||n==="vacuumStateComplete"?BA(e,t,r):{errors:[LT(n)]}},$A=(e,t,r)=>{const{moduleId:n}=e,a=[],o=Yo(r,n);if(o==null)return{errors:[re()]};if(o.currentBlockActivity.type!=="profile")return{errors:[Ep()]};const{taskId:s}=o.currentBlockActivity;return s==null?{errors:[Ep()]}:(a.push(O(Bb,{task_ids:[s]})),le(a,t,r))},BA=(e,t,r)=>{const{moduleId:n}=e,a=[],o=ut(r,n);if(o==null)return{errors:[re()]};if(o.currentPumpActivity.type!=="timedHold"&&o.currentPumpActivity.type!=="profile")return{errors:[AT()]};const s=o.currentPumpActivity.taskId;return a.push(O(Bb,{task_ids:[s]})),le(a,t,r)};var Ku,Ch;function xA(){if(Ch)return Ku;Ch=1;var e=My(),t=1,r=4;function n(a){return e(a,t|r)}return Ku=n,Ku}var HA=xA();const zA=Ge(HA),Hb=["A1","B1","C1","D1","E1","F1","G1","H1","A2","B2","C2","D2","E2","F2","G2","H2","A3","B3","C3","D3","E3","F3","G3","H3","A4","B4","C4","D4","E4","F4","G4","H4","A5","B5","C5","D5","E5","F5","G5","H5","A6","B6","C6","D6","E6","F6","G6","H6","A7","B7","C7","D7","E7","F7","G7","H7","A8","B8","C8","D8","E8","F8","G8","H8","A9","B9","C9","D9","E9","F9","G9","H9","A10","B10","C10","D10","E10","F10","G10","H10","A11","B11","C11","D11","E11","F11","G11","H11","A12","B12","C12","D12","E12","F12","G12","H12"],Hr="p300SingleId",Sa="p300MultiId",fc="p100096Id",mc="sourcePlateId",hc="destPlateId",_c="troughId",jA="A1",GA="tiprack1Id",WA={isAirGap:!0},lo=c.fixture96Plate,Dh=c.fixture12Trough,uo=c.fixtureTiprack10ul,$t=c.fixtureTiprack300ul,In=c.fixtureTiprack1000ul,co=c.fixtureTiprackAdapter,zb={OT_PD_DISABLE_MODULE_RESTRICTIONS:!1};function jb(e){return Hb.reduce((t,r)=>({...t,[r]:e?Da:de}),{})}function YA(e,t){return Array.from("ABCDEFGH").map(r=>`${r}${e}`).reduce((r,n)=>({...r,[n]:t}),{})}function Gb(){const e={[mc]:{id:mc,pythonName:"mock_source_plate",labwareDefURI:c.getLabwareDefURI(lo),def:lo},[hc]:{id:hc,pythonName:"mock_dest_plate",labwareDefURI:c.getLabwareDefURI(lo),def:lo},[_c]:{id:_c,pythonName:"mock_trough",labwareDefURI:c.getLabwareDefURI(Dh),def:Dh},tiprack1Id:{id:"tiprack1Id",pythonName:"mock_tip_rack_1",labwareDefURI:c.getLabwareDefURI($t),def:$t},tiprack2Id:{id:"tiprack2Id",pythonName:"mock_tip_rack_2",labwareDefURI:c.getLabwareDefURI($t),def:$t},tiprack3Id:{id:"tiprack3Id",pythonName:"mock_tip_rack_3",labwareDefURI:c.getLabwareDefURI($t),def:$t},tiprack4AdapterId:{id:"tiprack4AdapterId",pythonName:"mock_adapter_4",labwareDefURI:c.getLabwareDefURI(co),def:co},tiprack5AdapterId:{id:"tiprack5AdapterId",pythonName:"mock_adapter_5",labwareDefURI:c.getLabwareDefURI(co),def:co},tiprack4Id:{id:"tiprack4Id",pythonName:"mock_tip_rack_4",labwareDefURI:c.getLabwareDefURI(In),def:In},tiprack5Id:{id:"tiprack5Id",pythonName:"mock_tip_rack_5",labwareDefURI:c.getLabwareDefURI(In),def:In}},t={},r={[Xu]:{id:Xu,location:"cutoutA3",pythonName:"trash_bin_1"}},n={p10SingleId:{name:"p10_single",id:"p10SingleId",pythonName:"mock_pipette_p10",tiprackDefURI:[c.getLabwareDefURI(uo)],tiprackLabwareDef:[uo],spec:c.fixtureP10SingleV2Specs},p10MultiId:{name:"p10_multi",id:"p10MultiId",tiprackDefURI:[c.getLabwareDefURI(uo)],tiprackLabwareDef:[uo],spec:c.fixtureP10MultiV2Specs,pythonName:"mock_pipette_p10_multi"},[Hr]:{name:"p300_single",id:Hr,tiprackDefURI:[c.getLabwareDefURI($t)],tiprackLabwareDef:[$t],spec:c.fixtureP300SingleV2Specs,pythonName:"mock_pipette"},[Sa]:{name:"p300_multi",id:Sa,tiprackDefURI:[c.getLabwareDefURI($t)],tiprackLabwareDef:[$t],spec:c.fixtureP300MultiV2Specs,pythonName:"mock_pipette_p300_multi"},[fc]:{name:"p1000_96",id:fc,tiprackDefURI:[c.getLabwareDefURI(In)],tiprackLabwareDef:[In],spec:c.fixtureP100096V2Specs,pythonName:"mock_pipette_p1000_96"}};return{labwareEntities:e,moduleEntities:t,pipetteEntities:n,trashBinEntities:r,wasteChuteEntities:{},stagingAreaEntities:{},gripperEntities:{},liquidEntities:{},runtimeParameters:{},config:zb}}const Kr=e=>{const{invariantContext:t,labwareLocations:r,moduleLocations:n,pipetteLocations:a,tiprackSetting:o}=e,s=Xc({invariantContext:t,labwareLocations:r,moduleLocations:n||{},pipetteLocations:a});return s.tipState.tipracks=ar(o,i=>jb(i)),s},Zn=()=>({pipetteLocations:{[Hr]:{mount:"left",tiprackId:"tiprack1Id"},[Sa]:{mount:"right",tiprackId:"tiprack1Id"}},labwareLocations:{tiprack1Id:{stack:["tiprack1Id","1"]},tiprack2Id:{stack:["tiprack2Id","5"]},tiprack4AdapterId:{stack:["tiprack4AdapterId","7"]},tiprack5AdapterId:{stack:["tiprack5AdapterId","8"]},tiprack4Id:{stack:["tiprack4Id","tiprack4AdapterId","7"]},tiprack5Id:{stack:["tiprack5Id","tiprack5AdapterId","8"]},sourcePlateId:{stack:["sourcePlateId","2"]},destPlateId:{stack:["destPlateId","3"]}},moduleLocations:{}}),Wb=()=>({pipetteLocations:{[Hr]:{mount:"left"},[Sa]:{mount:"right"}},labwareLocations:{tiprack1Id:{stack:["tiprack1Id","B1"]},tiprack2Id:{stack:["tiprack2Id","A2"]},sourcePlateId:{stack:["sourcePlateId","offDeck"]},destPlateId:{stack:["destPlateId","C2"]}},moduleLocations:{}}),Yb=e=>Kr({...Zn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}}),KA=e=>Kr({...Wb(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}}),ZA=e=>({robotState:Yb(e),warnings:[]}),XA=e=>{const t=Kr({...Zn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}});return t.tipState.pipettes[Hr]={hasTip:!0,tiprackURI:"tiprack1Id"},t},QA=e=>{const t=Kr({...Zn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0}});return t.tipState.pipettes[Hr]={hasTip:!0,tiprackURI:"tiprack1Id"},t.tipState.tipracks.tiprack1Id.A1=de,t},JA=e=>Kr({...Zn(),invariantContext:e,tiprackSetting:{tiprack1Id:!1,tiprack2Id:!1}}),eL=({temperatureModuleId:e,thermocyclerId:t})=>{const r=Gb();r.moduleEntities={[e]:{id:e,type:c.TEMPERATURE_MODULE_TYPE,model:"foo",pythonName:"mock_temperature_module_1"},[t]:{id:t,type:c.THERMOCYCLER_MODULE_TYPE,model:"foo",pythonName:"mock_thermocycler"}};const n=Kr({...Zn(),invariantContext:r,tiprackSetting:{tiprack1Id:!0}});return n.modules={[e]:{slot:"3",moduleState:{type:c.TEMPERATURE_MODULE_TYPE,status:Ca,targetTemperature:null}},[t]:{slot:"span7_8_10_11",moduleState:{type:c.THERMOCYCLER_MODULE_TYPE,currentBlockActivity:{type:"blockDeactivated"},lidTargetTemp:null,lidOpen:null,numProfilesStarted:0}}},{invariantContext:r,robotState:n}},tL=(e,t,r,n)=>{const a=zA(e);return a.modules[t].moduleState={type:c.TEMPERATURE_MODULE_TYPE,targetTemperature:n,status:r},a};exports.ABSORBANCE_READER_INITIAL_STATE=Yh;exports.AIR=Ye;exports.AIR_GAP_META=WA;exports.AIR_GAP_OFFSET_FROM_TOP=Zu;exports.AUTOMATIC=Tc;exports.BACK_LEFT_NOZZLES=u_;exports.BOTTOM_UP_LABWARE_POOL_KEYS=tr;exports.BOTTOM_UP_STORED_LABWARE_URI_KEYS=FT;exports.CLEAN=Da;exports.COLUMN_4_SLOTS=De;exports.CUSTOM_LABWARE_DICT_NAME=Co;exports.DEFAULT_BLOWOUT_WELL=jA;exports.DEFAULT_CONFIG=zb;exports.DEFAULT_PIPETTE=Hr;exports.DEST_LABWARE=hc;exports.DEST_WELL_BLOWOUT_DESTINATION=$n;exports.DIRTY=er;exports.EMPTY=de;exports.FAKE_HOPPER_LOCATION_MAP=r_;exports.FIXED_TRASH_ID=Xu;exports.FLEX_STACKER_MODULE_INITIAL_STATE=Zh;exports.FLEX_TRASH_DEF_URI=DT;exports.GRIPPER_LOCATION=Jh;exports.HEATERSHAKER_MODULE_INITIAL_STATE=Wh;exports.HOPPER_FAKE_LOCATIONS=t_;exports.HOPPER_STACKER_LOCATION=et;exports.INDENT=Ba;exports.MAGNETIC_BLOCK_INITIAL_STATE=Kh;exports.MAGNETIC_MODULE_INITIAL_STATE=zh;exports.MANUAL=Lt;exports.MAX_STACKABLE_VACUUM_SPACERS=o_;exports.MIXED_WELL_COLOR=rb;exports.MODULES_WITH_COLLISION_ISSUES=Hh;exports.MODULE_INITIAL_STATE_BY_TYPE=Qh;exports.MULTI_PIPETTE=Sa;exports.NOZZLE_STYLES=i_;exports.OFF_DECK=vn;exports.OT2_TC_SLOTS=MT;exports.OT_2_TRASH_DEF_URI=CT;exports.PAPI_VERSION=ab;exports.PD_APPLICATION_VERSION=YS;exports.PIPETTE_96=fc;exports.PRIMARY_NOZZLES=l_;exports.PROTOCOL_CONTEXT_NAME=we;exports.SLOT_LOCATIONS_TO_FAKE_HOPPER_LOCATIONS=UT;exports.SOURCE_LABWARE=mc;exports.SOURCE_WELL_BLOWOUT_DESTINATION=Wr;exports.STAGING_AREA_SLOTS=e_;exports.TEMPERATURE_APPROACHING_TARGET=bc;exports.TEMPERATURE_AT_TARGET=yc;exports.TEMPERATURE_DEACTIVATED=Ca;exports.TEMPERATURE_MODULE_INITIAL_STATE=jh;exports.THERMOCYCLER_MODULE_INITIAL_STATE=Gh;exports.TIPRACK_1=GA;exports.TOUCHED_PIPETTABLE_LABWARE=pc;exports.TROUGH_LABWARE=_c;exports.VACUUM_AT_TARGET=GT;exports.VACUUM_DEACTIVATED=jT;exports.VACUUM_DOCK_ADDRESSABLE_AREA=n_;exports.VACUUM_DOCK_DISPLAY_LOCATION=s_;exports.VACUUM_DOCK_LOCATION=Ic;exports.VACUUM_MODE_POWER=Qu;exports.VACUUM_MODE_PRESSURE=Ju;exports.VACUUM_MODULE_INITIAL_STATE=Xh;exports.VACUUM_PROGRAM_PROFILE=VT;exports.VACUUM_PROGRAM_STATE=qT;exports.VACUUM_SPACER_LOAD_NAMES=a_;exports.VACUUM_STATE_PUMP_OFF=$T;exports.VACUUM_STATE_PUMP_ON=BT;exports.VACUUM_STATE_VENT=xT;exports.VACUUM_VENT_CLOSED=Ma;exports.VACUUM_VENT_OPEN=Ec;exports.VACUUM_VENT_SET_CLOSED=zT;exports.VACUUM_VENT_SET_OPEN=HT;exports.ZERO_OFFSET=At;exports._getNextTip=wb;exports._wellContentsForLabware=qS;exports.absorbanceReaderCloseInitialize=Sb;exports.absorbanceReaderCloseLid=Po;exports.absorbanceReaderCloseRead=Ab;exports.absorbanceReaderCollision=Ha;exports.absorbanceReaderInitialize=C_;exports.absorbanceReaderOpenLid=D_;exports.absorbanceReaderRead=M_;exports.absorbanceReaderStateGetter=Kn;exports.airGapLocationHelper=VE;exports.aspirate=TE;exports.assignContainsAmongSiblings=mp;exports.blowOutInWell=Uc;exports.captureImage=F_;exports.column4StagingSlotIdFromFlexStackerShuttleAddressableArea=Ty;exports.commandCreatorsTimeline=yS;exports.comment=U_;exports.consolidate=Nb;exports.constructInvariantContextFromAnalysis=wS;exports.createEmptyLiquidState=fy;exports.createStagingAreaForInvariantContext=nc;exports.createTipLiquidState=my;exports.curryCommandCreator=O;exports.curryWithoutPython=R;exports.deactivateTemperature=V_;exports.deckSlotKeyForFlexStackerShuttleAddressableArea=xE;exports.delay=be;exports.delayLocationHelper=$E;exports.disengageMagnet=$_;exports.dispense=qc;exports.dispenseLocationHelper=UE;exports.distribute=Cb;exports.dropTip=Gr;exports.dropTipInPlace=No;exports.dropTipInTrash=vb;exports.dropTipInWasteChute=kb;exports.engageMagnet=B_;exports.enrichRobotStateForStackGraphTraversals=ww;exports.flexStackerEmpty=x_;exports.flexStackerFillItems=H_;exports.flexStackerRetrieve=z_;exports.flexStackerStateGetter=_t;exports.flexStackerStore=j_;exports.formatChangeTipArg=Go;exports.formatPyDict=Vr;exports.formatPyList=xc;exports.formatPyRuntimeValue=kn;exports.formatPyStr=C;exports.formatPyTuple=Bc;exports.formatPyValue=or;exports.formatPyWellLocation=Ht;exports.getAddressableAreaFromModule=fp;exports.getAddressableAreaNameFromLabwareLocation=yw;exports.getAllLargestStacks=By;exports.getAllProvidedAddressableAreasFromDeckConfig=xy;exports.getAllWellsForLabware=tb;exports.getCanPlaceStackableVacuumSpacer=iy;exports.getChunkForIndentingLists=Do;exports.getCommandCreatorFromStepArgs=TA;exports.getCustomLiquidClassProperties=zo;exports.getCutoutFromSlot=yb;exports.getCutoutIdByAddressableArea=ly;exports.getDefaultPrimaryNozzle=bo;exports.getDefineLiquids=cb;exports.getDispenseAirGapLocation=hy;exports.getFlexStackerCutoutBaseDeckSlotId=Qc;exports.getFlexStackerShuttleAddressableArea=Fo;exports.getFullStackFromLabwares=Uo;exports.getFullStackFromNodeTopDownRecursive=Ho;exports.getHasNoWellsFromCCArgs=TS;exports.getInitialRobotStateStandard=Yb;exports.getInitialRobotStateWithOffDeckLabwareStandard=KA;exports.getIsHeaterShakerEastWestMultiChannelPipette=Wn;exports.getIsHeaterShakerEastWestWithLatchOpen=Gn;exports.getIsHeaterShakerNorthSouthOfNonTiprackWithMultiChannelPipette=Ya;exports.getIsInPipettableLocation=Sy;exports.getIsLabwareCompatibleWithStack=Ey;exports.getIsRetractSafeForAirGap=$r;exports.getIsSafePickupWithinTiprack=bp;exports.getIsSlotAHopper=gy;exports.getIsSlotAVacuumDock=Ia;exports.getIsSpaceInHopper=rp;exports.getIsStackableVacuumSpacer=Ta;exports.getIsTallLabwareEastWestOfHeaterShaker=Jy;exports.getIsVacuumSpacer=ay;exports.getIsVacuumSpacerSeat=oy;exports.getLabwareHasLid=wy;exports.getLabwareHasLiquid=yy;exports.getLabwareIdOnShuttle=ep;exports.getLabwareSlot=Hn;exports.getLargestStackContainingLabware=$y;exports.getLargestStackInSlot=ba;exports.getLiquidClassName=Xa;exports.getLiquidIdsOnLabware=BS;exports.getLiquidIdsOnLabwareStack=$S;exports.getLoadAdapters=sb;exports.getLoadLabware=lb;exports.getLoadLidStacks=ib;exports.getLoadLiquidClasses=db;exports.getLoadLiquids=pb;exports.getLoadModules=ob;exports.getLoadPipettes=ub;exports.getLoadTrashBins=fb;exports.getLoadWasteChute=mb;exports.getLocationTotalVolume=yr;exports.getModuleHasLiveTask=zn;exports.getModuleIdFromRobotStateStack=xa;exports.getModuleLocationSlot=BE;exports.getModuleState=vt;exports.getNearestParentInStack=by;exports.getNextRobotStateAndWarnings=_p;exports.getNextRobotStateAndWarningsSingleCommand=Qy;exports.getNextTiprack=Ja;exports.getNodeParentModuleId=hw;exports.getNozzleConfig=yp;exports.getPipetteCenteringFullOffset=Ib;exports.getPipetteIdFromCCArgs=bS;exports.getPipetteMovementSafetyStatus=ht;exports.getPipetteWithTipMaxVol=Wo;exports.getProvidedAddressableAreasExposed=bw;exports.getPythonAssignTipRacksString=jo;exports.getResultingTimelineFrameFromRunCommands=AS;exports.getRobotInitialStateNoTipsRemain=JA;exports.getRobotStateAndWarningsStandard=ZA;exports.getRobotStatePickedUpTipStandard=QA;exports.getRobotStateWithTipStandard=XA;exports.getRunTimeParameters=aA;exports.getSetStoredLabware=_b;exports.getSlotInLocationStack=K;exports.getStackForLabwareLocation=rc;exports.getStackableVacuumSpacerLoadNamesInStack=sy;exports.getStackedOnNodeFromPdStack=Hy;exports.getStateAndContextTempTCModules=eL;exports.getTargetTipsFromWellSets=Qa;exports.getThermocyclerProfileRepetitionsForPython=Eb;exports.getTipColumn=YA;exports.getTipColumnIndex=dc;exports.getTipColumnName=Tp;exports.getTipRowName=wn;exports.getTiprackHasTips=_y;exports.getTiprackTipstate=jb;exports.getTopLocationInStack=Mo;exports.getTopmostLabwareOnModuleFromStackRobotState=zE;exports.getTransferPlanAndReferenceVolumes=Jc;exports.getTrashBinAddressableAreaName=Kc;exports.getTrashLocationFromAddressableAreaName=cy;exports.getTrashOrLabware=Bn;exports.getVolumesPerLiquid=VS;exports.getWasteChuteAddressableAreaNamePip=uy;exports.getWellsForTips=Zc;exports.heaterShaker=Db;exports.indentPyLines=Y;exports.labwareMatchesLabwareInHopper=tp;exports.makeContext=Gb;exports.makeInitialRobotState=Xc;exports.makeState=Kr;exports.makeStateArgsLabwareOffDeck=Wb;exports.makeStateArgsStandard=Zn;exports.mergeLiquid=br;exports.mix=Pb;exports.mixBlowoutLocationHelper=dy;exports.modulePipetteCollision=jn;exports.moveHelper=qE;exports.moveLabware=G_;exports.moveToAddressableArea=$e;exports.moveToAddressableAreaForDropTip=Vc;exports.pipetteAdjacentHeaterShakerWhileShaking=Yn;exports.pipetteIntoHeaterShakerLatchOpen=Ka;exports.pipetteIntoHeaterShakerWhileShaking=Za;exports.pythonCustomLabwareDict=rA;exports.pythonDefRun=tA;exports.pythonImports=KS;exports.pythonMetadata=ZS;exports.pythonRequirements=XS;exports.pythonRuntimeString=ac;exports.reduceCommandCreators=le;exports.repeatArray=py;exports.replaceTip=eo;exports.resolveAllowedRuntimeValue=fo;exports.resolveBooleanRuntimeValue=qo;exports.resolveDeckSlotKeyForLabwareStackInSlot=Iy;exports.resolveNumericRuntimeValue=ie;exports.resolveRuntimeWellLocation=Pn;exports.resolveStringRuntimeValue=B;exports.robotWithStatusAndTemp=tL;exports.setTemperature=$c;exports.sortLabwareBySlot=gb;exports.splitLiquid=rr;exports.stepCommands=hb;exports.swatchColors=nb;exports.thermocyclerPipetteCollision=Ga;exports.thermocyclerProfileStep=Mb;exports.thermocyclerStateGetter=Yo;exports.thermocyclerStateStep=Fb;exports.tiprackWellNamesFlat=Hb;exports.touchTip=St;exports.transfer=Ub;exports.unrollThermocyclerProfile=Ip;exports.uuid=M;exports.vacuumCloseVent=$a;exports.vacuumCloseVentSetPumpPower=qb;exports.vacuumCloseVentSetPumpPressure=Vb;exports.vacuumCloseVentStartProfile=$b;exports.vacuumModuleStateGetter=ut;exports.vacuumOpenVent=Y_;exports.vacuumSetPumpPower=Hc;exports.vacuumSetPumpPressure=zc;exports.vacuumStartRunProfile=jc;exports.vacuumStopPump=Z_;exports.waitForModuleTask=xb;exports.waitForTemperature=Gc;exports.wellFillFromWellContents=HS;
155
+ )`}),aa=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:X,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??o,dn=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:X,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??M,oa=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:dt,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??o,fn=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:dt,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??M,Lr=xA(xe,O);let Or=null,sa=null;const Se=[...Lr.reduce((me,It,$t)=>{const[ve,Ue]=It,ia=Mt.reduce((he,Xe,fr)=>{const vr=$t===0&&fr===0,Pr=$t+1===Lr.length,mn=fr+1===Mt.length&&Pr;let wt=!1;A==="always"?wt=!0:A==="once"?wt=vr:A==="perSource"?wt=ve!==Or:A==="perDest"&&(wt=vr||Ue!==sa);const ua=c.LOW_VOLUME_PIPETTES.includes(Ft)?[R(kn,{pipetteId:V,volume:Xe})]:[];let mr=[];if(wt){const Et=Kt?.shift();mr=[P(ro,{pipette:V,primaryNozzle:W,nozzles:le,dropTipLocation:Dt&&Ze!=null?Ze:N,tipRack:ne,...le!=null?{nozzles:le}:{},...We===Ot&&Et!=null&&ye!=null?{tipSelectionArgs:{tipRackId:ye,tipWell:Et}}:{}})]}const Rr=Ie[H]?.def.wells[ve]?.depth??null,Zt=c.getMmFromBottom(g,s,Rr),Xt=c.getMmFromBottom(b,h,Rr),hn=c.getMmFromBottom(f,l,Rr);Zt!=null&&Xt!=null&&Zt>Xt&&we.push(xh());const kr=xr({retractZOffset:f,retractPositionReference:l,labwareId:H,labwareEntities:Ie,well:ve}),hr=!kr&&ve!=null?[R(z,{pipetteId:V,labwareId:H,wellName:ve,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],_n=xr({retractZOffset:Ve,retractPositionReference:ae,labwareId:E,labwareEntities:Ie,well:Ue}),Pe=!_n&&Ue!=null?[R(z,{pipetteId:V,labwareId:E,wellName:Ue,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[];Zt!=null&&hn!=null&&Zt>hn&&we.push(Hh());const Qt=[R(z,{pipetteId:V,labwareId:H,wellName:ve,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],Nr=[R(Pt,{pipetteId:V})],St=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:dt,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Jt=D!=null?[R(Te,{seconds:D.seconds})]:[],ca=dt>0&&!wt&&(fr>0||$t>0)?[R(Je,{isAirGap:!0,pipetteId:V,volume:dt,flowRate:fn,...St>0?{correctionVolume:St}:{},pushOut:0}),...Jt]:[],yn=[...Qt,...ca,...ua,...Nr],bn=[R(z,{pipetteId:V,labwareId:H,wellName:ve,wellLocation:en}),R(z,{pipetteId:V,labwareId:H,..._!=null?{speed:_}:{},wellName:ve,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[s],offset:{x:w,y:S,z:g}}}),...m!=null&&m.seconds>0?[R(Te,{seconds:m.seconds})]:[]],pa=Z?$r({pipette:V,volume:Xe,times:1,aspirateFlowRateUlSec:o,dispenseFlowRateUlSec:M,aspirateDelaySeconds:a?.seconds??0,dispenseDelaySeconds:D?.seconds??0,finalPushOut:0,invariantContext:t,liquidClass:B,tiprack:ne,generatePython:!1}):[],Tn=q!=null?$r({pipette:V,volume:q.volume,times:q.times,aspirateFlowRateUlSec:o,dispenseFlowRateUlSec:M,aspirateDelaySeconds:a?.seconds,dispenseDelaySeconds:D?.seconds,finalPushOut:0,invariantContext:t,liquidClass:B,tiprack:ne,generatePython:!1}):[],Cr=a!=null?[R(Te,{seconds:a.seconds})]:[],da=bt?[R(At,{pipetteId:V,labwareId:H,wellName:ve,...kt!=null?{mmFromEdge:kt}:{},zOffsetFromTop:Tt,...Ne!=null?{speed:Ne}:{}}),...X>0&&kr?[R(z,{pipetteId:V,labwareId:H,wellName:ve,wellLocation:cr})]:[]]:[],$e=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:X,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Dr=X>0?[...hr,R(vt,{pipetteId:V,volume:X,flowRate:aa,...$e>0?{correctionVolume:$e}:{}}),...Cr]:[],In=[R(Ba,{pipetteId:V,volume:Xe,flowRate:o,...rn>0?{correctionVolume:rn}:{}}),...Cr],_r=[R(z,{pipetteId:V,labwareId:H,...u!=null?{speed:u}:{},wellName:ve,wellLocation:cr}),...i!=null&&i?.seconds>0?[R(Te,{seconds:i.seconds})]:[]],Mr=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:X,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,er=Ue!=null?[R(z,{pipetteId:V,labwareId:E,wellName:Ue,wellLocation:wr}),...X>0?[R(Je,{isAirGap:!0,pipetteId:V,volume:X,flowRate:dn,pushOut:0,...Mr>0?{correctionVolume:Mr}:{}}),...Jt]:[],R(z,{pipetteId:V,labwareId:E,...ie!=null?{speed:ie}:{},wellName:Ue,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[G],offset:{x:oe,y:K,z:j}}}),...Me!=null&&Me.seconds>0?[R(Te,{seconds:Me.seconds})]:[]]:[R(qe,{fixtureId:E,pipetteId:V,offset:{x:0,y:0,z:0}})],yr=re!=null&&Ue!=null?0:x,fa=[R(Je,{pipetteId:V,volume:Xe,flowRate:M,...yr!=null?{pushOut:yr}:{},...Er>0?{correctionVolume:Er}:{}}),...Jt],oo=re!=null&&Ue!=null?$r({pipette:V,volume:re.volume,times:re.times,aspirateFlowRateUlSec:o,dispenseFlowRateUlSec:M,aspirateDelaySeconds:a?.seconds,dispenseDelaySeconds:D?.seconds,finalPushOut:x,invariantContext:t,liquidClass:B,tiprack:ne,generatePython:!1}):[],Ko=Ue!=null?[R(z,{pipetteId:V,labwareId:E,...fe!=null?{speed:fe}:{},wellName:Ue,wellLocation:pr}),...Y!=null&&Y?.seconds>0?[R(Te,{seconds:Y.seconds})]:[]]:[],so=R(Bn,{pipetteId:V,flowRate:L}),ma=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:dt,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,gt=(Et,Fr=!0)=>dt>0&&!(A==="never"&&mn&&Et)?[...Fr?Pe:[],R(Pt,{pipetteId:V}),R(vt,{pipetteId:V,volume:dt,flowRate:oa,...ma>0?{correctionVolume:ma}:{}}),...Cr]:[],wn=Et=>Ue!=null&&at?[R(At,{pipetteId:V,labwareId:E,wellName:Ue,...Ee!=null?{mmFromEdge:Ee}:{},zOffsetFromTop:Ce,...Fe!=null?{speed:Fe}:{}}),...gt(Et).length>0&&_n?[R(z,{pipetteId:V,labwareId:E,wellName:Ue,wellLocation:pr})]:[]]:[];let qt=[];switch(I){case null:case void 0:qt=[...wn(!0),...gt(!0)];break;case xn:qt=[so,...wn(!0),...gt(!0)];break;case Kr:qt=[...wn(!0),...gt(!1),R(z,{pipetteId:V,labwareId:H,wellName:ve,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),so,...at&&!ot?[R(At,{pipetteId:V,labwareId:H,wellName:ve,...Ee!=null?{mmFromEdge:Ee}:{},zOffsetFromTop:Ce,...Fe!=null?{speed:Fe}:{}})]:[],...gt(!0).length>0?[R(z,{pipetteId:V,labwareId:H,wellName:ve,wellLocation:{origin:c.WELL_ORIGIN_TOP}})]:[],...gt(!0,!1)];break;default:I in Ke?qt=[...wn(!1),...gt(!1),R(vb,{pipetteId:V,flowRate:L,trashId:I}),...gt(!0,!1)]:I in te&&(qt=[R(Pb,{pipetteId:V,flowRate:L,wasteChuteId:I}),...gt(!0,!1)]);break}const io=Dt&&(mn||A==="always")?[R(Yr,{pipette:V,dropTipLocation:ne,isReturnTip:Dt})]:[],Vt=[...mr,...yn,...bn,...Tn,...pa,...In,..._r,...da,...Dr,...er,...fa,...oo,...Ko,...qt,...io];return Or=ve,sa=Ue,[...he,...Vt]},[]);return[...me,...ia]},[]),Ar];return de(Se,t,r)},Vb=(e,t,r)=>de([P(xa,{moduleId:e.moduleId}),P(jc,{...e,commandCreatorFnName:"vacuumSetPumpPower"})],t,r),Bb=(e,t,r)=>de([P(xa,{moduleId:e.moduleId}),P(Wc,{...e,commandCreatorFnName:"vacuumSetPumpPressure"})],t,r),xb=(e,t,r)=>{const{ventAfter:n}=e;return de([P(xa,{moduleId:e.moduleId}),P(Gc,{...e,commandCreatorFnName:"vacuumStartRunProfile",ventAfter:n})],t,r)},Hb=(e,t,r)=>{const{runtimeParameters:n}=t,a=[],o=[];if(e.task_ids.forEach(l=>{const u=v(l,n);u==null?a.push(C({parameterName:l})):o.push(u)}),a.length>0)return{errors:a};const s=`[${o.join(", ")}]`,i=`${ge}.wait_for_tasks(${s})`;return{commands:[{key:$(),commandType:"waitForTasks",params:{task_ids:o}}],python:i}},zb=(e,t,r)=>{const{waitCondition:n}=e;return n==="thermocyclerProfileComplete"?HA(e,t,r):n==="vacuumProfileComplete"||n==="vacuumStateComplete"?zA(e,t,r):{errors:[vT(n)]}},HA=(e,t,r)=>{const{moduleId:n}=e,a=[],o=Yo(r,n);if(o==null)return{errors:[pe()]};if(o.currentBlockActivity.type!=="profile")return{errors:[gp()]};const{taskId:s}=o.currentBlockActivity;return s==null?{errors:[gp()]}:(a.push(P(Hb,{task_ids:[s]})),de(a,t,r))},zA=(e,t,r)=>{const{moduleId:n}=e,a=[],o=ct(r,n);if(o==null)return{errors:[pe()]};if(o.currentPumpActivity.type!=="timedHold"&&o.currentPumpActivity.type!=="profile")return{errors:[OT()]};const s=o.currentPumpActivity.taskId;return a.push(P(Hb,{task_ids:[s]})),de(a,t,r)};var Zu,Fh;function jA(){if(Fh)return Zu;Fh=1;var e=Uy(),t=1,r=4;function n(a){return e(a,t|r)}return Zu=n,Zu}var WA=jA();const GA=Ge(WA),jb=["A1","B1","C1","D1","E1","F1","G1","H1","A2","B2","C2","D2","E2","F2","G2","H2","A3","B3","C3","D3","E3","F3","G3","H3","A4","B4","C4","D4","E4","F4","G4","H4","A5","B5","C5","D5","E5","F5","G5","H5","A6","B6","C6","D6","E6","F6","G6","H6","A7","B7","C7","D7","E7","F7","G7","H7","A8","B8","C8","D8","E8","F8","G8","H8","A9","B9","C9","D9","E9","F9","G9","H9","A10","B10","C10","D10","E10","F10","G10","H10","A11","B11","C11","D11","E11","F11","G11","H11","A12","B12","C12","D12","E12","F12","G12","H12"],jr="p300SingleId",La="p300MultiId",mc="p100096Id",hc="sourcePlateId",_c="destPlateId",yc="troughId",YA="A1",KA="tiprack1Id",ZA={isAirGap:!0},co=c.fixture96Plate,Uh=c.fixture12Trough,po=c.fixtureTiprack10ul,Bt=c.fixtureTiprack300ul,Sn=c.fixtureTiprack1000ul,fo=c.fixtureTiprackAdapter,Wb={OT_PD_DISABLE_MODULE_RESTRICTIONS:!1};function Gb(e){return jb.reduce((t,r)=>({...t,[r]:e?Fa:_e}),{})}function XA(e,t){return Array.from("ABCDEFGH").map(r=>`${r}${e}`).reduce((r,n)=>({...r,[n]:t}),{})}function Yb(){const e={[hc]:{id:hc,pythonName:"mock_source_plate",labwareDefURI:c.getLabwareDefURI(co),def:co},[_c]:{id:_c,pythonName:"mock_dest_plate",labwareDefURI:c.getLabwareDefURI(co),def:co},[yc]:{id:yc,pythonName:"mock_trough",labwareDefURI:c.getLabwareDefURI(Uh),def:Uh},tiprack1Id:{id:"tiprack1Id",pythonName:"mock_tip_rack_1",labwareDefURI:c.getLabwareDefURI(Bt),def:Bt},tiprack2Id:{id:"tiprack2Id",pythonName:"mock_tip_rack_2",labwareDefURI:c.getLabwareDefURI(Bt),def:Bt},tiprack3Id:{id:"tiprack3Id",pythonName:"mock_tip_rack_3",labwareDefURI:c.getLabwareDefURI(Bt),def:Bt},tiprack4AdapterId:{id:"tiprack4AdapterId",pythonName:"mock_adapter_4",labwareDefURI:c.getLabwareDefURI(fo),def:fo},tiprack5AdapterId:{id:"tiprack5AdapterId",pythonName:"mock_adapter_5",labwareDefURI:c.getLabwareDefURI(fo),def:fo},tiprack4Id:{id:"tiprack4Id",pythonName:"mock_tip_rack_4",labwareDefURI:c.getLabwareDefURI(Sn),def:Sn},tiprack5Id:{id:"tiprack5Id",pythonName:"mock_tip_rack_5",labwareDefURI:c.getLabwareDefURI(Sn),def:Sn}},t={},r={[Qu]:{id:Qu,location:"cutoutA3",pythonName:"trash_bin_1"}},n={p10SingleId:{name:"p10_single",id:"p10SingleId",pythonName:"mock_pipette_p10",tiprackDefURI:[c.getLabwareDefURI(po)],tiprackLabwareDef:[po],spec:c.fixtureP10SingleV2Specs},p10MultiId:{name:"p10_multi",id:"p10MultiId",tiprackDefURI:[c.getLabwareDefURI(po)],tiprackLabwareDef:[po],spec:c.fixtureP10MultiV2Specs,pythonName:"mock_pipette_p10_multi"},[jr]:{name:"p300_single",id:jr,tiprackDefURI:[c.getLabwareDefURI(Bt)],tiprackLabwareDef:[Bt],spec:c.fixtureP300SingleV2Specs,pythonName:"mock_pipette"},[La]:{name:"p300_multi",id:La,tiprackDefURI:[c.getLabwareDefURI(Bt)],tiprackLabwareDef:[Bt],spec:c.fixtureP300MultiV2Specs,pythonName:"mock_pipette_p300_multi"},[mc]:{name:"p1000_96",id:mc,tiprackDefURI:[c.getLabwareDefURI(Sn)],tiprackLabwareDef:[Sn],spec:c.fixtureP100096V2Specs,pythonName:"mock_pipette_p1000_96"}};return{labwareEntities:e,moduleEntities:t,pipetteEntities:n,trashBinEntities:r,wasteChuteEntities:{},stagingAreaEntities:{},gripperEntities:{},liquidEntities:{},runtimeParameters:{},config:Wb}}const Xr=e=>{const{invariantContext:t,labwareLocations:r,moduleLocations:n,pipetteLocations:a,tiprackSetting:o}=e,s=Jc({invariantContext:t,labwareLocations:r,moduleLocations:n||{},pipetteLocations:a});return s.tipState.tipracks=or(o,i=>Gb(i)),s},Qn=()=>({pipetteLocations:{[jr]:{mount:"left",tiprackId:"tiprack1Id"},[La]:{mount:"right",tiprackId:"tiprack1Id"}},labwareLocations:{tiprack1Id:{stack:["tiprack1Id","1"]},tiprack2Id:{stack:["tiprack2Id","5"]},tiprack4AdapterId:{stack:["tiprack4AdapterId","7"]},tiprack5AdapterId:{stack:["tiprack5AdapterId","8"]},tiprack4Id:{stack:["tiprack4Id","tiprack4AdapterId","7"]},tiprack5Id:{stack:["tiprack5Id","tiprack5AdapterId","8"]},sourcePlateId:{stack:["sourcePlateId","2"]},destPlateId:{stack:["destPlateId","3"]}},moduleLocations:{}}),Kb=()=>({pipetteLocations:{[jr]:{mount:"left"},[La]:{mount:"right"}},labwareLocations:{tiprack1Id:{stack:["tiprack1Id","B1"]},tiprack2Id:{stack:["tiprack2Id","A2"]},sourcePlateId:{stack:["sourcePlateId","offDeck"]},destPlateId:{stack:["destPlateId","C2"]}},moduleLocations:{}}),Zb=e=>Xr({...Qn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}}),QA=e=>Xr({...Kb(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}}),JA=e=>({robotState:Zb(e),warnings:[]}),eL=e=>{const t=Xr({...Qn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}});return t.tipState.pipettes[jr]={hasTip:!0,tiprackURI:"tiprack1Id"},t},tL=e=>{const t=Xr({...Qn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0}});return t.tipState.pipettes[jr]={hasTip:!0,tiprackURI:"tiprack1Id"},t.tipState.tipracks.tiprack1Id.A1=_e,t},rL=e=>Xr({...Qn(),invariantContext:e,tiprackSetting:{tiprack1Id:!1,tiprack2Id:!1}}),nL=({temperatureModuleId:e,thermocyclerId:t})=>{const r=Yb();r.moduleEntities={[e]:{id:e,type:c.TEMPERATURE_MODULE_TYPE,model:"foo",pythonName:"mock_temperature_module_1"},[t]:{id:t,type:c.THERMOCYCLER_MODULE_TYPE,model:"foo",pythonName:"mock_thermocycler"}};const n=Xr({...Qn(),invariantContext:r,tiprackSetting:{tiprack1Id:!0}});return n.modules={[e]:{slot:"3",moduleState:{type:c.TEMPERATURE_MODULE_TYPE,status:Ma,targetTemperature:null}},[t]:{slot:"span7_8_10_11",moduleState:{type:c.THERMOCYCLER_MODULE_TYPE,currentBlockActivity:{type:"blockDeactivated"},lidTargetTemp:null,lidOpen:null,numProfilesStarted:0}}},{invariantContext:r,robotState:n}},aL=(e,t,r,n)=>{const a=GA(e);return a.modules[t].moduleState={type:c.TEMPERATURE_MODULE_TYPE,targetTemperature:n,status:r},a};exports.ABSORBANCE_READER_INITIAL_STATE=Xh;exports.AIR=Ye;exports.AIR_GAP_META=ZA;exports.AIR_GAP_OFFSET_FROM_TOP=Xu;exports.AUTOMATIC=Ic;exports.BACK_LEFT_NOZZLES=c_;exports.BOTTOM_UP_LABWARE_POOL_KEYS=rr;exports.BOTTOM_UP_STORED_LABWARE_URI_KEYS=$T;exports.CLEAN=Fa;exports.COLUMN_4_SLOTS=De;exports.CUSTOM_LABWARE_DICT_NAME=Do;exports.DEFAULT_BLOWOUT_WELL=YA;exports.DEFAULT_CONFIG=Wb;exports.DEFAULT_PIPETTE=jr;exports.DEST_LABWARE=_c;exports.DEST_WELL_BLOWOUT_DESTINATION=xn;exports.DIRTY=tr;exports.EMPTY=_e;exports.FAKE_HOPPER_LOCATION_MAP=o_;exports.FIXED_TRASH_ID=Qu;exports.FLEX_STACKER_MODULE_INITIAL_STATE=Jh;exports.FLEX_TRASH_DEF_URI=FT;exports.GRIPPER_LOCATION=r_;exports.HEATERSHAKER_MODULE_INITIAL_STATE=Zh;exports.HOPPER_FAKE_LOCATIONS=a_;exports.HOPPER_STACKER_LOCATION=et;exports.INDENT=Ha;exports.MAGNETIC_BLOCK_INITIAL_STATE=Qh;exports.MAGNETIC_MODULE_INITIAL_STATE=Gh;exports.MANUAL=Ot;exports.MAX_STACKABLE_VACUUM_SPACERS=l_;exports.MIXED_WELL_COLOR=ab;exports.MODULES_WITH_COLLISION_ISSUES=Wh;exports.MODULE_INITIAL_STATE_BY_TYPE=t_;exports.MULTI_PIPETTE=La;exports.NOZZLE_STYLES=gc;exports.OFF_DECK=Nn;exports.OT2_TC_SLOTS=UT;exports.OT_2_TRASH_DEF_URI=MT;exports.PAPI_VERSION=sb;exports.PD_APPLICATION_VERSION=XE;exports.PIPETTE_96=mc;exports.PRIMARY_NOZZLES=Ec;exports.PROTOCOL_CONTEXT_NAME=ge;exports.SLOT_LOCATIONS_TO_FAKE_HOPPER_LOCATIONS=qT;exports.SOURCE_LABWARE=hc;exports.SOURCE_WELL_BLOWOUT_DESTINATION=Kr;exports.STAGING_AREA_SLOTS=n_;exports.TEMPERATURE_APPROACHING_TARGET=Tc;exports.TEMPERATURE_AT_TARGET=bc;exports.TEMPERATURE_DEACTIVATED=Ma;exports.TEMPERATURE_MODULE_INITIAL_STATE=Yh;exports.THERMOCYCLER_MODULE_INITIAL_STATE=Kh;exports.TIPRACK_1=KA;exports.TOUCHED_PIPETTABLE_LABWARE=dc;exports.TROUGH_LABWARE=yc;exports.VACUUM_AT_TARGET=YT;exports.VACUUM_DEACTIVATED=GT;exports.VACUUM_DOCK_ADDRESSABLE_AREA=s_;exports.VACUUM_DOCK_DISPLAY_LOCATION=u_;exports.VACUUM_DOCK_LOCATION=wc;exports.VACUUM_MODE_POWER=Ju;exports.VACUUM_MODE_PRESSURE=ec;exports.VACUUM_MODULE_INITIAL_STATE=e_;exports.VACUUM_PROGRAM_PROFILE=BT;exports.VACUUM_PROGRAM_STATE=VT;exports.VACUUM_SPACER_LOAD_NAMES=i_;exports.VACUUM_STATE_PUMP_OFF=xT;exports.VACUUM_STATE_PUMP_ON=HT;exports.VACUUM_STATE_VENT=zT;exports.VACUUM_VENT_CLOSED=Ua;exports.VACUUM_VENT_OPEN=Sc;exports.VACUUM_VENT_SET_CLOSED=WT;exports.VACUUM_VENT_SET_OPEN=jT;exports.ZERO_OFFSET=Lt;exports._getNextTip=Ab;exports._wellContentsForLabware=BE;exports.absorbanceReaderCloseInitialize=Lb;exports.absorbanceReaderCloseLid=No;exports.absorbanceReaderCloseRead=Ob;exports.absorbanceReaderCollision=ja;exports.absorbanceReaderInitialize=D_;exports.absorbanceReaderOpenLid=M_;exports.absorbanceReaderRead=F_;exports.absorbanceReaderStateGetter=Xn;exports.airGapLocationHelper=Bw;exports.aspirate=ww;exports.assignContainsAmongSiblings=_p;exports.blowOutInWell=Vc;exports.captureImage=U_;exports.column4StagingSlotIdFromFlexStackerShuttleAddressableArea=wy;exports.commandCreatorsTimeline=IE;exports.comment=$_;exports.consolidate=Db;exports.constructInvariantContextFromAnalysis=LE;exports.createEmptyLiquidState=hy;exports.createStagingAreaForInvariantContext=ac;exports.createTipLiquidState=_y;exports.curryCommandCreator=P;exports.curryWithoutPython=R;exports.deactivateTemperature=V_;exports.deckSlotKeyForFlexStackerShuttleAddressableArea=zw;exports.delay=Te;exports.delayLocationHelper=xw;exports.disengageMagnet=B_;exports.dispense=Bc;exports.dispenseLocationHelper=qw;exports.distribute=Mb;exports.dropTip=Yr;exports.dropTipInPlace=Co;exports.dropTipInTrash=kb;exports.dropTipInWasteChute=Nb;exports.engageMagnet=x_;exports.enrichRobotStateForStackGraphTraversals=Ag;exports.flexStackerEmpty=H_;exports.flexStackerFillItems=z_;exports.flexStackerRetrieve=j_;exports.flexStackerStateGetter=yt;exports.flexStackerStore=W_;exports.formatChangeTipArg=Wo;exports.formatPyDict=Br;exports.formatPyList=zc;exports.formatPyRuntimeValue=Vr;exports.formatPyStr=F;exports.formatPyTuple=Z_;exports.formatPyValue=sr;exports.formatPyWellLocation=zt;exports.getAddressableAreaFromModule=hp;exports.getAddressableAreaNameFromLabwareLocation=Tg;exports.getAllLargestStacks=Hy;exports.getAllProvidedAddressableAreasFromDeckConfig=zy;exports.getAllWellsForLabware=nb;exports.getCanPlaceStackableVacuumSpacer=uy;exports.getChunkForIndentingLists=Mo;exports.getCommandCreatorFromStepArgs=SA;exports.getCustomLiquidClassProperties=zo;exports.getCutoutFromSlot=Tb;exports.getCutoutIdByAddressableArea=cy;exports.getDefaultPrimaryNozzle=To;exports.getDefineLiquids=db;exports.getDispenseAirGapLocation=yy;exports.getFlexStackerCutoutBaseDeckSlotId=ep;exports.getFlexStackerShuttleAddressableArea=Uo;exports.getFullStackFromLabwares=$o;exports.getFullStackFromNodeTopDownRecursive=Ho;exports.getHasNoWellsFromCCArgs=SE;exports.getInitialRobotStateStandard=Zb;exports.getInitialRobotStateWithOffDeckLabwareStandard=QA;exports.getIsHeaterShakerEastWestMultiChannelPipette=Kn;exports.getIsHeaterShakerEastWestWithLatchOpen=Yn;exports.getIsHeaterShakerNorthSouthOfNonTiprackWithMultiChannelPipette=Za;exports.getIsInPipettableLocation=Ly;exports.getIsLabwareCompatibleWithStack=gy;exports.getIsRetractSafeForAirGap=xr;exports.getIsSafePickupWithinTiprack=Ip;exports.getIsSlotAHopper=Ey;exports.getIsSlotAVacuumDock=Sa;exports.getIsSpaceInHopper=ap;exports.getIsStackableVacuumSpacer=wa;exports.getIsTallLabwareEastWestOfHeaterShaker=tb;exports.getIsVacuumSpacer=sy;exports.getIsVacuumSpacerSeat=iy;exports.getLabwareHasLid=Ay;exports.getLabwareHasLiquid=Ty;exports.getLabwareIdOnShuttle=rp;exports.getLabwareSlot=jn;exports.getLargestStackContainingLabware=xy;exports.getLargestStackInSlot=Ia;exports.getLiquidClassName=Ja;exports.getLiquidIdsOnLabware=zE;exports.getLiquidIdsOnLabwareStack=HE;exports.getLoadAdapters=lb;exports.getLoadLabware=cb;exports.getLoadLidStacks=ub;exports.getLoadLiquidClasses=mb;exports.getLoadLiquids=fb;exports.getLoadModules=ib;exports.getLoadPipettes=pb;exports.getLoadTrashBins=hb;exports.getLoadWasteChute=_b;exports.getLocationTotalVolume=br;exports.getModuleHasLiveTask=Wn;exports.getModuleIdFromRobotStateStack=za;exports.getModuleLocationSlot=Hw;exports.getModuleState=Rt;exports.getNearestParentInStack=Iy;exports.getNextRobotStateAndWarnings=bp;exports.getNextRobotStateAndWarningsSingleCommand=eb;exports.getNextTiprack=to;exports.getNodeParentModuleId=yg;exports.getNozzleConfig=Tp;exports.getPipetteCenteringFullOffset=Sb;exports.getPipetteIdFromCCArgs=wE;exports.getPipetteMovementSafetyStatus=_t;exports.getPipetteWithTipMaxVol=Go;exports.getProvidedAddressableAreasExposed=Ig;exports.getPythonAssignTipRacksString=jo;exports.getResultingTimelineFrameFromRunCommands=vE;exports.getRobotInitialStateNoTipsRemain=rL;exports.getRobotStateAndWarningsStandard=JA;exports.getRobotStatePickedUpTipStandard=tL;exports.getRobotStateWithTipStandard=eL;exports.getRunTimeParameters=iA;exports.getSetStoredLabware=bb;exports.getSlotInLocationStack=ee;exports.getStackForLabwareLocation=nc;exports.getStackableVacuumSpacerLoadNamesInStack=ly;exports.getStackedOnNodeFromPdStack=jy;exports.getStateAndContextTempTCModules=nL;exports.getTargetTipsFromWellSets=eo;exports.getThermocyclerProfileRepetitionsForPython=gb;exports.getTipColumn=XA;exports.getTipColumnIndex=fc;exports.getTipColumnName=wp;exports.getTipRowName=Ln;exports.getTiprackHasTips=by;exports.getTiprackTipstate=Gb;exports.getTopLocationInStack=Fo;exports.getTopmostLabwareOnModuleFromStackRobotState=Ww;exports.getTransferPlanAndReferenceVolumes=tp;exports.getTrashBinAddressableAreaName=Xc;exports.getTrashLocationFromAddressableAreaName=dy;exports.getTrashOrLabware=Hn;exports.getVolumesPerLiquid=xE;exports.getWasteChuteAddressableAreaNamePip=py;exports.getWellsForTips=Qc;exports.heaterShaker=Fb;exports.indentPyLines=Q;exports.labwareMatchesLabwareInHopper=np;exports.makeContext=Yb;exports.makeInitialRobotState=Jc;exports.makeState=Xr;exports.makeStateArgsLabwareOffDeck=Kb;exports.makeStateArgsStandard=Qn;exports.mergeLiquid=Tr;exports.mix=Cb;exports.mixBlowoutLocationHelper=my;exports.modulePipetteCollision=Gn;exports.moveHelper=Vw;exports.moveLabware=G_;exports.moveToAddressableArea=qe;exports.moveToAddressableAreaForDropTip=xc;exports.pipetteAdjacentHeaterShakerWhileShaking=Zn;exports.pipetteIntoHeaterShakerLatchOpen=Xa;exports.pipetteIntoHeaterShakerWhileShaking=Qa;exports.pythonCustomLabwareDict=oA;exports.pythonDefRun=aA;exports.pythonImports=QE;exports.pythonMetadata=JE;exports.pythonRequirements=eA;exports.pythonRuntimeString=oc;exports.reduceCommandCreators=de;exports.repeatArray=fy;exports.replaceTip=ro;exports.resolveAllowedRuntimeValue=En;exports.resolveBooleanRuntimeValue=lt;exports.resolveDeckSlotKeyForLabwareStackInSlot=Sy;exports.resolveNumericRuntimeValue=U;exports.resolveRuntimeWellLocation=Cn;exports.resolveStringRuntimeValue=v;exports.robotWithStatusAndTemp=aL;exports.setTemperature=Hc;exports.sortLabwareBySlot=Eb;exports.splitLiquid=nr;exports.stepCommands=yb;exports.swatchColors=ob;exports.thermocyclerPipetteCollision=Ya;exports.thermocyclerProfileStep=Ub;exports.thermocyclerStateGetter=Yo;exports.thermocyclerStateStep=$b;exports.tiprackWellNamesFlat=jb;exports.touchTip=At;exports.transfer=qb;exports.unrollThermocyclerProfile=Sp;exports.uuid=$;exports.vacuumCloseVent=xa;exports.vacuumCloseVentSetPumpPower=Vb;exports.vacuumCloseVentSetPumpPressure=Bb;exports.vacuumCloseVentStartProfile=xb;exports.vacuumModuleStateGetter=ct;exports.vacuumOpenVent=K_;exports.vacuumSetPumpPower=jc;exports.vacuumSetPumpPressure=Wc;exports.vacuumStartRunProfile=Gc;exports.vacuumStopPump=Q_;exports.waitForModuleTask=zb;exports.waitForTemperature=Yc;exports.wellFillFromWellContents=WE;