@opentrons/step-generation 0.3.1-alpha.0 → 0.3.3-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.
- package/README.md +1 -1
- package/lib/commandCreators/atomic/vacuumStartRunProfile.d.ts +2 -3
- package/lib/commandCreators/compound/index.d.ts +3 -0
- package/lib/commandCreators/compound/vacuumCloseVentSetPumpPower.d.ts +2 -0
- package/lib/commandCreators/compound/vacuumCloseVentSetPumpPressure.d.ts +2 -0
- package/lib/commandCreators/compound/vacuumCloseVentStartProfile.d.ts +2 -0
- package/lib/commandCreators/index.d.ts +1 -1
- package/lib/constants.d.ts +2 -2
- package/lib/errorCreators.d.ts +4 -2
- package/lib/index.cjs +69 -69
- package/lib/index.d.ts +1 -1
- package/lib/index.mjs +4892 -4647
- package/lib/types.d.ts +38 -6
- package/lib/utils/misc.d.ts +1 -0
- package/lib/utils/safePipetteMovements.d.ts +3 -3
- package/package.json +3 -3
- /package/lib/utils/__tests__/{getIsSafePipetteMovement.test.d.ts → getPipetteMovementSafetyStatus.test.d.ts} +0 -0
package/lib/index.cjs
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@opentrons/shared-data");function Cy(){return{type:"INSUFFICIENT_TIPS",message:"Not enough tips to complete action"}}function Dy(){return{type:"MISSING_96_CHANNEL_TIPRACK_ADAPTER",message:"A 96-channel cannot pick up tips fully without an adapter"}}function My(){return{type:"REMOVE_96_CHANNEL_TIPRACK_ADAPTER",message:"A 96-channel cannot pick up tips partially with an adapter"}}function Ut(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 Fy(){return{message:"One or more of the pipettes has a tip",type:"PIPETTE_HAS_TIP"}}function ut(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 ct(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 X(){return{message:"This step requires a module, but none is selected",type:"MISSING_MODULE"}}function qy(){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 xc(){return{message:"This module is not currently running a profile.",type:"MISSING_PROFILE_STEP"}}function Uy(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 Xa(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 By=()=>({type:"MOVE_LOCATION_NOT_SPECIFIED",message:"This step is missing a move location."}),pa=()=>({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."}),$y=()=>({type:"THERMOCYCLER_BUSY_WITH_PROFILE",message:"This step cannot run while the Thermocycler is running a profile. Move the step outside the profile."}),dn=()=>({type:"THERMOCYCLER_LID_CLOSED",message:"Attempted to interact with contents of a thermocycler with the lid closed."}),ts=()=>({type:"HEATER_SHAKER_LATCH_OPEN",message:"Attempted to interact with contents of a heater-shaker with the latch open."}),Hc=()=>({type:"HEATER_SHAKER_LATCH_CLOSED",message:"Attempted to move the contents of a heater-shaker with the latch closed."}),Dr=()=>({type:"ABSORBANCE_READER_LID_CLOSED",message:"Attempted to interact with contents of an absorbance plate reader with the lid closed."}),Vy=()=>({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."}),ah=()=>({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."}),xy=()=>({type:"HOPPER_EMPTY",message:"Cannot retrieve labware from empty stacker"}),Hy=()=>({type:"SHUTTLE_FULL",message:"Shuttle must be empty in order to retrieve labware from the stacker"}),jy=()=>({type:"SHUTTLE_EMPTY",message:"Shuttle must have labware in order to store it in the stacker"}),sh=()=>({type:"MISMATCHED_STACKER_LABWARE_TYPE",message:"The stacker can only store a single type of labware at a time"}),zy=()=>({type:"MISSING_STACKER_LABWARE_TYPE",message:"Add labware to the stacker in the starting deck so that you can refill it later"}),oh=()=>({type:"HOPPER_FULL",message:"The hopper has reached capacity"}),fn=()=>({type:"HEATER_SHAKER_IS_SHAKING",message:"Attempted to interact with the contents of a heater-shaker when it is shaking."}),Gy=e=>({type:"TALL_LABWARE_EAST_WEST_OF_HEATER_SHAKER",message:`Labware over 53 mm is ${e} of this Heater-Shaker module.`}),$r=()=>({type:"POSSIBLE_PIPETTE_COLLISION",message:"There is a possibility that the Pipette will collide with the a labware or module on the deck"}),da=()=>({type:"HEATER_SHAKER_EAST_WEST_LATCH_OPEN",message:"The Heater-Shaker labware latch is open"}),fa=()=>({type:"HEATER_SHAKER_NORTH_SOUTH_EAST_WEST_SHAKING",message:"The Heater-Shaker is shaking"}),ma=()=>({type:"HEATER_SHAKER_EAST_WEST_MULTI_CHANNEL",message:"The Heater-Shaker is shaking"}),rs=()=>({type:"HEATER_SHAKER_NORTH_SOUTH__OF_NON_TIPRACK_WITH_MULTI_CHANNEL",message:"8-Channel pipette cannot access labware"}),mn=()=>({type:"LABWARE_OFF_DECK",message:"Attempted to interact with labware off deck"}),Wy=()=>({type:"LABWARE_ON_ANOTHER_ENTITY",message:"Attempted to move labware onto another entity with the same slotName"}),yn=()=>({type:"DROP_TIP_LOCATION_DOES_NOT_EXIST",message:"The destination for dropping tip does not exist"}),ih=()=>({type:"EQUIPMENT_DOES_NOT_EXIST",message:"Equipment does not exist."}),Yy=()=>({type:"GRIPPER_REQUIRED",message:"The gripper is required to fulfill this action"}),Ft=e=>({type:"PIPETTING_INTO_COLUMN_4",message:`Cannot ${e.typeOfStep} into a column 4 slot.`}),Ky=()=>({type:"CANNOT_MOVE_WITH_GRIPPER",message:"The gripper cannot move aluminum blocks"}),Xy=()=>({type:"NO_TIP_SELECTED",message:"No tips were selected for this step"}),ha=()=>({type:"LABWARE_DISCARDED_IN_TRASH",message:"The labware was discarded in trash in a previous step."}),lh=()=>({type:"SUBMERGE_BELOW_ASPIRATE",message:"The submerge position must be above the aspirate position"}),uh=()=>({type:"RETRACT_BELOW_ASPIRATE",message:"The retract position must be above the aspirate position"}),Zy=()=>({type:"SUBMERGE_BELOW_DISPENSE",message:"The submerge position must be above the dispense position"}),Qy=()=>({type:"RETRACT_BELOW_DISPENSE",message:"The retract position must be above the dispense position"}),Jy=()=>({type:"MULTI_ASPIRATE_VOLUME_TOO_HIGH",message:"Consolidate pipette path was selected but cannot fit volume for more than 1 well in the tip"}),eb=()=>({type:"MULTI_DISPENSE_VOLUME_TOO_HIGH",message:"Distribute pipette path was selected but cannot fit volume for more than 1 well in the tip"}),tb=e=>({type:"CLOSING_THERMOCYCLER_WITH_INVALID_LABWARE_LID",message:`Closing the Thermocycler lid with ${e.lidDisplayName} in place will cause damage`}),jc=()=>({type:"RETURN_TIP_UNAVAILABLE",message:"Current tip does not have a known location to return to"}),rb=()=>({type:"TIPRACK_LID_NOT_ALLOWED_ON_DECK",message:"The tip rack lid is not supported directly on the deck"}),nb=()=>({type:"NEXT_TIPRACK_HAS_LID",message:"A pipette cannot pick up tips from a tip rack with a lid"}),ab=e=>({type:"STACK_TOO_HIGH",message:`The stack on slot ${e.slot} is too high`}),sb=()=>({type:"TOO_MANY_TIPS",message:"Action will pick up too many tips"}),ob=()=>({type:"INCOMPLETE_PICKUP",message:"At least one of the selected tips is empty"}),ib=()=>({type:"LABWARE_ON_HOPPER",message:"Labware cannot be moved from the Flex Stacker Hopper"}),lb=()=>({type:"MISSING_PUMP_ACTIVITY",message:"This module is not currently running a pump activity."}),ub=e=>({type:"INVALID_WAIT_CONDITION",message:`Invalid wait condition: ${e}`}),_a=()=>({type:"LIVE_TASK_ERROR",message:"This module is currently running a live task. Please wait for it to complete before performing this action."});function xe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vs,zc;function ch(){if(zc)return vs;zc=1;var e=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis;return vs=e,vs}var Ps,Gc;function Bt(){if(Gc)return Ps;Gc=1;var e=ch(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Ps=r,Ps}var Ns,Wc;function bn(){if(Wc)return Ns;Wc=1;var e=Bt(),t=e.Symbol;return Ns=t,Ns}var Cs,Yc;function cb(){if(Yc)return Cs;Yc=1;var e=bn(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,a=e?e.toStringTag:void 0;function s(o){var i=r.call(o,a),l=o[a];try{o[a]=void 0;var u=!0}catch{}var p=n.call(o);return u&&(i?o[a]=l:delete o[a]),p}return Cs=s,Cs}var Ds,Kc;function pb(){if(Kc)return Ds;Kc=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Ds=r,Ds}var Ms,Xc;function Tn(){if(Xc)return Ms;Xc=1;var e=bn(),t=cb(),r=pb(),n="[object Null]",a="[object Undefined]",s=e?e.toStringTag:void 0;function o(i){return i==null?i===void 0?a:n:s&&s in Object(i)?t(i):r(i)}return Ms=o,Ms}var Fs,Zc;function Qt(){if(Zc)return Fs;Zc=1;function e(t){return t!=null&&typeof t=="object"}return Fs=e,Fs}var qs,Qc;function ya(){if(Qc)return qs;Qc=1;var e=Tn(),t=Qt(),r="[object Symbol]";function n(a){return typeof a=="symbol"||t(a)&&e(a)==r}return qs=n,qs}var Us,Jc;function ph(){if(Jc)return Us;Jc=1;var e=ya();function t(r,n,a){for(var s=-1,o=r.length;++s<o;){var i=r[s],l=n(i);if(l!=null&&(u===void 0?l===l&&!e(l):a(l,u)))var u=l,p=i}return p}return Us=t,Us}var Bs,ep;function db(){if(ep)return Bs;ep=1;function e(t,r){return t<r}return Bs=e,Bs}var $s,tp;function ba(){if(tp)return $s;tp=1;function e(t){return t}return $s=e,$s}var Vs,rp;function fb(){if(rp)return Vs;rp=1;var e=ph(),t=db(),r=ba();function n(a){return a&&a.length?e(a,r,t):void 0}return Vs=n,Vs}var mb=fb();const hb=xe(mb),Ta="TEMPERATURE_DEACTIVATED",Xu="TEMPERATURE_AT_TARGET",Zu="TEMPERATURE_APPROACHING_TARGET",Nu=1,dh=[c.MAGNETIC_MODULE_V1,c.TEMPERATURE_MODULE_V1],Cu="fixedTrash",fh={type:c.MAGNETIC_MODULE_TYPE,engaged:!1},mh={type:c.TEMPERATURE_MODULE_TYPE,status:Ta,targetTemperature:null},hh={type:c.THERMOCYCLER_MODULE_TYPE,currentBlockActivity:{type:"blockDeactivated"},lidTargetTemp:null,lidOpen:null,numProfilesStarted:0},_h={type:c.HEATERSHAKER_MODULE_TYPE,targetTemp:null,targetSpeed:null,latchOpen:null},yh={type:"absorbanceReaderType",lidOpen:null,initialization:null},bh={type:"magneticBlockType"},Th={type:c.FLEX_STACKER_MODULE_TYPE,storedLabwareDetails:null,labwareInHopper:null,labwareOnShuttle:null,setStoredLabwareCount:1,fillCount:1},gh={type:c.VACUUM_MODULE_TYPE,ventStatus:null,numPumpActivitiesStarted:0,currentPumpActivity:{type:"pumpDeactivated"}},Ih={[c.MAGNETIC_MODULE_TYPE]:fh,[c.TEMPERATURE_MODULE_TYPE]:mh,[c.THERMOCYCLER_MODULE_TYPE]:hh,[c.HEATERSHAKER_MODULE_TYPE]:_h,[c.ABSORBANCE_READER_TYPE]:yh,[c.MAGNETIC_BLOCK_TYPE]:bh,[c.FLEX_STACKER_MODULE_TYPE]:Th,[c.VACUUM_MODULE_TYPE]:gh},_b="opentrons/opentrons_1_trash_1100ml_fixed/1",yb="opentrons/opentrons_1_trash_3200ml_fixed/1",De=["A4","B4","C4","D4"],It={x:0,y:0,z:0},Eh="mounted",ga="CLEAN",Wt="DIRTY",se="EMPTY",Qu="automatic",Et="manual",wh=["A4","B4","C4","D4"],bb=["7","8","10","11"],He="hopper",Ah=["hopperA4","hopperB4","hopperC4","hopperD4"],Sh={hopperA4:"A4",hopperB4:"B4",hopperC4:"C4",hopperD4:"D4"},Yt=["adapterLabwareId","primaryLabwareId","lidLabwareId"],Tb=["adapterLabwareURI","primaryLabwareURI","lidLabwareURI"],gb={A4:"hopperA4",B4:"hopperB4",C4:"hopperC4",D4:"hopperD4"},ns="open",Ia="closed",Du="power",Mu="pressure",Ib="state",Eb="profile",wb="pumpOff",Ab="pumpOn",Sb="vent",Lb="open",Ob="closed",Rb=.1,kb=1e3,vb="VACUUM_DEACTIVATED",Pb="VACUUM_AT_TARGET",Fe=[];for(let e=0;e<256;++e)Fe.push((e+256).toString(16).slice(1));function Nb(e,t=0){return(Fe[e[t+0]]+Fe[e[t+1]]+Fe[e[t+2]]+Fe[e[t+3]]+"-"+Fe[e[t+4]]+Fe[e[t+5]]+"-"+Fe[e[t+6]]+Fe[e[t+7]]+"-"+Fe[e[t+8]]+Fe[e[t+9]]+"-"+Fe[e[t+10]]+Fe[e[t+11]]+Fe[e[t+12]]+Fe[e[t+13]]+Fe[e[t+14]]+Fe[e[t+15]]).toLowerCase()}const Cb=new Uint8Array(16);function Db(){return crypto.getRandomValues(Cb)}function Mb(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():Fb(e,t,r)}function Fb(e,t,r){e=e||{};const n=e.random??e.rng?.()??Db();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 Nb(n)}var xs,np;function Ju(){if(np)return xs;np=1;function e(t,r){for(var n=-1,a=r.length,s=t.length;++n<a;)t[s+n]=r[n];return t}return xs=e,xs}var Hs,ap;function qb(){if(ap)return Hs;ap=1;var e=Tn(),t=Qt(),r="[object Arguments]";function n(a){return t(a)&&e(a)==r}return Hs=n,Hs}var js,sp;function as(){if(sp)return js;sp=1;var e=qb(),t=Qt(),r=Object.prototype,n=r.hasOwnProperty,a=r.propertyIsEnumerable,s=e((function(){return arguments})())?e:function(o){return t(o)&&n.call(o,"callee")&&!a.call(o,"callee")};return js=s,js}var zs,op;function Ke(){if(op)return zs;op=1;var e=Array.isArray;return zs=e,zs}var Gs,ip;function Ub(){if(ip)return Gs;ip=1;var e=bn(),t=as(),r=Ke(),n=e?e.isConcatSpreadable:void 0;function a(s){return r(s)||t(s)||!!(n&&s&&s[n])}return Gs=a,Gs}var Ws,lp;function Lh(){if(lp)return Ws;lp=1;var e=Ju(),t=Ub();function r(n,a,s,o,i){var l=-1,u=n.length;for(s||(s=t),i||(i=[]);++l<u;){var p=n[l];a>0&&s(p)?a>1?r(p,a-1,s,o,i):e(i,p):o||(i[i.length]=p)}return i}return Ws=r,Ws}var Ys,up;function Ea(){if(up)return Ys;up=1;function e(t,r){for(var n=-1,a=t==null?0:t.length,s=Array(a);++n<a;)s[n]=r(t[n],n,t);return s}return Ys=e,Ys}var Ks,cp;function Bb(){if(cp)return Ks;cp=1;function e(){this.__data__=[],this.size=0}return Ks=e,Ks}var Xs,pp;function ss(){if(pp)return Xs;pp=1;function e(t,r){return t===r||t!==t&&r!==r}return Xs=e,Xs}var Zs,dp;function os(){if(dp)return Zs;dp=1;var e=ss();function t(r,n){for(var a=r.length;a--;)if(e(r[a][0],n))return a;return-1}return Zs=t,Zs}var Qs,fp;function $b(){if(fp)return Qs;fp=1;var e=os(),t=Array.prototype,r=t.splice;function n(a){var s=this.__data__,o=e(s,a);if(o<0)return!1;var i=s.length-1;return o==i?s.pop():r.call(s,o,1),--this.size,!0}return Qs=n,Qs}var Js,mp;function Vb(){if(mp)return Js;mp=1;var e=os();function t(r){var n=this.__data__,a=e(n,r);return a<0?void 0:n[a][1]}return Js=t,Js}var eo,hp;function xb(){if(hp)return eo;hp=1;var e=os();function t(r){return e(this.__data__,r)>-1}return eo=t,eo}var to,_p;function Hb(){if(_p)return to;_p=1;var e=os();function t(r,n){var a=this.__data__,s=e(a,r);return s<0?(++this.size,a.push([r,n])):a[s][1]=n,this}return to=t,to}var ro,yp;function is(){if(yp)return ro;yp=1;var e=Bb(),t=$b(),r=Vb(),n=xb(),a=Hb();function s(o){var i=-1,l=o==null?0:o.length;for(this.clear();++i<l;){var u=o[i];this.set(u[0],u[1])}}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=r,s.prototype.has=n,s.prototype.set=a,ro=s,ro}var no,bp;function jb(){if(bp)return no;bp=1;var e=is();function t(){this.__data__=new e,this.size=0}return no=t,no}var ao,Tp;function zb(){if(Tp)return ao;Tp=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return ao=e,ao}var so,gp;function Gb(){if(gp)return so;gp=1;function e(t){return this.__data__.get(t)}return so=e,so}var oo,Ip;function Wb(){if(Ip)return oo;Ip=1;function e(t){return this.__data__.has(t)}return oo=e,oo}var io,Ep;function Jt(){if(Ep)return io;Ep=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return io=e,io}var lo,wp;function Oh(){if(wp)return lo;wp=1;var e=Tn(),t=Jt(),r="[object AsyncFunction]",n="[object Function]",a="[object GeneratorFunction]",s="[object Proxy]";function o(i){if(!t(i))return!1;var l=e(i);return l==n||l==a||l==r||l==s}return lo=o,lo}var uo,Ap;function Yb(){if(Ap)return uo;Ap=1;var e=Bt(),t=e["__core-js_shared__"];return uo=t,uo}var co,Sp;function Kb(){if(Sp)return co;Sp=1;var e=Yb(),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 co=r,co}var po,Lp;function Rh(){if(Lp)return po;Lp=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 po=r,po}var fo,Op;function Xb(){if(Op)return fo;Op=1;var e=Oh(),t=Kb(),r=Jt(),n=Rh(),a=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,o=Function.prototype,i=Object.prototype,l=o.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 _=e(f)?p:s;return _.test(n(f))}return fo=d,fo}var mo,Rp;function Zb(){if(Rp)return mo;Rp=1;function e(t,r){return t?.[r]}return mo=e,mo}var ho,kp;function Vr(){if(kp)return ho;kp=1;var e=Xb(),t=Zb();function r(n,a){var s=t(n,a);return e(s)?s:void 0}return ho=r,ho}var _o,vp;function ec(){if(vp)return _o;vp=1;var e=Vr(),t=Bt(),r=e(t,"Map");return _o=r,_o}var yo,Pp;function ls(){if(Pp)return yo;Pp=1;var e=Vr(),t=e(Object,"create");return yo=t,yo}var bo,Np;function Qb(){if(Np)return bo;Np=1;var e=ls();function t(){this.__data__=e?e(null):{},this.size=0}return bo=t,bo}var To,Cp;function Jb(){if(Cp)return To;Cp=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return To=e,To}var go,Dp;function eT(){if(Dp)return go;Dp=1;var e=ls(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function a(s){var o=this.__data__;if(e){var i=o[s];return i===t?void 0:i}return n.call(o,s)?o[s]:void 0}return go=a,go}var Io,Mp;function tT(){if(Mp)return Io;Mp=1;var e=ls(),t=Object.prototype,r=t.hasOwnProperty;function n(a){var s=this.__data__;return e?s[a]!==void 0:r.call(s,a)}return Io=n,Io}var Eo,Fp;function rT(){if(Fp)return Eo;Fp=1;var e=ls(),t="__lodash_hash_undefined__";function r(n,a){var s=this.__data__;return this.size+=this.has(n)?0:1,s[n]=e&&a===void 0?t:a,this}return Eo=r,Eo}var wo,qp;function nT(){if(qp)return wo;qp=1;var e=Qb(),t=Jb(),r=eT(),n=tT(),a=rT();function s(o){var i=-1,l=o==null?0:o.length;for(this.clear();++i<l;){var u=o[i];this.set(u[0],u[1])}}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=r,s.prototype.has=n,s.prototype.set=a,wo=s,wo}var Ao,Up;function aT(){if(Up)return Ao;Up=1;var e=nT(),t=is(),r=ec();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Ao=n,Ao}var So,Bp;function sT(){if(Bp)return So;Bp=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return So=e,So}var Lo,$p;function us(){if($p)return Lo;$p=1;var e=sT();function t(r,n){var a=r.__data__;return e(n)?a[typeof n=="string"?"string":"hash"]:a.map}return Lo=t,Lo}var Oo,Vp;function oT(){if(Vp)return Oo;Vp=1;var e=us();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Oo=t,Oo}var Ro,xp;function iT(){if(xp)return Ro;xp=1;var e=us();function t(r){return e(this,r).get(r)}return Ro=t,Ro}var ko,Hp;function lT(){if(Hp)return ko;Hp=1;var e=us();function t(r){return e(this,r).has(r)}return ko=t,ko}var vo,jp;function uT(){if(jp)return vo;jp=1;var e=us();function t(r,n){var a=e(this,r),s=a.size;return a.set(r,n),this.size+=a.size==s?0:1,this}return vo=t,vo}var Po,zp;function tc(){if(zp)return Po;zp=1;var e=aT(),t=oT(),r=iT(),n=lT(),a=uT();function s(o){var i=-1,l=o==null?0:o.length;for(this.clear();++i<l;){var u=o[i];this.set(u[0],u[1])}}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=r,s.prototype.has=n,s.prototype.set=a,Po=s,Po}var No,Gp;function cT(){if(Gp)return No;Gp=1;var e=is(),t=ec(),r=tc(),n=200;function a(s,o){var i=this.__data__;if(i instanceof e){var l=i.__data__;if(!t||l.length<n-1)return l.push([s,o]),this.size=++i.size,this;i=this.__data__=new r(l)}return i.set(s,o),this.size=i.size,this}return No=a,No}var Co,Wp;function rc(){if(Wp)return Co;Wp=1;var e=is(),t=jb(),r=zb(),n=Gb(),a=Wb(),s=cT();function o(i){var l=this.__data__=new e(i);this.size=l.size}return o.prototype.clear=t,o.prototype.delete=r,o.prototype.get=n,o.prototype.has=a,o.prototype.set=s,Co=o,Co}var Do,Yp;function pT(){if(Yp)return Do;Yp=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return Do=t,Do}var Mo,Kp;function dT(){if(Kp)return Mo;Kp=1;function e(t){return this.__data__.has(t)}return Mo=e,Mo}var Fo,Xp;function kh(){if(Xp)return Fo;Xp=1;var e=tc(),t=pT(),r=dT();function n(a){var s=-1,o=a==null?0:a.length;for(this.__data__=new e;++s<o;)this.add(a[s])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,Fo=n,Fo}var qo,Zp;function vh(){if(Zp)return qo;Zp=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 qo=e,qo}var Uo,Qp;function Ph(){if(Qp)return Uo;Qp=1;function e(t,r){return t.has(r)}return Uo=e,Uo}var Bo,Jp;function Nh(){if(Jp)return Bo;Jp=1;var e=kh(),t=vh(),r=Ph(),n=1,a=2;function s(o,i,l,u,p,d){var f=l&n,_=o.length,m=i.length;if(_!=m&&!(f&&m>_))return!1;var h=d.get(o),b=d.get(i);if(h&&b)return h==i&&b==o;var T=-1,y=!0,S=l&a?new e:void 0;for(d.set(o,i),d.set(i,o);++T<_;){var w=o[T],g=i[T];if(u)var I=f?u(g,w,T,i,o,d):u(w,g,T,o,i,d);if(I!==void 0){if(I)continue;y=!1;break}if(S){if(!t(i,function(L,A){if(!r(S,A)&&(w===L||p(w,L,l,u,d)))return S.push(A)})){y=!1;break}}else if(!(w===g||p(w,g,l,u,d))){y=!1;break}}return d.delete(o),d.delete(i),y}return Bo=s,Bo}var $o,ed;function Ch(){if(ed)return $o;ed=1;var e=Bt(),t=e.Uint8Array;return $o=t,$o}var Vo,td;function fT(){if(td)return Vo;td=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(a,s){n[++r]=[s,a]}),n}return Vo=e,Vo}var xo,rd;function nc(){if(rd)return xo;rd=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(a){n[++r]=a}),n}return xo=e,xo}var Ho,nd;function mT(){if(nd)return Ho;nd=1;var e=bn(),t=Ch(),r=ss(),n=Nh(),a=fT(),s=nc(),o=1,i=2,l="[object Boolean]",u="[object Date]",p="[object Error]",d="[object Map]",f="[object Number]",_="[object RegExp]",m="[object Set]",h="[object String]",b="[object Symbol]",T="[object ArrayBuffer]",y="[object DataView]",S=e?e.prototype:void 0,w=S?S.valueOf:void 0;function g(I,L,A,E,k,R,B){switch(A){case y:if(I.byteLength!=L.byteLength||I.byteOffset!=L.byteOffset)return!1;I=I.buffer,L=L.buffer;case T:return!(I.byteLength!=L.byteLength||!R(new t(I),new t(L)));case l:case u:case f:return r(+I,+L);case p:return I.name==L.name&&I.message==L.message;case _:case h:return I==L+"";case d:var F=a;case m:var te=E&o;if(F||(F=s),I.size!=L.size&&!te)return!1;var de=B.get(I);if(de)return de==L;E|=i,B.set(I,L);var _e=n(F(I),F(L),E,k,R,B);return B.delete(I),_e;case b:if(w)return w.call(I)==w.call(L)}return!1}return Ho=g,Ho}var jo,ad;function Dh(){if(ad)return jo;ad=1;var e=Ju(),t=Ke();function r(n,a,s){var o=a(n);return t(n)?o:e(o,s(n))}return jo=r,jo}var zo,sd;function Mh(){if(sd)return zo;sd=1;function e(t,r){for(var n=-1,a=t==null?0:t.length,s=0,o=[];++n<a;){var i=t[n];r(i,n,t)&&(o[s++]=i)}return o}return zo=e,zo}var Go,od;function Fh(){if(od)return Go;od=1;function e(){return[]}return Go=e,Go}var Wo,id;function ac(){if(id)return Wo;id=1;var e=Mh(),t=Fh(),r=Object.prototype,n=r.propertyIsEnumerable,a=Object.getOwnPropertySymbols,s=a?function(o){return o==null?[]:(o=Object(o),e(a(o),function(i){return n.call(o,i)}))}:t;return Wo=s,Wo}var Yo,ld;function qh(){if(ld)return Yo;ld=1;function e(t,r){for(var n=-1,a=Array(t);++n<t;)a[n]=r(n);return a}return Yo=e,Yo}var ta={exports:{}},Ko,ud;function hT(){if(ud)return Ko;ud=1;function e(){return!1}return Ko=e,Ko}ta.exports;var cd;function cs(){return cd||(cd=1,(function(e,t){var r=Bt(),n=hT(),a=t&&!t.nodeType&&t,s=a&&!0&&e&&!e.nodeType&&e,o=s&&s.exports===a,i=o?r.Buffer:void 0,l=i?i.isBuffer:void 0,u=l||n;e.exports=u})(ta,ta.exports)),ta.exports}var Xo,pd;function ps(){if(pd)return Xo;pd=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(n,a){var s=typeof n;return a=a??e,!!a&&(s=="number"||s!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<a}return Xo=r,Xo}var Zo,dd;function sc(){if(dd)return Zo;dd=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Zo=t,Zo}var Qo,fd;function _T(){if(fd)return Qo;fd=1;var e=Tn(),t=sc(),r=Qt(),n="[object Arguments]",a="[object Array]",s="[object Boolean]",o="[object Date]",i="[object Error]",l="[object Function]",u="[object Map]",p="[object Number]",d="[object Object]",f="[object RegExp]",_="[object Set]",m="[object String]",h="[object WeakMap]",b="[object ArrayBuffer]",T="[object DataView]",y="[object Float32Array]",S="[object Float64Array]",w="[object Int8Array]",g="[object Int16Array]",I="[object Int32Array]",L="[object Uint8Array]",A="[object Uint8ClampedArray]",E="[object Uint16Array]",k="[object Uint32Array]",R={};R[y]=R[S]=R[w]=R[g]=R[I]=R[L]=R[A]=R[E]=R[k]=!0,R[n]=R[a]=R[b]=R[s]=R[T]=R[o]=R[i]=R[l]=R[u]=R[p]=R[d]=R[f]=R[_]=R[m]=R[h]=!1;function B(F){return r(F)&&t(F.length)&&!!R[e(F)]}return Qo=B,Qo}var Jo,md;function oc(){if(md)return Jo;md=1;function e(t){return function(r){return t(r)}}return Jo=e,Jo}var ra={exports:{}};ra.exports;var hd;function ic(){return hd||(hd=1,(function(e,t){var r=ch(),n=t&&!t.nodeType&&t,a=n&&!0&&e&&!e.nodeType&&e,s=a&&a.exports===n,o=s&&r.process,i=(function(){try{var l=a&&a.require&&a.require("util").types;return l||o&&o.binding&&o.binding("util")}catch{}})();e.exports=i})(ra,ra.exports)),ra.exports}var ei,_d;function lc(){if(_d)return ei;_d=1;var e=_T(),t=oc(),r=ic(),n=r&&r.isTypedArray,a=n?t(n):e;return ei=a,ei}var ti,yd;function Uh(){if(yd)return ti;yd=1;var e=qh(),t=as(),r=Ke(),n=cs(),a=ps(),s=lc(),o=Object.prototype,i=o.hasOwnProperty;function l(u,p){var d=r(u),f=!d&&t(u),_=!d&&!f&&n(u),m=!d&&!f&&!_&&s(u),h=d||f||_||m,b=h?e(u.length,String):[],T=b.length;for(var y in u)(p||i.call(u,y))&&!(h&&(y=="length"||_&&(y=="offset"||y=="parent")||m&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||a(y,T)))&&b.push(y);return b}return ti=l,ti}var ri,bd;function ds(){if(bd)return ri;bd=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,a=typeof n=="function"&&n.prototype||e;return r===a}return ri=t,ri}var ni,Td;function Bh(){if(Td)return ni;Td=1;function e(t,r){return function(n){return t(r(n))}}return ni=e,ni}var ai,gd;function yT(){if(gd)return ai;gd=1;var e=Bh(),t=e(Object.keys,Object);return ai=t,ai}var si,Id;function $h(){if(Id)return si;Id=1;var e=ds(),t=yT(),r=Object.prototype,n=r.hasOwnProperty;function a(s){if(!e(s))return t(s);var o=[];for(var i in Object(s))n.call(s,i)&&i!="constructor"&&o.push(i);return o}return si=a,si}var oi,Ed;function xr(){if(Ed)return oi;Ed=1;var e=Oh(),t=sc();function r(n){return n!=null&&t(n.length)&&!e(n)}return oi=r,oi}var ii,wd;function wa(){if(wd)return ii;wd=1;var e=Uh(),t=$h(),r=xr();function n(a){return r(a)?e(a):t(a)}return ii=n,ii}var li,Ad;function Vh(){if(Ad)return li;Ad=1;var e=Dh(),t=ac(),r=wa();function n(a){return e(a,r,t)}return li=n,li}var ui,Sd;function bT(){if(Sd)return ui;Sd=1;var e=Vh(),t=1,r=Object.prototype,n=r.hasOwnProperty;function a(s,o,i,l,u,p){var d=i&t,f=e(s),_=f.length,m=e(o),h=m.length;if(_!=h&&!d)return!1;for(var b=_;b--;){var T=f[b];if(!(d?T in o:n.call(o,T)))return!1}var y=p.get(s),S=p.get(o);if(y&&S)return y==o&&S==s;var w=!0;p.set(s,o),p.set(o,s);for(var g=d;++b<_;){T=f[b];var I=s[T],L=o[T];if(l)var A=d?l(L,I,T,o,s,p):l(I,L,T,s,o,p);if(!(A===void 0?I===L||u(I,L,i,l,p):A)){w=!1;break}g||(g=T=="constructor")}if(w&&!g){var E=s.constructor,k=o.constructor;E!=k&&"constructor"in s&&"constructor"in o&&!(typeof E=="function"&&E instanceof E&&typeof k=="function"&&k instanceof k)&&(w=!1)}return p.delete(s),p.delete(o),w}return ui=a,ui}var ci,Ld;function TT(){if(Ld)return ci;Ld=1;var e=Vr(),t=Bt(),r=e(t,"DataView");return ci=r,ci}var pi,Od;function gT(){if(Od)return pi;Od=1;var e=Vr(),t=Bt(),r=e(t,"Promise");return pi=r,pi}var di,Rd;function xh(){if(Rd)return di;Rd=1;var e=Vr(),t=Bt(),r=e(t,"Set");return di=r,di}var fi,kd;function IT(){if(kd)return fi;kd=1;var e=Vr(),t=Bt(),r=e(t,"WeakMap");return fi=r,fi}var mi,vd;function Aa(){if(vd)return mi;vd=1;var e=TT(),t=ec(),r=gT(),n=xh(),a=IT(),s=Tn(),o=Rh(),i="[object Map]",l="[object Object]",u="[object Promise]",p="[object Set]",d="[object WeakMap]",f="[object DataView]",_=o(e),m=o(t),h=o(r),b=o(n),T=o(a),y=s;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(S){var w=s(S),g=w==l?S.constructor:void 0,I=g?o(g):"";if(I)switch(I){case _:return f;case m:return i;case h:return u;case b:return p;case T:return d}return w}),mi=y,mi}var hi,Pd;function ET(){if(Pd)return hi;Pd=1;var e=rc(),t=Nh(),r=mT(),n=bT(),a=Aa(),s=Ke(),o=cs(),i=lc(),l=1,u="[object Arguments]",p="[object Array]",d="[object Object]",f=Object.prototype,_=f.hasOwnProperty;function m(h,b,T,y,S,w){var g=s(h),I=s(b),L=g?p:a(h),A=I?p:a(b);L=L==u?d:L,A=A==u?d:A;var E=L==d,k=A==d,R=L==A;if(R&&o(h)){if(!o(b))return!1;g=!0,E=!1}if(R&&!E)return w||(w=new e),g||i(h)?t(h,b,T,y,S,w):r(h,b,L,T,y,S,w);if(!(T&l)){var B=E&&_.call(h,"__wrapped__"),F=k&&_.call(b,"__wrapped__");if(B||F){var te=B?h.value():h,de=F?b.value():b;return w||(w=new e),S(te,de,T,y,w)}}return R?(w||(w=new e),n(h,b,T,y,S,w)):!1}return hi=m,hi}var _i,Nd;function uc(){if(Nd)return _i;Nd=1;var e=ET(),t=Qt();function r(n,a,s,o,i){return n===a?!0:n==null||a==null||!t(n)&&!t(a)?n!==n&&a!==a:e(n,a,s,o,r,i)}return _i=r,_i}var yi,Cd;function wT(){if(Cd)return yi;Cd=1;var e=rc(),t=uc(),r=1,n=2;function a(s,o,i,l){var u=i.length,p=u,d=!l;if(s==null)return!p;for(s=Object(s);u--;){var f=i[u];if(d&&f[2]?f[1]!==s[f[0]]:!(f[0]in s))return!1}for(;++u<p;){f=i[u];var _=f[0],m=s[_],h=f[1];if(d&&f[2]){if(m===void 0&&!(_ in s))return!1}else{var b=new e;if(l)var T=l(m,h,_,s,o,b);if(!(T===void 0?t(h,m,r|n,l,b):T))return!1}}return!0}return yi=a,yi}var bi,Dd;function Hh(){if(Dd)return bi;Dd=1;var e=Jt();function t(r){return r===r&&!e(r)}return bi=t,bi}var Ti,Md;function AT(){if(Md)return Ti;Md=1;var e=Hh(),t=wa();function r(n){for(var a=t(n),s=a.length;s--;){var o=a[s],i=n[o];a[s]=[o,i,e(i)]}return a}return Ti=r,Ti}var gi,Fd;function jh(){if(Fd)return gi;Fd=1;function e(t,r){return function(n){return n==null?!1:n[t]===r&&(r!==void 0||t in Object(n))}}return gi=e,gi}var Ii,qd;function ST(){if(qd)return Ii;qd=1;var e=wT(),t=AT(),r=jh();function n(a){var s=t(a);return s.length==1&&s[0][2]?r(s[0][0],s[0][1]):function(o){return o===a||e(o,a,s)}}return Ii=n,Ii}var Ei,Ud;function cc(){if(Ud)return Ei;Ud=1;var e=Ke(),t=ya(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function a(s,o){if(e(s))return!1;var i=typeof s;return i=="number"||i=="symbol"||i=="boolean"||s==null||t(s)?!0:n.test(s)||!r.test(s)||o!=null&&s in Object(o)}return Ei=a,Ei}var wi,Bd;function LT(){if(Bd)return wi;Bd=1;var e=tc(),t="Expected a function";function r(n,a){if(typeof n!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var s=function(){var o=arguments,i=a?a.apply(this,o):o[0],l=s.cache;if(l.has(i))return l.get(i);var u=n.apply(this,o);return s.cache=l.set(i,u)||l,u};return s.cache=new(r.Cache||e),s}return r.Cache=e,wi=r,wi}var Ai,$d;function OT(){if($d)return Ai;$d=1;var e=LT(),t=500;function r(n){var a=e(n,function(o){return s.size===t&&s.clear(),o}),s=a.cache;return a}return Ai=r,Ai}var Si,Vd;function RT(){if(Vd)return Si;Vd=1;var e=OT(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(a){var s=[];return a.charCodeAt(0)===46&&s.push(""),a.replace(t,function(o,i,l,u){s.push(l?u.replace(r,"$1"):i||o)}),s});return Si=n,Si}var Li,xd;function kT(){if(xd)return Li;xd=1;var e=bn(),t=Ea(),r=Ke(),n=ya(),a=e?e.prototype:void 0,s=a?a.toString:void 0;function o(i){if(typeof i=="string")return i;if(r(i))return t(i,o)+"";if(n(i))return s?s.call(i):"";var l=i+"";return l=="0"&&1/i==-1/0?"-0":l}return Li=o,Li}var Oi,Hd;function vT(){if(Hd)return Oi;Hd=1;var e=kT();function t(r){return r==null?"":e(r)}return Oi=t,Oi}var Ri,jd;function gn(){if(jd)return Ri;jd=1;var e=Ke(),t=cc(),r=RT(),n=vT();function a(s,o){return e(s)?s:t(s,o)?[s]:r(n(s))}return Ri=a,Ri}var ki,zd;function In(){if(zd)return ki;zd=1;var e=ya();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return ki=t,ki}var vi,Gd;function fs(){if(Gd)return vi;Gd=1;var e=gn(),t=In();function r(n,a){a=e(a,n);for(var s=0,o=a.length;n!=null&&s<o;)n=n[t(a[s++])];return s&&s==o?n:void 0}return vi=r,vi}var Pi,Wd;function PT(){if(Wd)return Pi;Wd=1;var e=fs();function t(r,n,a){var s=r==null?void 0:e(r,n);return s===void 0?a:s}return Pi=t,Pi}var Ni,Yd;function NT(){if(Yd)return Ni;Yd=1;function e(t,r){return t!=null&&r in Object(t)}return Ni=e,Ni}var Ci,Kd;function CT(){if(Kd)return Ci;Kd=1;var e=gn(),t=as(),r=Ke(),n=ps(),a=sc(),s=In();function o(i,l,u){l=e(l,i);for(var p=-1,d=l.length,f=!1;++p<d;){var _=s(l[p]);if(!(f=i!=null&&u(i,_)))break;i=i[_]}return f||++p!=d?f:(d=i==null?0:i.length,!!d&&a(d)&&n(_,d)&&(r(i)||t(i)))}return Ci=o,Ci}var Di,Xd;function DT(){if(Xd)return Di;Xd=1;var e=NT(),t=CT();function r(n,a){return n!=null&&t(n,a,e)}return Di=r,Di}var Mi,Zd;function MT(){if(Zd)return Mi;Zd=1;var e=uc(),t=PT(),r=DT(),n=cc(),a=Hh(),s=jh(),o=In(),i=1,l=2;function u(p,d){return n(p)&&a(d)?s(o(p),d):function(f){var _=t(f,p);return _===void 0&&_===d?r(f,p):e(d,_,i|l)}}return Mi=u,Mi}var Fi,Qd;function zh(){if(Qd)return Fi;Qd=1;function e(t){return function(r){return r?.[t]}}return Fi=e,Fi}var qi,Jd;function FT(){if(Jd)return qi;Jd=1;var e=fs();function t(r){return function(n){return e(n,r)}}return qi=t,qi}var Ui,ef;function qT(){if(ef)return Ui;ef=1;var e=zh(),t=FT(),r=cc(),n=In();function a(s){return r(s)?e(n(s)):t(s)}return Ui=a,Ui}var Bi,tf;function En(){if(tf)return Bi;tf=1;var e=ST(),t=MT(),r=ba(),n=Ke(),a=qT();function s(o){return typeof o=="function"?o:o==null?r:typeof o=="object"?n(o)?t(o[0],o[1]):e(o):a(o)}return Bi=s,Bi}var $i,rf;function UT(){if(rf)return $i;rf=1;function e(t){return function(r,n,a){for(var s=-1,o=Object(r),i=a(r),l=i.length;l--;){var u=i[t?l:++s];if(n(o[u],u,o)===!1)break}return r}}return $i=e,$i}var Vi,nf;function BT(){if(nf)return Vi;nf=1;var e=UT(),t=e();return Vi=t,Vi}var xi,af;function Gh(){if(af)return xi;af=1;var e=BT(),t=wa();function r(n,a){return n&&e(n,a,t)}return xi=r,xi}var Hi,sf;function $T(){if(sf)return Hi;sf=1;var e=xr();function t(r,n){return function(a,s){if(a==null)return a;if(!e(a))return r(a,s);for(var o=a.length,i=n?o:-1,l=Object(a);(n?i--:++i<o)&&s(l[i],i,l)!==!1;);return a}}return Hi=t,Hi}var ji,of;function pc(){if(of)return ji;of=1;var e=Gh(),t=$T(),r=t(e);return ji=r,ji}var zi,lf;function VT(){if(lf)return zi;lf=1;var e=pc(),t=xr();function r(n,a){var s=-1,o=t(n)?Array(n.length):[];return e(n,function(i,l,u){o[++s]=a(i,l,u)}),o}return zi=r,zi}var Gi,uf;function xT(){if(uf)return Gi;uf=1;var e=Ea(),t=En(),r=VT(),n=Ke();function a(s,o){var i=n(s)?e:r;return i(s,t(o,3))}return Gi=a,Gi}var Wi,cf;function HT(){if(cf)return Wi;cf=1;var e=Lh(),t=xT();function r(n,a){return e(t(n,a),1)}return Wi=r,Wi}var jT=HT();const hn=xe(jT);var Yi,pf;function Wh(){if(pf)return Yi;pf=1;var e=Vr(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Yi=t,Yi}var Ki,df;function dc(){if(df)return Ki;df=1;var e=Wh();function t(r,n,a){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):r[n]=a}return Ki=t,Ki}var Xi,ff;function zT(){if(ff)return Xi;ff=1;var e=dc(),t=Gh(),r=En();function n(a,s){var o={};return s=r(s,3),t(a,function(i,l,u){e(o,l,s(i,l,u))}),o}return Xi=n,Xi}var GT=zT();const Xt=xe(GT);var Zi,mf;function WT(){if(mf)return Zi;mf=1;var e=Math.ceil,t=Math.max;function r(n,a,s,o){for(var i=-1,l=t(e((a-n)/(s||1)),0),u=Array(l);l--;)u[o?l:++i]=n,n+=s;return u}return Zi=r,Zi}var Qi,hf;function fc(){if(hf)return Qi;hf=1;var e=ss(),t=xr(),r=ps(),n=Jt();function a(s,o,i){if(!n(i))return!1;var l=typeof o;return(l=="number"?t(i)&&r(o,i.length):l=="string"&&o in i)?e(i[o],s):!1}return Qi=a,Qi}var Ji,_f;function YT(){if(_f)return Ji;_f=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return Ji=t,Ji}var el,yf;function KT(){if(yf)return el;yf=1;var e=YT(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return el=r,el}var tl,bf;function XT(){if(bf)return tl;bf=1;var e=KT(),t=Jt(),r=ya(),n=NaN,a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^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=s.test(u);return d||o.test(u)?i(u.slice(2),d?2:8):a.test(u)?n:+u}return tl=l,tl}var rl,Tf;function Yh(){if(Tf)return rl;Tf=1;var e=XT(),t=1/0,r=17976931348623157e292;function n(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var s=a<0?-1:1;return s*r}return a===a?a:0}return rl=n,rl}var nl,gf;function ZT(){if(gf)return nl;gf=1;var e=WT(),t=fc(),r=Yh();function n(a){return function(s,o,i){return i&&typeof i!="number"&&t(s,o,i)&&(o=i=void 0),s=r(s),o===void 0?(o=s,s=0):o=r(o),i=i===void 0?s<o?1:-1:r(i),e(s,o,i,a)}}return nl=n,nl}var al,If;function QT(){if(If)return al;If=1;var e=ZT(),t=e();return al=t,al}var JT=QT();const cn=xe(JT);var sl,Ef;function eg(){if(Ef)return sl;Ef=1;function e(t,r,n,a){var s=-1,o=t==null?0:t.length;for(a&&o&&(n=t[++s]);++s<o;)n=r(n,t[s],s,t);return n}return sl=e,sl}var ol,wf;function tg(){if(wf)return ol;wf=1;function e(t,r,n,a,s){return s(t,function(o,i,l){n=a?(a=!1,o):r(n,o,i,l)}),n}return ol=e,ol}var il,Af;function rg(){if(Af)return il;Af=1;var e=eg(),t=pc(),r=En(),n=tg(),a=Ke();function s(o,i,l){var u=a(o)?e:n,p=arguments.length<3;return u(o,r(i,4),l,p,t)}return il=s,il}var ng=rg();const lt=xe(ng),mc=(e,t,r)=>{const{gripperEntities:n,moduleEntities:a}=t,s=Dn(r,e.moduleId),o=Object.keys(n).length>0,i=[];if((e.moduleId==null||s==null)&&i.push(X()),o||i.push(ah()),i.length>0)return{errors:i};const l=a[e.moduleId].pythonName;return{commands:[{commandType:"absorbanceReader/closeLid",key:D(),params:{moduleId:e.moduleId}}],python:`${l}.close_lid()`}},Kh=(e,t,r)=>{const{moduleId:n,sampleWavelengths:a,measureMode:s,referenceWavelength:o}=e,i=t.moduleEntities[n].pythonName,l=o!=null?`, reference_wavelength=${o}`:"";return{commands:[{commandType:"absorbanceReader/initialize",key:D(),params:{moduleId:n,measureMode:s,sampleWavelengths:a,...o!=null?{referenceWavelength:o}:{}}}],python:`${i}.initialize(${N(s)}, ${_c(a)}${l})`}},ag=(e,t,r)=>{const{gripperEntities:n,moduleEntities:a}=t,s=Dn(r,e.moduleId),o=Object.keys(n).length>0,i=[];if((e.moduleId==null||s==null)&&i.push(X()),o||i.push(ah()),i.length>0)return{errors:i};const l=a[e.moduleId].pythonName;return{commands:[{commandType:"absorbanceReader/openLid",key:D(),params:{moduleId:e.moduleId}}],python:`${l}.open_lid()`}},Xh=(e,t,r)=>{const{moduleId:n,fileName:a}=e,s=[],o=Dn(r,n);if(o==null)return{errors:[X()]};o.initialization===null&&s.push(Dr());const i=t.moduleEntities[n].pythonName,l=a!=null?`export_filename=${N(a)}`:"";return s.length>0?{errors:s}:{commands:[{commandType:"absorbanceReader/read",key:D(),params:{moduleId:n,...a!=null?{fileName:a}:{}}}],python:`${i}.read(${l})`}},Zt=(e,t,r)=>{const{flowRate:n,pipetteId:a,volume:s,correctionVolume:o}=e,i=[];t.pipetteEntities[a]?.spec||i.push(ut({pipette:a}));const u=t.pipetteEntities[a].pythonName;return{commands:[{commandType:"airGapInPlace",key:D(),params:{flowRate:n,pipetteId:a,volume:s,...o!=null?{correctionVolume:o}:{}}}],python:`${u}.air_gap(${[`volume=${s}`,"in_place=True",`flow_rate=${n}`].join(", ")})`}},sg=(e,t,r)=>{const{pipetteId:n,volume:a,labwareId:s,wellName:o,flowRate:i,isAirGap:l,tipRack:u,wellLocation:p,primaryNozzle:d,nozzles:f}=e,_="aspirate",m=r.labware,h=[],b=t.pipetteEntities[n]?.spec,T=(b?.displayCategory==="FLEX"||b?.channels===96)??!1,y=Rn(s,r.labware);if(b||h.push(ut({pipette:n})),!s||!r.labware[s]?h.push(ct({actionName:_,labware:s})):z(r.labware[s].stack)==="offDeck"&&h.push(mn()),De.includes(y))h.push(Ft({typeOfStep:_}));else if(m[y]!=null){const E=z(m[y].stack);De.includes(E)&&h.push(Ft({typeOfStep:_}))}if(vn({pipette:n,labware:s,invariantContext:t,prevRobotState:r})&&h.push(pa()),r.tipState.pipettes[n]?.hasTip||h.push(Ut({actionName:_,pipette:n,labware:s,well:o})),t.pipetteEntities[n]?.spec.channels!==1&&b&&!wt({robotState:r,invariantContext:t,pipetteId:n,labwareId:s,wellLocationOffset:p?.offset??{x:0,y:0,z:0},wellTargetName:o,primaryNozzle:d,nozzleConfiguration:f})&&h.push($r()),Pa(r.modules,r.labware,s)&&h.push(dn()),Ra(r.modules,r.labware,s)&&h.push(Dr()),Da(r.modules,r.labware,s)&&h.push(ts()),Ma(r.modules,r.labware,s)&&h.push(fn()),Cn(r.modules,y,T?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&h.push(fa()),T||(Pn(r.modules,y)&&h.push(da()),Nn(r.modules,y,b)&&h.push(ma()),Ca(r.modules,y,b,t.labwareEntities[s])&&h.push(rs())),h.length===0&&b&&b.liquids.default.maxVolume<a&&h.push(Xa({actionName:_,volume:a,maxVolume:b.liquids.default.maxVolume})),h.length===0&&b){const E=Os(n,t,u);E<a&&h.push(Uy({actionName:_,volume:a,maxVolume:E}))}if(h.length>0)return{errors:h};const w=[{commandType:"aspirate",key:D(),params:{pipetteId:n,volume:a,labwareId:s,wellName:o,wellLocation:p,flowRate:i},...l&&{meta:{isAirGap:l}}}],g=t.pipetteEntities[n].pythonName,I=t.labwareEntities[s].pythonName,L=[`volume=${a}`,`location=${I}[${N(o)}]${An(p)}`,`flow_rate=${i}`],A=`${g}.aspirate(
|
|
2
|
-
${Z(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@opentrons/shared-data");function Vy(){return{type:"INSUFFICIENT_TIPS",message:"Not enough tips to complete action"}}function $y(){return{type:"MISSING_96_CHANNEL_TIPRACK_ADAPTER",message:"A 96-channel cannot pick up tips fully without an adapter"}}function xy(){return{type:"REMOVE_96_CHANNEL_TIPRACK_ADAPTER",message:"A 96-channel cannot pick up tips partially with an adapter"}}function Bt(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 Hy(){return{message:"One or more of the pipettes has a tip",type:"PIPETTE_HAS_TIP"}}function ut(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 ct(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 X(){return{message:"This step requires a module, but none is selected",type:"MISSING_MODULE"}}function zy(){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 Yc(){return{message:"This module is not currently running a profile.",type:"MISSING_PROFILE_STEP"}}function jy(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 Ja(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 Gy=()=>({type:"MOVE_LOCATION_NOT_SPECIFIED",message:"This step is missing a move location."}),fa=()=>({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."}),Wy=()=>({type:"THERMOCYCLER_BUSY_WITH_PROFILE",message:"This step cannot run while the Thermocycler is running a profile. Move the step outside the profile."}),mn=()=>({type:"THERMOCYCLER_LID_CLOSED",message:"Attempted to interact with contents of a thermocycler with the lid closed."}),as=()=>({type:"HEATER_SHAKER_LATCH_OPEN",message:"Attempted to interact with contents of a heater-shaker with the latch open."}),Kc=()=>({type:"HEATER_SHAKER_LATCH_CLOSED",message:"Attempted to move the contents of a heater-shaker with the latch closed."}),Mr=()=>({type:"ABSORBANCE_READER_LID_CLOSED",message:"Attempted to interact with contents of an absorbance plate reader with the lid closed."}),Yy=()=>({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."}),uh=()=>({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."}),Ky=()=>({type:"HOPPER_EMPTY",message:"Cannot retrieve labware from empty stacker"}),Xy=()=>({type:"SHUTTLE_FULL",message:"Shuttle must be empty in order to retrieve labware from the stacker"}),Zy=()=>({type:"SHUTTLE_EMPTY",message:"Shuttle must have labware in order to store it in the stacker"}),ch=()=>({type:"MISMATCHED_STACKER_LABWARE_TYPE",message:"The stacker can only store a single type of labware at a time"}),Qy=()=>({type:"MISSING_STACKER_LABWARE_TYPE",message:"Add labware to the stacker in the starting deck so that you can refill it later"}),ph=()=>({type:"HOPPER_FULL",message:"The hopper has reached capacity"}),hn=()=>({type:"HEATER_SHAKER_IS_SHAKING",message:"Attempted to interact with the contents of a heater-shaker when it is shaking."}),Jy=e=>({type:"TALL_LABWARE_EAST_WEST_OF_HEATER_SHAKER",message:`Labware over 53 mm is ${e} of this Heater-Shaker module.`}),Ft=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}}}},ma=()=>({type:"HEATER_SHAKER_EAST_WEST_LATCH_OPEN",message:"The Heater-Shaker labware latch is open"}),ha=()=>({type:"HEATER_SHAKER_NORTH_SOUTH_EAST_WEST_SHAKING",message:"The Heater-Shaker is shaking"}),_a=()=>({type:"HEATER_SHAKER_EAST_WEST_MULTI_CHANNEL",message:"The Heater-Shaker is shaking"}),ss=()=>({type:"HEATER_SHAKER_NORTH_SOUTH__OF_NON_TIPRACK_WITH_MULTI_CHANNEL",message:"8-Channel pipette cannot access labware"}),_n=()=>({type:"LABWARE_OFF_DECK",message:"Attempted to interact with labware off deck"}),eb=()=>({type:"LABWARE_ON_ANOTHER_ENTITY",message:"Attempted to move labware onto another entity with the same slotName"}),Tn=()=>({type:"DROP_TIP_LOCATION_DOES_NOT_EXIST",message:"The destination for dropping tip does not exist"}),dh=()=>({type:"EQUIPMENT_DOES_NOT_EXIST",message:"Equipment does not exist."}),tb=()=>({type:"GRIPPER_REQUIRED",message:"The gripper is required to fulfill this action"}),qt=e=>({type:"PIPETTING_INTO_COLUMN_4",message:`Cannot ${e.typeOfStep} into a column 4 slot.`}),rb=()=>({type:"CANNOT_MOVE_WITH_GRIPPER",message:"The gripper cannot move aluminum blocks"}),nb=()=>({type:"NO_TIP_SELECTED",message:"No tips were selected for this step"}),ya=()=>({type:"LABWARE_DISCARDED_IN_TRASH",message:"The labware was discarded in trash in a previous step."}),fh=()=>({type:"SUBMERGE_BELOW_ASPIRATE",message:"The submerge position must be above the aspirate position"}),mh=()=>({type:"RETRACT_BELOW_ASPIRATE",message:"The retract position must be above the aspirate position"}),ab=()=>({type:"SUBMERGE_BELOW_DISPENSE",message:"The submerge position must be above the dispense position"}),sb=()=>({type:"RETRACT_BELOW_DISPENSE",message:"The retract position must be above the dispense position"}),ob=()=>({type:"MULTI_ASPIRATE_VOLUME_TOO_HIGH",message:"Consolidate pipette path was selected but cannot fit volume for more than 1 well in the tip"}),ib=()=>({type:"MULTI_DISPENSE_VOLUME_TOO_HIGH",message:"Distribute pipette path was selected but cannot fit volume for more than 1 well in the tip"}),lb=e=>({type:"CLOSING_THERMOCYCLER_WITH_INVALID_LABWARE_LID",message:`Closing the Thermocycler lid with ${e.lidDisplayName} in place will cause damage`}),Xc=()=>({type:"RETURN_TIP_UNAVAILABLE",message:"Current tip does not have a known location to return to"}),ub=()=>({type:"TIPRACK_LID_NOT_ALLOWED_ON_DECK",message:"The tip rack lid is not supported directly on the deck"}),cb=()=>({type:"NEXT_TIPRACK_HAS_LID",message:"A pipette cannot pick up tips from a tip rack with a lid"}),pb=e=>({type:"STACK_TOO_HIGH",message:`The stack on slot ${e.slot} is too high`}),db=()=>({type:"TOO_MANY_TIPS",message:"Action will pick up too many tips"}),fb=()=>({type:"INCOMPLETE_PICKUP",message:"At least one of the selected tips is empty"}),mb=()=>({type:"LABWARE_ON_HOPPER",message:"Labware cannot be moved from the Flex Stacker Hopper"}),hb=()=>({type:"MISSING_PUMP_ACTIVITY",message:"This module is not currently running a pump activity."}),_b=e=>({type:"INVALID_WAIT_CONDITION",message:`Invalid wait condition: ${e}`}),ba=()=>({type:"LIVE_TASK_ERROR",message:"This module is currently running a live task. Please wait for it to complete before performing this action."});function xe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cs,Zc;function hh(){if(Zc)return Cs;Zc=1;var e=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis;return Cs=e,Cs}var Ns,Qc;function Vt(){if(Qc)return Ns;Qc=1;var e=hh(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Ns=r,Ns}var Ds,Jc;function gn(){if(Jc)return Ds;Jc=1;var e=Vt(),t=e.Symbol;return Ds=t,Ds}var Ms,ep;function yb(){if(ep)return Ms;ep=1;var e=gn(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,a=e?e.toStringTag:void 0;function s(o){var i=r.call(o,a),l=o[a];try{o[a]=void 0;var u=!0}catch{}var p=n.call(o);return u&&(i?o[a]=l:delete o[a]),p}return Ms=s,Ms}var Fs,tp;function bb(){if(tp)return Fs;tp=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Fs=r,Fs}var qs,rp;function In(){if(rp)return qs;rp=1;var e=gn(),t=yb(),r=bb(),n="[object Null]",a="[object Undefined]",s=e?e.toStringTag:void 0;function o(i){return i==null?i===void 0?a:n:s&&s in Object(i)?t(i):r(i)}return qs=o,qs}var Us,np;function Jt(){if(np)return Us;np=1;function e(t){return t!=null&&typeof t=="object"}return Us=e,Us}var Bs,ap;function Ta(){if(ap)return Bs;ap=1;var e=In(),t=Jt(),r="[object Symbol]";function n(a){return typeof a=="symbol"||t(a)&&e(a)==r}return Bs=n,Bs}var Vs,sp;function _h(){if(sp)return Vs;sp=1;var e=Ta();function t(r,n,a){for(var s=-1,o=r.length;++s<o;){var i=r[s],l=n(i);if(l!=null&&(u===void 0?l===l&&!e(l):a(l,u)))var u=l,p=i}return p}return Vs=t,Vs}var $s,op;function Tb(){if(op)return $s;op=1;function e(t,r){return t<r}return $s=e,$s}var xs,ip;function ga(){if(ip)return xs;ip=1;function e(t){return t}return xs=e,xs}var Hs,lp;function gb(){if(lp)return Hs;lp=1;var e=_h(),t=Tb(),r=ga();function n(a){return a&&a.length?e(a,r,t):void 0}return Hs=n,Hs}var Ib=gb();const Eb=xe(Ib),Ia="TEMPERATURE_DEACTIVATED",Qu="TEMPERATURE_AT_TARGET",Ju="TEMPERATURE_APPROACHING_TARGET",Du=1,yh=[c.MAGNETIC_MODULE_V1,c.TEMPERATURE_MODULE_V1],Mu="fixedTrash",bh={type:c.MAGNETIC_MODULE_TYPE,engaged:!1},Th={type:c.TEMPERATURE_MODULE_TYPE,status:Ia,targetTemperature:null},gh={type:c.THERMOCYCLER_MODULE_TYPE,currentBlockActivity:{type:"blockDeactivated"},lidTargetTemp:null,lidOpen:null,numProfilesStarted:0},Ih={type:c.HEATERSHAKER_MODULE_TYPE,targetTemp:null,targetSpeed:null,latchOpen:null},Eh={type:"absorbanceReaderType",lidOpen:null,initialization:null},wh={type:"magneticBlockType"},Sh={type:c.FLEX_STACKER_MODULE_TYPE,storedLabwareDetails:null,labwareInHopper:null,labwareOnShuttle:null,setStoredLabwareCount:1,fillCount:1},Ah={type:c.VACUUM_MODULE_TYPE,ventStatus:null,numPumpActivitiesStarted:0,currentPumpActivity:{type:"pumpDeactivated"}},Lh={[c.MAGNETIC_MODULE_TYPE]:bh,[c.TEMPERATURE_MODULE_TYPE]:Th,[c.THERMOCYCLER_MODULE_TYPE]:gh,[c.HEATERSHAKER_MODULE_TYPE]:Ih,[c.ABSORBANCE_READER_TYPE]:Eh,[c.MAGNETIC_BLOCK_TYPE]:wh,[c.FLEX_STACKER_MODULE_TYPE]:Sh,[c.VACUUM_MODULE_TYPE]:Ah},wb="opentrons/opentrons_1_trash_1100ml_fixed/1",Sb="opentrons/opentrons_1_trash_3200ml_fixed/1",Me=["A4","B4","C4","D4"],Et={x:0,y:0,z:0},Oh="mounted",Ea="CLEAN",Yt="DIRTY",ie="EMPTY",ec="automatic",wt="manual",Rh=["A4","B4","C4","D4"],Ab=["7","8","10","11"],je="hopper",kh=["hopperA4","hopperB4","hopperC4","hopperD4"],vh={hopperA4:"A4",hopperB4:"B4",hopperC4:"C4",hopperD4:"D4"},Kt=["adapterLabwareId","primaryLabwareId","lidLabwareId"],Lb=["adapterLabwareURI","primaryLabwareURI","lidLabwareURI"],Ob={A4:"hopperA4",B4:"hopperB4",C4:"hopperC4",D4:"hopperD4"},tc="vacuumDock",Rb=c.VACUUM_MODULE_DOCK_A4_ADDRESSABLE_AREA,rc="open",wa="closed",Fu="power",qu="pressure",kb="state",vb="profile",Pb="pumpOff",Cb="pumpOn",Nb="vent",Db="open",Mb="closed",Fb="VACUUM_DEACTIVATED",qb="VACUUM_AT_TARGET",qe=[];for(let e=0;e<256;++e)qe.push((e+256).toString(16).slice(1));function Ub(e,t=0){return(qe[e[t+0]]+qe[e[t+1]]+qe[e[t+2]]+qe[e[t+3]]+"-"+qe[e[t+4]]+qe[e[t+5]]+"-"+qe[e[t+6]]+qe[e[t+7]]+"-"+qe[e[t+8]]+qe[e[t+9]]+"-"+qe[e[t+10]]+qe[e[t+11]]+qe[e[t+12]]+qe[e[t+13]]+qe[e[t+14]]+qe[e[t+15]]).toLowerCase()}const Bb=new Uint8Array(16);function Vb(){return crypto.getRandomValues(Bb)}function $b(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():xb(e,t,r)}function xb(e,t,r){e=e||{};const n=e.random??e.rng?.()??Vb();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 Ub(n)}var zs,up;function nc(){if(up)return zs;up=1;function e(t,r){for(var n=-1,a=r.length,s=t.length;++n<a;)t[s+n]=r[n];return t}return zs=e,zs}var js,cp;function Hb(){if(cp)return js;cp=1;var e=In(),t=Jt(),r="[object Arguments]";function n(a){return t(a)&&e(a)==r}return js=n,js}var Gs,pp;function os(){if(pp)return Gs;pp=1;var e=Hb(),t=Jt(),r=Object.prototype,n=r.hasOwnProperty,a=r.propertyIsEnumerable,s=e((function(){return arguments})())?e:function(o){return t(o)&&n.call(o,"callee")&&!a.call(o,"callee")};return Gs=s,Gs}var Ws,dp;function Xe(){if(dp)return Ws;dp=1;var e=Array.isArray;return Ws=e,Ws}var Ys,fp;function zb(){if(fp)return Ys;fp=1;var e=gn(),t=os(),r=Xe(),n=e?e.isConcatSpreadable:void 0;function a(s){return r(s)||t(s)||!!(n&&s&&s[n])}return Ys=a,Ys}var Ks,mp;function Ph(){if(mp)return Ks;mp=1;var e=nc(),t=zb();function r(n,a,s,o,i){var l=-1,u=n.length;for(s||(s=t),i||(i=[]);++l<u;){var p=n[l];a>0&&s(p)?a>1?r(p,a-1,s,o,i):e(i,p):o||(i[i.length]=p)}return i}return Ks=r,Ks}var Xs,hp;function Sa(){if(hp)return Xs;hp=1;function e(t,r){for(var n=-1,a=t==null?0:t.length,s=Array(a);++n<a;)s[n]=r(t[n],n,t);return s}return Xs=e,Xs}var Zs,_p;function jb(){if(_p)return Zs;_p=1;function e(){this.__data__=[],this.size=0}return Zs=e,Zs}var Qs,yp;function is(){if(yp)return Qs;yp=1;function e(t,r){return t===r||t!==t&&r!==r}return Qs=e,Qs}var Js,bp;function ls(){if(bp)return Js;bp=1;var e=is();function t(r,n){for(var a=r.length;a--;)if(e(r[a][0],n))return a;return-1}return Js=t,Js}var eo,Tp;function Gb(){if(Tp)return eo;Tp=1;var e=ls(),t=Array.prototype,r=t.splice;function n(a){var s=this.__data__,o=e(s,a);if(o<0)return!1;var i=s.length-1;return o==i?s.pop():r.call(s,o,1),--this.size,!0}return eo=n,eo}var to,gp;function Wb(){if(gp)return to;gp=1;var e=ls();function t(r){var n=this.__data__,a=e(n,r);return a<0?void 0:n[a][1]}return to=t,to}var ro,Ip;function Yb(){if(Ip)return ro;Ip=1;var e=ls();function t(r){return e(this.__data__,r)>-1}return ro=t,ro}var no,Ep;function Kb(){if(Ep)return no;Ep=1;var e=ls();function t(r,n){var a=this.__data__,s=e(a,r);return s<0?(++this.size,a.push([r,n])):a[s][1]=n,this}return no=t,no}var ao,wp;function us(){if(wp)return ao;wp=1;var e=jb(),t=Gb(),r=Wb(),n=Yb(),a=Kb();function s(o){var i=-1,l=o==null?0:o.length;for(this.clear();++i<l;){var u=o[i];this.set(u[0],u[1])}}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=r,s.prototype.has=n,s.prototype.set=a,ao=s,ao}var so,Sp;function Xb(){if(Sp)return so;Sp=1;var e=us();function t(){this.__data__=new e,this.size=0}return so=t,so}var oo,Ap;function Zb(){if(Ap)return oo;Ap=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return oo=e,oo}var io,Lp;function Qb(){if(Lp)return io;Lp=1;function e(t){return this.__data__.get(t)}return io=e,io}var lo,Op;function Jb(){if(Op)return lo;Op=1;function e(t){return this.__data__.has(t)}return lo=e,lo}var uo,Rp;function er(){if(Rp)return uo;Rp=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return uo=e,uo}var co,kp;function Ch(){if(kp)return co;kp=1;var e=In(),t=er(),r="[object AsyncFunction]",n="[object Function]",a="[object GeneratorFunction]",s="[object Proxy]";function o(i){if(!t(i))return!1;var l=e(i);return l==n||l==a||l==r||l==s}return co=o,co}var po,vp;function eT(){if(vp)return po;vp=1;var e=Vt(),t=e["__core-js_shared__"];return po=t,po}var fo,Pp;function tT(){if(Pp)return fo;Pp=1;var e=eT(),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 fo=r,fo}var mo,Cp;function Nh(){if(Cp)return mo;Cp=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 mo=r,mo}var ho,Np;function rT(){if(Np)return ho;Np=1;var e=Ch(),t=tT(),r=er(),n=Nh(),a=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,o=Function.prototype,i=Object.prototype,l=o.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 _=e(f)?p:s;return _.test(n(f))}return ho=d,ho}var _o,Dp;function nT(){if(Dp)return _o;Dp=1;function e(t,r){return t?.[r]}return _o=e,_o}var yo,Mp;function $r(){if(Mp)return yo;Mp=1;var e=rT(),t=nT();function r(n,a){var s=t(n,a);return e(s)?s:void 0}return yo=r,yo}var bo,Fp;function ac(){if(Fp)return bo;Fp=1;var e=$r(),t=Vt(),r=e(t,"Map");return bo=r,bo}var To,qp;function cs(){if(qp)return To;qp=1;var e=$r(),t=e(Object,"create");return To=t,To}var go,Up;function aT(){if(Up)return go;Up=1;var e=cs();function t(){this.__data__=e?e(null):{},this.size=0}return go=t,go}var Io,Bp;function sT(){if(Bp)return Io;Bp=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Io=e,Io}var Eo,Vp;function oT(){if(Vp)return Eo;Vp=1;var e=cs(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function a(s){var o=this.__data__;if(e){var i=o[s];return i===t?void 0:i}return n.call(o,s)?o[s]:void 0}return Eo=a,Eo}var wo,$p;function iT(){if($p)return wo;$p=1;var e=cs(),t=Object.prototype,r=t.hasOwnProperty;function n(a){var s=this.__data__;return e?s[a]!==void 0:r.call(s,a)}return wo=n,wo}var So,xp;function lT(){if(xp)return So;xp=1;var e=cs(),t="__lodash_hash_undefined__";function r(n,a){var s=this.__data__;return this.size+=this.has(n)?0:1,s[n]=e&&a===void 0?t:a,this}return So=r,So}var Ao,Hp;function uT(){if(Hp)return Ao;Hp=1;var e=aT(),t=sT(),r=oT(),n=iT(),a=lT();function s(o){var i=-1,l=o==null?0:o.length;for(this.clear();++i<l;){var u=o[i];this.set(u[0],u[1])}}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=r,s.prototype.has=n,s.prototype.set=a,Ao=s,Ao}var Lo,zp;function cT(){if(zp)return Lo;zp=1;var e=uT(),t=us(),r=ac();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Lo=n,Lo}var Oo,jp;function pT(){if(jp)return Oo;jp=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Oo=e,Oo}var Ro,Gp;function ps(){if(Gp)return Ro;Gp=1;var e=pT();function t(r,n){var a=r.__data__;return e(n)?a[typeof n=="string"?"string":"hash"]:a.map}return Ro=t,Ro}var ko,Wp;function dT(){if(Wp)return ko;Wp=1;var e=ps();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return ko=t,ko}var vo,Yp;function fT(){if(Yp)return vo;Yp=1;var e=ps();function t(r){return e(this,r).get(r)}return vo=t,vo}var Po,Kp;function mT(){if(Kp)return Po;Kp=1;var e=ps();function t(r){return e(this,r).has(r)}return Po=t,Po}var Co,Xp;function hT(){if(Xp)return Co;Xp=1;var e=ps();function t(r,n){var a=e(this,r),s=a.size;return a.set(r,n),this.size+=a.size==s?0:1,this}return Co=t,Co}var No,Zp;function sc(){if(Zp)return No;Zp=1;var e=cT(),t=dT(),r=fT(),n=mT(),a=hT();function s(o){var i=-1,l=o==null?0:o.length;for(this.clear();++i<l;){var u=o[i];this.set(u[0],u[1])}}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=r,s.prototype.has=n,s.prototype.set=a,No=s,No}var Do,Qp;function _T(){if(Qp)return Do;Qp=1;var e=us(),t=ac(),r=sc(),n=200;function a(s,o){var i=this.__data__;if(i instanceof e){var l=i.__data__;if(!t||l.length<n-1)return l.push([s,o]),this.size=++i.size,this;i=this.__data__=new r(l)}return i.set(s,o),this.size=i.size,this}return Do=a,Do}var Mo,Jp;function oc(){if(Jp)return Mo;Jp=1;var e=us(),t=Xb(),r=Zb(),n=Qb(),a=Jb(),s=_T();function o(i){var l=this.__data__=new e(i);this.size=l.size}return o.prototype.clear=t,o.prototype.delete=r,o.prototype.get=n,o.prototype.has=a,o.prototype.set=s,Mo=o,Mo}var Fo,ed;function yT(){if(ed)return Fo;ed=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return Fo=t,Fo}var qo,td;function bT(){if(td)return qo;td=1;function e(t){return this.__data__.has(t)}return qo=e,qo}var Uo,rd;function Dh(){if(rd)return Uo;rd=1;var e=sc(),t=yT(),r=bT();function n(a){var s=-1,o=a==null?0:a.length;for(this.__data__=new e;++s<o;)this.add(a[s])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,Uo=n,Uo}var Bo,nd;function Mh(){if(nd)return Bo;nd=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 Bo=e,Bo}var Vo,ad;function Fh(){if(ad)return Vo;ad=1;function e(t,r){return t.has(r)}return Vo=e,Vo}var $o,sd;function qh(){if(sd)return $o;sd=1;var e=Dh(),t=Mh(),r=Fh(),n=1,a=2;function s(o,i,l,u,p,d){var f=l&n,_=o.length,m=i.length;if(_!=m&&!(f&&m>_))return!1;var h=d.get(o),b=d.get(i);if(h&&b)return h==i&&b==o;var T=-1,y=!0,A=l&a?new e:void 0;for(d.set(o,i),d.set(i,o);++T<_;){var S=o[T],g=i[T];if(u)var I=f?u(g,S,T,i,o,d):u(S,g,T,o,i,d);if(I!==void 0){if(I)continue;y=!1;break}if(A){if(!t(i,function(L,w){if(!r(A,w)&&(S===L||p(S,L,l,u,d)))return A.push(w)})){y=!1;break}}else if(!(S===g||p(S,g,l,u,d))){y=!1;break}}return d.delete(o),d.delete(i),y}return $o=s,$o}var xo,od;function Uh(){if(od)return xo;od=1;var e=Vt(),t=e.Uint8Array;return xo=t,xo}var Ho,id;function TT(){if(id)return Ho;id=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(a,s){n[++r]=[s,a]}),n}return Ho=e,Ho}var zo,ld;function ic(){if(ld)return zo;ld=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(a){n[++r]=a}),n}return zo=e,zo}var jo,ud;function gT(){if(ud)return jo;ud=1;var e=gn(),t=Uh(),r=is(),n=qh(),a=TT(),s=ic(),o=1,i=2,l="[object Boolean]",u="[object Date]",p="[object Error]",d="[object Map]",f="[object Number]",_="[object RegExp]",m="[object Set]",h="[object String]",b="[object Symbol]",T="[object ArrayBuffer]",y="[object DataView]",A=e?e.prototype:void 0,S=A?A.valueOf:void 0;function g(I,L,w,E,R,k,B){switch(w){case y:if(I.byteLength!=L.byteLength||I.byteOffset!=L.byteOffset)return!1;I=I.buffer,L=L.buffer;case T:return!(I.byteLength!=L.byteLength||!k(new t(I),new t(L)));case l:case u:case f:return r(+I,+L);case p:return I.name==L.name&&I.message==L.message;case _:case h:return I==L+"";case d:var q=a;case m:var ee=E&o;if(q||(q=s),I.size!=L.size&&!ee)return!1;var pe=B.get(I);if(pe)return pe==L;E|=i,B.set(I,L);var _e=n(q(I),q(L),E,R,k,B);return B.delete(I),_e;case b:if(S)return S.call(I)==S.call(L)}return!1}return jo=g,jo}var Go,cd;function Bh(){if(cd)return Go;cd=1;var e=nc(),t=Xe();function r(n,a,s){var o=a(n);return t(n)?o:e(o,s(n))}return Go=r,Go}var Wo,pd;function Vh(){if(pd)return Wo;pd=1;function e(t,r){for(var n=-1,a=t==null?0:t.length,s=0,o=[];++n<a;){var i=t[n];r(i,n,t)&&(o[s++]=i)}return o}return Wo=e,Wo}var Yo,dd;function $h(){if(dd)return Yo;dd=1;function e(){return[]}return Yo=e,Yo}var Ko,fd;function lc(){if(fd)return Ko;fd=1;var e=Vh(),t=$h(),r=Object.prototype,n=r.propertyIsEnumerable,a=Object.getOwnPropertySymbols,s=a?function(o){return o==null?[]:(o=Object(o),e(a(o),function(i){return n.call(o,i)}))}:t;return Ko=s,Ko}var Xo,md;function xh(){if(md)return Xo;md=1;function e(t,r){for(var n=-1,a=Array(t);++n<t;)a[n]=r(n);return a}return Xo=e,Xo}var na={exports:{}},Zo,hd;function IT(){if(hd)return Zo;hd=1;function e(){return!1}return Zo=e,Zo}na.exports;var _d;function ds(){return _d||(_d=1,(function(e,t){var r=Vt(),n=IT(),a=t&&!t.nodeType&&t,s=a&&!0&&e&&!e.nodeType&&e,o=s&&s.exports===a,i=o?r.Buffer:void 0,l=i?i.isBuffer:void 0,u=l||n;e.exports=u})(na,na.exports)),na.exports}var Qo,yd;function fs(){if(yd)return Qo;yd=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(n,a){var s=typeof n;return a=a??e,!!a&&(s=="number"||s!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<a}return Qo=r,Qo}var Jo,bd;function uc(){if(bd)return Jo;bd=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Jo=t,Jo}var ei,Td;function ET(){if(Td)return ei;Td=1;var e=In(),t=uc(),r=Jt(),n="[object Arguments]",a="[object Array]",s="[object Boolean]",o="[object Date]",i="[object Error]",l="[object Function]",u="[object Map]",p="[object Number]",d="[object Object]",f="[object RegExp]",_="[object Set]",m="[object String]",h="[object WeakMap]",b="[object ArrayBuffer]",T="[object DataView]",y="[object Float32Array]",A="[object Float64Array]",S="[object Int8Array]",g="[object Int16Array]",I="[object Int32Array]",L="[object Uint8Array]",w="[object Uint8ClampedArray]",E="[object Uint16Array]",R="[object Uint32Array]",k={};k[y]=k[A]=k[S]=k[g]=k[I]=k[L]=k[w]=k[E]=k[R]=!0,k[n]=k[a]=k[b]=k[s]=k[T]=k[o]=k[i]=k[l]=k[u]=k[p]=k[d]=k[f]=k[_]=k[m]=k[h]=!1;function B(q){return r(q)&&t(q.length)&&!!k[e(q)]}return ei=B,ei}var ti,gd;function cc(){if(gd)return ti;gd=1;function e(t){return function(r){return t(r)}}return ti=e,ti}var aa={exports:{}};aa.exports;var Id;function pc(){return Id||(Id=1,(function(e,t){var r=hh(),n=t&&!t.nodeType&&t,a=n&&!0&&e&&!e.nodeType&&e,s=a&&a.exports===n,o=s&&r.process,i=(function(){try{var l=a&&a.require&&a.require("util").types;return l||o&&o.binding&&o.binding("util")}catch{}})();e.exports=i})(aa,aa.exports)),aa.exports}var ri,Ed;function dc(){if(Ed)return ri;Ed=1;var e=ET(),t=cc(),r=pc(),n=r&&r.isTypedArray,a=n?t(n):e;return ri=a,ri}var ni,wd;function Hh(){if(wd)return ni;wd=1;var e=xh(),t=os(),r=Xe(),n=ds(),a=fs(),s=dc(),o=Object.prototype,i=o.hasOwnProperty;function l(u,p){var d=r(u),f=!d&&t(u),_=!d&&!f&&n(u),m=!d&&!f&&!_&&s(u),h=d||f||_||m,b=h?e(u.length,String):[],T=b.length;for(var y in u)(p||i.call(u,y))&&!(h&&(y=="length"||_&&(y=="offset"||y=="parent")||m&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||a(y,T)))&&b.push(y);return b}return ni=l,ni}var ai,Sd;function ms(){if(Sd)return ai;Sd=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,a=typeof n=="function"&&n.prototype||e;return r===a}return ai=t,ai}var si,Ad;function zh(){if(Ad)return si;Ad=1;function e(t,r){return function(n){return t(r(n))}}return si=e,si}var oi,Ld;function wT(){if(Ld)return oi;Ld=1;var e=zh(),t=e(Object.keys,Object);return oi=t,oi}var ii,Od;function jh(){if(Od)return ii;Od=1;var e=ms(),t=wT(),r=Object.prototype,n=r.hasOwnProperty;function a(s){if(!e(s))return t(s);var o=[];for(var i in Object(s))n.call(s,i)&&i!="constructor"&&o.push(i);return o}return ii=a,ii}var li,Rd;function xr(){if(Rd)return li;Rd=1;var e=Ch(),t=uc();function r(n){return n!=null&&t(n.length)&&!e(n)}return li=r,li}var ui,kd;function Aa(){if(kd)return ui;kd=1;var e=Hh(),t=jh(),r=xr();function n(a){return r(a)?e(a):t(a)}return ui=n,ui}var ci,vd;function Gh(){if(vd)return ci;vd=1;var e=Bh(),t=lc(),r=Aa();function n(a){return e(a,r,t)}return ci=n,ci}var pi,Pd;function ST(){if(Pd)return pi;Pd=1;var e=Gh(),t=1,r=Object.prototype,n=r.hasOwnProperty;function a(s,o,i,l,u,p){var d=i&t,f=e(s),_=f.length,m=e(o),h=m.length;if(_!=h&&!d)return!1;for(var b=_;b--;){var T=f[b];if(!(d?T in o:n.call(o,T)))return!1}var y=p.get(s),A=p.get(o);if(y&&A)return y==o&&A==s;var S=!0;p.set(s,o),p.set(o,s);for(var g=d;++b<_;){T=f[b];var I=s[T],L=o[T];if(l)var w=d?l(L,I,T,o,s,p):l(I,L,T,s,o,p);if(!(w===void 0?I===L||u(I,L,i,l,p):w)){S=!1;break}g||(g=T=="constructor")}if(S&&!g){var E=s.constructor,R=o.constructor;E!=R&&"constructor"in s&&"constructor"in o&&!(typeof E=="function"&&E instanceof E&&typeof R=="function"&&R instanceof R)&&(S=!1)}return p.delete(s),p.delete(o),S}return pi=a,pi}var di,Cd;function AT(){if(Cd)return di;Cd=1;var e=$r(),t=Vt(),r=e(t,"DataView");return di=r,di}var fi,Nd;function LT(){if(Nd)return fi;Nd=1;var e=$r(),t=Vt(),r=e(t,"Promise");return fi=r,fi}var mi,Dd;function Wh(){if(Dd)return mi;Dd=1;var e=$r(),t=Vt(),r=e(t,"Set");return mi=r,mi}var hi,Md;function OT(){if(Md)return hi;Md=1;var e=$r(),t=Vt(),r=e(t,"WeakMap");return hi=r,hi}var _i,Fd;function La(){if(Fd)return _i;Fd=1;var e=AT(),t=ac(),r=LT(),n=Wh(),a=OT(),s=In(),o=Nh(),i="[object Map]",l="[object Object]",u="[object Promise]",p="[object Set]",d="[object WeakMap]",f="[object DataView]",_=o(e),m=o(t),h=o(r),b=o(n),T=o(a),y=s;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(A){var S=s(A),g=S==l?A.constructor:void 0,I=g?o(g):"";if(I)switch(I){case _:return f;case m:return i;case h:return u;case b:return p;case T:return d}return S}),_i=y,_i}var yi,qd;function RT(){if(qd)return yi;qd=1;var e=oc(),t=qh(),r=gT(),n=ST(),a=La(),s=Xe(),o=ds(),i=dc(),l=1,u="[object Arguments]",p="[object Array]",d="[object Object]",f=Object.prototype,_=f.hasOwnProperty;function m(h,b,T,y,A,S){var g=s(h),I=s(b),L=g?p:a(h),w=I?p:a(b);L=L==u?d:L,w=w==u?d:w;var E=L==d,R=w==d,k=L==w;if(k&&o(h)){if(!o(b))return!1;g=!0,E=!1}if(k&&!E)return S||(S=new e),g||i(h)?t(h,b,T,y,A,S):r(h,b,L,T,y,A,S);if(!(T&l)){var B=E&&_.call(h,"__wrapped__"),q=R&&_.call(b,"__wrapped__");if(B||q){var ee=B?h.value():h,pe=q?b.value():b;return S||(S=new e),A(ee,pe,T,y,S)}}return k?(S||(S=new e),n(h,b,T,y,A,S)):!1}return yi=m,yi}var bi,Ud;function fc(){if(Ud)return bi;Ud=1;var e=RT(),t=Jt();function r(n,a,s,o,i){return n===a?!0:n==null||a==null||!t(n)&&!t(a)?n!==n&&a!==a:e(n,a,s,o,r,i)}return bi=r,bi}var Ti,Bd;function kT(){if(Bd)return Ti;Bd=1;var e=oc(),t=fc(),r=1,n=2;function a(s,o,i,l){var u=i.length,p=u,d=!l;if(s==null)return!p;for(s=Object(s);u--;){var f=i[u];if(d&&f[2]?f[1]!==s[f[0]]:!(f[0]in s))return!1}for(;++u<p;){f=i[u];var _=f[0],m=s[_],h=f[1];if(d&&f[2]){if(m===void 0&&!(_ in s))return!1}else{var b=new e;if(l)var T=l(m,h,_,s,o,b);if(!(T===void 0?t(h,m,r|n,l,b):T))return!1}}return!0}return Ti=a,Ti}var gi,Vd;function Yh(){if(Vd)return gi;Vd=1;var e=er();function t(r){return r===r&&!e(r)}return gi=t,gi}var Ii,$d;function vT(){if($d)return Ii;$d=1;var e=Yh(),t=Aa();function r(n){for(var a=t(n),s=a.length;s--;){var o=a[s],i=n[o];a[s]=[o,i,e(i)]}return a}return Ii=r,Ii}var Ei,xd;function Kh(){if(xd)return Ei;xd=1;function e(t,r){return function(n){return n==null?!1:n[t]===r&&(r!==void 0||t in Object(n))}}return Ei=e,Ei}var wi,Hd;function PT(){if(Hd)return wi;Hd=1;var e=kT(),t=vT(),r=Kh();function n(a){var s=t(a);return s.length==1&&s[0][2]?r(s[0][0],s[0][1]):function(o){return o===a||e(o,a,s)}}return wi=n,wi}var Si,zd;function mc(){if(zd)return Si;zd=1;var e=Xe(),t=Ta(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function a(s,o){if(e(s))return!1;var i=typeof s;return i=="number"||i=="symbol"||i=="boolean"||s==null||t(s)?!0:n.test(s)||!r.test(s)||o!=null&&s in Object(o)}return Si=a,Si}var Ai,jd;function CT(){if(jd)return Ai;jd=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 s=function(){var o=arguments,i=a?a.apply(this,o):o[0],l=s.cache;if(l.has(i))return l.get(i);var u=n.apply(this,o);return s.cache=l.set(i,u)||l,u};return s.cache=new(r.Cache||e),s}return r.Cache=e,Ai=r,Ai}var Li,Gd;function NT(){if(Gd)return Li;Gd=1;var e=CT(),t=500;function r(n){var a=e(n,function(o){return s.size===t&&s.clear(),o}),s=a.cache;return a}return Li=r,Li}var Oi,Wd;function DT(){if(Wd)return Oi;Wd=1;var e=NT(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(a){var s=[];return a.charCodeAt(0)===46&&s.push(""),a.replace(t,function(o,i,l,u){s.push(l?u.replace(r,"$1"):i||o)}),s});return Oi=n,Oi}var Ri,Yd;function MT(){if(Yd)return Ri;Yd=1;var e=gn(),t=Sa(),r=Xe(),n=Ta(),a=e?e.prototype:void 0,s=a?a.toString:void 0;function o(i){if(typeof i=="string")return i;if(r(i))return t(i,o)+"";if(n(i))return s?s.call(i):"";var l=i+"";return l=="0"&&1/i==-1/0?"-0":l}return Ri=o,Ri}var ki,Kd;function FT(){if(Kd)return ki;Kd=1;var e=MT();function t(r){return r==null?"":e(r)}return ki=t,ki}var vi,Xd;function En(){if(Xd)return vi;Xd=1;var e=Xe(),t=mc(),r=DT(),n=FT();function a(s,o){return e(s)?s:t(s,o)?[s]:r(n(s))}return vi=a,vi}var Pi,Zd;function wn(){if(Zd)return Pi;Zd=1;var e=Ta();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Pi=t,Pi}var Ci,Qd;function hs(){if(Qd)return Ci;Qd=1;var e=En(),t=wn();function r(n,a){a=e(a,n);for(var s=0,o=a.length;n!=null&&s<o;)n=n[t(a[s++])];return s&&s==o?n:void 0}return Ci=r,Ci}var Ni,Jd;function qT(){if(Jd)return Ni;Jd=1;var e=hs();function t(r,n,a){var s=r==null?void 0:e(r,n);return s===void 0?a:s}return Ni=t,Ni}var Di,ef;function UT(){if(ef)return Di;ef=1;function e(t,r){return t!=null&&r in Object(t)}return Di=e,Di}var Mi,tf;function BT(){if(tf)return Mi;tf=1;var e=En(),t=os(),r=Xe(),n=fs(),a=uc(),s=wn();function o(i,l,u){l=e(l,i);for(var p=-1,d=l.length,f=!1;++p<d;){var _=s(l[p]);if(!(f=i!=null&&u(i,_)))break;i=i[_]}return f||++p!=d?f:(d=i==null?0:i.length,!!d&&a(d)&&n(_,d)&&(r(i)||t(i)))}return Mi=o,Mi}var Fi,rf;function VT(){if(rf)return Fi;rf=1;var e=UT(),t=BT();function r(n,a){return n!=null&&t(n,a,e)}return Fi=r,Fi}var qi,nf;function $T(){if(nf)return qi;nf=1;var e=fc(),t=qT(),r=VT(),n=mc(),a=Yh(),s=Kh(),o=wn(),i=1,l=2;function u(p,d){return n(p)&&a(d)?s(o(p),d):function(f){var _=t(f,p);return _===void 0&&_===d?r(f,p):e(d,_,i|l)}}return qi=u,qi}var Ui,af;function Xh(){if(af)return Ui;af=1;function e(t){return function(r){return r?.[t]}}return Ui=e,Ui}var Bi,sf;function xT(){if(sf)return Bi;sf=1;var e=hs();function t(r){return function(n){return e(n,r)}}return Bi=t,Bi}var Vi,of;function HT(){if(of)return Vi;of=1;var e=Xh(),t=xT(),r=mc(),n=wn();function a(s){return r(s)?e(n(s)):t(s)}return Vi=a,Vi}var $i,lf;function Sn(){if(lf)return $i;lf=1;var e=PT(),t=$T(),r=ga(),n=Xe(),a=HT();function s(o){return typeof o=="function"?o:o==null?r:typeof o=="object"?n(o)?t(o[0],o[1]):e(o):a(o)}return $i=s,$i}var xi,uf;function zT(){if(uf)return xi;uf=1;function e(t){return function(r,n,a){for(var s=-1,o=Object(r),i=a(r),l=i.length;l--;){var u=i[t?l:++s];if(n(o[u],u,o)===!1)break}return r}}return xi=e,xi}var Hi,cf;function jT(){if(cf)return Hi;cf=1;var e=zT(),t=e();return Hi=t,Hi}var zi,pf;function Zh(){if(pf)return zi;pf=1;var e=jT(),t=Aa();function r(n,a){return n&&e(n,a,t)}return zi=r,zi}var ji,df;function GT(){if(df)return ji;df=1;var e=xr();function t(r,n){return function(a,s){if(a==null)return a;if(!e(a))return r(a,s);for(var o=a.length,i=n?o:-1,l=Object(a);(n?i--:++i<o)&&s(l[i],i,l)!==!1;);return a}}return ji=t,ji}var Gi,ff;function hc(){if(ff)return Gi;ff=1;var e=Zh(),t=GT(),r=t(e);return Gi=r,Gi}var Wi,mf;function WT(){if(mf)return Wi;mf=1;var e=hc(),t=xr();function r(n,a){var s=-1,o=t(n)?Array(n.length):[];return e(n,function(i,l,u){o[++s]=a(i,l,u)}),o}return Wi=r,Wi}var Yi,hf;function YT(){if(hf)return Yi;hf=1;var e=Sa(),t=Sn(),r=WT(),n=Xe();function a(s,o){var i=n(s)?e:r;return i(s,t(o,3))}return Yi=a,Yi}var Ki,_f;function KT(){if(_f)return Ki;_f=1;var e=Ph(),t=YT();function r(n,a){return e(t(n,a),1)}return Ki=r,Ki}var XT=KT();const yn=xe(XT);var Xi,yf;function Qh(){if(yf)return Xi;yf=1;var e=$r(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Xi=t,Xi}var Zi,bf;function _c(){if(bf)return Zi;bf=1;var e=Qh();function t(r,n,a){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):r[n]=a}return Zi=t,Zi}var Qi,Tf;function ZT(){if(Tf)return Qi;Tf=1;var e=_c(),t=Zh(),r=Sn();function n(a,s){var o={};return s=r(s,3),t(a,function(i,l,u){e(o,l,s(i,l,u))}),o}return Qi=n,Qi}var QT=ZT();const Zt=xe(QT);var Ji,gf;function JT(){if(gf)return Ji;gf=1;var e=Math.ceil,t=Math.max;function r(n,a,s,o){for(var i=-1,l=t(e((a-n)/(s||1)),0),u=Array(l);l--;)u[o?l:++i]=n,n+=s;return u}return Ji=r,Ji}var el,If;function yc(){if(If)return el;If=1;var e=is(),t=xr(),r=fs(),n=er();function a(s,o,i){if(!n(i))return!1;var l=typeof o;return(l=="number"?t(i)&&r(o,i.length):l=="string"&&o in i)?e(i[o],s):!1}return el=a,el}var tl,Ef;function eg(){if(Ef)return tl;Ef=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return tl=t,tl}var rl,wf;function tg(){if(wf)return rl;wf=1;var e=eg(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return rl=r,rl}var nl,Sf;function rg(){if(Sf)return nl;Sf=1;var e=tg(),t=er(),r=Ta(),n=NaN,a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^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=s.test(u);return d||o.test(u)?i(u.slice(2),d?2:8):a.test(u)?n:+u}return nl=l,nl}var al,Af;function Jh(){if(Af)return al;Af=1;var e=rg(),t=1/0,r=17976931348623157e292;function n(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var s=a<0?-1:1;return s*r}return a===a?a:0}return al=n,al}var sl,Lf;function ng(){if(Lf)return sl;Lf=1;var e=JT(),t=yc(),r=Jh();function n(a){return function(s,o,i){return i&&typeof i!="number"&&t(s,o,i)&&(o=i=void 0),s=r(s),o===void 0?(o=s,s=0):o=r(o),i=i===void 0?s<o?1:-1:r(i),e(s,o,i,a)}}return sl=n,sl}var ol,Of;function ag(){if(Of)return ol;Of=1;var e=ng(),t=e();return ol=t,ol}var sg=ag();const cn=xe(sg);var il,Rf;function og(){if(Rf)return il;Rf=1;function e(t,r,n,a){var s=-1,o=t==null?0:t.length;for(a&&o&&(n=t[++s]);++s<o;)n=r(n,t[s],s,t);return n}return il=e,il}var ll,kf;function ig(){if(kf)return ll;kf=1;function e(t,r,n,a,s){return s(t,function(o,i,l){n=a?(a=!1,o):r(n,o,i,l)}),n}return ll=e,ll}var ul,vf;function lg(){if(vf)return ul;vf=1;var e=og(),t=hc(),r=Sn(),n=ig(),a=Xe();function s(o,i,l){var u=a(o)?e:n,p=arguments.length<3;return u(o,r(i,4),l,p,t)}return ul=s,ul}var ug=lg();const lt=xe(ug),bc=(e,t,r)=>{const{gripperEntities:n,moduleEntities:a}=t,s=Fn(r,e.moduleId),o=Object.keys(n).length>0,i=[];if((e.moduleId==null||s==null)&&i.push(X()),o||i.push(uh()),i.length>0)return{errors:i};const l=a[e.moduleId].pythonName;return{commands:[{commandType:"absorbanceReader/closeLid",key:F(),params:{moduleId:e.moduleId}}],python:`${l}.close_lid()`}},e_=(e,t,r)=>{const{moduleId:n,sampleWavelengths:a,measureMode:s,referenceWavelength:o}=e,i=t.moduleEntities[n].pythonName,l=o!=null?`, reference_wavelength=${o}`:"";return{commands:[{commandType:"absorbanceReader/initialize",key:F(),params:{moduleId:n,measureMode:s,sampleWavelengths:a,...o!=null?{referenceWavelength:o}:{}}}],python:`${i}.initialize(${C(s)}, ${gc(a)}${l})`}},cg=(e,t,r)=>{const{gripperEntities:n,moduleEntities:a}=t,s=Fn(r,e.moduleId),o=Object.keys(n).length>0,i=[];if((e.moduleId==null||s==null)&&i.push(X()),o||i.push(uh()),i.length>0)return{errors:i};const l=a[e.moduleId].pythonName;return{commands:[{commandType:"absorbanceReader/openLid",key:F(),params:{moduleId:e.moduleId}}],python:`${l}.open_lid()`}},t_=(e,t,r)=>{const{moduleId:n,fileName:a}=e,s=[],o=Fn(r,n);if(o==null)return{errors:[X()]};o.initialization===null&&s.push(Mr());const i=t.moduleEntities[n].pythonName,l=a!=null?`export_filename=${C(a)}`:"";return s.length>0?{errors:s}:{commands:[{commandType:"absorbanceReader/read",key:F(),params:{moduleId:n,...a!=null?{fileName:a}:{}}}],python:`${i}.read(${l})`}},Qt=(e,t,r)=>{const{flowRate:n,pipetteId:a,volume:s,correctionVolume:o}=e,i=[];t.pipetteEntities[a]?.spec||i.push(ut({pipette:a}));const u=t.pipetteEntities[a].pythonName;return{commands:[{commandType:"airGapInPlace",key:F(),params:{flowRate:n,pipetteId:a,volume:s,...o!=null?{correctionVolume:o}:{}}}],python:`${u}.air_gap(${[`volume=${s}`,"in_place=True",`flow_rate=${n}`].join(", ")})`}},pg=(e,t,r)=>{const{pipetteId:n,volume:a,labwareId:s,wellName:o,flowRate:i,isAirGap:l,tipRack:u,wellLocation:p,primaryNozzle:d,nozzles:f}=e,_="aspirate",m=r.labware,h=[],b=t.pipetteEntities[n]?.spec,T=(b?.displayCategory==="FLEX"||b?.channels===96)??!1,y=vn(s,r.labware);if(b||h.push(ut({pipette:n})),!s||!r.labware[s]?h.push(ct({actionName:_,labware:s})):G(r.labware[s].stack)==="offDeck"&&h.push(_n()),Me.includes(y))h.push(qt({typeOfStep:_}));else if(m[y]!=null){const R=G(m[y].stack);Me.includes(R)&&h.push(qt({typeOfStep:_}))}Cn({pipette:n,labware:s,invariantContext:t,prevRobotState:r})&&h.push(fa()),r.tipState.pipettes[n]?.hasTip||h.push(Bt({actionName:_,pipette:n,labware:s,well:o}));const A=t.pipetteEntities[n]?.spec.channels!==1,S=dt({robotState:r,invariantContext:t,pipetteId:n,labwareId:s,wellLocationOffset:p?.offset??{x:0,y:0,z:0},wellTargetName:o,primaryNozzle:d,nozzleConfiguration:f});if(A&&b&&!S.isSafe&&h.push(Ft({unsafePipetteMovementReason:S.reason})),Na(r.modules,r.labware,s)&&h.push(mn()),va(r.modules,r.labware,s)&&h.push(Mr()),Fa(r.modules,r.labware,s)&&h.push(as()),qa(r.modules,r.labware,s)&&h.push(hn()),Mn(r.modules,y,T?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&h.push(ha()),T||(Nn(r.modules,y)&&h.push(ma()),Dn(r.modules,y,b)&&h.push(_a()),Ma(r.modules,y,b,t.labwareEntities[s])&&h.push(ss())),h.length===0&&b&&b.liquids.default.maxVolume<a&&h.push(Ja({actionName:_,volume:a,maxVolume:b.liquids.default.maxVolume})),h.length===0&&b){const R=ks(n,t,u);R<a&&h.push(jy({actionName:_,volume:a,maxVolume:R}))}if(h.length>0)return{errors:h};const g=[{commandType:"aspirate",key:F(),params:{pipetteId:n,volume:a,labwareId:s,wellName:o,wellLocation:p,flowRate:i},...l&&{meta:{isAirGap:l}}}],I=t.pipetteEntities[n].pythonName,L=t.labwareEntities[s].pythonName,w=[`volume=${a}`,`location=${L}[${C(o)}]${Ln(p)}`,`flow_rate=${i}`],E=`${I}.aspirate(
|
|
2
|
+
${Z(w.join(`,
|
|
3
3
|
`))},
|
|
4
|
-
)`;return{commands:
|
|
5
|
-
${o}.blow_out()`}},
|
|
6
|
-
${y}.blow_out(${
|
|
4
|
+
)`;return{commands:g,python:E}},_s=(e,t,r)=>{const{pipetteId:n,volume:a,flowRate:s,correctionVolume:o}=e,i=[{commandType:"aspirateInPlace",key:F(),params:{pipetteId:n,volume:a,flowRate:s,...o!=null?{correctionVolume:o}:{}}}],l=[];r.tipState.pipettes[n]?.hasTip||l.push(Bt({actionName:"aspirate",pipette:n}));const u=t.pipetteEntities[n].pythonName,p=[`volume=${a}`,`flow_rate=${s}`],d=`${u}.aspirate(${p.join(", ")})`;return l.length>0?{errors:l}:{commands:i,python:d}},Oa=(e,t,r)=>{const{pipetteId:n,flowRate:a}=e,s=[];if(r.tipState.pipettes[n]?.hasTip||s.push(Bt({actionName:"blowout",pipette:n})),s.length>0)return{errors:s};const o=t.pipetteEntities[n].pythonName;return{commands:[{commandType:"blowOutInPlace",key:F(),params:{pipetteId:n,flowRate:a}}],python:`${o}.flow_rate.blow_out = ${a}
|
|
5
|
+
${o}.blow_out()`}},r_=(e,t,r)=>{const{pipetteId:n,labwareId:a,wellName:s,wellLocation:o,flowRate:i}=e,{pipetteEntities:l,labwareEntities:u}=t,p=l[n],d="blowout",f=[],_=p?.spec,m=(_?.displayCategory==="FLEX"||_?.channels===96)??!1,h=r.pipettes[n],b=r.labware,T=vn(a,r.labware);if(h||f.push(ut({pipette:n})),_==null&&f.push(ut({pipette:n})),r.tipState.pipettes[n]?.hasTip||f.push(Bt({actionName:d,pipette:n,labware:a,well:s})),!a||!r.labware[a]?f.push(ct({actionName:d,labware:a})):G(r.labware[a].stack)==="offDeck"&&f.push(_n()),Me.includes(T))f.push(qt({typeOfStep:d}));else if(b[T]!=null){const g=G(b[T].stack);Me.includes(g)&&f.push(qt({typeOfStep:d}))}if(Cn({pipette:n,labware:a,invariantContext:t,prevRobotState:r})&&f.push(fa()),Na(r.modules,r.labware,a)&&f.push(mn()),va(r.modules,r.labware,a)&&f.push(Mr()),Fa(r.modules,r.labware,a)&&f.push(as()),qa(r.modules,r.labware,a)&&f.push(hn()),Mn(r.modules,T,m?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&f.push(ha()),!m&&_!=null&&(Nn(r.modules,T)&&f.push(ma()),Dn(r.modules,T,_)&&f.push(_a()),Ma(r.modules,T,_,t.labwareEntities[a])&&f.push(ss())),f.length>0)return{errors:f};const y=p.pythonName,A=u[a].pythonName;return{commands:[{commandType:"blowout",key:F(),params:{pipetteId:n,labwareId:a,wellName:s,flowRate:i,wellLocation:o}}],python:`${y}.flow_rate.blow_out = ${i}
|
|
6
|
+
${y}.blow_out(${A}[${C(s)}]${Ln(o)})`}},dg=(e,t,r)=>{const n={commandType:"captureImage",key:F(),params:{homeBefore:e.homeBefore,fileName:e.fileName,resolution:e.resolution,zoom:e.zoom,contrast:e.contrast,brightness:e.brightness,saturation:e.saturation}},a=`${Ie}.capture_image()`;return{commands:[n],python:a}},fg=(e,t,r)=>{const{message:n}=e,a=[{commandType:"comment",key:F(),params:{message:n}}],s=`${Ie}.comment(${C(n)})`;return{commands:a,python:s}},oa=(e,t,r)=>{const{pipetteId:n,volume:a}=e,s=t.pipetteEntities[n];return s?{commands:[{commandType:"configureForVolume",key:F(),params:{pipetteId:n,volume:a}}],python:`${s.pythonName}.configure_for_volume(${a})`}:{commands:[]}},mg=(e,t,r)=>{const{pipetteId:n,configurationParams:a}=e,{style:s,primaryNozzle:o}=a,i=[{commandType:"configureNozzleLayout",key:F(),params:{pipetteId:n,configurationParams:a}}],l=t.pipetteEntities[n].pythonName;let u;return s===c.PARTIAL_COLUMN?u=[`protocol_api.${s}`,...o!=null?[`start=${C(o)}, end=${C(c.H1_NOZZLE)}`]:[]]:u=[`protocol_api.${s}`,...o!=null?[`start=${C(o)}`]:[]],{commands:i,python:`${l}.configure_nozzle_layout(
|
|
7
7
|
${Z(u.join(`,
|
|
8
8
|
`))},
|
|
9
|
-
)`}},
|
|
10
|
-
${o}.deactivate_block()`}:s===c.HEATERSHAKER_MODULE_TYPE?{commands:[{commandType:"heaterShaker/deactivateHeater",key:
|
|
11
|
-
${Z(
|
|
9
|
+
)`}},hg=(e,t,r)=>{const{moduleId:n}=e;if(n===null)return{errors:[X()]};const a=t.moduleEntities[n],s=a?.type,o=a?.pythonName,i={moduleId:n};return s===c.TEMPERATURE_MODULE_TYPE?{commands:[{commandType:"temperatureModule/deactivate",key:F(),params:i}],python:`${o}.deactivate()`}:s===c.THERMOCYCLER_MODULE_TYPE?{commands:[{commandType:"thermocycler/deactivateLid",key:F(),params:i},{commandType:"thermocycler/deactivateBlock",key:F(),params:i}],python:`${o}.deactivate_lid()
|
|
10
|
+
${o}.deactivate_block()`}:s===c.HEATERSHAKER_MODULE_TYPE?{commands:[{commandType:"heaterShaker/deactivateHeater",key:F(),params:i}],python:`${o}.deactivate_heater()`}:(console.error(`setTemperature expected module ${n} to be ${c.TEMPERATURE_MODULE_TYPE}, ${c.THERMOCYCLER_MODULE_TYPE} or ${c.HEATERSHAKER_MODULE_TYPE}, got ${s}`),{errors:[X()]})},he=(e,t,r)=>{const{message:n}=e;let a,s;if("seconds"in e){a={commandType:"waitForDuration",key:F(),params:{seconds:e.seconds,message:n}};const o=[`seconds=${e.seconds}`,...n?[`msg=${C(n)}`]:[]];s=`${Ie}.delay(${o.join(", ")})`}else a={commandType:"waitForResume",key:F(),params:{message:n}},s=`${Ie}.pause(${n?C(n):""})`;return{commands:[a],python:s}},_g=(e,t,r)=>{const{moduleId:n}=e,{moduleEntities:a}=t,s="magneticModule/disengage";if(n===null)return{errors:[X()]};if(a[n]?.type!==c.MAGNETIC_MODULE_TYPE)throw new Error(`expected module ${n} to be magdeck, got ${a[n]?.type}`);const o=a[n].pythonName;return{commands:[{commandType:s,key:F(),params:{moduleId:n}}],python:`${o}.disengage()`}},n_=(e,t,r)=>{const{pipetteId:n,volume:a,labwareId:s,wellName:o,flowRate:i,isAirGap:l,wellLocation:u,pushOut:p,primaryNozzle:d,nozzles:f}=e,_="dispense",m=r.labware,h=[],b=t.pipetteEntities[n]?.spec,T=(b?.displayCategory==="FLEX"||b?.channels===96)??!1,y=vn(s,r.labware);if(b||h.push(ut({pipette:n})),Cn({pipette:n,labware:s,invariantContext:t,prevRobotState:r})&&h.push(fa()),r.tipState.pipettes[n]?.hasTip||h.push(Bt({actionName:_,pipette:n,labware:s,well:o})),!s||!r.labware[s]?h.push(ct({actionName:_,labware:s})):G(r.labware[s].stack)==="offDeck"&&h.push(_n()),Me.includes(y))h.push(qt({typeOfStep:_}));else if(m[y]!=null){const R=G(m[y].stack);Me.includes(R)&&h.push(qt({typeOfStep:_}))}const A=t.pipetteEntities[n]?.spec.channels!==1,S=dt({robotState:r,invariantContext:t,pipetteId:n,labwareId:s,wellLocationOffset:u?.offset??{x:0,y:0,z:0},wellTargetName:o,primaryNozzle:d,nozzleConfiguration:f});if(A&&!S.isSafe&&h.push(Ft({unsafePipetteMovementReason:S.reason})),Na(r.modules,r.labware,s)&&h.push(mn()),va(r.modules,r.labware,s)&&h.push(Mr()),Fa(r.modules,r.labware,s)&&h.push(as()),qa(r.modules,r.labware,s)&&h.push(hn()),Mn(r.modules,y,T?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&h.push(ha()),T||(Nn(r.modules,y)&&h.push(ma()),Dn(r.modules,y,b)&&h.push(_a()),Ma(r.modules,y,b,t.labwareEntities[s])&&h.push(ss())),h.length>0)return{errors:h};const g=[{commandType:"dispense",key:F(),params:{pipetteId:n,volume:a,labwareId:s,wellName:o,wellLocation:u,flowRate:i,...p!=null?{pushOut:p}:{}},...l&&{meta:{isAirGap:l}}}],I=t.pipetteEntities[n].pythonName,L=t.labwareEntities[s].pythonName,w=[`volume=${a}`,`location=${L}[${C(o)}]${Ln(u)}`,`flow_rate=${i}`,...p!=null?[`push_out=${p}`]:[]],E=`${I}.dispense(
|
|
11
|
+
${Z(w.join(`,
|
|
12
12
|
`))},
|
|
13
|
-
)`;return{commands:
|
|
13
|
+
)`;return{commands:g,python:E}},nt=(e,t,r)=>{const{pipetteId:n,volume:a,flowRate:s,pushOut:o,correctionVolume:i,isAirGap:l}=e,u=[];r.tipState.pipettes[n]?.hasTip||u.push(Bt({actionName:"dispense",pipette:n}));const p=[{commandType:"dispenseInPlace",key:F(),params:{pipetteId:n,volume:a,flowRate:s,...o!=null?{pushOut:o}:{},...i!=null?{correctionVolume:i}:{}},...l?{meta:{isAirGap:l}}:{}}],d=t.pipetteEntities[n].pythonName,f=[`volume=${a}`,`flow_rate=${s}`,...o!=null?[`push_out=${o}`]:[]],_=`${d}.dispense(${f.join(", ")})`;return u.length>0?{errors:u}:{commands:p,python:_}},An=(e,t,r)=>{const{pipette:n,dropTipLocation:a,wellName:s,isReturnTip:o}=e;if(!r.tipState.pipettes[n]?.hasTip)return{commands:[]};const i=r.pipettes[n].tiprackId,l=r.pipettes[n].tipWell,u=Object.values(t.labwareEntities).find(({id:_})=>_===i),p=u!=null&&l!=null;if(o&&!p)return{errors:[Xc()]};let d=null;if(o&&p){const _=t.pipetteEntities[n].pythonName,h=`${u.pythonName}["${l}"]`;d=`${_}.drop_tip(location=${h})`}let f=[];if(o){if(i==null||l==null)return{errors:[Xc()]};f=[{commandType:"dropTip",key:F(),params:{pipetteId:n,labwareId:i,wellName:l}}]}else{if(a==null||s==null)return{errors:[Tn()]};f=[{commandType:"dropTip",key:F(),params:{pipetteId:n,labwareId:a,wellName:s}}]}return{commands:f,...d!=null?{python:d}:{}}},Tc=(e,t,r)=>{const{pipetteId:n}=e;return r.tipState.pipettes[n]?.hasTip?{commands:[{commandType:"dropTipInPlace",key:F(),params:{pipetteId:n}}]}:{commands:[]}},yg=(e,t,r)=>{const{moduleId:n,height:a}=e,{moduleEntities:s}=t,o="magneticModule/engage";if(n===null)return{errors:[X()]};if(s[n]?.type!==c.MAGNETIC_MODULE_TYPE)throw new Error(`expected module ${n} to be magdeck, got ${s[n]?.type}`);const i=s[n].pythonName;return{commands:[{commandType:o,key:F(),params:{moduleId:n,height:a}}],python:`${i}.engage(height_from_base=${a})`}},bg=(e,t,r)=>{const{moduleEntities:n}=t,{moduleId:a,strategy:s,message:o,count:i}=e,l=ft(r,a);if(a==null||n[a]==null)return{errors:[X()]};const u=[];if(l==null&&u.push(X()),u.length>0)return{errors:u};const p=n[a].pythonName;return{commands:[{commandType:"flexStacker/empty",key:F(),params:{moduleId:a,strategy:s,message:o,count:i}}],python:`${p}.empty(${e.message?`message=${C(e.message)}`:""})`}},Tg=(e,t,r)=>{const{moduleId:n,interventionMessage:a,fillLabwareIds:s}=e,{labwareEntities:o,moduleEntities:i}=t;if(n==null||i[n]==null)return{errors:[X()]};const l=ft(r,n),u=vc(l,t.labwareEntities),p=i[n].pythonName,d=s.filter(T=>!c.getIsLid(o[T].def)).map(T=>o[T]?.pythonName),_=Ts(d,4).map(T=>Ra+T.join(", ")).join(`,
|
|
14
14
|
`),m=d.length<4?d.join(", "):`
|
|
15
15
|
${_}
|
|
16
|
-
`;if(l!=null&&l.storedLabwareDetails===null&&l.labwareInHopper==null)return{errors:[
|
|
17
|
-
`:[],...a!=null?[`message=${
|
|
18
|
-
`]:[]].join("");return{commands:[{commandType:"flexStacker/fillItems",key:
|
|
19
|
-
${Z(b)})`}},
|
|
16
|
+
`;if(l!=null&&l.storedLabwareDetails===null&&l.labwareInHopper==null)return{errors:[Qy()]};if(u){if(s.length>0&&!s.every(y=>kc(y,t,l)))return{errors:[ch()]}}else return{errors:[ph()]};const b=[...s.filter(T=>!c.getIsLid(o[T].def)).length>0?`labware=[${m}],
|
|
17
|
+
`:[],...a!=null?[`message=${C(a)},
|
|
18
|
+
`]:[]].join("");return{commands:[{commandType:"flexStacker/fillItems",key:F(),params:{moduleId:n,labware:s,message:a??void 0}}],python:`${p}.fill_items(
|
|
19
|
+
${Z(b)})`}},gg=(e,t,r)=>{const{moduleId:n}=e,{moduleEntities:a}=t;if(n==null||a[n]==null)return{errors:[X()]};const s=a[n].pythonName,o=ft(r,n),i=o?.labwareInHopper!=null&&o.labwareInHopper.length>0;return o!==null&&Rc(o)?{errors:[Xy()]}:i?{commands:[{commandType:"flexStacker/retrieve",key:F(),params:{moduleId:n}}],python:`${s}.retrieve()`}:{errors:[Ky()]}},Ig=(e,t,r)=>{const{moduleId:n}=e,{labwareEntities:a,moduleEntities:s}=t;if(n==null||s[n]==null)return{errors:[X()]};const o=s[n].pythonName,i=ft(r,n),l=i?.labwareOnShuttle?.primaryLabwareId??null,u=vc(i,a);return i!==null&&!Rc(i)?{errors:[Zy()]}:l!==null&&!kc(l,t,i)?{errors:[ch()]}:u?{commands:[{commandType:"flexStacker/store",key:F(),params:{moduleId:n,strategy:"automatic"}}],python:`${o}.store()`}:{errors:[ph()]}};function cl(){return{type:"ASPIRATE_MORE_THAN_WELL_CONTENTS",message:"Not enough liquid"}}function pl(){return{type:"ASPIRATE_FROM_PRISTINE_WELL",message:"This step tries to aspirate from an empty well."}}function Eg(){return{type:"LABWARE_IN_WASTE_CHUTE_HAS_LIQUID",message:"Disposing of a labware with liquid"}}function wg(){return{type:"TIPRACK_IN_WASTE_CHUTE_HAS_TIPS",message:"Disposing unused tips"}}function Sg(){return{type:"TEMPERATURE_IS_POTENTIALLY_UNREACHABLE",message:"The module set temperature is potentially unreachable."}}function Ag(){return{type:"WAITING_FOR_NONEXISTENT_TASK",message:"This step is waiting for a task that was never started."}}const Lg="opentrons_flex_tiprack_lid",Og=(e,t,r)=>{const{labwareId:n,strategy:a,newLocation:s}=e,o=a==="usingGripper",{gripperEntities:i,trashBinEntities:l,wasteChuteEntities:u,labwareEntities:p,moduleEntities:d}=t,f=Object.keys(i).length>0,_=Object.values(u).length>0,m=r.tipState!=null?g_(r.tipState,n):!1,h=r.liquidState!=null?I_(r.liquidState,n):!1,b=Object.values(r.tipState.pipettes).some(({hasTip:P})=>P),T="moveToLabware",y=[],A=[],S=c.locationIsOnAddressableArea(s)&&s.addressableAreaName==="gripperWasteChute";!n||!r.labware[n]?y.push(ct({actionName:T,labware:n})):G(r.labware[n].stack)==="offDeck"&&o?y.push(_n()):r.labware[n].stack.includes(je)&&y.push(mb());const g=p[n]?.def.metadata.displayCategory==="aluminumBlock";o&&g&&y.push(rb()),(S&&f&&!o||!f&&o)&&y.push(tb()),b&&o&&y.push(Hy());const I=r.labware[n]!=null?G(r.labware[n].stack):null;(_&&I==="gripperWasteChute"||c.MOVABLE_TRASH_ADDRESSABLE_AREAS.includes(I)||I==="fixedTrash")&&y.push(ya());const L=I!=null&&r.labware[I]!=null?G(r.labware[I].stack):null,w=L??I,E=P=>P==null?null:P in r.modules?r.modules[P].moduleState:Object.values(r.modules).find(({slot:v})=>v===P)?.moduleState??null,R=Object.entries(r.labware).filter(([P,v])=>v.stack.includes("offDeck")).map(([P])=>P),k=Object.values(s);R.some(P=>k.includes(P))&&o&&y.push(Gy());const B=E(w);B!=null&&(B.type===c.THERMOCYCLER_MODULE_TYPE&&B.lidOpen!==!0?y.push(mn()):B.type===c.HEATERSHAKER_MODULE_TYPE?B.latchOpen!==!0?y.push(Kc()):B.targetSpeed!==null&&y.push(hn()):B.type===c.ABSORBANCE_READER_TYPE&&B.lidOpen!==!0&&y.push(Mr()));const q=c.locationIsOnModule(s)&&"moduleId"in s?s.moduleId:null,ee=c.locationIsOnLabware(s)?s.labwareId:null,pe=ee!=null?r.labware[ee].stack[1]:null,_e=pe??q;s==="offDeck"&&o&&y.push(_n()),m&&S&&_?A.push(wg()):h&&S&&_&&A.push(Eg());const le=E(_e);le!=null&&(le.type===c.THERMOCYCLER_MODULE_TYPE&&le.lidOpen!==!0?y.push(mn()):le.type===c.HEATERSHAKER_MODULE_TYPE?(le.latchOpen!==!0&&y.push(Kc()),le.targetSpeed!==null&&y.push(hn())):le.type===c.ABSORBANCE_READER_TYPE&&le.lidOpen!==!0&&y.push(Mr())),p[n]?.def.parameters.loadName===Lg&&s!=null&&c.locationIsOnDeck(s)&&("slotName"in s||"addressableAreaName"in s&&c.FLEX_STAGING_AREA_SLOT_ADDRESSABLE_AREAS.includes(s.addressableAreaName))&&y.push(ub());const ve={labwareId:n,strategy:a,newLocation:s},He=[{commandType:"moveLabware",key:F(),params:ve}],Be=p[n]?.pythonName;let te="",Ee=null;if(s==="offDeck")te=ia;else if(s==="systemLocation")te="system_location";else if(s==="wasteChuteLocation")te=ia;else if("labwareId"in s){te=p[s.labwareId].pythonName;const P=r.labware[s.labwareId].stack;Ee=P[P.length-1]}else if("moduleId"in s)Ee=r.modules[s.moduleId].slot,te=d[s.moduleId].pythonName;else if("slotName"in s){const{slotName:P}=s;if(P in p){const v=G(r.labware[P].stack);te=c.getIsLid(p[P].def)?C(v):p[P].pythonName;const N=r.labware[P].stack;Ee=N[N.length-1]}else te=C(P),Ee=P}else if("addressableAreaName"in s){const P=Me.includes(s.addressableAreaName),v=c.WASTE_CHUTE_ADDRESSABLE_AREAS.includes(s.addressableAreaName),V=s.addressableAreaName==="fixedTrash",ae=c.MOVABLE_TRASH_ADDRESSABLE_AREAS.includes(s.addressableAreaName)||V?Object.values(l)?.map(D=>D.location):[],U=!v&&!P&&!la(s.addressableAreaName)?d_(s.addressableAreaName,V?"fixedTrashSlot":"trashBinAdapter",V?c.OT2_ROBOT_TYPE:c.FLEX_ROBOT_TYPE):null,H=ae.find(D=>D===U),z=H!=null?Object.values(l).find(D=>D.location===H)?.id:null;if(P)te=C(s.addressableAreaName);else if(z!=null&&!v)te=l[z]?.pythonName??"";else if(z==null&&v)te=Object.values(u)[0]?.pythonName??"";else if(la(s.addressableAreaName)){const[D]=Object.entries(r.modules).find(([,x])=>x.moduleState.type===c.VACUUM_MODULE_TYPE)??[];if(D!=null&&d[D]!=null){const{pythonName:x}=d[D];te=`${x}.manifold_dock`}}else te=""}if(Ee!=null){const P=pn(r.labware,Ee),v=G(P),{isCompatible:V,isAboveStackLimit:N}=A_(n,P,p,d);V||y.push(eb()),N&&y.push(pb({slot:v}))}if(y.length>0)return{errors:y};te===""&&console.error("expected to find a python new location but could not");const ze=o?", use_gripper=True":"",Pe=c.getIsLid(p[n].def),Te=r.labware[n].stack;let K="";if(Pe){const P=E_(Te);if(P==null)console.error("expected to find a parent for labware to move but could not");else{const v=p[P]!=null,V=v&&c.getIsLid(p[P].def);Te.length===2||v&&V?K=C(G(Te)):(v||!c.getIsLid(p[P].def))&&(K=p[P].pythonName)}}Pe&&K===""&&console.error("expected to find a valid lid move location but could not");const W=Pe?`${Ie}.move_lid(${K}, ${te}${ze})`:`${Ie}.move_labware(${Be}, ${te}${ze})`;return{commands:He,...A.length>0?{warnings:A}:{},python:W}},Ue=(e,t,r)=>{const{pipetteId:n,fixtureId:a,offset:s}=e,{pipetteEntities:o,trashBinEntities:i,wasteChuteEntities:l}=t,u=o[n],p=u.spec.channels,d=u.pythonName,f=i[a]??l[a],_=f.pythonName;let m=f_(p);return i[a]!=null&&(m=Ic(f.location)),{commands:[{commandType:"moveToAddressableArea",key:F(),params:{pipetteId:n,addressableAreaName:m,offset:s}}],python:`${d}.move_to(${_})`}},a_=(e,t,r)=>{const{pipetteId:n,addressableAreaName:a}=e;return{commands:[{commandType:"moveToAddressableAreaForDropTip",key:F(),params:{pipetteId:n,addressableAreaName:a,offset:{x:0,y:0,z:0},alternateDropLocation:!0}}]}},$=(e,t,r)=>{const{pipetteId:n,labwareId:a,wellName:s,wellLocation:o,minimumZHeight:i,forceDirect:l,speed:u}=e,p="moveToWell",d=[],f=r.labware,{pipetteEntities:_,labwareEntities:m}=t,h=_[n]?.spec,b=r.pipettes[n]?.nozzles??c.ALL,T=r.pipettes[n]?.primaryNozzle??ns({nozzles:b,channels:h?.channels}),y=(h?.displayCategory==="FLEX"||h?.channels===96)??!1,A=vn(a,r.labware);if(h||d.push(ut({pipette:n})),!a||!r.labware[a]?d.push(ct({actionName:p,labware:a})):G(r.labware[a].stack)==="offDeck"&&d.push(_n()),Me.includes(A))d.push(qt({typeOfStep:"move to well"}));else if(f[A]!=null){const k=G(f[A].stack);Me.includes(k)&&d.push(qt({typeOfStep:p}))}Cn({pipette:n,labware:a,invariantContext:t,prevRobotState:r})&&d.push(fa()),Na(r.modules,r.labware,a)&&d.push(mn()),Fa(r.modules,r.labware,a)&&d.push(as()),va(r.modules,r.labware,a)&&d.push(Mr()),qa(r.modules,r.labware,a)&&d.push(hn()),Mn(r.modules,A,y?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&d.push(ha()),y||(Nn(r.modules,A)&&d.push(ma()),Dn(r.modules,A,h)&&d.push(_a()),Ma(r.modules,A,h,m[a])&&d.push(ss()));const S=t.pipetteEntities[n]?.spec.channels!==1,g=t.pipetteEntities[n]?.spec,I=dt({robotState:r,invariantContext:t,pipetteId:n,labwareId:a,wellLocationOffset:o?.offset??{x:0,y:0,z:0},wellTargetName:s,nozzleConfiguration:b,primaryNozzle:T});if(S&&g&&!I.isSafe&&d.push(Ft({unsafePipetteMovementReason:I.reason})),d.length>0)return{errors:d};const L=_[n].pythonName,w=m[a].pythonName,E=[{commandType:"moveToWell",key:F(),params:{pipetteId:n,labwareId:a,wellName:s,wellLocation:o,...l!=null?{forceDirect:l}:{},...i!=null?{minimumZHeight:i}:{},...u!=null?{speed:u}:null}}],R=[`${w}[${C(s)}]${Ln(o)}`,...l?["force_direct=True"]:[],...i?[`minimum_z_height=${i}`]:[],...u?[`speed=${u}`]:[]];return{commands:E,python:`${L}.move_to(${R.join(", ")})`}},dl=(e,t,r)=>{const{pipetteId:n,labwareId:a,wellName:s,tipTrackingOption:o=ec,nozzles:i,primaryNozzle:l}=e,u=[],p=t.pipetteEntities[n].spec.channels,d=dt({robotState:r,invariantContext:t,pipetteId:n,labwareId:a,wellLocationOffset:{x:0,y:0},wellTargetName:s,nozzleConfiguration:i,primaryNozzle:l}),f=jc({tipState:r.tipState.tipracks[a],primaryNozzle:l,channels:p,nozzleConfiguration:i,wellName:s,tiprackDef:t.labwareEntities[a].def});d.isSafe||u.push(Ft({unsafePipetteMovementReason:d.reason})),f.isSafe||u.push(db()),f.isComplete!==!0&&u.push(fb());const _=G(r.labware[a].stack);if(Me.includes(_))u.push(qt({typeOfStep:"pick up tip"}));else if(r.labware[_]!=null){const T=G(r.labware[_].stack);Me.includes(T)&&u.push(qt({typeOfStep:"pick up tip"}))}const m=t.pipetteEntities[n].pythonName,h=t.labwareEntities[a].pythonName,b=`${m}.pick_up_tip(location=${h}${o===wt?`[${C(s)}]`:""})`;return u.length>0?{errors:u}:{commands:[{commandType:"pickUpTip",key:F(),params:{pipetteId:n,labwareId:a,wellName:s}}],python:b}},Rg=(e,t,r)=>{const{moduleId:n,taskId:a,profileElements:s,blockMaxVolumeUl:o}=e,i=t.moduleEntities[n].pythonName,l=Ey(e.profileElements),u=l.repeatingProfileSteps.map(m=>`{${C("temperature")}: ${m.celsius}, ${C("hold_time_seconds")}: ${m.holdSeconds}},`).join(`
|
|
20
20
|
`),d=`${`[
|
|
21
21
|
${Z(u)}
|
|
22
22
|
],`}
|
|
23
23
|
${l.numRepetitions},
|
|
24
24
|
`+(e.blockMaxVolumeUl!==void 0?`block_max_volume=${e.blockMaxVolumeUl},`:""),_=(a!=null?`${a} = `:"")+`${i}.start_execute_profile(
|
|
25
25
|
${Z(d)}
|
|
26
|
-
)`;return{commands:[{commandType:"thermocycler/startRunExtendedProfile",key:
|
|
27
|
-
`).map(t=>t&&
|
|
28
|
-
`)}function pt(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
|
|
29
|
-
${Z(t.map(([n,a])=>`${
|
|
26
|
+
)`;return{commands:[{commandType:"thermocycler/startRunExtendedProfile",key:F(),params:{moduleId:n,taskId:a,profileElements:s,blockMaxVolumeUl:o}}],python:_}},Ut=(e,t,r)=>{const{pipetteId:n}=e,a=t.pipetteEntities[n].pythonName;return{commands:[{commandType:"prepareToAspirate",key:F(),params:{pipetteId:n}}],python:`${a}.prepare_to_aspirate()`}},s_=(e,t,r)=>{const{moduleId:n,celsius:a}=e;if(n===null)return{errors:[X()]};const s=t.moduleEntities[n],o=s?.type;return o===c.TEMPERATURE_MODULE_TYPE?{commands:[{commandType:"temperatureModule/setTargetTemperature",key:F(),params:{moduleId:n,celsius:a}}],python:`${s?.pythonName}.start_set_temperature(${a})`}:o===c.THERMOCYCLER_MODULE_TYPE?(console.error("Thermocycler set temp not implemented!"),{commands:[]}):o===c.HEATERSHAKER_MODULE_TYPE?{commands:[{commandType:"heaterShaker/setTargetTemperature",key:F(),params:{moduleId:n,celsius:a}}],python:`${s?.pythonName}.set_target_temperature(${a})`}:(console.error(`setTemperature expected module ${n} to be ${c.TEMPERATURE_MODULE_TYPE}, ${c.THERMOCYCLER_MODULE_TYPE} or ${c.HEATERSHAKER_MODULE_TYPE}, got ${o}`),{errors:[X()]})},Mt=(e,t,r)=>{const n="touchTip",{pipetteId:a,labwareId:s,wellName:o,zOffsetFromTop:i,speed:l,mmFromEdge:u}=e,p=r.pipettes[a],d=[];if(p||d.push(ut({pipette:a})),r.tipState.pipettes[a]?.hasTip||d.push(Bt({actionName:n,pipette:a,labware:s,well:o})),d.length>0)return{errors:d};const f=t.pipetteEntities[a].pythonName,m=[`${t.labwareEntities[s].pythonName}[${C(o)}]`,`v_offset=${i}`,...l!=null?[`speed=${l}`]:[],...u!=null?[`mm_from_edge=${u}`]:[]],h=`${f}.touch_tip(${m.join(", ")})`;return{commands:[{commandType:"touchTip",key:F(),params:{pipetteId:a,labwareId:s,wellName:o,wellLocation:{origin:c.WELL_ORIGIN_TOP,offset:{z:i}},speed:l,mmFromEdge:u}}],python:h}},ys=(e,t,r)=>{const{moduleId:n}=e,a=t.moduleEntities[n],s=st(r,n);if(a==null||s==null)return{errors:[X()]};if(Pn(s))return{errors:[ba()]};const i=`${a.pythonName}.close_vent()`;return{commands:[{commandType:"vacuumModule/closeVent",key:F(),params:{moduleId:n}}],python:i}},kg=(e,t,r)=>{const{moduleId:n}=e,a=t.moduleEntities[n],s=st(r,n);if(a==null||s==null)return{errors:[X()]};if(Pn(s))return{errors:[ba()]};const i=`${a.pythonName}.open_vent()`;return{commands:[{commandType:"vacuumModule/openVent",key:F(),params:{moduleId:n}}],python:i}},Ie="protocol",ia="protocol_api.OFF_DECK",bs="CUSTOM_LABWARE",Ra=" ";function Z(e){return e.split(`
|
|
27
|
+
`).map(t=>t&&Ra+t).join(`
|
|
28
|
+
`)}function pt(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)?gc(e):Fr(e);default:throw Error("Cannot render value as Python",{cause:e})}}function C(e){return JSON.stringify(e)}function o_(e){return`(${e.map(t=>pt(t)).join(", ")})`}function gc(e){return e.every(t=>Array.isArray(t)&&t.length===2&&t.every(r=>typeof r=="number"))?`[${e.map(t=>o_(t)).join(", ")}]`:`[${e.map(t=>pt(t)).join(", ")}]`}function vg(e){return["undefined","boolean","number","string"].includes(typeof e)||e===null}function Fr(e){const t=Object.entries(e),r=t.every(([n,a])=>vg(a));if(t.length<=1||r){const n=`{${t.map(([a,s])=>`${C(a)}: ${pt(s)}`).join(", ")}}`;if(t.length<=1||n.length<64)return n}return`{
|
|
29
|
+
${Z(t.map(([n,a])=>`${C(n)}: ${pt(a)}`).join(`,
|
|
30
30
|
`))},
|
|
31
|
-
}`}function
|
|
31
|
+
}`}function Ln(e){const{x:t,y:r,z:n}=e?.offset||{};let a=!!n,s=e?.origin;!s&&(t||r||n)&&(s="top");let o="";if(s&&(o+=(()=>{switch(s){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}`:""})`}})()),t||r||a){const i=[...t?[`x=${t}`]:[],...r?[`y=${r}`]:[],...a?[`z=${n}`]:[]];o+=`.move(types.Point(${i.join(", ")}))`}return o}function Ts(e,t){const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}const i_=(e,t)=>[`duration=${pt(e)}`,...typeof t=="boolean"?[`vent_after=${pt(t)}`]:[]],l_=(e,t,r)=>{const{moduleId:n,percentPower:a,duration:s,ventAfter:o}=e,i=t.moduleEntities[n],l=st(r,n);if(l==null||i==null)return{errors:[X()]};if(Pn(l))return{errors:[ba()]};const p=s!=null,d=p?`${i.pythonName}_task_${l.numPumpActivitiesStarted+1}`:null,f=p?{duration:s,ventAfter:o,taskId:d}:null,_=d==null?"":`${d} = `,m=`percent_power=${pt(a)}`,h=p?i_(s,o):[],b=[m,...h],T=`${_}${i.pythonName}.start_set_vacuum_power(
|
|
32
32
|
${Z(b.join(`,
|
|
33
33
|
`))}
|
|
34
|
-
)`;return{commands:[{commandType:"vacuumModule/startSetVacuumPower",key:
|
|
34
|
+
)`;return{commands:[{commandType:"vacuumModule/startSetVacuumPower",key:F(),params:{moduleId:n,percentPower:a,...f??{}}}],python:T}},u_=(e,t,r)=>{const{moduleId:n,gaugePressure:a,duration:s,ventAfter:o}=e,i=t.moduleEntities[n],l=st(r,n);if(l==null||i==null)return{errors:[X()]};if(Pn(l))return{errors:[ba()]};const p=s!=null,d=p?`${i.pythonName}_task_${l.numPumpActivitiesStarted+1}`:null,f=p?{duration:s,ventAfter:o,taskId:d}:null,_=d==null?"":`${d} = `,m=`gauge_pressure_mbar=${pt(a)}`,h=p?i_(s,o):[],b=[m,...h],T=`${_}${i.pythonName}.start_set_vacuum_pressure(
|
|
35
35
|
${Z(b.join(`,
|
|
36
36
|
`))}
|
|
37
|
-
)`;return{commands:[{commandType:"vacuumModule/startSetVacuumPressure",key:
|
|
38
|
-
${Z(
|
|
37
|
+
)`;return{commands:[{commandType:"vacuumModule/startSetVacuumPressure",key:F(),params:{moduleId:n,gaugePressure:a,...f??{}}}],python:T}},Pg=e=>{const{steps:t,repetitions:r}=e;return Array.from({length:r}).flatMap(()=>t)},Cg=e=>e.reduce((t,r)=>{if("repetitions"in r){const n=Pg(r);return[...t,...n]}return[...t,r]},[]),Ya=e=>{const{holdSeconds:t,ventAfter:r}=e,n={hold_time_seconds:t,...r!=null?{vent_after:r}:{}};if("gaugePressureMbar"in e){const{gaugePressureMbar:s}=e;return Fr({gauge_pressure_mbar:s,...n,vent_after:r})}const{percentPower:a}=e;return Fr({percent_power:Number(a),...n,vent_after:r})},Ng=e=>{let t,r;if(e.length===1&&"repetitions"in e[0]){const{steps:a,repetitions:s}=e[0];return t=`profile=[
|
|
38
|
+
${Z(a.map((o,i)=>(i===a.length-1,Ya(o))).join(`,
|
|
39
39
|
`))}
|
|
40
|
-
]`,r=`repetitions=${pt(
|
|
41
|
-
${Z(n.map(
|
|
40
|
+
]`,r=`repetitions=${pt(s)}`,[t,r]}const n=Cg(e);return t=`profile=[
|
|
41
|
+
${Z(n.map((a,s)=>(s===n.length-1,Ya(a))).join(`,
|
|
42
42
|
`))}
|
|
43
|
-
]`,r=`repetitions=${pt(1)}
|
|
44
|
-
${Z(
|
|
43
|
+
]`,r=`repetitions=${pt(1)}`,[t,r]},c_=(e,t,r)=>{const{moduleId:n,profile:a,ventAfter:s}=e,o=st(r,n);if(o===null)return{errors:[X()]};if(Pn(o))return{errors:[ba()]};const l=t.moduleEntities[n].pythonName,u=`${l}_task_${o.numPumpActivitiesStarted+1}`,p=Ng(a),d=`vent_after=${pt(s)}`,f=a.map((m,h)=>h===a.length-1?{...m,ventAfter:s}:m),_=`${u} = ${l}.start_execute_profile(
|
|
44
|
+
${Z([...p,d].join(`,
|
|
45
45
|
`))}
|
|
46
|
-
)`;return{commands:[{commandType:"vacuumModule/startRunProfile",key:D(),params:{moduleId:n,profile:a,ventAfter:s,taskId:u}}],python:_}},Ng=(e,t,r)=>{const{moduleId:n}=e,a=t.moduleEntities[n];if(a==null)return{errors:[X()]};const s=`${a.pythonName}.stop_vacuum()`;return{commands:[{commandType:"vacuumModule/stopVacuum",key:D(),params:{moduleId:n}}],python:s}},n_=(e,t,r)=>{const{moduleId:n,celsius:a}=e,s=n?At(r,n):null,o=[];if(n===null||!s)return{errors:[X()]};if(s.type!==c.TEMPERATURE_MODULE_TYPE&&s.type!==c.HEATERSHAKER_MODULE_TYPE)return console.error(`expected module to be ${c.TEMPERATURE_MODULE_TYPE} but got ${s.type}`),{errors:[X()]};const i="status"in s&&s.status===Xu&&s.targetTemperature!==a,l="status"in s&&s.status===Zu&&s.targetTemperature!==a;if(i||"status"in s&&s.status===Ta||"targetTemp"in s&&s.targetTemp==null)return{errors:[qy()]};l&&o.push(bg());const u=t.moduleEntities[n],p=u?.type;switch(p){case c.TEMPERATURE_MODULE_TYPE:return{commands:[{commandType:"temperatureModule/waitForTemperature",key:D(),params:{moduleId:n,celsius:a}}],warnings:o.length>0?o:void 0,python:`${u?.pythonName}.await_temperature(${a})`};case c.HEATERSHAKER_MODULE_TYPE:return{commands:[{commandType:"heaterShaker/waitForTemperature",key:D(),params:{moduleId:n,celsius:a}}],warnings:o.length>0?o:void 0,python:`${u?.pythonName}.wait_for_temperature()`};default:return console.error(`awaitTemperature expected module ${n} to be ${c.TEMPERATURE_MODULE_TYPE} or ${c.HEATERSHAKER_MODULE_TYPE}, got ${p}`),{errors:[X()]}}};function U(e,t){return(r,n)=>e(t,r,n)}function O(e,t){return(r,n)=>{const a=e(t,r,n);if("python"in a){const{python:s,...o}=a;return o}return a}}const je="__air__",Hr="source_well",Sn="dest_well",a_=(e,t,r)=>{const s=c.getDeckDefFromRobotType(r).cutoutFixtures.find(l=>l.id.includes(t))?.providesAddressableAreas,i=(l=>{if(s!=null){for(const u in s)if(s[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 s_(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 yc(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 o_(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 Ln(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 i_(e,t){return hn(cn(t),r=>e)}function pr(e){return lt(e,(t,r,n)=>n===je?t:t+r.volume,0)}function Kt(e,t){const r=pr(t);if(r===0)return{source:t,dest:{[je]:{volume:e}}};if(e>r)return{source:Xt(t,()=>({volume:0})),dest:{...t,[je]:{volume:e-r}}};const n=lt(t,(a,s,o)=>({...a,[o]:s.volume/r}),{});return Object.keys(t).reduce((a,s)=>{const o=n[s]*e;return{source:{...a.source,[s]:{volume:t[s].volume-o}},dest:{...a.dest,[s]:{volume:o}}}},{source:{},dest:{}})}function dr(e,t){return{...t,...lt(e,(r,n,a)=>{const o=a in t?n.volume+t[a].volume:n.volume;return{...r,[a]:{volume:o}}},{})}}function bc(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(s=>s&&s===n[0]);return{wellsForTips:n,allWellsShared:a}}const l_=e=>{const{pipette:t,sourceLabwareId:r,sourceWell:n,destLabwareId:a,destWell:s,blowoutLocation:o,flowRate:i,offsetFromTopMm:l,invariantContext:u}=e;if(!o)return[];const{trashBinEntities:p,wasteChuteEntities:d}=u;let f=null,_=null;return o===Hr?(f=r,_=n):o===Sn&&(f=a,_=s),_!=null&&f!=null?[U(Zh,{pipetteId:t,labwareId:f,wellName:_,flowRate:i,wellLocation:{origin:"top",offset:{z:l}}})]:d[o]!=null?[U(Ty,{pipetteId:t,flowRate:i,wasteChuteId:Object.keys(d)[0]})]:[U(by,{pipetteId:t,trashId:Object.keys(p)[0],flowRate:i})]};function u_(e){const{labwareEntities:t,pipetteEntities:r,wasteChuteEntities:n,trashBinEntities:a}=e;return{pipettes:lt(r,(s,o,i)=>{const l=o.spec;return{...s,[i]:c_(l.channels,{})}},{}),labware:lt(t,(s,o,i)=>({...s,[i]:Xt(o.def.wells,()=>({}))}),{}),trashBins:lt(a,(s,o,i)=>({...s,[i]:{}}),{}),wasteChute:lt(n,(s,o,i)=>({...s,[i]:{}}),{})}}function c_(e,t){return cn(e).reduce((r,n)=>({...r,[n]:t}),{})}const p_=e=>{const{blowoutLocation:t,sourceLabware:r,destLabware:n,sourceWell:a,destWell:s}=e;return t===Hr&&r!=null&&a!=null?{dispenseAirGapLabware:r,dispenseAirGapWell:a}:{dispenseAirGapLabware:n,dispenseAirGapWell:s}};function Tc(e){const{invariantContext:t,labwareLocations:r,moduleLocations:n={},pipetteLocations:a}=e;return{labware:r,modules:n,pipettes:a,liquidState:u_(t),tipState:{pipettes:lt(a,(s,o,i)=>o.mount?{...s,[i]:{hasTip:!1,tiprackURI:null}}:s,{}),tipracks:lt(r,(s,o,i)=>{const l=t.labwareEntities[i].def;if(!c.getIsTiprack(l))return s;const u=Xt(l.wells,()=>ga);return{...s,[i]:u}},{})}}}const d_=(e,t)=>e.tipracks[t]!=null?Object.values(e.tipracks[t]).some(r=>r!==se):!1,f_=(e,t)=>e.labware[t]!=null?Object.values(e.labware[t]).some(r=>Object.values(r).some(n=>n.volume>0)):!1,Cg=(e,t,r)=>{const{destinationId:n,pipetteId:a,volume:s,flowRate:o,offsetFromBottomMm:i,well:l,xOffset:u,yOffset:p,tipRack:d,primaryNozzle:f,nozzles:_}=e,{labwareEntities:m,trashBinEntities:h,wasteChuteEntities:b}=t,T=Ln(m,b,h,n);let y=[];return T==="labware"&&i!=null&&l!=null?y=[U(Qh,{pipetteId:a,volume:s,labwareId:n,wellName:l,flowRate:o,wellLocation:{origin:"bottom",offset:{z:i,x:u,y:p}},tipRack:d,primaryNozzle:f,nozzles:_})]:T==="wasteChute"?y=[U(gA,{pipetteId:a,volume:s,flowRate:o,wasteChuteId:b[n].id})]:y=[U(TA,{pipetteId:a,volume:s,flowRate:o,trashId:h[n].id})],ce(y,t,r)},Dg=(e,t,r)=>{const{destinationId:n,pipetteId:a,zOffset:s,well:o}=e,{labwareEntities:i,wasteChuteEntities:l,trashBinEntities:u}=t,p=Ln(i,l,u,n);let d=[];return p==="labware"&&o!=null?d=[U(V,{pipetteId:a,labwareId:n,wellName:o,wellLocation:{origin:"bottom",offset:{x:0,y:0,z:s}}})]:p==="wasteChute"?d=[U(qe,{pipetteId:a,fixtureId:l[n].id,offset:{x:0,y:0,z:0}})]:d=[U(qe,{pipetteId:a,fixtureId:u[n].id,offset:It})],ce(d,t,r)},Mg=(e,t,r)=>{const{blowOutLocation:n,destinationId:a,destWell:s,flowRate:o,pipetteId:i,sourceId:l,sourceWell:u,volume:p}=e,{labwareEntities:d,trashBinEntities:f,wasteChuteEntities:_}=t,m=Ln(d,_,f,a);let h=[];if(m==="labware"&&s!=null){const{dispenseAirGapLabware:b,dispenseAirGapWell:T}=p_({blowoutLocation:n,sourceLabware:l,destLabware:a,sourceWell:u,destWell:s});h=[U(dA,{flowRate:o,pipetteId:i,labwareId:b,wellName:T,volume:p,type:"dispense"})]}else m==="wasteChute"?h=[U(pA,{pipetteId:i,volume:p,flowRate:o,wasteChuteId:_[a].id})]:h=[U(cA,{pipetteId:i,volume:p,flowRate:o,trashId:f[a].id})];return ce(h,t,r)},Fg=(e,t,r)=>{const{pipetteId:n,destinationId:a,well:s,zOffset:o,seconds:i}=e,{labwareEntities:l,trashBinEntities:u,wasteChuteEntities:p}=t,d=Ln(l,p,u,a);let f=[];return s!=null&&d==="labware"?f=[U(V,{pipetteId:n,labwareId:a,wellName:s,wellLocation:{origin:"bottom",offset:{x:0,y:0,z:o}}}),U(he,{seconds:i})]:d==="wasteChute"?f=[U(qe,{pipetteId:n,fixtureId:a,offset:It}),U(he,{seconds:i})]:f=[U(qe,{pipetteId:n,fixtureId:a,offset:It}),U(he,{seconds:i})],ce(f,t,r)},z=(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}},gc=e=>e==null?(console.error("expected to find stack but could not"),"unknown top location"):e[0],m_=e=>e.length>=2?e[1]:null,ys=(e,t)=>Object.values(e).reduce((r,{stack:n})=>(n[n.length-1]===t&&n.length>r.length&&(r=n),r),[]),Ic=e=>c.FLEX_SINGLE_SLOT_BY_CUTOUT_ID[c.FLEX_CUTOUT_BY_SLOT_ID[e]],h_=e=>{const t=c.FLEX_STACKER_ADDRESSABLE_AREAS.indexOf(e);return t===-1?null:De[t]},qg=e=>{const t=h_(e);return t!=null?Ic(t):null},__=(e,t,r)=>{if(e==null)return null;if(De.includes(e)){const n=Ic(e);return Object.entries(t).some(([s,o])=>r[s]?.type===c.FLEX_STACKER_MODULE_TYPE&&o.slot===n)?n:e}return e},bs=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:s})=>s===c.FLEX_STACKER_V1_FIXTURE)?.providesAddressableAreas[n];return c.FLEX_STACKER_ADDRESSABLE_AREAS.find(s=>a?.includes(s))??null},y_=(e,t,r,n)=>{if(t.length===0)return{isCompatible:!0,isAboveStackLimit:!1};let a=!1;const s=t.find(u=>u in n);s!=null&&(a=n[s].type===c.FLEX_STACKER_MODULE_TYPE&&t.includes(He));const o=gc(t);let i=!0,l=!1;if(o in r){const u=r[e],p=r[o],d=t.filter(I=>r[I]!=null),f=d.filter(I=>r[I]?.def?.allowedRoles?.includes("lid"))[0],_=d.filter(I=>r[I]?.def?.allowedRoles?.includes("adapter"))[0],m=p.def.parameters.loadName,h=d.filter(I=>!r[I]?.def?.allowedRoles?.includes("adapter")&&!r[I]?.def?.allowedRoles?.includes("lid"))[0];if(a){const I=c.getMaxPoolCount({labwareDefinitions:{primary:r[h]?.def??null,adapter:r[_]?.def??null,lid:r[f]?.def??null},model:c.FLEX_STACKER_MODULE_V1});l=t.length>I}else{const I=p.def.stackLimit??1,L=m===u.def.parameters.loadName,A=t.filter(E=>r[E]?.def.parameters.loadName===m)?.length;l=L&&A>=I}const b=u.def.parameters.loadName==="opentrons_tough_universal_lid",T=p.def.metadata.displayCategory==="tubeRack",y=p.def.metadata.displayCategory==="aluminumBlock",S=p.def.parameters.isTiprack,g=(p.def.allowedRoles??[]).includes("lid");i=u.def.compatibleParentLabware?.some(I=>I===m)||Object.keys(u.def.stackingOffsetWithLabware??{}).some(I=>I===m)||b&&!T&&!y&&!S&&(p.def.parameters.loadName==="opentrons_tough_universal_lid"||!g)}else if(o in n){const u=n[o],{model:p}=u;i=Object.keys(r[e].def.stackingOffsetWithModule??{}).some(d=>p===d)}return{isCompatible:i,isAboveStackLimit:l}},Oa=(e,t)=>t?.find(r=>e[r]!=null)??null,Ec=(e,t,r)=>{if(t==="offDeck"&&r==null)return console.error("offDeck slot is not allowed to be used without an offDeckOverrideId"),[];const n=b_(t),a=n?Sh[t]:t,s=Object.values(e).filter(o=>o.stack.includes(a)&&(r==null||o.stack.includes(r))&&o.stack.includes(He)===n);return n?s.reverse()[0].stack??[]:s.sort((o,i)=>i.stack.length-o.stack.length)[0]?.stack??[]},Ug=(e,t)=>Object.values(t).filter(r=>r.stack.includes(e)).sort((r,n)=>n.stack.length-r.stack.length)[0]?.stack[0],ea=(e,t,r,n=!0)=>{const a=c.linearInterpolate(e,t)??0,s=c.linearInterpolate(e,r)??0;return e+(n?a:0)+s},wc=e=>{const{path:t,volume:r,pipetteSpecs:n,tiprackDefinition:a,conditioningByVolume:s,disposalByVolume:o,numDispenseWells:i,numAspirateWells:l,aspirateAirGapByVolume:u}=e,{liquids:p}=n,f=r<p.default.minVolume&&"lowVolumeDefault"in p?p.lowVolumeDefault.maxVolume:p.default.maxVolume,_=a?.wells.A1.totalLiquidVolume,m=_==null?f:Math.min(f,_),h=r*2,b=s!=null?c.linearInterpolate(h,s)??0:0,y=a?.namespace!=="opentrons"||s!=null&&o!=null&&m>=h+b+(c.linearInterpolate(h,o)??0)+(b===0?c.linearInterpolate(h,u)??0:0),S=m>=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"&&!S){const L=c.linearInterpolate(r,u)??0,A=Math.ceil((r+L)/m),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 L=0,A=0;for(let E=0;E<i&&!(ea((E+1)*r,s??[],o??[])>m);E++)L=(E+1)*r,A+=1;return{referenceVolumes:{airGap:{aspirate:ea(L,s??[],o??[],!1),dispense:ea((A-1)*r,s??[],o??[],!1)},correction:{aspirate:ea(L,s??[],o??[]),dispense:r},flowRate:{aspirate:ea(L,s??[],o??[]),dispense:r},pushOut:r,conditioning:L,disposal:L},multiWellHandling:{isSupported:!0,numWellsToFitInTip:A}}}const w=Math.floor(m/r),g=Math.min(w,l),I=g*r;return{referenceVolumes:{airGap:{aspirate:I,dispense:0},pushOut:I,correction:{aspirate:I,dispense:I},flowRate:{aspirate:r,dispense:I}},multiWellHandling:{isSupported:!0,numWellsToFitInTip:g}}},Fr=e=>{const{retractZOffset:t,retractPositionReference:r,labwareId:n,labwareEntities:a,well:s}=e;if(s==null)return!1;const o=a[n]?.def.wells[s]?.depth;if(o==null)return!1;const i=c.getMmFromBottom(t,r,o);return i==null?!1:i-o>=c.SAFE_MOVE_TO_WELL_OFFSET_FROM_TOP_MM},Fu=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]},[]),Bg={A4:"cutoutA3",B4:"cutoutB3",C4:"cutoutC3",D4:"cutoutD3"};function qu(e){if(e.location!=="offDeck"&&e.location!=="systemLocation"&&e.location!=="wasteChuteLocation"&&"addressableAreaName"in e.location&&wh.includes(e.location.addressableAreaName)){const t=D(),r=e.location.addressableAreaName,n=Bg[r]??r;return{[t]:{id:t,location:n}}}return{}}const $g=(e,t)=>{const r=ys(e,t),n=r.indexOf(He);return r[n-1]},b_=e=>Ah.includes(e),Ac=e=>e.labwareOnShuttle?.primaryLabwareId??null,Sc=(e,t,r)=>{if(r?.storedLabwareDetails==null)return!0;const n=Object.values(r?.storedLabwareDetails??{}).reduce((s,o)=>o!=null?[...s,o]:s,[]),a=t.labwareEntities[e];return n.some(s=>a?.labwareDefURI===s)},Lc=(e,t)=>{const{storedLabwareDetails:r}=e??{};if(r==null)return!0;const{primaryLabwareURI:n,adapterLabwareURI:a,lidLabwareURI:s}=r,o=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===s);if(o==null)return console.error("Primary labware entity not found"),!1;const u=c.getMaxPoolCount({labwareDefinitions:{primary:o.def,adapter:i?.def??null,lid:l?.def??null},model:c.FLEX_STACKER_MODULE_V1}),d=e?.labwareInHopper?.length??0;return u>d},Ra=(e,t,r)=>{const n=t[r]?.stack,a=Oa(e,n),s=a!=null?e[a].moduleState:null;return!!(s&&s.type===c.ABSORBANCE_READER_TYPE&&s.lidOpen!==!0)};var pl,Lf;function T_(){if(Lf)return pl;Lf=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return pl=e,pl}var Vg=T_();const Oc=xe(Vg);var g_=Symbol.for("immer-nothing"),Of=Symbol.for("immer-draftable"),at=Symbol.for("immer-state"),xg=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 Ye(e,...t){if(process.env.NODE_ENV!=="production"){const r=xg[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 ia=Object.getPrototypeOf;function _n(e){return!!e&&!!e[at]}function qr(e){return e?I_(e)||Array.isArray(e)||!!e[Of]||!!e.constructor?.[Of]||ka(e)||gs(e):!1}var Hg=Object.prototype.constructor.toString(),Rf=new WeakMap;function I_(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=Rf.get(r);return n===void 0&&(n=Function.toString.call(r),Rf.set(r,n)),n===Hg}function Za(e,t,r=!0){Ts(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 Ts(e){const t=e[at];return t?t.type_:Array.isArray(e)?1:ka(e)?2:gs(e)?3:0}function Uu(e,t){return Ts(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function E_(e,t,r){const n=Ts(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function jg(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ka(e){return e instanceof Map}function gs(e){return e instanceof Set}function Nr(e){return e.copy_||e.base_}function Bu(e,t){if(ka(e))return new Map(e);if(gs(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=I_(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[at];let a=Reflect.ownKeys(n);for(let s=0;s<a.length;s++){const o=a[s],i=n[o];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(ia(e),n)}else{const n=ia(e);if(n!==null&&r)return{...e};const a=Object.create(n);return Object.assign(a,e)}}function Rc(e,t=!1){return Is(e)||_n(e)||!qr(e)||(Ts(e)>1&&Object.defineProperties(e,{set:Ga,add:Ga,clear:Ga,delete:Ga}),Object.freeze(e),t&&Object.values(e).forEach(r=>Rc(r,!0))),e}function zg(){Ye(2)}var Ga={value:zg};function Is(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var Gg={};function Ur(e){const t=Gg[e];return t||Ye(0,e),t}var la;function w_(){return la}function Wg(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function kf(e,t){t&&(Ur("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function $u(e){Vu(e),e.drafts_.forEach(Yg),e.drafts_=null}function Vu(e){e===la&&(la=e.parent_)}function vf(e){return la=Wg(la,e)}function Yg(e){const t=e[at];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Pf(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[at].modified_&&($u(t),Ye(4)),qr(e)&&(e=Qa(t,e),t.parent_||Ja(t,e)),t.patches_&&Ur("Patches").generateReplacementPatches_(r[at].base_,e,t.patches_,t.inversePatches_)):e=Qa(t,r,[]),$u(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==g_?e:void 0}function Qa(e,t,r){if(Is(t))return t;const n=e.immer_.shouldUseStrictIteration(),a=t[at];if(!a)return Za(t,(s,o)=>Nf(e,a,t,s,o,r),n),t;if(a.scope_!==e)return t;if(!a.modified_)return Ja(e,a.base_,!0),a.base_;if(!a.finalized_){a.finalized_=!0,a.scope_.unfinalizedDrafts_--;const s=a.copy_;let o=s,i=!1;a.type_===3&&(o=new Set(s),s.clear(),i=!0),Za(o,(l,u)=>Nf(e,a,s,l,u,r,i),n),Ja(e,s,!1),r&&e.patches_&&Ur("Patches").generatePatches_(a,r,e.patches_,e.inversePatches_)}return a.copy_}function Nf(e,t,r,n,a,s,o){if(a==null||typeof a!="object"&&!o)return;const i=Is(a);if(!(i&&!o)){if(process.env.NODE_ENV!=="production"&&a===r&&Ye(5),_n(a)){const l=s&&t&&t.type_!==3&&!Uu(t.assigned_,n)?s.concat(n):void 0,u=Qa(e,a,l);if(E_(r,n,u),_n(u))e.canAutoFreeze_=!1;else return}else o&&r.add(a);if(qr(a)&&!i){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===a&&i)return;Qa(e,a),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(ka(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&Ja(e,a)}}}function Ja(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Rc(t,r)}function Kg(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:w_(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=n,s=kc;r&&(a=[n],s=ua);const{revoke:o,proxy:i}=Proxy.revocable(a,s);return n.draft_=i,n.revoke_=o,i}var kc={get(e,t){if(t===at)return e;const r=Nr(e);if(!Uu(r,t))return Xg(e,r,t);const n=r[t];return e.finalized_||!qr(n)?n:n===dl(e.base_,t)?(fl(e),e.copy_[t]=Hu(n,e)):n},has(e,t){return t in Nr(e)},ownKeys(e){return Reflect.ownKeys(Nr(e))},set(e,t,r){const n=A_(Nr(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const a=dl(Nr(e),t),s=a?.[at];if(s&&s.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(jg(r,a)&&(r!==void 0||Uu(e.base_,t)))return!0;fl(e),xu(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 dl(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,fl(e),xu(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Nr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){Ye(11)},getPrototypeOf(e){return ia(e.base_)},setPrototypeOf(){Ye(12)}},ua={};Za(kc,(e,t)=>{ua[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});ua.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Ye(13),ua.set.call(this,e,t,void 0)};ua.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Ye(14),kc.set.call(this,e[0],t,r,e[0])};function dl(e,t){const r=e[at];return(r?Nr(r):e)[t]}function Xg(e,t,r){const n=A_(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}function A_(e,t){if(!(t in e))return;let r=ia(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=ia(r)}}function xu(e){e.modified_||(e.modified_=!0,e.parent_&&xu(e.parent_))}function fl(e){e.copy_||(e.copy_=Bu(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Zg=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 s=r;r=t;const o=this;return function(l=s,...u){return o.produce(l,p=>r.call(this,p,...u))}}typeof r!="function"&&Ye(6),n!==void 0&&typeof n!="function"&&Ye(7);let a;if(qr(t)){const s=vf(this),o=Hu(t,void 0);let i=!0;try{a=r(o),i=!1}finally{i?$u(s):Vu(s)}return kf(s,n),Pf(a,s)}else if(!t||typeof t!="object"){if(a=r(t),a===void 0&&(a=t),a===g_&&(a=void 0),this.autoFreeze_&&Rc(a,!0),n){const s=[],o=[];Ur("Patches").generateReplacementPatches_(t,a,s,o),n(s,o)}return a}else Ye(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(o,...i)=>this.produceWithPatches(o,l=>t(l,...i));let n,a;return[this.produce(t,r,(o,i)=>{n=o,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){qr(e)||Ye(8),_n(e)&&(e=Qg(e));const t=vf(this),r=Hu(e,void 0);return r[at].isManual_=!0,Vu(t),r}finishDraft(e,t){const r=e&&e[at];(!r||!r.isManual_)&&Ye(9);const{scope_:n}=r;return kf(n,t),Pf(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=Ur("Patches").applyPatches_;return _n(e)?n(e,t):this.produce(e,a=>n(a,t))}};function Hu(e,t){const r=ka(e)?Ur("MapSet").proxyMap_(e,t):gs(e)?Ur("MapSet").proxySet_(e,t):Kg(e,t);return(t?t.scope_:w_()).drafts_.push(r),r}function Qg(e){return _n(e)||Ye(10,e),S_(e)}function S_(e){if(!qr(e)||Is(e))return e;const t=e[at];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Bu(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Bu(e,!0);return Za(r,(a,s)=>{E_(r,a,S_(s))},n),t&&(t.finalized_=!1),r}var Jg=new Zg,L_=Jg.produce;function eI(e,t){let n=0;const a=[];for(;n+1<e.length;){const s=e[n],o=e[n+1];if(t(s,o)){n+=2;continue}else a.push(s),n+=1}return n+1===e.length&&a.push(e[n]),a}const tI=(e,t)=>["pipetteId","volume","labwareId","wellName"].every(n=>e[n]===t[n]),rI=e=>eI(e,(t,r)=>t.commandType==="aspirate"&&r.commandType==="dispense"&&tI(t.params,r.params)),O_=e=>rI(e),vc=(e,t)=>{const r=At(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)},nI=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=vc(n,a);s!=null&&(s.lidOpen=!0)},aI=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=vc(n,a);s!=null&&(s.lidOpen=!1)},sI=(e,t,r)=>{const{robotState:n}=r,{moduleId:a,measureMode:s,sampleWavelengths:o,referenceWavelength:i}=e,l=vc(n,a);l!=null&&(l.initialization={mode:s,wavelengths:o,referenceWavelength:i},l.lidOpen=!1)};function oI(e,t,r){const{pipetteId:n,volume:a}=e,{robotState:s}=r,o=s.pipettes[n].nozzles;let l=t.pipetteEntities[n].spec.channels;o===c.COLUMN?l=8:o===c.SINGLE&&(l=1),cn(l).forEach(u=>{const p=s.liquidState.pipettes[n][u]??{},d=p[je]?.volume??0;s.liquidState.pipettes[n][u]={...p,[je]:{volume:d+a}}})}var ml,Cf;function iI(){if(Cf)return ml;Cf=1;var e=$h(),t=Aa(),r=as(),n=Ke(),a=xr(),s=cs(),o=ds(),i=lc(),l="[object Map]",u="[object Set]",p=Object.prototype,d=p.hasOwnProperty;function f(_){if(_==null)return!0;if(a(_)&&(n(_)||typeof _=="string"||typeof _.splice=="function"||s(_)||i(_)||r(_)))return!_.length;var m=t(_);if(m==l||m==u)return!_.size;if(o(_))return!e(_).length;for(var h in _)if(d.call(_,h))return!1;return!0}return ml=f,ml}var lI=iI();const hl=xe(lI);var _l,Df;function uI(){if(Df)return _l;Df=1;function e(t,r,n,a){for(var s=t.length,o=n+(a?1:-1);a?o--:++o<s;)if(r(t[o],o,t))return o;return-1}return _l=e,_l}var yl,Mf;function cI(){if(Mf)return yl;Mf=1;function e(t){return t!==t}return yl=e,yl}var bl,Ff;function pI(){if(Ff)return bl;Ff=1;function e(t,r,n){for(var a=n-1,s=t.length;++a<s;)if(t[a]===r)return a;return-1}return bl=e,bl}var Tl,qf;function dI(){if(qf)return Tl;qf=1;var e=uI(),t=cI(),r=pI();function n(a,s,o){return s===s?r(a,s,o):e(a,t,o)}return Tl=n,Tl}var gl,Uf;function fI(){if(Uf)return gl;Uf=1;var e=dI();function t(r,n){var a=r==null?0:r.length;return!!a&&e(r,n,0)>-1}return gl=t,gl}var Il,Bf;function mI(){if(Bf)return Il;Bf=1;function e(t,r,n){for(var a=-1,s=t==null?0:t.length;++a<s;)if(n(r,t[a]))return!0;return!1}return Il=e,Il}var El,$f;function hI(){if($f)return El;$f=1;function e(){}return El=e,El}var wl,Vf;function _I(){if(Vf)return wl;Vf=1;var e=xh(),t=hI(),r=nc(),n=1/0,a=e&&1/r(new e([,-0]))[1]==n?function(s){return new e(s)}:t;return wl=a,wl}var Al,xf;function yI(){if(xf)return Al;xf=1;var e=kh(),t=fI(),r=mI(),n=Ph(),a=_I(),s=nc(),o=200;function i(l,u,p){var d=-1,f=t,_=l.length,m=!0,h=[],b=h;if(p)m=!1,f=r;else if(_>=o){var T=u?null:a(l);if(T)return s(T);m=!1,f=n,b=new e}else b=u?[]:h;e:for(;++d<_;){var y=l[d],S=u?u(y):y;if(y=p||y!==0?y:0,m&&S===S){for(var w=b.length;w--;)if(b[w]===S)continue e;u&&b.push(S),h.push(y)}else f(b,S,p)||(b!==h&&b.push(S),h.push(y))}return h}return Al=i,Al}var Sl,Hf;function bI(){if(Hf)return Sl;Hf=1;var e=yI();function t(r){return r&&r.length?e(r):[]}return Sl=t,Sl}var TI=bI();const gI=xe(TI),Pc=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 II(e,t,r){const{pipetteId:n,volume:a}=e,{robotState:s,warnings:o}=r,i="labwareId"in e?e.labwareId:s.pipettes[n].entityId??"",l="wellName"in e?e.wellName:s.pipettes[n].wellName??"",{liquidState:u}=s,p=s.pipettes[n].nozzles,d=r.robotState.pipettes[n].primaryNozzle,f=t.pipetteEntities[n].spec,_=t.labwareEntities[i].def,m=_.metadata.displayCategory==="reservoir",h=Pc({pipetteSpec:f,nozzles:p,primaryNozzle:d}),{allWellsShared:b,wellsForTips:T}=bc(h,_,l);if(console.assert(gI(T).length===b?1:T.length,`expected all wells to be shared, or no wells to be shared. Got: ${JSON.stringify(T)}`),h>1&&b){const S=T[0],w=u.labware[i][S],g=a*h>pr(w);hl(w)?o.push(ul()):g&&o.push(ll());const I=g?pr(w)/h:a,L=Kt(I,w).dest;cn(h).forEach(A=>{const E=u.pipettes[n],k=A.toString(),R=E[k],B=g?dr(R,{...L,[je]:{volume:a-I}}):dr(R,L);E[k]=B}),u.labware[i][S]=Kt(a*h,u.labware[i][S]).source;return}if(h===96&&m){T.forEach(S=>{const w=u.labware[i][S],g=a*8>pr(w);hl(w)?o.push(ul()):g&&o.push(ll());const I=g?pr(w)/8:a,L=Kt(I,w).dest;cn(h).forEach(A=>{const E=u.pipettes[n],k=A.toString(),R=E[k],B=g?dr(R,{...L,[je]:{volume:a-I}}):dr(R,L);E[k]=B}),u.labware[i][S]=Kt(I*8,u.labware[i][S]).source});return}cn(h).forEach(S=>{const w=S.toString(),g=u.pipettes[n],I=g[w],L=u.labware[i][T[S]],A=Kt(a,L).dest;hl(L)?o.push(ul()):a>pr(L)&&o.push(ll()),g[w]=dr(I,A)});const y=u.labware[i];T.forEach(S=>{y[S]=Kt(a,y[S]).source}),"labwareId"in e&&(s.pipettes[n]={...s.pipettes[n],entityId:e.labwareId,wellName:l})}function Es(e){const{robotStateAndWarnings:t,invariantContext:r,entityId:n,pipetteId:a,prevLiquidState:s,useFullVolume:o,volume:i,wellName:l}=e,u=r.pipetteEntities[a].spec,p=t.robotState.pipettes[a].nozzles,d=t.robotState.pipettes[a].primaryNozzle,f=Pc({pipetteSpec:u,nozzles:p,primaryNozzle:d}),_=l??null,m=r.labwareEntities[n]!=null?r.labwareEntities[n].def:null;console.assert(!(o&&typeof i=="number"),"dispenseUpdateLiquidState takes either `volume` or `useFullVolume`, but got both"),console.assert(typeof i=="number"||o,"in dispenseUpdateLiquidState, either volume or useFullVolume are required");const{wellsForTips:h,allWellsShared:b}=m!=null&&l!=null?bc(f,m,l):{wellsForTips:null,allWellsShared:!0},T=s.labware[n]!=null?s.labware[n]:null;let y=null;s.trashBins[n]!=null?y=s.trashBins[n]:s.wasteChute[n]!=null&&(y=s.wasteChute[n]);const S=Xt(s.pipettes[a],L=>{const{...A}=L;if(o){const E=pr(A);return E>0?Kt(E,A):{source:{},dest:{}}}return Kt(i||0,A)});let w=null;if(_!=null&&T!=null)w={[_]:lt(S,(L,A)=>dr(L,A.dest),T[_])};else if(y!=null){const L=Object.values(s.pipettes[a]).reduce((A,E)=>A+(E[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 g=_!=null&&T!=null&&h!=null?h.reduce((L,A,E)=>({...L,[A]:dr(S[`${E}`].dest,T[A]||{})}),{}):{},I=b?w:g;s.pipettes[a]=Xt(S,"source"),s.trashBins[n]!=null&&y!=null?Object.assign(s.trashBins[n],y):s.wasteChute[n]!=null&&y!=null?Object.assign(s.wasteChute[n],y):s.labware[n]!=null&&I!=null&&(s.labware[n]=Object.assign(T??{},I))}function EI(e,t,r){const{pipetteId:n,labwareId:a,wellName:s}=e,{robotState:o}=r;Es({pipetteId:n,entityId:a,useFullVolume:!0,wellName:s,prevLiquidState:o.liquidState,invariantContext:t,robotStateAndWarnings:r})}function wI(e,t,r){const{pipetteId:n,configurationParams:a}=e,{robotState:s}=r;s.pipettes[n].nozzles=a.style,s.pipettes[n].primaryNozzle=a.primaryNozzle}function AI(e,t,r){const{pipetteId:n,volume:a}=e,{robotState:s}=r,o="labwareId"in e?e.labwareId:s.pipettes[n].entityId??"",i="wellName"in e?e.wellName:s.pipettes[n].wellName??"",l=s.liquidState.pipettes[n],p=Object.values(l)[0]?.[je]?.volume??0,d=r.robotState.pipettes[n].primaryNozzle;if(Es({invariantContext:t,entityId:o,pipetteId:n,prevLiquidState:s.liquidState,useFullVolume:!1,volume:a,wellName:i,robotStateAndWarnings:r}),p>0){const f=r.robotState.pipettes[n].nozzles,_=t.pipetteEntities[n].spec,m=Pc({pipetteSpec:_,nozzles:f,primaryNozzle:d});Object.keys(l).slice(0,m).forEach(b=>{const T=l[b]??{};l[b]={...T,[je]:{volume:0}}})}"labwareId"in e&&(s.pipettes[n]={...s.pipettes[n],entityId:e.labwareId})}function SI(e,t,r){const{pipetteId:n,wellName:a,labwareId:s}=e,{robotState:o}=r;o.tipState.pipettes[n].hasTip=!1,o.tipState.pipettes[n].tiprackURI=null,o.pipettes[n].tiprackId=void 0;const i=o.tipState,l=t.pipetteEntities[n].spec,u=o.pipettes[n].nozzles,p=$c(u,l),d=(_,m)=>_.find(h=>h.includes(m)),f=t.labwareEntities[s].def;if(f==null||!c.getIsTiprack(f))throw new Error(`forDropTip expected ${s} to have definition and to be a tiprack`);p===c.SINGLE?i.tipracks[s][a]=Wt:p===c.COLUMN?(d(f.ordering,a)??[]).forEach(m=>i.tipracks[s][m]=Wt):p===c.ALL?l.channels===96?f.ordering.reduce((m,h)=>m.concat(h),[]).forEach(function(m){i.tipracks[s][m]=Wt}):(d(f.ordering,a)??[]).forEach(m=>i.tipracks[s][m]=Wt):l.channels===1?i.tipracks[s][a]=Wt:l.channels===96?f.ordering.reduce((m,h)=>m.concat(h),[]).forEach(function(m){i.tipracks[s][m]=Wt}):(d(f.ordering,a)??[]).forEach(m=>i.tipracks[s][m]=Wt),o.pipettes[n].entityId=s,o.pipettes[n].wellName=a}function LI(e,t,r){const{labwareId:n,liquidId:a,volumeByWell:s}=e;Object.entries(s).forEach(([o,i])=>{r.robotState.liquidState.labware[n][o][a]={volume:i}})}var Ll,jf;function OI(){if(jf)return Ll;jf=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 Ll=e,Ll}var Ol,zf;function Nc(){if(zf)return Ol;zf=1;var e=dc(),t=ss(),r=Object.prototype,n=r.hasOwnProperty;function a(s,o,i){var l=s[o];(!(n.call(s,o)&&t(l,i))||i===void 0&&!(o in s))&&e(s,o,i)}return Ol=a,Ol}var Rl,Gf;function va(){if(Gf)return Rl;Gf=1;var e=Nc(),t=dc();function r(n,a,s,o){var i=!s;s||(s={});for(var l=-1,u=a.length;++l<u;){var p=a[l],d=o?o(s[p],n[p],p,s,n):void 0;d===void 0&&(d=n[p]),i?t(s,p,d):e(s,p,d)}return s}return Rl=r,Rl}var kl,Wf;function RI(){if(Wf)return kl;Wf=1;var e=va(),t=wa();function r(n,a){return n&&e(a,t(a),n)}return kl=r,kl}var vl,Yf;function kI(){if(Yf)return vl;Yf=1;function e(t){var r=[];if(t!=null)for(var n in Object(t))r.push(n);return r}return vl=e,vl}var Pl,Kf;function vI(){if(Kf)return Pl;Kf=1;var e=Jt(),t=ds(),r=kI(),n=Object.prototype,a=n.hasOwnProperty;function s(o){if(!e(o))return r(o);var i=t(o),l=[];for(var u in o)u=="constructor"&&(i||!a.call(o,u))||l.push(u);return l}return Pl=s,Pl}var Nl,Xf;function Cc(){if(Xf)return Nl;Xf=1;var e=Uh(),t=vI(),r=xr();function n(a){return r(a)?e(a,!0):t(a)}return Nl=n,Nl}var Cl,Zf;function PI(){if(Zf)return Cl;Zf=1;var e=va(),t=Cc();function r(n,a){return n&&e(a,t(a),n)}return Cl=r,Cl}var na={exports:{}};na.exports;var Qf;function NI(){return Qf||(Qf=1,(function(e,t){var r=Bt(),n=t&&!t.nodeType&&t,a=n&&!0&&e&&!e.nodeType&&e,s=a&&a.exports===n,o=s?r.Buffer:void 0,i=o?o.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})(na,na.exports)),na.exports}var Dl,Jf;function CI(){if(Jf)return Dl;Jf=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 Dl=e,Dl}var Ml,em;function DI(){if(em)return Ml;em=1;var e=va(),t=ac();function r(n,a){return e(n,t(n),a)}return Ml=r,Ml}var Fl,tm;function Dc(){if(tm)return Fl;tm=1;var e=Bh(),t=e(Object.getPrototypeOf,Object);return Fl=t,Fl}var ql,rm;function R_(){if(rm)return ql;rm=1;var e=Ju(),t=Dc(),r=ac(),n=Fh(),a=Object.getOwnPropertySymbols,s=a?function(o){for(var i=[];o;)e(i,r(o)),o=t(o);return i}:n;return ql=s,ql}var Ul,nm;function MI(){if(nm)return Ul;nm=1;var e=va(),t=R_();function r(n,a){return e(n,t(n),a)}return Ul=r,Ul}var Bl,am;function Mc(){if(am)return Bl;am=1;var e=Dh(),t=R_(),r=Cc();function n(a){return e(a,r,t)}return Bl=n,Bl}var $l,sm;function FI(){if(sm)return $l;sm=1;var e=Object.prototype,t=e.hasOwnProperty;function r(n){var a=n.length,s=new n.constructor(a);return a&&typeof n[0]=="string"&&t.call(n,"index")&&(s.index=n.index,s.input=n.input),s}return $l=r,$l}var Vl,om;function Fc(){if(om)return Vl;om=1;var e=Ch();function t(r){var n=new r.constructor(r.byteLength);return new e(n).set(new e(r)),n}return Vl=t,Vl}var xl,im;function qI(){if(im)return xl;im=1;var e=Fc();function t(r,n){var a=n?e(r.buffer):r.buffer;return new r.constructor(a,r.byteOffset,r.byteLength)}return xl=t,xl}var Hl,lm;function UI(){if(lm)return Hl;lm=1;var e=/\w*$/;function t(r){var n=new r.constructor(r.source,e.exec(r));return n.lastIndex=r.lastIndex,n}return Hl=t,Hl}var jl,um;function BI(){if(um)return jl;um=1;var e=bn(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function n(a){return r?Object(r.call(a)):{}}return jl=n,jl}var zl,cm;function $I(){if(cm)return zl;cm=1;var e=Fc();function t(r,n){var a=n?e(r.buffer):r.buffer;return new r.constructor(a,r.byteOffset,r.length)}return zl=t,zl}var Gl,pm;function VI(){if(pm)return Gl;pm=1;var e=Fc(),t=qI(),r=UI(),n=BI(),a=$I(),s="[object Boolean]",o="[object Date]",i="[object Map]",l="[object Number]",u="[object RegExp]",p="[object Set]",d="[object String]",f="[object Symbol]",_="[object ArrayBuffer]",m="[object DataView]",h="[object Float32Array]",b="[object Float64Array]",T="[object Int8Array]",y="[object Int16Array]",S="[object Int32Array]",w="[object Uint8Array]",g="[object Uint8ClampedArray]",I="[object Uint16Array]",L="[object Uint32Array]";function A(E,k,R){var B=E.constructor;switch(k){case _:return e(E);case s:case o:return new B(+E);case m:return t(E,R);case h:case b:case T:case y:case S:case w:case g:case I:case L:return a(E,R);case i:return new B;case l:case d:return new B(E);case u:return r(E);case p:return new B;case f:return n(E)}}return Gl=A,Gl}var Wl,dm;function xI(){if(dm)return Wl;dm=1;var e=Jt(),t=Object.create,r=(function(){function n(){}return function(a){if(!e(a))return{};if(t)return t(a);n.prototype=a;var s=new n;return n.prototype=void 0,s}})();return Wl=r,Wl}var Yl,fm;function HI(){if(fm)return Yl;fm=1;var e=xI(),t=Dc(),r=ds();function n(a){return typeof a.constructor=="function"&&!r(a)?e(t(a)):{}}return Yl=n,Yl}var Kl,mm;function jI(){if(mm)return Kl;mm=1;var e=Aa(),t=Qt(),r="[object Map]";function n(a){return t(a)&&e(a)==r}return Kl=n,Kl}var Xl,hm;function zI(){if(hm)return Xl;hm=1;var e=jI(),t=oc(),r=ic(),n=r&&r.isMap,a=n?t(n):e;return Xl=a,Xl}var Zl,_m;function GI(){if(_m)return Zl;_m=1;var e=Aa(),t=Qt(),r="[object Set]";function n(a){return t(a)&&e(a)==r}return Zl=n,Zl}var Ql,ym;function WI(){if(ym)return Ql;ym=1;var e=GI(),t=oc(),r=ic(),n=r&&r.isSet,a=n?t(n):e;return Ql=a,Ql}var Jl,bm;function k_(){if(bm)return Jl;bm=1;var e=rc(),t=OI(),r=Nc(),n=RI(),a=PI(),s=NI(),o=CI(),i=DI(),l=MI(),u=Vh(),p=Mc(),d=Aa(),f=FI(),_=VI(),m=HI(),h=Ke(),b=cs(),T=zI(),y=Jt(),S=WI(),w=wa(),g=Cc(),I=1,L=2,A=4,E="[object Arguments]",k="[object Array]",R="[object Boolean]",B="[object Date]",F="[object Error]",te="[object Function]",de="[object GeneratorFunction]",_e="[object Map]",oe="[object Number]",Se="[object Object]",ve="[object RegExp]",ze="[object Set]",Ue="[object String]",J="[object Symbol]",Le="[object WeakMap]",Ge="[object ArrayBuffer]",Be="[object DataView]",re="[object Float32Array]",W="[object Float64Array]",Y="[object Int8Array]",P="[object Int16Array]",v="[object Int32Array]",$="[object Uint8Array]",C="[object Uint8ClampedArray]",ae="[object Uint16Array]",q="[object Uint32Array]",x={};x[E]=x[k]=x[Ge]=x[Be]=x[R]=x[B]=x[re]=x[W]=x[Y]=x[P]=x[v]=x[_e]=x[oe]=x[Se]=x[ve]=x[ze]=x[Ue]=x[J]=x[$]=x[C]=x[ae]=x[q]=!0,x[F]=x[te]=x[Le]=!1;function H(M,G,ye,$e,Xe,Ve){var pe,Ze=G&I,ft=G&L,St=G&A;if(ye&&(pe=Xe?ye(M,$e,Xe,Ve):ye(M)),pe!==void 0)return pe;if(!y(M))return M;var mt=h(M);if(mt){if(pe=f(M),!Ze)return o(M,pe)}else{var Oe=d(M),Qe=Oe==te||Oe==de;if(b(M))return s(M,Ze);if(Oe==Se||Oe==E||Qe&&!Xe){if(pe=ft||Qe?{}:m(M),!Ze)return ft?l(M,a(pe,M)):i(M,n(pe,M))}else{if(!x[Oe])return Xe?M:{};pe=_(M,Oe,Ze)}}Ve||(Ve=new e);var Re=Ve.get(M);if(Re)return Re;Ve.set(M,pe),S(M)?M.forEach(function(ie){pe.add(H(ie,G,ye,ie,M,Ve))}):T(M)&&M.forEach(function(ie,ne){pe.set(ne,H(ie,G,ye,ne,M,Ve))});var ke=St?ft?p:u:ft?g:w,Pe=mt?void 0:ke(M);return t(Pe||M,function(ie,ne){Pe&&(ne=ie,ie=M[ne]),r(pe,ne,H(ie,G,ye,ne,M,Ve))}),pe}return Jl=H,Jl}var eu,Tm;function v_(){if(Tm)return eu;Tm=1;function e(t,r,n){var a=-1,s=t.length;r<0&&(r=-r>s?0:s+r),n=n>s?s:n,n<0&&(n+=s),s=r>n?0:n-r>>>0,r>>>=0;for(var o=Array(s);++a<s;)o[a]=t[a+r];return o}return eu=e,eu}var tu,gm;function YI(){if(gm)return tu;gm=1;var e=fs(),t=v_();function r(n,a){return a.length<2?n:e(n,t(a,0,-1))}return tu=r,tu}var ru,Im;function KI(){if(Im)return ru;Im=1;var e=gn(),t=T_(),r=YI(),n=In(),a=Object.prototype,s=a.hasOwnProperty;function o(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__"&&!s.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 ru=o,ru}var nu,Em;function XI(){if(Em)return nu;Em=1;var e=Tn(),t=Dc(),r=Qt(),n="[object Object]",a=Function.prototype,s=Object.prototype,o=a.toString,i=s.hasOwnProperty,l=o.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&&o.call(f)==l}return nu=u,nu}var au,wm;function ZI(){if(wm)return au;wm=1;var e=XI();function t(r){return e(r)?void 0:r}return au=t,au}var su,Am;function QI(){if(Am)return su;Am=1;var e=Lh();function t(r){var n=r==null?0:r.length;return n?e(r,1):[]}return su=t,su}var ou,Sm;function JI(){if(Sm)return ou;Sm=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 ou=e,ou}var iu,Lm;function P_(){if(Lm)return iu;Lm=1;var e=JI(),t=Math.max;function r(n,a,s){return a=t(a===void 0?n.length-1:a,0),function(){for(var o=arguments,i=-1,l=t(o.length-a,0),u=Array(l);++i<l;)u[i]=o[a+i];i=-1;for(var p=Array(a+1);++i<a;)p[i]=o[i];return p[a]=s(u),e(n,this,p)}}return iu=r,iu}var lu,Om;function eE(){if(Om)return lu;Om=1;function e(t){return function(){return t}}return lu=e,lu}var uu,Rm;function tE(){if(Rm)return uu;Rm=1;var e=eE(),t=Wh(),r=ba(),n=t?function(a,s){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(s),writable:!0})}:r;return uu=n,uu}var cu,km;function rE(){if(km)return cu;km=1;var e=800,t=16,r=Date.now;function n(a){var s=0,o=0;return function(){var i=r(),l=t-(i-o);if(o=i,l>0){if(++s>=e)return arguments[0]}else s=0;return a.apply(void 0,arguments)}}return cu=n,cu}var pu,vm;function N_(){if(vm)return pu;vm=1;var e=tE(),t=rE(),r=t(e);return pu=r,pu}var du,Pm;function nE(){if(Pm)return du;Pm=1;var e=QI(),t=P_(),r=N_();function n(a){return r(t(a,void 0,e),a+"")}return du=n,du}var fu,Nm;function aE(){if(Nm)return fu;Nm=1;var e=Ea(),t=k_(),r=KI(),n=gn(),a=va(),s=ZI(),o=nE(),i=Mc(),l=1,u=2,p=4,d=o(function(f,_){var m={};if(f==null)return m;var h=!1;_=e(_,function(T){return T=n(T,f),h||(h=T.length>1),T}),a(f,i(f),m),h&&(m=t(m,l|u|p,s));for(var b=_.length;b--;)r(m,_[b]);return m});return fu=d,fu}var sE=aE();const oE=xe(sE),ju="TOUCHED_PIPETTABLE_LABWARE";var mu,Cm;function iE(){if(Cm)return mu;Cm=1;var e=uc();function t(r,n){return e(r,n)}return mu=t,mu}var lE=iE();const uE=xe(lE),ws=e=>{const{node:t,stack:r=[],robotState:n,memo:a=new Map}=e;let s=r;if(!(typeof t=="object"&&"labwareId"in t))return s=[...r,t],a.set(t,s),{stack:s,memo:a};const{labwareId:o}=t,i=n.labware[o];if(i!=null&&i.stackedOnNode!=null){const{stack:l,memo:u}=ws({node:i.stackedOnNode,stack:[...r,t],robotState:n,memo:a});C_(a,u),s=l,a.set(t,s)}return{stack:s,memo:a}},cE=e=>{const{node:t,robotState:r,deckDef:n,deckConfiguration:a}=e,{stack:s}=ws({node:t,robotState:r}),{cutoutFixtures:o}=n,i=s.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 o){const[d]=Object.entries(p).find(([f,_])=>_.includes(l))??[];if(d!=null){const f=a.find(({cutoutId:T})=>T===d),{cutoutFixtureId:_,cutoutId:m}=f,h=_===u&&m===d,b=Object.entries(r.modules).find(([T,{slot:y}])=>c.FLEX_CUTOUT_BY_SLOT_ID[y]===m);if(h&&b!=null)return b[0]}}}return null},C_=(e,t)=>{t.forEach((r,n)=>{e.set(n,r)})},pE=(e,t)=>e.some(r=>uE(r,t)),D_=e=>{const{labwareId:t,robotState:r}=e,n=new Map,a={labwareId:t};let s=[];for(const[o,{stackedOnNode:i}]of Object.entries(r.labware)){const l={labwareId:o};if(i==null)continue;let u;const p=n.get(l);if(p!=null)u=p;else{const{stack:d,memo:f}=ws({node:l,robotState:r,memo:n});if(C_(n,f),!pE(d,a))continue;n.set(l,d),u=d}u.length>s.length&&(s=u)}return s},M_=e=>{const t=[],r=new Set;for(const n of Object.keys(e.labware)){if(r.has(n))continue;const a=D_({labwareId:n,robotState:e});a.forEach(s=>{typeof s=="object"&&"labwareId"in s&&r.add(s.labwareId)}),t.push(a)}return t},qc=e=>{const{moduleId:t,robotState:r,moduleEntities:n,deckDef:a}=e,s=r.modules[t],o=n[t];if(s==null||o==null)return null;const{slot:i}=s,{model:l}=o,u=c.getAddressableAreaNamesFromLoadedModule(l,i,a);return u.length===0?null:u[0]},dE=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:s}=t;return qc({moduleId:s,robotState:r,moduleEntities:n,deckDef:a})}return null},F_=e=>{const{deckConfiguration:t,deckDefinition:r}=e;return t.reduce((n,{cutoutFixtureId:a,cutoutId:s})=>((r.cutoutFixtures.find(({id:i})=>a===i)?.providesAddressableAreas[s]??[]).forEach(i=>{n.add(i)}),n),new Set)},fE=e=>{const{robotState:t,deckConfiguration:r,deckDefinition:n,moduleEntities:a}=e,s=F_({deckConfiguration:r,deckDefinition:n}),o=new Set(s),i=M_(t);for(const l of i){const u=Oc(l);if(typeof u=="object"&&"addressableAreaName"in u){const{addressableAreaName:p}=u;o.delete(p)}if(typeof u=="object"&&"slotName"in u){const{slotName:p}=u;o.delete(p)}if(typeof u=="object"&&"moduleId"in u){const{moduleId:p}=u,d=qc({moduleId:p,robotState:t,moduleEntities:a,deckDef:n});d!=null&&o.delete(d)}}return o},mE=e=>{const t=e.toLowerCase();return t.includes("chute")||t.includes("waste")||t.startsWith("gripper")||t==="96channelwastechute"},q_=e=>{const{stack:t,subjectLabwareId:r,moduleEntities:n,labwareEntityIds:a,modules:s}=e;if(t.length===0||t[0]!==r||t.length<2)return;const o=t[1];if(o===He){const u=t[2];return u==null?void 0:{kind:"inStackerHopper",moduleId:u}}if(n[o]!=null)return{moduleId:o};if(a.has(o))return{labwareId:o};if(o==="offDeck")return"offDeck";if(o==="systemLocation")return"systemLocation";if(o==="wasteChuteLocation")return"wasteChuteLocation";if(mE(o))return{addressableAreaName:o};const i=__(o,s,n)??o;if(Object.entries(s).some(([u,p])=>n[u]?.type===c.FLEX_STACKER_MODULE_TYPE&&p.slot===i)){const u=bs(i);if(u!=null)return{addressableAreaName:u}}return{slotName:o}},hE=e=>typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="inStackerHopper",_E=e=>typeof e!="object"||e===null?!1:!hE(e),yE=(e,t)=>{const{id:r,def:n}=e,{id:a,def:s}=t,o=n.dimensions.xDimension,i=n.dimensions.yDimension,l=s.dimensions.xDimension,u=s.dimensions.yDimension;return o>l&&i>u?{containerLabwareId:r,containedLabwareId:a}:l>o&&u>i?{containerLabwareId:a,containedLabwareId:r}:null},Uc=(e,t)=>{const r=new Map;for(const a of Object.keys(e)){const s=e[a].stackedOnNode;if(s==null||!_E(s))continue;const o=JSON.stringify(s),i=r.get(o)??[];i.push(a),r.set(o,i)}const n={};for(const a of r.values()){if(a.length!==2)continue;const[s,o]=a,i=t[s],l=t[o];if(i==null||l==null)continue;const u=yE(i,l);if(u==null)continue;const{containerLabwareId:p,containedLabwareId:d}=u;n[p]=d}return Object.keys(n).length===0?e:Xt(e,(a,s)=>n[s]!=null?{...a,contains:n[s]}:a)},bE=(e,t,r)=>{const n=Object.keys(e.labware),a=new Set(n);let s=Xt(e.labware,(o,i)=>{const l=o.stackedOnNode??q_({stack:o.stack,subjectLabwareId:i,moduleEntities:t,labwareEntityIds:a,modules:e.modules});return l!=null?{...o,stackedOnNode:l}:{...o}});return s=Uc(s,r),{...e,labware:s}};function TE(e,t,r){const{labwareId:n,newLocation:a}=e,{robotState:s}=r,{labwareEntities:o}=t,{modules:i,labware:l}=s;if(l[n]==null)return;const u=z(l[n].stack),p=Ec(l,u,n),d=p.indexOf(n),f=p.slice(0,d+1),_=c.getIsLid(o[n].def);let m=!1;const h=Object.entries(i).find(([A,{slot:E}])=>{const{type:k}=t.moduleEntities[A]??{};return k===c.FLEX_STACKER_MODULE_TYPE&&E===u})??null,b=h!=null&&h[1].moduleState.type===c.FLEX_STACKER_MODULE_TYPE?Yt.map(A=>h[1].moduleState.labwareOnShuttle?.[A]).filter(A=>A!=null):[],T=b.includes(n)?b.slice(0,b.indexOf(n)+1):[];if(h!=null&&h[1].moduleState.type===c.FLEX_STACKER_MODULE_TYPE){const A=h[1].moduleState,E=Yt.findIndex(k=>A.labwareOnShuttle?.[k]===n);if(E!==-1&&A.labwareOnShuttle!=null)for(const k of Yt.slice(E,Yt.length))if(k==="primaryLabwareId"){A.labwareOnShuttle=null;break}else A.labwareOnShuttle[k]=null}const y=Object.entries(i).find(([A,{slot:E}])=>{const{type:k}=t.moduleEntities[A]??{};return k===c.FLEX_STACKER_MODULE_TYPE&&typeof a=="object"&&("moduleId"in a&&a.moduleId===A||"slotName"in a&&E===a.slotName)})??null,[S,w]=y??[];if(S!=null&&w!=null){const A=T.length>0?T:ys(l,u),E=A.indexOf(n),k=w.moduleState;if(E!==-1){const R=A.slice(0,E+1).toReversed();if(k.labwareOnShuttle==null&&(k.labwareOnShuttle={primaryLabwareId:"",adapterLabwareId:null,lidLabwareId:null}),R.length===3)for(let B=0;B<Yt.length;B++){const F=Yt[B];k.labwareOnShuttle[F]=R[B]}else if(R.length===2){const B=R.some(F=>t.labwareEntities[F].def.allowedRoles?.some(te=>te==="lid"))?["primaryLabwareId","lidLabwareId"]:["adapterLabwareId","primaryLabwareId"];for(let F=0;F<B.length;F++){const te=B[F];k.labwareOnShuttle[te]=R[F]}}else R.length===1&&(k.labwareOnShuttle.primaryLabwareId=R[0])}}const g=[];if(c.locationIsOffDeck(a))g.push(a);else if("moduleId"in a)i[a.moduleId].moduleState.type===c.FLEX_STACKER_MODULE_TYPE?g.push(i[a.moduleId].slot):g.push(a.moduleId,i[a.moduleId].slot);else if("slotName"in a){const{slotName:A}=a;A in l?(m=c.getIsPipettableLabware(o[A].def),g.push(...l[A].stack)):g.push(A)}else if("labwareId"in a){const A=a.labwareId;m=c.getIsPipettableLabware(o[A].def);const E=l[A].stack;g.push(...E)}else"addressableAreaName"in a&&g.push(a.addressableAreaName);f.forEach((A,E)=>{if(l[A]!=null){const k=f.slice(E+1);s.labware[A]={...s.labware[A],stack:[A,...k,...g],..._&&m?{sterility:ju}:{}}}});const I=typeof a=="object"&&"labwareId"in a&&c.getIsPipettableLabware(o[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 A=bs(i[a.moduleId].slot);A!=null&&(L={addressableAreaName:A})}s.labware[n].stackedOnNode=L,I&&(s.labware[n].sterility=ju),s.labware=Uc(Xt(s.labware,A=>oE(A,"contains")),o)}function gE(e,t,r){const{pipetteId:n,addressableAreaName:a}=e,{wasteChuteEntities:s,trashBinEntities:o}=t,i=c.WASTE_CHUTE_ADDRESSABLE_AREAS.includes(a),l=Object.values(o).find(d=>d.location===o_(a))?.id,u=i?Object.values(s)[0].id:l,{robotState:p}=r;p.pipettes[n]={...p.pipettes[n],entityId:u}}function IE(e,t,r){const{pipetteId:n,labwareId:a,wellName:s}=e,{robotState:o}=r;o.pipettes[n]={...o.pipettes[n],entityId:a,wellName:s}}function EE(e,t,r){const{pipetteId:n,labwareId:a,wellName:s}=e,o=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=$c(u,o),f=(h,b)=>h.find(T=>T.includes(b)),_=(h,b)=>{const T=h.findIndex(S=>S.includes(b));if(T===-1)return null;const y=h[T].indexOf(b);return h.map(S=>S[y])},m=(h,b)=>{const T=c.PARTIAL_NOZZLE_MAP[p],y=h.findIndex(L=>L.includes(b)),S=h[y].indexOf(b),w=h[y];if(w.length-S<T){const L=w.length-T;return w.slice(L,w.length)}const I=S+T;return w.slice(S,Math.min(I,w.length))};if(l.pipettes[n].hasTip=!0,l.pipettes[n].tiprackURI=a,d===c.SINGLE)l.tipracks[a][s]=se;else if(d===c.PARTIAL_COLUMN&&p){const h=m(i.ordering,s);h==null?console.error(`Invalid primary well for tip pick up for partial config: ${s}`):h.forEach(function(b){l.tipracks[a][b]=se})}else if(d===c.COLUMN){const h=f(i.ordering,s);h==null&&console.error(`Invalid primary well for tip pickup: ${s}`),h?.forEach(function(b){l.tipracks[a][b]=se})}else if(d===c.ROW){const h=_(i.ordering,s);h==null&&console.error("Invalid primary well for tip pickup: "+s),h?.forEach(function(b){l.tipracks[a][b]=se})}else if(d===c.ALL)if(o.channels===96)i.ordering.reduce((b,T)=>b.concat(T),[]).forEach(function(b){l.tipracks[a][b]=se});else{const h=f(i.ordering,s);h==null&&console.error(`Invalid primary well for tip pickup: ${s}`),h?.forEach(function(b){l.tipracks[a][b]=se})}else if(o.channels===1)l.tipracks[a][s]=se;else if(o.channels===96)i.ordering.reduce((b,T)=>b.concat(T),[]).forEach(function(b){l.tipracks[a][b]=se});else{const h=f(i.ordering,s);h==null&&console.error(`Invalid primary well for tip pickup: ${s}`),h?.forEach(function(b){l.tipracks[a][b]=se})}r.robotState.pipettes[n].tiprackId=a,r.robotState.pipettes[n].tipWell=s}const wE={clean:ga,empty:se,used:Wt};function AE(e,t,r){const{labwareId:n,wellNames:a,tipWellState:s="clean"}=e,o=wE[s],i=r.robotState.tipState.tipracks[n];i!=null&&a.forEach(l=>{i[l]=o})}const jr=(e,t)=>{const r=At(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}`),{})},SE=(e,t,r)=>{const{moduleId:n,celsius:a}=e,{robotState:s}=r,o=jr(s,n);o.currentBlockActivity={type:"blockTargetTemp",blockTargetTemp:a}},LE=(e,t,r)=>{const{moduleId:n,celsius:a}=e,{robotState:s}=r,o=jr(s,n);o.lidTargetTemp=a},OE=(e,t,r)=>{},RE=(e,t,r)=>{},kE=(e,t,r)=>{},vE=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,s=jr(a,n);s.currentBlockActivity={type:"blockDeactivated"}},PE=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,s=jr(a,n);s.lidTargetTemp=null},NE=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,s=jr(a,n);s.lidOpen=!1},CE=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,s=jr(a,n);s.lidOpen=!0},DE=(e,t,r)=>{const{profile:n,...a}=e;U_({profileElements:n,...a},t,r)},U_=(e,t,r)=>{const n=NaN+D();B_({...e,taskId:n},t,r),$_(n,r,c.THERMOCYCLER_MODULE_TYPE)},B_=(e,t,r)=>{const{moduleId:n,taskId:a,profileElements:s}=e,{robotState:o}=r,i=jr(o,n);i.currentBlockActivity={type:"profile",profileElements:s,taskId:a??null},i.numProfilesStarted++},ME=e=>{if(e.currentBlockActivity.type==="profile"){const t=FE(e.currentBlockActivity.profileElements);return e.currentBlockActivity=t!=null?{type:"blockTargetTemp",blockTargetTemp:t}:{type:"blockDeactivated"},!0}else return!1};function FE(e){const t=Oc(Vc(e));return t!=null?t.celsius:null}const qE=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,s=st(a,n);s!=null&&(s.ventStatus=ns)},UE=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,s=st(a,n);s!=null&&(s.ventStatus=Ia)},BE=(e,t,r)=>{const{moduleId:n,gaugePressure:a,duration:s,ventAfter:o=!0,taskId:i}=e,{robotState:l}=r,u=st(l,n);u!=null&&(s==null||i==null?u.currentPumpActivity={type:"indefiniteHold",mode:Mu,targetPressure:a}:(u.currentPumpActivity={type:"timedHold",mode:Mu,targetPressure:a,durationSeconds:s,taskId:i,ventAfter:o},u.numPumpActivitiesStarted++),u.ventStatus=Ia)},$E=(e,t,r)=>{const{moduleId:n,percentPower:a,duration:s,ventAfter:o=!0,taskId:i}=e,{robotState:l}=r,u=st(l,n);u!=null&&(s==null||i==null?u.currentPumpActivity={type:"indefiniteHold",mode:Du,targetPower:a}:(u.currentPumpActivity={type:"timedHold",mode:Du,targetPower:a,durationSeconds:s,taskId:i,ventAfter:o},u.numPumpActivitiesStarted++),u.ventStatus=Ia)},VE=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,s=st(a,n);s!=null&&(s.currentPumpActivity={type:"pumpDeactivated"},s.ventStatus=ns)},xE=(e,t,r)=>{const{moduleId:n,profile:a,taskId:s,ventAfter:o=!0}=e,{robotState:i}=r,l=st(i,n);l==null||s==null||(l.currentPumpActivity={type:"profile",profileElements:a,taskId:s,ventAfter:o},l.numPumpActivitiesStarted++)},HE=e=>{if(e.currentPumpActivity.type==="timedHold"||e.currentPumpActivity.type==="profile"){const t=e.currentPumpActivity.ventAfter;return e.currentPumpActivity={type:"pumpDeactivated"},e.ventStatus=t?ns:Ia,!0}return!1};function jE(e,t,r){for(const n of e.task_ids)$_(n,r)||r.warnings.push(Tg())}const $_=(e,t,r)=>{const{robotState:n}=t,a=Object.values(n.modules).find(s=>{if(r&&s.moduleState.type!==r)return!1;const o=s.moduleState.type==="thermocyclerModuleType"&&s.moduleState.currentBlockActivity.type==="profile"&&s.moduleState.currentBlockActivity.taskId===e,i=s.moduleState.type==="vacuumModuleType"&&(s.moduleState.currentPumpActivity.type==="timedHold"||s.moduleState.currentPumpActivity.type==="profile")&&s.moduleState.currentPumpActivity.taskId===e;return o||i});return a==null?!1:a.moduleState.type==="thermocyclerModuleType"?ME(a.moduleState):a.moduleState.type==="vacuumModuleType"?HE(a.moduleState):(console.log(`unexpected module type with task: ${a.moduleState.type}`),!1)},On=(e,t)=>{const r=At(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}`),{})},zE=(e,t,r)=>{const{robotState:n}=r,{moduleId:a,celsius:s}=e,o=On(n,a);o.targetTemp=s},GE=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=On(n,a);s.targetTemp=null},WE=(e,t,r)=>{const{robotState:n}=r,{moduleId:a,rpm:s}=e,o=On(n,a);o.targetSpeed=s},YE=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=On(n,a);s.targetSpeed=null},KE=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=On(n,a);s.latchOpen=!0},XE=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=On(n,a);s.latchOpen=!1},ZE=(e,t,r)=>{const{pipetteId:n}=e,{robotState:a}=r,s=a.pipettes[n].entityId??"";Es({invariantContext:t,pipetteId:n,prevLiquidState:a.liquidState,useFullVolume:!0,robotStateAndWarnings:r,entityId:s})},QE=(e,t,r)=>{const{pipetteId:n}=e,{robotState:a}=r,s=a.pipettes[n].entityId??"";a.tipState.pipettes[n]={hasTip:!1,tiprackURI:null},Es({invariantContext:t,prevLiquidState:a.liquidState,pipetteId:n,useFullVolume:!0,robotStateAndWarnings:r,entityId:s}),a.pipettes[n].tiprackId=void 0};function V_(e,t){e.type===c.MAGNETIC_MODULE_TYPE&&(e.engaged=t)}function JE(e,t,r){const{moduleId:n}=e,{robotState:a}=r,s=At(a,n);V_(s,!0)}function ew(e,t,r){const{moduleId:n}=e,{robotState:a}=r,s=At(a,n);V_(s,!1)}const hu=(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},x_=(e,t,r,n)=>{const a=e.labwareInHopper??[];t.forEach(s=>{const{primaryLabwareId:o,adapterLabwareId:i,lidLabwareId:l}=s;r.labware[o]={stack:[o,...l!=null?[l]:[],...n]},i!=null&&(r.labware[i]={stack:[i,o,...l!=null?[l]:[],...n]}),l!=null&&(r.labware[l]={stack:[l,...n]}),a.push({primaryLabwareId:o,adapterLabwareId:i??null,lidLabwareId:l??null})}),e.labwareInHopper=a},H_=(e,t,r,n,a,s,o,i)=>{const u=Object.entries(e.labware).filter(([d,f])=>f[s]===t[s]).map(([d])=>d).map(d=>r[d]),p=[];for(let d=0;d<n;d++){const f=hu(u,t.storedLabwareDetails?.primaryLabwareURI),_=o!=null?hu(u,t.storedLabwareDetails?.adapterLabwareURI):null,m=i!=null?hu(u,t.storedLabwareDetails?.lidLabwareURI):null;f!=null&&(e.labware[f]={stack:[f,...m!=null?[m]:[],...a]},_!=null&&(e.labware[_]={stack:[_,f,...m!=null?[m]:[],...a]}),m!=null&&(e.labware[m]={stack:[m,...a]}),p.push({primaryLabwareId:f,adapterLabwareId:_,lidLabwareId:m})),t.labwareInHopper=p}},tw=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=Object.entries(n.labware).filter(([,i])=>i.stack.includes(He)&&i.stack.includes(a)),o=dt(n,a);o!=null&&o.labwareInHopper!=null&&(e.count!=null?o.labwareInHopper=o.labwareInHopper.slice(0,e.count):o.labwareInHopper=[]),s.forEach(([i])=>{n.labware[i]={...n.labware[i],stack:[i,c.SYSTEM_LOCATION]}})},rw=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:a}=t,{moduleId:s,labware:o}=e,i=n.modules[s].slot,l=dt(n,s);if(l==null||l.storedLabwareDetails==null)return;const{primaryLabwareURI:u,adapterLabwareURI:p,lidLabwareURI:d}=l.storedLabwareDetails,f=[];for(const b of o){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 _=[He,s,i];for(const b of f){const T=[b.adapterLabwareId,b.primaryLabwareId,b.lidLabwareId,..._].filter(S=>S!=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 S of T)a[S]!=null&&(y==null?n.labware[S].stackedOnNode={kind:"inStackerHopper",moduleId:s}:n.labware[S].stackedOnNode={labwareId:y},y=S)}const m=l.labwareInHopper??[],h=f.map(({primaryLabwareId:b,adapterLabwareId:T,lidLabwareId:y})=>({primaryLabwareId:b,adapterLabwareId:T,lidLabwareId:y}));l.labwareInHopper=[...m,...h]},nw=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:a}=t,{moduleId:s,primaryLabware:o,initialCount:i,adapterLabware:l,lidLabware:u,initialStoredLabware:p}=e,d=n.modules[s].slot,f=dt(n,s),_=[He,s,d];f!=null&&(f.storedLabwareDetails={primaryLabwareURI:`${o.namespace}/${o.loadName}/${o.version}`,adapterLabwareURI:l!=null?`${l.namespace}/${l.loadName}/${l.version}`:null,lidLabwareURI:u!=null?`${u.namespace}/${u.loadName}/${u.version}`:null},i!=null?H_(n,f,a,i,_,"setStoredLabwareCount",l?.loadName,u?.loadName):p!=null&&x_(f,p,n,_),f.setStoredLabwareCount=(f?.setStoredLabwareCount??0)+1)},aw=(e,t,r)=>{const{robotState:n}=r,{moduleId:a,labware:s}=e,{labwareEntities:o}=t,i=n.modules[a].slot,l=dt(n,a);if(l==null)return;const u=s.map(g=>g.split(":")[1]),p=new Set(u),d=Array.from(p),f=d.find(g=>Object.values(o).find(I=>I.labwareDefURI===g&&!I.def.allowedRoles?.includes("lid")&&!I.def.allowedRoles?.includes("adapter"))),_=d.find(g=>Object.values(o).find(I=>I.labwareDefURI===g&&I.def.allowedRoles?.includes("adapter"))),m=d.find(g=>Object.values(o).find(I=>I.labwareDefURI===g&&I.def.allowedRoles?.includes("lid")));if(f==null)throw new Error(`expected to find primaryLabwareURI for storedLabwareDetails but could not with labware ${s}`);l.storedLabwareDetails={primaryLabwareURI:f,adapterLabwareURI:_??null,lidLabwareURI:m??null};const h=[];for(const g of s){const I=o[g].labwareDefURI;if(I===f)h.push({primary:g,adapter:null,lid:null});else if(I===_){const L=h[h.length-1];L&&(L.adapter=g)}else if(I===m){const L=h[h.length-1];L&&(L.lid=g)}}const b=[He,a,i];for(const g of h){const I=[g.adapter,g.primary,g.lid,...b].filter(L=>L!=null);n.labware[g.primary]={...n.labware[g.primary],stack:I.slice(I.indexOf(g.primary))},g.adapter!=null&&(n.labware[g.adapter]={...n.labware[g.adapter],stack:I.slice(I.indexOf(g.adapter))}),g.lid!=null&&(n.labware[g.lid]={...n.labware[g.lid],stack:I.slice(I.indexOf(g.lid))})}const T=l.labwareInHopper??[],y=h.map(g=>({primaryLabwareId:g.primary,adapterLabwareId:g.adapter,lidLabwareId:g.lid})),S=new Map(T.map(g=>[g.primaryLabwareId,g])),w=[];for(const g of y)w.push(g),S.delete(g.primaryLabwareId);for(const g of T)S.has(g.primaryLabwareId)&&w.push(g);l.labwareInHopper=w},sw=(e,t,r)=>{const{robotState:n}=r,{moduleId:a,count:s,labwareToStore:o}=e,{labwareEntities:i}=t,l=n.modules[a].slot,u=dt(n,a),p=[He,a,l];if(u!=null){const d=u.storedLabwareDetails?.adapterLabwareURI,f=u.storedLabwareDetails?.lidLabwareURI;s!=null?H_(n,u,i,s,p,"fillCount",d,f):o!=null&&x_(u,o,n,p),u.fillCount=(u?.fillCount??0)+1}},ow=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=dt(n,a),o=n.modules[a].slot;if(s!=null){const{labwareInHopper:i,labwareOnShuttle:l}=s;if(i!=null&&i.length>0&&l==null){const u=i[0];s.labwareOnShuttle=u,i.shift();const p=[o];let d=null;for(const f of Yt){const _=u[f];if(_!=null){if(p.unshift(_),n.labware[_].stack=[...p],d==null){const m=bs(o);m!=null?n.labware[_].stackedOnNode={addressableAreaName:m}:console.warn(`Could not find an addressable area for retrieved labware in stacker module ${a} at slot ${o}`)}else n.labware[_].stackedOnNode={labwareId:d};d=_}}}}},iw=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=dt(n,a),o=n.modules[a].slot;if(s!=null){const{labwareOnShuttle:i}=s;if(i!=null){s.labwareInHopper=[i,...s.labwareInHopper??[]],s.labwareOnShuttle=null;let l=null;for(const u of Yt){const p=i[u];p!=null&&(n.labware[p].stack=[p,He,a,o],l==null?(n.labware[p].stackedOnNode={kind:"inStackerHopper",moduleId:a},l=p):n.labware[p].stackedOnNode={labwareId:l})}s.storedLabwareDetails==null&&(s.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 j_(e,t,r){e.type===c.TEMPERATURE_MODULE_TYPE&&(e.targetTemperature=t,e.status=r)}function lw(e,t,r){const{robotState:n}=r,{moduleId:a,celsius:s}=e,o=At(n,a);j_(o,s,Zu)}function uw(e,t,r){const{robotState:n}=r,{moduleId:a,celsius:s}=e,o=At(n,a);o.type===c.TEMPERATURE_MODULE_TYPE&&s===o.targetTemperature&&(o.status=Xu)}function cw(e,t,r){const{robotState:n}=r,{moduleId:a}=e,s=At(n,a);j_(s,null,Ta)}function z_(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;II(e.params,t,r);break;case"airGapInPlace":oI(e.params,t,r);break;case"dispenseWhileTracking":case"dispense":case"dispenseInPlace":if(e.meta?.isAirGap===!0)break;AI(e.params,t,r);break;case"blowout":EI(e.params,t,r);break;case"dropTip":SI(e.params,t,r);break;case"pickUpTip":EE(e.params,t,r);break;case"setTipState":AE(e.params,t,r);break;case"magneticModule/engage":JE(e.params,t,r);break;case"magneticModule/disengage":ew(e.params,t,r);break;case"moveLabware":TE(e.params,t,r);break;case"waitForTasks":jE(e.params,t,r);break;case"flexStacker/setStoredLabware":nw(e.params,t,r);break;case"flexStacker/setStoredLabwareItems":aw(e.params,t,r);break;case"flexStacker/prepareShuttle":case"flexStacker/closeLatch":case"flexStacker/openLatch":break;case"flexStacker/empty":tw(e.params,t,r);break;case"flexStacker/fill":sw(e.params,t,r);break;case"flexStacker/fillItems":rw(e.params,t,r);break;case"flexStacker/retrieve":ow(e.params,t,r);break;case"flexStacker/store":iw(e.params,t,r);break;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":gE(e.params,t,r);break;case"moveToWell":IE(e.params,t,r);break;case"loadLiquid":LI(e.params,t,r);break;case"dropTipInPlace":QE(e.params,t,r);break;case"blowOutInPlace":ZE(e.params,t,r);break;case"configureNozzleLayout":wI(e.params,t,r);break;case"temperatureModule/setTargetTemperature":lw(e.params,t,r);break;case"temperatureModule/deactivate":cw(e.params,t,r);break;case"temperatureModule/waitForTemperature":uw(e.params,t,r);break;case"thermocycler/setTargetBlockTemperature":SE(e.params,t,r);break;case"thermocycler/setTargetLidTemperature":LE(e.params,t,r);break;case"thermocycler/waitForBlockTemperature":OE(e.params);break;case"thermocycler/waitForLidTemperature":RE(e.params);break;case"thermocycler/deactivateBlock":vE(e.params,t,r);break;case"thermocycler/deactivateLid":PE(e.params,t,r);break;case"thermocycler/closeLid":NE(e.params,t,r);break;case"thermocycler/openLid":CE(e.params,t,r);break;case"thermocycler/runProfile":DE(e.params,t,r);break;case"thermocycler/runExtendedProfile":U_(e.params,t,r);break;case"thermocycler/startRunExtendedProfile":B_(e.params,t,r);break;case"thermocycler/awaitProfileComplete":kE(e.params);break;case"heaterShaker/deactivateHeater":GE(e.params,t,r);break;case"heaterShaker/setTargetTemperature":zE(e.params,t,r);break;case"heaterShaker/setAndWaitForShakeSpeed":WE(e.params,t,r);break;case"heaterShaker/deactivateShaker":YE(e.params,t,r);break;case"heaterShaker/openLabwareLatch":KE(e.params,t,r);break;case"heaterShaker/closeLabwareLatch":XE(e.params,t,r);break;case"heaterShaker/waitForTemperature":break;case"absorbanceReader/openLid":nI(e.params,t,r);break;case"absorbanceReader/closeLid":aI(e.params,t,r);break;case"absorbanceReader/initialize":sI(e.params,t,r);break;case"absorbanceReader/read":break;case"vacuumModule/startSetVacuumPressure":BE(e.params,t,r);break;case"vacuumModule/startSetVacuumPower":$E(e.params,t,r);break;case"vacuumModule/openVent":qE(e.params,t,r);break;case"vacuumModule/closeVent":UE(e.params,t,r);break;case"vacuumModule/stopVacuum":VE(e.params,t,r);break;case"vacuumModule/startRunProfile":xE(e.params,t,r);break;default:console.error(`unknown command: ${e.commandType} passed to getNextRobotStateAndWarning`)}}function G_(e,t,r){return L_({warnings:[],robotState:r},a=>{z_(e,t,a)})}function Bc(e,t,r){const n=O_(e);return L_({warnings:[],robotState:r},s=>{n.forEach(o=>{z_(o,t,s)})})}const pw=(e,t,r)=>{const n=e.reduce((a,s,o)=>{const i=a.timeline.length===0?r:Oc(a.timeline).robotState;if(a.errors!=null)return a;const l=s(t,i);if("errors"in l)return{timeline:a.timeline,errors:l.errors};const p=O_(l.commands).reduce((f,_)=>G_(_,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}},Rn=(e,t)=>{const r=t[e]?.stack;return r!=null?z(r):""},kn=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},vn=e=>{const{pipette:t,labware:r,invariantContext:n,prevRobotState:a}=e;if(n.config.OT_PD_DISABLE_MODULE_RESTRICTIONS)return!1;const s=t?n.pipetteEntities[t]:null,o=r?z(a.labware[r]?.stack):null;if(!t||!r||!s||!o)return!1;const i=Object.keys(n.moduleEntities).some(l=>{const u=n.moduleEntities[l].model;if(dh.includes(u)){const p=a.modules[l]?.slot;return p==="1"&&o==="4"||p==="3"&&o==="6"}else return!1});return c.GEN_ONE_MULTI_PIPETTES.includes(s.name)&&i},ce=(e,t,r)=>{const n=e.reduce((a,s)=>{if(a.errors.length>0)return a;const o=s(t,a.robotState);if("errors"in o)return{robotState:a.robotState,commands:a.commands,errors:o.errors,warnings:a.warnings};const i=[...a.commands,...o.commands],l=[...a.python?[a.python]:[],...o.python?[o.python]:[]].join(`
|
|
47
|
-
`),u=Bc(o.commands,t,a.robotState);return{...a,robotState:u.robotState,commands:i,warnings:[...a.warnings||[],...o.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}}},Pa=(e,t,r)=>{const n=Oa(e,t[r]?.stack),a=n&&e[n].moduleState;return!!(a&&a.type===c.THERMOCYCLER_MODULE_TYPE&&a.lidOpen!==!0)},dw=e=>e.commandCreatorFnName!=="delay"&&e.commandCreatorFnName!=="engageMagnet"&&e.commandCreatorFnName!=="disengageMagnet"&&e.commandCreatorFnName!=="setTemperature"&&e.commandCreatorFnName!=="deactivateTemperature"&&"pipette"in e?e.pipette:null,fw=e=>e.commandCreatorFnName==="delay"||e.commandCreatorFnName==="engageMagnet"||e.commandCreatorFnName==="disengageMagnet"||e.commandCreatorFnName==="setTemperature"||e.commandCreatorFnName==="deactivateTemperature",mw=new Date("2025-03-19T00:00:00Z"),hw=2,_w=22;function yw(e,t,r){const{labware:n,modules:a,pipettes:s,commands:o,liquids:i}=e,l=t.protocolType==="python"?t.apiVersion:null,u=l!=null&&l[0]>=hw&&l[1]>=_w,p=t.protocolType==="json"&&r>=mw,d=c.getLabwareDefinitionsByURIForProtocol(o),f=i.reduce((y,S)=>{const{id:w,description:g,displayName:I,displayColor:L}=S;return{...y,[w]:{description:g,displayName:I??"Unknown Liquid",pythonName:"n/a",displayColor:L??"#B7B8B9",liquidGroupId:w}}},{}),_=a.reduce((y,S)=>{const{id:w,model:g}=S;return{...y,[w]:{id:w,type:c.getModuleType(g),model:g,pythonName:"n/a"}}},{}),m=n.reduce((y,S)=>{const{id:w,definitionUri:g}=S,I=d[g];return I==null||I.schemaVersion===3?y:{...y,[w]:{id:w,labwareDefURI:g,def:I,pythonName:"n/a"}}},{}),h=o.reduce((y,S)=>{if(S.commandType==="loadLidStack"&&S.result!=null){const{stackLabwareId:w,lidStackDefinition:g}=S.result;if(w!=null&&g!=null&&y[w]==null&&g.schemaVersion!==3)return{...y,[w]:{id:w,labwareDefURI:c.getLabwareDefURI(g),def:g,pythonName:"n/a"}}}return y},m),b=s.reduce((y,S)=>{const{id:w,pipetteName:g}=S,I=c.getPipetteSpecsV2(g),A=o.filter(R=>R.commandType==="pickUpTip"&&R.params.pipetteId===w).map(R=>h[R.params.labwareId]),E=Array.from(new Set(A.map(R=>R.labwareDefURI))),k=Array.from(new Set(A.map(R=>R.def)));return I==null||(y[w]={name:g,id:w,tiprackLabwareDef:k,tiprackDefURI:E,spec:I,pythonName:"n/a"}),y},{}),T=o.reduce((y,S)=>{if(S.commandType==="loadLidStack"&&S.result!=null){const{params:w}=S,g=qu(w);return{...y,stagingAreaEntities:{...y.stagingAreaEntities,...g}}}else if((S.commandType==="loadLabware"||S.commandType==="loadLid")&&S.result!=null){const{params:w}=S,g=qu(w);return{...y,stagingAreaEntities:{...y.stagingAreaEntities,...g}}}else if(S.commandType==="moveToAddressableArea"||S.commandType==="moveToAddressableAreaForDropTip"){const w=S.params.addressableAreaName,g=`${D()}:${w}`;let I=Eh;w==="fixedTrash"?I="cutout12":w.includes("WasteChute")?I="cutoutD3":w.includes("movableTrash")&&(I=`cutout${w.split("movableTrash")[1]}`);let L=y.trashBinEntities;!Object.values(y.trashBinEntities).some(E=>E.location===I)&&w.includes("movableTrash")&&(L={...y.trashBinEntities,[g]:{pythonName:"trash_bin_1",id:g,location:I}});let A=y.wasteChuteEntities;return w.includes("WasteChute")&&(A={[g]:{pythonName:"waste_chute",id:g,location:I}}),{...y,trashBinEntities:L,wasteChuteEntities:A}}return y},{wasteChuteEntities:{},trashBinEntities:{},stagingAreaEntities:{},gripperEntities:{},config:{OT_PD_DISABLE_MODULE_RESTRICTIONS:!0}});return{labwareEntities:h,pipetteEntities:b,moduleEntities:_,liquidEntities:u||p?f:{},...T}}const bw={A3:"A4",B3:"B4",C3:"C4",D3:"D4"};function Tw(e,t){const r=e.reduce((o,i)=>i.commandType==="loadPipette"&&i.result!=null?{...o,[i.result.pipetteId]:{mount:i.params.mount}}:o,{}),n=e.reduce((o,i)=>{if(i.commandType==="loadModule"&&i.result!=null){const l=c.getModuleDef(i.params.model).moduleType;return{...o,[i.result.moduleId]:{slot:l===c.FLEX_STACKER_MODULE_TYPE?bw[i.params.location.slotName]:i.params.location.slotName,moduleState:Ih[l]}}}return o},{}),a=e.reduce((o,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=>{if(c.locationIsOffDeck(m))return[m];if("slotName"in m)return[m.slotName];if("moduleId"in m){const h=n[m.moduleId]?.slot??"offDeck";return[m.moduleId,h]}else if("addressableAreaName"in m)return[m.addressableAreaName];return["offDeck"]};if(u!=null){const m=u.reduce((T,y)=>{const S=y.find(w=>w.kind==="onLabware");return S!=null&&(T[S.labwareId]=y),T},{}),h=p.reduce((T,y,S)=>{const w=m[y]??u[S];if(w!=null){const g=Fu(w);T[y]={stack:g[0]===y?g:[y,...g]}}else{const g=i.params.location;c.locationIsOffDeck(g)?T[y]={stack:[y,g]}:"slotName"in g?T[y]={stack:[y,g.slotName]}:T[y]={stack:[y,"offDeck"]}}return T},{}),b=d!=null&&f!=null?[d,...Fu(f)]:null;return{...o,...h,...d!=null&&b!=null?{[d]:{stack:b}}:{}}}else{const m=i.params.location,h=p.reduce((T,y)=>{if(c.locationIsOffDeck(m))T[y]={stack:[y,m]};else if("slotName"in m)T[y]={stack:[y,m.slotName]};else if("moduleId"in m){const S=m.moduleId;T[y]={stack:[y,S,n[S].slot]}}else T[y]={stack:[y,"offDeck"]};return T},{}),b=d!=null?[d,..._(m)]:null;return{...o,...h,...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. `),o;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;o[u]==null&&(console.warn(`Parent labware ${u} not found when processing loadLabware/loadLid command. `),o[u]={stack:[u,"offDeck"]});const p=o[u].stack;l.push(u,...p)}else l.push(i.params.location.addressableAreaName);return{...o,[i.result.labwareId]:{stack:l}}}else{if(i.commandType==="flexStacker/setStoredLabware")return Mm(i).forEach(u=>{Dm(o,u,"setStoredLabwareCount")}),o;if(i.commandType==="flexStacker/fill")return Mm(i).forEach(u=>{Dm(o,u,"fillCount")}),o}return o},{}),s=Tc({invariantContext:t,labwareLocations:a,moduleLocations:n,pipetteLocations:r});return{frame:{...Bc(e,t,s),command:e[e.length-1]},invariantContext:t}}const Dm=(e,t,r)=>{const n=e[t]??{stack:[t,"offDeck"]};e[t]={...n,[r]:(n[r]??0)+1}},Mm=e=>e.result?.storedLabware?.flatMap(r=>[r.primaryLabwareId,r.adapterLabwareId,r.lidLabwareId].filter(n=>n!=null))??[],$c=(e,t)=>e??(t.channels===1?c.SINGLE:t.channels===96?c.ALL:c.COLUMN);var _u,Fm;function gw(){if(Fm)return _u;Fm=1;var e=pc();function t(r,n){var a;return e(r,function(s,o,i){return a=n(s,o,i),!a}),!!a}return _u=t,_u}var yu,qm;function Iw(){if(qm)return yu;qm=1;var e=vh(),t=En(),r=gw(),n=Ke(),a=fc();function s(o,i,l){var u=n(o)?e:r;return l&&a(o,i,l)&&(i=void 0),u(o,t(i,3))}return yu=s,yu}var Ew=Iw();const Na=xe(Ew),Pn=(e,t)=>Na(e,r=>r.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&r.moduleState.latchOpen!==!1&&c.getAreSlotsHorizontallyAdjacent(r.slot,t)),Nn=(e,t,r)=>r.channels!==1&&Na(e,n=>n.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&c.getAreSlotsHorizontallyAdjacent(n.slot,t)),Ca=(e,t,r,n)=>r.channels!==1&&!n.def.parameters.isTiprack&&Na(e,a=>a.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&c.getAreSlotsVerticallyAdjacent(a.slot,t)),W_=(e,t,r)=>Na(e,(a,s)=>c.getAreSlotsHorizontallyAdjacent(r,z(a.stack))&&c.getIsLabwareAboveHeight(t[s].def,c.MAX_LABWARE_HEIGHT_EAST_WEST_HEATER_SHAKER_MM)),Da=(e,t,r)=>{const n=Oa(e,t[r]?.stack),a=n!=null?e[n].moduleState:null;return!!(a&&a.type===c.HEATERSHAKER_MODULE_TYPE&&a.latchOpen!==!1)},Cn=(e,t,r)=>Na(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))),Ma=(e,t,r)=>{const n=Oa(e,t[r]?.stack),a=n!=null?e[n].moduleState:null;return!!(a&&a.type===c.HEATERSHAKER_MODULE_TYPE&&a.targetSpeed!==null)},As=e=>{const{args:t,pipetteName:r,tiprackUri:n,liquidClassValuesForTip:a}=e;let s=null;"mixBeforeAspirate"in t?s=t.mixBeforeAspirate:"mixFirstAspirate"in t&&(s=t.mixFirstAspirate);const o=ww(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:Y_(t.blowoutLocation),flow_rate:t.blowoutLocation!=null?t.blowoutFlowRateUlSec:void 0,...o!=null?{blowout_position:o}:{}}}},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:!!s?.volume,...s?.times?{repetitions:s.times}:{},...s?.volume?{volume:s.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 Mr(u)},Fa=(e,t)=>`${c.getAllLiquidClassDefs()[e].liquidClassName}${t?"_base_class":""}`,Y_=e=>{if(e!=null)return e===Hr?"source":e===Sn?"destination":"trash"},ww=e=>{const t=Y_(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}},Ss=e=>{const{labwareEntities:t,tiprackIds:r}=e;return`tip_racks=[${r.map(a=>t[a].pythonName).join(", ")}]`};var bu,Um;function Aw(){if(Um)return bu;Um=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 bu=t,bu}var Tu,Bm;function Sw(){if(Bm)return Tu;Bm=1;var e=Nc(),t=gn(),r=ps(),n=Jt(),a=In();function s(o,i,l,u){if(!n(o))return o;i=t(i,o);for(var p=-1,d=i.length,f=d-1,_=o;_!=null&&++p<d;){var m=a(i[p]),h=l;if(m==="__proto__"||m==="constructor"||m==="prototype")return o;if(p!=f){var b=_[m];h=u?u(b,m,_):void 0,h===void 0&&(h=n(b)?b:r(i[p+1])?[]:{})}e(_,m,h),_=_[m]}return o}return Tu=s,Tu}var gu,$m;function Lw(){if($m)return gu;$m=1;var e=fs(),t=Sw(),r=gn();function n(a,s,o){for(var i=-1,l=s.length,u={};++i<l;){var p=s[i],d=e(a,p);o(d,p)&&t(u,r(p,a),d)}return u}return gu=n,gu}var Iu,Vm;function Ow(){if(Vm)return Iu;Vm=1;var e=Ea(),t=En(),r=Lw(),n=Mc();function a(s,o){if(s==null)return{};var i=e(n(s),function(l){return[l]});return o=t(o),r(s,i,function(l,u){return o(l,u[0])})}return Iu=a,Iu}var Eu,xm;function Rw(){if(xm)return Eu;xm=1;var e=En(),t=Aw(),r=Ow();function n(a,s){return r(a,t(e(s)))}return Eu=n,Eu}var kw=Rw();const vw=xe(kw);function K_(e){return Object.keys(e.wells)}const Pw=(e,t)=>{const r=Object.keys(e||{}).filter(n=>e[n]&&e[n].volume>0);return{wellName:t,groupIds:r,ingreds:vw(e,n=>!n||n.volume<=0)}},Nw=(e,t)=>{const r=K_(t);return lt(r,(n,a)=>{const s=e&&e[a];return{...n,[a]:s?Pw(e[a],a):{}}},{})},Cw=(e,t)=>{const r={};return t.forEach(n=>{const a=e!=null?Object.values(e).reduce((s,o)=>{if(o.groupIds.indexOf(n)!==-1){const l=o.ingreds[n];l?.volume!=null&&(s[o.wellName??"A1"]=l.volume)}return s},{}):{};r[n]=a}),r},Dw=e=>{const t=e.flatMap(r=>r==null?[]:Object.values(r).flatMap(n=>n.groupIds.filter(a=>a!==je)));return Array.from(new Set(t))},Mw=e=>{const t=e!=null?Object.values(e).flatMap(r=>r.groupIds)?.filter(r=>r!==je):[];return Array.from(new Set(t))},X_="#737578",Z_=e=>{const t=Number(e);return Number.isInteger(t)?c.DEFAULT_LIQUID_COLORS[t%c.DEFAULT_LIQUID_COLORS.length]:(e!==je&&console.warn(`swatchColors expected an integer or ${je}, got ${e}`),"transparent")},Fw=(e,t)=>{const r=e.filter(n=>n!==je);return r.length===0?null:r.length===1?t[r[0]]??Z_(r[0]):X_},qw=(e,t)=>lt(e,(r,n,a)=>{const s=Fw(n.groupIds,t);return s?{...r,[a]:s}:r},{});var wu,Hm;function Uw(){if(Hm)return wu;Hm=1;function e(t,r){return t>r}return wu=e,wu}var Au,jm;function Bw(){if(jm)return Au;jm=1;var e=ph(),t=Uw(),r=ba();function n(a){return a&&a.length?e(a,r,t):void 0}return Au=n,Au}var $w=Bw();const Vw=xe($w),Q_="2.28",xw="8.11.0";function Hw(){return["import json","from opentrons import protocol_api, types"].join(`
|
|
48
|
-
`)}function
|
|
46
|
+
)`;return{commands:[{commandType:"vacuumModule/startRunProfile",key:F(),params:{moduleId:n,profile:f,ventAfter:s,taskId:u}}],python:_}},Dg=(e,t,r)=>{const{moduleId:n}=e,a=t.moduleEntities[n];if(a==null)return{errors:[X()]};const s=`${a.pythonName}.stop_vacuum_pump()`;return{commands:[{commandType:"vacuumModule/stopVacuum",key:F(),params:{moduleId:n}}],python:s}},p_=(e,t,r)=>{const{moduleId:n,celsius:a}=e,s=n?St(r,n):null,o=[];if(n===null||!s)return{errors:[X()]};if(s.type!==c.TEMPERATURE_MODULE_TYPE&&s.type!==c.HEATERSHAKER_MODULE_TYPE)return console.error(`expected module to be ${c.TEMPERATURE_MODULE_TYPE} but got ${s.type}`),{errors:[X()]};const i="status"in s&&s.status===Qu&&s.targetTemperature!==a,l="status"in s&&s.status===Ju&&s.targetTemperature!==a;if(i||"status"in s&&s.status===Ia||"targetTemp"in s&&s.targetTemp==null)return{errors:[zy()]};l&&o.push(Sg());const u=t.moduleEntities[n],p=u?.type;switch(p){case c.TEMPERATURE_MODULE_TYPE:return{commands:[{commandType:"temperatureModule/waitForTemperature",key:F(),params:{moduleId:n,celsius:a}}],warnings:o.length>0?o:void 0,python:`${u?.pythonName}.await_temperature(${a})`};case c.HEATERSHAKER_MODULE_TYPE:return{commands:[{commandType:"heaterShaker/waitForTemperature",key:F(),params:{moduleId:n,celsius:a}}],warnings:o.length>0?o:void 0,python:`${u?.pythonName}.wait_for_temperature()`};default:return console.error(`awaitTemperature expected module ${n} to be ${c.TEMPERATURE_MODULE_TYPE} or ${c.HEATERSHAKER_MODULE_TYPE}, got ${p}`),{errors:[X()]}}};function M(e,t){return(r,n)=>e(t,r,n)}function O(e,t){return(r,n)=>{const a=e(t,r,n);if("python"in a){const{python:s,...o}=a;return o}return a}}const Ge="__air__",Hr="source_well",On="dest_well",d_=(e,t,r)=>{const s=c.getDeckDefFromRobotType(r).cutoutFixtures.find(l=>l.id.includes(t))?.providesAddressableAreas,i=(l=>{if(s!=null){for(const u in s)if(s[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 f_(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 Ic(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 m_(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 Rn(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 h_(e,t){return yn(cn(t),r=>e)}function dr(e){return lt(e,(t,r,n)=>n===Ge?t:t+r.volume,0)}function Xt(e,t){const r=dr(t);if(r===0)return{source:t,dest:{[Ge]:{volume:e}}};if(e>r)return{source:Zt(t,()=>({volume:0})),dest:{...t,[Ge]:{volume:e-r}}};const n=lt(t,(a,s,o)=>({...a,[o]:s.volume/r}),{});return Object.keys(t).reduce((a,s)=>{const o=n[s]*e;return{source:{...a.source,[s]:{volume:t[s].volume-o}},dest:{...a.dest,[s]:{volume:o}}}},{source:{},dest:{}})}function fr(e,t){return{...t,...lt(e,(r,n,a)=>{const o=a in t?n.volume+t[a].volume:n.volume;return{...r,[a]:{volume:o}}},{})}}function Ec(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(s=>s&&s===n[0]);return{wellsForTips:n,allWellsShared:a}}const __=e=>{const{pipette:t,sourceLabwareId:r,sourceWell:n,destLabwareId:a,destWell:s,blowoutLocation:o,flowRate:i,offsetFromTopMm:l,invariantContext:u}=e;if(!o)return[];const{trashBinEntities:p,wasteChuteEntities:d}=u;let f=null,_=null;return o===Hr?(f=r,_=n):o===On&&(f=a,_=s),_!=null&&f!=null?[M(r_,{pipetteId:t,labwareId:f,wellName:_,flowRate:i,wellLocation:{origin:"top",offset:{z:l}}})]:d[o]!=null?[M(Ly,{pipetteId:t,flowRate:i,wasteChuteId:Object.keys(d)[0]})]:[M(Ay,{pipetteId:t,trashId:Object.keys(p)[0],flowRate:i})]};function y_(e){const{labwareEntities:t,pipetteEntities:r,wasteChuteEntities:n,trashBinEntities:a}=e;return{pipettes:lt(r,(s,o,i)=>{const l=o.spec;return{...s,[i]:b_(l.channels,{})}},{}),labware:lt(t,(s,o,i)=>({...s,[i]:Zt(o.def.wells,()=>({}))}),{}),trashBins:lt(a,(s,o,i)=>({...s,[i]:{}}),{}),wasteChute:lt(n,(s,o,i)=>({...s,[i]:{}}),{})}}function b_(e,t){return cn(e).reduce((r,n)=>({...r,[n]:t}),{})}const T_=e=>{const{blowoutLocation:t,sourceLabware:r,destLabware:n,sourceWell:a,destWell:s}=e;return t===Hr&&r!=null&&a!=null?{dispenseAirGapLabware:r,dispenseAirGapWell:a}:{dispenseAirGapLabware:n,dispenseAirGapWell:s}};function wc(e){const{invariantContext:t,labwareLocations:r,moduleLocations:n={},pipetteLocations:a}=e;return{labware:r,modules:n,pipettes:a,liquidState:y_(t),tipState:{pipettes:lt(a,(s,o,i)=>o.mount?{...s,[i]:{hasTip:!1,tiprackURI:null}}:s,{}),tipracks:lt(r,(s,o,i)=>{const l=t.labwareEntities[i].def;if(!c.getIsTiprack(l))return s;const u=Zt(l.wells,()=>Ea);return{...s,[i]:u}},{})}}}const g_=(e,t)=>e.tipracks[t]!=null?Object.values(e.tipracks[t]).some(r=>r!==ie):!1,I_=(e,t)=>e.labware[t]!=null?Object.values(e.labware[t]).some(r=>Object.values(r).some(n=>n.volume>0)):!1,Mg=(e,t,r)=>{const{destinationId:n,pipetteId:a,volume:s,flowRate:o,offsetFromBottomMm:i,well:l,xOffset:u,yOffset:p,tipRack:d,primaryNozzle:f,nozzles:_}=e,{labwareEntities:m,trashBinEntities:h,wasteChuteEntities:b}=t,T=Rn(m,b,h,n);let y=[];return T==="labware"&&i!=null&&l!=null?y=[M(n_,{pipetteId:a,volume:s,labwareId:n,wellName:l,flowRate:o,wellLocation:{origin:"bottom",offset:{z:i,x:u,y:p}},tipRack:d,primaryNozzle:f,nozzles:_})]:T==="wasteChute"?y=[M(LS,{pipetteId:a,volume:s,flowRate:o,wasteChuteId:b[n].id})]:y=[M(AS,{pipetteId:a,volume:s,flowRate:o,trashId:h[n].id})],ne(y,t,r)},Fg=(e,t,r)=>{const{destinationId:n,pipetteId:a,zOffset:s,well:o}=e,{labwareEntities:i,wasteChuteEntities:l,trashBinEntities:u}=t,p=Rn(i,l,u,n);let d=[];return p==="labware"&&o!=null?d=[M($,{pipetteId:a,labwareId:n,wellName:o,wellLocation:{origin:"bottom",offset:{x:0,y:0,z:s}}})]:p==="wasteChute"?d=[M(Ue,{pipetteId:a,fixtureId:l[n].id,offset:{x:0,y:0,z:0}})]:d=[M(Ue,{pipetteId:a,fixtureId:u[n].id,offset:Et})],ne(d,t,r)},qg=(e,t,r)=>{const{blowOutLocation:n,destinationId:a,destWell:s,flowRate:o,pipetteId:i,sourceId:l,sourceWell:u,volume:p}=e,{labwareEntities:d,trashBinEntities:f,wasteChuteEntities:_}=t,m=Rn(d,_,f,a);let h=[];if(m==="labware"&&s!=null){const{dispenseAirGapLabware:b,dispenseAirGapWell:T}=T_({blowoutLocation:n,sourceLabware:l,destLabware:a,sourceWell:u,destWell:s});h=[M(bS,{flowRate:o,pipetteId:i,labwareId:b,wellName:T,volume:p,type:"dispense"})]}else m==="wasteChute"?h=[M(yS,{pipetteId:i,volume:p,flowRate:o,wasteChuteId:_[a].id})]:h=[M(_S,{pipetteId:i,volume:p,flowRate:o,trashId:f[a].id})];return ne(h,t,r)},Ug=(e,t,r)=>{const{pipetteId:n,destinationId:a,well:s,zOffset:o,seconds:i}=e,{labwareEntities:l,trashBinEntities:u,wasteChuteEntities:p}=t,d=Rn(l,p,u,a);let f=[];return s!=null&&d==="labware"?f=[M($,{pipetteId:n,labwareId:a,wellName:s,wellLocation:{origin:"bottom",offset:{x:0,y:0,z:o}}}),M(he,{seconds:i})]:d==="wasteChute"?f=[M(Ue,{pipetteId:n,fixtureId:a,offset:Et}),M(he,{seconds:i})]:f=[M(Ue,{pipetteId:n,fixtureId:a,offset:Et}),M(he,{seconds:i})],ne(f,t,r)},G=(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}},Sc=e=>e==null?(console.error("expected to find stack but could not"),"unknown top location"):e[0],E_=e=>e.length>=2?e[1]:null,pn=(e,t)=>Object.values(e).reduce((r,{stack:n})=>(n[n.length-1]===t&&n.length>r.length&&(r=n),r),[]),Ac=e=>c.FLEX_SINGLE_SLOT_BY_CUTOUT_ID[c.FLEX_CUTOUT_BY_SLOT_ID[e]],w_=e=>{const t=c.FLEX_STACKER_ADDRESSABLE_AREAS.indexOf(e);return t===-1?null:Me[t]},Bg=e=>{const t=w_(e);return t!=null?Ac(t):null},S_=(e,t,r)=>{if(e==null)return null;if(Me.includes(e)){const n=Ac(e);return Object.entries(t).some(([s,o])=>r[s]?.type===c.FLEX_STACKER_MODULE_TYPE&&o.slot===n)?n:e}return e},gs=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:s})=>s===c.FLEX_STACKER_V1_FIXTURE)?.providesAddressableAreas[n];return c.FLEX_STACKER_ADDRESSABLE_AREAS.find(s=>a?.includes(s))??null},A_=(e,t,r,n)=>{if(t.length===0)return{isCompatible:!0,isAboveStackLimit:!1};let a=!1;const s=t.find(u=>u in n);s!=null&&(a=n[s].type===c.FLEX_STACKER_MODULE_TYPE&&t.includes(je));const o=Sc(t);let i=!0,l=!1;if(o in r){const u=r[e],p=r[o],d=t.filter(I=>r[I]!=null),f=d.filter(I=>r[I]?.def?.allowedRoles?.includes("lid"))[0],_=d.filter(I=>r[I]?.def?.allowedRoles?.includes("adapter"))[0],m=p.def.parameters.loadName,h=d.filter(I=>!r[I]?.def?.allowedRoles?.includes("adapter")&&!r[I]?.def?.allowedRoles?.includes("lid"))[0];if(a){const I=c.getMaxPoolCount({labwareDefinitions:{primary:r[h]?.def??null,adapter:r[_]?.def??null,lid:r[f]?.def??null},model:c.FLEX_STACKER_MODULE_V1});l=t.length>I}else{const I=p.def.stackLimit??1,L=m===u.def.parameters.loadName,w=t.filter(E=>r[E]?.def.parameters.loadName===m)?.length;l=L&&w>=I}const b=u.def.parameters.loadName==="opentrons_tough_universal_lid",T=p.def.metadata.displayCategory==="tubeRack",y=p.def.metadata.displayCategory==="aluminumBlock",A=p.def.parameters.isTiprack,g=(p.def.allowedRoles??[]).includes("lid");i=u.def.compatibleParentLabware?.some(I=>I===m)||Object.keys(u.def.stackingOffsetWithLabware??{}).some(I=>I===m)||b&&!T&&!y&&!A&&(p.def.parameters.loadName==="opentrons_tough_universal_lid"||!g)}else if(o in n){const u=n[o],{model:p}=u;i=Object.keys(r[e].def.stackingOffsetWithModule??{}).some(d=>p===d)}return{isCompatible:i,isAboveStackLimit:l}},ka=(e,t)=>t?.find(r=>e[r]!=null)??null,Vg=(e,t,r)=>t?e:r?vh[e]:e,Lc=(e,t,r)=>{if(t==="offDeck"&&r==null)return console.error("offDeck slot is not allowed to be used without an offDeckOverrideId"),[];const n=la(t),a=L_(t),s=Vg(t,n,a),o=Object.values(e).filter(i=>i.stack.includes(s)&&(r==null||i.stack.includes(r))&&i.stack.includes(je)===a&&i.stack.includes(tc)===n);return o.length===0?[]:a?o.at(-1)?.stack??[]:n?o.at(-1)?.stack??[]:o.toSorted((i,l)=>l.stack.length-i.stack.length)[0]?.stack??[]},$g=(e,t)=>Object.values(t).filter(r=>r.stack.includes(e)).sort((r,n)=>n.stack.length-r.stack.length)[0]?.stack[0],ra=(e,t,r,n=!0)=>{const a=c.linearInterpolate(e,t)??0,s=c.linearInterpolate(e,r)??0;return e+(n?a:0)+s},Oc=e=>{const{path:t,volume:r,pipetteSpecs:n,tiprackDefinition:a,conditioningByVolume:s,disposalByVolume:o,numDispenseWells:i,numAspirateWells:l,aspirateAirGapByVolume:u}=e,{liquids:p}=n,f=r<p.default.minVolume&&"lowVolumeDefault"in p?p.lowVolumeDefault.maxVolume:p.default.maxVolume,_=a?.wells.A1.totalLiquidVolume,m=_==null?f:Math.min(f,_),h=r*2,b=s!=null?c.linearInterpolate(h,s)??0:0,y=a?.namespace!=="opentrons"||s!=null&&o!=null&&m>=h+b+(c.linearInterpolate(h,o)??0)+(b===0?c.linearInterpolate(h,u)??0:0),A=m>=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"&&!A){const L=c.linearInterpolate(r,u)??0,w=Math.ceil((r+L)/m),E=r/w;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 L=0,w=0;for(let E=0;E<i&&!(ra((E+1)*r,s??[],o??[])>m);E++)L=(E+1)*r,w+=1;return{referenceVolumes:{airGap:{aspirate:ra(L,s??[],o??[],!1),dispense:ra((w-1)*r,s??[],o??[],!1)},correction:{aspirate:ra(L,s??[],o??[]),dispense:r},flowRate:{aspirate:ra(L,s??[],o??[]),dispense:r},pushOut:r,conditioning:L,disposal:L},multiWellHandling:{isSupported:!0,numWellsToFitInTip:w}}}const S=Math.floor(m/r),g=Math.min(S,l),I=g*r;return{referenceVolumes:{airGap:{aspirate:I,dispense:0},pushOut:I,correction:{aspirate:I,dispense:I},flowRate:{aspirate:r,dispense:I}},multiWellHandling:{isSupported:!0,numWellsToFitInTip:g}}},qr=e=>{const{retractZOffset:t,retractPositionReference:r,labwareId:n,labwareEntities:a,well:s}=e;if(s==null)return!1;const o=a[n]?.def.wells[s]?.depth;if(o==null)return!1;const i=c.getMmFromBottom(t,r,o);return i==null?!1:i-o>=c.SAFE_MOVE_TO_WELL_OFFSET_FROM_TOP_MM},Uu=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]},[]),xg={A4:"cutoutA3",B4:"cutoutB3",C4:"cutoutC3",D4:"cutoutD3"};function Bu(e){if(e.location!=="offDeck"&&e.location!=="systemLocation"&&e.location!=="wasteChuteLocation"&&"addressableAreaName"in e.location&&Rh.includes(e.location.addressableAreaName)){const t=F(),r=e.location.addressableAreaName,n=xg[r]??r;return{[t]:{id:t,location:n}}}return{}}const Hg=(e,t)=>{const r=pn(e,t),n=r.indexOf(je);return r[n-1]},L_=e=>kh.includes(e),la=e=>e===c.VACUUM_MODULE_DOCK_A4_ADDRESSABLE_AREA,Rc=e=>e.labwareOnShuttle?.primaryLabwareId??null,kc=(e,t,r)=>{if(r?.storedLabwareDetails==null)return!0;const n=Object.values(r?.storedLabwareDetails??{}).reduce((s,o)=>o!=null?[...s,o]:s,[]),a=t.labwareEntities[e];return n.some(s=>a?.labwareDefURI===s)},vc=(e,t)=>{const{storedLabwareDetails:r}=e??{};if(r==null)return!0;const{primaryLabwareURI:n,adapterLabwareURI:a,lidLabwareURI:s}=r,o=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===s);if(o==null)return console.error("Primary labware entity not found"),!1;const u=c.getMaxPoolCount({labwareDefinitions:{primary:o.def,adapter:i?.def??null,lid:l?.def??null},model:c.FLEX_STACKER_MODULE_V1}),d=e?.labwareInHopper?.length??0;return u>d},va=(e,t,r)=>{const n=t[r]?.stack,a=ka(e,n),s=a!=null?e[a].moduleState:null;return!!(s&&s.type===c.ABSORBANCE_READER_TYPE&&s.lidOpen!==!0)};var fl,Pf;function O_(){if(Pf)return fl;Pf=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return fl=e,fl}var zg=O_();const Pc=xe(zg);var R_=Symbol.for("immer-nothing"),Cf=Symbol.for("immer-draftable"),at=Symbol.for("immer-state"),jg=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 Ke(e,...t){if(process.env.NODE_ENV!=="production"){const r=jg[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 ua=Object.getPrototypeOf;function bn(e){return!!e&&!!e[at]}function Ur(e){return e?k_(e)||Array.isArray(e)||!!e[Cf]||!!e.constructor?.[Cf]||Pa(e)||Es(e):!1}var Gg=Object.prototype.constructor.toString(),Nf=new WeakMap;function k_(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=Nf.get(r);return n===void 0&&(n=Function.toString.call(r),Nf.set(r,n)),n===Gg}function es(e,t,r=!0){Is(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 Is(e){const t=e[at];return t?t.type_:Array.isArray(e)?1:Pa(e)?2:Es(e)?3:0}function Vu(e,t){return Is(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function v_(e,t,r){const n=Is(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function Wg(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Pa(e){return e instanceof Map}function Es(e){return e instanceof Set}function Nr(e){return e.copy_||e.base_}function $u(e,t){if(Pa(e))return new Map(e);if(Es(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=k_(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[at];let a=Reflect.ownKeys(n);for(let s=0;s<a.length;s++){const o=a[s],i=n[o];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(ua(e),n)}else{const n=ua(e);if(n!==null&&r)return{...e};const a=Object.create(n);return Object.assign(a,e)}}function Cc(e,t=!1){return ws(e)||bn(e)||!Ur(e)||(Is(e)>1&&Object.defineProperties(e,{set:Ka,add:Ka,clear:Ka,delete:Ka}),Object.freeze(e),t&&Object.values(e).forEach(r=>Cc(r,!0))),e}function Yg(){Ke(2)}var Ka={value:Yg};function ws(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var Kg={};function Br(e){const t=Kg[e];return t||Ke(0,e),t}var ca;function P_(){return ca}function Xg(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Df(e,t){t&&(Br("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function xu(e){Hu(e),e.drafts_.forEach(Zg),e.drafts_=null}function Hu(e){e===ca&&(ca=e.parent_)}function Mf(e){return ca=Xg(ca,e)}function Zg(e){const t=e[at];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ff(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[at].modified_&&(xu(t),Ke(4)),Ur(e)&&(e=ts(t,e),t.parent_||rs(t,e)),t.patches_&&Br("Patches").generateReplacementPatches_(r[at].base_,e,t.patches_,t.inversePatches_)):e=ts(t,r,[]),xu(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==R_?e:void 0}function ts(e,t,r){if(ws(t))return t;const n=e.immer_.shouldUseStrictIteration(),a=t[at];if(!a)return es(t,(s,o)=>qf(e,a,t,s,o,r),n),t;if(a.scope_!==e)return t;if(!a.modified_)return rs(e,a.base_,!0),a.base_;if(!a.finalized_){a.finalized_=!0,a.scope_.unfinalizedDrafts_--;const s=a.copy_;let o=s,i=!1;a.type_===3&&(o=new Set(s),s.clear(),i=!0),es(o,(l,u)=>qf(e,a,s,l,u,r,i),n),rs(e,s,!1),r&&e.patches_&&Br("Patches").generatePatches_(a,r,e.patches_,e.inversePatches_)}return a.copy_}function qf(e,t,r,n,a,s,o){if(a==null||typeof a!="object"&&!o)return;const i=ws(a);if(!(i&&!o)){if(process.env.NODE_ENV!=="production"&&a===r&&Ke(5),bn(a)){const l=s&&t&&t.type_!==3&&!Vu(t.assigned_,n)?s.concat(n):void 0,u=ts(e,a,l);if(v_(r,n,u),bn(u))e.canAutoFreeze_=!1;else return}else o&&r.add(a);if(Ur(a)&&!i){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===a&&i)return;ts(e,a),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(Pa(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&rs(e,a)}}}function rs(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Cc(t,r)}function Qg(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:P_(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=n,s=Nc;r&&(a=[n],s=pa);const{revoke:o,proxy:i}=Proxy.revocable(a,s);return n.draft_=i,n.revoke_=o,i}var Nc={get(e,t){if(t===at)return e;const r=Nr(e);if(!Vu(r,t))return Jg(e,r,t);const n=r[t];return e.finalized_||!Ur(n)?n:n===ml(e.base_,t)?(hl(e),e.copy_[t]=ju(n,e)):n},has(e,t){return t in Nr(e)},ownKeys(e){return Reflect.ownKeys(Nr(e))},set(e,t,r){const n=C_(Nr(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const a=ml(Nr(e),t),s=a?.[at];if(s&&s.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(Wg(r,a)&&(r!==void 0||Vu(e.base_,t)))return!0;hl(e),zu(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 ml(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,hl(e),zu(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Nr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){Ke(11)},getPrototypeOf(e){return ua(e.base_)},setPrototypeOf(){Ke(12)}},pa={};es(Nc,(e,t)=>{pa[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});pa.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Ke(13),pa.set.call(this,e,t,void 0)};pa.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Ke(14),Nc.set.call(this,e[0],t,r,e[0])};function ml(e,t){const r=e[at];return(r?Nr(r):e)[t]}function Jg(e,t,r){const n=C_(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}function C_(e,t){if(!(t in e))return;let r=ua(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=ua(r)}}function zu(e){e.modified_||(e.modified_=!0,e.parent_&&zu(e.parent_))}function hl(e){e.copy_||(e.copy_=$u(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var eI=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 s=r;r=t;const o=this;return function(l=s,...u){return o.produce(l,p=>r.call(this,p,...u))}}typeof r!="function"&&Ke(6),n!==void 0&&typeof n!="function"&&Ke(7);let a;if(Ur(t)){const s=Mf(this),o=ju(t,void 0);let i=!0;try{a=r(o),i=!1}finally{i?xu(s):Hu(s)}return Df(s,n),Ff(a,s)}else if(!t||typeof t!="object"){if(a=r(t),a===void 0&&(a=t),a===R_&&(a=void 0),this.autoFreeze_&&Cc(a,!0),n){const s=[],o=[];Br("Patches").generateReplacementPatches_(t,a,s,o),n(s,o)}return a}else Ke(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(o,...i)=>this.produceWithPatches(o,l=>t(l,...i));let n,a;return[this.produce(t,r,(o,i)=>{n=o,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){Ur(e)||Ke(8),bn(e)&&(e=tI(e));const t=Mf(this),r=ju(e,void 0);return r[at].isManual_=!0,Hu(t),r}finishDraft(e,t){const r=e&&e[at];(!r||!r.isManual_)&&Ke(9);const{scope_:n}=r;return Df(n,t),Ff(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=Br("Patches").applyPatches_;return bn(e)?n(e,t):this.produce(e,a=>n(a,t))}};function ju(e,t){const r=Pa(e)?Br("MapSet").proxyMap_(e,t):Es(e)?Br("MapSet").proxySet_(e,t):Qg(e,t);return(t?t.scope_:P_()).drafts_.push(r),r}function tI(e){return bn(e)||Ke(10,e),N_(e)}function N_(e){if(!Ur(e)||ws(e))return e;const t=e[at];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=$u(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=$u(e,!0);return es(r,(a,s)=>{v_(r,a,N_(s))},n),t&&(t.finalized_=!1),r}var rI=new eI,D_=rI.produce;function nI(e,t){let n=0;const a=[];for(;n+1<e.length;){const s=e[n],o=e[n+1];if(t(s,o)){n+=2;continue}else a.push(s),n+=1}return n+1===e.length&&a.push(e[n]),a}const aI=(e,t)=>["pipetteId","volume","labwareId","wellName"].every(n=>e[n]===t[n]),sI=e=>nI(e,(t,r)=>t.commandType==="aspirate"&&r.commandType==="dispense"&&aI(t.params,r.params)),M_=e=>sI(e),Dc=(e,t)=>{const r=St(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)},oI=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=Dc(n,a);s!=null&&(s.lidOpen=!0)},iI=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=Dc(n,a);s!=null&&(s.lidOpen=!1)},lI=(e,t,r)=>{const{robotState:n}=r,{moduleId:a,measureMode:s,sampleWavelengths:o,referenceWavelength:i}=e,l=Dc(n,a);l!=null&&(l.initialization={mode:s,wavelengths:o,referenceWavelength:i},l.lidOpen=!1)};function uI(e,t,r){const{pipetteId:n,volume:a}=e,{robotState:s}=r,o=s.pipettes[n].nozzles;let l=t.pipetteEntities[n].spec.channels;o===c.COLUMN?l=8:o===c.SINGLE&&(l=1),cn(l).forEach(u=>{const p=s.liquidState.pipettes[n][u]??{},d=p[Ge]?.volume??0;s.liquidState.pipettes[n][u]={...p,[Ge]:{volume:d+a}}})}var _l,Uf;function cI(){if(Uf)return _l;Uf=1;var e=jh(),t=La(),r=os(),n=Xe(),a=xr(),s=ds(),o=ms(),i=dc(),l="[object Map]",u="[object Set]",p=Object.prototype,d=p.hasOwnProperty;function f(_){if(_==null)return!0;if(a(_)&&(n(_)||typeof _=="string"||typeof _.splice=="function"||s(_)||i(_)||r(_)))return!_.length;var m=t(_);if(m==l||m==u)return!_.size;if(o(_))return!e(_).length;for(var h in _)if(d.call(_,h))return!1;return!0}return _l=f,_l}var pI=cI();const yl=xe(pI);var bl,Bf;function dI(){if(Bf)return bl;Bf=1;function e(t,r,n,a){for(var s=t.length,o=n+(a?1:-1);a?o--:++o<s;)if(r(t[o],o,t))return o;return-1}return bl=e,bl}var Tl,Vf;function fI(){if(Vf)return Tl;Vf=1;function e(t){return t!==t}return Tl=e,Tl}var gl,$f;function mI(){if($f)return gl;$f=1;function e(t,r,n){for(var a=n-1,s=t.length;++a<s;)if(t[a]===r)return a;return-1}return gl=e,gl}var Il,xf;function hI(){if(xf)return Il;xf=1;var e=dI(),t=fI(),r=mI();function n(a,s,o){return s===s?r(a,s,o):e(a,t,o)}return Il=n,Il}var El,Hf;function _I(){if(Hf)return El;Hf=1;var e=hI();function t(r,n){var a=r==null?0:r.length;return!!a&&e(r,n,0)>-1}return El=t,El}var wl,zf;function yI(){if(zf)return wl;zf=1;function e(t,r,n){for(var a=-1,s=t==null?0:t.length;++a<s;)if(n(r,t[a]))return!0;return!1}return wl=e,wl}var Sl,jf;function bI(){if(jf)return Sl;jf=1;function e(){}return Sl=e,Sl}var Al,Gf;function TI(){if(Gf)return Al;Gf=1;var e=Wh(),t=bI(),r=ic(),n=1/0,a=e&&1/r(new e([,-0]))[1]==n?function(s){return new e(s)}:t;return Al=a,Al}var Ll,Wf;function gI(){if(Wf)return Ll;Wf=1;var e=Dh(),t=_I(),r=yI(),n=Fh(),a=TI(),s=ic(),o=200;function i(l,u,p){var d=-1,f=t,_=l.length,m=!0,h=[],b=h;if(p)m=!1,f=r;else if(_>=o){var T=u?null:a(l);if(T)return s(T);m=!1,f=n,b=new e}else b=u?[]:h;e:for(;++d<_;){var y=l[d],A=u?u(y):y;if(y=p||y!==0?y:0,m&&A===A){for(var S=b.length;S--;)if(b[S]===A)continue e;u&&b.push(A),h.push(y)}else f(b,A,p)||(b!==h&&b.push(A),h.push(y))}return h}return Ll=i,Ll}var Ol,Yf;function II(){if(Yf)return Ol;Yf=1;var e=gI();function t(r){return r&&r.length?e(r):[]}return Ol=t,Ol}var EI=II();const wI=xe(EI),Mc=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 SI(e,t,r){const{pipetteId:n,volume:a}=e,{robotState:s,warnings:o}=r,i="labwareId"in e?e.labwareId:s.pipettes[n].entityId??"",l="wellName"in e?e.wellName:s.pipettes[n].wellName??"",{liquidState:u}=s,p=s.pipettes[n].nozzles,d=r.robotState.pipettes[n].primaryNozzle,f=t.pipetteEntities[n].spec,_=t.labwareEntities[i].def,m=_.metadata.displayCategory==="reservoir",h=Mc({pipetteSpec:f,nozzles:p,primaryNozzle:d}),{allWellsShared:b,wellsForTips:T}=Ec(h,_,l);if(console.assert(wI(T).length===b?1:T.length,`expected all wells to be shared, or no wells to be shared. Got: ${JSON.stringify(T)}`),h>1&&b){const A=T[0],S=u.labware[i][A],g=a*h>dr(S);yl(S)?o.push(pl()):g&&o.push(cl());const I=g?dr(S)/h:a,L=Xt(I,S).dest;cn(h).forEach(w=>{const E=u.pipettes[n],R=w.toString(),k=E[R],B=g?fr(k,{...L,[Ge]:{volume:a-I}}):fr(k,L);E[R]=B}),u.labware[i][A]=Xt(a*h,u.labware[i][A]).source;return}if(h===96&&m){T.forEach(A=>{const S=u.labware[i][A],g=a*8>dr(S);yl(S)?o.push(pl()):g&&o.push(cl());const I=g?dr(S)/8:a,L=Xt(I,S).dest;cn(h).forEach(w=>{const E=u.pipettes[n],R=w.toString(),k=E[R],B=g?fr(k,{...L,[Ge]:{volume:a-I}}):fr(k,L);E[R]=B}),u.labware[i][A]=Xt(I*8,u.labware[i][A]).source});return}cn(h).forEach(A=>{const S=A.toString(),g=u.pipettes[n],I=g[S],L=u.labware[i][T[A]],w=Xt(a,L).dest;yl(L)?o.push(pl()):a>dr(L)&&o.push(cl()),g[S]=fr(I,w)});const y=u.labware[i];T.forEach(A=>{y[A]=Xt(a,y[A]).source}),"labwareId"in e&&(s.pipettes[n]={...s.pipettes[n],entityId:e.labwareId,wellName:l})}function Ss(e){const{robotStateAndWarnings:t,invariantContext:r,entityId:n,pipetteId:a,prevLiquidState:s,useFullVolume:o,volume:i,wellName:l}=e,u=r.pipetteEntities[a].spec,p=t.robotState.pipettes[a].nozzles,d=t.robotState.pipettes[a].primaryNozzle,f=Mc({pipetteSpec:u,nozzles:p,primaryNozzle:d}),_=l??null,m=r.labwareEntities[n]!=null?r.labwareEntities[n].def:null;console.assert(!(o&&typeof i=="number"),"dispenseUpdateLiquidState takes either `volume` or `useFullVolume`, but got both"),console.assert(typeof i=="number"||o,"in dispenseUpdateLiquidState, either volume or useFullVolume are required");const{wellsForTips:h,allWellsShared:b}=m!=null&&l!=null?Ec(f,m,l):{wellsForTips:null,allWellsShared:!0},T=s.labware[n]!=null?s.labware[n]:null;let y=null;s.trashBins[n]!=null?y=s.trashBins[n]:s.wasteChute[n]!=null&&(y=s.wasteChute[n]);const A=Zt(s.pipettes[a],L=>{const{...w}=L;if(o){const E=dr(w);return E>0?Xt(E,w):{source:{},dest:{}}}return Xt(i||0,w)});let S=null;if(_!=null&&T!=null)S={[_]:lt(A,(L,w)=>fr(L,w.dest),T[_])};else if(y!=null){const L=Object.values(s.pipettes[a]).reduce((w,E)=>w+(E[0]?.volume??0),0);y[0]={volume:L}}S==null&&y==null&&console.assert(!1,`expected to merge liquid to a single well with sourceId ${n}`);const g=_!=null&&T!=null&&h!=null?h.reduce((L,w,E)=>({...L,[w]:fr(A[`${E}`].dest,T[w]||{})}),{}):{},I=b?S:g;s.pipettes[a]=Zt(A,"source"),s.trashBins[n]!=null&&y!=null?Object.assign(s.trashBins[n],y):s.wasteChute[n]!=null&&y!=null?Object.assign(s.wasteChute[n],y):s.labware[n]!=null&&I!=null&&(s.labware[n]=Object.assign(T??{},I))}function AI(e,t,r){const{pipetteId:n,labwareId:a,wellName:s}=e,{robotState:o}=r;Ss({pipetteId:n,entityId:a,useFullVolume:!0,wellName:s,prevLiquidState:o.liquidState,invariantContext:t,robotStateAndWarnings:r})}function LI(e,t,r){const{pipetteId:n,configurationParams:a}=e,{robotState:s}=r;s.pipettes[n].nozzles=a.style,s.pipettes[n].primaryNozzle=a.primaryNozzle}function OI(e,t,r){const{pipetteId:n,volume:a}=e,{robotState:s}=r,o="labwareId"in e?e.labwareId:s.pipettes[n].entityId??"",i="wellName"in e?e.wellName:s.pipettes[n].wellName??"",l=s.liquidState.pipettes[n],p=Object.values(l)[0]?.[Ge]?.volume??0,d=r.robotState.pipettes[n].primaryNozzle;if(Ss({invariantContext:t,entityId:o,pipetteId:n,prevLiquidState:s.liquidState,useFullVolume:!1,volume:a,wellName:i,robotStateAndWarnings:r}),p>0){const f=r.robotState.pipettes[n].nozzles,_=t.pipetteEntities[n].spec,m=Mc({pipetteSpec:_,nozzles:f,primaryNozzle:d});Object.keys(l).slice(0,m).forEach(b=>{const T=l[b]??{};l[b]={...T,[Ge]:{volume:0}}})}"labwareId"in e&&(s.pipettes[n]={...s.pipettes[n],entityId:e.labwareId})}function RI(e,t,r){const{pipetteId:n,wellName:a,labwareId:s}=e,{robotState:o}=r;o.tipState.pipettes[n].hasTip=!1,o.tipState.pipettes[n].tiprackURI=null,o.pipettes[n].tiprackId=void 0;const i=o.tipState,l=t.pipetteEntities[n].spec,u=o.pipettes[n].nozzles,p=zc(u,l),d=(_,m)=>_.find(h=>h.includes(m)),f=t.labwareEntities[s]?.def;f==null||!c.getIsTiprack(f)?console.warn(`forDropTip expected ${s} to have definition and to be a tiprack`):(p===c.SINGLE?i.tipracks[s][a]=Yt:p===c.COLUMN?(d(f.ordering,a)??[]).forEach(m=>i.tipracks[s][m]=Yt):p===c.ALL?l.channels===96?f.ordering.reduce((m,h)=>m.concat(h),[]).forEach(function(m){i.tipracks[s][m]=Yt}):(d(f.ordering,a)??[]).forEach(m=>i.tipracks[s][m]=Yt):l.channels===1?i.tipracks[s][a]=Yt:l.channels===96?f.ordering.reduce((m,h)=>m.concat(h),[]).forEach(function(m){i.tipracks[s][m]=Yt}):(d(f.ordering,a)??[]).forEach(m=>i.tipracks[s][m]=Yt),o.pipettes[n].entityId=s,o.pipettes[n].wellName=a)}function kI(e,t,r){const{labwareId:n,liquidId:a,volumeByWell:s}=e;Object.entries(s).forEach(([o,i])=>{r.robotState.liquidState.labware[n][o][a]={volume:i}})}var Rl,Kf;function vI(){if(Kf)return Rl;Kf=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 Rl=e,Rl}var kl,Xf;function Fc(){if(Xf)return kl;Xf=1;var e=_c(),t=is(),r=Object.prototype,n=r.hasOwnProperty;function a(s,o,i){var l=s[o];(!(n.call(s,o)&&t(l,i))||i===void 0&&!(o in s))&&e(s,o,i)}return kl=a,kl}var vl,Zf;function Ca(){if(Zf)return vl;Zf=1;var e=Fc(),t=_c();function r(n,a,s,o){var i=!s;s||(s={});for(var l=-1,u=a.length;++l<u;){var p=a[l],d=o?o(s[p],n[p],p,s,n):void 0;d===void 0&&(d=n[p]),i?t(s,p,d):e(s,p,d)}return s}return vl=r,vl}var Pl,Qf;function PI(){if(Qf)return Pl;Qf=1;var e=Ca(),t=Aa();function r(n,a){return n&&e(a,t(a),n)}return Pl=r,Pl}var Cl,Jf;function CI(){if(Jf)return Cl;Jf=1;function e(t){var r=[];if(t!=null)for(var n in Object(t))r.push(n);return r}return Cl=e,Cl}var Nl,em;function NI(){if(em)return Nl;em=1;var e=er(),t=ms(),r=CI(),n=Object.prototype,a=n.hasOwnProperty;function s(o){if(!e(o))return r(o);var i=t(o),l=[];for(var u in o)u=="constructor"&&(i||!a.call(o,u))||l.push(u);return l}return Nl=s,Nl}var Dl,tm;function qc(){if(tm)return Dl;tm=1;var e=Hh(),t=NI(),r=xr();function n(a){return r(a)?e(a,!0):t(a)}return Dl=n,Dl}var Ml,rm;function DI(){if(rm)return Ml;rm=1;var e=Ca(),t=qc();function r(n,a){return n&&e(a,t(a),n)}return Ml=r,Ml}var sa={exports:{}};sa.exports;var nm;function MI(){return nm||(nm=1,(function(e,t){var r=Vt(),n=t&&!t.nodeType&&t,a=n&&!0&&e&&!e.nodeType&&e,s=a&&a.exports===n,o=s?r.Buffer:void 0,i=o?o.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})(sa,sa.exports)),sa.exports}var Fl,am;function FI(){if(am)return Fl;am=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 Fl=e,Fl}var ql,sm;function qI(){if(sm)return ql;sm=1;var e=Ca(),t=lc();function r(n,a){return e(n,t(n),a)}return ql=r,ql}var Ul,om;function Uc(){if(om)return Ul;om=1;var e=zh(),t=e(Object.getPrototypeOf,Object);return Ul=t,Ul}var Bl,im;function F_(){if(im)return Bl;im=1;var e=nc(),t=Uc(),r=lc(),n=$h(),a=Object.getOwnPropertySymbols,s=a?function(o){for(var i=[];o;)e(i,r(o)),o=t(o);return i}:n;return Bl=s,Bl}var Vl,lm;function UI(){if(lm)return Vl;lm=1;var e=Ca(),t=F_();function r(n,a){return e(n,t(n),a)}return Vl=r,Vl}var $l,um;function Bc(){if(um)return $l;um=1;var e=Bh(),t=F_(),r=qc();function n(a){return e(a,r,t)}return $l=n,$l}var xl,cm;function BI(){if(cm)return xl;cm=1;var e=Object.prototype,t=e.hasOwnProperty;function r(n){var a=n.length,s=new n.constructor(a);return a&&typeof n[0]=="string"&&t.call(n,"index")&&(s.index=n.index,s.input=n.input),s}return xl=r,xl}var Hl,pm;function Vc(){if(pm)return Hl;pm=1;var e=Uh();function t(r){var n=new r.constructor(r.byteLength);return new e(n).set(new e(r)),n}return Hl=t,Hl}var zl,dm;function VI(){if(dm)return zl;dm=1;var e=Vc();function t(r,n){var a=n?e(r.buffer):r.buffer;return new r.constructor(a,r.byteOffset,r.byteLength)}return zl=t,zl}var jl,fm;function $I(){if(fm)return jl;fm=1;var e=/\w*$/;function t(r){var n=new r.constructor(r.source,e.exec(r));return n.lastIndex=r.lastIndex,n}return jl=t,jl}var Gl,mm;function xI(){if(mm)return Gl;mm=1;var e=gn(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function n(a){return r?Object(r.call(a)):{}}return Gl=n,Gl}var Wl,hm;function HI(){if(hm)return Wl;hm=1;var e=Vc();function t(r,n){var a=n?e(r.buffer):r.buffer;return new r.constructor(a,r.byteOffset,r.length)}return Wl=t,Wl}var Yl,_m;function zI(){if(_m)return Yl;_m=1;var e=Vc(),t=VI(),r=$I(),n=xI(),a=HI(),s="[object Boolean]",o="[object Date]",i="[object Map]",l="[object Number]",u="[object RegExp]",p="[object Set]",d="[object String]",f="[object Symbol]",_="[object ArrayBuffer]",m="[object DataView]",h="[object Float32Array]",b="[object Float64Array]",T="[object Int8Array]",y="[object Int16Array]",A="[object Int32Array]",S="[object Uint8Array]",g="[object Uint8ClampedArray]",I="[object Uint16Array]",L="[object Uint32Array]";function w(E,R,k){var B=E.constructor;switch(R){case _:return e(E);case s:case o:return new B(+E);case m:return t(E,k);case h:case b:case T:case y:case A:case S:case g:case I:case L:return a(E,k);case i:return new B;case l:case d:return new B(E);case u:return r(E);case p:return new B;case f:return n(E)}}return Yl=w,Yl}var Kl,ym;function jI(){if(ym)return Kl;ym=1;var e=er(),t=Object.create,r=(function(){function n(){}return function(a){if(!e(a))return{};if(t)return t(a);n.prototype=a;var s=new n;return n.prototype=void 0,s}})();return Kl=r,Kl}var Xl,bm;function GI(){if(bm)return Xl;bm=1;var e=jI(),t=Uc(),r=ms();function n(a){return typeof a.constructor=="function"&&!r(a)?e(t(a)):{}}return Xl=n,Xl}var Zl,Tm;function WI(){if(Tm)return Zl;Tm=1;var e=La(),t=Jt(),r="[object Map]";function n(a){return t(a)&&e(a)==r}return Zl=n,Zl}var Ql,gm;function YI(){if(gm)return Ql;gm=1;var e=WI(),t=cc(),r=pc(),n=r&&r.isMap,a=n?t(n):e;return Ql=a,Ql}var Jl,Im;function KI(){if(Im)return Jl;Im=1;var e=La(),t=Jt(),r="[object Set]";function n(a){return t(a)&&e(a)==r}return Jl=n,Jl}var eu,Em;function XI(){if(Em)return eu;Em=1;var e=KI(),t=cc(),r=pc(),n=r&&r.isSet,a=n?t(n):e;return eu=a,eu}var tu,wm;function q_(){if(wm)return tu;wm=1;var e=oc(),t=vI(),r=Fc(),n=PI(),a=DI(),s=MI(),o=FI(),i=qI(),l=UI(),u=Gh(),p=Bc(),d=La(),f=BI(),_=zI(),m=GI(),h=Xe(),b=ds(),T=YI(),y=er(),A=XI(),S=Aa(),g=qc(),I=1,L=2,w=4,E="[object Arguments]",R="[object Array]",k="[object Boolean]",B="[object Date]",q="[object Error]",ee="[object Function]",pe="[object GeneratorFunction]",_e="[object Map]",le="[object Number]",be="[object Object]",ve="[object RegExp]",He="[object Set]",Be="[object String]",te="[object Symbol]",Ee="[object WeakMap]",ze="[object ArrayBuffer]",Pe="[object DataView]",Te="[object Float32Array]",K="[object Float64Array]",W="[object Int8Array]",P="[object Int16Array]",v="[object Int32Array]",V="[object Uint8Array]",N="[object Uint8ClampedArray]",ae="[object Uint16Array]",U="[object Uint32Array]",H={};H[E]=H[R]=H[ze]=H[Pe]=H[k]=H[B]=H[Te]=H[K]=H[W]=H[P]=H[v]=H[_e]=H[le]=H[be]=H[ve]=H[He]=H[Be]=H[te]=H[V]=H[N]=H[ae]=H[U]=!0,H[q]=H[ee]=H[Ee]=!1;function z(D,x,ye,Ve,Ze,$e){var ce,Qe=x&I,mt=x&L,At=x&w;if(ye&&(ce=Ze?ye(D,Ve,Ze,$e):ye(D)),ce!==void 0)return ce;if(!y(D))return D;var ht=h(D);if(ht){if(ce=f(D),!Qe)return o(D,ce)}else{var Oe=d(D),Je=Oe==ee||Oe==pe;if(b(D))return s(D,Qe);if(Oe==be||Oe==E||Je&&!Ze){if(ce=mt||Je?{}:m(D),!Qe)return mt?l(D,a(ce,D)):i(D,n(ce,D))}else{if(!H[Oe])return Ze?D:{};ce=_(D,Oe,Qe)}}$e||($e=new e);var Re=$e.get(D);if(Re)return Re;$e.set(D,ce),A(D)?D.forEach(function(ue){ce.add(z(ue,x,ye,ue,D,$e))}):T(D)&&D.forEach(function(ue,re){ce.set(re,z(ue,x,ye,re,D,$e))});var ke=At?mt?p:u:mt?g:S,Ce=ht?void 0:ke(D);return t(Ce||D,function(ue,re){Ce&&(re=ue,ue=D[re]),r(ce,re,z(ue,x,ye,re,D,$e))}),ce}return tu=z,tu}var ru,Sm;function U_(){if(Sm)return ru;Sm=1;function e(t,r,n){var a=-1,s=t.length;r<0&&(r=-r>s?0:s+r),n=n>s?s:n,n<0&&(n+=s),s=r>n?0:n-r>>>0,r>>>=0;for(var o=Array(s);++a<s;)o[a]=t[a+r];return o}return ru=e,ru}var nu,Am;function ZI(){if(Am)return nu;Am=1;var e=hs(),t=U_();function r(n,a){return a.length<2?n:e(n,t(a,0,-1))}return nu=r,nu}var au,Lm;function QI(){if(Lm)return au;Lm=1;var e=En(),t=O_(),r=ZI(),n=wn(),a=Object.prototype,s=a.hasOwnProperty;function o(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__"&&!s.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 au=o,au}var su,Om;function JI(){if(Om)return su;Om=1;var e=In(),t=Uc(),r=Jt(),n="[object Object]",a=Function.prototype,s=Object.prototype,o=a.toString,i=s.hasOwnProperty,l=o.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&&o.call(f)==l}return su=u,su}var ou,Rm;function eE(){if(Rm)return ou;Rm=1;var e=JI();function t(r){return e(r)?void 0:r}return ou=t,ou}var iu,km;function tE(){if(km)return iu;km=1;var e=Ph();function t(r){var n=r==null?0:r.length;return n?e(r,1):[]}return iu=t,iu}var lu,vm;function rE(){if(vm)return lu;vm=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 lu=e,lu}var uu,Pm;function B_(){if(Pm)return uu;Pm=1;var e=rE(),t=Math.max;function r(n,a,s){return a=t(a===void 0?n.length-1:a,0),function(){for(var o=arguments,i=-1,l=t(o.length-a,0),u=Array(l);++i<l;)u[i]=o[a+i];i=-1;for(var p=Array(a+1);++i<a;)p[i]=o[i];return p[a]=s(u),e(n,this,p)}}return uu=r,uu}var cu,Cm;function nE(){if(Cm)return cu;Cm=1;function e(t){return function(){return t}}return cu=e,cu}var pu,Nm;function aE(){if(Nm)return pu;Nm=1;var e=nE(),t=Qh(),r=ga(),n=t?function(a,s){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(s),writable:!0})}:r;return pu=n,pu}var du,Dm;function sE(){if(Dm)return du;Dm=1;var e=800,t=16,r=Date.now;function n(a){var s=0,o=0;return function(){var i=r(),l=t-(i-o);if(o=i,l>0){if(++s>=e)return arguments[0]}else s=0;return a.apply(void 0,arguments)}}return du=n,du}var fu,Mm;function V_(){if(Mm)return fu;Mm=1;var e=aE(),t=sE(),r=t(e);return fu=r,fu}var mu,Fm;function oE(){if(Fm)return mu;Fm=1;var e=tE(),t=B_(),r=V_();function n(a){return r(t(a,void 0,e),a+"")}return mu=n,mu}var hu,qm;function iE(){if(qm)return hu;qm=1;var e=Sa(),t=q_(),r=QI(),n=En(),a=Ca(),s=eE(),o=oE(),i=Bc(),l=1,u=2,p=4,d=o(function(f,_){var m={};if(f==null)return m;var h=!1;_=e(_,function(T){return T=n(T,f),h||(h=T.length>1),T}),a(f,i(f),m),h&&(m=t(m,l|u|p,s));for(var b=_.length;b--;)r(m,_[b]);return m});return hu=d,hu}var lE=iE();const uE=xe(lE),Gu="TOUCHED_PIPETTABLE_LABWARE";var _u,Um;function cE(){if(Um)return _u;Um=1;var e=fc();function t(r,n){return e(r,n)}return _u=t,_u}var pE=cE();const dE=xe(pE),As=e=>{const{node:t,stack:r=[],robotState:n,memo:a=new Map}=e;let s=r;if(!(typeof t=="object"&&"labwareId"in t))return s=[...r,t],a.set(t,s),{stack:s,memo:a};const{labwareId:o}=t,i=n.labware[o];if(i!=null&&i.stackedOnNode!=null){const{stack:l,memo:u}=As({node:i.stackedOnNode,stack:[...r,t],robotState:n,memo:a});$_(a,u),s=l,a.set(t,s)}return{stack:s,memo:a}},fE=e=>{const{node:t,robotState:r,deckDef:n,deckConfiguration:a}=e,{stack:s}=As({node:t,robotState:r}),{cutoutFixtures:o}=n,i=s.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 o){const[d]=Object.entries(p).find(([f,_])=>_.includes(l))??[];if(d!=null){const f=a.find(({cutoutId:T})=>T===d),{cutoutFixtureId:_,cutoutId:m}=f,h=_===u&&m===d,b=Object.entries(r.modules).find(([T,{slot:y}])=>c.FLEX_CUTOUT_BY_SLOT_ID[y]===m);if(h&&b!=null)return b[0]}}}return null},$_=(e,t)=>{t.forEach((r,n)=>{e.set(n,r)})},mE=(e,t)=>e.some(r=>dE(r,t)),x_=e=>{const{labwareId:t,robotState:r}=e,n=new Map,a={labwareId:t};let s=[];for(const[o,{stackedOnNode:i}]of Object.entries(r.labware)){const l={labwareId:o};if(i==null)continue;let u;const p=n.get(l);if(p!=null)u=p;else{const{stack:d,memo:f}=As({node:l,robotState:r,memo:n});if($_(n,f),!mE(d,a))continue;n.set(l,d),u=d}u.length>s.length&&(s=u)}return s},H_=e=>{const t=[],r=new Set;for(const n of Object.keys(e.labware)){if(r.has(n))continue;const a=x_({labwareId:n,robotState:e});a.forEach(s=>{typeof s=="object"&&"labwareId"in s&&r.add(s.labwareId)}),t.push(a)}return t},$c=e=>{const{moduleId:t,robotState:r,moduleEntities:n,deckDef:a}=e,s=r.modules[t],o=n[t];if(s==null||o==null)return null;const{slot:i}=s,{model:l}=o,u=c.getAddressableAreaNamesFromLoadedModule(l,i,a);return u.length===0?null:u[0]},hE=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:s}=t;return $c({moduleId:s,robotState:r,moduleEntities:n,deckDef:a})}return null},z_=e=>{const{deckConfiguration:t,deckDefinition:r}=e;return t.reduce((n,{cutoutFixtureId:a,cutoutId:s})=>((r.cutoutFixtures.find(({id:i})=>a===i)?.providesAddressableAreas[s]??[]).forEach(i=>{n.add(i)}),n),new Set)},_E=e=>{const{robotState:t,deckConfiguration:r,deckDefinition:n,moduleEntities:a}=e,s=z_({deckConfiguration:r,deckDefinition:n}),o=new Set(s),i=H_(t);for(const l of i){const u=Pc(l);if(typeof u=="object"&&"addressableAreaName"in u){const{addressableAreaName:p}=u;o.delete(p)}if(typeof u=="object"&&"slotName"in u){const{slotName:p}=u;o.delete(p)}if(typeof u=="object"&&"moduleId"in u){const{moduleId:p}=u,d=$c({moduleId:p,robotState:t,moduleEntities:a,deckDef:n});d!=null&&o.delete(d)}}return o},yE=e=>{const t=e.toLowerCase();return t.includes("chute")||t.includes("waste")||t.startsWith("gripper")||t==="96channelwastechute"},j_=e=>{const{stack:t,subjectLabwareId:r,moduleEntities:n,labwareEntityIds:a,modules:s}=e;if(t.length===0||t[0]!==r||t.length<2)return;const o=t[1];if(o===je){const u=t[2];return u==null?void 0:{kind:"inStackerHopper",moduleId:u}}if(n[o]!=null)return{moduleId:o};if(a.has(o))return{labwareId:o};if(o==="offDeck")return"offDeck";if(o==="systemLocation")return"systemLocation";if(o==="wasteChuteLocation")return"wasteChuteLocation";if(yE(o))return{addressableAreaName:o};const i=S_(o,s,n)??o;if(Object.entries(s).some(([u,p])=>n[u]?.type===c.FLEX_STACKER_MODULE_TYPE&&p.slot===i)){const u=gs(i);if(u!=null)return{addressableAreaName:u}}return{slotName:o}},bE=e=>typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="inStackerHopper",TE=e=>typeof e!="object"||e===null?!1:!bE(e),gE=(e,t)=>{const{id:r,def:n}=e,{id:a,def:s}=t,o=n.dimensions.xDimension,i=n.dimensions.yDimension,l=s.dimensions.xDimension,u=s.dimensions.yDimension;return o>l&&i>u?{containerLabwareId:r,containedLabwareId:a}:l>o&&u>i?{containerLabwareId:a,containedLabwareId:r}:null},xc=(e,t)=>{const r=new Map;for(const a of Object.keys(e)){const s=e[a].stackedOnNode;if(s==null||!TE(s))continue;const o=JSON.stringify(s),i=r.get(o)??[];i.push(a),r.set(o,i)}const n={};for(const a of r.values()){if(a.length!==2)continue;const[s,o]=a,i=t[s],l=t[o];if(i==null||l==null)continue;const u=gE(i,l);if(u==null)continue;const{containerLabwareId:p,containedLabwareId:d}=u;n[p]=d}return Object.keys(n).length===0?e:Zt(e,(a,s)=>n[s]!=null?{...a,contains:n[s]}:a)},IE=(e,t,r)=>{const n=Object.keys(e.labware),a=new Set(n);let s=Zt(e.labware,(o,i)=>{const l=o.stackedOnNode??j_({stack:o.stack,subjectLabwareId:i,moduleEntities:t,labwareEntityIds:a,modules:e.modules});return l!=null?{...o,stackedOnNode:l}:{...o}});return s=xc(s,r),{...e,labware:s}};function EE(e,t,r){const{labwareId:n,newLocation:a}=e,{robotState:s}=r,{labwareEntities:o}=t,{modules:i,labware:l}=s;if(l[n]==null)return;const u=G(l[n].stack),p=Lc(l,u,n),d=p.indexOf(n),f=p.slice(0,d+1),_=c.getIsLid(o[n].def);let m=!1;const h=Object.entries(i).find(([w,{slot:E}])=>{const{type:R}=t.moduleEntities[w]??{};return R===c.FLEX_STACKER_MODULE_TYPE&&E===u})??null,b=h!=null&&h[1].moduleState.type===c.FLEX_STACKER_MODULE_TYPE?Kt.map(w=>h[1].moduleState.labwareOnShuttle?.[w]).filter(w=>w!=null):[],T=b.includes(n)?b.slice(0,b.indexOf(n)+1):[];if(h!=null&&h[1].moduleState.type===c.FLEX_STACKER_MODULE_TYPE){const w=h[1].moduleState,E=Kt.findIndex(R=>w.labwareOnShuttle?.[R]===n);if(E!==-1&&w.labwareOnShuttle!=null)for(const R of Kt.slice(E,Kt.length))if(R==="primaryLabwareId"){w.labwareOnShuttle=null;break}else w.labwareOnShuttle[R]=null}const y=Object.entries(i).find(([w,{slot:E}])=>{const{type:R}=t.moduleEntities[w]??{};return R===c.FLEX_STACKER_MODULE_TYPE&&typeof a=="object"&&("moduleId"in a&&a.moduleId===w||"slotName"in a&&E===a.slotName)})??null,[A,S]=y??[];if(A!=null&&S!=null){const w=T.length>0?T:pn(l,u),E=w.indexOf(n),R=S.moduleState;if(E!==-1){const k=w.slice(0,E+1).toReversed();if(R.labwareOnShuttle==null&&(R.labwareOnShuttle={primaryLabwareId:"",adapterLabwareId:null,lidLabwareId:null}),k.length===3)for(let B=0;B<Kt.length;B++){const q=Kt[B];R.labwareOnShuttle[q]=k[B]}else if(k.length===2){const B=k.some(q=>t.labwareEntities[q].def.allowedRoles?.some(ee=>ee==="lid"))?["primaryLabwareId","lidLabwareId"]:["adapterLabwareId","primaryLabwareId"];for(let q=0;q<B.length;q++){const ee=B[q];R.labwareOnShuttle[ee]=k[q]}}else k.length===1&&(R.labwareOnShuttle.primaryLabwareId=k[0])}}const g=[];if(c.locationIsOffDeck(a))g.push(a);else if("moduleId"in a)if(i[a.moduleId].moduleState.type===c.FLEX_STACKER_MODULE_TYPE)g.push(i[a.moduleId].slot);else if(t.moduleEntities[a.moduleId]?.type===c.VACUUM_MODULE_TYPE){const w=i[a.moduleId].slot,E=pn(l,w);E.length>0?g.push(...E):g.push(a.moduleId,w)}else g.push(a.moduleId,i[a.moduleId].slot);else if("slotName"in a){const{slotName:w}=a;w in l?(m=c.getIsPipettableLabware(o[w].def),g.push(...l[w].stack)):g.push(w)}else if("labwareId"in a){const w=a.labwareId;m=c.getIsPipettableLabware(o[w].def);const E=l[w].stack;g.push(...E)}else if("addressableAreaName"in a)if(la(a.addressableAreaName)){const w=Object.entries(i).find(([E])=>t.moduleEntities[E]?.type===c.VACUUM_MODULE_TYPE)?.[0];g.push(tc),w!=null&&g.push(w),g.push(a.addressableAreaName)}else g.push(a.addressableAreaName);f.forEach((w,E)=>{if(l[w]!=null){const R=f.slice(E+1);s.labware[w]={...s.labware[w],stack:[w,...R,...g],..._&&m?{sterility:Gu}:{}}}});const I=typeof a=="object"&&"labwareId"in a&&c.getIsPipettableLabware(o[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 w=gs(i[a.moduleId].slot);w!=null&&(L={addressableAreaName:w})}else if(typeof a=="object"&&a!==null&&"moduleId"in a&&t.moduleEntities[a.moduleId]?.type===c.VACUUM_MODULE_TYPE){const w=i[a.moduleId].slot,E=pn(l,w),R=E.length>0?E[0]:null;R!=null&&R in o&&(L={labwareId:R})}s.labware[n].stackedOnNode=L,I&&(s.labware[n].sterility=Gu),s.labware=xc(Zt(s.labware,w=>uE(w,"contains")),o)}function wE(e,t,r){const{pipetteId:n,addressableAreaName:a}=e,{wasteChuteEntities:s,trashBinEntities:o}=t,i=c.WASTE_CHUTE_ADDRESSABLE_AREAS.includes(a),l=Object.values(o).find(d=>d.location===m_(a))?.id,u=i?Object.values(s)[0].id:l,{robotState:p}=r;p.pipettes[n]={...p.pipettes[n],entityId:u}}function SE(e,t,r){const{pipetteId:n,labwareId:a,wellName:s}=e,{robotState:o}=r;o.pipettes[n]={...o.pipettes[n],entityId:a,wellName:s}}function AE(e,t,r){const{pipetteId:n,labwareId:a,wellName:s}=e,o=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=zc(u,o),f=(h,b)=>h.find(T=>T.includes(b)),_=(h,b)=>{const T=h.findIndex(A=>A.includes(b));if(T===-1)return null;const y=h[T].indexOf(b);return h.map(A=>A[y])},m=(h,b)=>{const T=c.PARTIAL_NOZZLE_MAP[p],y=h.findIndex(L=>L.includes(b)),A=h[y].indexOf(b),S=h[y];if(S.length-A<T){const L=S.length-T;return S.slice(L,S.length)}const I=A+T;return S.slice(A,Math.min(I,S.length))};if(l.pipettes[n].hasTip=!0,l.pipettes[n].tiprackURI=a,d===c.SINGLE)l.tipracks[a][s]=ie;else if(d===c.PARTIAL_COLUMN&&p){const h=m(i.ordering,s);h==null?console.error(`Invalid primary well for tip pick up for partial config: ${s}`):h.forEach(function(b){l.tipracks[a][b]=ie})}else if(d===c.COLUMN){const h=f(i.ordering,s);h==null&&console.error(`Invalid primary well for tip pickup: ${s}`),h?.forEach(function(b){l.tipracks[a][b]=ie})}else if(d===c.ROW){const h=_(i.ordering,s);h==null&&console.error("Invalid primary well for tip pickup: "+s),h?.forEach(function(b){l.tipracks[a][b]=ie})}else if(d===c.ALL)if(o.channels===96)i.ordering.reduce((b,T)=>b.concat(T),[]).forEach(function(b){l.tipracks[a][b]=ie});else{const h=f(i.ordering,s);h==null&&console.error(`Invalid primary well for tip pickup: ${s}`),h?.forEach(function(b){l.tipracks[a][b]=ie})}else if(o.channels===1)l.tipracks[a][s]=ie;else if(o.channels===96)i.ordering.reduce((b,T)=>b.concat(T),[]).forEach(function(b){l.tipracks[a][b]=ie});else{const h=f(i.ordering,s);h==null&&console.error(`Invalid primary well for tip pickup: ${s}`),h?.forEach(function(b){l.tipracks[a][b]=ie})}r.robotState.pipettes[n].tiprackId=a,r.robotState.pipettes[n].tipWell=s}const LE={clean:Ea,empty:ie,used:Yt};function OE(e,t,r){const{labwareId:n,wellNames:a,tipWellState:s="clean"}=e,o=LE[s],i=r.robotState.tipState.tipracks[n];i!=null&&a.forEach(l=>{i[l]=o})}const zr=(e,t)=>{const r=St(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}`),{})},RE=(e,t,r)=>{const{moduleId:n,celsius:a}=e,{robotState:s}=r,o=zr(s,n);o.currentBlockActivity={type:"blockTargetTemp",blockTargetTemp:a}},kE=(e,t,r)=>{const{moduleId:n,celsius:a}=e,{robotState:s}=r,o=zr(s,n);o.lidTargetTemp=a},vE=(e,t,r)=>{},PE=(e,t,r)=>{},CE=(e,t,r)=>{},NE=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,s=zr(a,n);s.currentBlockActivity={type:"blockDeactivated"}},DE=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,s=zr(a,n);s.lidTargetTemp=null},ME=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,s=zr(a,n);s.lidOpen=!1},FE=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,s=zr(a,n);s.lidOpen=!0},qE=(e,t,r)=>{const{profile:n,...a}=e;G_({profileElements:n,...a},t,r)},G_=(e,t,r)=>{const n=NaN+F();W_({...e,taskId:n},t,r),Y_(n,r,c.THERMOCYCLER_MODULE_TYPE)},W_=(e,t,r)=>{const{moduleId:n,taskId:a,profileElements:s}=e,{robotState:o}=r,i=zr(o,n);i.currentBlockActivity={type:"profile",profileElements:s,taskId:a??null},i.numProfilesStarted++},UE=e=>{if(e.currentBlockActivity.type==="profile"){const t=BE(e.currentBlockActivity.profileElements);return e.currentBlockActivity=t!=null?{type:"blockTargetTemp",blockTargetTemp:t}:{type:"blockDeactivated"},!0}else return!1};function BE(e){const t=Pc(Wc(e));return t!=null?t.celsius:null}const VE=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,s=st(a,n);s!=null&&(s.ventStatus=rc)},$E=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,s=st(a,n);s!=null&&(s.ventStatus=wa)},xE=(e,t,r)=>{const{moduleId:n,gaugePressure:a,duration:s,ventAfter:o=!0,taskId:i}=e,{robotState:l}=r,u=st(l,n);u!=null&&(s==null||i==null?u.currentPumpActivity={type:"indefiniteHold",mode:qu,targetPressure:a}:(u.currentPumpActivity={type:"timedHold",mode:qu,targetPressure:a,durationSeconds:s,taskId:i,ventAfter:o},u.numPumpActivitiesStarted++),u.ventStatus=wa)},HE=(e,t,r)=>{const{moduleId:n,percentPower:a,duration:s,ventAfter:o=!0,taskId:i}=e,{robotState:l}=r,u=st(l,n);u!=null&&(s==null||i==null?u.currentPumpActivity={type:"indefiniteHold",mode:Fu,targetPower:a}:(u.currentPumpActivity={type:"timedHold",mode:Fu,targetPower:a,durationSeconds:s,taskId:i,ventAfter:o},u.numPumpActivitiesStarted++),u.ventStatus=wa)},zE=(e,t,r)=>{const{moduleId:n}=e,{robotState:a}=r,s=st(a,n);s!=null&&(s.currentPumpActivity={type:"pumpDeactivated"})},jE=(e,t,r)=>{const{moduleId:n,profile:a,taskId:s,ventAfter:o=!0}=e,{robotState:i}=r,l=st(i,n);l==null||s==null||(l.currentPumpActivity={type:"profile",profileElements:a,taskId:s,ventAfter:o},l.numPumpActivitiesStarted++)},GE=e=>{if(e.currentPumpActivity.type==="timedHold"||e.currentPumpActivity.type==="profile"){const t=e.currentPumpActivity.ventAfter;return e.currentPumpActivity={type:"pumpDeactivated"},e.ventStatus=t?rc:wa,!0}return!1};function WE(e,t,r){for(const n of e.task_ids)Y_(n,r)||r.warnings.push(Ag())}const Y_=(e,t,r)=>{const{robotState:n}=t,a=Object.values(n.modules).find(s=>{if(r&&s.moduleState.type!==r)return!1;const o=s.moduleState.type==="thermocyclerModuleType"&&s.moduleState.currentBlockActivity.type==="profile"&&s.moduleState.currentBlockActivity.taskId===e,i=s.moduleState.type==="vacuumModuleType"&&(s.moduleState.currentPumpActivity.type==="timedHold"||s.moduleState.currentPumpActivity.type==="profile")&&s.moduleState.currentPumpActivity.taskId===e;return o||i});return a==null?!1:a.moduleState.type==="thermocyclerModuleType"?UE(a.moduleState):a.moduleState.type==="vacuumModuleType"?GE(a.moduleState):(console.log(`unexpected module type with task: ${a.moduleState.type}`),!1)},kn=(e,t)=>{const r=St(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}`),{})},YE=(e,t,r)=>{const{robotState:n}=r,{moduleId:a,celsius:s}=e,o=kn(n,a);o.targetTemp=s},KE=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=kn(n,a);s.targetTemp=null},XE=(e,t,r)=>{const{robotState:n}=r,{moduleId:a,rpm:s}=e,o=kn(n,a);o.targetSpeed=s},ZE=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=kn(n,a);s.targetSpeed=null},QE=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=kn(n,a);s.latchOpen=!0},JE=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=kn(n,a);s.latchOpen=!1},ew=(e,t,r)=>{const{pipetteId:n}=e,{robotState:a}=r,s=a.pipettes[n].entityId??"";Ss({invariantContext:t,pipetteId:n,prevLiquidState:a.liquidState,useFullVolume:!0,robotStateAndWarnings:r,entityId:s})},tw=(e,t,r)=>{const{pipetteId:n}=e,{robotState:a}=r,s=a.pipettes[n].entityId??"";a.tipState.pipettes[n]={hasTip:!1,tiprackURI:null},Ss({invariantContext:t,prevLiquidState:a.liquidState,pipetteId:n,useFullVolume:!0,robotStateAndWarnings:r,entityId:s}),a.pipettes[n].tiprackId=void 0};function K_(e,t){e.type===c.MAGNETIC_MODULE_TYPE&&(e.engaged=t)}function rw(e,t,r){const{moduleId:n}=e,{robotState:a}=r,s=St(a,n);K_(s,!0)}function nw(e,t,r){const{moduleId:n}=e,{robotState:a}=r,s=St(a,n);K_(s,!1)}const yu=(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},X_=(e,t,r,n)=>{const a=e.labwareInHopper??[];t.forEach(s=>{const{primaryLabwareId:o,adapterLabwareId:i,lidLabwareId:l}=s;r.labware[o]={stack:[o,...l!=null?[l]:[],...n]},i!=null&&(r.labware[i]={stack:[i,o,...l!=null?[l]:[],...n]}),l!=null&&(r.labware[l]={stack:[l,...n]}),a.push({primaryLabwareId:o,adapterLabwareId:i??null,lidLabwareId:l??null})}),e.labwareInHopper=a},Z_=(e,t,r,n,a,s,o,i)=>{const u=Object.entries(e.labware).filter(([d,f])=>f[s]===t[s]).map(([d])=>d).map(d=>r[d]),p=[];for(let d=0;d<n;d++){const f=yu(u,t.storedLabwareDetails?.primaryLabwareURI),_=o!=null?yu(u,t.storedLabwareDetails?.adapterLabwareURI):null,m=i!=null?yu(u,t.storedLabwareDetails?.lidLabwareURI):null;f!=null&&(e.labware[f]={stack:[f,...m!=null?[m]:[],...a]},_!=null&&(e.labware[_]={stack:[_,f,...m!=null?[m]:[],...a]}),m!=null&&(e.labware[m]={stack:[m,...a]}),p.push({primaryLabwareId:f,adapterLabwareId:_,lidLabwareId:m})),t.labwareInHopper=p}},aw=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=Object.entries(n.labware).filter(([,i])=>i.stack.includes(je)&&i.stack.includes(a)),o=ft(n,a);o!=null&&o.labwareInHopper!=null&&(e.count!=null?o.labwareInHopper=o.labwareInHopper.slice(0,e.count):o.labwareInHopper=[]),s.forEach(([i])=>{n.labware[i]={...n.labware[i],stack:[i,c.SYSTEM_LOCATION]}})},sw=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:a}=t,{moduleId:s,labware:o}=e,i=n.modules[s].slot,l=ft(n,s);if(l==null||l.storedLabwareDetails==null)return;const{primaryLabwareURI:u,adapterLabwareURI:p,lidLabwareURI:d}=l.storedLabwareDetails,f=[];for(const b of o){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 _=[je,s,i];for(const b of f){const T=[b.adapterLabwareId,b.primaryLabwareId,b.lidLabwareId,..._].filter(A=>A!=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 A of T)a[A]!=null&&(y==null?n.labware[A].stackedOnNode={kind:"inStackerHopper",moduleId:s}:n.labware[A].stackedOnNode={labwareId:y},y=A)}const m=l.labwareInHopper??[],h=f.map(({primaryLabwareId:b,adapterLabwareId:T,lidLabwareId:y})=>({primaryLabwareId:b,adapterLabwareId:T,lidLabwareId:y}));l.labwareInHopper=[...m,...h]},ow=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:a}=t,{moduleId:s,primaryLabware:o,initialCount:i,adapterLabware:l,lidLabware:u,initialStoredLabware:p}=e,d=n.modules[s].slot,f=ft(n,s),_=[je,s,d];f!=null&&(f.storedLabwareDetails={primaryLabwareURI:`${o.namespace}/${o.loadName}/${o.version}`,adapterLabwareURI:l!=null?`${l.namespace}/${l.loadName}/${l.version}`:null,lidLabwareURI:u!=null?`${u.namespace}/${u.loadName}/${u.version}`:null},i!=null?Z_(n,f,a,i,_,"setStoredLabwareCount",l?.loadName,u?.loadName):p!=null&&X_(f,p,n,_),f.setStoredLabwareCount=(f?.setStoredLabwareCount??0)+1)},iw=(e,t,r)=>{const{robotState:n}=r,{moduleId:a,labware:s}=e,{labwareEntities:o}=t,i=n.modules[a].slot,l=ft(n,a);if(l==null)return;const u=s.map(g=>g.split(":")[1]),p=new Set(u),d=Array.from(p),f=d.find(g=>Object.values(o).find(I=>I.labwareDefURI===g&&!I.def.allowedRoles?.includes("lid")&&!I.def.allowedRoles?.includes("adapter"))),_=d.find(g=>Object.values(o).find(I=>I.labwareDefURI===g&&I.def.allowedRoles?.includes("adapter"))),m=d.find(g=>Object.values(o).find(I=>I.labwareDefURI===g&&I.def.allowedRoles?.includes("lid")));if(f==null)throw new Error(`expected to find primaryLabwareURI for storedLabwareDetails but could not with labware ${s}`);l.storedLabwareDetails={primaryLabwareURI:f,adapterLabwareURI:_??null,lidLabwareURI:m??null};const h=[];for(const g of s){const I=o[g].labwareDefURI;if(I===f)h.push({primary:g,adapter:null,lid:null});else if(I===_){const L=h[h.length-1];L&&(L.adapter=g)}else if(I===m){const L=h[h.length-1];L&&(L.lid=g)}}const b=[je,a,i];for(const g of h){const I=[g.adapter,g.primary,g.lid,...b].filter(L=>L!=null);n.labware[g.primary]={...n.labware[g.primary],stack:I.slice(I.indexOf(g.primary))},g.adapter!=null&&(n.labware[g.adapter]={...n.labware[g.adapter],stack:I.slice(I.indexOf(g.adapter))}),g.lid!=null&&(n.labware[g.lid]={...n.labware[g.lid],stack:I.slice(I.indexOf(g.lid))})}const T=l.labwareInHopper??[],y=h.map(g=>({primaryLabwareId:g.primary,adapterLabwareId:g.adapter,lidLabwareId:g.lid})),A=new Map(T.map(g=>[g.primaryLabwareId,g])),S=[];for(const g of y)S.push(g),A.delete(g.primaryLabwareId);for(const g of T)A.has(g.primaryLabwareId)&&S.push(g);l.labwareInHopper=S},lw=(e,t,r)=>{const{robotState:n}=r,{moduleId:a,count:s,labwareToStore:o}=e,{labwareEntities:i}=t,l=n.modules[a].slot,u=ft(n,a),p=[je,a,l];if(u!=null){const d=u.storedLabwareDetails?.adapterLabwareURI,f=u.storedLabwareDetails?.lidLabwareURI;s!=null?Z_(n,u,i,s,p,"fillCount",d,f):o!=null&&X_(u,o,n,p),u.fillCount=(u?.fillCount??0)+1}},uw=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=ft(n,a),o=n.modules[a].slot;if(s!=null){const{labwareInHopper:i,labwareOnShuttle:l}=s;if(i!=null&&i.length>0&&l==null){const u=i[0];s.labwareOnShuttle=u,i.shift();const p=[o];let d=null;for(const f of Kt){const _=u[f];if(_!=null){if(p.unshift(_),n.labware[_].stack=[...p],d==null){const m=gs(o);m!=null?n.labware[_].stackedOnNode={addressableAreaName:m}:console.warn(`Could not find an addressable area for retrieved labware in stacker module ${a} at slot ${o}`)}else n.labware[_].stackedOnNode={labwareId:d};d=_}}}}},cw=(e,t,r)=>{const{robotState:n}=r,{moduleId:a}=e,s=ft(n,a),o=n.modules[a].slot;if(s!=null){const{labwareOnShuttle:i}=s;if(i!=null){s.labwareInHopper=[i,...s.labwareInHopper??[]],s.labwareOnShuttle=null;let l=null;for(const u of Kt){const p=i[u];p!=null&&(n.labware[p].stack=[p,je,a,o],l==null?(n.labware[p].stackedOnNode={kind:"inStackerHopper",moduleId:a},l=p):n.labware[p].stackedOnNode={labwareId:l})}s.storedLabwareDetails==null&&(s.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 Q_(e,t,r){e.type===c.TEMPERATURE_MODULE_TYPE&&(e.targetTemperature=t,e.status=r)}function pw(e,t,r){const{robotState:n}=r,{moduleId:a,celsius:s}=e,o=St(n,a);Q_(o,s,Ju)}function dw(e,t,r){const{robotState:n}=r,{moduleId:a,celsius:s}=e,o=St(n,a);o.type===c.TEMPERATURE_MODULE_TYPE&&s===o.targetTemperature&&(o.status=Qu)}function fw(e,t,r){const{robotState:n}=r,{moduleId:a}=e,s=St(n,a);Q_(s,null,Ia)}function J_(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;SI(e.params,t,r);break;case"airGapInPlace":uI(e.params,t,r);break;case"dispenseWhileTracking":case"dispense":case"dispenseInPlace":if(e.meta?.isAirGap===!0)break;OI(e.params,t,r);break;case"blowout":AI(e.params,t,r);break;case"dropTip":RI(e.params,t,r);break;case"pickUpTip":AE(e.params,t,r);break;case"setTipState":OE(e.params,t,r);break;case"magneticModule/engage":rw(e.params,t,r);break;case"magneticModule/disengage":nw(e.params,t,r);break;case"moveLabware":EE(e.params,t,r);break;case"waitForTasks":WE(e.params,t,r);break;case"flexStacker/setStoredLabware":ow(e.params,t,r);break;case"flexStacker/setStoredLabwareItems":iw(e.params,t,r);break;case"flexStacker/prepareShuttle":case"flexStacker/closeLatch":case"flexStacker/openLatch":break;case"flexStacker/empty":aw(e.params,t,r);break;case"flexStacker/fill":lw(e.params,t,r);break;case"flexStacker/fillItems":sw(e.params,t,r);break;case"flexStacker/retrieve":uw(e.params,t,r);break;case"flexStacker/store":cw(e.params,t,r);break;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":wE(e.params,t,r);break;case"moveToWell":SE(e.params,t,r);break;case"loadLiquid":kI(e.params,t,r);break;case"dropTipInPlace":tw(e.params,t,r);break;case"blowOutInPlace":ew(e.params,t,r);break;case"configureNozzleLayout":LI(e.params,t,r);break;case"temperatureModule/setTargetTemperature":pw(e.params,t,r);break;case"temperatureModule/deactivate":fw(e.params,t,r);break;case"temperatureModule/waitForTemperature":dw(e.params,t,r);break;case"thermocycler/setTargetBlockTemperature":RE(e.params,t,r);break;case"thermocycler/setTargetLidTemperature":kE(e.params,t,r);break;case"thermocycler/waitForBlockTemperature":vE(e.params);break;case"thermocycler/waitForLidTemperature":PE(e.params);break;case"thermocycler/deactivateBlock":NE(e.params,t,r);break;case"thermocycler/deactivateLid":DE(e.params,t,r);break;case"thermocycler/closeLid":ME(e.params,t,r);break;case"thermocycler/openLid":FE(e.params,t,r);break;case"thermocycler/runProfile":qE(e.params,t,r);break;case"thermocycler/runExtendedProfile":G_(e.params,t,r);break;case"thermocycler/startRunExtendedProfile":W_(e.params,t,r);break;case"thermocycler/awaitProfileComplete":CE(e.params);break;case"heaterShaker/deactivateHeater":KE(e.params,t,r);break;case"heaterShaker/setTargetTemperature":YE(e.params,t,r);break;case"heaterShaker/setAndWaitForShakeSpeed":XE(e.params,t,r);break;case"heaterShaker/deactivateShaker":ZE(e.params,t,r);break;case"heaterShaker/openLabwareLatch":QE(e.params,t,r);break;case"heaterShaker/closeLabwareLatch":JE(e.params,t,r);break;case"heaterShaker/waitForTemperature":break;case"absorbanceReader/openLid":oI(e.params,t,r);break;case"absorbanceReader/closeLid":iI(e.params,t,r);break;case"absorbanceReader/initialize":lI(e.params,t,r);break;case"absorbanceReader/read":break;case"vacuumModule/startSetVacuumPressure":xE(e.params,t,r);break;case"vacuumModule/startSetVacuumPower":HE(e.params,t,r);break;case"vacuumModule/openVent":VE(e.params,t,r);break;case"vacuumModule/closeVent":$E(e.params,t,r);break;case"vacuumModule/stopVacuum":zE(e.params,t,r);break;case"vacuumModule/startRunProfile":jE(e.params,t,r);break;default:console.error(`unknown command: ${e.commandType} passed to getNextRobotStateAndWarning`)}}function ey(e,t,r){return D_({warnings:[],robotState:r},a=>{J_(e,t,a)})}function Hc(e,t,r){const n=M_(e);return D_({warnings:[],robotState:r},s=>{n.forEach(o=>{J_(o,t,s)})})}const mw=(e,t,r)=>{const n=e.reduce((a,s,o)=>{const i=a.timeline.length===0?r:Pc(a.timeline).robotState;if(a.errors!=null)return a;const l=s(t,i);if("errors"in l)return{timeline:a.timeline,errors:l.errors};const p=M_(l.commands).reduce((f,_)=>ey(_,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}},vn=(e,t)=>{const r=t[e]?.stack;return r!=null?G(r):""},Pn=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},Cn=e=>{const{pipette:t,labware:r,invariantContext:n,prevRobotState:a}=e;if(n.config.OT_PD_DISABLE_MODULE_RESTRICTIONS)return!1;const s=t?n.pipetteEntities[t]:null,o=r?G(a.labware[r]?.stack):null;if(!t||!r||!s||!o)return!1;const i=Object.keys(n.moduleEntities).some(l=>{const u=n.moduleEntities[l].model;if(yh.includes(u)){const p=a.modules[l]?.slot;return p==="1"&&o==="4"||p==="3"&&o==="6"}else return!1});return c.GEN_ONE_MULTI_PIPETTES.includes(s.name)&&i},ne=(e,t,r)=>{const n=e.reduce((a,s)=>{if(a.errors.length>0)return a;const o=s(t,a.robotState);if("errors"in o)return{robotState:a.robotState,commands:a.commands,errors:o.errors,warnings:a.warnings};const i=[...a.commands,...o.commands],l=[...a.python?[a.python]:[],...o.python?[o.python]:[]].join(`
|
|
47
|
+
`),u=Hc(o.commands,t,a.robotState);return{...a,robotState:u.robotState,commands:i,warnings:[...a.warnings||[],...o.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}}},Na=(e,t,r)=>{const n=ka(e,t[r]?.stack),a=n&&e[n].moduleState;return!!(a&&a.type===c.THERMOCYCLER_MODULE_TYPE&&a.lidOpen!==!0)},hw=e=>e.commandCreatorFnName!=="delay"&&e.commandCreatorFnName!=="engageMagnet"&&e.commandCreatorFnName!=="disengageMagnet"&&e.commandCreatorFnName!=="setTemperature"&&e.commandCreatorFnName!=="deactivateTemperature"&&"pipette"in e?e.pipette:null,_w=e=>e.commandCreatorFnName==="delay"||e.commandCreatorFnName==="engageMagnet"||e.commandCreatorFnName==="disengageMagnet"||e.commandCreatorFnName==="setTemperature"||e.commandCreatorFnName==="deactivateTemperature",yw=new Date("2025-03-19T00:00:00Z"),bw=2,Tw=22;function gw(e,t,r){const{labware:n,modules:a,pipettes:s,commands:o,liquids:i}=e,l=t.protocolType==="python"?t.apiVersion:null,u=l!=null&&l[0]>=bw&&l[1]>=Tw,p=t.protocolType==="json"&&r>=yw,d=c.getLabwareDefinitionsByURIForProtocol(o),f=i.reduce((y,A)=>{const{id:S,description:g,displayName:I,displayColor:L}=A;return{...y,[S]:{description:g,displayName:I??"Unknown Liquid",pythonName:"n/a",displayColor:L??"#B7B8B9",liquidGroupId:S}}},{}),_=a.reduce((y,A)=>{const{id:S,model:g}=A;return{...y,[S]:{id:S,type:c.getModuleType(g),model:g,pythonName:"n/a"}}},{}),m=n.reduce((y,A)=>{const{id:S,definitionUri:g}=A,I=d[g];return I==null||I.schemaVersion===3?y:{...y,[S]:{id:S,labwareDefURI:g,def:I,pythonName:"n/a"}}},{}),h=o.reduce((y,A)=>{if(A.commandType==="loadLidStack"&&A.result!=null){const{stackLabwareId:S,lidStackDefinition:g}=A.result;if(S!=null&&g!=null&&y[S]==null&&g.schemaVersion!==3)return{...y,[S]:{id:S,labwareDefURI:c.getLabwareDefURI(g),def:g,pythonName:"n/a"}}}return y},m),b=s.reduce((y,A)=>{const{id:S,pipetteName:g}=A,I=c.getPipetteSpecsV2(g),w=o.filter(k=>k.commandType==="pickUpTip"&&k.params.pipetteId===S).map(k=>h[k.params.labwareId]),E=Array.from(new Set(w.map(k=>k.labwareDefURI))),R=Array.from(new Set(w.map(k=>k.def)));return I==null||(y[S]={name:g,id:S,tiprackLabwareDef:R,tiprackDefURI:E,spec:I,pythonName:"n/a"}),y},{}),T=o.reduce((y,A)=>{if(A.commandType==="loadLidStack"&&A.result!=null){const{params:S}=A,g=Bu(S);return{...y,stagingAreaEntities:{...y.stagingAreaEntities,...g}}}else if((A.commandType==="loadLabware"||A.commandType==="loadLid")&&A.result!=null){const{params:S}=A,g=Bu(S);return{...y,stagingAreaEntities:{...y.stagingAreaEntities,...g}}}else if(A.commandType==="moveToAddressableArea"||A.commandType==="moveToAddressableAreaForDropTip"){const S=A.params.addressableAreaName,g=`${F()}:${S}`;let I=Oh;S==="fixedTrash"?I="cutout12":S.includes("WasteChute")?I="cutoutD3":S.includes("movableTrash")&&(I=`cutout${S.split("movableTrash")[1]}`);let L=y.trashBinEntities;Object.values(y.trashBinEntities).some(E=>E.location===I)||(S.includes("movableTrash")?L={...y.trashBinEntities,[g]:{pythonName:"trash_bin_1",id:g,location:I}}:S==="fixedTrash"&&(L={...y.trashBinEntities,[g]:{pythonName:"trash_bin_1",id:g,location:I}}));let w=y.wasteChuteEntities;return S.includes("WasteChute")&&(w={[g]:{pythonName:"waste_chute",id:g,location:I}}),{...y,trashBinEntities:L,wasteChuteEntities:w}}return y},{wasteChuteEntities:{},trashBinEntities:{},stagingAreaEntities:{},gripperEntities:{},config:{OT_PD_DISABLE_MODULE_RESTRICTIONS:!0}});return{labwareEntities:h,pipetteEntities:b,moduleEntities:_,liquidEntities:u||p?f:{},...T}}const Iw={A3:"A4",B3:"B4",C3:"C4",D3:"D4"};function Ew(e,t){const r=e.reduce((o,i)=>i.commandType==="loadPipette"&&i.result!=null?{...o,[i.result.pipetteId]:{mount:i.params.mount}}:o,{}),n=e.reduce((o,i)=>{if(i.commandType==="loadModule"&&i.result!=null){const l=c.getModuleDef(i.params.model).moduleType;return{...o,[i.result.moduleId]:{slot:l===c.FLEX_STACKER_MODULE_TYPE?Iw[i.params.location.slotName]:i.params.location.slotName,moduleState:Lh[l]}}}return o},{}),a=e.reduce((o,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=>{if(c.locationIsOffDeck(m))return[m];if("slotName"in m)return[m.slotName];if("moduleId"in m){const h=n[m.moduleId]?.slot??"offDeck";return[m.moduleId,h]}else if("addressableAreaName"in m)return[m.addressableAreaName];return["offDeck"]};if(u!=null){const m=u.reduce((T,y)=>{const A=y.find(S=>S.kind==="onLabware");return A!=null&&(T[A.labwareId]=y),T},{}),h=p.reduce((T,y,A)=>{const S=m[y]??u[A];if(S!=null){const g=Uu(S);T[y]={stack:g[0]===y?g:[y,...g]}}else{const g=i.params.location;c.locationIsOffDeck(g)?T[y]={stack:[y,g]}:"slotName"in g?T[y]={stack:[y,g.slotName]}:T[y]={stack:[y,"offDeck"]}}return T},{}),b=d!=null&&f!=null?[d,...Uu(f)]:null;return{...o,...h,...d!=null&&b!=null?{[d]:{stack:b}}:{}}}else{const m=i.params.location,h=p.reduce((T,y)=>{if(c.locationIsOffDeck(m))T[y]={stack:[y,m]};else if("slotName"in m)T[y]={stack:[y,m.slotName]};else if("moduleId"in m){const A=m.moduleId;T[y]={stack:[y,A,n[A].slot]}}else T[y]={stack:[y,"offDeck"]};return T},{}),b=d!=null?[d,..._(m)]:null;return{...o,...h,...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. `),o;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;o[u]==null&&(console.warn(`Parent labware ${u} not found when processing loadLabware/loadLid command. `),o[u]={stack:[u,"offDeck"]});const p=o[u].stack;l.push(u,...p)}else l.push(i.params.location.addressableAreaName);return{...o,[i.result.labwareId]:{stack:l}}}else{if(i.commandType==="flexStacker/setStoredLabware")return Vm(i).forEach(u=>{Bm(o,u,"setStoredLabwareCount")}),o;if(i.commandType==="flexStacker/fill")return Vm(i).forEach(u=>{Bm(o,u,"fillCount")}),o}return o},{}),s=wc({invariantContext:t,labwareLocations:a,moduleLocations:n,pipetteLocations:r});return{frame:{...Hc(e,t,s),command:e[e.length-1]},invariantContext:t}}const Bm=(e,t,r)=>{const n=e[t]??{stack:[t,"offDeck"]};e[t]={...n,[r]:(n[r]??0)+1}},Vm=e=>e.result?.storedLabware?.flatMap(r=>[r.primaryLabwareId,r.adapterLabwareId,r.lidLabwareId].filter(n=>n!=null))??[],zc=(e,t)=>e??(t.channels===1?c.SINGLE:t.channels===96?c.ALL:c.COLUMN);var bu,$m;function ww(){if($m)return bu;$m=1;var e=hc();function t(r,n){var a;return e(r,function(s,o,i){return a=n(s,o,i),!a}),!!a}return bu=t,bu}var Tu,xm;function Sw(){if(xm)return Tu;xm=1;var e=Mh(),t=Sn(),r=ww(),n=Xe(),a=yc();function s(o,i,l){var u=n(o)?e:r;return l&&a(o,i,l)&&(i=void 0),u(o,t(i,3))}return Tu=s,Tu}var Aw=Sw();const Da=xe(Aw),Nn=(e,t)=>Da(e,r=>r.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&r.moduleState.latchOpen!==!1&&c.getAreSlotsHorizontallyAdjacent(r.slot,t)),Dn=(e,t,r)=>r.channels!==1&&Da(e,n=>n.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&c.getAreSlotsHorizontallyAdjacent(n.slot,t)),Ma=(e,t,r,n)=>r.channels!==1&&!n.def.parameters.isTiprack&&Da(e,a=>a.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&c.getAreSlotsVerticallyAdjacent(a.slot,t)),ty=(e,t,r)=>Da(e,(a,s)=>c.getAreSlotsHorizontallyAdjacent(r,G(a.stack))&&c.getIsLabwareAboveHeight(t[s].def,c.MAX_LABWARE_HEIGHT_EAST_WEST_HEATER_SHAKER_MM)),Fa=(e,t,r)=>{const n=ka(e,t[r]?.stack),a=n!=null?e[n].moduleState:null;return!!(a&&a.type===c.HEATERSHAKER_MODULE_TYPE&&a.latchOpen!==!1)},Mn=(e,t,r)=>Da(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=ka(e,t[r]?.stack),a=n!=null?e[n].moduleState:null;return!!(a&&a.type===c.HEATERSHAKER_MODULE_TYPE&&a.targetSpeed!==null)},Ls=e=>{const{args:t,pipetteName:r,tiprackUri:n,liquidClassValuesForTip:a}=e;let s=null;"mixBeforeAspirate"in t?s=t.mixBeforeAspirate:"mixFirstAspirate"in t&&(s=t.mixFirstAspirate);const o=Lw(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:ry(t.blowoutLocation),flow_rate:t.blowoutLocation!=null?t.blowoutFlowRateUlSec:void 0,...o!=null?{blowout_position:o}:{}}}},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:!!s?.volume,...s?.times?{repetitions:s.times}:{},...s?.volume?{volume:s.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 Fr(u)},Ua=(e,t)=>`${c.getAllLiquidClassDefs()[e].liquidClassName}${t?"_base_class":""}`,ry=e=>{if(e!=null)return e===Hr?"source":e===On?"destination":"trash"},Lw=e=>{const t=ry(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}},Os=e=>{const{labwareEntities:t,tiprackIds:r}=e;return`tip_racks=[${r.map(a=>t[a].pythonName).join(", ")}]`};var gu,Hm;function Ow(){if(Hm)return gu;Hm=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 gu=t,gu}var Iu,zm;function Rw(){if(zm)return Iu;zm=1;var e=Fc(),t=En(),r=fs(),n=er(),a=wn();function s(o,i,l,u){if(!n(o))return o;i=t(i,o);for(var p=-1,d=i.length,f=d-1,_=o;_!=null&&++p<d;){var m=a(i[p]),h=l;if(m==="__proto__"||m==="constructor"||m==="prototype")return o;if(p!=f){var b=_[m];h=u?u(b,m,_):void 0,h===void 0&&(h=n(b)?b:r(i[p+1])?[]:{})}e(_,m,h),_=_[m]}return o}return Iu=s,Iu}var Eu,jm;function kw(){if(jm)return Eu;jm=1;var e=hs(),t=Rw(),r=En();function n(a,s,o){for(var i=-1,l=s.length,u={};++i<l;){var p=s[i],d=e(a,p);o(d,p)&&t(u,r(p,a),d)}return u}return Eu=n,Eu}var wu,Gm;function vw(){if(Gm)return wu;Gm=1;var e=Sa(),t=Sn(),r=kw(),n=Bc();function a(s,o){if(s==null)return{};var i=e(n(s),function(l){return[l]});return o=t(o),r(s,i,function(l,u){return o(l,u[0])})}return wu=a,wu}var Su,Wm;function Pw(){if(Wm)return Su;Wm=1;var e=Sn(),t=Ow(),r=vw();function n(a,s){return r(a,t(e(s)))}return Su=n,Su}var Cw=Pw();const Nw=xe(Cw);function ny(e){return Object.keys(e.wells)}const Dw=(e,t)=>{const r=Object.keys(e||{}).filter(n=>e[n]&&e[n].volume>0);return{wellName:t,groupIds:r,ingreds:Nw(e,n=>!n||n.volume<=0)}},Mw=(e,t)=>{const r=ny(t);return lt(r,(n,a)=>{const s=e&&e[a];return{...n,[a]:s?Dw(e[a],a):{}}},{})},Fw=(e,t)=>{const r={};return t.forEach(n=>{const a=e!=null?Object.values(e).reduce((s,o)=>{if(o.groupIds.indexOf(n)!==-1){const l=o.ingreds[n];l?.volume!=null&&(s[o.wellName??"A1"]=l.volume)}return s},{}):{};r[n]=a}),r},qw=e=>{const t=e.flatMap(r=>r==null?[]:Object.values(r).flatMap(n=>n.groupIds.filter(a=>a!==Ge)));return Array.from(new Set(t))},Uw=e=>{const t=e!=null?Object.values(e).flatMap(r=>r.groupIds)?.filter(r=>r!==Ge):[];return Array.from(new Set(t))},ay="#737578",sy=e=>{const t=Number(e);return Number.isInteger(t)?c.DEFAULT_LIQUID_COLORS[t%c.DEFAULT_LIQUID_COLORS.length]:(e!==Ge&&console.warn(`swatchColors expected an integer or ${Ge}, got ${e}`),"transparent")},Bw=(e,t)=>{const r=e.filter(n=>n!==Ge);return r.length===0?null:r.length===1?t[r[0]]??sy(r[0]):ay},Vw=(e,t)=>lt(e,(r,n,a)=>{const s=Bw(n.groupIds,t);return s?{...r,[a]:s}:r},{});var Au,Ym;function $w(){if(Ym)return Au;Ym=1;function e(t,r){return t>r}return Au=e,Au}var Lu,Km;function xw(){if(Km)return Lu;Km=1;var e=_h(),t=$w(),r=ga();function n(a){return a&&a.length?e(a,r,t):void 0}return Lu=n,Lu}var Hw=xw();const zw=xe(Hw),oy="2.28",jw="8.11.0";function Gw(){return["import json","from opentrons import protocol_api, types"].join(`
|
|
48
|
+
`)}function Ww(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 = ${Fr(r)}`}function Yw(e){const r={robotType:{[c.OT2_ROBOT_TYPE]:"OT-2",[c.FLEX_ROBOT_TYPE]:"Flex"}[e],apiLevel:oy};return`requirements = ${Fr(r)}`}function iy(e,t){const r=Object.keys(e).length>0,n=r?Object.values(e).map(a=>`${a.pythonName} = ${Ie}.load_module(${C(a.model)}, ${C(t[a.id].slot)})`).join(`
|
|
49
49
|
`):"";return r?`# Load Modules:
|
|
50
|
-
${n}`:""}function
|
|
50
|
+
${n}`:""}function ly(e,t,r){const n=Object.values(t).filter(s=>s.def.allowedRoles?.includes("adapter")),a=Object.values(n).map(s=>{const{id:o,def:i,pythonName:l}=s,{parameters:u,namespace:p,version:d}=i,f=r[o].stack[1],_=e[f]!=null;let m,h;if(_?m=e[f].pythonName:(m=Ie,h=`location=${f==="offDeck"?ia:C(f)}`),c.getLabwareDefIsStandard(i)){const T=[`${C(u.loadName)}`,...h?[h]:[],`namespace=${C(p)}`,`version=${d}`].join(`,
|
|
51
51
|
`);return`${l} = ${m}.load_adapter(
|
|
52
52
|
${Z(T)},
|
|
53
|
-
)`}else{const T=[`${
|
|
53
|
+
)`}else{const T=[`${bs}[${C(c.getLabwareDefURI(i))}]`,...h?[h]:[]].join(`,
|
|
54
54
|
`);return`${l} = ${m}.load_adapter_from_definition(
|
|
55
55
|
${Z(T)},
|
|
56
56
|
)`}}).join(`
|
|
57
57
|
`);return a?`# Load Adapters:
|
|
58
|
-
${a}`:""}const
|
|
59
|
-
`),_=Z(f);return`lid_stack_${s} = ${
|
|
58
|
+
${a}`:""}const Kw=(e,t,r)=>e.reduce((n,{id:a,labwareDefURI:s,def:o})=>{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===s)||p!=null,f=o.parameters.loadName;if(!d)return n;const _=p!=null?t[p]?.pythonName:G(i),m=i.length-(p!=null?2:1);if(!(_ in n))return{...n,[_]:{loadName:f,quantity:m}};const{quantity:h}=n[_],b=zw([h,m])??h;return{...n,[_]:{loadName:f,quantity:b}}},{}),uy=(e,t)=>{const r=Object.values(e).filter(s=>s.def.allowedRoles?.includes("lid")),n=Kw(r,e,t),a=Object.entries(n).map(([s,{loadName:o,quantity:i}])=>{const l=Object.values(e).some(({pythonName:m})=>m===s),u=`load_name=${C(o)}`,p=`location=${l?s:C(s)}`,d=`quantity=${i}`,f=[u,p,d].join(`,
|
|
59
|
+
`),_=Z(f);return`lid_stack_${s} = ${Ie}.load_lid_stack(
|
|
60
60
|
${_},
|
|
61
61
|
)`}).join(`
|
|
62
62
|
`);return a?`# Load Lid Stacks:
|
|
63
|
-
${a}`:""},
|
|
63
|
+
${a}`:""},Xw=e=>{const{parameters:t,namespace:r,version:n}=e;return[`lid=${C(t.loadName)}`,`lid_namespace=${C(r)}`,`lid_version=${n}`]};function cy(e,t,r,n,a){const s=Object.values(r).filter(l=>!l.def.allowedRoles?.includes("adapter")&&!l.def.allowedRoles?.includes("lid")),o=Object.values(r).filter(l=>l.def.allowedRoles?.includes("lid")),i=Object.values(s).reduce((l,u)=>{const{id:p,def:d,pythonName:f}=u,{metadata:_,parameters:m,namespace:h,version:b}=d,T=Object.values(o).find(q=>n[q.id].stack[1]===p),y=a[p]!=null&&a[p]!==_.displayName,A=n[p].stack.includes(je),S=n[p].stack[1],g=G(n[p].stack),I=Object.entries(e).find(([q,ee])=>ee.slot===g&&ee.moduleState.type===c.FLEX_STACKER_MODULE_TYPE),L=t[S]!=null||g===I?.[1].slot&&!A,w=r[S]!=null;let E,R;if(w&&!A)E=r[S].pythonName;else if(L){const q=I!=null?I?.[0]:S;E=t[q].pythonName}else E=Ie,R=`location=${S==="offDeck"||A?ia:C(S)}`;const k=y?`label=${C(a[p])}`:void 0;if(c.getLabwareDefIsStandard(d)){const q=[`${C(m.loadName)}`,...R?[R]:[],...k?[k]:[],`namespace=${C(h)}`,`version=${b}`,...T!=null?Xw(T.def):[]].join(`,
|
|
64
64
|
`);return[...l,`${f} = ${E}.load_labware(
|
|
65
|
-
${Z(
|
|
66
|
-
)`]}else{const
|
|
65
|
+
${Z(q)},
|
|
66
|
+
)`]}else{const q=[`${bs}[${C(c.getLabwareDefURI(d))}]`,...R?[R]:[],...k?[k]:[]].join(`,
|
|
67
67
|
`);return[...l,`${f} = ${E}.load_labware_from_definition(
|
|
68
|
-
${Z(
|
|
68
|
+
${Z(q)},
|
|
69
69
|
)`]}},[]).join(`
|
|
70
70
|
`);return i?`# Load Labware:
|
|
71
|
-
${i}`:""}function
|
|
71
|
+
${i}`:""}function py(e,t){const r=Object.values(e).map(n=>{const{name:a,id:s,spec:o,pythonName:i}=n,l=o.channels===96?"":C(t[s].mount),u=c.isFlexPipette(a)?c.getFlexNameConversion(o):a;return`${i} = ${Ie}.load_instrument(${[C(u),...l?[l]:[]].join(", ")})`}).join(`
|
|
72
72
|
`);return r?`# Load Pipettes:
|
|
73
|
-
${r}`:""}function
|
|
74
|
-
`);return`${n} = ${
|
|
73
|
+
${r}`:""}function dy(e){const t=Object.values(e).map(r=>{const{pythonName:n,displayColor:a,displayName:s,description:o}=r,i=[`${C(s)}`,...o?[`description=${C(o)}`]:[],`display_color=${C(a)}`].join(`,
|
|
74
|
+
`);return`${n} = ${Ie}.define_liquid(
|
|
75
75
|
${Z(i)},
|
|
76
76
|
)`}).join(`
|
|
77
77
|
`);return t?`# Define Liquids:
|
|
78
|
-
${t}`:""}function
|
|
78
|
+
${t}`:""}function fy(e,t,r){const n=Object.entries(e).reduce((s,[o,i])=>{const l=r[o].pythonName;return Object.entries(i).forEach(([u,p])=>{Object.entries(p).forEach(([d,f])=>{const _=t[d].pythonName,m=`${l}__${_}__${f.volume}`;s[m]||(s[m]={labwarePythonName:l,liquidPythonName:_,volume:f.volume,wells:[]}),s[m].wells.push(u)})}),s},{}),a=Object.values(n).map(({labwarePythonName:s,liquidPythonName:o,volume:i,wells:l})=>{const u=l.map(m=>C(m)),d=Ts(u,8).map(m=>Ra+m.join(", ")).join(`,
|
|
79
79
|
`),_=[`wells=[${u.length<8?u.join(", "):`
|
|
80
80
|
${d}
|
|
81
81
|
`}],
|
|
@@ -84,59 +84,59 @@ volume=${i},
|
|
|
84
84
|
`].join();return`${s}.load_liquid(
|
|
85
85
|
${Z(_)})`}).join(`
|
|
86
86
|
`);return a?`# Load Liquids:
|
|
87
|
-
${a}`:""}function
|
|
87
|
+
${a}`:""}function my(e){const t=c.getAllLiquidClassDefs(),r=e.map(n=>n==null?"":`${Ua(n,!0)} = ${Ie}.get_liquid_class(${C(t[n].liquidClassName)})`).join(`
|
|
88
88
|
`);return e.length>0?`# Load Liquid Classes:
|
|
89
|
-
${r}`:""}function
|
|
89
|
+
${r}`:""}function hy(e){const t=Object.values(e)?.map(r=>{const n=C(c.getCutoutDisplayName(r.location));return`${r.pythonName} = ${Ie}.load_trash_bin(${n})`}).join(`
|
|
90
90
|
`);return t?`# Load Trash Bins:
|
|
91
|
-
${t}`:""}function
|
|
92
|
-
${t}`:""}const
|
|
91
|
+
${t}`:""}function _y(e){const t=Object.values(e)?.map(r=>`${r.pythonName} = ${Ie}.load_waste_chute()`);return t.length>0?`# Load Waste Chute:
|
|
92
|
+
${t}`:""}const Zw=e=>e?`
|
|
93
93
|
`+e.split(/\r\n|\r|\n/).map(t=>`# ${t}`).join(`
|
|
94
|
-
`):"";function
|
|
94
|
+
`):"";function yy(e){return`# PROTOCOL STEPS
|
|
95
95
|
|
|
96
|
-
`+e.timeline.map(t=>{const{stepInfo:r}=t,n=r?.description;return`# Step ${r?.stepNumber}: ${r?.name}${
|
|
96
|
+
`+e.timeline.map(t=>{const{stepInfo:r}=t,n=r?.description;return`# Step ${r?.stepNumber}: ${r?.name}${Zw(n)}
|
|
97
97
|
${t.python||"pass"}`}).join(`
|
|
98
98
|
|
|
99
|
-
`)}function
|
|
99
|
+
`)}function Qw(e,t,r,n,a,s,o){const{moduleEntities:i,labwareEntities:l,pipetteEntities:u,liquidEntities:p,wasteChuteEntities:d,trashBinEntities:f}=e,{modules:_,labware:m,pipettes:h}=t,T=[iy(i,_),ly(i,l,m),uy(l,m),cy(_,i,l,m,a),py(u,h),...s===c.FLEX_ROBOT_TYPE?[hy(f),_y(d)]:[],dy(p),fy(n,p,l),my(o),by(i,l,m,_,r),yy(r)].filter(y=>y).join(`
|
|
100
100
|
|
|
101
|
-
`)||"pass";return`def run(${
|
|
102
|
-
${Z(T)}`}function
|
|
101
|
+
`)||"pass";return`def run(${Ie}: protocol_api.ProtocolContext) -> None:
|
|
102
|
+
${Z(T)}`}function Jw(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`${bs} = json.loads("""${JSON.stringify(r)}""")`}else return""}const Rs=e=>{switch(e){case"perDest":return"per destination";case"perSource":return"per source";default:return e}},by=(e,t,r,n,a)=>{const o=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(h=>h.robotState.labware),_=Object.entries(r).filter(([h,b])=>b.stack.includes(l)&&b.stack.includes(je)),m=[...Object.entries(r),...f.flatMap(h=>Object.entries(h))].filter(([h,b])=>G(b.stack)===d&&!b.stack.includes(je));if(_.length===0){if(m.length===0)return"";const h=m.find(([y])=>t[y].def.allowedRoles?.includes("lid")),b=m.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",...h!=null?[`lid=${C(t[h[0]].def.parameters.loadName)}`]:[]].join(`,
|
|
103
103
|
`);return`${p}.set_stored_labware(
|
|
104
104
|
${Z(T)}
|
|
105
|
-
)`}else{const h=Object.values(_).filter(
|
|
106
|
-
`),
|
|
105
|
+
)`}else{const h=Object.values(_).filter(S=>!t[S[0]]?.def.allowedRoles?.includes("lid")).map(S=>t[S[0]].pythonName),T=Ts(h,4).map(S=>Ra+S.join(", ")).join(`,
|
|
106
|
+
`),A=`labware=[${h.length<4?h.join(", "):`
|
|
107
107
|
${T}
|
|
108
108
|
`}],
|
|
109
109
|
`;return`${p}.set_stored_labware_items(
|
|
110
|
-
${Z(
|
|
110
|
+
${Z(A)})`}}}).filter(Boolean);return o.length>0?`# Set Stored Labware:
|
|
111
111
|
${o.join(`
|
|
112
|
-
`).trimStart()}`:""},Zw=(e,t,r,n)=>{const{spec:a}=t,s=e===c.ROW,o=e===c.COLUMN||e===c.ALL&&a.channels===8,i=n.ordering[0].length===1;if((o||s)&&i){const u=o?`H${r.slice(1)}`:`${r.charAt(0)}12`,p=a.nozzleMap[u],d=a.nozzleMap[r],f=p.map((h,b)=>h-d[b]),_=[f[0]/2,f[1]/2,0],m=d.map((h,b)=>h+_[b]);return{x:m[0],y:m[1],z:m[2]}}const l=a.nozzleMap[r];return{x:l[0],y:l[1],z:l[2]}},pn={back_left:{x:-43.25,y:454.9,z:211.91},front_right:{x:128.75,y:402,z:211.91}},zm={x:pn.back_left.x,y:pn.back_left.y,z:pn.back_left.z},Qw={x:pn.front_right.x,y:pn.front_right.y,z:pn.front_right.z},py=e=>{if(e.addressableArea?.areaType==="slot"){const t=`cutout${e.addressableArea?.id}`;if(t)return t}return null},Jw=(e,t,r,n,a,s,o)=>{const{pipetteBoundingBoxOffsets:i}=e.spec,l=Zw(s,e,a,n),u=i.backLeftCorner[0],p=i.frontRightCorner[0],d=i.backLeftCorner[1],f=i.frontRightCorner[1],_=r.x-(l.x-u),m=r.x+(p-l.x),h=r.y+(d-l.y),b=r.y-(l.y-f),T=(r.z??0)+t-o;return[{x:_,y:h,z:T},{x:m,y:b,z:T},{x:m,y:h,z:T},{x:_,y:b,z:T}]},dy=(e,t)=>{const r=e[1].x<t[0].x,n=e[0].x>t[1].x,a=e[0].y<t[1].y,s=e[1].y>t[0].y;return!(r||n||a||s)},Gm=(e,t)=>{if(t===c.FLEX_ROBOT_TYPE){const r=c.getDeckDefFromRobotType(t),{addressableAreas:n}=r.locations;return n.find(s=>s.id.includes(e))?.offsetFromCutoutFixture[2]??0}return c.getModuleDef(e).dimensions.bareOverallHeight},eA=e=>{const t=c.getDeckDefFromRobotType(e);return Object.values(t.cutoutFixtures).find(n=>c.WASTE_CHUTE_FIXTURES.includes(n.id))?.height??0},tA=(e,t,r,n)=>{const{modules:a,labware:s}=e,{moduleEntities:o,labwareEntities:i,wasteChuteEntities:l}=t;let u=0;const p=r?.addressableArea?.id;if(p){const d=Ec(s,p),f=Object.keys(a).find(m=>a[m].slot===p);Object.values(l).find(m=>m.location===py(r))&&(u+=eA(n)),d.length>0?d.forEach(m=>{a[m]!=null&&(u+=Gm(o[m].model,n)),s[m]!=null&&(u+=i[m].def.dimensions.zDimension)}):f!=null&&(u+=Gm(o[f].model,n))}return u},rA=(e,t,r,n,a)=>{for(const s of t){const o=s.addressableArea?.boundingBox,i=s.position;if(i==null||o==null)continue;const l={x:i[0],y:o.yDimension+i[1],z:i[2]},u={x:i[0]+o.xDimension,y:i[1],z:i[2]};if(dy([e[0],e[1]],[l,u])&&e[0].z!=null&&tA(r,n,s,a)>=e[0]?.z)return!0}return!1},nA=(e,t)=>Object.values(t).find(r=>r.type===c.THERMOCYCLER_MODULE_TYPE)?dy([zm,Qw],[e[0],e[1]])&&e[0].x<=zm.z:!1,aA=(e,t,r,n,a)=>{const{wells:s}=e.def,o=s[t];return{x:o.x+r.x+(n?.[0]??0),y:o.y+r.y+(n?.[1]??0),z:a?o.z+(r.z??0)+(n?.[2]??0):e.def.dimensions.zDimension}},wt=e=>{const{robotState:t,invariantContext:r,pipetteId:n,labwareId:a,wellLocationOffset:s={x:0,y:0,z:0},wellTargetName:o,primaryNozzle:i,nozzleConfiguration:l,tiprackId:u}=e,{pipetteEntities:p,labwareEntities:d,stagingAreaEntities:f,moduleEntities:_}=r,{labware:m,tipState:h}=t,b=p[n],{spec:T}=b,{channels:y}=T,g=T?.displayCategory==="FLEX"?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE,I=c.getDeckDefFromRobotType(g);if(d[a]==null||o==null||y===1)return!0;const L=u?!0:h.pipettes[n]?.hasTip??!1,A=u??h.pipettes[n]?.tiprackURI,E=A!=null?d[A]:null,k=E!=null?E.def.parameters.tipLength:0,R=Object.values(f).map(re=>re.location),B=L?k??0:0,F=z(m[a].stack),te=m[a].stack.some(re=>_[re]?.type===c.THERMOCYCLER_MODULE_TYPE),de=c.getDeckDefFromRobotType(c.FLEX_ROBOT_TYPE),_e=(te?c.getPositionFromSlotId(c.B1_ADDRESSABLE_AREA,de):c.getPositionFromSlotId(F,I))??[0,0,0],oe=te?de.locations.addressableAreas.find(re=>re.id===c.THERMOCYCLER_MODULE_V2)?.offsetFromCutoutFixture??[0,0,0]:[0,0,0],Se=[oe[0]+_e[0],oe[1]+_e[1],oe[2]+_e[2]],ve=aA(d[a],o,s,Se,L),ze=E!=null?sA({pipetteSpecs:T,tiprackUri:E.labwareDefURI,nozzles:l}):0,Ue=d[a].def,J=Jw(b,B,ve,Ue,i,l,ze);if(!iA({channels:y,boundingBox:J,robotType:g}))return!1;const Be=(g===c.OT2_ROBOT_TYPE?c.getOt2SurroundingSlots(F):c.getFlexSurroundingSlots(F,R)).map(re=>{const W=c.getAddressableAreaFromSlotId(re,I),Y=c.getPositionFromSlotId(re,I);return{addressableArea:W,position:Y}});return!nA(J,_)&&!rA(J,Be,t,r,g)},fy=e=>{const{tipState:t,primaryNozzle:r,channels:n,nozzleConfiguration:a,wellName:s,tiprackDef:o,tipsToIgnore:i=[]}=e,{ordering:l}=o;if(n===1)return{isSafe:!0,isComplete:t[s]!==se};if(n===8){const u=r!==c.A1_NOZZLE,p=zu(s),d=l[p],f=u?[...d].reverse():d;if(a===c.SINGLE){const _=f.indexOf(s);return{isSafe:f.slice(_+1).every(m=>t[m]===se||i.includes(m)),isComplete:t[s]!==se}}if(a===c.PARTIAL_COLUMN){const _=f.indexOf(s),m=c.PARTIAL_NOZZLE_MAP[r];return{isSafe:f.slice(_+m,f.length).every(h=>t[h]===se||i.includes(h)),isComplete:t[s]!==se}}return{isSafe:!0,isComplete:f.every(_=>t[_]!==se)}}if(a===c.ALL)return{isSafe:!0,isComplete:Object.keys(o.wells).every(u=>t[u]!==se)};if(a===c.COLUMN){const u=r===c.A12_NOZZLE,p=zu(s),d=l[p],f=u?[...l].reverse():l,_=f.indexOf(d);return{isSafe:f.slice(_+1).flat().every(m=>t[m]===se||i.includes(m)),isComplete:f[_].every(m=>t[m]!==se)}}if(a===c.ROW){const u=l[0].map((_,m)=>l.map(h=>h[m])),d=r===c.H1_NOZZLE?[...u].reverse():u,f=d.findIndex(_=>_.some(m=>m===s));return{isSafe:d.slice(f+1).flat().every(_=>t[_]===se||i.includes(_)),isComplete:d[f].every(_=>t[_]!==se)}}if(a===c.SINGLE){const u=aa(r??es({nozzles:a,channels:n})),p=my(r??es({nozzles:a,channels:n})),d=u==="H",_=p==="12"?[...l].reverse():l,m=_.findIndex(h=>h.some(b=>b===s));return{isSafe:_.slice(m).every(h=>{const b=d?[...h].reverse():h,T=b.findIndex(y=>aa(y)===aa(s));return b.slice(T).every(y=>t[y]===se||i.includes(y)||y===s)}),isComplete:t[s]!==se}}return{isSafe:!1}},aa=e=>e.slice(0,1),my=e=>e.slice(1),zu=e=>parseInt(e.slice(1))-1,es=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;if(r===c.ROW){const s=t[0].length;return Array.from({length:s},(i,l)=>t.map(u=>u[l])).map(i=>i[0])}return t.map(s=>n===96&&r===c.ALL?a:r===c.COLUMN||n===8&&r===c.ALL||n===8&&r===c.PARTIAL_COLUMN?aa(a)==="H"?s[s.length-1]:s[0]:(console.assert(s.length===1,"Well set for SINGLE nozzle configuration should have exactly 1 well"),s[0]))},sA=e=>{const{pipetteSpecs:t,tiprackUri:r,nozzles:n}=e,{channels:a}=t,s=oA(a,n),o=t.pickUpTipConfigurations.pressFit.configurationsByNozzleMap[s]?.default.tipOverlaps;if(o==null)return console.error(`No tip overlaps found for ${n} and ${s} overlap.`),0;const i=Math.max(...Object.keys(o).map(l=>Number(l.slice(1))));return o[`v${i}`]?.[r]??o[`v${i}`]?.default??0},oA=(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"},iA=e=>{const{channels:t,boundingBox:r,robotType:n}=e,a=c.getRobotDefFromRobotType(n),{paddingOffsets:s}=a,{front:o,rear:i,leftSide:l,rightSide:u}=s,[p,d]=a.extents,[f,_]=r,{x:m,y:h}=f,{x:b,y:T}=_;if(t===96){if(b<l)return!1;const y=p+u;if(m>y)return!1}if(t!==1){if(h<o)return!1;const y=d+i;if(T>y)return!1}return!0};function hy(e){const t=e.length===1?e[0]:null;return t!=null&&"steps"in t?{numRepetitions:t.repetitions,repeatingProfileSteps:t.steps}:{numRepetitions:1,repeatingProfileSteps:Vc(e)}}function Vc(e){return e.flatMap(t=>"steps"in t?i_(t.steps,t.repetitions):t)}const D=Mb;function _y(e){return Object.keys(e).sort((r,n)=>{const a=z(e[r].stack),s=z(e[n].stack),o=parseInt(a),i=parseInt(s);return De.includes(a)&&De.includes(s)?r.localeCompare(n):De.includes(a)?1:De.includes(s)?-1:o-i})}function yy(e){const{pipetteId:t,tiprackId:r,invariantContext:n,robotState:a,nozzles:s,primaryNozzle:o}=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]===ga,d=c.orderWells(l.ordering,"t2b","l2r"),f=c.orderWells(l.ordering,"b2t","l2r"),_=E=>E.find(p)??null,m=E=>[...E].reverse().find(p)??null,h=E=>E.find(k=>k.every(p))??null,b=E=>[...E].reverse().find(k=>k.every(p))??null,T=i===8&&s===c.SINGLE,y=T&&o===c.H1_NOZZLE,S=T&&o===c.A1_NOZZLE,w=i===96&&s===c.SINGLE,g=w&&o===c.H12_NOZZLE,I=w&&o===c.A12_NOZZLE,L=w&&o===c.H1_NOZZLE,A=w&&o===c.A1_NOZZLE;if(i===1||y||g)return _(d);if(S)return _(f);if(s===c.PARTIAL_COLUMN){const E=_(d);if(!E)return null;const k=d.indexOf(E);return d[k]??null}if(s===c.ALL&&i===8)return h(l.ordering)?.[0]??null;if(A)return m(d);if(I)return _(f);if(L)return m(f);if(s===c.COLUMN){const E=l.ordering;return(o===c.A1_NOZZLE?b(E):h(E))?.[0]??null}if(s===c.ROW){const E=l.ordering,k=E[0].map((B,F)=>E.map(te=>te[F]));return(o===c.A1_NOZZLE?b(k):h(k))?.[0]??null}return s===c.ALL&&i===96?d.every(p)?d[0]:null:(console.assert(!1,`Unhandled _getNextTip case for pipette ${t}`),null)}function Ua(e,t,r,n,a,s){const o=r.pipetteEntities[e];if(!o)throw new Error(`cannot getNextTiprack, no pipette entity for pipette "${e}"`);const i=_y(n.labware).filter(m=>{console.assert(r.labwareEntities[m]?.labwareDefURI!=null,`cannot getNextTiprack, no labware entity for "${m}"`);const h=z(n.labware[m].stack)!=="offDeck",b=r.labwareEntities[m].labwareDefURI;return h&&b===t});let l=i;const u=o.spec.channels===96,p=[],d=[];u&&(l=l.filter(m=>{const h=n.labware[m].stack[1],b=r.labwareEntities[h],T=b?.def.parameters.loadName==="opentrons_flex_96_tiprack_adapter"&&c.getLabwareDefIsStandard(b?.def),y=s===c.ALL?T:!T;return y||p.push(m),y})),l=l.filter(m=>{const h=Object.entries(n.labware).find(([b,T])=>T.stack.includes(m)&&c.getIsLid(r.labwareEntities[b].def));return h!=null&&d.push(m),h==null});let f=null,_=null;for(const m of l){const h=yy({pipetteId:e,tiprackId:m,nozzles:s,invariantContext:r,robotState:n,primaryNozzle:a});if(h){f=m,_=h;break}}return f&&_?{nextTiprack:{tiprackId:f,well:_},tipracks:{totalTipracks:i.length,excludedBy96Channel:p.length,excludedByLid:d.length,filteredSortedTiprackIds:l}}:{nextTiprack:null,tipracks:{totalTipracks:i.length,excludedBy96Channel:p.length,excludedByLid:d.length,filteredSortedTiprackIds:l}}}function Os(e,t,r){const n=t.pipetteEntities[e],a=n.spec.liquids.default.maxVolume,s=n.tiprackLabwareDef;let o=null;for(const l of s)if(c.getLabwareDefURI(l)===r){o=l;break}const i=c.getTiprackVolume(o??s[0]);return!a||!i?(console.assert(!1,`getPipetteEffectiveMaxVol expected tiprackMaxVol and pipette maxVolume to be > 0, got',
|
|
113
|
-
${a}, ${i}`),NaN):
|
|
114
|
-
${l}.blow_out(${u})`}),d=[O(
|
|
115
|
-
${l}.blow_out(${u})`}),d=[O(
|
|
112
|
+
`).trimStart()}`:""},eS=(e,t,r,n)=>{const{spec:a}=t,s=e===c.ROW,o=e===c.COLUMN||e===c.ALL&&a.channels===8,i=n.ordering[0].length===1;if((o||s)&&i){const u=o?`H${r.slice(1)}`:`${r.charAt(0)}12`,p=a.nozzleMap[u],d=a.nozzleMap[r],f=p.map((h,b)=>h-d[b]),_=[f[0]/2,f[1]/2,0],m=d.map((h,b)=>h+_[b]);return{x:m[0],y:m[1],z:m[2]}}const l=a.nozzleMap[r];return{x:l[0],y:l[1],z:l[2]}},dn={back_left:{x:-43.25,y:454.9,z:211.91},front_right:{x:128.75,y:402,z:211.91}},Xm={x:dn.back_left.x,y:dn.back_left.y,z:dn.back_left.z},tS={x:dn.front_right.x,y:dn.front_right.y,z:dn.front_right.z},Ty=e=>{if(e.addressableArea?.areaType==="slot"){const t=`cutout${e.addressableArea?.id}`;if(t)return t}return null},rS=(e,t,r,n,a,s,o)=>{const{pipetteBoundingBoxOffsets:i}=e.spec,l=eS(s,e,a,n),u=i.backLeftCorner[0],p=i.frontRightCorner[0],d=i.backLeftCorner[1],f=i.frontRightCorner[1],_=r.x-(l.x-u),m=r.x+(p-l.x),h=r.y+(d-l.y),b=r.y-(l.y-f),T=(r.z??0)+t-o;return[{x:_,y:h,z:T},{x:m,y:b,z:T},{x:m,y:h,z:T},{x:_,y:b,z:T}]},gy=(e,t)=>{const r=e[1].x<t[0].x,n=e[0].x>t[1].x,a=e[0].y<t[1].y,s=e[1].y>t[0].y;return!(r||n||a||s)},Zm=(e,t)=>{if(t===c.FLEX_ROBOT_TYPE){const r=c.getDeckDefFromRobotType(t),{addressableAreas:n}=r.locations;return n.find(s=>s.id.includes(e))?.offsetFromCutoutFixture[2]??0}return c.getModuleDef(e).dimensions.bareOverallHeight},nS=e=>{const t=c.getDeckDefFromRobotType(e);return Object.values(t.cutoutFixtures).find(n=>c.WASTE_CHUTE_FIXTURES.includes(n.id))?.height??0},aS=(e,t,r,n)=>{const{modules:a,labware:s}=e,{moduleEntities:o,labwareEntities:i,wasteChuteEntities:l}=t;let u=0;const p=r?.addressableArea?.id;if(p){const d=Lc(s,p),f=Object.keys(a).find(m=>a[m].slot===p);Object.values(l).find(m=>m.location===Ty(r))&&(u+=nS(n)),d.length>0?d.forEach(m=>{a[m]!=null&&(u+=Zm(o[m].model,n)),s[m]!=null&&(u+=i[m].def.dimensions.zDimension)}):f!=null&&(u+=Zm(o[f].model,n))}return u},sS=(e,t,r,n,a)=>{for(const s of t){const o=s.addressableArea?.boundingBox,i=s.position;if(i==null||o==null)continue;const l={x:i[0],y:o.yDimension+i[1],z:i[2]},u={x:i[0]+o.xDimension,y:i[1],z:i[2]};if(gy([e[0],e[1]],[l,u])&&e[0].z!=null&&aS(r,n,s,a)>=e[0]?.z&&s.addressableArea!=null)return{addressableAreaCausingCollision:s.addressableArea}}return null},oS=(e,t)=>Object.values(t).find(r=>r.type===c.THERMOCYCLER_MODULE_TYPE)?gy([Xm,tS],[e[0],e[1]])&&e[0].x<=Xm.z:!1,iS=(e,t,r,n)=>{const{wells:a}=e.def,s=a[t];return{x:s.x+r.x,y:s.y+r.y,z:n?s.z+(r.z??0):e.def.dimensions.zDimension}},dt=e=>{const{robotState:t,invariantContext:r,pipetteId:n,labwareId:a,wellLocationOffset:s={x:0,y:0,z:0},wellTargetName:o,primaryNozzle:i,nozzleConfiguration:l,tiprackId:u}=e,{pipetteEntities:p,labwareEntities:d,stagingAreaEntities:f,moduleEntities:_}=r,{labware:m,tipState:h}=t,b=p[n];if(b==null)return{isSafe:!0};const{spec:T}=b,{channels:y}=T,g=T?.displayCategory==="FLEX"?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE,I=c.getDeckDefFromRobotType(g);if(d[a]==null||o==null||y===1)return{isSafe:!0};const L=u?!0:h.pipettes[n]?.hasTip??!1,w=u??h.pipettes[n]?.tiprackURI,E=w!=null?d[w]:null,R=E!=null?E.def.parameters.tipLength:0,k=Object.values(f).map(v=>v.location),B=L?R??0:0,q=G(m[a].stack),ee=m[a].stack.some(v=>_[v]?.type===c.THERMOCYCLER_MODULE_TYPE),pe=c.getDeckDefFromRobotType(c.FLEX_ROBOT_TYPE),_e=(ee?c.getPositionFromSlotId(c.B1_ADDRESSABLE_AREA,pe):c.getPositionFromSlotId(q,I))??[0,0,0],le=ee?pe.locations.addressableAreas.find(v=>v.id===c.THERMOCYCLER_MODULE_V2)?.offsetFromCutoutFixture??[0,0,0]:[0,0,0],be={x:le[0]+_e[0],y:le[1]+_e[1],z:le[2]+_e[2]},{def:ve}=d[a],He=pS({wellTargetName:o,primaryNozzle:i,nozzleConfiguration:l,specs:T,labwareDef:ve}),Be={x:s.x+He.x+be.x,y:s.y+He.y+be.y,z:(s.z??0)+(be.z??0)},te=iS(d[a],o,Be,L),Ee=E!=null?lS({pipetteSpecs:T,tiprackUri:E.labwareDefURI,nozzles:l}):0,ze=d[a].def,Pe=rS(b,B,te,ze,i,l,Ee);if(!cS({channels:y,boundingBox:Pe,robotType:g}))return{isSafe:!1,reason:{type:"outsidePipetteExtents"}};const W=(g===c.OT2_ROBOT_TYPE?c.getOt2SurroundingSlots(q):c.getFlexSurroundingSlots(q,k)).map(v=>{const V=c.getAddressableAreaFromSlotId(v,I),N=c.getPositionFromSlotId(v,I);return{addressableArea:V,position:N}});if(oS(Pe,_))return{isSafe:!1,reason:{type:"thermocyclerLidCollision"}};const P=sS(Pe,W,t,r,g);return P!=null?{isSafe:!1,reason:{type:"adjacentAdressableAreaCollision",addressableAreaCausingCollision:P.addressableAreaCausingCollision}}:{isSafe:!0}},jc=e=>{const{tipState:t,primaryNozzle:r,channels:n,nozzleConfiguration:a,wellName:s,tiprackDef:o,tipsToIgnore:i=[]}=e,{ordering:l}=o;if(n===1)return{isSafe:!0,isComplete:t[s]!==ie};if(n===8){const u=r!==c.A1_NOZZLE,p=Wu(s),d=l[p],f=u?[...d].reverse():d;if(a===c.SINGLE){const _=f.indexOf(s);return{isSafe:f.slice(_+1).every(m=>t[m]===ie||i.includes(m)),isComplete:t[s]!==ie}}if(a===c.PARTIAL_COLUMN){const _=f.indexOf(s),m=c.PARTIAL_NOZZLE_MAP[r],h=u?f.slice(_-m+1,_+1):f.slice(_,_+m);return{isSafe:f.slice(_+1).every(b=>t[b]===ie||i.includes(b)),isComplete:h.every(b=>t[b]!==ie&&!i.includes(b))}}return{isSafe:!0,isComplete:f.every(_=>t[_]!==ie)}}if(a===c.ALL)return{isSafe:!0,isComplete:Object.keys(o.wells).every(u=>t[u]!==ie)};if(a===c.COLUMN){const u=r===c.A12_NOZZLE,p=Wu(s),d=l[p],f=u?[...l].reverse():l,_=f.indexOf(d);return{isSafe:f.slice(_+1).flat().every(m=>t[m]===ie||i.includes(m)),isComplete:f[_].every(m=>t[m]!==ie)}}if(a===c.ROW){const u=l[0].map((_,m)=>l.map(h=>h[m])),d=r===c.H1_NOZZLE?[...u].reverse():u,f=d.findIndex(_=>_.some(m=>m===s));return{isSafe:d.slice(f+1).flat().every(_=>t[_]===ie||i.includes(_)),isComplete:d[f].every(_=>t[_]!==ie)}}if(a===c.SINGLE){const u=fn(r??ns({nozzles:a,channels:n})),p=Gc(r??ns({nozzles:a,channels:n})),d=u==="H",_=p==="12"?[...l].reverse():l,m=_.findIndex(h=>h.some(b=>b===s));return{isSafe:_.slice(m).every(h=>{const b=d?[...h].reverse():h,T=b.findIndex(y=>fn(y)===fn(s));return b.slice(T).every(y=>t[y]===ie||i.includes(y)||y===s)}),isComplete:t[s]!==ie}}return{isSafe:!1}},fn=e=>e.slice(0,1),Gc=e=>e.slice(1),Wu=e=>parseInt(e.slice(1))-1,ns=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"},Ba=e=>{const{wellSets:t,nozzles:r,channels:n,primaryNozzle:a}=e;if(r===c.ROW){const s=t[0].length;return Array.from({length:s},(i,l)=>t.map(u=>u[l])).map(i=>i[0])}return t.map(s=>n===96&&r===c.ALL?a:r===c.COLUMN||n===8&&r===c.ALL||n===8&&r===c.PARTIAL_COLUMN?fn(a)==="H"?s[s.length-1]:s[0]:(console.assert(s.length===1,"Well set for SINGLE nozzle configuration should have exactly 1 well"),s[0]))},lS=e=>{const{pipetteSpecs:t,tiprackUri:r,nozzles:n}=e,{channels:a}=t,s=uS(a,n),o=t.pickUpTipConfigurations.pressFit.configurationsByNozzleMap[s]?.default.tipOverlaps;if(o==null)return console.error(`No tip overlaps found for ${n} and ${s} overlap.`),0;const i=Math.max(...Object.keys(o).map(l=>Number(l.slice(1))));return o[`v${i}`]?.[r]??o[`v${i}`]?.default??0},uS=(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"},cS=e=>{const{channels:t,boundingBox:r,robotType:n}=e,a=c.getRobotDefFromRobotType(n),{paddingOffsets:s}=a,{front:o,rear:i,leftSide:l,rightSide:u}=s,[p,d]=a.extents,[f,_]=r,{x:m,y:h}=f,{x:b,y:T}=_;if(t===96){if(b<l)return!1;const y=p+u;if(m>y)return!1}if(t!==1){if(h<o)return!1;const y=d+i;if(T>y)return!1}return!0},Iy=e=>{const[t,r]=[0,1].map(a=>Object.values(e.nozzleMap)[a][0]);return Math.abs(t-r)},pS=e=>{const t=dS(e),r=fS(e);return{x:t,y:r}},dS=e=>{const{primaryNozzle:t,nozzleConfiguration:r,specs:n,labwareDef:a}=e,{channels:s}=n,{ordering:o}=a,i=o.length===1;if(!i)return 0;let l;r===c.ALL&&s===96||r===c.ROW?l=12:r===c.QUADRANT?l=6:l=1;const u=Gc(t)==="12"?1:-1,p=Iy(n);return i?(l-1)*p/2*u:0},fS=e=>{const{wellTargetName:t,primaryNozzle:r,nozzleConfiguration:n,specs:a,labwareDef:s}=e,{channels:o}=a,{ordering:i}=s,l=i.findIndex(m=>m.includes(t));if(!(i[l].length===1))return 0;let d;n===c.COLUMN||n===c.ALL&&o===96||o===8?d=8:n===c.PARTIAL_COLUMN?d=c.PARTIAL_NOZZLE_MAP[r]:n===c.QUADRANT?d=4:d=1;const f=Iy(a),_=fn(r)==="H"?-1:1;return(d-1)*f/2*_};function Ey(e){const t=e.length===1?e[0]:null;return t!=null&&"steps"in t?{numRepetitions:t.repetitions,repeatingProfileSteps:t.steps}:{numRepetitions:1,repeatingProfileSteps:Wc(e)}}function Wc(e){return e.flatMap(t=>"steps"in t?h_(t.steps,t.repetitions):t)}const F=$b;function wy(e){return Object.keys(e).sort((r,n)=>{const a=G(e[r].stack),s=G(e[n].stack),o=parseInt(a),i=parseInt(s);return Me.includes(a)&&Me.includes(s)?r.localeCompare(n):Me.includes(a)?1:Me.includes(s)?-1:o-i})}function Sy(e){const{pipetteId:t,tiprackId:r,invariantContext:n,robotState:a,nozzles:s,primaryNozzle:o}=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]===Ea,d=c.orderWells(l.ordering,"t2b","l2r"),f=c.orderWells(l.ordering,"b2t","l2r"),_=E=>E.find(p)??null,m=E=>[...E].reverse().find(p)??null,h=E=>E.find(R=>R.every(p))??null,b=E=>[...E].reverse().find(R=>R.every(p))??null,T=i===8&&s===c.SINGLE,y=T&&o===c.H1_NOZZLE,A=T&&o===c.A1_NOZZLE,S=i===96&&s===c.SINGLE,g=S&&o===c.H12_NOZZLE,I=S&&o===c.A12_NOZZLE,L=S&&o===c.H1_NOZZLE,w=S&&o===c.A1_NOZZLE;if(i===1||y||g)return _(d);if(A)return _(f);if(s===c.PARTIAL_COLUMN){const E=_(d);if(!E)return null;const R=d.indexOf(E);return d[R]??null}if(s===c.ALL&&i===8)return h(l.ordering)?.[0]??null;if(w)return m(d);if(I)return _(f);if(L)return m(f);if(s===c.COLUMN){const E=l.ordering;return(o===c.A1_NOZZLE?b(E):h(E))?.[0]??null}if(s===c.ROW){const E=l.ordering,R=E[0].map((B,q)=>E.map(ee=>ee[q]));return(o===c.A1_NOZZLE?b(R):h(R))?.[0]??null}return s===c.ALL&&i===96?d.every(p)?d[0]:null:(console.assert(!1,`Unhandled _getNextTip case for pipette ${t}`),null)}function Va(e,t,r,n,a,s){const o=r.pipetteEntities[e];if(!o)throw new Error(`cannot getNextTiprack, no pipette entity for pipette "${e}"`);const i=wy(n.labware).filter(m=>{console.assert(r.labwareEntities[m]?.labwareDefURI!=null,`cannot getNextTiprack, no labware entity for "${m}"`);const h=G(n.labware[m].stack)!=="offDeck",b=r.labwareEntities[m].labwareDefURI;return h&&b===t});let l=i;const u=o.spec.channels===96,p=[],d=[];u&&(l=l.filter(m=>{const h=n.labware[m].stack[1],b=r.labwareEntities[h],T=b?.def.parameters.loadName==="opentrons_flex_96_tiprack_adapter"&&c.getLabwareDefIsStandard(b?.def),y=s===c.ALL?T:!T;return y||p.push(m),y})),l=l.filter(m=>{const h=Object.entries(n.labware).find(([b,T])=>T.stack.includes(m)&&c.getIsLid(r.labwareEntities[b].def));return h!=null&&d.push(m),h==null});let f=null,_=null;for(const m of l){const h=Sy({pipetteId:e,tiprackId:m,nozzles:s,invariantContext:r,robotState:n,primaryNozzle:a}),{isSafe:b}=h!=null?dt({robotState:n,invariantContext:r,pipetteId:e,labwareId:m,wellTargetName:h,primaryNozzle:a,nozzleConfiguration:s}):{isSafe:!1},{isSafe:T,isComplete:y=!1}=h!=null?jc({tipState:n.tipState.tipracks[m],primaryNozzle:a,channels:o.spec.channels,nozzleConfiguration:s,wellName:h,tiprackDef:r.labwareEntities[m].def}):{isSafe:!1};if(h&&b&&T&&y){f=m,_=h;break}}return f&&_?{nextTiprack:{tiprackId:f,well:_},tipracks:{totalTipracks:i.length,excludedBy96Channel:p.length,excludedByLid:d.length,filteredSortedTiprackIds:l}}:{nextTiprack:null,tipracks:{totalTipracks:i.length,excludedBy96Channel:p.length,excludedByLid:d.length,filteredSortedTiprackIds:l}}}function ks(e,t,r){const n=t.pipetteEntities[e],a=n.spec.liquids.default.maxVolume,s=n.tiprackLabwareDef;let o=null;for(const l of s)if(c.getLabwareDefURI(l)===r){o=l;break}const i=c.getTiprackVolume(o??s[0]);return!a||!i?(console.assert(!1,`getPipetteEffectiveMaxVol expected tiprackMaxVol and pipette maxVolume to be > 0, got',
|
|
113
|
+
${a}, ${i}`),NaN):Eb([i,a])??NaN}function St(e,t){return t in e.modules||console.warn(`getModuleState expected module id "${t}" to be in robot state`),e.modules[t]?.moduleState}const vs=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.THERMOCYCLER_MODULE_TYPE?r:null},Fn=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.ABSORBANCE_READER_TYPE?r:null},ft=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.FLEX_STACKER_MODULE_TYPE?r:null},st=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.VACUUM_MODULE_TYPE?r:null},mS=(e,t,r)=>{const{moduleId:n,measureMode:a,sampleWavelengths:s,referenceWavelength:o}=e,i=Fn(r,n),l=[];if(i==null&&l.push(X()),l.length>0)return{errors:l};const u=[M(bc,{moduleId:n}),M(e_,{moduleId:n,measureMode:a,sampleWavelengths:s,referenceWavelength:o??void 0})];return ne(u,t,r)},hS=(e,t,r)=>{const n=[],a=Fn(r,e.moduleId);if((a==null||e.moduleId==null)&&n.push(X()),a?.initialization==null&&n.push(Yy()),n.length>0)return{errors:n};const{moduleId:s,fileName:o}=e,i=[M(bc,{moduleId:s}),M(t_,{moduleId:s,fileName:o})];return ne(i,t,r)},_S=(e,t,r)=>{const{pipetteId:n,trashId:a,flowRate:s,volume:o}=e,i=[M(Ue,{pipetteId:n,fixtureId:a,offset:Et}),O(Ut,{pipetteId:n}),M(Qt,{pipetteId:n,volume:o,flowRate:s})];return ne(i,t,r)},yS=(e,t,r)=>{const{pipetteId:n,volume:a,flowRate:s,wasteChuteId:o}=e,i=[M(Ue,{pipetteId:n,fixtureId:o,offset:Et}),O(Ut,{pipetteId:n}),M(Qt,{pipetteId:n,flowRate:s,volume:a})];return ne(i,t,r)},bS=(e,t,r)=>{const{labwareId:n,wellName:a,flowRate:s,pipetteId:o,volume:i,type:l}=e,u=t.pipetteEntities[o].pythonName,p=l==="aspirate"?[]:[O(Ut,{pipetteId:o})],d=()=>({commands:[],python:`${u}.air_gap(${[`volume=${i}`,`height=${Du}`,`flow_rate=${s}`].join(", ")})`}),f=[O($,{pipetteId:o,labwareId:n,wellName:a,wellLocation:{origin:"top",offset:{z:Du,x:0,y:0}}}),...p,O(Qt,{pipetteId:o,volume:i,flowRate:s}),d];return ne(f,t,r)},Ay=(e,t,r)=>{const{pipetteId:n,trashId:a,flowRate:s}=e,{pipetteEntities:o,trashBinEntities:i}=t,l=o[n].pythonName,u=i[a].pythonName,p=()=>({commands:[],python:`${l}.flow_rate.blow_out = ${s}
|
|
114
|
+
${l}.blow_out(${u})`}),d=[O(Ue,{pipetteId:n,fixtureId:a,offset:Et}),O(Oa,{pipetteId:n,flowRate:s}),p];return ne(d,t,r)},Ly=(e,t,r)=>{const{pipetteId:n,flowRate:a,wasteChuteId:s}=e,{pipetteEntities:o,wasteChuteEntities:i}=t,l=o[n].pythonName,u=i[s].pythonName,p=()=>({commands:[],python:`${l}.flow_rate.blow_out = ${a}
|
|
115
|
+
${l}.blow_out(${u})`}),d=[O(Ue,{pipetteId:n,fixtureId:s,offset:Et}),O(Oa,{pipetteId:n,flowRate:a}),p];return ne(d,t,r)};var Ou,Qm;function TS(){if(Qm)return Ou;Qm=1;var e=Jh();function t(r){var n=e(r),a=n%1;return n===n?a?n-a:n:0}return Ou=t,Ou}var Ru,Jm;function gS(){if(Jm)return Ru;Jm=1;var e=U_(),t=yc(),r=TS(),n=Math.ceil,a=Math.max;function s(o,i,l){(l?t(o,i,l):i===void 0)?i=1:i=a(r(i),0);var u=o==null?0:o.length;if(!u||i<1)return[];for(var p=0,d=0,f=Array(n(u/i));p<u;)f[d++]=e(o,p,p+=i);return f}return Ru=s,Ru}var IS=gS();const Oy=xe(IS),Ry=(e,t,r)=>{const{pipetteId:n,trashLocation:a}=e;let s=[];const o=Ic(a);if(r.tipState.pipettes[n]?.hasTip){const i=t.pipetteEntities[n].pythonName,l=()=>({commands:[],python:`${i}.drop_tip()`});s=[O(a_,{pipetteId:n,addressableAreaName:o}),O(Tc,{pipetteId:n}),l]}return ne(s,t,r)},ky=(e,t,r)=>{const n=Et,{pipetteId:a,wasteChuteId:s}=e,{pipetteEntities:o,wasteChuteEntities:i}=t;let l=[];if(!r.tipState.pipettes[a].hasTip)l=[];else{const u=o[a].pythonName,p=i[s].pythonName,d=()=>({commands:[],python:`${u}.drop_tip(${p})`});l=[O(Ue,{pipetteId:a,fixtureId:s,offset:n}),O(Tc,{pipetteId:a}),d]}return ne(l,t,r)},$a=(e,t,r)=>{const{pipette:n,dropTipLocation:a,nozzles:s,primaryNozzle:o,tipRack:i,isFromMixCommand:l=!1,tipSelectionArgs:u}=e,p=r.pipettes[n].nozzles,d=r.pipettes[n].tiprackId,f=t.pipetteEntities[n]?.spec,_=f?.channels;let m=null;if(u==null){if(i==null)return{errors:[nb()]};const E=Va(n,i,t,r,o,s);m=E.nextTiprack;const R=E.tipracks,{excludedBy96Channel:k,excludedByLid:B}=R??{},q=m==null&&_===96&&k>0;if(s===c.ALL&&q)return{errors:[$y()]};if(s===c.COLUMN&&q)return{errors:[xy()]};if(B>0&&m==null)return{errors:[cb()]}}else m={tiprackId:u.tipRackId,well:u.tipWell};if(m==null)return{errors:[Vy()]};const h=(f?.displayCategory==="FLEX"||_===96)??!1;if(!f)return{errors:[ut({pipette:n})]};const b=t.labwareEntities[m.tiprackId]?.def,T=t.wasteChuteEntities[a]!=null,y=t.trashBinEntities[a]!=null;if(!b)return{errors:[ct({actionName:"replaceTip",labware:m.tiprackId})]};const A=r.tipState.pipettes[n]?.hasTip;if(!a||!T&&!y&&A)return{errors:[Tn()]};if(Cn({pipette:n,labware:m.tiprackId,invariantContext:t,prevRobotState:r}))return{errors:[fa()]};const S=vn(m.tiprackId,r.labware);if(Mn(r.modules,S,h?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE))return{errors:[ha()]};if(!h){if(Nn(r.modules,S))return{errors:[ma()]};if(Dn(r.modules,S,f))return{errors:[_a()]}}const g=l?M:O,I=[];_!==1&&e.nozzles!=null&&(e.nozzles!==p||m.tiprackId!==d)&&I.push(M(mg,{configurationParams:{primaryNozzle:o,style:e.nozzles},pipetteId:e.pipette}));const L=u?wt:ec;let w=[g(An,{pipette:n,dropTipLocation:a}),...I,g(dl,{pipetteId:n,labwareId:m.tiprackId,wellName:m.well,nozzles:e.nozzles,tipTrackingOption:L,primaryNozzle:o})];return T&&(w=[g(ky,{pipetteId:e.pipette,wasteChuteId:t.wasteChuteEntities[e.dropTipLocation].id}),...I,g(dl,{pipetteId:n,labwareId:m.tiprackId,wellName:m.well,nozzles:e.nozzles,tipTrackingOption:L,primaryNozzle:o})]),y&&(w=[g(Ry,{pipetteId:n,trashLocation:t.trashBinEntities[e.dropTipLocation].location}),...I,g(dl,{pipetteId:n,labwareId:m.tiprackId,wellName:m.well,nozzles:e.nozzles,tipTrackingOption:L,primaryNozzle:o})]),ne(w,t,r)},eh=(e=0)=>e>0?[O(he,{seconds:e})]:[],ES=e=>()=>{const{invariantContext:t,pipette:r,times:n,volume:a,aspirateDelaySeconds:s,dispenseDelaySeconds:o,finalPushOut:i,aspirateFlowRateUlSec:l,dispenseFlowRateUlSec:u,positionArgs:p}=e,{pipetteEntities:d,labwareEntities:f}=t,_=d[r].pythonName;let m=null;if(p!=null){const{labware:b,well:T,wellOrigin:y,xOffset:A,yOffset:S,zOffset:g}=p,I=f[b].pythonName,L={origin:y,offset:{x:A,y:S,z:g}};m=`location=${I}[${C(T)}]${Ln(L)}`}const h=[`repetitions=${n}`,`volume=${a}`,...m!=null?[m]:[],`aspirate_flow_rate=${l}`,`dispense_flow_rate=${u}`,...s!=null&&s!==0?[`aspirate_delay=${s}`]:[],...o!=null&&o!==0?[`dispense_delay=${o}`]:[],...i!=null?[`final_push_out=${i}`]:[]];return{commands:[],python:`${_}.mix(
|
|
116
116
|
${Z(h.join(`,
|
|
117
117
|
`))},
|
|
118
|
-
)`}},
|
|
118
|
+
)`}},Dr=e=>{const{pipette:t,volume:r,times:n,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:s,aspirateDelaySeconds:o=0,dispenseDelaySeconds:i=0,finalPushOut:l,invariantContext:u,liquidClass:p,tiprack:d,moveToWellParams:f,generatePython:_}=e,m=ES({invariantContext:u,pipette:t,volume:r,times:n,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:s,aspirateDelaySeconds:o,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}),h=u.pipetteEntities[t].spec,b=c.getByVolumeValue({liquidClass:p,pipetteSpecs:h,tiprackDefUri:d,targetVolume:r,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,T=c.getByVolumeValue({liquidClass:p,pipetteSpecs:h,tiprackDefUri:d,targetVolume:r,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,A=f!=null?[O($,{...f,wellLocation:{...f.wellLocation}})]:[];for(let S=0;S<n;S++)A.push(O(_s,{pipetteId:t,volume:r,flowRate:a,...b>0?{correctionVolume:b}:{}}),...eh(o),O(nt,{pipetteId:t,volume:r,flowRate:s,...S<n-1?{pushOut:0}:l==null?{}:{pushOut:l},...T>0?{correctionVolume:T}:{}}),...eh(i));return[...A,..._?[m]:[]]},wS=(e,t,r)=>{const{pipette:a,labware:s,wells:o,volume:i,times:l,changeTip:u,aspirateFlowRateUlSec:p,dispenseFlowRateUlSec:d,blowoutFlowRateUlSec:f,blowoutOffsetFromTopMm:_,dropTipLocation:m,tipRack:h,positionReference:b,xOffset:T,yOffset:y,zOffset:A,finalPushOut:S,nozzles:g,primaryNozzle:I,tipsSelected:L,tiprackSelected:w,tipTracking:E}=e,R=e.aspirateDelaySeconds??0,k=e.dispenseDelaySeconds??0,B=t.pipetteEntities[a]?.spec.channels!==1;if(r.pipettes[a]==null||t.pipetteEntities[a]==null)return{errors:[ut({pipette:a})]};if(r.labware[s]==null)return{errors:[ct({actionName:"mix",labware:s})]};const q=G(r.labware[s]?.stack);if(Object.keys(t.wasteChuteEntities).length>0&&q===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)return{errors:[ya()]};const pe=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],_e=pe.length>0?pe[0]:null,le=Object.values(t.labwareEntities).find(({labwareDefURI:W})=>W===m),be=le!=null&&c.getIsTiprack(le.def),ve=t.wasteChuteEntities[m]!=null,He=t.trashBinEntities[m]!=null,Be=r.pipettes[a]?.tipWell!=null;if(m==null||be&&_e==null&&u!=="never"&&Be||!be&&!ve&&!He)return{errors:[Tn()]};if(B){const W=dt({robotState:r,invariantContext:t,pipetteId:a,labwareId:s,wellLocationOffset:{x:T,y},wellTargetName:o[0],primaryNozzle:I,nozzleConfiguration:g});if(!W.isSafe)return{errors:[Ft({unsafePipetteMovementReason:W.reason})]};const P=dt({robotState:r,invariantContext:t,pipetteId:a,labwareId:s,wellLocationOffset:{x:T,y},wellTargetName:o[0],primaryNozzle:I,nozzleConfiguration:g});if(!P.isSafe)return{errors:[Ft({unsafePipetteMovementReason:P.reason})]}}const te=c.LOW_VOLUME_PIPETTES.includes(t.pipetteEntities[a].name),Ee=te?[M(oa,{pipetteId:a,volume:i})]:[],ze=t.pipetteEntities[a].spec,Te=E===wt&&w!=null&&L!=null&&L.length>0?Ba({wellSets:L,nozzles:g,channels:ze.channels,primaryNozzle:I}):null,K=yn(o,(W,P)=>{let v=[];if(u==="always"||u==="once"&&P===0){const ye=Te?.shift();v=[M($a,{pipette:a,primaryNozzle:I,dropTipLocation:be&&_e!=null?_e:m,tipRack:h,nozzles:g,...E===wt&&ye!=null&&w!=null?{tipSelectionArgs:{tipRackId:w,tipWell:ye}}:{},isFromMixCommand:!0})]}const V=te||e.blowoutLocation!=null&&P>0?[M(Ut,{pipetteId:a})]:[],N=e.touchTip?[M(Mt,{pipetteId:a,labwareId:s,wellName:W,zOffsetFromTop:e.touchTipMmFromTop})]:[],ae=__({pipette:e.pipette,sourceLabwareId:e.labware,sourceWell:W,destLabwareId:e.labware,destWell:W,blowoutLocation:e.blowoutLocation,flowRate:f,offsetFromTopMm:_,invariantContext:t}),z=[...Object.keys(t.wasteChuteEntities),...Object.keys(t.trashBinEntities)].some(ye=>ye===e.blowoutLocation)?[...N,...ae]:[...ae,...N],D=be&&(P===o.length-1||u==="always")?[M(An,{pipette:a,dropTipLocation:h,isReturnTip:be})]:[],x=Dr({pipette:a,volume:i,times:l,aspirateFlowRateUlSec:p,dispenseFlowRateUlSec:d,invariantContext:t,liquidClass:null,tiprack:h,finalPushOut:S,aspirateDelaySeconds:R,dispenseDelaySeconds:k,moveToWellParams:{pipetteId:a,labwareId:s,wellName:W,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[b],offset:{x:T,y,z:A}}},generatePython:!0});return[...v,...Ee,...V,...x,...z,...D]});return ne(K,t,r)},SS=(e,t,r)=>{const{aspirateDelay:n,aspirateFlowRateUlSec:a,aspiratePositionReference:s,aspirateRetractDelay:o,aspirateRetractPositionReference:i,aspirateRetractSpeed:l,aspirateRetractXOffset:u,aspirateRetractYOffset:p,aspirateRetractZOffset:d,aspirateSubmergeDelay:f,aspirateSubmergePositionReference:_,aspirateSubmergeSpeed:m,aspirateSubmergeXOffset:h,aspirateSubmergeYOffset:b,aspirateSubmergeZOffset:T,aspirateXOffset:y,aspirateYOffset:A,aspirateZOffset:S,blowoutFlowRateUlSec:g,blowoutLocation:I,changeTip:L,destLabware:w,destWell:E,dispenseDelay:R,dispenseFlowRateUlSec:k,dispensePositionReference:B,dispenseRetractPositionReference:q,dispenseRetractXOffset:ee,dispenseRetractYOffset:pe,dispenseRetractZOffset:_e,dispenseSubmergeDelay:le,dispenseSubmergePositionReference:be,dispenseSubmergeSpeed:ve,dispenseSubmergeXOffset:He,dispenseSubmergeYOffset:Be,dispenseSubmergeZOffset:te,dispenseXOffset:Ee,dispenseYOffset:ze,dispenseZOffset:Pe,dropTipLocation:Te,liquidClass:K,mixInDestination:W,nozzles:P,pipette:v,primaryNozzle:V,pushOut:N,sourceLabware:ae,sourceWells:U,tipRack:H,tipTracking:z,tiprackSelected:D,tipsSelected:x,touchTipAfterAspirate:ye,touchTipAfterAspirateMmFromEdge:Ve,touchTipAfterAspirateOffsetMmFromTop:Ze,touchTipAfterAspirateSpeed:$e,touchTipAfterDispense:ce,touchTipAfterDispenseMmFromEdge:Qe,touchTipAfterDispenseOffsetMmFromTop:mt,touchTipAfterDispenseSpeed:At,stepNumber:ht,volume:Oe}=e,{pipetteEntities:Je,labwareEntities:Re,trashBinEntities:ke,wasteChuteEntities:Ce}=t,ue="consolidate",re=[],Lt=r.pipettes[v],We=Je[v]?.spec.channels!==1,Y=e.aspirateAirGapVolume??0,we=e.dispenseAirGapVolume??0;Lt==null&&re.push(ut({pipette:v})),(w==null||Re[w]==null&&ke[w]==null&&Ce[w]==null)&&re.push(dh());const mr=G(r.labware[w]?.stack),et=G(r.labware[ae]?.stack);Object.keys(Ce).length>0&&(mr===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA||et===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)&&re.push(ya());const fe=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],tt=fe.length>0?fe[0]:null,Gr=Object.values(t.labwareEntities).find(({labwareDefURI:me})=>me===Te),Ot=Gr!=null&&c.getIsTiprack(Gr.def),xa=t.wasteChuteEntities[Te]!=null,Wr=t.trashBinEntities[Te]!=null,tr=r.tipState.pipettes[v]?.hasTip;(Te==null||Ot&&tt==null&&L!=="never"&&tr||!Ot&&!xa&&!Wr)&&re.push(Tn());let ot,Q;if(L==="never"){const me=r.tipState.pipettes[v]?.tiprackURI;ot=t.labwareEntities[me??""],Q=ot?.labwareDefURI}else ot=Object.values(Re).find(({labwareDefURI:me})=>me===H),Q=H;ot==null&&(L==="never"?re.push(Bt({actionName:ue,pipette:v})):re.push(ct({actionName:ue,labware:Q})));const{def:Rt=null}=ot??{},{spec:ge,name:kt,pythonName:J}=Je[v],j=c.getAllLiquidClassDefs()[K===c.NONE_LIQUID_CLASS_NAME||K==null?c.WATER_LIQUID_CLASS_NAME:K].byPipette?.find(({pipetteModel:me})=>me===c.getFlexNameConversion(ge))?.byTipType.find(({tiprack:me})=>me===Q)??null,{aspirate:it}=j??{},{multiWellHandling:de}=Oc({pipetteSpecs:ge,tiprackDefinition:Rt,volume:Oe,path:"multiAspirate",numAspirateWells:U.length,numDispenseWells:1,aspirateAirGapByVolume:it?.retract.airGapByVolume??[],conditioningByVolume:null,disposalByVolume:null}),{numWellsToFitInTip:rt}=de;if((!de.isSupported||rt==null||rt===1)&&re.push(ob()),We&&P!==c.ALL){const me=dt({robotState:r,invariantContext:t,pipetteId:v,labwareId:ae,wellLocationOffset:{x:y,y:A},primaryNozzle:V,nozzleConfiguration:P});me.isSafe||re.push(Ft({unsafePipetteMovementReason:me.reason}));const se=dt({robotState:r,invariantContext:t,pipetteId:v,labwareId:w,wellLocationOffset:{x:Ee,y:ze},primaryNozzle:V,nozzleConfiguration:P});se.isSafe||re.push(Ft({unsafePipetteMovementReason:se.reason}))}const $t=E!=null?Re[ae]?.def.wells[E]?.depth:null,vt=c.getMmFromBottom(Pe,B,$t),Yr=c.getMmFromBottom(te,be,$t),rr=c.getMmFromBottom(_e,q,$t);if(vt!=null&&Yr!=null&&vt>Yr&&re.push(ab()),vt!=null&&rr!=null&&vt>rr&&re.push(sb()),re.length>0)return{errors:re};const{tipracks:hr}=Va(v,Q,t,r,V,P),nr=c.getByVolumeValue({liquidClass:K,pipetteSpecs:ge,tiprackDefUri:Q,targetVolume:Oe,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Se=ke[w]?.pythonName??Ce[w]?.pythonName,Pt=ke[Te]?.pythonName??Ce[Te]?.pythonName,_r=I==null?null:ke[I]?.pythonName??Ce[I]?.pythonName,yr=Re[ae].pythonName,Kr=Re[w]?.pythonName,br=U.map(me=>`${yr}[${C(me)}]`).join(", "),Xr=e.destWell!=null&&Kr!=null?`${Kr}[${C(e.destWell)}]`:null,Zr=[`name=${C(`${e.commandCreatorFnName}_step_${ht}`)}`,...K!=null?[`base_liquid_class=${Ua(K,!0)}`]:[],`properties=${Ls({args:e,pipetteName:c.isFlexPipette(kt)?c.getFlexNameConversion(ge):kt,tiprackUri:Q,liquidClassValuesForTip:j})}`],Un=`${Ie}.define_liquid_class(
|
|
119
119
|
${Z(Zr.join(`,
|
|
120
120
|
`))},
|
|
121
|
-
)`,
|
|
121
|
+
)`,Tr=z===wt&&D!=null&&x!=null&&x.length>0?Ba({wellSets:x,nozzles:P,channels:ge.channels,primaryNozzle:V}):null,ar=D!=null?Re[D]?.pythonName:null,Vn=Tr?.map(me=>`${ar}[${C(me)}]`).join(", "),Qr=[`volume=${Oe}`,`source=[${br}]`,`dest=${Xr!=null?`[${Xr}]`:Se}`,`new_tip=${C(Rs(L))}`,...Ot?["return_tip=True",..._r!=null?[`trash_location=${_r}`]:[]]:[`trash_location=${Pt}`,"keep_last_tip=True"],...ge.channels>1?["group_wells=False"]:[],...hr.filteredSortedTiprackIds.length>0?[Os({labwareEntities:Re,tiprackIds:hr.filteredSortedTiprackIds})]:[],`liquid_class=${Un}`,...Tr!=null&&ar!=null?[`tips=[${Vn}]`]:[]],$n=()=>({commands:[],python:`${J}.consolidate_with_liquid_class(
|
|
122
122
|
${Z(Qr.join(`,
|
|
123
123
|
`))},
|
|
124
|
-
)`}),
|
|
124
|
+
)`}),gr=Oy(U,rt),Ha=c.LOW_VOLUME_PIPETTES.includes(kt)?[O(oa,{pipetteId:v,volume:Oe})]:[],sr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[be],offset:{x:He,y:Be,z:te}},xn={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[q],offset:{x:ee,y:pe,z:_e}},xt=n!=null?[O(he,{seconds:n.seconds})]:[],Ir=c.getByVolumeValue({liquidClass:K,pipetteSpecs:ge,tiprackDefUri:Q,targetVolume:we,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Er=R!=null?[O(he,{seconds:R.seconds})]:[],Hn=c.getByVolumeValue({liquidClass:K,pipetteSpecs:ge,tiprackDefUri:Q,targetVolume:Y,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,Jr=c.getByVolumeValue({liquidClass:K,pipetteSpecs:ge,tiprackDefUri:Q,targetVolume:Y,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??k,zn=c.getByVolumeValue({liquidClass:K,pipetteSpecs:ge,tiprackDefUri:Q,targetVolume:we,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,en=c.getByVolumeValue({liquidClass:K,pipetteSpecs:ge,tiprackDefUri:Q,targetVolume:we,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??k,or=qr({retractZOffset:_e,retractPositionReference:q,labwareId:w,labwareEntities:Re,well:E}),wr=!or&&E!=null?[O($,{pipetteId:v,labwareId:w,wellName:E,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],za=[...yn(gr,(me,se)=>{const _t=(Le,jt=!0)=>we>0&&!(L==="never"&&Ne&&Le)?[...jt?wr:[],O(Ut,{pipetteId:v}),O(Qt,{pipetteId:v,volume:we,flowRate:zn,...Ir>0?{correctionVolume:Ir}:{}}),...xt]:[],yt=Le=>E!=null&&ce?[O(Mt,{pipetteId:v,labwareId:w,wellName:E,...Qe!=null?{mmFromEdge:Qe}:{},zOffsetFromTop:mt,...At!=null?{speed:At}:{}}),..._t(Le).length>0&&or?[O($,{pipetteId:v,labwareId:w,wellName:E,wellLocation:xn})]:[]]:[],Ae=se===0,Ne=se===gr.length-1,Gn=me.length,oe=Oe*Gn,Ye=L==="always"||L==="once"&&Ae;let ir=[];if(Ye){const Le=Tr?.shift();ir=[M($a,{pipette:v,primaryNozzle:V,nozzles:P,dropTipLocation:Ot&&tt!=null?tt:Te,tipRack:Q,...z===wt&&Le!=null&&D!=null?{tipSelectionArgs:{tipRackId:D,tipWell:Le}}:{}})]}const Sr=yn(me,(Le,jt)=>{const Rr=jt===0;let Tt=0,Gt=k;Rr&&!Ye&&!Ae?(Tt=we,Gt=en):Rr||(Tt=Y,Gt=Jr);const Xn={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[_],offset:{x:h,y:b,z:T}},nn={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[i],offset:{x:u,y:p,z:d}},an=qr({retractZOffset:d,retractPositionReference:i,labwareId:ae,labwareEntities:Re,well:Le}),Zn=!an&&Le!=null?[O($,{pipetteId:v,labwareId:ae,wellName:Le,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],sn=c.getByVolumeValue({liquidClass:K,pipetteSpecs:ge,tiprackDefUri:Q,targetVolume:Tt,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,kr=Rr?[...c.LOW_VOLUME_PIPETTES.includes(t.pipetteEntities[v].name)?[O(oa,{pipetteId:v,volume:oe})]:[],O(Ut,{pipetteId:v})]:[],Qn=Tt>0?[O(nt,{pipetteId:v,volume:Tt,flowRate:Gt,...sn>0?{correctionVolume:sn}:{},isAirGap:!0,pushOut:0}),...Er]:[],vr=[...[O($,{pipetteId:v,labwareId:ae,wellName:Le,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],...Qn,...kr],on=[O($,{pipetteId:v,labwareId:ae,wellName:Le,wellLocation:Xn}),O($,{pipetteId:v,labwareId:ae,...m!=null?{speed:m}:{},wellName:Le,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[s],offset:{x:y,y:A,z:S}}}),...f!=null&&f.seconds>0?[O(he,{seconds:f.seconds})]:[]],cr=ye?[O(Mt,{pipetteId:v,labwareId:ae,wellName:Le,...Ve!=null?{mmFromEdge:Ve}:{},zOffsetFromTop:Ze,...$e!=null?{speed:$e}:{}}),...Y>0&&an?[O($,{pipetteId:v,labwareId:ae,wellName:Le,wellLocation:nn})]:[]]:[],Pr=c.getByVolumeValue({liquidClass:K,pipetteSpecs:ge,tiprackDefUri:Q,targetVolume:Y,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Wt=Y>0?[...Zn,O(Qt,{pipetteId:v,volume:Y,flowRate:Hn,...Pr>0?{correctionVolume:Pr}:{}}),...xt]:[],pr=[O(_s,{pipetteId:v,volume:Oe,flowRate:a,correctionVolume:nr}),...xt],Jn=[O($,{pipetteId:v,labwareId:ae,...l!=null?{speed:l}:{},wellName:Le,wellLocation:nn}),...o!=null&&o?.seconds>0?[O(he,{seconds:o.seconds})]:[]];return[...vr,...on,...pr,...Jn,...cr,...Wt]}),Ar=E!=null?[O($,{pipetteId:v,labwareId:w,wellName:E,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION}),O($,{pipetteId:v,labwareId:w,wellName:E,wellLocation:sr,...ve!=null?{speed:ve}:{}})]:[O(Ue,{pipetteId:v,fixtureId:w,offset:{x:0,y:0,z:0}})],Wn=c.getByVolumeValue({liquidClass:K,pipetteSpecs:ge,tiprackDefUri:Q,targetVolume:Y,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Yn=Y>0?[O(nt,{pipetteId:v,volume:Y,flowRate:Jr,pushOut:0,correctionVolume:Wn,isAirGap:!0}),...Er]:[],bt=E!=null?[O($,{pipetteId:v,labwareId:w,wellName:E,wellLocation:sr}),O($,{pipetteId:v,labwareId:w,...ve!=null?{speed:ve}:{},wellName:E,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[B],offset:{x:Ee,y:ze,z:Pe}}}),...le!=null&&le.seconds>0?[O(he,{seconds:le.seconds})]:[]]:[],Kn=c.getByVolumeValue({liquidClass:K,pipetteSpecs:ge,tiprackDefUri:Q,targetVolume:oe,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,lr=W!=null?0:N,Lr=[O(nt,{pipetteId:v,volume:oe,flowRate:k,...lr!=null?{pushOut:lr}:{},correctionVolume:Kn}),...Er],Ht=(W!=null?c.getByVolumeValue({liquidClass:K,pipetteSpecs:ge,tiprackDefUri:Q,targetVolume:W.volume,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null}):a)??a,zt=(W!=null?c.getByVolumeValue({liquidClass:K,pipetteSpecs:ge,tiprackDefUri:Q,targetVolume:W.volume,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null}):k)??k,tn=W!=null?Dr({pipette:v,volume:W.volume,times:W.times,aspirateFlowRateUlSec:Ht,dispenseFlowRateUlSec:zt,aspirateDelaySeconds:n?.seconds,dispenseDelaySeconds:R?.seconds,finalPushOut:N,invariantContext:t,liquidClass:K,tiprack:Q,generatePython:!1}):[],Or=[O(Oa,{pipetteId:v,flowRate:g})];let ur=[];I==null||I===Hr?ur=[...yt(!0),..._t(!0)]:I===On&&E!=null?ur=[O($,{pipetteId:v,labwareId:w,wellName:E,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),...Or,...yt(!0),..._t(!0)]:ur=[...yt(!1),..._t(!1),O(Ue,{pipetteId:v,fixtureId:Object.values(ke).length>0?Object.values(ke)[0].id:Object.values(Ce)[0].id,offset:{x:0,y:0,z:0}}),...Or,..._t(!0,!1)];const rn=Ot&&(se===gr.length-1||L==="always")?[O(An,{pipette:v,dropTipLocation:Q,isReturnTip:Ot})]:[];return[...ir,...Ha,...Sr,...Ar,...Yn,...bt,...Lr,...tn,...ur,...rn]}),$n];return ne(za,t,r)},AS=(e,t,r)=>{const{pipetteId:n,trashId:a,flowRate:s,volume:o}=e,{pipetteEntities:i,trashBinEntities:l}=t,u=l[a],p=i[n].pythonName,d=u.pythonName,f=[`volume=${o}`,`location=${d}`,`rate=${s} / ${p}.flow_rate.dispense`],_=()=>({commands:[],python:`${p}.dispense(
|
|
125
125
|
${Z(f.join(`,
|
|
126
126
|
`))},
|
|
127
|
-
)`}),m=[O(
|
|
127
|
+
)`}),m=[O(Ue,{pipetteId:n,fixtureId:a,offset:Et}),O(nt,{pipetteId:n,volume:o,flowRate:s}),_];return ne(m,t,r)},LS=(e,t,r)=>{const{pipetteId:n,flowRate:a,volume:s,wasteChuteId:o}=e,{pipetteEntities:i,wasteChuteEntities:l}=t,u=l[o].pythonName,p=i[n].pythonName,d=[`volume=${s}`,`location=${u}`,`rate=${a} / ${p}.flow_rate.dispense`],f=()=>({commands:[],python:`${p}.dispense(
|
|
128
128
|
${Z(d.join(`,
|
|
129
129
|
`))},
|
|
130
|
-
)`}),_=[O(
|
|
131
|
-
${Z(
|
|
130
|
+
)`}),_=[O(Ue,{pipetteId:n,fixtureId:o,offset:Et}),O(nt,{pipetteId:n,flowRate:a,volume:s}),f];return ne(_,t,r)},OS=(e,t,r)=>{const{aspirateDelay:n,aspirateFlowRateUlSec:a,aspiratePositionReference:s,aspirateRetractDelay:o,aspirateRetractPositionReference:i,aspirateRetractSpeed:l,aspirateRetractXOffset:u,aspirateRetractYOffset:p,aspirateRetractZOffset:d,aspirateSubmergeDelay:f,aspirateSubmergePositionReference:_,aspirateSubmergeSpeed:m,aspirateSubmergeXOffset:h,aspirateSubmergeYOffset:b,aspirateSubmergeZOffset:T,aspirateXOffset:y,aspirateYOffset:A,aspirateZOffset:S,blowoutFlowRateUlSec:g,blowoutLocation:I,changeTip:L,destLabware:w,destWells:E,dispenseDelay:R,dispenseFlowRateUlSec:k,dispensePositionReference:B,dispenseRetractDelay:q,dispenseRetractPositionReference:ee,dispenseRetractSpeed:pe,dispenseRetractXOffset:_e,dispenseRetractYOffset:le,dispenseRetractZOffset:be,dispenseSubmergeDelay:ve,dispenseSubmergePositionReference:He,dispenseSubmergeSpeed:Be,dispenseSubmergeXOffset:te,dispenseSubmergeYOffset:Ee,dispenseSubmergeZOffset:ze,dispenseXOffset:Pe,dispenseYOffset:Te,dispenseZOffset:K,dropTipLocation:W,liquidClass:P,mixBeforeAspirate:v,nozzles:V,pipette:N,preWetTip:ae,primaryNozzle:U,pushOut:H,sourceLabware:z,sourceWell:D,tipRack:x,tipTracking:ye,tiprackSelected:Ve,tipsSelected:Ze,touchTipAfterAspirate:$e,touchTipAfterAspirateMmFromEdge:ce,touchTipAfterAspirateOffsetMmFromTop:Qe,touchTipAfterAspirateSpeed:mt,touchTipAfterDispense:At,touchTipAfterDispenseMmFromEdge:ht,touchTipAfterDispenseOffsetMmFromTop:Oe,touchTipAfterDispenseSpeed:Je,stepNumber:Re,volume:ke}=e,{pipetteEntities:Ce,labwareEntities:ue,trashBinEntities:re,wasteChuteEntities:Lt}=t,We="distribute",Y=[],we=Ce[N]?.spec.channels!==1,mr=ue[z]?.def.parameters.quirks?.includes("touchTipDisabled"),et=e.aspirateAirGapVolume??0,Fe=e.dispenseAirGapVolume??0,fe=e.disposalVolume!=null&&e.disposalVolume>0?e.disposalVolume:0,tt=e.conditioningVolume!=null&&e.conditioningVolume>0?e.conditioningVolume:0;(r.pipettes[N]==null||Ce[N]==null)&&Y.push(ut({pipette:N})),(!z||!r.labware[z])&&Y.push(ct({actionName:We,labware:z}));const Gr=G(r.labware[w]?.stack),Ot=G(r.labware[z]?.stack);Object.keys(Lt).length>0&&(Gr===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA||Ot===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)&&Y.push(ya());const Wr=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],tr=Wr.length>0?Wr[0]:null,ot=Object.values(t.labwareEntities).find(({labwareDefURI:oe})=>oe===W),Q=ot!=null&&c.getIsTiprack(ot.def),Rt=t.wasteChuteEntities[W]!=null,ge=t.trashBinEntities[W]!=null,kt=r.tipState.pipettes[N]?.hasTip;(W==null||Q&&tr==null&&L!=="never"&&kt||!Q&&!Rt&&!ge)&&Y.push(Tn());let J,j;if(L==="never"){const oe=r.tipState.pipettes[N]?.tiprackURI;J=t.labwareEntities[oe??""],j=J?.labwareDefURI}else J=Object.values(ue).find(({labwareDefURI:oe})=>oe===x),j=x;J==null&&(L==="never"?Y.push(Bt({actionName:We,pipette:N})):Y.push(ct({actionName:We,labware:j})));const{def:it=null}=J??{},{spec:de,name:rt,pythonName:$t}=Ce[N],vt=c.getAllLiquidClassDefs()[P===c.NONE_LIQUID_CLASS_NAME||P==null?c.WATER_LIQUID_CLASS_NAME:P].byPipette?.find(({pipetteModel:oe})=>oe===c.getFlexNameConversion(de))?.byTipType.find(({tiprack:oe})=>oe===j)??null,{aspirate:Yr,multiDispense:rr}=vt??{},{multiWellHandling:hr}=Oc({pipetteSpecs:de,tiprackDefinition:it,volume:ke,path:"multiDispense",numAspirateWells:1,numDispenseWells:E.length,conditioningByVolume:rr?.conditioningByVolume??[],disposalByVolume:rr?.disposalByVolume??[],aspirateAirGapByVolume:Yr?.retract.airGapByVolume??[]}),{numWellsToFitInTip:nr}=hr;if((!hr.isSupported||nr==null||nr===1)&&Y.push(ib()),we&&V!==c.ALL){const oe=dt({robotState:r,invariantContext:t,pipetteId:N,labwareId:z,wellLocationOffset:{x:y,y:A},wellTargetName:D,primaryNozzle:U,nozzleConfiguration:V});oe.isSafe||Y.push(Ft({unsafePipetteMovementReason:oe.reason}));const Ye=dt({robotState:r,invariantContext:t,pipetteId:N,labwareId:w,wellLocationOffset:{x:Pe,y:Te},wellTargetName:E[0],primaryNozzle:U,nozzleConfiguration:V});Ye.isSafe||Y.push(Ft({unsafePipetteMovementReason:Ye.reason}))}const Se=t.labwareEntities[z]?.def.wells[D]?.depth??null,Pt=c.getMmFromBottom(S,s,Se),_r=c.getMmFromBottom(T,_,Se),yr=c.getMmFromBottom(d,i,Se);Pt!=null&&_r!=null&&Pt>_r&&Y.push(fh()),Pt!=null&&yr!=null&&Pt>yr&&Y.push(mh());const Kr=[O($,{pipetteId:N,labwareId:z,wellName:D,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],br=ks(N,t,j)-et;if(Math.floor((br-fe)/ke)===0&&Y.push(Ja({actionName:We,volume:ke,maxVolume:br,disposalVolume:fe})),Y.length>0)return{errors:Y};const{tipracks:Zr}=Va(N,j,t,r,U,V),Un=c.getByVolumeValue({liquidClass:P,pipetteSpecs:de,tiprackDefUri:j,targetVolume:ke,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Bn=re[w]?.pythonName??Lt[w]?.pythonName,Tr=re[W]?.pythonName??Lt[W]?.pythonName,ar=I==null?null:re[I]?.pythonName??Lt[I]?.pythonName,Vn=ue[z].pythonName,Qr=ue[w]?.pythonName,$n=`${Vn}[${C(e.sourceWell)}]`,gr=e.destWells.map(oe=>`${Qr}[${C(oe)}]`).join(", "),Ha=[`name=${C(`${e.commandCreatorFnName}_step_${Re}`)}`,...P!=null?[`base_liquid_class=${Ua(P,!0)}`]:[],`properties=${Ls({args:e,pipetteName:c.isFlexPipette(rt)?c.getFlexNameConversion(de):rt,tiprackUri:j,liquidClassValuesForTip:vt})}`],sr=`${Ie}.define_liquid_class(
|
|
131
|
+
${Z(Ha.join(`,
|
|
132
132
|
`))},
|
|
133
|
-
)`,
|
|
134
|
-
${Z(
|
|
133
|
+
)`,xt=ye===wt&&Ve!=null&&Ze!=null&&Ze.length>0?Ba({wellSets:Ze,nozzles:V,channels:de.channels,primaryNozzle:U}):null,Ir=Ve!=null?ue[Ve]?.pythonName:null,Er=xt?.map(oe=>`${Ir}[${C(oe)}]`).join(", "),Hn=[`volume=${ke}`,`source=[${$n}]`,`dest=[${gr??Bn}]`,`new_tip=${C(Rs(L))}`,...Q?["return_tip=True",...ar!=null?[`trash_location=${ar}`]:[]]:[`trash_location=${Tr}`,"keep_last_tip=True"],...de.channels>1?["group_wells=False"]:[],...Zr.filteredSortedTiprackIds.length>0?[Os({labwareEntities:ue,tiprackIds:Zr.filteredSortedTiprackIds})]:[],`liquid_class=${sr}`,...xt!=null&&Ir!=null?[`tips=[${Er}]`]:[]],Jr=()=>({commands:[],python:`${$t}.distribute_with_liquid_class(
|
|
134
|
+
${Z(Hn.join(`,
|
|
135
135
|
`))},
|
|
136
|
-
)`}),xn={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[_],offset:{x:h,y:b,z:T}},en={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[i],offset:{x:u,y:p,z:d}},sr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[ze],offset:{x:J,y:Le,z:Ge}},Er={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[te],offset:{x:_e,y:oe,z:Se}},Hn=c.getByVolumeValue({liquidClass:P,pipetteSpecs:fe,tiprackDefUri:j,targetVolume:Je,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,xa=c.getByVolumeValue({liquidClass:P,pipetteSpecs:fe,tiprackDefUri:j,targetVolume:Je,liquidHandlingAction:"multiDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??R,be=c.getByVolumeValue({liquidClass:P,pipetteSpecs:fe,tiprackDefUri:j,targetVolume:Me,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,le=c.getByVolumeValue({liquidClass:P,pipetteSpecs:fe,tiprackDefUri:j,targetVolume:Me,liquidHandlingAction:"multiDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??R,ht=gy(E,rr),_t=Fr({retractZOffset:d,retractPositionReference:i,labwareId:H,labwareEntities:ie,well:M}),we=!_t&&M!=null?[O(V,{pipetteId:C,labwareId:H,wellName:M,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],jn=[...hn(ht,(ue,rt)=>{const or=ue.length,wr=ke*or,Ar=wr+me+et,zn=rt===0,Gn=rt===ht.length-1,yt=L==="always"||L==="once"&&zn,Wn=c.LOW_VOLUME_PIPETTES.includes(tt)?[O(sa,{pipetteId:C,volume:Ar})]:[];let ir=[];if(yt){const Ce=Vt?.shift();ir=[U(Ba,{pipette:C,nozzles:$,primaryNozzle:q,dropTipLocation:Q&&er!=null?er:Y,tipRack:j,...ye===Et&&Ce!=null&&$e!=null?{tipSelectionArgs:{tipRackId:$e,tipWell:Ce}}:{}})]}const Sr=[O(qt,{pipetteId:C})],xt=c.getByVolumeValue({liquidClass:P,pipetteSpecs:fe,tiprackDefUri:j,targetVolume:Me,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Ht=k!=null?[O(he,{seconds:k.seconds})]:[],tn=Me>0&&!yt&&!zn&&me===0&&I==null?[O(nt,{isAirGap:!0,pipetteId:C,volume:Me,flowRate:le,...xt>0?{correctionVolume:xt}:{},pushOut:0}),...Ht]:[],Lr=[...Kr,...tn,...Wn,...Sr],lr=[O(V,{pipetteId:C,labwareId:H,wellName:M,wellLocation:xn}),O(V,{pipetteId:C,labwareId:H,...m!=null?{speed:m}:{},wellName:M,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[s],offset:{x:y,y:S,z:w}}}),...f!=null&&f.seconds>0?[O(he,{seconds:f.seconds})]:[]],rn=ae?Cr({pipette:C,volume:wr,times:1,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:R,aspirateDelaySeconds:n?.seconds??0,dispenseDelaySeconds:k?.seconds??0,finalPushOut:0,invariantContext:t,liquidClass:P,tiprack:j,generatePython:!1}):[],Ae=v!=null?Cr({pipette:C,volume:v.volume,times:v.times,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:R,aspirateDelaySeconds:n?.seconds,dispenseDelaySeconds:k?.seconds,finalPushOut:0,invariantContext:t,liquidClass:P,tiprack:j,generatePython:!1}):[],jt=n!=null?[O(he,{seconds:n.seconds})]:[],Or=Ve?[O(Mt,{pipetteId:C,labwareId:H,wellName:M,...pe!=null?{mmFromEdge:pe}:{},zOffsetFromTop:Ze,...ft!=null?{speed:ft}:{}}),...Je>0&&_t?[O(V,{pipetteId:C,labwareId:H,wellName:M,wellLocation:en})]:[]]:[],bt=c.getByVolumeValue({liquidClass:P,pipetteSpecs:fe,tiprackDefUri:j,targetVolume:Je,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,zt=Je>0?[...we,O(Zt,{pipetteId:C,volume:Je,flowRate:Hn,...bt>0?{correctionVolume:bt}:{}}),...jt]:[],Yn=c.getByVolumeValue({liquidClass:P,pipetteSpecs:fe,tiprackDefUri:j,targetVolume:Ar,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,nn=c.getByVolumeValue({liquidClass:P,pipetteSpecs:fe,tiprackDefUri:j,targetVolume:et,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,an=et!=null&&et>0?[O(nt,{pipetteId:C,volume:et,flowRate:R,correctionVolume:nn,pushOut:0}),...Ht]:[],Kn=[O(ms,{pipetteId:C,volume:Ar,flowRate:a,correctionVolume:Yn}),...jt,...an],sn=[O(V,{pipetteId:C,labwareId:H,...l!=null?{speed:l}:{},wellName:M,wellLocation:en}),...o!=null&&o?.seconds>0?[O(he,{seconds:o.seconds})]:[]],Rr=hn(ue,(Ce,kr)=>{const on=kr===0,ur=kr===ue.length-1,vr=Gn&&ur;let Gt=0,cr=R;on&&Je>0?(Gt=Je,cr=xa):!on&&Me>0&&et===0&&(Gt=Me,cr=le);const Zn=c.getByVolumeValue({liquidClass:P,pipetteSpecs:fe,tiprackDefUri:j,targetVolume:Gt,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Ha=Fr({retractZOffset:Se,retractPositionReference:te,labwareId:A,labwareEntities:ie,well:Ce}),ks=Ha?[]:[O(V,{pipetteId:C,labwareId:A,wellName:Ce,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],ja=Ce!=null?[O(V,{pipetteId:C,labwareId:A,wellName:Ce,wellLocation:sr}),...Gt>0?[O(nt,{isAirGap:!0,pipetteId:C,volume:Gt,flowRate:cr,pushOut:0,correctionVolume:Zn}),...Ht]:[],O(V,{pipetteId:C,labwareId:A,...Ue!=null?{speed:Ue}:{},wellName:Ce,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[B],offset:{x:Be,y:re,z:W}}}),...ve!=null&&ve.seconds>0?[O(he,{seconds:ve.seconds})]:[]]:[O(qe,{fixtureId:A,pipetteId:C,offset:{x:0,y:0,z:0}})],Qn=me===0&&ur?x:0,Tt=[O(nt,{pipetteId:C,volume:ke,flowRate:R,...Qn!=null?{pushOut:Qn}:{},correctionVolume:Fn}),...Ht],ln=Ce!=null?[O(V,{pipetteId:C,labwareId:A,...de!=null?{speed:de}:{},wellName:Ce,wellLocation:Er}),...F!=null&&F?.seconds>0?[O(he,{seconds:F.seconds})]:[]]:[],Nt=ur?[O(Sa,{pipetteId:C,flowRate:g})]:[],za=c.getByVolumeValue({liquidClass:P,pipetteSpecs:fe,tiprackDefUri:j,targetVolume:Me,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Ct=(Jn,Ny=!0)=>Me>0&&!(kr<ue.length-1&&et>0)&&!(L==="never"&&vr&&Jn)?[...Ny?ks:[],O(qt,{pipetteId:C}),O(Zt,{pipetteId:C,volume:Me,flowRate:be,...za>0?{correctionVolume:za}:{}}),...jt]:[],gt=Jn=>Ce!=null&&St?[O(Mt,{pipetteId:C,labwareId:A,wellName:Ce,...mt!=null?{mmFromEdge:mt}:{},zOffsetFromTop:Oe,...Qe!=null?{speed:Qe}:{}}),...Ct(Jn).length>0&&Ha?[O(V,{pipetteId:C,labwareId:A,wellName:Ce,wellLocation:Er})]:[]]:[];let Pr=[];if(I==null||!ur)Pr=[...gt(!0),...Ct(!0)];else if(I===Sn)Pr=[O(V,{pipetteId:C,labwareId:A,wellName:Ce,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),...Nt,...gt(!0),...Ct(!0)];else if(I===Hr){const Jn=Ct(!0);Pr=[...gt(!1),...Ct(!1),O(V,{pipetteId:C,labwareId:H,wellName:M,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),...Nt,...St&&!fr?[O(Mt,{pipetteId:C,labwareId:H,wellName:M,...mt!=null?{mmFromEdge:mt}:{},zOffsetFromTop:Oe,...Qe!=null?{speed:Qe}:{}})]:[],...Jn.length>0?[O(V,{pipetteId:C,labwareId:H,wellName:M,wellLocation:{origin:c.WELL_ORIGIN_TOP}})]:[],...Ct(!0,!1)]}else Pr=[...gt(!1),...Ct(!1),O(qe,{pipetteId:C,fixtureId:Object.values(ne).length>0?Object.values(ne)[0].id:Object.values(Lt)[0].id,offset:{x:0,y:0,z:0}}),...Nt,...Ct(!0,!1)];return[...ja,...Tt,...ln,...Pr]}),Xn=Q&&(rt===ht.length-1||L==="always")?[O(wn,{pipette:C,dropTipLocation:j,isReturnTip:Q})]:[];return[...ir,...Lr,...lr,...Ae,...rn,...Kn,...sn,...Or,...zt,...Rr,...Xn]}),Jr];return ce(jn,t,r)},EA=(e,t,r)=>{const n=t.moduleEntities[e.moduleId].pythonName;return{commands:[{commandType:"heaterShaker/closeLabwareLatch",key:D(),params:{moduleId:e.moduleId}}],python:`${n}.close_labware_latch()`}},Xm=(e,t,r)=>{const n=t.moduleEntities[e.moduleId].pythonName;return{commands:[{commandType:"heaterShaker/deactivateHeater",key:D(),params:{moduleId:e.moduleId}}],python:`${n}.deactivate_heater()`}},wA=["1","4","7","10"],AA=(e,t,r)=>{const{pipetteEntities:n,labwareEntities:a,moduleEntities:s}=t,o=r.modules[e.moduleId].slot,i=Object.keys(n)[0],l=n[i]?.spec;if(!((l?.displayCategory==="FLEX"||l?.channels===96)??!1)&&W_(r.labware,a,o)){const d=wA.includes(o)?"right":"left";return{errors:[Gy(d)]}}const p=s[e.moduleId].pythonName;return{commands:[{commandType:"heaterShaker/openLabwareLatch",key:D(),params:{moduleId:e.moduleId}}],python:`${p}.open_labware_latch()`}},SA=(e,t,r)=>{const{moduleEntities:n}=t,{moduleId:a,rpm:s}=e;if(a===null)return{errors:[X()]};if(n[a]?.type!==c.HEATERSHAKER_MODULE_TYPE)throw new Error(`expected module ${a} to be heaterShaker, got ${n[a]?.type}`);const o=n[a].pythonName;return{commands:[{commandType:"heaterShaker/setAndWaitForShakeSpeed",key:D(),params:{moduleId:a,rpm:s}}],python:`${o}.set_and_wait_for_shake_speed(${s})`}},Zm=(e,t,r)=>{const n=t.moduleEntities[e.moduleId].pythonName;return{commands:[{commandType:"heaterShaker/deactivateShaker",key:D(),params:{moduleId:e.moduleId}}],python:`${n}.deactivate_shaker()`}},LA=(e,t,r)=>{const{timerHours:n,timerMinutes:a,timerSeconds:s,latchOpen:o,targetTemperature:i,rpm:l}=e;if(e.moduleId==null)return{errors:[X()]};const u=At(r,e.moduleId),p=e.moduleId??"";if(u==null)return{errors:[X()]};const d=[];if(o||d.push(U(EA,{moduleId:p})),i===null?d.push(U(Xm,{moduleId:p})):d.push(U(e_,{moduleId:p,celsius:i})),l===null&&"targetSpeed"in u&&u.targetSpeed!==null?d.push(U(Zm,{moduleId:p})):l!==null&&d.push(U(SA,{moduleId:p,rpm:l})),[n,a,s].some(_=>_!=null&&_!==0)){i!==null&&d.push(U(n_,{moduleId:p,celsius:i}));const _=(n??0)*3600+(a??0)*60+(s??0);d.push(U(he,{seconds:_})),d.push(U(Zm,{moduleId:p})),d.push(U(Xm,{moduleId:p}))}return o&&d.push(U(AA,{moduleId:p})),ce(d,t,r)},wy=(e,t,r)=>{const{moduleId:n}=e,{moduleEntities:a,labwareEntities:s}=t,o=[],i=a[n].pythonName,u=Object.values(r.labware).filter(f=>f.stack.includes(n)).find(f=>f.stack.find(_=>s[_]?.def.allowedRoles?.includes("lid")&&s[_]?.def.parameters.loadName!=="opentrons_tough_pcr_auto_sealing_lid")),p=u!=null?gc(u.stack):null,d=p!=null?s[p].def.metadata.displayName:null;return d!=null&&o.push(tb({lidDisplayName:d})),o.length>0?{errors:o}:{commands:[{commandType:"thermocycler/closeLid",key:D(),params:{moduleId:n}}],python:`${i}.close_lid()`}},Ay=(e,t,r)=>{const{moduleId:n,celsius:a}=e,s=t.moduleEntities[n].pythonName;return{commands:[{commandType:"thermocycler/setTargetLidTemperature",key:D(),params:{moduleId:n,celsius:a}}],python:`${s}.set_lid_temperature(${a})`}},OA=(e,t,r)=>{const{moduleId:n,profileElements:a,profileTargetLidTemp:s,profileVolume:o}=e,i=Rs(r,n);if(i===null)return{errors:[X()]};const l=t.moduleEntities[n].pythonName,u=[];i.lidOpen!==!1&&u.push(U(wy,{moduleId:n})),s!==i.lidTargetTemp&&u.push(U(Ay,{moduleId:n,celsius:s}));const p=`${l}_task_${i.numProfilesStarted+1}`;return u.push(U(Eg,{moduleId:n,profileElements:a,blockMaxVolumeUl:o,taskId:p})),ce(u,t,r)},RA=()=>({lidOpen:!1,lidClosed:!1,setBlockTemperature:!1,deactivateBlockTemperature:!1,setLidTemperature:!1,deactivateLidTemperature:!1}),kA=(e,t)=>!e.lidOpen&&t.lidOpen?{lidOpen:!0}:{},vA=(e,t)=>e.lidOpen&&!t.lidOpen||e.lidOpen===null&&!t.lidOpen?{lidClosed:!0}:{},PA=(e,t)=>t==null?e.currentBlockActivity.type==="blockDeactivated":e.currentBlockActivity.type==="blockTargetTemp"&&e.currentBlockActivity.blockTargetTemp===t,NA=(e,t)=>{const r={...kA(e,t)},n={...vA(e,t)},a=!PA(e,t.blockTargetTemp),s=a&&t.blockTargetTemp===null,o=a&&t.blockTargetTemp!==null,i=e.lidTargetTemp!==t.lidTargetTemp,l=i&&t.lidTargetTemp===null,u=i&&t.lidTargetTemp!==null;return{...RA(),...r,...n,setBlockTemperature:o,deactivateBlockTemperature:s,setLidTemperature:u,deactivateLidTemperature:l}},CA=(e,t,r)=>{const n=t.moduleEntities[e.moduleId].pythonName;return{commands:[{commandType:"thermocycler/deactivateBlock",key:D(),params:{moduleId:e.moduleId}}],python:`${n}.deactivate_block()`}},DA=(e,t,r)=>{const n=t.moduleEntities[e.moduleId].pythonName;return{commands:[{commandType:"thermocycler/deactivateLid",key:D(),params:{moduleId:e.moduleId}}],python:`${n}.deactivate_lid()`}},MA=(e,t,r)=>{const n=t.moduleEntities[e.moduleId].pythonName;return{commands:[{commandType:"thermocycler/openLid",key:D(),params:{moduleId:e.moduleId}}],python:`${n}.open_lid()`}},FA=(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:D(),params:{moduleId:e.moduleId,celsius:e.celsius}}],python:`${n}.set_block_temperature(${e.celsius})`}},qA=(e,t,r)=>{const n=Rs(r,e.moduleId);if(n===null)return{errors:[X()]};if(n.currentBlockActivity.type==="profile")return{errors:[$y()]};const{lidOpen:a,lidClosed:s,setBlockTemperature:o,deactivateBlockTemperature:i,setLidTemperature:l,deactivateLidTemperature:u}=NA(n,e),{blockTargetTemp:p,lidTargetTemp:d}=e,f=[];return a&&f.push(U(MA,{moduleId:e.moduleId})),s&&f.push(U(wy,{moduleId:e.moduleId})),i&&f.push(U(CA,{moduleId:e.moduleId})),p!==null&&o&&f.push(U(FA,{moduleId:e.moduleId,celsius:p})),u&&f.push(U(DA,{moduleId:e.moduleId})),d!==null&&l&&f.push(U(Ay,{moduleId:e.moduleId,celsius:d})),ce(f,t,r)};var Ou,Qm;function UA(){if(Qm)return Ou;Qm=1;var e=ba(),t=P_(),r=N_();function n(a,s){return r(t(a,s,e),a+"")}return Ou=n,Ou}var Ru,Jm;function BA(){if(Jm)return Ru;Jm=1;var e=xr(),t=Qt();function r(n){return t(n)&&e(n)}return Ru=r,Ru}var ku,eh;function $A(){if(eh)return ku;eh=1;var e=Mh(),t=Ea(),r=zh(),n=qh(),a=BA(),s=Math.max;function o(i){if(!(i&&i.length))return[];var l=0;return i=e(i,function(u){if(a(u))return l=s(u.length,l),!0}),n(l,function(u){return t(i,r(u))})}return ku=o,ku}var vu,th;function VA(){if(th)return vu;th=1;var e=UA(),t=$A(),r=e(t);return vu=r,vu}var xA=VA();const HA=xe(xA),jA=(e,t,r)=>{const{aspirateAirGapVolume:n,aspirateDelay:a,aspirateFlowRateUlSec:s,aspiratePositionReference:o,aspirateRetractDelay:i,aspirateRetractPositionReference:l,aspirateRetractSpeed:u,aspirateRetractXOffset:p,aspirateRetractYOffset:d,aspirateRetractZOffset:f,aspirateSubmergeDelay:_,aspirateSubmergePositionReference:m,aspirateSubmergeSpeed:h,aspirateSubmergeXOffset:b,aspirateSubmergeYOffset:T,aspirateSubmergeZOffset:y,aspirateXOffset:S,aspirateYOffset:w,aspirateZOffset:g,blowoutFlowRateUlSec:I,blowoutLocation:L,changeTip:A,destLabware:E,destWells:k,dispenseAirGapVolume:R,dispenseDelay:B,dispenseFlowRateUlSec:F,dispensePositionReference:te,dispenseRetractDelay:de,dispenseRetractPositionReference:_e,dispenseRetractSpeed:oe,dispenseRetractXOffset:Se,dispenseRetractYOffset:ve,dispenseRetractZOffset:ze,dispenseSubmergeDelay:Ue,dispenseSubmergePositionReference:J,dispenseSubmergeSpeed:Le,dispenseSubmergeXOffset:Ge,dispenseSubmergeYOffset:Be,dispenseSubmergeZOffset:re,dispenseXOffset:W,dispenseYOffset:Y,dispenseZOffset:P,dropTipLocation:v,liquidClass:$,mixBeforeAspirate:C,mixInDestination:ae,pipette:q,preWetTip:x,primaryNozzle:H,pushOut:M,sourceLabware:G,nozzles:ye,sourceWells:$e,tipRack:Xe,tipTracking:Ve,tiprackSelected:pe,tipsSelected:Ze,touchTipAfterAspirate:ft,touchTipAfterAspirateMmFromEdge:St,touchTipAfterAspirateOffsetMmFromTop:mt,touchTipAfterAspirateSpeed:Oe,touchTipAfterDispense:Qe,touchTipAfterDispenseMmFromEdge:Re,touchTipAfterDispenseOffsetMmFromTop:ke,touchTipAfterDispenseSpeed:Pe,volume:ie,stepNumber:ne}=e,{pipetteEntities:Lt,trashBinEntities:We,wasteChuteEntities:K,labwareEntities:Ie}=t,fr=Ln(Ie,K,We,E),Je=Ie[G]?.def.parameters.quirks?.includes("touchTipDisabled");if(!(fr==="labware"&&k!=null&&$e.length===k.length||(fr==="wasteChute"||fr==="trashBin")&&k==null&&$e.length>=1))throw new Error(`Transfer command creator expected N:N source-to-dest wells ratio. Got ${$e.length}:${k?.length} in labware`);const Me="transfer",me=[];(!r.pipettes[q]||!Lt[q])&&me.push(ut({pipette:q})),(!G||!r.labware[G])&&me.push(ct({actionName:Me,labware:G}));const et=r.labware[E]!=null?z(r.labware[E].stack):"",Gr=z(r.labware[G]?.stack),Ot=Object.keys(K).length>0,$a=K[v]!=null,Wr=We[v]!=null;Ot&&(et===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA||Gr===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)&&me.push(ha());const er=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],ot=er.length>0?er[0]:null,Q=Object.values(t.labwareEntities).find(({labwareDefURI:le})=>le===v),Rt=Q!=null&&c.getIsTiprack(Q.def),Te=r.tipState.pipettes[q]?.hasTip;if(v==null||Rt&&ot==null&&A!=="never"&&Te||!Rt&&!$a&&!Wr)return{errors:[yn()]};(!E||!Ie[E]&&!K[E]&&!We[E])&&me.push(ih());let kt,ee;if(A==="never"){const le=r.tipState.pipettes[q]?.tiprackURI;kt=t.labwareEntities[le??""],ee=kt?.labwareDefURI}else kt=Object.values(Ie).find(({labwareDefURI:le})=>le===Xe),ee=Xe;if(kt==null&&(A==="never"?me.push(Ut({actionName:Me,pipette:q})):me.push(ct({actionName:Me,labware:ee}))),me.length>0)return{errors:me};const j=n||0,it=R||0,fe=Os(q,t,ee)-j;if(fe<=0||!isFinite(fe))return me.push(Xa({volume:ie,maxVolume:fe,actionName:Me})),{errors:me};const tt=Math.ceil(ie/fe);if(!isFinite(tt)||tt<=0)return me.push(Xa({volume:ie,maxVolume:tt,actionName:Me})),{errors:me};const $t=ie/tt,vt=Array(tt).fill($t),Yr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[m],offset:{x:b,y:T,z:y}},tr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[l],offset:{x:p,y:d,z:f}},mr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[J],offset:{x:Ge,y:Be,z:re}},rr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[_e],offset:{x:Se,y:ve,z:ze}},{spec:Ee,name:Pt,pythonName:hr}=Lt[q],{tipracks:_r}=Ua(q,ee,t,r,H,ye),Kr=c.getAllLiquidClassDefs()[$===c.NONE_LIQUID_CLASS_NAME||$==null?c.WATER_LIQUID_CLASS_NAME:$].byPipette?.find(({pipetteModel:le})=>le===c.getFlexNameConversion(Ee))?.byTipType.find(({tiprack:le})=>le===ee)??null,yr=c.getByVolumeValue({liquidClass:$,pipetteSpecs:Ee,tiprackDefUri:ee,targetVolume:$t,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Xr=c.getByVolumeValue({liquidClass:$,pipetteSpecs:Ee,tiprackDefUri:ee,targetVolume:$t,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Zr=We[E]?.pythonName??K[E]?.pythonName,Fn=We[v]?.pythonName??K[v]?.pythonName,qn=L==null?null:We[L]?.pythonName??K[L]?.pythonName,br=Ie[G].pythonName,nr=Ie[E]?.pythonName,Un=$e.map(le=>`${br}[${N(le)}]`).join(", "),Qr=k!=null&&nr!=null?k.map(le=>`${nr}[${N(le)}]`).join(", "):null,Bn=[`name=${N(`${e.commandCreatorFnName}_step_${ne}`)}`,...$!=null?[`base_liquid_class=${Fa($,!0)}`]:[],`properties=${As({args:e,pipetteName:c.isFlexPipette(Pt)?c.getFlexNameConversion(Ee):Pt,tiprackUri:ee,liquidClassValuesForTip:Kr})}`],Tr=`${ge}.define_liquid_class(
|
|
137
|
-
${Z(
|
|
136
|
+
)`}),zn={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[_],offset:{x:h,y:b,z:T}},en={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[i],offset:{x:u,y:p,z:d}},or={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[He],offset:{x:te,y:Ee,z:ze}},wr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[ee],offset:{x:_e,y:le,z:be}},jn=c.getByVolumeValue({liquidClass:P,pipetteSpecs:de,tiprackDefUri:j,targetVolume:et,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,za=c.getByVolumeValue({liquidClass:P,pipetteSpecs:de,tiprackDefUri:j,targetVolume:et,liquidHandlingAction:"multiDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??k,me=c.getByVolumeValue({liquidClass:P,pipetteSpecs:de,tiprackDefUri:j,targetVolume:Fe,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,se=c.getByVolumeValue({liquidClass:P,pipetteSpecs:de,tiprackDefUri:j,targetVolume:Fe,liquidHandlingAction:"multiDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??k,_t=Oy(E,nr),yt=qr({retractZOffset:d,retractPositionReference:i,labwareId:z,labwareEntities:ue,well:D}),Ae=!yt&&D!=null?[O($,{pipetteId:N,labwareId:z,wellName:D,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],Gn=[...yn(_t,(oe,Ye)=>{const ir=oe.length,Sr=ke*ir,Ar=Sr+fe+tt,Wn=Ye===0,Yn=Ye===_t.length-1,bt=L==="always"||L==="once"&&Wn,Kn=c.LOW_VOLUME_PIPETTES.includes(rt)?[O(oa,{pipetteId:N,volume:Ar})]:[];let lr=[];if(bt){const De=xt?.shift();lr=[M($a,{pipette:N,nozzles:V,primaryNozzle:U,dropTipLocation:Q&&tr!=null?tr:W,tipRack:j,...ye===wt&&De!=null&&Ve!=null?{tipSelectionArgs:{tipRackId:Ve,tipWell:De}}:{}})]}const Lr=[O(Ut,{pipetteId:N})],Ht=c.getByVolumeValue({liquidClass:P,pipetteSpecs:de,tiprackDefUri:j,targetVolume:Fe,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,zt=R!=null?[O(he,{seconds:R.seconds})]:[],tn=Fe>0&&!bt&&!Wn&&fe===0&&I==null?[O(nt,{isAirGap:!0,pipetteId:N,volume:Fe,flowRate:se,...Ht>0?{correctionVolume:Ht}:{},pushOut:0}),...zt]:[],Or=[...Kr,...tn,...Kn,...Lr],ur=[O($,{pipetteId:N,labwareId:z,wellName:D,wellLocation:zn}),O($,{pipetteId:N,labwareId:z,...m!=null?{speed:m}:{},wellName:D,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[s],offset:{x:y,y:A,z:S}}}),...f!=null&&f.seconds>0?[O(he,{seconds:f.seconds})]:[]],rn=ae?Dr({pipette:N,volume:Sr,times:1,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:k,aspirateDelaySeconds:n?.seconds??0,dispenseDelaySeconds:R?.seconds??0,finalPushOut:0,invariantContext:t,liquidClass:P,tiprack:j,generatePython:!1}):[],Le=v!=null?Dr({pipette:N,volume:v.volume,times:v.times,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:k,aspirateDelaySeconds:n?.seconds,dispenseDelaySeconds:R?.seconds,finalPushOut:0,invariantContext:t,liquidClass:P,tiprack:j,generatePython:!1}):[],jt=n!=null?[O(he,{seconds:n.seconds})]:[],Rr=$e?[O(Mt,{pipetteId:N,labwareId:z,wellName:D,...ce!=null?{mmFromEdge:ce}:{},zOffsetFromTop:Qe,...mt!=null?{speed:mt}:{}}),...et>0&&yt?[O($,{pipetteId:N,labwareId:z,wellName:D,wellLocation:en})]:[]]:[],Tt=c.getByVolumeValue({liquidClass:P,pipetteSpecs:de,tiprackDefUri:j,targetVolume:et,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Gt=et>0?[...Ae,O(Qt,{pipetteId:N,volume:et,flowRate:jn,...Tt>0?{correctionVolume:Tt}:{}}),...jt]:[],Xn=c.getByVolumeValue({liquidClass:P,pipetteSpecs:de,tiprackDefUri:j,targetVolume:Ar,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,nn=c.getByVolumeValue({liquidClass:P,pipetteSpecs:de,tiprackDefUri:j,targetVolume:tt,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,an=tt!=null&&tt>0?[O(nt,{pipetteId:N,volume:tt,flowRate:k,correctionVolume:nn,pushOut:0}),...zt]:[],Zn=[O(_s,{pipetteId:N,volume:Ar,flowRate:a,correctionVolume:Xn}),...jt,...an],sn=[O($,{pipetteId:N,labwareId:z,...l!=null?{speed:l}:{},wellName:D,wellLocation:en}),...o!=null&&o?.seconds>0?[O(he,{seconds:o.seconds})]:[]],kr=yn(oe,(De,vr)=>{const on=vr===0,cr=vr===oe.length-1,Pr=Yn&&cr;let Wt=0,pr=k;on&&et>0?(Wt=et,pr=za):!on&&Fe>0&&tt===0&&(Wt=Fe,pr=se);const Jn=c.getByVolumeValue({liquidClass:P,pipetteSpecs:de,tiprackDefUri:j,targetVolume:Wt,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,ja=qr({retractZOffset:be,retractPositionReference:ee,labwareId:w,labwareEntities:ue,well:De}),Ps=ja?[]:[O($,{pipetteId:N,labwareId:w,wellName:De,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],Ga=De!=null?[O($,{pipetteId:N,labwareId:w,wellName:De,wellLocation:or}),...Wt>0?[O(nt,{isAirGap:!0,pipetteId:N,volume:Wt,flowRate:pr,pushOut:0,correctionVolume:Jn}),...zt]:[],O($,{pipetteId:N,labwareId:w,...Be!=null?{speed:Be}:{},wellName:De,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[B],offset:{x:Pe,y:Te,z:K}}}),...ve!=null&&ve.seconds>0?[O(he,{seconds:ve.seconds})]:[]]:[O(Ue,{fixtureId:w,pipetteId:N,offset:{x:0,y:0,z:0}})],ea=fe===0&&cr?H:0,gt=[O(nt,{pipetteId:N,volume:ke,flowRate:k,...ea!=null?{pushOut:ea}:{},correctionVolume:Un}),...zt],ln=De!=null?[O($,{pipetteId:N,labwareId:w,...pe!=null?{speed:pe}:{},wellName:De,wellLocation:wr}),...q!=null&&q?.seconds>0?[O(he,{seconds:q.seconds})]:[]]:[],Ct=cr?[O(Oa,{pipetteId:N,flowRate:g})]:[],Wa=c.getByVolumeValue({liquidClass:P,pipetteSpecs:de,tiprackDefUri:j,targetVolume:Fe,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Nt=(ta,By=!0)=>Fe>0&&!(vr<oe.length-1&&tt>0)&&!(L==="never"&&Pr&&ta)?[...By?Ps:[],O(Ut,{pipetteId:N}),O(Qt,{pipetteId:N,volume:Fe,flowRate:me,...Wa>0?{correctionVolume:Wa}:{}}),...jt]:[],It=ta=>De!=null&&At?[O(Mt,{pipetteId:N,labwareId:w,wellName:De,...ht!=null?{mmFromEdge:ht}:{},zOffsetFromTop:Oe,...Je!=null?{speed:Je}:{}}),...Nt(ta).length>0&&ja?[O($,{pipetteId:N,labwareId:w,wellName:De,wellLocation:wr})]:[]]:[];let Cr=[];if(I==null||!cr)Cr=[...It(!0),...Nt(!0)];else if(I===On)Cr=[O($,{pipetteId:N,labwareId:w,wellName:De,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),...Ct,...It(!0),...Nt(!0)];else if(I===Hr){const ta=Nt(!0);Cr=[...It(!1),...Nt(!1),O($,{pipetteId:N,labwareId:z,wellName:D,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),...Ct,...At&&!mr?[O(Mt,{pipetteId:N,labwareId:z,wellName:D,...ht!=null?{mmFromEdge:ht}:{},zOffsetFromTop:Oe,...Je!=null?{speed:Je}:{}})]:[],...ta.length>0?[O($,{pipetteId:N,labwareId:z,wellName:D,wellLocation:{origin:c.WELL_ORIGIN_TOP}})]:[],...Nt(!0,!1)]}else Cr=[...It(!1),...Nt(!1),O(Ue,{pipetteId:N,fixtureId:Object.values(re).length>0?Object.values(re)[0].id:Object.values(Lt)[0].id,offset:{x:0,y:0,z:0}}),...Ct,...Nt(!0,!1)];return[...Ga,...gt,...ln,...Cr]}),Qn=Q&&(Ye===_t.length-1||L==="always")?[O(An,{pipette:N,dropTipLocation:j,isReturnTip:Q})]:[];return[...lr,...Or,...ur,...Le,...rn,...Zn,...sn,...Rr,...Gt,...kr,...Qn]}),Jr];return ne(Gn,t,r)},RS=(e,t,r)=>{const n=t.moduleEntities[e.moduleId].pythonName;return{commands:[{commandType:"heaterShaker/closeLabwareLatch",key:F(),params:{moduleId:e.moduleId}}],python:`${n}.close_labware_latch()`}},th=(e,t,r)=>{const n=t.moduleEntities[e.moduleId].pythonName;return{commands:[{commandType:"heaterShaker/deactivateHeater",key:F(),params:{moduleId:e.moduleId}}],python:`${n}.deactivate_heater()`}},kS=["1","4","7","10"],vS=(e,t,r)=>{const{pipetteEntities:n,labwareEntities:a,moduleEntities:s}=t,o=r.modules[e.moduleId].slot,i=Object.keys(n)[0],l=n[i]?.spec;if(!((l?.displayCategory==="FLEX"||l?.channels===96)??!1)&&ty(r.labware,a,o)){const d=kS.includes(o)?"right":"left";return{errors:[Jy(d)]}}const p=s[e.moduleId].pythonName;return{commands:[{commandType:"heaterShaker/openLabwareLatch",key:F(),params:{moduleId:e.moduleId}}],python:`${p}.open_labware_latch()`}},PS=(e,t,r)=>{const{moduleEntities:n}=t,{moduleId:a,rpm:s}=e;if(a===null)return{errors:[X()]};if(n[a]?.type!==c.HEATERSHAKER_MODULE_TYPE)throw new Error(`expected module ${a} to be heaterShaker, got ${n[a]?.type}`);const o=n[a].pythonName;return{commands:[{commandType:"heaterShaker/setAndWaitForShakeSpeed",key:F(),params:{moduleId:a,rpm:s}}],python:`${o}.set_and_wait_for_shake_speed(${s})`}},rh=(e,t,r)=>{const n=t.moduleEntities[e.moduleId].pythonName;return{commands:[{commandType:"heaterShaker/deactivateShaker",key:F(),params:{moduleId:e.moduleId}}],python:`${n}.deactivate_shaker()`}},CS=(e,t,r)=>{const{timerHours:n,timerMinutes:a,timerSeconds:s,latchOpen:o,targetTemperature:i,rpm:l}=e;if(e.moduleId==null)return{errors:[X()]};const u=St(r,e.moduleId),p=e.moduleId??"";if(u==null)return{errors:[X()]};const d=[];if(o||d.push(M(RS,{moduleId:p})),i===null?d.push(M(th,{moduleId:p})):d.push(M(s_,{moduleId:p,celsius:i})),l===null&&"targetSpeed"in u&&u.targetSpeed!==null?d.push(M(rh,{moduleId:p})):l!==null&&d.push(M(PS,{moduleId:p,rpm:l})),[n,a,s].some(_=>_!=null&&_!==0)){i!==null&&d.push(M(p_,{moduleId:p,celsius:i}));const _=(n??0)*3600+(a??0)*60+(s??0);d.push(M(he,{seconds:_})),d.push(M(rh,{moduleId:p})),d.push(M(th,{moduleId:p}))}return o&&d.push(M(vS,{moduleId:p})),ne(d,t,r)},vy=(e,t,r)=>{const{moduleId:n}=e,{moduleEntities:a,labwareEntities:s}=t,o=[],i=a[n].pythonName,u=Object.values(r.labware).filter(f=>f.stack.includes(n)).find(f=>f.stack.find(_=>s[_]?.def.allowedRoles?.includes("lid")&&s[_]?.def.parameters.loadName!=="opentrons_tough_pcr_auto_sealing_lid")),p=u!=null?Sc(u.stack):null,d=p!=null?s[p].def.metadata.displayName:null;return d!=null&&o.push(lb({lidDisplayName:d})),o.length>0?{errors:o}:{commands:[{commandType:"thermocycler/closeLid",key:F(),params:{moduleId:n}}],python:`${i}.close_lid()`}},Py=(e,t,r)=>{const{moduleId:n,celsius:a}=e,s=t.moduleEntities[n].pythonName;return{commands:[{commandType:"thermocycler/setTargetLidTemperature",key:F(),params:{moduleId:n,celsius:a}}],python:`${s}.set_lid_temperature(${a})`}},NS=(e,t,r)=>{const{moduleId:n,profileElements:a,profileTargetLidTemp:s,profileVolume:o}=e,i=vs(r,n);if(i===null)return{errors:[X()]};const l=t.moduleEntities[n].pythonName,u=[];i.lidOpen!==!1&&u.push(M(vy,{moduleId:n})),s!==i.lidTargetTemp&&u.push(M(Py,{moduleId:n,celsius:s}));const p=`${l}_task_${i.numProfilesStarted+1}`;return u.push(M(Rg,{moduleId:n,profileElements:a,blockMaxVolumeUl:o,taskId:p})),ne(u,t,r)},DS=()=>({lidOpen:!1,lidClosed:!1,setBlockTemperature:!1,deactivateBlockTemperature:!1,setLidTemperature:!1,deactivateLidTemperature:!1}),MS=(e,t)=>!e.lidOpen&&t.lidOpen?{lidOpen:!0}:{},FS=(e,t)=>e.lidOpen&&!t.lidOpen||e.lidOpen===null&&!t.lidOpen?{lidClosed:!0}:{},qS=(e,t)=>t==null?e.currentBlockActivity.type==="blockDeactivated":e.currentBlockActivity.type==="blockTargetTemp"&&e.currentBlockActivity.blockTargetTemp===t,US=(e,t)=>{const r={...MS(e,t)},n={...FS(e,t)},a=!qS(e,t.blockTargetTemp),s=a&&t.blockTargetTemp===null,o=a&&t.blockTargetTemp!==null,i=e.lidTargetTemp!==t.lidTargetTemp,l=i&&t.lidTargetTemp===null,u=i&&t.lidTargetTemp!==null;return{...DS(),...r,...n,setBlockTemperature:o,deactivateBlockTemperature:s,setLidTemperature:u,deactivateLidTemperature:l}},BS=(e,t,r)=>{const n=t.moduleEntities[e.moduleId].pythonName;return{commands:[{commandType:"thermocycler/deactivateBlock",key:F(),params:{moduleId:e.moduleId}}],python:`${n}.deactivate_block()`}},VS=(e,t,r)=>{const n=t.moduleEntities[e.moduleId].pythonName;return{commands:[{commandType:"thermocycler/deactivateLid",key:F(),params:{moduleId:e.moduleId}}],python:`${n}.deactivate_lid()`}},$S=(e,t,r)=>{const n=t.moduleEntities[e.moduleId].pythonName;return{commands:[{commandType:"thermocycler/openLid",key:F(),params:{moduleId:e.moduleId}}],python:`${n}.open_lid()`}},xS=(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:F(),params:{moduleId:e.moduleId,celsius:e.celsius}}],python:`${n}.set_block_temperature(${e.celsius})`}},HS=(e,t,r)=>{const n=vs(r,e.moduleId);if(n===null)return{errors:[X()]};if(n.currentBlockActivity.type==="profile")return{errors:[Wy()]};const{lidOpen:a,lidClosed:s,setBlockTemperature:o,deactivateBlockTemperature:i,setLidTemperature:l,deactivateLidTemperature:u}=US(n,e),{blockTargetTemp:p,lidTargetTemp:d}=e,f=[];return a&&f.push(M($S,{moduleId:e.moduleId})),s&&f.push(M(vy,{moduleId:e.moduleId})),i&&f.push(M(BS,{moduleId:e.moduleId})),p!==null&&o&&f.push(M(xS,{moduleId:e.moduleId,celsius:p})),u&&f.push(M(VS,{moduleId:e.moduleId})),d!==null&&l&&f.push(M(Py,{moduleId:e.moduleId,celsius:d})),ne(f,t,r)};var ku,nh;function zS(){if(nh)return ku;nh=1;var e=ga(),t=B_(),r=V_();function n(a,s){return r(t(a,s,e),a+"")}return ku=n,ku}var vu,ah;function jS(){if(ah)return vu;ah=1;var e=xr(),t=Jt();function r(n){return t(n)&&e(n)}return vu=r,vu}var Pu,sh;function GS(){if(sh)return Pu;sh=1;var e=Vh(),t=Sa(),r=Xh(),n=xh(),a=jS(),s=Math.max;function o(i){if(!(i&&i.length))return[];var l=0;return i=e(i,function(u){if(a(u))return l=s(u.length,l),!0}),n(l,function(u){return t(i,r(u))})}return Pu=o,Pu}var Cu,oh;function WS(){if(oh)return Cu;oh=1;var e=zS(),t=GS(),r=e(t);return Cu=r,Cu}var YS=WS();const KS=xe(YS),XS=(e,t,r)=>{const{aspirateAirGapVolume:n,aspirateDelay:a,aspirateFlowRateUlSec:s,aspiratePositionReference:o,aspirateRetractDelay:i,aspirateRetractPositionReference:l,aspirateRetractSpeed:u,aspirateRetractXOffset:p,aspirateRetractYOffset:d,aspirateRetractZOffset:f,aspirateSubmergeDelay:_,aspirateSubmergePositionReference:m,aspirateSubmergeSpeed:h,aspirateSubmergeXOffset:b,aspirateSubmergeYOffset:T,aspirateSubmergeZOffset:y,aspirateXOffset:A,aspirateYOffset:S,aspirateZOffset:g,blowoutFlowRateUlSec:I,blowoutLocation:L,changeTip:w,destLabware:E,destWells:R,dispenseAirGapVolume:k,dispenseDelay:B,dispenseFlowRateUlSec:q,dispensePositionReference:ee,dispenseRetractDelay:pe,dispenseRetractPositionReference:_e,dispenseRetractSpeed:le,dispenseRetractXOffset:be,dispenseRetractYOffset:ve,dispenseRetractZOffset:He,dispenseSubmergeDelay:Be,dispenseSubmergePositionReference:te,dispenseSubmergeSpeed:Ee,dispenseSubmergeXOffset:ze,dispenseSubmergeYOffset:Pe,dispenseSubmergeZOffset:Te,dispenseXOffset:K,dispenseYOffset:W,dispenseZOffset:P,dropTipLocation:v,liquidClass:V,mixBeforeAspirate:N,mixInDestination:ae,pipette:U,preWetTip:H,primaryNozzle:z,pushOut:D,sourceLabware:x,nozzles:ye,sourceWells:Ve,tipRack:Ze,tipTracking:$e,tiprackSelected:ce,tipsSelected:Qe,touchTipAfterAspirate:mt,touchTipAfterAspirateMmFromEdge:At,touchTipAfterAspirateOffsetMmFromTop:ht,touchTipAfterAspirateSpeed:Oe,touchTipAfterDispense:Je,touchTipAfterDispenseMmFromEdge:Re,touchTipAfterDispenseOffsetMmFromTop:ke,touchTipAfterDispenseSpeed:Ce,volume:ue,stepNumber:re}=e,{pipetteEntities:Lt,trashBinEntities:We,wasteChuteEntities:Y,labwareEntities:we}=t,mr=Rn(we,Y,We,E),et=we[x]?.def.parameters.quirks?.includes("touchTipDisabled");if(!(mr==="labware"&&R!=null&&Ve.length===R.length||(mr==="wasteChute"||mr==="trashBin")&&R==null&&Ve.length>=1))throw new Error(`Transfer command creator expected N:N source-to-dest wells ratio. Got ${Ve.length}:${R?.length} in labware`);const Fe="transfer",fe=[];(!r.pipettes[U]||!Lt[U])&&fe.push(ut({pipette:U})),(!x||!r.labware[x])&&fe.push(ct({actionName:Fe,labware:x}));const tt=r.labware[E]!=null?G(r.labware[E].stack):"",Gr=G(r.labware[x]?.stack),Ot=Object.keys(Y).length>0,xa=Y[v]!=null,Wr=We[v]!=null;Ot&&(tt===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA||Gr===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)&&fe.push(ya());const tr=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],ot=tr.length>0?tr[0]:null,Q=Object.values(t.labwareEntities).find(({labwareDefURI:se})=>se===v),Rt=Q!=null&&c.getIsTiprack(Q.def),ge=r.tipState.pipettes[U]?.hasTip;if(v==null||Rt&&ot==null&&w!=="never"&&ge||!Rt&&!xa&&!Wr)return{errors:[Tn()]};(!E||!we[E]&&!Y[E]&&!We[E])&&fe.push(dh());let kt,J;if(w==="never"){const se=r.tipState.pipettes[U]?.tiprackURI;kt=t.labwareEntities[se??""],J=kt?.labwareDefURI}else kt=Object.values(we).find(({labwareDefURI:se})=>se===Ze),J=Ze;if(kt==null&&(w==="never"?fe.push(Bt({actionName:Fe,pipette:U})):fe.push(ct({actionName:Fe,labware:J}))),fe.length>0)return{errors:fe};const j=n||0,it=k||0,de=ks(U,t,J)-j;if(de<=0||!isFinite(de))return fe.push(Ja({volume:ue,maxVolume:de,actionName:Fe})),{errors:fe};const rt=Math.ceil(ue/de);if(!isFinite(rt)||rt<=0)return fe.push(Ja({volume:ue,maxVolume:rt,actionName:Fe})),{errors:fe};const $t=ue/rt,vt=Array(rt).fill($t),Yr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[m],offset:{x:b,y:T,z:y}},rr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[l],offset:{x:p,y:d,z:f}},hr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[te],offset:{x:ze,y:Pe,z:Te}},nr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[_e],offset:{x:be,y:ve,z:He}},{spec:Se,name:Pt,pythonName:_r}=Lt[U],{tipracks:yr}=Va(U,J,t,r,z,ye),Kr=c.getAllLiquidClassDefs()[V===c.NONE_LIQUID_CLASS_NAME||V==null?c.WATER_LIQUID_CLASS_NAME:V].byPipette?.find(({pipetteModel:se})=>se===c.getFlexNameConversion(Se))?.byTipType.find(({tiprack:se})=>se===J)??null,br=c.getByVolumeValue({liquidClass:V,pipetteSpecs:Se,tiprackDefUri:J,targetVolume:$t,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Xr=c.getByVolumeValue({liquidClass:V,pipetteSpecs:Se,tiprackDefUri:J,targetVolume:$t,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Zr=We[E]?.pythonName??Y[E]?.pythonName,Un=We[v]?.pythonName??Y[v]?.pythonName,Bn=L==null?null:We[L]?.pythonName??Y[L]?.pythonName,Tr=we[x].pythonName,ar=we[E]?.pythonName,Vn=Ve.map(se=>`${Tr}[${C(se)}]`).join(", "),Qr=R!=null&&ar!=null?R.map(se=>`${ar}[${C(se)}]`).join(", "):null,$n=[`name=${C(`${e.commandCreatorFnName}_step_${re}`)}`,...V!=null?[`base_liquid_class=${Ua(V,!0)}`]:[],`properties=${Ls({args:e,pipetteName:c.isFlexPipette(Pt)?c.getFlexNameConversion(Se):Pt,tiprackUri:J,liquidClassValuesForTip:Kr})}`],gr=`${Ie}.define_liquid_class(
|
|
137
|
+
${Z($n.join(`,
|
|
138
138
|
`))},
|
|
139
|
-
)`,
|
|
140
|
-
${Z(
|
|
139
|
+
)`,sr=$e===wt&&ce!=null&&Qe!=null&&Qe.length>0?Ba({wellSets:Qe,nozzles:ye,channels:Se.channels,primaryNozzle:z}):null,xn=ce!=null?we[ce]?.pythonName:null,xt=sr?.map(se=>`${xn}[${C(se)}]`).join(", "),Ir=[`volume=${ue}`,`source=[${Vn}]`,`dest=${Qr!=null?`[${Qr}]`:Zr}`,`new_tip=${C(Rs(w))}`,...Rt?["return_tip=True",...Bn!=null?[`trash_location=${Bn}`]:[]]:[`trash_location=${Un}`,"keep_last_tip=True"],...Se.channels>1?["group_wells=False"]:[],...yr.filteredSortedTiprackIds.length>0?[Os({labwareEntities:we,tiprackIds:yr.filteredSortedTiprackIds})]:[],`liquid_class=${gr}`,...sr!=null&&xn!=null?[`tips=[${xt}]`]:[]],Er=()=>({commands:[],python:`${_r}.transfer_with_liquid_class(
|
|
140
|
+
${Z(Ir.join(`,
|
|
141
141
|
`))},
|
|
142
|
-
)`}),Vn=c.getByVolumeValue({liquidClass:$,pipetteSpecs:Ee,tiprackDefUri:ee,targetVolume:j,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??s,Jr=c.getByVolumeValue({liquidClass:$,pipetteSpecs:Ee,tiprackDefUri:ee,targetVolume:j,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??F,xn=c.getByVolumeValue({liquidClass:$,pipetteSpecs:Ee,tiprackDefUri:ee,targetVolume:it,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??s,en=c.getByVolumeValue({liquidClass:$,pipetteSpecs:Ee,tiprackDefUri:ee,targetVolume:it,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??F,sr=HA($e,k);let Er=null,Hn=null;const be=[...sr.reduce((le,ht,_t)=>{const[we,Ne]=ht,jn=vt.reduce((ue,rt,or)=>{const wr=_t===0&&or===0,Ar=_t+1===sr.length,Gn=or+1===vt.length&&Ar;let yt=!1;A==="always"?yt=!0:A==="once"?yt=wr:A==="perSource"?yt=we!==Er:A==="perDest"&&(yt=wr||Ne!==Hn);const Wn=c.LOW_VOLUME_PIPETTES.includes(Pt)?[O(sa,{pipetteId:q,volume:rt})]:[];let ir=[];if(yt){const gt=ar?.shift();ir=[U(Ba,{pipette:q,primaryNozzle:H,nozzles:ye,dropTipLocation:Rt&&ot!=null?ot:v,tipRack:ee,...ye!=null?{nozzles:ye}:{},...Ve===Et&>!=null&&pe!=null?{tipSelectionArgs:{tipRackId:pe,tipWell:gt}}:{}})]}const Sr=Ie[G]?.def.wells[we]?.depth??null,xt=c.getMmFromBottom(g,o,Sr),Ht=c.getMmFromBottom(y,m,Sr),tn=c.getMmFromBottom(f,l,Sr);xt!=null&&Ht!=null&&xt>Ht&&me.push(lh());const Lr=Fr({retractZOffset:f,retractPositionReference:l,labwareId:G,labwareEntities:Ie,well:we}),lr=!Lr&&we!=null?[O(V,{pipetteId:q,labwareId:G,wellName:we,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],rn=Fr({retractZOffset:ze,retractPositionReference:_e,labwareId:E,labwareEntities:Ie,well:Ne}),Ae=!rn&&Ne!=null?[O(V,{pipetteId:q,labwareId:E,wellName:Ne,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[];xt!=null&&tn!=null&&xt>tn&&me.push(uh());const jt=[O(V,{pipetteId:q,labwareId:G,wellName:we,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],Or=[O(qt,{pipetteId:q})],bt=c.getByVolumeValue({liquidClass:$,pipetteSpecs:Ee,tiprackDefUri:ee,targetVolume:it,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,zt=B!=null?[O(he,{seconds:B.seconds})]:[],Yn=it>0&&!yt&&(or>0||_t>0)?[O(nt,{isAirGap:!0,pipetteId:q,volume:it,flowRate:en,...bt>0?{correctionVolume:bt}:{},pushOut:0}),...zt]:[],nn=[...jt,...Yn,...Wn,...Or],an=[O(V,{pipetteId:q,labwareId:G,wellName:we,wellLocation:Yr}),O(V,{pipetteId:q,labwareId:G,...h!=null?{speed:h}:{},wellName:we,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[o],offset:{x:S,y:w,z:g}}}),..._!=null&&_.seconds>0?[O(he,{seconds:_.seconds})]:[]],Kn=x?Cr({pipette:q,volume:rt,times:1,aspirateFlowRateUlSec:s,dispenseFlowRateUlSec:F,aspirateDelaySeconds:a?.seconds??0,dispenseDelaySeconds:B?.seconds??0,finalPushOut:0,invariantContext:t,liquidClass:$,tiprack:ee,generatePython:!1}):[],sn=C!=null?Cr({pipette:q,volume:C.volume,times:C.times,aspirateFlowRateUlSec:s,dispenseFlowRateUlSec:F,aspirateDelaySeconds:a?.seconds,dispenseDelaySeconds:B?.seconds,finalPushOut:0,invariantContext:t,liquidClass:$,tiprack:ee,generatePython:!1}):[],Rr=a!=null?[O(he,{seconds:a.seconds})]:[],Xn=ft?[O(Mt,{pipetteId:q,labwareId:G,wellName:we,...St!=null?{mmFromEdge:St}:{},zOffsetFromTop:mt,...Oe!=null?{speed:Oe}:{}}),...j>0&&Lr?[O(V,{pipetteId:q,labwareId:G,wellName:we,wellLocation:tr})]:[]]:[],Ce=c.getByVolumeValue({liquidClass:$,pipetteSpecs:Ee,tiprackDefUri:ee,targetVolume:j,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,kr=j>0?[...lr,O(Zt,{pipetteId:q,volume:j,flowRate:Vn,...Ce>0?{correctionVolume:Ce}:{}}),...Rr]:[],on=[O(ms,{pipetteId:q,volume:rt,flowRate:s,...Xr>0?{correctionVolume:Xr}:{}}),...Rr],ur=[O(V,{pipetteId:q,labwareId:G,...u!=null?{speed:u}:{},wellName:we,wellLocation:tr}),...i!=null&&i?.seconds>0?[O(he,{seconds:i.seconds})]:[]],vr=c.getByVolumeValue({liquidClass:$,pipetteSpecs:Ee,tiprackDefUri:ee,targetVolume:j,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Gt=Ne!=null?[O(V,{pipetteId:q,labwareId:E,wellName:Ne,wellLocation:mr}),...j>0?[O(nt,{isAirGap:!0,pipetteId:q,volume:j,flowRate:Jr,pushOut:0,...vr>0?{correctionVolume:vr}:{}}),...zt]:[],O(V,{pipetteId:q,labwareId:E,...Le!=null?{speed:Le}:{},wellName:Ne,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[te],offset:{x:W,y:Y,z:P}}}),...Ue!=null&&Ue.seconds>0?[O(he,{seconds:Ue.seconds})]:[]]:[O(qe,{fixtureId:E,pipetteId:q,offset:{x:0,y:0,z:0}})],cr=ae!=null&&Ne!=null?0:M,Zn=[O(nt,{pipetteId:q,volume:rt,flowRate:F,...cr!=null?{pushOut:cr}:{},...yr>0?{correctionVolume:yr}:{}}),...zt],Ha=ae!=null&&Ne!=null?Cr({pipette:q,volume:ae.volume,times:ae.times,aspirateFlowRateUlSec:s,dispenseFlowRateUlSec:F,aspirateDelaySeconds:a?.seconds,dispenseDelaySeconds:B?.seconds,finalPushOut:M,invariantContext:t,liquidClass:$,tiprack:ee,generatePython:!1}):[],ks=Ne!=null?[O(V,{pipetteId:q,labwareId:E,...oe!=null?{speed:oe}:{},wellName:Ne,wellLocation:rr}),...de!=null&&de?.seconds>0?[O(he,{seconds:de.seconds})]:[]]:[],ja=O(Sa,{pipetteId:q,flowRate:I}),Qn=c.getByVolumeValue({liquidClass:$,pipetteSpecs:Ee,tiprackDefUri:ee,targetVolume:it,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Tt=(gt,Pr=!0)=>it>0&&!(A==="never"&&Gn&>)?[...Pr?Ae:[],O(qt,{pipetteId:q}),O(Zt,{pipetteId:q,volume:it,flowRate:xn,...Qn>0?{correctionVolume:Qn}:{}}),...Rr]:[],ln=gt=>Ne!=null&&Qe?[O(Mt,{pipetteId:q,labwareId:E,wellName:Ne,...Re!=null?{mmFromEdge:Re}:{},zOffsetFromTop:ke,...Pe!=null?{speed:Pe}:{}}),...Tt(gt).length>0&&rn?[O(V,{pipetteId:q,labwareId:E,wellName:Ne,wellLocation:rr})]:[]]:[];let Nt=[];switch(L){case null:case void 0:Nt=[...ln(!0),...Tt(!0)];break;case Sn:Nt=[ja,...ln(!0),...Tt(!0)];break;case Hr:Nt=[...ln(!0),...Tt(!1),O(V,{pipetteId:q,labwareId:G,wellName:we,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),ja,...Qe&&!Je?[O(Mt,{pipetteId:q,labwareId:G,wellName:we,...Re!=null?{mmFromEdge:Re}:{},zOffsetFromTop:ke,...Pe!=null?{speed:Pe}:{}})]:[],...Tt(!0).length>0?[O(V,{pipetteId:q,labwareId:G,wellName:we,wellLocation:{origin:c.WELL_ORIGIN_TOP}})]:[],...Tt(!0,!1)];break;default:L in We?Nt=[...ln(!1),...Tt(!1),O(by,{pipetteId:q,flowRate:I,trashId:L}),...Tt(!0,!1)]:L in K&&(Nt=[O(Ty,{pipetteId:q,flowRate:I,wasteChuteId:L}),...Tt(!0,!1)]);break}const za=Rt&&(_t===sr.length-1||A==="always")?[O(wn,{pipette:q,dropTipLocation:ee,isReturnTip:Rt})]:[],Ct=[...ir,...nn,...an,...sn,...Kn,...on,...ur,...Xn,...kr,...Gt,...Zn,...Ha,...ks,...Nt,...za];return Er=we,Hn=Ne,[...ue,...Ct]},[]);return[...le,...jn]},[]),Ir];return ce(be,t,r)},Sy=(e,t,r)=>{const n=`[${e.task_ids.join(", ")}]`,a=`${ge}.wait_for_tasks(${n})`;return{commands:[{key:D(),commandType:"waitForTasks",params:e}],python:a}},zA=(e,t,r)=>{const{waitCondition:n}=e;return n==="thermocyclerProfileComplete"?GA(e,t,r):n==="vacuumProfileComplete"||n==="vacuumStateComplete"?WA(e,t,r):{errors:[ub(n)]}},GA=(e,t,r)=>{const{moduleId:n}=e,a=[],s=Rs(r,n);if(s==null)return{errors:[X()]};if(s.currentBlockActivity.type!=="profile")return{errors:[xc()]};const{taskId:o}=s.currentBlockActivity;return o==null?{errors:[xc()]}:(a.push(U(Sy,{task_ids:[o]})),ce(a,t,r))},WA=(e,t,r)=>{const{moduleId:n}=e,a=[],s=st(r,n);if(s==null)return{errors:[X()]};if(s.currentPumpActivity.type!=="timedHold"&&s.currentPumpActivity.type!=="profile")return{errors:[lb()]};const o=s.currentPumpActivity.taskId;return a.push(U(Sy,{task_ids:[o]})),ce(a,t,r)};var Pu,rh;function YA(){if(rh)return Pu;rh=1;var e=k_(),t=1,r=4;function n(a){return e(a,t|r)}return Pu=n,Pu}var KA=YA();const XA=xe(KA),Ly=["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"],Br="p300SingleId",ca="p300MultiId",Gu="p100096Id",Wu="sourcePlateId",Yu="destPlateId",Ku="troughId",ZA="A1",QA="tiprack1Id",JA={isAirGap:!0},Wa=c.fixture96Plate,nh=c.fixture12Trough,Ya=c.fixtureTiprack10ul,Dt=c.fixtureTiprack300ul,un=c.fixtureTiprack1000ul,Ka=c.fixtureTiprackAdapter,Oy={OT_PD_DISABLE_MODULE_RESTRICTIONS:!1};function Ry(e){return Ly.reduce((t,r)=>({...t,[r]:e?ga:se}),{})}function eS(e,t){return Array.from("ABCDEFGH").map(r=>`${r}${e}`).reduce((r,n)=>({...r,[n]:t}),{})}function ky(){const e={[Wu]:{id:Wu,pythonName:"mock_source_plate",labwareDefURI:c.getLabwareDefURI(Wa),def:Wa},[Yu]:{id:Yu,pythonName:"mock_dest_plate",labwareDefURI:c.getLabwareDefURI(Wa),def:Wa},[Ku]:{id:Ku,pythonName:"mock_trough",labwareDefURI:c.getLabwareDefURI(nh),def:nh},tiprack1Id:{id:"tiprack1Id",pythonName:"mock_tip_rack_1",labwareDefURI:c.getLabwareDefURI(Dt),def:Dt},tiprack2Id:{id:"tiprack2Id",pythonName:"mock_tip_rack_2",labwareDefURI:c.getLabwareDefURI(Dt),def:Dt},tiprack3Id:{id:"tiprack3Id",pythonName:"mock_tip_rack_3",labwareDefURI:c.getLabwareDefURI(Dt),def:Dt},tiprack4AdapterId:{id:"tiprack4AdapterId",pythonName:"mock_adapter_4",labwareDefURI:c.getLabwareDefURI(Ka),def:Ka},tiprack5AdapterId:{id:"tiprack5AdapterId",pythonName:"mock_adapter_5",labwareDefURI:c.getLabwareDefURI(Ka),def:Ka},tiprack4Id:{id:"tiprack4Id",pythonName:"mock_tip_rack_4",labwareDefURI:c.getLabwareDefURI(un),def:un},tiprack5Id:{id:"tiprack5Id",pythonName:"mock_tip_rack_5",labwareDefURI:c.getLabwareDefURI(un),def:un}},t={},r={[Cu]:{id:Cu,location:"cutoutA3",pythonName:"trash_bin_1"}},n={p10SingleId:{name:"p10_single",id:"p10SingleId",pythonName:"mock_pipette_p10",tiprackDefURI:[c.getLabwareDefURI(Ya)],tiprackLabwareDef:[Ya],spec:c.fixtureP10SingleV2Specs},p10MultiId:{name:"p10_multi",id:"p10MultiId",tiprackDefURI:[c.getLabwareDefURI(Ya)],tiprackLabwareDef:[Ya],spec:c.fixtureP10MultiV2Specs,pythonName:"mock_pipette_p10_multi"},[Br]:{name:"p300_single",id:Br,tiprackDefURI:[c.getLabwareDefURI(Dt)],tiprackLabwareDef:[Dt],spec:c.fixtureP300SingleV2Specs,pythonName:"mock_pipette"},[ca]:{name:"p300_multi",id:ca,tiprackDefURI:[c.getLabwareDefURI(Dt)],tiprackLabwareDef:[Dt],spec:c.fixtureP300MultiV2Specs,pythonName:"mock_pipette_p300_multi"},[Gu]:{name:"p1000_96",id:Gu,tiprackDefURI:[c.getLabwareDefURI(un)],tiprackLabwareDef:[un],spec:c.fixtureP100096V2Specs,pythonName:"mock_pipette_p1000_96"}};return{labwareEntities:e,moduleEntities:t,pipetteEntities:n,trashBinEntities:r,wasteChuteEntities:{},stagingAreaEntities:{},gripperEntities:{},liquidEntities:{},config:Oy}}const zr=e=>{const{invariantContext:t,labwareLocations:r,moduleLocations:n,pipetteLocations:a,tiprackSetting:s}=e,o=Tc({invariantContext:t,labwareLocations:r,moduleLocations:n||{},pipetteLocations:a});return o.tipState.tipracks=Xt(s,i=>Ry(i)),o},Mn=()=>({pipetteLocations:{[Br]:{mount:"left",tiprackId:"tiprack1Id"},[ca]:{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:{}}),vy=()=>({pipetteLocations:{[Br]:{mount:"left"},[ca]:{mount:"right"}},labwareLocations:{tiprack1Id:{stack:["tiprack1Id","B1"]},tiprack2Id:{stack:["tiprack2Id","A2"]},sourcePlateId:{stack:["sourcePlateId","offDeck"]},destPlateId:{stack:["destPlateId","C2"]}},moduleLocations:{}}),Py=e=>zr({...Mn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}}),tS=e=>zr({...vy(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}}),rS=e=>({robotState:Py(e),warnings:[]}),nS=e=>{const t=zr({...Mn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}});return t.tipState.pipettes[Br]={hasTip:!0,tiprackURI:"tiprack1Id"},t},aS=e=>{const t=zr({...Mn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0}});return t.tipState.pipettes[Br]={hasTip:!0,tiprackURI:"tiprack1Id"},t.tipState.tipracks.tiprack1Id.A1=se,t},sS=e=>zr({...Mn(),invariantContext:e,tiprackSetting:{tiprack1Id:!1,tiprack2Id:!1}}),oS=({temperatureModuleId:e,thermocyclerId:t})=>{const r=ky();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=zr({...Mn(),invariantContext:r,tiprackSetting:{tiprack1Id:!0}});return n.modules={[e]:{slot:"3",moduleState:{type:c.TEMPERATURE_MODULE_TYPE,status:Ta,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}},iS=(e,t,r,n)=>{const a=XA(e);return a.modules[t].moduleState={type:c.TEMPERATURE_MODULE_TYPE,targetTemperature:n,status:r},a};exports.ABSORBANCE_READER_INITIAL_STATE=yh;exports.AIR=je;exports.AIR_GAP_META=JA;exports.AIR_GAP_OFFSET_FROM_TOP=Nu;exports.AUTOMATIC=Qu;exports.BOTTOM_UP_LABWARE_POOL_KEYS=Yt;exports.BOTTOM_UP_STORED_LABWARE_URI_KEYS=Tb;exports.CLEAN=ga;exports.COLUMN_4_SLOTS=De;exports.CUSTOM_LABWARE_DICT_NAME=hs;exports.DEFAULT_BLOWOUT_WELL=ZA;exports.DEFAULT_CONFIG=Oy;exports.DEFAULT_PIPETTE=Br;exports.DEST_LABWARE=Yu;exports.DEST_WELL_BLOWOUT_DESTINATION=Sn;exports.DIRTY=Wt;exports.EMPTY=se;exports.FAKE_HOPPER_LOCATION_MAP=Sh;exports.FIXED_TRASH_ID=Cu;exports.FLEX_STACKER_MODULE_INITIAL_STATE=Th;exports.FLEX_TRASH_DEF_URI=yb;exports.GRIPPER_LOCATION=Eh;exports.HEATERSHAKER_MODULE_INITIAL_STATE=_h;exports.HOPPER_FAKE_LOCATIONS=Ah;exports.HOPPER_STACKER_LOCATION=He;exports.INDENT=La;exports.MAGNETIC_BLOCK_INITIAL_STATE=bh;exports.MAGNETIC_MODULE_INITIAL_STATE=fh;exports.MANUAL=Et;exports.MIXED_WELL_COLOR=X_;exports.MODULES_WITH_COLLISION_ISSUES=dh;exports.MODULE_INITIAL_STATE_BY_TYPE=Ih;exports.MULTI_PIPETTE=ca;exports.OFF_DECK=oa;exports.OT2_TC_SLOTS=bb;exports.OT_2_TRASH_DEF_URI=_b;exports.PAPI_VERSION=Q_;exports.PD_APPLICATION_VERSION=xw;exports.PIPETTE_96=Gu;exports.PROTOCOL_CONTEXT_NAME=ge;exports.SLOT_LOCATIONS_TO_FAKE_HOPPER_LOCATIONS=gb;exports.SOURCE_LABWARE=Wu;exports.SOURCE_WELL_BLOWOUT_DESTINATION=Hr;exports.STAGING_AREA_SLOTS=wh;exports.TEMPERATURE_APPROACHING_TARGET=Zu;exports.TEMPERATURE_AT_TARGET=Xu;exports.TEMPERATURE_DEACTIVATED=Ta;exports.TEMPERATURE_MODULE_INITIAL_STATE=mh;exports.THERMOCYCLER_MODULE_INITIAL_STATE=hh;exports.TIPRACK_1=QA;exports.TOUCHED_PIPETTABLE_LABWARE=ju;exports.TROUGH_LABWARE=Ku;exports.VACUUM_AT_TARGET=Pb;exports.VACUUM_DEACTIVATED=vb;exports.VACUUM_MAX_PRESSURE_MBAR=kb;exports.VACUUM_MIN_PRESSURE_MBAR=Rb;exports.VACUUM_MODE_POWER=Du;exports.VACUUM_MODE_PRESSURE=Mu;exports.VACUUM_MODULE_INITIAL_STATE=gh;exports.VACUUM_PROGRAM_PROFILE=Eb;exports.VACUUM_PROGRAM_STATE=Ib;exports.VACUUM_STATE_PUMP_OFF=wb;exports.VACUUM_STATE_PUMP_ON=Ab;exports.VACUUM_STATE_VENT=Sb;exports.VACUUM_VENT_CLOSED=Ia;exports.VACUUM_VENT_OPEN=ns;exports.VACUUM_VENT_SET_CLOSED=Ob;exports.VACUUM_VENT_SET_OPEN=Lb;exports.ZERO_OFFSET=It;exports._getNextTip=yy;exports._wellContentsForLabware=Nw;exports.absorbanceReaderCloseInitialize=lA;exports.absorbanceReaderCloseLid=mc;exports.absorbanceReaderCloseRead=uA;exports.absorbanceReaderCollision=Ra;exports.absorbanceReaderInitialize=Kh;exports.absorbanceReaderOpenLid=ag;exports.absorbanceReaderRead=Xh;exports.absorbanceReaderStateGetter=Dn;exports.airGapLocationHelper=Mg;exports.aspirate=sg;exports.assignContainsAmongSiblings=Uc;exports.blowOutInWell=Zh;exports.captureImage=og;exports.column4StagingSlotIdFromFlexStackerShuttleAddressableArea=h_;exports.commandCreatorsTimeline=pw;exports.comment=ig;exports.consolidate=bA;exports.constructInvariantContextFromAnalysis=yw;exports.createEmptyLiquidState=u_;exports.createStagingAreaForInvariantContext=qu;exports.createTipLiquidState=c_;exports.curryCommandCreator=U;exports.curryWithoutPython=O;exports.deactivateTemperature=ug;exports.deckSlotKeyForFlexStackerShuttleAddressableArea=qg;exports.delay=he;exports.delayLocationHelper=Fg;exports.disengageMagnet=cg;exports.dispense=Qh;exports.dispenseLocationHelper=Cg;exports.distribute=IA;exports.dropTip=wn;exports.dropTipInPlace=hc;exports.dropTipInTrash=Iy;exports.dropTipInWasteChute=Ey;exports.engageMagnet=pg;exports.enrichRobotStateForStackGraphTraversals=bE;exports.flexStackerEmpty=dg;exports.flexStackerFillItems=fg;exports.flexStackerRetrieve=mg;exports.flexStackerStateGetter=dt;exports.flexStackerStore=hg;exports.formatChangeTipArg=Ls;exports.formatPyDict=Mr;exports.formatPyList=_c;exports.formatPyStr=N;exports.formatPyTuple=t_;exports.formatPyValue=pt;exports.formatPyWellLocation=An;exports.getAddressableAreaFromModule=qc;exports.getAddressableAreaNameFromLabwareLocation=dE;exports.getAllLargestStacks=M_;exports.getAllProvidedAddressableAreasFromDeckConfig=F_;exports.getAllWellsForLabware=K_;exports.getChunkForIndentingLists=_s;exports.getCustomLiquidClassProperties=As;exports.getCutoutFromSlot=py;exports.getCutoutIdByAddressableArea=a_;exports.getDefaultPrimaryNozzle=es;exports.getDefineLiquids=ay;exports.getDispenseAirGapLocation=p_;exports.getFlexStackerCutoutBaseDeckSlotId=Ic;exports.getFlexStackerShuttleAddressableArea=bs;exports.getFullStackFromLabwares=Ec;exports.getFullStackFromNodeTopDownRecursive=ws;exports.getHasNoWellsFromCCArgs=fw;exports.getInitialRobotStateStandard=Py;exports.getInitialRobotStateWithOffDeckLabwareStandard=tS;exports.getIsHeaterShakerEastWestMultiChannelPipette=Nn;exports.getIsHeaterShakerEastWestWithLatchOpen=Pn;exports.getIsHeaterShakerNorthSouthOfNonTiprackWithMultiChannelPipette=Ca;exports.getIsLabwareCompatibleWithStack=y_;exports.getIsRetractSafeForAirGap=Fr;exports.getIsSafePickupWithinTiprack=fy;exports.getIsSafePipetteMovement=wt;exports.getIsSlotAHopper=b_;exports.getIsSpaceInHopper=Lc;exports.getIsTallLabwareEastWestOfHeaterShaker=W_;exports.getLabwareHasLiquid=f_;exports.getLabwareIdOnHopper=$g;exports.getLabwareIdOnShuttle=Ac;exports.getLabwareSlot=Rn;exports.getLargestStackContainingLabware=D_;exports.getLargestStackInSlot=ys;exports.getLiquidClassName=Fa;exports.getLiquidIdsOnLabware=Mw;exports.getLiquidIdsOnLabwareStack=Dw;exports.getLoadAdapters=ey;exports.getLoadLabware=ry;exports.getLoadLidStacks=ty;exports.getLoadLiquidClasses=oy;exports.getLoadLiquids=sy;exports.getLoadModules=J_;exports.getLoadPipettes=ny;exports.getLoadTrashBins=iy;exports.getLoadWasteChute=ly;exports.getLocationTotalVolume=pr;exports.getModuleHasLiveTask=kn;exports.getModuleIdFromRobotStateStack=Oa;exports.getModuleState=At;exports.getNearestParentInStack=m_;exports.getNextRobotStateAndWarnings=Bc;exports.getNextRobotStateAndWarningsSingleCommand=G_;exports.getNextTiprack=Ua;exports.getNodeParentModuleId=cE;exports.getNozzleConfig=$c;exports.getPipetteIdFromCCArgs=dw;exports.getPipetteWithTipMaxVol=Os;exports.getProvidedAddressableAreasExposed=fE;exports.getPythonAssignTipRacksString=Ss;exports.getResultingTimelineFrameFromRunCommands=Tw;exports.getRobotInitialStateNoTipsRemain=sS;exports.getRobotStateAndWarningsStandard=rS;exports.getRobotStatePickedUpTipStandard=aS;exports.getRobotStateWithTipStandard=nS;exports.getSetStoredLabware=cy;exports.getSlotInLocationStack=z;exports.getStackForLabwareLocation=Fu;exports.getStackedOnNodeFromPdStack=q_;exports.getStateAndContextTempTCModules=oS;exports.getTargetTipsFromWellSets=qa;exports.getThermocyclerProfileRepetitionsForPython=hy;exports.getTipColumn=eS;exports.getTipColumnIndex=zu;exports.getTipColumnName=my;exports.getTipRowName=aa;exports.getTiprackHasTips=d_;exports.getTiprackTipstate=Ry;exports.getTopLocationInStack=gc;exports.getTopmostLabwareOnModuleFromStackRobotState=Ug;exports.getTransferPlanAndReferenceVolumes=wc;exports.getTrashBinAddressableAreaName=yc;exports.getTrashLocationFromAddressableAreaName=o_;exports.getTrashOrLabware=Ln;exports.getVolumesPerLiquid=Cw;exports.getWasteChuteAddressableAreaNamePip=s_;exports.getWellsForTips=bc;exports.heaterShaker=LA;exports.indentPyLines=Z;exports.labwareMatchesLabwareInHopper=Sc;exports.makeContext=ky;exports.makeInitialRobotState=Tc;exports.makeState=zr;exports.makeStateArgsLabwareOffDeck=vy;exports.makeStateArgsStandard=Mn;exports.mergeLiquid=dr;exports.mix=yA;exports.mixBlowoutLocationHelper=l_;exports.modulePipetteCollision=vn;exports.moveHelper=Dg;exports.moveLabware=Ig;exports.moveToAddressableArea=qe;exports.moveToAddressableAreaForDropTip=Jh;exports.pipetteAdjacentHeaterShakerWhileShaking=Cn;exports.pipetteIntoHeaterShakerLatchOpen=Da;exports.pipetteIntoHeaterShakerWhileShaking=Ma;exports.pythonCustomLabwareDict=Xw;exports.pythonDefRun=Kw;exports.pythonImports=Hw;exports.pythonMetadata=jw;exports.pythonRequirements=zw;exports.reduceCommandCreators=ce;exports.repeatArray=i_;exports.replaceTip=Ba;exports.resolveDeckSlotKeyForLabwareStackInSlot=__;exports.robotWithStatusAndTemp=iS;exports.setTemperature=e_;exports.sortLabwareBySlot=_y;exports.splitLiquid=Kt;exports.stepCommands=uy;exports.swatchColors=Z_;exports.thermocyclerPipetteCollision=Pa;exports.thermocyclerProfileStep=OA;exports.thermocyclerStateGetter=Rs;exports.thermocyclerStateStep=qA;exports.tiprackWellNamesFlat=Ly;exports.touchTip=Mt;exports.transfer=jA;exports.unrollThermocyclerProfile=Vc;exports.uuid=D;exports.vacuumCloseVent=wg;exports.vacuumModuleStateGetter=st;exports.vacuumOpenVent=Ag;exports.vacuumSetPumpPower=Lg;exports.vacuumSetPumpPressure=Og;exports.vacuumStartRunProfile=Pg;exports.vacuumStopPump=Ng;exports.waitForModuleTask=zA;exports.waitForTemperature=n_;exports.wellFillFromWellContents=qw;
|
|
142
|
+
)`}),Hn=c.getByVolumeValue({liquidClass:V,pipetteSpecs:Se,tiprackDefUri:J,targetVolume:j,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??s,Jr=c.getByVolumeValue({liquidClass:V,pipetteSpecs:Se,tiprackDefUri:J,targetVolume:j,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??q,zn=c.getByVolumeValue({liquidClass:V,pipetteSpecs:Se,tiprackDefUri:J,targetVolume:it,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??s,en=c.getByVolumeValue({liquidClass:V,pipetteSpecs:Se,tiprackDefUri:J,targetVolume:it,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??q,or=KS(Ve,R);let wr=null,jn=null;const me=[...or.reduce((se,_t,yt)=>{const[Ae,Ne]=_t,Gn=vt.reduce((oe,Ye,ir)=>{const Sr=yt===0&&ir===0,Ar=yt+1===or.length,Yn=ir+1===vt.length&&Ar;let bt=!1;w==="always"?bt=!0:w==="once"?bt=Sr:w==="perSource"?bt=Ae!==wr:w==="perDest"&&(bt=Sr||Ne!==jn);const Kn=c.LOW_VOLUME_PIPETTES.includes(Pt)?[O(oa,{pipetteId:U,volume:Ye})]:[];let lr=[];if(bt){const It=sr?.shift();lr=[M($a,{pipette:U,primaryNozzle:z,nozzles:ye,dropTipLocation:Rt&&ot!=null?ot:v,tipRack:J,...ye!=null?{nozzles:ye}:{},...$e===wt&&It!=null&&ce!=null?{tipSelectionArgs:{tipRackId:ce,tipWell:It}}:{}})]}const Lr=we[x]?.def.wells[Ae]?.depth??null,Ht=c.getMmFromBottom(g,o,Lr),zt=c.getMmFromBottom(y,m,Lr),tn=c.getMmFromBottom(f,l,Lr);Ht!=null&&zt!=null&&Ht>zt&&fe.push(fh());const Or=qr({retractZOffset:f,retractPositionReference:l,labwareId:x,labwareEntities:we,well:Ae}),ur=!Or&&Ae!=null?[O($,{pipetteId:U,labwareId:x,wellName:Ae,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],rn=qr({retractZOffset:He,retractPositionReference:_e,labwareId:E,labwareEntities:we,well:Ne}),Le=!rn&&Ne!=null?[O($,{pipetteId:U,labwareId:E,wellName:Ne,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[];Ht!=null&&tn!=null&&Ht>tn&&fe.push(mh());const jt=[O($,{pipetteId:U,labwareId:x,wellName:Ae,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],Rr=[O(Ut,{pipetteId:U})],Tt=c.getByVolumeValue({liquidClass:V,pipetteSpecs:Se,tiprackDefUri:J,targetVolume:it,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Gt=B!=null?[O(he,{seconds:B.seconds})]:[],Xn=it>0&&!bt&&(ir>0||yt>0)?[O(nt,{isAirGap:!0,pipetteId:U,volume:it,flowRate:en,...Tt>0?{correctionVolume:Tt}:{},pushOut:0}),...Gt]:[],nn=[...jt,...Xn,...Kn,...Rr],an=[O($,{pipetteId:U,labwareId:x,wellName:Ae,wellLocation:Yr}),O($,{pipetteId:U,labwareId:x,...h!=null?{speed:h}:{},wellName:Ae,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[o],offset:{x:A,y:S,z:g}}}),..._!=null&&_.seconds>0?[O(he,{seconds:_.seconds})]:[]],Zn=H?Dr({pipette:U,volume:Ye,times:1,aspirateFlowRateUlSec:s,dispenseFlowRateUlSec:q,aspirateDelaySeconds:a?.seconds??0,dispenseDelaySeconds:B?.seconds??0,finalPushOut:0,invariantContext:t,liquidClass:V,tiprack:J,generatePython:!1}):[],sn=N!=null?Dr({pipette:U,volume:N.volume,times:N.times,aspirateFlowRateUlSec:s,dispenseFlowRateUlSec:q,aspirateDelaySeconds:a?.seconds,dispenseDelaySeconds:B?.seconds,finalPushOut:0,invariantContext:t,liquidClass:V,tiprack:J,generatePython:!1}):[],kr=a!=null?[O(he,{seconds:a.seconds})]:[],Qn=mt?[O(Mt,{pipetteId:U,labwareId:x,wellName:Ae,...At!=null?{mmFromEdge:At}:{},zOffsetFromTop:ht,...Oe!=null?{speed:Oe}:{}}),...j>0&&Or?[O($,{pipetteId:U,labwareId:x,wellName:Ae,wellLocation:rr})]:[]]:[],De=c.getByVolumeValue({liquidClass:V,pipetteSpecs:Se,tiprackDefUri:J,targetVolume:j,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,vr=j>0?[...ur,O(Qt,{pipetteId:U,volume:j,flowRate:Hn,...De>0?{correctionVolume:De}:{}}),...kr]:[],on=[O(_s,{pipetteId:U,volume:Ye,flowRate:s,...Xr>0?{correctionVolume:Xr}:{}}),...kr],cr=[O($,{pipetteId:U,labwareId:x,...u!=null?{speed:u}:{},wellName:Ae,wellLocation:rr}),...i!=null&&i?.seconds>0?[O(he,{seconds:i.seconds})]:[]],Pr=c.getByVolumeValue({liquidClass:V,pipetteSpecs:Se,tiprackDefUri:J,targetVolume:j,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Wt=Ne!=null?[O($,{pipetteId:U,labwareId:E,wellName:Ne,wellLocation:hr}),...j>0?[O(nt,{isAirGap:!0,pipetteId:U,volume:j,flowRate:Jr,pushOut:0,...Pr>0?{correctionVolume:Pr}:{}}),...Gt]:[],O($,{pipetteId:U,labwareId:E,...Ee!=null?{speed:Ee}:{},wellName:Ne,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[ee],offset:{x:K,y:W,z:P}}}),...Be!=null&&Be.seconds>0?[O(he,{seconds:Be.seconds})]:[]]:[O(Ue,{fixtureId:E,pipetteId:U,offset:{x:0,y:0,z:0}})],pr=ae!=null&&Ne!=null?0:D,Jn=[O(nt,{pipetteId:U,volume:Ye,flowRate:q,...pr!=null?{pushOut:pr}:{},...br>0?{correctionVolume:br}:{}}),...Gt],ja=ae!=null&&Ne!=null?Dr({pipette:U,volume:ae.volume,times:ae.times,aspirateFlowRateUlSec:s,dispenseFlowRateUlSec:q,aspirateDelaySeconds:a?.seconds,dispenseDelaySeconds:B?.seconds,finalPushOut:D,invariantContext:t,liquidClass:V,tiprack:J,generatePython:!1}):[],Ps=Ne!=null?[O($,{pipetteId:U,labwareId:E,...le!=null?{speed:le}:{},wellName:Ne,wellLocation:nr}),...pe!=null&&pe?.seconds>0?[O(he,{seconds:pe.seconds})]:[]]:[],Ga=O(Oa,{pipetteId:U,flowRate:I}),ea=c.getByVolumeValue({liquidClass:V,pipetteSpecs:Se,tiprackDefUri:J,targetVolume:it,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,gt=(It,Cr=!0)=>it>0&&!(w==="never"&&Yn&&It)?[...Cr?Le:[],O(Ut,{pipetteId:U}),O(Qt,{pipetteId:U,volume:it,flowRate:zn,...ea>0?{correctionVolume:ea}:{}}),...kr]:[],ln=It=>Ne!=null&&Je?[O(Mt,{pipetteId:U,labwareId:E,wellName:Ne,...Re!=null?{mmFromEdge:Re}:{},zOffsetFromTop:ke,...Ce!=null?{speed:Ce}:{}}),...gt(It).length>0&&rn?[O($,{pipetteId:U,labwareId:E,wellName:Ne,wellLocation:nr})]:[]]:[];let Ct=[];switch(L){case null:case void 0:Ct=[...ln(!0),...gt(!0)];break;case On:Ct=[Ga,...ln(!0),...gt(!0)];break;case Hr:Ct=[...ln(!0),...gt(!1),O($,{pipetteId:U,labwareId:x,wellName:Ae,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),Ga,...Je&&!et?[O(Mt,{pipetteId:U,labwareId:x,wellName:Ae,...Re!=null?{mmFromEdge:Re}:{},zOffsetFromTop:ke,...Ce!=null?{speed:Ce}:{}})]:[],...gt(!0).length>0?[O($,{pipetteId:U,labwareId:x,wellName:Ae,wellLocation:{origin:c.WELL_ORIGIN_TOP}})]:[],...gt(!0,!1)];break;default:L in We?Ct=[...ln(!1),...gt(!1),O(Ay,{pipetteId:U,flowRate:I,trashId:L}),...gt(!0,!1)]:L in Y&&(Ct=[O(Ly,{pipetteId:U,flowRate:I,wasteChuteId:L}),...gt(!0,!1)]);break}const Wa=Rt&&(yt===or.length-1||w==="always")?[O(An,{pipette:U,dropTipLocation:J,isReturnTip:Rt})]:[],Nt=[...lr,...nn,...an,...sn,...Zn,...on,...cr,...Qn,...vr,...Wt,...Jn,...ja,...Ps,...Ct,...Wa];return wr=Ae,jn=Ne,[...oe,...Nt]},[]);return[...se,...Gn]},[]),Er];return ne(me,t,r)},ZS=(e,t,r)=>ne([M(ys,{moduleId:e.moduleId,commandCreatorFnName:"vacuumCloseVent"}),M(l_,{...e,commandCreatorFnName:"vacuumSetPumpPower"})],t,r),QS=(e,t,r)=>ne([M(ys,{moduleId:e.moduleId,commandCreatorFnName:"vacuumCloseVent"}),M(u_,{...e,commandCreatorFnName:"vacuumSetPumpPressure"})],t,r),JS=(e,t,r)=>{const{ventAfter:n}=e;return ne([M(ys,{moduleId:e.moduleId,commandCreatorFnName:"vacuumCloseVent"}),M(c_,{...e,commandCreatorFnName:"vacuumStartRunProfile",ventAfter:n})],t,r)},Cy=(e,t,r)=>{const n=`[${e.task_ids.join(", ")}]`,a=`${Ie}.wait_for_tasks(${n})`;return{commands:[{key:F(),commandType:"waitForTasks",params:e}],python:a}},eA=(e,t,r)=>{const{waitCondition:n}=e;return n==="thermocyclerProfileComplete"?tA(e,t,r):n==="vacuumProfileComplete"||n==="vacuumStateComplete"?rA(e,t,r):{errors:[_b(n)]}},tA=(e,t,r)=>{const{moduleId:n}=e,a=[],s=vs(r,n);if(s==null)return{errors:[X()]};if(s.currentBlockActivity.type!=="profile")return{errors:[Yc()]};const{taskId:o}=s.currentBlockActivity;return o==null?{errors:[Yc()]}:(a.push(M(Cy,{task_ids:[o]})),ne(a,t,r))},rA=(e,t,r)=>{const{moduleId:n}=e,a=[],s=st(r,n);if(s==null)return{errors:[X()]};if(s.currentPumpActivity.type!=="timedHold"&&s.currentPumpActivity.type!=="profile")return{errors:[hb()]};const o=s.currentPumpActivity.taskId;return a.push(M(Cy,{task_ids:[o]})),ne(a,t,r)};var Nu,ih;function nA(){if(ih)return Nu;ih=1;var e=q_(),t=1,r=4;function n(a){return e(a,t|r)}return Nu=n,Nu}var aA=nA();const sA=xe(aA),Ny=["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"],Vr="p300SingleId",da="p300MultiId",Yu="p100096Id",Ku="sourcePlateId",Xu="destPlateId",Zu="troughId",oA="A1",iA="tiprack1Id",lA={isAirGap:!0},Xa=c.fixture96Plate,lh=c.fixture12Trough,Za=c.fixtureTiprack10ul,Dt=c.fixtureTiprack300ul,un=c.fixtureTiprack1000ul,Qa=c.fixtureTiprackAdapter,Dy={OT_PD_DISABLE_MODULE_RESTRICTIONS:!1};function My(e){return Ny.reduce((t,r)=>({...t,[r]:e?Ea:ie}),{})}function uA(e,t){return Array.from("ABCDEFGH").map(r=>`${r}${e}`).reduce((r,n)=>({...r,[n]:t}),{})}function Fy(){const e={[Ku]:{id:Ku,pythonName:"mock_source_plate",labwareDefURI:c.getLabwareDefURI(Xa),def:Xa},[Xu]:{id:Xu,pythonName:"mock_dest_plate",labwareDefURI:c.getLabwareDefURI(Xa),def:Xa},[Zu]:{id:Zu,pythonName:"mock_trough",labwareDefURI:c.getLabwareDefURI(lh),def:lh},tiprack1Id:{id:"tiprack1Id",pythonName:"mock_tip_rack_1",labwareDefURI:c.getLabwareDefURI(Dt),def:Dt},tiprack2Id:{id:"tiprack2Id",pythonName:"mock_tip_rack_2",labwareDefURI:c.getLabwareDefURI(Dt),def:Dt},tiprack3Id:{id:"tiprack3Id",pythonName:"mock_tip_rack_3",labwareDefURI:c.getLabwareDefURI(Dt),def:Dt},tiprack4AdapterId:{id:"tiprack4AdapterId",pythonName:"mock_adapter_4",labwareDefURI:c.getLabwareDefURI(Qa),def:Qa},tiprack5AdapterId:{id:"tiprack5AdapterId",pythonName:"mock_adapter_5",labwareDefURI:c.getLabwareDefURI(Qa),def:Qa},tiprack4Id:{id:"tiprack4Id",pythonName:"mock_tip_rack_4",labwareDefURI:c.getLabwareDefURI(un),def:un},tiprack5Id:{id:"tiprack5Id",pythonName:"mock_tip_rack_5",labwareDefURI:c.getLabwareDefURI(un),def:un}},t={},r={[Mu]:{id:Mu,location:"cutoutA3",pythonName:"trash_bin_1"}},n={p10SingleId:{name:"p10_single",id:"p10SingleId",pythonName:"mock_pipette_p10",tiprackDefURI:[c.getLabwareDefURI(Za)],tiprackLabwareDef:[Za],spec:c.fixtureP10SingleV2Specs},p10MultiId:{name:"p10_multi",id:"p10MultiId",tiprackDefURI:[c.getLabwareDefURI(Za)],tiprackLabwareDef:[Za],spec:c.fixtureP10MultiV2Specs,pythonName:"mock_pipette_p10_multi"},[Vr]:{name:"p300_single",id:Vr,tiprackDefURI:[c.getLabwareDefURI(Dt)],tiprackLabwareDef:[Dt],spec:c.fixtureP300SingleV2Specs,pythonName:"mock_pipette"},[da]:{name:"p300_multi",id:da,tiprackDefURI:[c.getLabwareDefURI(Dt)],tiprackLabwareDef:[Dt],spec:c.fixtureP300MultiV2Specs,pythonName:"mock_pipette_p300_multi"},[Yu]:{name:"p1000_96",id:Yu,tiprackDefURI:[c.getLabwareDefURI(un)],tiprackLabwareDef:[un],spec:c.fixtureP100096V2Specs,pythonName:"mock_pipette_p1000_96"}};return{labwareEntities:e,moduleEntities:t,pipetteEntities:n,trashBinEntities:r,wasteChuteEntities:{},stagingAreaEntities:{},gripperEntities:{},liquidEntities:{},config:Dy}}const jr=e=>{const{invariantContext:t,labwareLocations:r,moduleLocations:n,pipetteLocations:a,tiprackSetting:s}=e,o=wc({invariantContext:t,labwareLocations:r,moduleLocations:n||{},pipetteLocations:a});return o.tipState.tipracks=Zt(s,i=>My(i)),o},qn=()=>({pipetteLocations:{[Vr]:{mount:"left",tiprackId:"tiprack1Id"},[da]:{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:{}}),qy=()=>({pipetteLocations:{[Vr]:{mount:"left"},[da]:{mount:"right"}},labwareLocations:{tiprack1Id:{stack:["tiprack1Id","B1"]},tiprack2Id:{stack:["tiprack2Id","A2"]},sourcePlateId:{stack:["sourcePlateId","offDeck"]},destPlateId:{stack:["destPlateId","C2"]}},moduleLocations:{}}),Uy=e=>jr({...qn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}}),cA=e=>jr({...qy(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}}),pA=e=>({robotState:Uy(e),warnings:[]}),dA=e=>{const t=jr({...qn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}});return t.tipState.pipettes[Vr]={hasTip:!0,tiprackURI:"tiprack1Id"},t},fA=e=>{const t=jr({...qn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0}});return t.tipState.pipettes[Vr]={hasTip:!0,tiprackURI:"tiprack1Id"},t.tipState.tipracks.tiprack1Id.A1=ie,t},mA=e=>jr({...qn(),invariantContext:e,tiprackSetting:{tiprack1Id:!1,tiprack2Id:!1}}),hA=({temperatureModuleId:e,thermocyclerId:t})=>{const r=Fy();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=jr({...qn(),invariantContext:r,tiprackSetting:{tiprack1Id:!0}});return n.modules={[e]:{slot:"3",moduleState:{type:c.TEMPERATURE_MODULE_TYPE,status:Ia,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}},_A=(e,t,r,n)=>{const a=sA(e);return a.modules[t].moduleState={type:c.TEMPERATURE_MODULE_TYPE,targetTemperature:n,status:r},a};exports.ABSORBANCE_READER_INITIAL_STATE=Eh;exports.AIR=Ge;exports.AIR_GAP_META=lA;exports.AIR_GAP_OFFSET_FROM_TOP=Du;exports.AUTOMATIC=ec;exports.BOTTOM_UP_LABWARE_POOL_KEYS=Kt;exports.BOTTOM_UP_STORED_LABWARE_URI_KEYS=Lb;exports.CLEAN=Ea;exports.COLUMN_4_SLOTS=Me;exports.CUSTOM_LABWARE_DICT_NAME=bs;exports.DEFAULT_BLOWOUT_WELL=oA;exports.DEFAULT_CONFIG=Dy;exports.DEFAULT_PIPETTE=Vr;exports.DEST_LABWARE=Xu;exports.DEST_WELL_BLOWOUT_DESTINATION=On;exports.DIRTY=Yt;exports.EMPTY=ie;exports.FAKE_HOPPER_LOCATION_MAP=vh;exports.FIXED_TRASH_ID=Mu;exports.FLEX_STACKER_MODULE_INITIAL_STATE=Sh;exports.FLEX_TRASH_DEF_URI=Sb;exports.GRIPPER_LOCATION=Oh;exports.HEATERSHAKER_MODULE_INITIAL_STATE=Ih;exports.HOPPER_FAKE_LOCATIONS=kh;exports.HOPPER_STACKER_LOCATION=je;exports.INDENT=Ra;exports.MAGNETIC_BLOCK_INITIAL_STATE=wh;exports.MAGNETIC_MODULE_INITIAL_STATE=bh;exports.MANUAL=wt;exports.MIXED_WELL_COLOR=ay;exports.MODULES_WITH_COLLISION_ISSUES=yh;exports.MODULE_INITIAL_STATE_BY_TYPE=Lh;exports.MULTI_PIPETTE=da;exports.OFF_DECK=ia;exports.OT2_TC_SLOTS=Ab;exports.OT_2_TRASH_DEF_URI=wb;exports.PAPI_VERSION=oy;exports.PD_APPLICATION_VERSION=jw;exports.PIPETTE_96=Yu;exports.PROTOCOL_CONTEXT_NAME=Ie;exports.SLOT_LOCATIONS_TO_FAKE_HOPPER_LOCATIONS=Ob;exports.SOURCE_LABWARE=Ku;exports.SOURCE_WELL_BLOWOUT_DESTINATION=Hr;exports.STAGING_AREA_SLOTS=Rh;exports.TEMPERATURE_APPROACHING_TARGET=Ju;exports.TEMPERATURE_AT_TARGET=Qu;exports.TEMPERATURE_DEACTIVATED=Ia;exports.TEMPERATURE_MODULE_INITIAL_STATE=Th;exports.THERMOCYCLER_MODULE_INITIAL_STATE=gh;exports.TIPRACK_1=iA;exports.TOUCHED_PIPETTABLE_LABWARE=Gu;exports.TROUGH_LABWARE=Zu;exports.VACUUM_AT_TARGET=qb;exports.VACUUM_DEACTIVATED=Fb;exports.VACUUM_DOCK_ADDRESSABLE_AREA=Rb;exports.VACUUM_DOCK_LOCATION=tc;exports.VACUUM_MODE_POWER=Fu;exports.VACUUM_MODE_PRESSURE=qu;exports.VACUUM_MODULE_INITIAL_STATE=Ah;exports.VACUUM_PROGRAM_PROFILE=vb;exports.VACUUM_PROGRAM_STATE=kb;exports.VACUUM_STATE_PUMP_OFF=Pb;exports.VACUUM_STATE_PUMP_ON=Cb;exports.VACUUM_STATE_VENT=Nb;exports.VACUUM_VENT_CLOSED=wa;exports.VACUUM_VENT_OPEN=rc;exports.VACUUM_VENT_SET_CLOSED=Mb;exports.VACUUM_VENT_SET_OPEN=Db;exports.ZERO_OFFSET=Et;exports._getNextTip=Sy;exports._wellContentsForLabware=Mw;exports.absorbanceReaderCloseInitialize=mS;exports.absorbanceReaderCloseLid=bc;exports.absorbanceReaderCloseRead=hS;exports.absorbanceReaderCollision=va;exports.absorbanceReaderInitialize=e_;exports.absorbanceReaderOpenLid=cg;exports.absorbanceReaderRead=t_;exports.absorbanceReaderStateGetter=Fn;exports.airGapLocationHelper=qg;exports.aspirate=pg;exports.assignContainsAmongSiblings=xc;exports.blowOutInWell=r_;exports.captureImage=dg;exports.column4StagingSlotIdFromFlexStackerShuttleAddressableArea=w_;exports.commandCreatorsTimeline=mw;exports.comment=fg;exports.consolidate=SS;exports.constructInvariantContextFromAnalysis=gw;exports.createEmptyLiquidState=y_;exports.createStagingAreaForInvariantContext=Bu;exports.createTipLiquidState=b_;exports.curryCommandCreator=M;exports.curryWithoutPython=O;exports.deactivateTemperature=hg;exports.deckSlotKeyForFlexStackerShuttleAddressableArea=Bg;exports.delay=he;exports.delayLocationHelper=Ug;exports.disengageMagnet=_g;exports.dispense=n_;exports.dispenseLocationHelper=Mg;exports.distribute=OS;exports.dropTip=An;exports.dropTipInPlace=Tc;exports.dropTipInTrash=Ry;exports.dropTipInWasteChute=ky;exports.engageMagnet=yg;exports.enrichRobotStateForStackGraphTraversals=IE;exports.flexStackerEmpty=bg;exports.flexStackerFillItems=Tg;exports.flexStackerRetrieve=gg;exports.flexStackerStateGetter=ft;exports.flexStackerStore=Ig;exports.formatChangeTipArg=Rs;exports.formatPyDict=Fr;exports.formatPyList=gc;exports.formatPyStr=C;exports.formatPyTuple=o_;exports.formatPyValue=pt;exports.formatPyWellLocation=Ln;exports.getAddressableAreaFromModule=$c;exports.getAddressableAreaNameFromLabwareLocation=hE;exports.getAllLargestStacks=H_;exports.getAllProvidedAddressableAreasFromDeckConfig=z_;exports.getAllWellsForLabware=ny;exports.getChunkForIndentingLists=Ts;exports.getCustomLiquidClassProperties=Ls;exports.getCutoutFromSlot=Ty;exports.getCutoutIdByAddressableArea=d_;exports.getDefaultPrimaryNozzle=ns;exports.getDefineLiquids=dy;exports.getDispenseAirGapLocation=T_;exports.getFlexStackerCutoutBaseDeckSlotId=Ac;exports.getFlexStackerShuttleAddressableArea=gs;exports.getFullStackFromLabwares=Lc;exports.getFullStackFromNodeTopDownRecursive=As;exports.getHasNoWellsFromCCArgs=_w;exports.getInitialRobotStateStandard=Uy;exports.getInitialRobotStateWithOffDeckLabwareStandard=cA;exports.getIsHeaterShakerEastWestMultiChannelPipette=Dn;exports.getIsHeaterShakerEastWestWithLatchOpen=Nn;exports.getIsHeaterShakerNorthSouthOfNonTiprackWithMultiChannelPipette=Ma;exports.getIsLabwareCompatibleWithStack=A_;exports.getIsRetractSafeForAirGap=qr;exports.getIsSafePickupWithinTiprack=jc;exports.getIsSlotAHopper=L_;exports.getIsSlotAVacuumDock=la;exports.getIsSpaceInHopper=vc;exports.getIsTallLabwareEastWestOfHeaterShaker=ty;exports.getLabwareHasLiquid=I_;exports.getLabwareIdOnHopper=Hg;exports.getLabwareIdOnShuttle=Rc;exports.getLabwareSlot=vn;exports.getLargestStackContainingLabware=x_;exports.getLargestStackInSlot=pn;exports.getLiquidClassName=Ua;exports.getLiquidIdsOnLabware=Uw;exports.getLiquidIdsOnLabwareStack=qw;exports.getLoadAdapters=ly;exports.getLoadLabware=cy;exports.getLoadLidStacks=uy;exports.getLoadLiquidClasses=my;exports.getLoadLiquids=fy;exports.getLoadModules=iy;exports.getLoadPipettes=py;exports.getLoadTrashBins=hy;exports.getLoadWasteChute=_y;exports.getLocationTotalVolume=dr;exports.getModuleHasLiveTask=Pn;exports.getModuleIdFromRobotStateStack=ka;exports.getModuleState=St;exports.getNearestParentInStack=E_;exports.getNextRobotStateAndWarnings=Hc;exports.getNextRobotStateAndWarningsSingleCommand=ey;exports.getNextTiprack=Va;exports.getNodeParentModuleId=fE;exports.getNozzleConfig=zc;exports.getPipetteIdFromCCArgs=hw;exports.getPipetteMovementSafetyStatus=dt;exports.getPipetteWithTipMaxVol=ks;exports.getProvidedAddressableAreasExposed=_E;exports.getPythonAssignTipRacksString=Os;exports.getResultingTimelineFrameFromRunCommands=Ew;exports.getRobotInitialStateNoTipsRemain=mA;exports.getRobotStateAndWarningsStandard=pA;exports.getRobotStatePickedUpTipStandard=fA;exports.getRobotStateWithTipStandard=dA;exports.getSetStoredLabware=by;exports.getSlotInLocationStack=G;exports.getStackForLabwareLocation=Uu;exports.getStackedOnNodeFromPdStack=j_;exports.getStateAndContextTempTCModules=hA;exports.getTargetTipsFromWellSets=Ba;exports.getThermocyclerProfileRepetitionsForPython=Ey;exports.getTipColumn=uA;exports.getTipColumnIndex=Wu;exports.getTipColumnName=Gc;exports.getTipRowName=fn;exports.getTiprackHasTips=g_;exports.getTiprackTipstate=My;exports.getTopLocationInStack=Sc;exports.getTopmostLabwareOnModuleFromStackRobotState=$g;exports.getTransferPlanAndReferenceVolumes=Oc;exports.getTrashBinAddressableAreaName=Ic;exports.getTrashLocationFromAddressableAreaName=m_;exports.getTrashOrLabware=Rn;exports.getVolumesPerLiquid=Fw;exports.getWasteChuteAddressableAreaNamePip=f_;exports.getWellsForTips=Ec;exports.heaterShaker=CS;exports.indentPyLines=Z;exports.labwareMatchesLabwareInHopper=kc;exports.makeContext=Fy;exports.makeInitialRobotState=wc;exports.makeState=jr;exports.makeStateArgsLabwareOffDeck=qy;exports.makeStateArgsStandard=qn;exports.mergeLiquid=fr;exports.mix=wS;exports.mixBlowoutLocationHelper=__;exports.modulePipetteCollision=Cn;exports.moveHelper=Fg;exports.moveLabware=Og;exports.moveToAddressableArea=Ue;exports.moveToAddressableAreaForDropTip=a_;exports.pipetteAdjacentHeaterShakerWhileShaking=Mn;exports.pipetteIntoHeaterShakerLatchOpen=Fa;exports.pipetteIntoHeaterShakerWhileShaking=qa;exports.pythonCustomLabwareDict=Jw;exports.pythonDefRun=Qw;exports.pythonImports=Gw;exports.pythonMetadata=Ww;exports.pythonRequirements=Yw;exports.reduceCommandCreators=ne;exports.repeatArray=h_;exports.replaceTip=$a;exports.resolveDeckSlotKeyForLabwareStackInSlot=S_;exports.robotWithStatusAndTemp=_A;exports.setTemperature=s_;exports.sortLabwareBySlot=wy;exports.splitLiquid=Xt;exports.stepCommands=yy;exports.swatchColors=sy;exports.thermocyclerPipetteCollision=Na;exports.thermocyclerProfileStep=NS;exports.thermocyclerStateGetter=vs;exports.thermocyclerStateStep=HS;exports.tiprackWellNamesFlat=Ny;exports.touchTip=Mt;exports.transfer=XS;exports.unrollThermocyclerProfile=Wc;exports.uuid=F;exports.vacuumCloseVent=ys;exports.vacuumCloseVentSetPumpPower=ZS;exports.vacuumCloseVentSetPumpPressure=QS;exports.vacuumCloseVentStartProfile=JS;exports.vacuumModuleStateGetter=st;exports.vacuumOpenVent=kg;exports.vacuumSetPumpPower=l_;exports.vacuumSetPumpPressure=u_;exports.vacuumStartRunProfile=c_;exports.vacuumStopPump=Dg;exports.waitForModuleTask=eA;exports.waitForTemperature=p_;exports.wellFillFromWellContents=Vw;
|