(this["webpackJsonpgonzo-test-client"]=this["webpackJsonpgonzo-test-client"]||[]).push([[57],{"+CSe":function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return i}));var a=n("B6RA");function r(e,t,n,r,i=null){if(navigator&&"serviceWorker"in navigator&&navigator.serviceWorker.controller){console.log("pushing");let o=a.default.getState();navigator.serviceWorker.controller.postMessage(JSON.stringify({locale:e||o.language.locale,lang:t||o.language.lang,sub:n||o.user.attributes.sub,isService:r,user:i||o.user.user}))}}function i(e,t){navigator&&"serviceWorker"in navigator&&navigator.serviceWorker.controller&&navigator.serviceWorker.controller.postMessage(JSON.stringify({refreshToken:e,deviceKey:t,type:"REFRESH_TOKEN"}))}},"0MVo":function(e,t,n){"use strict";n.d(t,"d",(function(){return c})),n.d(t,"a",(function(){return s})),n.d(t,"f",(function(){return u})),n.d(t,"c",(function(){return l})),n.d(t,"b",(function(){return f})),n.d(t,"e",(function(){return d}));n("L5/0"),n("50DI");var a=n("UB5X"),r=n.n(a),i=n("J2iB"),o=n.n(i);function c(e=""){let t="".concat(e);for(let n=1;n{const n=e%26,a=Math.floor(e/26);return t+=String.fromCharCode(65+n),a?l(a,t):t},f=(e,t,{numeric:n=!1,ascending:a=!0,nonValuesAtEnd:r=!0}={})=>o()(e)!==o()(t)?(r?o()(e):o()(t))?1:-1:o()(e)&&o()(t)?0:"".concat(a?e:t||"").trim().localeCompare("".concat(a?t:e||"").trim(),void 0,{sensitivity:"base",numeric:n}),d=e=>r()(e)?e.toString(16).toUpperCase():"0x?"},"15cA":function(e,t,n){"use strict";n.d(t,"i",(function(){return F})),n.d(t,"j",(function(){return U})),n.d(t,"m",(function(){return Y})),n.d(t,"d",(function(){return j})),n.d(t,"h",(function(){return V})),n.d(t,"n",(function(){return k})),n.d(t,"c",(function(){return x})),n.d(t,"g",(function(){return H})),n.d(t,"f",(function(){return z})),n.d(t,"l",(function(){return K})),n.d(t,"a",(function(){return X})),n.d(t,"b",(function(){return Z})),n.d(t,"e",(function(){return J})),n.d(t,"k",(function(){return q})),n.d(t,"o",(function(){return Q}));var a=n("44Ds"),r=n.n(a),i=n("4qC0"),o=n.n(i),c=n("J2iB"),s=n.n(c),u=n("lFKM"),l=n.n(u),f=n("Y+p1"),d=n.n(f),m=n("Z0cm"),I=n.n(m),g=n("mwIZ"),T=n.n(g),E=n("BkRI"),N=n.n(E),O=n("uM7l"),D=n.n(O),A=n("B6RA"),S=n("6/k7"),y=n("zDJl"),p=n("kCmh"),h=n("n7pt"),R=n("IBmF"),P=n("wd/R"),v=n.n(P),b=(n("ZRKa"),n("P0Qa"),n("I8zd")),C=n("i8MS"),M=n("msTn");function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function w(e){for(var t=1;t{let t=e.receiver;const n=e.animal?{AnmNo1:e.animal.AnmNo1,AnmID:e.animal.AnmID,RFID:e.animal.RFID}:{};if(n.PlcmntID=e.id,t){const e=a.has(t.gatewayId)?a.get(t.gatewayId):N()(G);if(s()(t.index))e.individualNRF.devices=[...new Set([...e.individualNRF.devices,t.deviceId])],Object.keys(n).length&&e.individualNRF.animals.push(n);else{let a=e.individualDTM.findIndex(e=>e.DevID===t.deviceId);~a?~e.individualDTM[a].outputs.findIndex(e=>e.number===t.index+1)||e.individualDTM[a].outputs.push(w({number:t.index+1},n)):e.individualDTM.push({DevID:t.deviceId,outputs:[w({number:t.index+1},n)]})}a.set(t.gatewayId,e)}});else{const n=p.a.getDevicesInPlcmntID(e,{showDevicesInChildren:!1}).filter(e=>e.DevType===y.d.DISPENSER_NRF);if(n.length){const r=t.map(e=>{const t={RFID:e.id};return e.animal&&(t.AnmNo1=e.animal.AnmNo1,t.AnmID=e.animal.AnmID),t}),i=N()(G);i.groupNRF=[{LocID:e,animals:r}],n.forEach(e=>{a.has(e.GatewayID)||a.set(e.GatewayID,N()(i))})}}return n.receivers=a,n}function U(e=[],t=[]){if(console.log(e,t),0===(e=e.map(e=>w({},e,{ForageAmount:e.ForageAmount<99?1e3*e.ForageAmount:e.ForageAmount}))).length)return[];let n=[],a=0;e.forEach((r,i)=>{(e[a].DailyPlan!==r.DailyPlan||e[a].ForageType!==r.ForageType||t.find(e=>e.StartDay===i+1))&&(n.push({start:a,end:i-1}),a=i)}),(0===n.length||n.find(e=>e.end!==a))&&n.push({start:a,end:e.length-1}),console.log("stages chopped by plan & forage type",n);let r=[];return n.forEach((n,a)=>{let i=n.start;for(;i!==n.end+1;){let a=B(i,n.end,e),o=t.find(e=>e.StartDay===i+1);r.push({name:T()(o,"Name","Etap ".concat(r.length+1)),startingAmount:e[i].ForageAmount,endingAmount:e[a].ForageAmount,days:a-i+1,forage:e[i].ForageType,plan:e[i].DailyPlan}),i=a+1}}),r}function B(e,t,n){for(let a=t;a>=e;a--)if(W(e,a,n))return console.log(e,a),a}function W(e,t,n){if(e===t)return!0;let a=[],r=[];for(let i=e;i<=t;i++){let o=n[e].ForageAmount+(i-e)*(n[t].ForageAmount-n[e].ForageAmount)/(t-e||1);a.push(o+(o%100>49?100-o%100:-o%100)),r.push(n[i].ForageAmount)}return d()(a,r)}function Y(e){let t;const{curveDay:n,curve:a,curveStart:r,doseCorrection:i,punishment:o,repetitionDate:c}=e;let s=z(a)===S.a.NORMAL?l()(n)?+v()().startOf("day").subtract(n-1,"day"):r||+new Date:c,u=v()(function(e,t){switch(z(e)){case S.a.BEFORE:return+v()(t).startOf("day").subtract(T()(e,"SetData.Days",[]).length,"days");case S.a.BOTH:return+v()(t).startOf("day").subtract(T()(e,"SetData.InseminationJumpTo",1)-1,"days");default:return+v()(t).startOf("day")}}(a,+v()(s))).startOf("day"),f=R.h.NO_EVENT,d=v()().startOf("day").diff(u,"days")+1,m=T()(a,"SetData.InseminationJumpTo",0);return m&&d>=m&&(f=R.h.INSEMINATION,u=u.add(m-1,"days")),t={curveNr:a?a.SetData.Index+1:0,offset:0,percentCorrection:+i,startTime:+u,punishment:+o,stage:f},t}function j(e=0,t){const n=T()(t,"SetData.Days.length",0),a=T()(t,"SetData.InseminationJumpTo",0);switch(z(t)){case S.a.BEFORE:return e-1-n;case S.a.AFTER:return e-1;case S.a.BOTH:return e-a;default:return e}}function V(e=new Map){let t=0;for(let[n,a]of e.entries())n&&((a.groupNRF.length||a.individualNRF.devices.length)&&(t|=2),a.individualDTM.length&&(t|=1));return t}function k(e=new Map,t="UNBINDED"){if(!e.has(t))return e;const n=e.get(t).map(e=>e.RFID);for(let a of e.keys())a!==t&&e.set(a,e.get(a).filter(e=>!n.includes(e.RFID)));return e}function x(e,t={}){const{IndividualFeeding:n}=e,a=t.animals?t.animals:C.a.getAllAnimalsForLocation(e,b.a.CHAMBER,{joinEvents:!1}),r=new Map;return console.log("createAnimalDict",t,e,a),n?a.forEach(e=>{I()(e.PlcmntID)?e.PlcmntID.forEach(t=>{r.set(t.PlcmntID,e)}):o()(e.PlcmntID)&&r.set(e.PlcmntID,e)}):a.forEach(e=>{o()(e.RFID)&&r.set(e.RFID,e)}),r}function H(e=[]){const t=A.default.getState().location.farm,n={},a=C.a.getAllAnimals(t,void 0,!1,!1);console.log(a);const i=p.a.getDevices(t),c={},s={chamber:{},sectorType:null,dispensers:[],animals:[]};console.log("Builds",e),e.map(e=>{T()(e,"Sectors",[]).forEach(e=>{const{SType:t}=e;T()(e,"Chambers",[]).forEach(e=>{const{IndividualFeeding:a,CID:r}=e;n[r]?console.error("2 chambers with same Id"):(n[r]=N()(s),n[r].sectorType=t,n[r].chamber=e),a?T()(e,"Boxes",[]).forEach(e=>{c[e.BID]=r}):c[r]=r})})}),console.log("hehe",D()(n),c,i);const u=[...Object.keys(c),...Object.values(c)];console.log("hehe2",u);const l=r()(e=>u.includes(e));return i.forEach(e=>{[y.d.DISPENSER,y.d.DISPENSER_NRF].includes(e.DevType)&&(I()(e.PlcmntID)?e.PlcmntID.forEach(t=>{l(t.PlcmntID)&&(~n[c[t.PlcmntID]||t.PlcmntID].dispensers.findIndex(t=>t.DevID===e.DevID)||n[c[t.PlcmntID]||t.PlcmntID].dispensers.push(e))}):o()(e.PlcmntID)&&l(e.PlcmntID)&&(~n[c[e.PlcmntID]||e.PlcmntID].dispensers.findIndex(t=>t.DevID===e.DevID)||n[c[e.PlcmntID]||e.PlcmntID].dispensers.push(e)))}),a.forEach(e=>{I()(e.PlcmntID)?e.PlcmntID.forEach(t=>{l(t.PlcmntID)&&(~n[c[t.PlcmntID]||t.PlcmntID].animals.findIndex(t=>t.AnmID===e.AnmID)||n[c[t.PlcmntID]||t.PlcmntID].animals.push(e))}):o()(e.PlcmntID)&&l(e.PlcmntID)&&(~n[c[e.PlcmntID]||e.PlcmntID].animals.findIndex(t=>t.AnmID===e.AnmID)||n[c[e.PlcmntID]||e.PlcmntID].animals.push(e))}),console.log(n),Object.values(n).filter(e=>!!e.dispensers.length).sort((e,t)=>e.chamber.CName.localeCompare(t.chamber.CName,void 0,{numeric:!0,sensitivity:"base"}))}function z(e){const t=T()(e,"SetData.InseminationJumpTo")?255===T()(e,"SetData.InseminationJumpTo")?S.a.AFTER:S.a.BOTH:S.a.BEFORE;switch(T()(e,"SetData.Type")){case S.b.INDIVIDUAL:return S.a.NORMAL;case S.b.MATING:case S.b.PARTURITION:return t;default:return S.a.NORMAL}}const K=r()(({devType:e,curve:t,index:n,showingType:a})=>{console.log("isValidCurveForDevType",e,t,n,a);const r=s()(n)?T()(t,"SetData.Index",999):n,i=T()(t,"SetData.Days",[]),o=s()(a)?z(t):a;switch(e){case y.d.DISPENSER_NRF:return!0;case y.d.DISPENSER:return r<5&&o!==S.a.BOTH&&!i.filter(e=>e.DailyPlan>4||e.ForageType>1).length;default:return!1}},(...e)=>JSON.stringify(e));function X(e,t,n=1,a=[]){if(console.log(e,t,n,a,"canChangeCurve"),!t||!e)return!1;const{curve:{number:r,day:i}={}}=e;if(0===r)return!0;const o=a.find(e=>e.SetData.Index===r-1);if(!o)return!0;const c=l()(i)?i:1;return o.SetData.Index!==t.SetData.Index||c{l()(T()(e,"receiver.index"))&&t===S.f.INDIVIDUAL?n.curve?X(e,s.curve,s.day,r)?c.push(e):o.push(e):i.push(e):(console.log("checky checky"),a.curve?X(e,u.curve,u.day,r)?(console.log("yyeess"),c.push(e)):(console.log("nooo"),o.push(e)):i.push(e))}),{nodesEligible:c,nodesAlreadyReported:o,nodesMissingSettings:i}}const J=({sectorType:e}={})=>{const t=Object.values(S.b);if("override"===e)return t;switch(e){case M.a.DELIVERY:return t.filter(e=>e===S.b.INDIVIDUAL||e===S.b.PARTURITION);case M.a.MATING:case M.a.SOWS:return t.filter(e=>e===S.b.MATING);default:return t.filter(e=>e===S.b.INDIVIDUAL)}};function q({animal:e,curves:t,sectorType:n,initializeIndex:a=!1}){console.log(arguments,"initializeFeeding");let r={stage:T()(e,"feedParam.stage")||0,percentCorrection:T()(e,"feedParam.percentCorrection")||0,punishment:T()(e,"feedParam.punishment")||0,curve:a?0:null,curveStart:v()(T()(e,"feedParam.startTime")||+new Date),curveDay:1,repetitionDate:v()(T()(e,"feedParam.startTime")||+new Date)};const i=T()(e,"feedParam.curveNr");if(console.log("curveNr",i),i){const o=t.find(e=>e.SetData.Index===i-1&&J({sectorType:n}).includes(e.SetData.Type));if(o){console.log("curve",o),r.curve=a?t.indexOf(o):o;const n=!!T()(e,"feedParam.stage",0),i=T()(o,"SetData.InseminationJumpTo",0),c=T()(o,"SetData.Days.length",0);switch(z(o)){case S.a.BEFORE:r.repetitionDate=r.curveStart.clone().add(c,"days");break;case S.a.AFTER:r.repetitionDate=r.curveStart;break;case S.a.BOTH:console.log(r.repetitionDate.clone(),i,n),r.repetitionDate=r.curveStart.clone().add(n?0:Math.max(i-1,0),"day"),console.log(r.repetitionDate.clone(),i,n);break;case S.a.NORMAL:default:r.curveDay=Math.min(c,Math.max(1,v()().startOf("day").diff(r.curveStart.clone().startOf("day"),"days")+1))}}}return r.repetitionDate=r.repetitionDate.format("YYYY-MM-DD"),r.curveStart=r.curveStart.format("YYYY-MM-DD"),r}const Q=(e,t={})=>{const n=[];return e.groupNRF.length&&e.groupNRF.forEach(e=>{e.animals.forEach(a=>{n.push(w({PlcmntID:e.LocID},a,{feeding:t}))})}),e.individualDTM.length&&e.individualDTM.forEach(e=>{e.outputs.forEach(e=>{n.push(w({},e,{feeding:w({},t,{number:e.number})}))})}),e.individualNRF.animals.length&&e.individualNRF.animals.forEach(e=>{n.push(w({},e,{feeding:t}))}),n}},"1mk5":function(e,t,n){"use strict";n.d(t,"c",(function(){return d})),n.d(t,"b",(function(){return m})),n.d(t,"a",(function(){return I}));n("Z0cm");var a=n("uVg0"),r=(n("q1tI"),n("i8MS")),i=n("kCmh"),o=n("B6RA"),c=n("zDJl"),s=(n("qzmO"),n("r3a2"),n("wd/R")),u=n.n(s),l=n("kCVf"),f=n("XzT5");function d(e){switch(e.NData.Type){case a.b.PLACE:return e.NData.Title;case a.b.NO_INSEMINATION:return f.a.t("notificationsCenter.birthNoInsemination");case a.b.TOO_FAST_BIRTH:return f.a.t("notificationsCenter.birthTooEarly");case a.b.SEPARATION_WRONG_AMOUNT:return f.a.t("notificationsCenter.tooMuchPiglets");case a.b.TREATMENT:return f.a.t("scheduleOfTreatment");case a.b.DEVICE_ALARM:{let n=i.a.getDeviceByID(e.NData.DeviceID),r="";if(n)try{let t=n.getLocation().map(e=>Object(l.k)(e)),i=!1;if(t.length>3&&(t=t.slice(0,3),i=!0),t.length>0){switch(e.NData.Status){case a.a.INFO:r=f.a.t("notificationsCenter.deviceInfoLocation");break;case a.a.ALERT:r=f.a.t("notificationsCenter.deviceAlarmLocation");break;default:r="Nie rozpoznano "}return r+t.join(", ")+(i?", ...":"")}switch(e.NData.Status){case a.a.INFO:r=f.a.t("notificationsCenter.deviceInfoText");break;case a.a.ALERT:r=f.a.t("notificationsCenter.deviceAlarmText");break;default:r="Nie rozpoznano "}return r+n.Name}catch(t){return console.error(t),r+n.Name}return r}case a.b.USG_NO_INSEMINATION:return f.a.t("notificationsCenter.usgNoInsemination");case a.b.BIRTH_NO_PREGNANCY:return f.a.t("notificationsCenter.birthNoPregnancy");case a.b.FALL_PIGLETS_WRONG_AMOUNT:return f.a.t("notificationsCenter.fallPigletsWrongAmount");case a.b.AUTO_CREATE_ANIMAL:return f.a.t("notificationsCenter.autoCreateAnimal");case a.b.BIRTH_NEGATIVE_USG:return f.a.t("notificationsCenter.birthNegativeUSG");case a.b.NO_PREGNANCY_NO_INSEMINATION:return f.a.t("notificationsCenter.noInseminationNoPregnancy");case a.b.MOMMY_WRONG_AMOUNT:return f.a.t("notificationsCenter.mommyWrongAmount");case a.b.TOO_FAST_INSEMINATION:return f.a.t("notificationsCenter.tooFastInsemination");default:return f.a.t("notRecognized")+" "+f.a.t("notificationsCenter.title")}}function m(e){let t=o.default.getState();switch(e.NData.Type){case a.b.PLACE:return e.NData.Message;case a.b.NO_INSEMINATION:{let t=r.a.getAnimalById(e.NData.AnmID);return t?[f.a.t("notificationsCenter.animal"),t.AnmNo1,f.a.t("notificationsCenter.birthNoInseminationText")]:f.a.t("notificationsCenter.birthNoInseminationTextNoAnimal")}case a.b.TOO_FAST_BIRTH:{let t=r.a.getAnimalById(e.NData.AnmID);return t?[f.a.t("notificationsCenter.animal"),t.AnmNo1,f.a.t("notificationsCenter.birthTooEarlyText")]:f.a.t("notificationsCenter.birthTooEarlyTextNoAnimal")}case a.b.SEPARATION_WRONG_AMOUNT:{let t=r.a.getAnimalById(e.NData.AnmID);return t?[f.a.t("notificationsCenter.animal"),t.AnmNo1,f.a.t("notificationsCenter.tooMuchPigletsText")]:f.a.t("notificationsCenter.tooMuchPigletsNoAnimal")}case a.b.TREATMENT:{let n=t.dictionary.medicine;console.log(n);let a=e.NData.Treatment.Medicine.map(t=>{let a=n.find(e=>e.WordID===t);if(console.log(a),a){let t="";return a.WData.Dose&&a.WData.Unit&&(t=" (".concat(a.WData.Dose).concat(a.WData.Unit,")")),["".concat(a.WData.Name).concat(t,":"),"\r\n",e.NData.Treatment.Animals.map(e=>{let t=r.a.getAnimalById(e);if(t)return t.AnmNo1}).filter(e=>e).join(", ")].join(" ")}});return console.log(a),[f.a.t("notificationsCenter.treatmentText1"),"\r\n",...a]}case a.b.DEVICE_ALARM:{let t=[];if(e.NData.Codes)for(let n of e.NData.Codes){let a=f.a.t("notificationsCenter.errorCodes.".concat(n));if(a){switch(n){case 5108:case 5001:let t="-";e.NData.LastSeenTime&&(t=u()(e.NData.LastSeenTime).format("DD.MM.YYYY HH:mm"));let i="-";if(e.NData.Plcmnt){let t=r.a.getAnimalLocationsByPlcmntID(e.NData.Plcmnt);t.length>0&&(i=t[0].name)}a=f.a.t("notificationsCenter.errorCodes.".concat(n),{number:e.NData.RFID||"-",location:i,time:t});break;case 5002:let o="-";if(e.NData.ExpectedLocation){let t=r.a.getAnimalLocationsByPlcmntID(e.NData.ExpectedLocation);t.length>0&&(o=t[0].name)}let c="-";if(e.NData.CurrentLocation){let t=r.a.getAnimalLocationsByPlcmntID(e.NData.CurrentLocation);t.length>0&&(c=t[0].name)}a=f.a.t("notificationsCenter.errorCodes.".concat(n),{number:e.NData.RFID||"-",expectedLoc:o,currentLoc:c});break;case 5101:case 5102:case 5103:case 5104:case 5202:case 5204:a=f.a.t("notificationsCenter.errorCodes.".concat(n),{number:e.NData.Number||"-"});break;case 5107:{let t="-";if(e.NData.PlcmntID){let n=r.a.getAnimalLocationsByPlcmntID(e.NData.PlcmntID);n.length>0&&(t=n[0].name)}a=f.a.t("notificationsCenter.errorCodes.".concat(n),{animal:e.NData.RFID||"-",loc:t});break}case 1430:a=f.a.t("notificationsCenter.errorCodes.".concat(n),{time:e.NData.Time?u()(e.NData.Time).format("HH:mm"):"-"});break;case 5109:{let t=r.a.getAnimalLocationsByPlcmntID(e.NData.PlcmntID);a=f.a.t("notificationsCenter.errorCodes.".concat(n),{location:t?Object(l.k)(t):"-"});break}case 3020:case 3021:case 3022:case 3023:case 3024:case 3025:case 3026:case 3027:case 3028:case 3029:case 3030:case 3031:case 3032:case 3033:case 3034:case 3035:case 3036:case 3037:case 3038:case 3039:case 3040:case 3042:case 3043:case 3044:case 3045:case 3047:a=f.a.t("notificationsCenter.errorCodes.".concat(n),{value:e.NData.Param})}t.length>0&&(a=a.charAt(0).toLowerCase()+a.slice(1)),t.push(a)}}return t.join(", ")}case a.b.USG_NO_INSEMINATION:{let t=r.a.getAnimalById(e.NData.AnmID);return t?[f.a.t("notificationsCenter.animal"),t.AnmNo1,f.a.t("notificationsCenter.usgNoInseminationText")]:f.a.t("notificationsCenter.usgNoInseminationTextNoAnimal")}case a.b.NO_PREGNANCY_NO_INSEMINATION:{let t=r.a.getAnimalById(e.NData.AnmID);return t?[f.a.t("notificationsCenter.animal"),t.AnmNo1,f.a.t("notificationsCenter.noInseminationNoPregnancyText")]:f.a.t("notificationsCenter.noInseminationNoPregnancyNoAnimal")}case a.b.BIRTH_NO_PREGNANCY:{let t=r.a.getAnimalById(e.NData.AnmID);return t?[f.a.t("notificationsCenter.animal"),t.AnmNo1,f.a.t("notificationsCenter.birthNoPregnancyText")].join(""):f.a.t("notificationsCenter.birthNoPregnancy")}case a.b.FALL_PIGLETS_WRONG_AMOUNT:{let t=r.a.getAnimalById(e.NData.AnmID);return t?[f.a.t("notificationsCenter.animal"),t.AnmNo1,f.a.t("notificationsCenter.fallPigletsWrongAmountText")].join(""):f.a.t("notificationsCenter.fallPigletsWrongAmount")}case a.b.AUTO_CREATE_ANIMAL:{let t=r.a.getAnimalById(e.NData.AnmID),n=r.a.getAnimalLocationsByPlcmntID(e.NData.PlcmntID);return t&&n.length>0?f.a.t("notificationsCenter.autoCreateAnimalText",{animal:t.AnmNo1,location:n.map(e=>e.name).join(", ")}):t?f.a.t("notificationsCenter.autoCreateAnimalText",{animal:t.AnmNo1,location:"-"}):f.a.t("notificationsCenter.autoCreateAnimalText",{animal:"-",location:"-"})}case a.b.BIRTH_NEGATIVE_USG:{let t=r.a.getAnimalById(e.NData.AnmID);return t?[f.a.t("notificationsCenter.animal"),t.AnmNo1,f.a.t("notificationsCenter.birthNegativeUSGText")]:f.a.t("notificationsCenter.birthNegativeUSGTextNoAnimal")}case a.b.MOMMY_WRONG_AMOUNT:return f.a.t("notificationsCenter.mommyWrongAmountText");case a.b.TOO_FAST_INSEMINATION:let n=r.a.getAnimalById(e.NData.AnmID);return n?[f.a.t("notificationsCenter.animal"),n.AnmNo1,f.a.t("notificationsCenter.tooFastInseminationText")].join(""):f.a.t("notificationsCenter.tooFastInseminationNoAnimal");default:return f.a.t("notRecognized")+" "+f.a.t("notificationsCenter.message")}}function I(e){switch(e.NData.Type){case a.b.DEVICE_ALARM:let t=i.a.getDeviceByID(e.NData.DeviceID);if(t)switch(t.DevType){case c.d.DISPENSER_NRF:return n("XZUa").default;case c.d.CAGE:return n("RbfI").default;case c.d.CLIMATE:return n("Hc9C").default;case c.d.BRIDGE:return n("En8b").default;case c.d.SCALE:return n("HHIC").default;case c.d.DISPENSER:return n("0hRy").default;default:return n("e/p3").default}return n("e/p3").default;case a.b.FALL_PIGLETS_WRONG_AMOUNT:return n("Lqnr").default;case a.b.SEPARATION_WRONG_AMOUNT:return n("lXf0").default;case a.b.BIRTH_NEGATIVE_USG:case a.b.BIRTH_NO_PREGNANCY:case a.b.TOO_FAST_BIRTH:return n("hN/4").default;case a.b.TOO_FAST_INSEMINATION:case a.b.USG_NO_INSEMINATION:case a.b.NO_INSEMINATION:case a.b.NO_PREGNANCY_NO_INSEMINATION:return console.log(JSON.stringify(n("5tiW"))),n("5tiW").default;case a.b.MOMMY_WRONG_AMOUNT:return n("O9J6").default;case a.b.TREATMENT:return n("Iugh").default;case a.b.AUTO_CREATE_ANIMAL:return n("71VT").default;default:return n("e/p3").default}}},"3Srn":function(e,t,n){"use strict";n.d(t,"c",(function(){return h})),n.d(t,"b",(function(){return P})),n.d(t,"i",(function(){return v})),n.d(t,"f",(function(){return b})),n.d(t,"g",(function(){return C})),n.d(t,"d",(function(){return M})),n.d(t,"h",(function(){return L})),n.d(t,"e",(function(){return G})),n.d(t,"a",(function(){return F})),n.d(t,"m",(function(){return B})),n.d(t,"o",(function(){return W})),n.d(t,"n",(function(){return Y})),n.d(t,"l",(function(){return j})),n.d(t,"k",(function(){return k})),n.d(t,"j",(function(){return x})),n.d(t,"r",(function(){return H})),n.d(t,"p",(function(){return z})),n.d(t,"x",(function(){return K})),n.d(t,"u",(function(){return X})),n.d(t,"v",(function(){return Z})),n.d(t,"s",(function(){return J})),n.d(t,"w",(function(){return q})),n.d(t,"t",(function(){return Q})),n.d(t,"q",(function(){return $}));var a=n("C0l4"),r=n.n(a),i=n("qPyV"),o=n.n(i),c=n("i8MS"),s=n("tkTQ"),u=n("10H7"),l=n("wd/R"),f=n.n(l),d=n("q17X"),m=n("n7pt"),I=n("msTn"),g=n("B6RA"),T=n("pxzG"),E=n("eASP"),N=n("PRyg"),O=n("17UY"),D=n("r8wt"),A=n("i7k/"),S=n("kiXb"),y=n("JFfd"),p=n("XzT5");function h(e,t){let n=[];const{WData:{InseminationTime:a}}=e;let r=c.a.getAllAnimals(t,s.a.SOW),i=e.getDatesForList();for(let o of r){let e=[];e=Array.isArray(a)?o.events.filter(e=>{if(e.EvCode!==u.b.INSEMINATION)return!1;let t=f()(e.EvTime).add(a[0],"days").toDate().getTime(),n=f()(e.EvTime).add(a[1],"days").toDate().getTime();return ti.start.toDate().getTime()}):o.events.filter(e=>{if(e.EvCode!==u.b.INSEMINATION)return!1;let t=f()(e.EvTime).add(a,"days").toDate().getTime();return t>i.start.toDate().getTime()&&tArray.isArray(a)?e.date.start-t.date.start:e.date-t.date),o()(n,e=>[e.animal.AnmID,f()(e.insemination.EvTime).format("DD.MM.YYYY")].join())}function R(e,t,n,a){let r=Object(d.getTimeFromInseminationToPartuition)(),i=e.events.filter(e=>{if(e.EvCode!==u.b.INSEMINATION)return!1;let a=f()(e.EvTime).add(n,"days").toDate().getTime();return a>t.start.toDate().getTime()&&ac&&(o=u,s++);if(o){let t=f()(o.EvTime);if(!!!e.events.find(e=>e.EvCode===a&&e.EvTime>o.EvTime&&e.EvTime<(new Date).getTime()))return{animal:e,insemination:o,date:t.clone().add(n,"days"),parturitionDate:t.clone().add(r,"days"),pregnancyDay:f()().startOf("day").diff(t,"days"),repeatedInsemination:s}}}function P(e,t){let n=[];const{WData:{ConditionDays:a}}=e;let r=c.a.getAllAnimals(t,s.a.SOW),i=e.getDatesForList();for(let o of r)for(let e of a){let t=R(o,i,e,u.b.CONDITION);t&&n.push(t)}return n.sort((e,t)=>e.date.toDate().getTime()-t.date.toDate().getTime()),o()(n,e=>[e.animal.AnmID,f()(e.insemination.EvTime).format("DD.MM.YYYY"),e.date.format("DD.MM.YYYY")].join())}function v(e,t){let n=[];const{WData:{USGDays:a}}=e;let r=c.a.getAllAnimals(t,s.a.SOW),i=e.getDatesForList();for(let o of r)for(let e of a){let t=R(o,i,e,u.b.USG);t&&n.push(t)}return n.sort((e,t)=>e.date.toDate().getTime()-t.date.toDate().getTime()),o()(n,e=>[e.animal.AnmID,f()(e.insemination.EvTime).format("DD.MM.YYYY"),e.date.format("DD.MM.YYYY")].join())}function b(e,t){let n=[],a=c.a.getAllAnimals(t,s.a.SOW),r=e.getDatesForList();a=a.filter(e=>{let t=m.a.getTreeByLocationID(Array.isArray(e.PlcmntID)?e.PlcmntID[0].PlcmntID:e.PlcmntID);return t&&t.sector&&t.sector.SType===I.a.MATING});let i=r.end.diff(r.start,"days");for(let o=0;o{let n=t.events.filter(e=>e.EvCode===u.b.INSEMINATION);n.sort((e,t)=>t.EvTime-e.EvTime);let a=n[0];return!a||a.EvTime{let t=null,n=e.events.filter(e=>e.EvCode===u.b.SEPARATION);n.sort((e,t)=>t.EvTime-e.EvTime);let a=n[0];return a&&(t=f()().startOf("day").diff(f()(a.EvTime).startOf("day"),"days")),{animal:e,sterilleDays:t}})]}return o()(n,e=>e.animal.AnmID)}function C(e,t){let n=[],a=c.a.getAllAnimals(t,s.a.SOW);a=a.filter(e=>{let t=m.a.getTreeByLocationID(Array.isArray(e.PlcmntID)?e.PlcmntID[0].PlcmntID:e.PlcmntID);return t&&t.sector&&(t.sector.SType===I.a.MATING||t.sector.SType===I.a.DELIVERY||t.sector.SType===I.a.SOWS)});let r=e.getDatesForList(),i=Object(d.getTimeOnBirthRoomMommy)(),o=Object(d.getTimeOnBirthRoom)(),l=Object(d.getTimeOnMatingRoom)(),g=Object(d.getTimeOnSowsRoom)();for(let c of a){let e=c.events.filter(e=>e.EvCode===u.b.TRANSFER);e.sort((e,t)=>t.EvTime-e.EvTime);let t=e[0];if(t||c.DtaInTime){let e=t?t.EvTime:c.DtaInTime,a=m.a.getTreeByLocationID(Array.isArray(c.PlcmntID)?c.PlcmntID[0].PlcmntID:c.PlcmntID),s=a.sector.SType===I.a.MATING?l:a.sector.SType===I.a.SOWS?g:c.events.filter(t=>t.EvCode===u.b.MOMMY&&t.EvTime>e&&t.EvTime0?i:o,d=f()(e).add(s,"days").startOf("day").toDate().getTime();d>r.start.toDate().getTime()&&d+e.transferDate-+t.transferDate),n}function M(e,t){let n=[],a=c.a.getAllAnimals(t,s.a.SOW),r=e.getDatesForList(),i=Object(d.getTimeFromInseminationToPartuition)();for(let o of a){let e=R(o,r,i,u.b.PARTURITION);e&&e.pregnancyDay>=0&&n.push(e)}return n.sort((e,t)=>e.date-t.date),o()(n,e=>[e.animal.AnmID,f()(e.insemination.EvTime).format("DD.MM.YYYY")].join())}function _(e,t,n,a){return!!e.events.find(e=>{let r=f()(t).startOf("day");return a===D.b.VACCINE||a===D.b.STIMULATOR?e.EvCode===u.b.GRAFTING&&e.EvData.Medicine===n&&r.isSame(e.EvTime,"day"):e.EvCode===u.b.GRAFTING&&e.EvData.Medicine===n&&r.isBetween(e.EvData.StartTime,e.EvData.EndTime,null,"[]")})}function w(e,t,n,a,r,i,o,c){let s=[];for(let u of e)for(let e of u.WData.MedicineList)if(e.Age>t&&e.Aget.WordID===e.Medicine);if(u&&u.WData.Type===r){let e=i.start.clone().startOf("day").add(n,"days");_(o,e,u.WordID,r)||s.push({date:e,animal:o,medicine:u,weight:c})}}return s}function L(e,t,n,a){let i=[],l=c.a.getAllAnimals(t,n),d=e.getDatesForList(),m=g.default.getState(),I=m.dictionary.medicine,T=m.dictionary.graftingPrograms.filter(e=>e.WData.AnimalKind===n);if(n!==s.a.SOW){let e=l.filter(e=>e.DtaBrthTime);for(let t of e){let e=t.events.filter(e=>e.EvCode===u.b.WEIGHTING),n=e.length>0?e[0].EvData.Weight:t.Weight,r=w(T,d.start.clone().utc(!1).startOf("day").diff(t.DtaBrthTime,"days"),d.end.clone().utc(!1).startOf("day").diff(t.DtaBrthTime,"days"),I,a,d,t,n);i=[...i,...r]}}for(let o of l){let e=o.events.filter(e=>e.EvCode===u.b.INSEMINATION),t=o.events.filter(e=>e.EvCode===u.b.WEIGHTING),n=t.length>0?t[0].EvData.Weight:o.Weight;for(let r of e){let e=w(T,d.start.clone().utc(!1).startOf("day").diff(r.EvTime,"days"),d.end.clone().utc(!1).startOf("day").diff(r.EvTime,"days"),I,a,d,o,n);i=[...i,...e]}let c=o.events.filter(e=>e.EvCode===u.b.TREATMENT);if(t.sort((e,t)=>t.EvTime-e.EvTime),c.length>0)for(let s of c)for(let[e,n]of r()(s.EvData.Treatment)){let r=n.Dates.filter(e=>e>d.start.toDate().getTime()&&ee.WordID===r);if(n&&n.WData.Type===a){_(o,c,r,a)||i.push({animal:o,date:f()(c),medicine:n,weight:t.length>0?t[0].EvData.Weight:o.Weight,lastWeighting:t[0],event:s,treatmentIndex:e})}}}}return i.sort((e,t)=>e.date-t.date),o()(i,e=>[e.animal.AnmID,f()(e.date).format("DD.MM.YYYY"),e.medicine?JSON.stringify(e.medicine):"noMed"].join())}function G(e,t){let n=[],a=c.a.getAllAnimals(t,s.a.SOW),r=e.getDatesForList();const{WData:{DefaultActiveNipples:i}}=e;for(let o of a){let e=o.events.filter(e=>e.EvTime>r.start.toDate().getTime()&&e.EvTimee.EvCode===u.b.PARTURITION);if(t){let a=Object(N.getPigBalance)(e),r=O.a.getActiveNipples(o.AnmID);a>(r||i)&&n.push({animal:o,parturition:t,alive:a,nipples:r||i})}}return console.log(n),n.sort((e,t)=>e.parturition.EvTime-t.parturition.EvTime),o()(n,e=>e.animal.AnmID)}const F=e=>{let t=c.a.getAnimalLocationsByPlcmntID(e);if(t.length>0)return t[0].name},U=e=>e?e.start?"".concat(f()(e.start).format("DD.MM.YYYY")," - ").concat(f()(e.end).format("DD.MM.YYYY")):f()(e).format("DD.MM.YYYY"):null,B=e=>{const{insemination:t,repeatedInsemination:n}=e;if(t){let e=f()(t.EvTime).format("DD.MM.YYYY");return n&&(e+=" [".concat(S.a.t("inseminationRepeat",{repeat:n}),"]")),e}},W=e=>S.a.t("SType",{returnObjects:!0})[e-1],Y=e=>{if(e)return e.WData.Name},j=e=>{if(e)return"".concat(e.WData.Dose," ").concat(e.WData.Unit)},V=e=>{if(e)return Object(T.j)(e,{unit:E.a.MEDIUM,showUnit:!0})},k={name:"",headerClassName:"d-none empty",itemClassName:"d-none empty",field:"null"},x={name:"\u2713",headerClassName:"d-none",itemClassName:"d-none",field:"null"};function H(){return[{name:S.a.t("animalNumber"),field:"animal.AnmNo1",customSort:A.b},{name:S.a.t("location"),field:"animal.PlcmntID",valueFormatter:F},{name:S.a.t("inseminationDate"),field:"insemination.EvTime",valueFormatter:U,customSort:A.c},{name:S.a.t("examinationDate"),field:"date",valueFormatter:U,customSort:A.c}]}function z(){return[{name:S.a.t("animalNumber"),field:"animal.AnmNo1",customSort:A.b},{name:S.a.t("location"),field:"animal.PlcmntID",valueFormatter:F},{name:S.a.t("inseminationDate"),field:"insemination.EvTime",valueFormatter:U,customSort:A.c},{name:S.a.t("pregnancyDay"),field:"pregnancyDay"},{name:S.a.t("parturitionDate"),field:"parturitionDate",valueFormatter:U,customSort:A.c},{name:S.a.t("examinationDate"),field:"date",valueFormatter:U,customSort:A.c}]}function K(){return[{name:S.a.t("animalNumber"),field:"animal.AnmNo1",customSort:A.b},{name:S.a.t("location"),field:"animal.PlcmntID",valueFormatter:F},{name:S.a.t("inseminationDate"),field:"insemination.EvTime",valueFormatter:U,customSort:A.c},{name:S.a.t("pregnancyDay"),field:"pregnancyDay"},{name:S.a.t("parturitionDate"),field:"parturitionDate",valueFormatter:U,customSort:A.c},{name:S.a.t("usgDate"),field:"date",valueFormatter:U,customSort:A.c}]}function X(){return[{name:S.a.t("animalNumber"),field:"animal.AnmNo1",customSort:A.b},{name:S.a.t("location"),field:"animal.PlcmntID",valueFormatter:F},{name:S.a.t("idle"),field:"sterilleDays"}]}function Z(){return[{name:S.a.t("animalNumber"),field:"animal.AnmNo1",customSort:A.b},{name:S.a.t("location"),field:"animal.PlcmntID",valueFormatter:F},{name:S.a.t("currentSector"),field:"currentSector",valueFormatter:W},{name:S.a.t("nextSector"),field:"nextSector",valueFormatter:W},{name:S.a.t("transferDate"),field:"transferDate",valueFormatter:U,customSort:A.c}]}function J(){return[{name:S.a.t("animalNumber"),field:"animal.AnmNo1",customSort:A.b},{name:S.a.t("location"),field:"animal.PlcmntID",valueFormatter:F},{name:S.a.t("inseminationDate"),valueFormatter:B,customSort:A.c},{name:S.a.t("pregnancyDay"),field:"pregnancyDay"},{name:S.a.t("parturitionDate"),field:"parturitionDate",valueFormatter:U,customSort:A.c}]}function q(){return[{name:S.a.t("animalNumber"),field:"animal.AnmNo1",customSort:A.b},{name:S.a.t("location"),field:"animal.PlcmntID",valueFormatter:F},{name:S.a.t("weight"),field:"weight",valueFormatter:V},{name:S.a.t("lastWeighting"),field:"lastWeighting.EvTime",valueFormatter:U,customSort:A.c},{name:S.a.t("medicine"),field:"medicine",valueFormatter:Y},{name:S.a.t("dosage"),field:"medicine",valueFormatter:j},{name:S.a.t("date"),field:"date",valueFormatter:U,customSort:A.c}]}function Q(){return[{name:S.a.t("animalNumber"),field:"animal.AnmNo1",customSort:A.b},{name:S.a.t("location"),field:"animal.PlcmntID",valueFormatter:F},{name:S.a.t("parturitionDate"),field:"parturition.EvTime",valueFormatter:U,customSort:A.c},{name:S.a.t("alivePiglets"),field:"alive"},{name:S.a.t("activeNipples"),field:"nipples"}]}const $=e=>{switch(e){case y.a.INSEMINATIONS:return p.a.t("controlLists.mainView.sowsForRepeatedInsemination");case y.a.CONDITION:return p.a.t("condition");case y.a.USG:return p.a.t("usgTest");case y.a.SOWS_TO_INSEMINATION:return p.a.t("controlLists.mainView.sowsToInseminationTitle");case y.a.SOWS_TO_TRANSFER:return p.a.t("controlLists.mainView.sowsToTransferTitle");case y.a.PLANNED_PARTURITIONS:return p.a.t("controlLists.mainView.plannedParturitionsTitle");case y.a.SOWS_TO_GRAFTING:return p.a.t("controlLists.mainView.sowsToGraftingTitle");case y.a.BOARS_TO_GRAFRING:return p.a.t("controlLists.mainView.boarsToGraftingTitle");case y.a.PORKER_TO_GRAFTING:return p.a.t("controlLists.mainView.porkerToGraftingTitle");case y.a.PIGLET_TO_GRAFTING:return p.a.t("controlLists.mainView.pigletToGraftingTitle");case y.a.SOWS_FORAGE:return p.a.t("controlLists.mainView.sowsForageTitle");case y.a.BOARS_FORAGE:return p.a.t("controlLists.mainView.boarsForageTitle");case y.a.PORKER_FORAGE:return p.a.t("controlLists.mainView.porkerForageTitle");case y.a.PIGLET_FORAGE:return p.a.t("controlLists.mainView.pigletForageTitle");case y.a.SOWS_DOSATRON:return p.a.t("controlLists.mainView.sowsDosatronTitle");case y.a.BOARS_DOSATRON:return p.a.t("controlLists.mainView.boarsDosatronTitle");case y.a.PORKER_DOSATRON:return p.a.t("controlLists.mainView.porkerDosatronTitle");case y.a.PIGLET_DOSATRON:return p.a.t("controlLists.mainView.pigletDosatronTitle");case y.a.SOWS_STIMULATOR:return p.a.t("controlLists.mainView.sowsStimulatorTitle");case y.a.REMANENT:return p.a.t("controlLists.mainView.remanentTitle");default:return""}}},"3xDe":function(e,t,n){"use strict";n.d(t,"a",(function(){return u})),n.d(t,"e",(function(){return l})),n.d(t,"c",(function(){return m})),n.d(t,"b",(function(){return I})),n.d(t,"d",(function(){return g})),n.d(t,"g",(function(){return E})),n.d(t,"f",(function(){return N}));var a=n("J2iB"),r=n.n(a),i=n("4qC0"),o=n.n(i);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function l(e=0){let t="error";return e>=20&&(t="warning"),e>=40&&(t="info"),e>=75&&(t="success"),t}const f={success:"#33cc33",primary:"#33cc33",secondary:"#313131",error:"#fd3b60",info:"#00afff",warning:"#ffc007",white:"#ffffff",colorLightText:"#ffffff",colorDarkText:"#000000",red:"#fd3b60"},d={teal:"#53cba5",pink:"#ff57a9",blue:"#00afff",orange:"#ffc007",cyan:"#00cbda",yellow:"#f1db0e",green:"#33cc33"};function m(e="primary"){return e.startsWith("#")?e:function(e){for(var t=1;t+e||0):(e=u(e))?[e.r,e.g,e.b]:[0,0,0]:e?[e.r,e.g,e.b]:[0,0,0],Math.round(299*e[0]+587*e[1]+114*e[2]/1e3)}function E(e,t=m("colorLightText"),n=m("colorDarkText")){if(r()(e))return e;{let a=T(e),r=T(t);return Math.abs(a-3e4){let e=document.getElementById("root"),t=function(e,t,n){return"#"+[e,t,n].map(e=>{const t=e.toString(16);return 1===t.length?"0"+t:t}).join("")}(...getComputedStyle(e).getPropertyValue("background-color").split("(")[1].split(")")[0].split(",").map(e=>+e));document.querySelector('meta[name="theme-color"]').setAttribute("content",t)})}},"7e/R":function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));n("wd/R"),n("17UY"),n("10H7"),n("q17X");function a(e){try{for(let t=e.length;t<16;t++)e="0"+e;return e}catch(t){console.error(t)}}},"7w6X":function(e,t,n){"use strict";n.d(t,"b",(function(){return u})),n.d(t,"a",(function(){return l}));var a=n("wj3C"),r=n.n(a),i=n("ST2B"),o=n("B6RA"),c=n("ZRlo"),s=n("SjWX");n("gHGA");const u=()=>{r.a.initializeApp({apiKey:"AIzaSyC3MdMEF0T689-dCFBubO9gHFTK7GQzV5M",authDomain:"feturasns.firebaseapp.com",databaseURL:"https://feturasns.firebaseio.com",projectId:"feturasns",storageBucket:"feturasns.appspot.com",messagingSenderId:"1008420419627",appId:"1:1008420419627:android:1685a2929049113f"})},l=async e=>{try{if("granted"===await Notification.requestPermission()){const t=r.a.messaging(),n=await t.getToken();console.log("TOKEN",n);let a=Object(s.detect)(),u="".concat(e.LocalUserID,"_").concat(a.name,"_").concat(a.os);return o.default.dispatch(Object(c.a)(i.a.sns.platformApplicationArn,n,u,e.ClientID,e.LocalUserID,e.FarmData,e.Roles)),n}}catch(t){console.error(t)}}},"85nz":function(e,t,n){"use strict";function a(e,t){let n=[];for(const r in e)e.hasOwnProperty(r)&&("object"===typeof e[r]?a(e[r],t+"."+r):"code"===r&&(n=[...n,e[r]]));return n}function r(e={}){const{LicenseExpirationDate:t=0}=e;return+new Datee.Role===t);return a&&(a=a.LocalRights.find(e=>e.FarmID===n)),a}function f(e,t=i.default.getState().location.farm){const n=r()(i.default.getState(),"user.user.UserType"),a=n===c.OWNER,u=n===c.SERVICE;let f=[];for(let r in o){const n={hasRole:!!l(e,o[r],t)};switch(o[r]){case o.GENERAL_READ:n.text=s.a.t("userRolePicker.general");break;case o.BREEDING:n.text=s.a.t("breeding");break;case o.DEVICE_CAGE:n.text=s.a.t("userRolePicker.cages");break;case o.DEVICE_SILO:n.text=s.a.t("weights");break;case o.DEVICE_CONFIG:n.text=s.a.t("userRolePicker.configuration");break;case o.REPORT_READ:n.text=s.a.t("userRolePicker.reportsRead");break;case o.REPORT_WRITE:n.text=s.a.t("userRolePicker.reportsWrite");break;case o.DEVICE_FEEDING:n.text=s.a.t("feeding");break;case o.DEVICE_CLIMATE:n.text=s.a.t("climate");break;case o.DEVICE_CHAIN:n.text=s.a.t("userRolePicker.chains");break;case o.BILLING:(a||u)&&(n.text=s.a.t("billing"));break;case o.BUILDING:n.text=s.a.t("userRolePicker.buildings");break;case o.USER_MANAGE:n.text=s.a.t("userRolePicker.userManage");break;case o.DEVICE_PIGLET_CAGE:n.text=s.a.t("userRolePicker.smallCages");break;case o.DEVICE_COUNTER:n.text=s.a.t("userRolePicker.counters");break;case o.REPORTS:break;default:n.text=o[r]}f.push(n)}return f.filter(e=>e.text)}function d(){const{user:{user:{Roles:e,UserType:t}},location:{farm:n}}=i.default.getState(),a=(e||[]).filter(e=>r()(e,"Role","").startsWith("_DEVICE"));if([t.OWNER,c.SERVICE].includes(t))return!0;{const e=a.find(e=>e.Role===o.DEVICE_CONFIG);if(e){if(e.LocalRights.find(e=>e.FarmID===n))return!0}}return!1}function m(e,t,n=null){if(n||(n=i.default.getState().user.user.Roles),t||(t=i.default.getState().location.farm),e===o.SERVICE){let e=n.find(e=>e.Role===o.SERVICE);return!!e&&!!e.LocalRights.find(e=>e.FarmID===t)}for(let a of n)if(a.Role===o.SERVICE||a.Role===e){if(a.LocalRights.find(e=>e.FarmID===t))return!0}return!1}function I(e){if(!e){const t=i.default.getState().user.user;e=t&&t.Roles?t.Roles:[]}return e.filter(e=>e.Role===o.SERVICE).length>0}function g(){let e=i.default.getState().user.user.Roles,t=i.default.getState().user.user.UserType;return e.filter(e=>t===c.OWNER||e.Role===o.BILLING).length>0}function T(e=i.default.getState().user.user){return r()(e,"Roles",[]).filter(e=>e.Role===o.BILLING||e.Role===o.USER_MANAGE).length>0}function E(e=i.default.getState().user.user){return r()(e,"Roles",[]).filter(e=>e.Role===o.USER_MANAGE).length>0}function N(e=i.default.getState().user.user){return!(r()(e,"Roles",[]).filter(e=>e.Role===o.SERVICE).length>0)&&!r()(e,"AdminSubscription",!1)}function O(e=i.default.getState().user.user){return e.UserType===c.MANAGER}function D(e=[],t,n){const a=e=>{switch(e){case u.b.EXTENDED:return 2;case u.b.BASIC:return 1;default:return 0}};for(let r=0;r=a(o))return!0}return!1}function A(e=i.default.getState().user.user){return[c.SERVICE,c.OWNER,c.MANAGER].includes(e.UserType)}},Bzsw:function(e,t,n){"use strict";n.d(t,"a",(function(){return u})),n.d(t,"c",(function(){return l})),n.d(t,"b",(function(){return f}));var a=n("OwcS"),r=n("B6RA"),i=n("j1RV");function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function c(e){for(var t=1;t{const r=a.default.getState(),{user:{user:{LocalUserID:i,ClientID:o}},location:{farm:c}}=r;return{_FarmID:e||c,_LocalUserID:n||i,_ClientID:t||o}}},LKKa:function(e,t,n){"use strict";n.d(t,"c",(function(){return g})),n.d(t,"a",(function(){return T})),n.d(t,"b",(function(){return E})),n.d(t,"d",(function(){return N}));var a=n("44Ds"),r=n.n(a),i=n("UB5X"),o=n.n(i),c=n("Z0cm"),s=n.n(c),u=n("mwIZ"),l=n.n(u),f=n("wd/R"),d=n.n(f),m=n("ZRKa"),I=n("kiXb");const g=({scheduleMap:e=new Map,scheduleId:t})=>{const n=t?e.get(t)||m.a.getSettingByID(t,{showDeleted:!0}):null;return{doses:l()(n,"SetData.Doses",[]).map(e=>({start:d()(e.Start).format("HH:mm"),stop:d()(e.Stop).format("HH:mm"),percentage:"".concat(e.Percent,"%")})),isDeleted:!!l()(n,"DtaDelTime")}},T=({curveMap:e=new Map,curveId:t,day:n=1,animal:a})=>{if(!a)return!1;const r=t?e.get(t)||m.a.getSettingByID(t):null,i=l()(r,"SetData.Days",[]);let o=0;const c=n-1;for(let s=c;s>=Math.max(c-14,0);s--){if(i[s]&&i[s].Notify){const e=+d()().endOf("day"),t=+d()(e).startOf("day").subtract(o,"days");return!a.ConditionTime||!(e>=a.ConditionTime&&a.ConditionTime>=t)}o++}return!1};const E=r()(({lastWeekHistory:e})=>{const t=e=>I.a.t(e),n=[],a=[],r={0:t("today"),"-1":t("yesterday")},i=d()().startOf("day");for(let c=0;c<6;c++){let t=e.find(e=>+d()(e.date).startOf("day")===+i.clone().subtract(c,"day"));n.push(r["".concat(-c)]||-c),t?a.push(t.plannedUsage?Math.round((o()(t.usage)?100*t.usage:100*(s()(t.usage)?t.usage:[]).reduce((e,t)=>e+t,0))/t.plannedUsage):0):a.push(0)}return{labels:n,values:a}},(...e)=>JSON.stringify(e)),N=r()((function({curveMap:e=new Map,curveId:t,day:n=0}){if(!n||!t)return null;const a=e.get(t)||m.a.getSettingByID(t),r=l()(a,"SetData.Stages",[]);for(let i=r.length-1;i>=0;i--)if(n>=r[i].StartDay)return r[i].Name;return null}),(...e)=>JSON.stringify(e))},"Le/y":function(e,t,n){"use strict";n.d(t,"a",(function(){return T}));var a=n("D1y2"),r=n.n(a),i=n("GoyQ"),o=n.n(i),c=n("UB5X"),s=n.n(c),u=n("J2iB"),l=n.n(u),f=n("Z0cm"),d=n.n(f),m=n("mwIZ"),I=n.n(m),g=n("B6RA");const T={set:(e,t)=>{const n=JSON.stringify(t);return localStorage.setItem(e,n),!0},get:(e,t)=>{const n=JSON.parse(localStorage.getItem(e));return l()(n)?t:d()(n)||o()(n)?n:["true","false"].includes(n)?"true"===n:s()(+n)?+n:n},setPrivate:(e,t)=>{const n=I()(g.default.getState(),"user.user.LocalUserID");if(!n)return!1;let a=T.get("$_".concat(n),{});return o()(a)||(a={}),r()(a,e,t),T.set("$_".concat(n),a),!0},getPrivate:(e,t)=>{const n=I()(g.default.getState(),"user.user.LocalUserID");if(!n)return t;let a=T.get("$_".concat(n),{});return o()(a)||(a={}),I()(a,e,t)},clearPrivate:()=>{Object.keys(localStorage).forEach(e=>{e.startsWith("$_")&&localStorage.removeItem(e)})},clear:()=>localStorage.clear()}},"Lqn+":function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"m",(function(){return m})),n.d(t,"b",(function(){return I})),n.d(t,"c",(function(){return g})),n.d(t,"e",(function(){return T})),n.d(t,"d",(function(){return E})),n.d(t,"l",(function(){return N})),n.d(t,"f",(function(){return O})),n.d(t,"i",(function(){return D})),n.d(t,"n",(function(){return A})),n.d(t,"h",(function(){return S})),n.d(t,"g",(function(){return y})),n.d(t,"j",(function(){return p})),n.d(t,"k",(function(){return h}));n("J2iB"),n("j+1e"),n("lFKM"),n("a9jo"),n("RBan"),n("Y+p1"),n("Z0cm"),n("UfWW"),n("E+oP");var a=n("mwIZ"),r=n.n(a),i=n("10H7"),o=n("B6RA"),c=n("i8MS"),s=n("wd/R"),u=n.n(s),l=(n("Zayz"),n("q17X")),f=(n("uUZO"),n("XzT5"));function d(e,t){if(t<(e=e.filter(e=>[i.b.FALL,i.b.NO_PREGNANCY,i.b.SELL,i.b.USG,i.b.INSEMINATION].includes(e.EvCode))).length&&(e[t].EvCode===i.b.FALL||e[t].EvCode===i.b.NO_PREGNANCY||e[t].EvCode===i.b.SELL||e[t].EvCode===i.b.USG&&!1===e[t].EvData.Pregnant))return null;if(te.EvCode===i.b.INSEMINATION).sort((e,t)=>e.EvTime-t.EvTime))[0]||null}function m(){let e;try{e=o.default.getState().settings.general.SetData.Settings.Cycle.TimeFromInseminationToPartuition}catch(t){console.error(t)}return e||Object(l.getTimeFromInseminationToPartuition)()}function I(e){return r()(c.a.getAnimalById(e),"AnmNo1","?")}function g(e){let t=f.a.t("animalKind",{returnObjects:!0})[e]||"?";return t[0].toUpperCase()+t.slice(1)}function T(e,{format:t}={}){return u()(e).format(t)}function E(e){const{dictionary:{clients:t},language:{locale:n}}=o.default.getState();return r()(r()(t,"WData[".concat(n,"]"),[]).filter(t=>t.ID===e),"[0].Value","?")}function N(e){const{dictionary:{selectionReason:t},language:{locale:n}}=o.default.getState();return r()(r()(t,"WData[".concat(n,"]"),[]).filter(t=>t.ID===e),"[0].Value","?")}function O(e){const{dictionary:{graftingReason:t},language:{locale:n}}=o.default.getState();return r()(r()(t,"WData[".concat(n,"]"),[]).filter(t=>t.ID===e),"[0].Value","?")}function D(e){const{dictionary:{medicine:t}}=o.default.getState();return console.log(t),r()(t.filter(t=>t.WordID===e),"[0].WData.Name","?")}function A(e){const t=f.a.t("grid.treatmentTypes",{returnObjects:!0});let n="?";switch(+e){case 1:n=t.grafting||n;break;case 2:n=t.medicatedFeed||n;break;case 3:n=t.dosatron||n;break;case 4:n=t.stimulator||n;break;default:n="?"}return n[0].toUpperCase()+n.slice(1)}function S({dose:e,unit:t}){return e&&t?"".concat(e," ").concat(t).trim():"-"}function y(e){let t=c.a.getAnimalLocationsByPlcmntID(e);return t.length?t.map(e=>r()(e,"name","")).join(", ")||"?":"-"}function p(e){const{user:{employees:t}}=o.default.getState();return r()((t||[]).find(t=>t.LocalUserID===e),"userName",e.startsWith("ServiceWesstron")?e:"?")}function h(e=[],t="",n=(e=>e)){let a=0;for(let i=0;i(n?e:!e.DtaDelTime)&&e.EvCode===t).map(e=>ce(e)):[]}function ue(e,t){let n=se(e,t);return n.sort((e,t)=>t.EvTime-e.EvTime),n[0]}function le(e,t=!0){let n=0;e.sort((e,t)=>+e.EvTime-+t.EvTime);for(let r of e)switch(r.EvCode){case ne.PARTURITION:try{n+=+r.EvData.HealthyCnt}catch(a){console.error(a)}break;case ne.FALL_PIGLETS:try{n-=+r.EvData.Piglets}catch(a){console.error(a)}break;case ne.SEPARATION_TO_MOMMY:case ne.SEPARATION:try{n-=+r.EvData.PiCnt}catch(a){console.error(a)}break;case ne.MOMMY:try{n+=+r.EvData.PiCnt}catch(a){console.error(a)}break;case ne.INSEMINATION:t&&(n=0)}return n}function fe(e,t){try{let n=y.default.getState();const{events:{eventsForAnimals:a}}=n;let i=r()(a.get(e));return i=i.filter(e=>e.EvTime>=t&&!e.DtaDelTime),i.sort((e,t)=>e.EvTime-t.EvTime).map(e=>ce(e))}catch(n){return console.error(n),[]}}function de(e,t){if(!e)return 0;try{let n=ue(e.AnmID,ne.PARTURITION);if(!n)return 0;let a=fe(e.AnmID,n.EvTime);return t&&(a=a.filter(e=>o()(+e.EvTime).startOf("day").isSameOrBefore(t))),le(a)}catch(n){return console.error(n),0}}function me(e){return[{label:e("insertion"),value:"animalKind/insertion",svgPath:R.a,eligibleAnimal:[P.a.SOW,P.a.BOAR,P.a.PIGLET,P.a.PORKER,P.a.RENOVATION_SOW],category:te.a.OVERALL,drafts:$.a.getDrafts([ee.a.PORKER_AND_PIGLET_GROUP_INSERTION,ee.a.PORKER_AND_PIGLET_RFID_INSERTION,ee.a.RENOVATION_SOW_AND_BOAR_INSERTION,ee.a.SOW_INSERTION])},{label:e("insemination"),value:"insemination",svgPath:v.default,eligibleAnimal:[P.a.SOW,P.a.RENOVATION_SOW],category:te.a.PROCREATION,drafts:$.a.getDrafts([ee.a.INSEMINATION])},{label:e("usg"),value:"usg",svgPath:b.a,eligibleAnimal:[P.a.SOW],category:te.a.PROCREATION,drafts:$.a.getDrafts([ee.a.USG])},{label:e("noPregnancy"),value:"noPregnancy",svgPath:C.a,eligibleAnimal:[P.a.SOW],category:te.a.PROCREATION,drafts:$.a.getDrafts([ee.a.NO_PREGNANCY])},{label:e("parturition"),value:"parturition",svgPath:M.default,eligibleAnimal:[P.a.SOW],category:te.a.PARTURITION,drafts:$.a.getDrafts([ee.a.PARTURITION])},{label:e("separationToPigletHouse"),value:"locationChooser/separationToPigletHouse",svgPath:_.default,eligibleAnimal:[P.a.SOW],category:te.a.PARTURITION,drafts:$.a.getDrafts([ee.a.SEPARATION_TO_PORKHOUSE])},{label:e("separationToMommy"),value:"separationToMommy",svgPath:w.a,eligibleAnimal:[P.a.SOW],category:te.a.PARTURITION,drafts:$.a.getDrafts([ee.a.SEPARATION_TO_MOMMY])},{label:e("grafting"),value:"grafting",svgPath:L.a,eligibleAnimal:[P.a.SOW,P.a.PIGLET,P.a.BOAR,P.a.PORKER,P.a.RENOVATION_SOW],category:te.a.GRAFTING,drafts:$.a.getDrafts([ee.a.GRAFTING])},{label:e("scheduleOfTreatment"),value:"scheduleOfTreatment",svgPath:G.default,eligibleAnimal:[P.a.SOW,P.a.PIGLET,P.a.BOAR,P.a.PORKER,P.a.RENOVATION_SOW],category:te.a.GRAFTING,drafts:$.a.getDrafts([ee.a.TREATMENT])},{label:e("fallPiglets"),value:"fallPiglets",svgPath:F.default,eligibleAnimal:[P.a.SOW],category:te.a.FALL,drafts:$.a.getDrafts([ee.a.FALL_PIGLETS])},{label:e("transfer"),value:"locationChooser/transfer",svgPath:U.a,eligibleAnimal:[P.a.SOW,P.a.PIGLET,P.a.BOAR,P.a.PORKER,P.a.RENOVATION_SOW],category:te.a.OVERALL,drafts:$.a.getDrafts([ee.a.TRANSFER_STAND,ee.a.TRANSFER_CHAMBER])},{label:e("fall"),value:"fall",svgPath:B.a,eligibleAnimal:[P.a.RENOVATION_SOW,P.a.SOW,P.a.PIGLET,P.a.BOAR,P.a.PORKER],category:te.a.FALL,drafts:$.a.getDrafts([ee.a.FALL])},{label:e("sale"),value:"sale",svgPath:W.a,eligibleAnimal:[P.a.RENOVATION_SOW,P.a.SOW,P.a.PIGLET,P.a.BOAR,P.a.PORKER],category:te.a.SELL,drafts:$.a.getDrafts([ee.a.SELL])},{label:e("selection"),value:"selection",svgPath:Y.a,eligibleAnimal:[P.a.RENOVATION_SOW,P.a.SOW,P.a.BOAR],category:te.a.SELL,drafts:$.a.getDrafts([ee.a.SELECTION])},{label:e("weighting"),value:"weighting",svgPath:j.a,eligibleAnimal:[P.a.RENOVATION_SOW,P.a.SOW,P.a.PIGLET,P.a.BOAR,P.a.PORKER],category:te.a.OVERALL,drafts:$.a.getDrafts([ee.a.WEIGHTING])},{label:e("activeNipples"),value:"activeNipples",svgPath:V.a,eligibleAnimal:[P.a.SOW],category:te.a.PARTURITION,drafts:$.a.getDrafts([ee.a.ACTIVE_NIPPLES])},{label:e("reclassify"),value:"reclassify",svgPath:k.a,eligibleAnimal:[P.a.PORKER],category:te.a.OVERALL,drafts:$.a.getDrafts([ee.a.RECLASSIFY])},{label:e("pigletsTreatment"),value:"pigletsTreatment",svgPath:H.a,eligibleAnimal:[P.a.SOW],category:te.a.GRAFTING,drafts:$.a.getDrafts([ee.a.PIGLETS_TREATMENT])},{label:e("heat"),value:"heat",svgPath:x.a,eligibleAnimal:[P.a.RENOVATION_SOW,P.a.SOW],category:te.a.PROCREATION,drafts:$.a.getDrafts([ee.a.HEAT])}]}function Ie(e,t){let n=Z.a.getAnimalById(e);if(!n)throw new Error("Nie odnaleziono zwierz\u0119cia");return ge(n,t)}function ge(e,t,n=!0){try{if(e.AnimalKind===P.a.PORKER||e.AnimalKind===P.a.PIGLET){let t=J.a.getGroupWithAnimal(e.AnmID,e.FarmID)[0];if(t)return t.AnmGrp}if(e.AnimalKind===P.a.SOW||e.AnimalKind===P.a.RENOVATION_SOW){let n=q.a.getTechnologyGroupsWithAnimal(e.FarmID,e.AnmID,!0).filter(e=>e.StartTimet.StartTime-e.StartTime)[0];if(console.log(n),n&&n.includesDate(t))return n.TGID}return"noGrID"}catch(a){return console.error(a),"noGrID"}}function Te(e,t){return!Object(re.i)()&&o()(e).toDate().getTime()>o()().toDate().getTime()}function Ee(e){e.sort((e,t)=>+e.EvTime-+t.EvTime);let t=e.filter(e=>e.EvCode===ne.INSEMINATION),n=t[0],a=Object(Q.getDaysForRepeatedInsemination)();for(let r of t)if(o()(r.EvTime).diff(n.EvTime,"days")>a)return r;return n}function Ne(e){let t=Ee(e);if(t){const e=Object(Q.getTimeFromInseminationToPartuition)();return+o()(+t.EvTime).add(e,"days")}return null}function Oe(e){let t=Ne(e);return t?o()(t).format("DD.MM.YYYY"):"-"}const De=e=>({[ae.a.clients]:"newSettings.dictionary.manage.item.clients",[ae.a.fallReasons]:"newSettings.dictionary.manage.item.fallReasons",[ae.a.feedingCurves]:"newSettings.dictionary.manage.item.feedingCurves",[ae.a.forageType]:"newSettings.dictionary.manage.item.forageType",[ae.a.graftingReason]:"newSettings.dictionary.manage.item.graftingReason",[ae.a.medicine]:"medicines",[ae.a.noPreganancy]:"newSettings.dictionary.manage.item.noPreganancy",[ae.a.race]:"newSettings.dictionary.manage.item.race",[ae.a.selectionReason]:"newSettings.dictionary.manage.item.selectionReason",[ae.a.suppliers]:"newSettings.dictionary.manage.item.suppliers",[ae.a.weighting]:"weighting",[ae.a.controlLists]:"controlLists.mainView.header",[ae.a.taskCategory]:"newSettings.dictionary.manage.item.taskCategory"}[e]||null)},PVpG:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var a=n("kiXb");const r=e=>a.a.t(e),i=e=>{switch(console.log(e),e){case"Username cannot be empty":return r("errors.noEmptyLogin");case"Password cannot be empty":case"Custom auth lambda trigger is not configured for the user pool.":return r("errors.noEmptyPassword");case"User is disabled.":return r("errors.UserDisabled");case"Attempt limit exceeded, please try after some time.":return r("errors.LimitExceededException");case"Confirmation code cannot be empty":return r("errors.noEmptyVerificationCode");case"Password did not conform with policy: Password not long enough":case"Password does not conform to policy: Password not long enough":case"1 validation error detected: Value at 'password' failed to satisfy constraint: Member must have length greater than or equal to 6":return r("errors.passLognerThan");case"Invalid verification code provided, please try again.":return r("errors.CodeMismatchException");case"Password did not conform with policy: Password must have uppercase characters":case"Password does not conform to policy: Password must have uppercase characters":return r("errors.passMinOneBig");case"Password did not conform with policy: Password must have numeric characters":case"Password does not conform to policy: Password must have numeric characters":return r("errors.passMinOneNumber");case"Password did not conform with policy: Password must have symbol characters":case"Password does not conform to policy: Password must have symbol characters":return r("errors.passMinOneSpecial");case"User does not exist.":case"Incorrect username or password.":return r("errors.BadLoginPassword");case"No connection to server":return r("errors.noConnection");case"Username/client id combination not found.":return r("errors.UserNotFound");case"User is not confirmed.":return r("errors.UserNotConfirmed");case"The Auth category has been configured successfully":return r("errors.RegistrationSuccess");case"Session expired.":return r("errors.sessionExpired");case"Cannot reset password for the user as there is no registered/verified email or phone_number":return r("errors.noRegisteredMail");default:return e}}},Q2bl:function(e,t,n){"use strict";n.d(t,"a",(function(){return g})),n.d(t,"c",(function(){return E})),n.d(t,"b",(function(){return N}));var a=n("4qC0"),r=n.n(a),i=n("GoyQ"),o=n.n(i),c=n("Z0cm"),s=n.n(c),u=n("mwIZ"),l=n.n(u),f=n("BkRI"),d=n.n(f),m=n("B6RA"),I=n("+bso");function g(e){const t=m.default.getState(),n=l()(t,"user.user.LocalUserID"),a=l()(t,"user.user.ClientID"),i=l()(t,"farmDevices.devices"),c=e=>i.find(t=>t.DevID===e);let u,f,d="?",g=!1;console.log("getIOTAttributes",e);try{if(s()(e)){console.log("isArray",e),u=[];for(let t of e)if(o()(t))console.log("isObject",t),u.push(t.DevID),f||(f=t.GatewayID),T(f,t.GatewayID);else if(r()(t)){console.log("isString",t);let e=c(t);u.push(t),e&&(f||(f=e.GatewayID),T(f,e.GatewayID))}}else if(o()(e))console.log("isObject",e),u=e.DevID,f=e.GatewayID;else if(r()(e)){console.log("isString",e);let t=c(e);t&&(u=t.DevID,f=t.GatewayID)}let t=c(s()(u)&&u.length>1?f:s()(u)?u[0]:u);t&&t.Name&&(d=t.Name),s()(u)&&1===u.length&&(u=u[0]),s()(u)&&(d="".concat(d," (").concat(u.length,")")),g=d&&f&&u&&a&&n}catch(N){console.error("getIOTAttributes EXCEPTION OCCURED: ",N),g=!1}const E={LocalUserID:n,ClientID:a,DevID:u,GatewayID:f,Name:d,isValid:!!g};if(!g){const e=Object.keys(E).filter(e=>!E[e]);console.error("getIOTAttributes MISSING KEYS: ".concat(e.join(", ")));try{!function(e,t){const{user:{user:{ClientID:n}}}=m.default.getState();if("TestNewRole"!==n){Object(I.b)().notify("missing IOT attributes",{severity:"error",metaData:{feedback:{user:n,missing:e,ids:t}}})}}(e,E),console.log("sending report")}catch(N){console.error(N)}}return E}function T(e,t){if(e&&e!==t)throw Error("Device with different GatewayID passed! Expected: ".concat(e," found: ").concat(t))}function E(e,t=""){return s()(e)?e.map(e=>"".concat(e).concat(t)):"".concat(e).concat(t)}function N(e){let t=d()(e);return["device","SetTime","loadedDataFrom","changed"].forEach(e=>{delete t[e]}),t}},Tpgi:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var a=n("/pZs"),r=n("+bso"),i=n("m9wQ");function o(e=a.a.NOT_SPECIFIED,t){let n=Object(r.b)();const o=t&&t.toString?t.toString():"No info available",c="".concat(e,"-").concat(Object(i.b)(o));return n.notify("Controlled ER CODE: ".concat(c),{metaData:{feedback:{causedBy:o,stack:t&&t.stack?t.stack:"No info available"}}}),c}},VfnB:function(e,t,n){"use strict";n.d(t,"c",(function(){return te})),n.d(t,"h",(function(){return ne})),n.d(t,"v",(function(){return oe})),n.d(t,"r",(function(){return ce})),n.d(t,"u",(function(){return ue})),n.d(t,"a",(function(){return le})),n.d(t,"i",(function(){return fe})),n.d(t,"k",(function(){return de})),n.d(t,"e",(function(){return me})),n.d(t,"m",(function(){return Ie})),n.d(t,"g",(function(){return ge})),n.d(t,"f",(function(){return Te})),n.d(t,"q",(function(){return Ee})),n.d(t,"l",(function(){return Oe})),n.d(t,"t",(function(){return Ae})),n.d(t,"n",(function(){return Se})),n.d(t,"w",(function(){return ye})),n.d(t,"d",(function(){return pe})),n.d(t,"p",(function(){return Re})),n.d(t,"s",(function(){return Pe})),n.d(t,"o",(function(){return ve})),n.d(t,"j",(function(){return be})),n.d(t,"b",(function(){return Ce}));var a=n("J2iB"),r=n.n(a),i=n("E+oP"),o=n.n(i),c=n("4qC0"),s=n.n(c),u=n("BkRI"),l=n.n(u),f=n("GoyQ"),d=n.n(f),m=n("Z0cm"),I=n.n(m),g=n("44Ds"),T=n.n(g),E=n("mwIZ"),N=n.n(E),O=n("B6RA"),D=n("g9bv"),A=n("zDJl"),S=n("wd/R"),y=n.n(S),p=n("j1RV"),h=n("kCmh"),R=(n("ZRKa"),n("dgT6")),P=(n("P0Qa"),n("dz5w")),v=n("4pKL"),b=n("ml9u"),C=n("n2uv"),M=n("dQyM"),_=n("R7+t"),w=n("TQJ8"),L=n("Ogml"),G=n("40mZ"),F=n("tIcX"),U=n("QX5u"),B=n("Svle"),W=n("4czH"),Y=n("C07J"),j=n("qFW1"),V=n("RRbG"),k=n("pLLp"),x=n("YDFS"),H=n("kiXb"),z=n("LxSa"),K=n("ZXZZ"),X=n("XzT5"),Z=n("KRta");function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function q(e){for(var t=1;tH.a.t(e);function ee(e){let t=0;return e<=50&&(t=2*e),e>50&&(t=3*e-50),e>80&&(t=4*e-130),e>105&&(t=6*e-340),e>150&&(t=10*e-940),e>180&&(t=15*e-1840),t}function te(e){let t=ee(e);return t>1e3&&(t=1e3),t/10}function ne(e,t,n=[]){let a=e.filter(e=>e.FarmID===t.FarmID),r=n.filter(e=>e.FarmID===t.FarmID&&!a.filter(t=>t.DevID===e.DevID&&e.FarmID===t.FarmID)[0]&&[A.d.DISPENSER,A.d.SCALE,A.d.CLIMATE,A.d.CAGE,A.d.BRIDGE].includes(e.DevType)&&function(e){if(e&&"DI"===e.DevType&&e.Protocol===A.g.NRF)try{if(6!==e.DevID.split("_")[2].length)return!1;if(e.DevID.split("_")[2].endsWith("0"))return!1}catch(t){return!1}return!e||"BR"!==e.DevType||!e.DevID.includes("CONF")&&!e.DevID.includes("WORK")}(e)),i=[...a,...r];if(t&&t.DevID){return{name:t.Name,nodeID:t.DevID,device:t,type:D.b.RASPBERRY,children:ie(i,t),nodeSvgShape:{shapeProps:{fill:D.a.GATEWAY,r:20}}}}}function ae(e,t,n){let a=[];return e&&e.filter(e=>t.DevID===e.ParentID&&e.Interface===n).map(t=>{let n={name:t._id?"".concat(t.DevType," ").concat(t.DevAdr):t.Name,nodeID:t.DevID,type:t._id?t.DevType===A.d.BRIDGE?D.b.BRIDGE_GW:D.b.DEVICE_GW:t.DevType===A.d.BRIDGE?D.b.BRIDGE:D.b.DEVICE,children:ie(e,t),device:t,nodeSvgShape:{shapeProps:{fill:re(t),r:10}}};a.push(n)}),a}function re(e){if(e._id)return D.a.NOT_IMPORTED;{let t=e.DevType;switch(t){case A.d.GATEWAY:return D.a.GATEWAY;case A.d.BRIDGE:return D.a.BRIDGE;default:if(!e.Address||e.Interface<0)return D.a.ERROR;switch(t){case A.d.DISPENSER_NRF:return D.a.DISPENSER_NRF;case A.d.DISPENSER:return D.a.DISPENSER;case A.d.CLIMATE:return D.a.CLIMATE;case A.d.CAGE:return D.a.CAGE;case A.d.SCALE:return D.a.SCALE;default:return D.a.ERROR}}}}function ie(e,t){let n=[];return e&&(t.DevType===A.d.BRIDGE?Object.keys(A.h).filter(n=>n.startsWith("RS485")||n.startsWith("NRF_")||!!ae(e,t,A.h[n]).length).map(a=>{let r={name:a,nodeID:"".concat(t.DevID,"_").concat(a),type:D.b.INTERFACE,nodeSvgShape:{shapeProps:{fill:t.Interfaces[A.h[a]]?D.a.INTERFACE:D.a.ERROR,r:10}},iface:A.h[a],bridge:t,children:ae(e,t,A.h[a])};return n.push(r)}):e.filter(e=>t.DevID===e.ParentID).map(t=>{let a={name:t._id?"".concat(t.DevType," ").concat(t.DevAdr):t.Name,nodeID:t.DevID,nodeSvgShape:{shapeProps:{fill:re(t),r:10}},type:t._id?t.DevType===A.d.BRIDGE?D.b.BRIDGE_GW:D.b.DEVICE_GW:t.DevType===A.d.BRIDGE?D.b.BRIDGE:D.b.DEVICE,children:ie(e,t),device:t};n.push(a)})),n}function oe(e){if(e){let t=e.CData.DeviceIDs;for(let n in e.CAnsw)t=t.filter(e=>e!==n);se(t),O.default.dispatch(Object(V.d)({DevID:e.CData.DeviceIDs,status:!1}))}}function ce(e){if(e&&I()(e))try{let t=new Map;for(const n of e){let e;if(e=d()(n)?l()(n):h.a.getDeviceByID(n),e&&e.GatewayID){let n=t.get(e.GatewayID)||{[A.d.CAGE]:[],[A.d.CLIMATE]:[],[A.d.SCALE]:[],[A.d.DISPENSER_NRF]:[],[A.d.DISPENSER]:[],[A.d.DISPENSER_NRF_MULTI]:[],[A.d.BROADCAST]:[],[A.d.WATER_FLOW_METER]:[],[A.d.ELECTRICITY_FLOW_METER]:[],[A.d.CHAIN_FEEDING]:[],[A.d.CLIMATE_SK3]:[]};n[e.DevType]&&!n[e.DevType].filter(t=>t.DevID===e.DevID)[0]&&n[e.DevType].push(e),t.set(e.GatewayID,n)}}return o()(t)?void 0:t}catch(t){return void console.error(t)}}function se(e=[]){if(e&&e.length){let t=e.map(e=>{let t=h.a.getDeviceByID(e);return t?"".concat(t.Name,"-").concat(t.Address):e}),n={title:X.a.t("error"),message:X.a.t("popNotifications.connectDeviceFailure",{error:t.length>3?t[0]+"...+"+(t.length-1):t.join(", ")}),status:"error",dismissible:!0,dismissAfter:5e3};O.default.dispatch(Object(p.addNotification)(n))}}function ue(e,t){if(t&&t.CData){let e=t.CData.DeviceIDs;se(e),O.default.dispatch(Object(V.d)({DevID:e,status:!1}))}}function le(e,t,n=R.a.VIEW){let a=e||[];return void 0===t||!a.includes(n+t)&&a.push(n+t),a}function fe(e,t=!0){let n=[];return(e||[]).map(e=>{let t=d()(e)?e.code:e;var a,r;return R.a.VIEW+1e3>t&&t>=R.a.VIEW?(r=t-R.a.VIEW,t=X.a.t("deviceUtils.viewErrors.".concat(r),{returnObjects:!0})?X.a.t("deviceUtils.viewErrors.".concat(r)):X.a.t("deviceUtils.bugNotRecognized",{error:r})):R.a.CONFIG+1e3>t&&t>=R.a.CONFIG?(a=t-R.a.CONFIG,t=$("deviceUtils.dispenserConfigError.".concat(a))?$("deviceUtils.dispenserConfigError.".concat(a)):"".concat($("deviceUtils.bugNotRecognized")," ").concat(a)):R.a.FEEDING+1e3>t&&t>=R.a.FEEDING?t=function(e){switch(e){case 0:return X.a.t("deviceUtils.previosFeedingProblem");case 1:return X.a.t("deviceUtils.motorOverload");case 2:return X.a.t("deviceUtils.motorCircuitBreak");case 3:return X.a.t("deviceUtils.noPower");case 4:return X.a.t("deviceUtils.skipDoseOrder");case 5:return X.a.t("deviceUtils.skipDoseLock");case 6:return X.a.t("deviceUtils.skipDoseLockClick");case 7:return X.a.t("deviceUtils.skipDoseHold");default:return X.a.t("deviceUtils.bugNotRecognized",{error:e})}}(t-R.a.FEEDING):R.a.MOTOR+1e3>t&&t>=R.a.MOTOR&&(t=function(e){switch(e){case 0:return X.a.t("deviceUtils.noBreakdown");case 1:return X.a.t("deviceUtils.motorBlockage");case 2:return X.a.t("deviceUtils.motorCircuitBreak");default:return X.a.t("deviceUtils.bugNotRecognized",{error:e})}}(t-R.a.MOTOR)),n.push({time:d()(e)?e.time:null,message:t})}),t?n.map(e=>"".concat(e.time?y()(e.time).format()+": ":"").concat(e.message)).join(", "):n}function de(e){try{switch(e.DevType){case A.d.BRIDGE:return new v.a(e);case A.d.CAGE:return new b.a(e);case A.d.CLIMATE:return new C.a(e);case A.d.DISPENSER:return new M.a(e);case A.d.DISPENSER_NRF:return new _.a(e);case A.d.GATEWAY:return new P.a(e);case A.d.SCALE:return new w.a(e);case A.d.BROADCAST:return new G.a(e);case A.d.BRIDGE_WORK:return new F.a(e);case A.d.BRIDGE_CONF:return new U.a(e);case A.d.DI_TIME:return new B.a(e);case A.d.DISPENSER_NRF_MULTI:return new W.a(e);case A.d.THERMOEYE:return new Y.a(e);case A.d.ANTENNA_RFID:return new j.a(e);case A.d.WATER_FLOW_METER:return new k.a(e);case A.d.ELECTRICITY_FLOW_METER:return new z.a(e);case A.d.CHAIN_FEEDING:return new K.a(e);case A.d.SMALL_CAGE:return new x.a(e);case A.d.CLIMATE_SK3:return new Z.a(e);default:return new L.a(e)}}catch(t){return e}}function me(e,t=["$loki","meta","location","GatewayID"]){let n=l()(e);if(e)if(Array.isArray(n))n.map(e=>{for(let n of t)delete e[n];return e});else for(let a of t)delete n[a];return n}function Ie(e=[],t=!0){let n=[];return e.forEach(e=>{let a={device:e};if(A.d.SCALE===e.DevType){N()(e,"Siloses",[]).forEach(e=>{e.Active&&n.push(q({},a,{index:+e.Adr}))})}else if(A.d.DISPENSER===e.DevType){N()(e,"Dispensers",[]).forEach(e=>{e.Connected&&n.push(q({},a,{index:+e.Adr}))})}else t&&[A.d.CAGE,A.d.CLIMATE,A.d.DISPENSER_NRF,A.d.ANTENNA_RFID,A.d.WATER_FLOW_METER,A.d.ELECTRICITY_FLOW_METER,A.d.SMALL_CAGE,A.d.CHAIN_FEEDING].includes(e.DevType)?n.push(a):t||n.push(a)}),console.log(n,"getFlatDevices"),n}function ge(e,{showDEC:t=!1,showInterface:n=!0,showBridgeName:a=!0}={}){if(!e)return;const{DevID:r,Adr:i}=e;let o=h.a.getDeviceByID(r);if(!o)return;let c=o.DevType===A.d.DISPENSER_NRF?"0x".concat(o.Address.toString(16)):o.getSelectName(i);if(n)try{c+=" ".concat(Se(o.Interface))}catch(s){}if(a)try{let e=h.a.getDeviceByID(o.ParentID);c+=e?" Br: ".concat(e.Name," Adr: ").concat(e.Address):""}catch(s){}return c}function Te(e=[]){const t=[];return(I()(e)?e:[e]).forEach(e=>{I()(e.PlcmntID)?e.PlcmntID.forEach(e=>t.push(e.PlcmntID)):t.push(e.PlcmntID)}),t.filter(e=>!!e)}function Ee(e,t){let n=["Sectors","Chambers","Boxes"],a=0;for(let r of e){if(r.PlcmntID){let e=t.BgID||t.SID||t.CID||t.BID;a+=r.PlcmntID.filter(t=>t.PlcmntID===e).length}for(let r of n)if(t[r])for(let n of t[r])a+=Ee(e,n)}return a}function Ne(e){switch(e){case 5:return"L";case 6:return"R";case 7:return"C";default:return N()(Object.entries(A.h).filter(([t,n])=>n===e),"[0][0]")||"?"}}function Oe(e){return N()(h.a.getDeviceByID(e),"Name","?")}const De=e=>e.getLocation().map(e=>e.CName||e.BName||e.SName||e.FarmName||e.BoxesName).join(", ");function Ae(e){return[{name:e("location"),valueFormatter:De},{name:e("designation"),field:"Name",_mobileHeader:!0},{name:e("adres"),field:"Address",valueFormatter:e=>function(e,{padStartZeros:t=4}={}){return"0x".concat((+e).toString(16).toUpperCase().padStart(t,"0"))}(e)},{name:e("newSettings.cage.manage.interface"),field:"Interface",valueFormatter:Ne},{name:e("newSettings.cage.manage.bridge"),field:"ParentID",valueFormatter:e=>Oe(e)},{name:e("newSettings.cage.manage.gateway"),field:"GatewayID",valueFormatter:e=>Oe(e)}]}function Se(e){for(let t in A.h)if(A.h[t]===e)return t}function ye(e){let t=e||O.default.getState().location.farm,n=h.a.getDevices(t),a=new Map;for(let r of n)if(Array.isArray(r.PlcmntID))for(let e of r.PlcmntID){let t=a.get(e.PlcmntID)||[];-1===t.findIndex(e=>e.DevID===r.DevID)&&(t.push(r),a.set(e.PlcmntID,t))}return a}function pe(e,t){"string"!==typeof e&&(e+=""),e=e.replace(/ /g,"");let n=[];for(let a of e.split(",").filter(e=>e))if(console.log(a),a.includes("-")){let e=[Number(a.split("-")[0]),Number(a.split("-")[1])];n=[...n,...he(Math.min(...e),Math.max(...e),t)]}else n=[...n,Number(a)];return[...new Set(n)]}function he(e=0,t=128,n=""){let a=[];switch(n){case A.d.DISPENSER_NRF:{let n=e,r=n>>8,i=255&n;do{i>15&&(i=1,r+=2),n=r<<8|i,a.push(n),i++}while(nr));e+=2){let t="0x".concat(e,"00");a.push(+t)}break}default:for(let n=e;n<=t;n++)a.push(n)}return a}function Re(e){try{if(!e)throw new Error("Device ID not provided");const t=h.a.getDeviceByID(e);if(!t||t.DevType!==A.d.DISPENSER_NRF)throw new Error("Device not found or device is not Dispenser NRF");const n=65280&t.Address,a=O.default.getState().location.farm,r={Address:n,DevType:A.d.DISPENSER_NRF_MULTI,ParentID:t.ParentID,FarmID:a};let i=h.a.getDevicesByAttributes(r);if(1===i.length)return i[0];throw new Error("Too many devices found for given attributes")}catch(t){return console.error(t),null}}const Pe=T()((e,t)=>!!e.find(e=>e.DevType===t),(...e)=>JSON.stringify(e)),ve=e=>{if(d()(e)){const t=Math.max(...Object.values(e));return isFinite(t)?t:void 0}if(isFinite(e))return e},be=T()((e=[],t=[])=>{const n=new Map,a=new Map;return e.forEach(e=>{n.set(e.BgID,{name:e.BName}),(e.Sectors||[]).forEach(e=>{(e.Chambers||[]).forEach(t=>{n.set(t.CID,{sectorType:e.SType,name:t.CName})})})}),t.forEach(e=>{if(s()(e.PlcmntID)){if(n.has(e.PlcmntID)){const[t,{sectorType:r,name:i}]=n.entries().find(([t])=>t===e.PlcmntID);a.set(e.DevID,{CID:t,sectorType:r,name:i})}}else if(I()(e.PlcmntID))for(let t of e.PlcmntID)if(n.has(t.PlcmntID)){const[r,{sectorType:i,name:o}]=[...n.entries()].find(([e])=>e===t.PlcmntID);a.set(e.DevID,{CID:r,sectorType:i,name:o});break}}),a},(...e)=>JSON.stringify(e)),Ce=({DevID:e,index:t=null}={})=>r()(t)?e:"".concat(e,"_").concat(t)},WFNR:function(e,t,n){"use strict";n.d(t,"a",(function(){return f})),n.d(t,"b",(function(){return d}));var a=n("44Ds"),r=n.n(a),i=n("GoyQ"),o=n.n(i),c=n("Z0cm"),s=n.n(c),u=n("1j/Y"),l=n("s506");const f=r()((e,t)=>{if(s()(e))return e;const n=new Map(e.entries),a=t.trim().toLowerCase();if(""===a)return n;const r=(e=[])=>e.filter(e=>"".concat(e.FarmName||"").concat(e.Adr||"").concat(e.FarmID||"").toLowerCase().includes(a)),i=e=>e.slice(0).sort((e,t)=>{const n=e=>3*Object(u.compareTwoStrings)((e.FarmID||"").toLowerCase(),a)+2*Object(u.compareTwoStrings)((e.FarmName||"").toLowerCase(),a)+Object(u.compareTwoStrings)((e.Adr||"").toLowerCase(),a);return n(t)-n(e)});if(o()(n)){let e=new Map;for(let[t,{name:o,farms:c}]of n.entries()){const n=r(c);t.toLowerCase().includes(a)||o.toLowerCase().includes(a)?e.set(t,{name:o,farms:i(c)}):n.length?e.set(t,{name:o,farms:i(n)}):e.delete(t)}return e}return n},(...e)=>JSON.stringify(e)),d=(e,t)=>{let n=new Map,a=t.Roles.find(e=>e.Role===l.c._SERVICE);if(!a)return e;for(let c of e){let e="",r=a.LocalRights.find(e=>e.FarmID===c.FarmID);e=r?r.ClientID:t.ClientID;const i=n.get(e)||{name:c.Alias||e,farms:[]};i.farms.push(c),n.set(e,i)}const r=new Map;for(let[c,{name:s,farms:u}]of n){const e=u.filter(e=>e.RemoteServicing);e.length>0&&r.set(c,{name:s,farms:e})}const i=[...r].sort();try{if(t.ClientID){const e=i.findIndex(e=>e[0]===t.ClientID),n=i[e];if(0===e||-1===e)return{entries:i.slice(0)};e>0&&i.splice(e,1),i.unshift(n)}}catch(o){console.error(o)}return{entries:i.slice(0)}}},"ZW/8":function(e,t,n){"use strict";n.d(t,"b",(function(){return c})),n.d(t,"c",(function(){return s})),n.d(t,"d",(function(){return u})),n.d(t,"e",(function(){return l})),n.d(t,"f",(function(){return f})),n.d(t,"g",(function(){return d})),n.d(t,"h",(function(){return m})),n.d(t,"i",(function(){return I})),n.d(t,"j",(function(){return g})),n.d(t,"k",(function(){return T})),n.d(t,"a",(function(){return E})),n.d(t,"m",(function(){return N})),n.d(t,"l",(function(){return O})),n.d(t,"n",(function(){return D}));var a=n("wd/R"),r=n.n(a),i=n("pxzG"),o=n("eASP");function c(e){let t=[],n=r()(e.AggDt[e.AggDt.length-1].T).hour();for(let a of e.AggDt)void 0!==a.CO2&&t.push({name:a.T,co2:a.CO2});return{co2:t,lastTime:n}}function s(e){let t=[],n=r()(e.AggDt[e.AggDt.length-1].T).hour();for(let a of e.AggDt)void 0!==a.H2S&&t.push({name:a.T,h2s:a.H2S});return{h2s:t,lastTime:n}}function u(e){let t=[],n=r()(e.AggDt[e.AggDt.length-1].T).hour();for(let a of e.AggDt)void 0!==a.Humid&&t.push({name:a.T,humidity:a.Humid,temperature:a.Temp});return{humidity:t,lastTime:n}}function l(e){let t=[],n=r()(e.AggDt[e.AggDt.length-1].T).hour();for(let a of e.AggDt)void 0!==a.NH3&&t.push({name:a.T,nh3:a.NH3});return{nh3:t,lastTime:n}}function f(e){let t=[],n=r()(e.AggDt[e.AggDt.length-1].T).hour();for(let a of e.AggDt)void 0!==a.CoolPress&&t.push({name:a.T,pressure:a.CoolPress});return{pressure:t,lastTime:n}}function d(e,t){let n=e.filter(e=>e.AggTi===t)[0],a=[];if(n)for(let i of n.AggDt)void 0!==i.W&&a.push({name:r()(i.T).format("HH:mm"),weight:i.W});return a}function m(e,t,n){console.log(e);let a=e.filter(e=>e.AggTi>=t&&e.AggTi<=n).sort((e,t)=>e.AggTi-t.AggTi);console.log(a);let i=[];for(const o of a){let e=0,t=0;for(let n of o.AggDt)void 0!==n.W&&(e+=n.W,t++);t&&i.push({name:r.a.utc(o.AggTi).format("DD.MM"),weight:Math.round(e/t)})}return i}function I(e){let t=[],n=r()(e.AggDt[e.AggDt.length-1].T).hour();for(let a of e.AggDt)void 0!==a.Slur&&t.push({name:a.T,slurry:a.Slur});return{slurry:t,lastTime:n}}function g(e,t){let n=new Map,a=0,i=e.filter(e=>e.AggTi===t)[0];if(i){for(let e of i.AggDt)n.set(e.T,{name:e.T,temperature:e.Temp,temperatureDesired:e.TempR,minTemp:e.MinT,maxTemp:e.MaxT});a=r()(i.AggDt[i.AggDt.length-1].T).hour()}return{temps:n,lastTime:a}}function T(e,t){let n=new Map,a=0,i=e.filter(e=>e.AggTi===t)[0];if(i){for(let e of i.AggDt)n.set(e.T,{name:e.T,temperature:e.Temp,ventilation:e.V});a=r()(i.AggDt[i.AggDt.length-1].T).hour()}return{vents:n,lastTime:a}}function E(e){let t,n;console.log(e);try{n=e.AggDt.map(e=>({name:e.T,curveActive:e.CAct,worktype:e.WType}));let a=n[n.length-1];t=r()(a.name).hour()}catch(a){console.error(a),t=0,n=[]}return{data:n,lastTime:t}}function N(e){return Object(i.f)(parseFloat(e),{showUnit:!1,rawValue:!0,acceptNil:!0,fixed:1,unit:o.a.SMALL})}function O(e){return Object(i.c)(parseFloat(e),{showUnit:!1,rawValue:!0,acceptNil:!0,fixed:1,unit:o.a.MEDIUM})}function D(e){return r()(e).format("HH:mm")}},Zayz:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"c",(function(){return s})),n.d(t,"d",(function(){return u})),n.d(t,"e",(function(){return l})),n.d(t,"b",(function(){return f}));var a=n("lFKM"),r=n.n(a),i=n("wd/R"),o=n.n(i);function c(e,t,n,a){if(!r()(e)||!r()(t)||!r()(n)||!r()(a))throw new Error("checkIfTimeRangeOverlap ArgumentException expected timestamps");return Math.max(e,n){try{let t=(new window.DOMParser).parseFromString(e,"image/svg+xml");return console.log({x:t.documentElement}),t&&t.documentElement instanceof SVGSVGElement?t.documentElement:null}catch(t){return null}},(...e)=>JSON.stringify(e))},gJrJ:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var a=n("8vhO"),r=n("q17X"),i=n("XzT5");function o(e,t){switch(e){case a.a.USG_BEFORE_X_DAYS:return i.a.t("cycleReasons.usgBeforeXDays",{count:Object(r.getTimeFromInseminationToPregnancy)()});case a.a.PARTURITION_BEFORE_X_DAYS:return i.a.t("cycleReasons.parturitionBeforeXDays",{count:Object(r.getTimeFromInseminationToPartuition)()});case a.a.PARTURITION_AFTER_X_DAYS:return i.a.t("cycleReasons.parturitionAfterXDays",{count:Object(r.getTimeFromInseminationToPartuition)()+Object(r.getMaxDelayForBirth)()});case a.a.FIRST_INSEMINATION_FROM_BIRTH:return i.a.t("cycleReasons.firstInseminationFromBirth");case a.a.NO_INSEMINATION_BEFORE_EV:return i.a.t("cycleReasons.noInseminationFromBirth");case a.a.NO_USG_BEFORE_EV:return i.a.t("cycleReasons.noUsgBeforeEv");case a.a.NO_PARTURITION_AFTER_EV:return i.a.t("cycleReasons.noParturitionAfterEv");case a.a.NO_SEPARATION_AFTER_EV:return i.a.t("cycleReasons.noSeparationAfterEv");case a.a.NO_PARTURITION_AFTER_X_DAYS:return i.a.t("cycleReasons.noParturitionAfterXDays",{count:Object(r.getTimeFromInseminationToPartuition)()});case a.a.SEPARATION_CNT_BIGGER_THAN_PARTURITION_CNT:return i.a.t("cycleReasons.separationCntBiggerThanParturitionCnt");case a.a.SEPARATION_CNT_BIGGER_THAN_BIRTH_CNT:return i.a.t("cycleReasons.separationCntBiggerThanBirthCnt");case a.a.PIGLET_CNT_BIGGER_THAN_NIPPLES:return i.a.t("cycleReasons.pigletCntBiggerThanNipples");case a.a.NO_SEPARATION_BUT_SOW_CYCLES:return i.a.t("cycleReasons.noSeparationButSowCycles",{lastSeparation:t.lastSeparation});case a.a.LAST_SEPARATION_DIFF_THAN_IN_REALITY:return i.a.t("cycleReasons.lastSeparationDiffrentThanInReality");default:return""}}},hPO2:function(e,t,n){"use strict";function a(e){if(!e)return e;const t=e.replace(/[^\d]/g,"");return t.length<=3?t:t.length>3&&t.length<=5?"".concat(t.slice(0,3),"-").concat(t.slice(3,5)):t.length>5&&t.length<=7?"".concat(t.slice(0,3),"-").concat(t.slice(3,5),"-").concat(t.slice(5,7)):"".concat(t.slice(0,3),"-").concat(t.slice(3,5),"-").concat(t.slice(5,7),"-").concat(t.slice(7,10))}function r(e){let t=[6,5,7,2,3,4,5,6,7],n=(e=e.replace(/-/g,"")).split(""),a=0;for(let r=0;r<9;r++)a+=t[r]*+n[r];return a%11===+n[9]}function i(e){if(!e)return e;const t=e.replace(/[^\d]/g,"");return t.length>16?t.slice(0,16):t}n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return r})),n.d(t,"c",(function(){return i}))},"i7k/":function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"c",(function(){return o})),n.d(t,"b",(function(){return c}));n("Lqn+");var a=n("wd/R"),r=n.n(a);function i(e,t,n,a,r,i){let o=+r,c=+i;return isNaN(o)||isNaN(c)?"asc"===a&&isNaN(o)||"desc"===a&&isNaN(c)?1:-1:o-c}function o(e,t,n,a,i,o){let c=r()(i),s=r()(o);return c.isValid()&&s.isValid()?c.toDate().getTime()-s.toDate().getTime():("asc"!==a||c.isValid())&&("desc"!==a||s.isValid())?void 0:1}function c(e,t,n,a,r,i){return r&&i?r.localeCompare(i,void 0,{numeric:!0,sensitivity:"base"}):("asc"!==a||r)&&("desc"!==a||i)?-1:1}},kCVf:function(e,t,n){"use strict";n.d(t,"o",(function(){return p})),n.d(t,"d",(function(){return h})),n.d(t,"f",(function(){return R})),n.d(t,"e",(function(){return P})),n.d(t,"c",(function(){return v})),n.d(t,"k",(function(){return b})),n.d(t,"j",(function(){return C})),n.d(t,"i",(function(){return M})),n.d(t,"g",(function(){return _})),n.d(t,"b",(function(){return w})),n.d(t,"a",(function(){return L})),n.d(t,"n",(function(){return G})),n.d(t,"l",(function(){return U})),n.d(t,"m",(function(){return B})),n.d(t,"h",(function(){return W}));var a=n("4qC0"),r=n.n(a),i=n("J2iB"),o=n.n(i),c=n("lFKM"),s=n.n(c),u=n("Y+p1"),l=n.n(u),f=n("Z0cm"),d=n.n(f),m=n("mwIZ"),I=n.n(m),g=n("BkRI"),T=n.n(g),E=n("zDJl"),N=n("AF5L"),O=n("B6RA"),D=n("OwcS"),A=n("VfnB"),S=(n("msTn"),n("I8zd")),y=n("n7pt");function p(e){try{if(e.CID){let t=I()(e,"Devices",[]).map(e=>e.DevID);if(t.length&&(t=Object(A.r)(t),t))for(let[n,a]of t.entries())Object(N.o)(n,{[C(e)]:a[E.d.DISPENSER_NRF].map(e=>e.DevID)})}}catch(t){console.error(t)}}function h({name:e,individualFeeding:t,createStandings:n,chamberSize:a,standingsInRow:r,standingsOrder:i,devices:o,standingsName:c,standingsFrom:u,standingsAmount:l,standings:f,id:d}){const m={CName:e,CID:d||Object(D.a)()};if(t){if(m.IndividualFeeding=!0,!(s()(r)&&r>0&&s()(i)&&i>=0&&i<=7))throw new Error("ValidationError expected: standingsInRow number > 0, standingsOrder number <0...7> but got ".concat(r," ").concat(i));if(m.StandsInRow=+r,m.StandsOrder=+i,m.Boxes=f||[],o){if(o.filter(e=>!e.DevID).length)throw new Error("ValidationError expected: devices [{DevID: string, Adr: number opt}]");m.Devices=o}else delete m.Devices;n&&(m.Boxes=[...m.Boxes,...R({name:c,startFrom:+u,amount:+l})])}else{if(!("number"==typeof l&&a>0))throw Error("ValidationError chamberSize (should be number & > 0");m.CSize=+a}return m}function R({name:e,amount:t,startFrom:n}){let a=[];if(!(s()(t)&&s()(n)&&t>0))throw new Error("ValidationError expected: amount - number > 0, startFrom number got ".concat(t," ").concat(n));for(let r=+n;r<+n+ +t;r++){let t={BoxesName:"".concat(e||""," ").concat(r),BID:Object(D.a)()};a.push(t)}return a}function P({name:e,type:t,chambers:n}){if(e&&s()(t))return{SID:Object(D.a)(),SName:e,SType:t,Chambers:n||[]};throw new Error("ValidationError expected name - string, type - number but got ".concat(e," ").concat(t))}function v({FarmID:e,name:t,sectors:n}){const a=+new Date;if(e&&t)return{FarmID:e,BgID:Object(D.a)(),BName:t,Sectors:n||[],DtaCrtTime:a,DtaModTime:a};throw new Error("ValidationError expected name - string, FarmID - string but got ".concat(t," ").concat(e))}function b(e={}){return e.CName||e.BName||e.SName||e.FarmName||e.BoxesName}function C(e={}){return e.CID||e.SID||e.BID||e.BgID||e.FarmID}function M(e){return function e(t,n=[]){if(!t)return n;let a=n;return C(t)&&a.push(t),["Boxes","Sectors","Chambers","Buildings"].forEach(n=>{t[n]&&t[n].forEach(t=>{a=e(t,a)})}),console.timeEnd("getFlatLocations"),a}(T()(e))}function _(){try{return O.default.getState().location.farm}catch(e){console.error(e)}}function w(e,t){return console.log("checkIfPlmntIDIncludesLocationID",arguments),r()(e)?e===t:!!d()(e)&&e.map(e=>e.PlcmntID).includes(t)}function L(e,t,n){return F(e,"forageID",(e,t,a)=>!(!e||a!==S.a.CHAMBER||!n.includes(e.CID)),t)}function G(e,t,n){return F(e,"forageID",(e,t,a)=>!(!e||a!==S.a.CHAMBER||t!==n),t)}function F(e=[],t,n=(()=>!0),a=null){const r=T()(O.default.getState().farms.buildings),i=T()(e),o=(e,a)=>!!n(e,e[t],a);for(let c=0;c!r.find(t=>l()(t,e)))}const U=(e,t)=>{const n=e.get(t);return n?n.name.join(" - ")||"?":null},B=({device:e,index:t=null})=>{try{return console.log(e,t," E A E"),I()(e,"PlcmntID",[]).filter(e=>!!o()(t)||e.Adr===t).map(e=>e.PlcmntID)}catch(n){return console.error(n),[]}},W=e=>{try{let t=[];const n=y.a.getLocationByID(e);if(n){const a=y.a.getTreeByLocationID(e);I()(a,"building")&&I()(n,"BgID")?I()(a,"building.Sectors",[]).forEach(e=>{t.push({PlcmntID:e.SID}),I()(e,"Chambers",[]).forEach(e=>{t.push({PlcmntID:e.CID}),I()(e,"Boxes",[]).forEach(e=>{t.push({PlcmntID:e.BID})})})}):I()(a,"sector")&&I()(n,"SID")?I()(a,"sector.Chambers",[]).forEach(e=>{t.push({PlcmntID:e.CID}),I()(e,"Boxes",[]).forEach(e=>{t.push({PlcmntID:e.BID})})}):I()(a,"chamber")&&I()(n,"CID")?(I()(a,"Boxes")||t.push({PlcmntID:n.CID}),I()(a,"chamber.Boxes",[]).forEach(e=>{t.push({PlcmntID:e.BID})})):t.push({PlcmntID:n.BID})}return t}catch(t){return console.error(t),[]}}},m9wQ:function(e,t,n){"use strict";(function(e){function a(e){return e.charCodeAt(0)}function r(e){let t=e.trim().split(" "),n=[];return t.map(e=>{let t=Number("0x"+(1===e.length?"0".concat(e):e));n.push(t)}),n}function i(t){return function(t,n){let a=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];"undefined"!==typeof Int32Array&&(a=new Int32Array(a));const r=new e(t);let i="undefined"!==typeof n?~~n:65535;for(let e=0;e>8^t)]^i<<8)}return i}(t?t.split("").map(a):[],0)}n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return i}))}).call(this,n("tjlA").Buffer)},olHg:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var a=n("GoyQ"),r=n.n(a),i=n("Z0cm"),o=n.n(i);function c(e=[],t=null){if(o()(e))for(let n of e){let e=c(n,t);if(e)return e}else if(r()(e)){if(e.object[e.key]===t)return e;if(e.children)return c(e.children,t)}}},opqk:function(e,t,n){"use strict";n.d(t,"b",(function(){return c})),n.d(t,"a",(function(){return s})),n.d(t,"c",(function(){return u}));var a=n("EE6H");function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t{console.log("INSERT",e,t,n,r);let o=a.e.getCollection(t);if(!o)throw new Error("Brak kolekcji: "+t);let c=o.find(),s={};for(let a of c){let e=a[n];r&&(e+=a[r]),s[e]=a}let u=[];for(let a of e){let e=a[n];r&&(e+=a[r]);let t=s[e];if(t){let e=i({$loki:t.$loki},a);o.update(e)}else u.push(a)}u.length>0&&o.insert(u)},s=(e,t,n,r="DtaModTime")=>{let i={table:e};return t&&(i[t]=n),a.d.findOne(i)||{[r]:"0"}},u=(e,t,n,r,i="DtaModTime")=>{let o=s(e,n,r,i);"0"===o[i]?(o[i]=t,o.table=e,n&&(o[n]=r),o.$loki?a.d.update(o):a.d.insert(o)):(o[i]=t,a.d.update(o))}},pxzG:function(e,t,n){"use strict";n.d(t,"l",(function(){return m})),n.d(t,"j",(function(){return I})),n.d(t,"k",(function(){return g})),n.d(t,"i",(function(){return T})),n.d(t,"f",(function(){return E})),n.d(t,"c",(function(){return N})),n.d(t,"h",(function(){return O})),n.d(t,"b",(function(){return D})),n.d(t,"e",(function(){return A})),n.d(t,"d",(function(){return S})),n.d(t,"a",(function(){return y})),n.d(t,"g",(function(){return p}));var a=n("lFKM"),r=n.n(a),i=n("mwIZ"),o=n.n(i),c=n("eASP"),s=n("qpxp"),u=n.n(s),l=n("q17X");const f={weight:"g",temperature:"C",length:"cm",pressure:"bar",volume:"ml",energy:"Wh",power:"W",current:"mA",voltage:"mV"},d={metric:{weight:["g","kg","mt"],temperature:["C"],length:["mm","cm","m"],pressure:["bar"],volume:["ml","l","m3"],energy:["Wh","kWh","MWh"],power:["W","kW","MW"],current:["mA","A","kA"],voltage:["mV","V","kV"]},imperial:{weight:["oz","lb","t"],temperature:["F"],length:["in","ft","mi"],pressure:["psi"],volume:["fl-oz","cup","gal"],energy:["Wh","kWh","MWh"],power:["W","kW","MW"],current:["mA","A","kA"],voltage:["mV","V","kV"]}};function m(e,t=c.a.SMALL,{overrideUnitSystem:n}={}){let a="";"temperature"===e&&(a="\xb0");let r=o()(d,"[".concat(n||Object(l.getUnitSystem)(),"][").concat(e,"][").concat(t,"]"));switch(r){case"mt":r="t";break;case"m3":r="m\xb3"}return"".concat(a).concat(r)}function I(e,{unit:t=c.a.SMALL,showUnit:n=!1,fixed:a=2,defaultValue:r="-",rawValue:i=!1,acceptNil:o=!1}={}){return h("weight",e,{showUnit:n,fixed:a,defaultValue:r,rawValue:i,unit:t,acceptNil:o})}function g(e){return e>=1e3&&e=Math.pow(10,6)?c.a.BIG:c.a.SMALL}function T(e,{fromUnit:t=c.a.SMALL}={}){let n=d[Object(l.getUnitSystem)()].weight[t];if(r()(e))return u()(e).from(n).to(f.weight);throw new Error("convertWeightToBaseUnit failed expected number got ".concat(e))}function E(e,{showUnit:t=!1,unit:n=c.a.SMALL,fixed:a=2,defaultValue:r="-",rawValue:i=!1,acceptNil:o=!1}={}){return h("temperature",e,{showUnit:t,fixed:a,defaultValue:r,rawValue:i,unit:n,acceptNil:o})}function N(e,{showUnit:t=!1,unit:n=c.a.MEDIUM,fixed:a=2,defaultValue:r="-",rawValue:i=!1,acceptNil:o=!1}={}){return h("length",e,{showUnit:t,fixed:a,defaultValue:r,rawValue:i,unit:n,acceptNil:o})}function O(e,{showUnit:t=!1,unit:n=c.a.MEDIUM,fixed:a=2,defaultValue:r="-",rawValue:i=!1,acceptNil:o=!1}={}){return h("volume",e,{showUnit:t,fixed:a,defaultValue:r,rawValue:i,unit:n,acceptNil:o})}function D(e,{showUnit:t=!1,unit:n=c.a.MEDIUM,fixed:a=2,defaultValue:r="-",rawValue:i=!1,acceptNil:o=!1}={}){return h("energy",e,{showUnit:t,fixed:a,defaultValue:r,rawValue:i,unit:n,acceptNil:o})}function A(e,{showUnit:t=!1,fixed:n=2,defaultValue:a="-",rawValue:r=!1,acceptNil:i=!1}={}){return h("pressure",e,{showUnit:t,fixed:n,defaultValue:a,rawValue:r,unit:c.a.SMALL,acceptNil:i})}function S(e,{showUnit:t=!1,unit:n=c.a.MEDIUM,fixed:a=2,defaultValue:r="-",rawValue:i=!1,acceptNil:o=!1}={}){return h("power",e,{showUnit:t,fixed:a,defaultValue:r,rawValue:i,unit:n,acceptNil:o})}function y(e,{showUnit:t=!1,unit:n=c.a.MEDIUM,fixed:a=2,defaultValue:r="-",rawValue:i=!1,acceptNil:o=!1}={}){return h("current",e,{showUnit:t,fixed:a,defaultValue:r,rawValue:i,unit:n,acceptNil:o})}function p(e,{showUnit:t=!1,unit:n=c.a.MEDIUM,fixed:a=2,defaultValue:r="-",rawValue:i=!1,acceptNil:o=!1}={}){return h("voltage",e,{showUnit:t,fixed:a,defaultValue:r,rawValue:i,unit:n,acceptNil:o})}function h(e,t,{showUnit:n=!1,fixed:a=2,defaultValue:i="-",rawValue:o=!1,acceptNil:s=!1,unit:I=c.a.SMALL}={}){let g=d[Object(l.getUnitSystem)()][e][I]||d[Object(l.getUnitSystem)()][e][0];if(!e)throw new Error("convertUnitTo unitType not specified");if(o){if(r()(t))return+u()(t).from(f[e]).to(g).toFixed(a);if(s)return;throw new Error("convert".concat(e[0].toUpperCase()).concat(e.substr(1),"UnitTo failed expected number got ").concat(t))}return"".concat(r()(+t)?u()(+t).from(f[e]).to(g).toFixed(a):i).concat(n?"".concat(m(e,I)):"")}},q17X:function(e,t,n){"use strict";n.r(t),n.d(t,"getUnitSystem",(function(){return R})),n.d(t,"getFeedingUnit",(function(){return P})),n.d(t,"getAnimalUnit",(function(){return v})),n.d(t,"getScaleUnit",(function(){return b})),n.d(t,"getCageUnit",(function(){return C})),n.d(t,"getTechnologyGroupWeeks",(function(){return M})),n.d(t,"getTimeFromInseminationToPregnancy",(function(){return _})),n.d(t,"getFarmStart",(function(){return w})),n.d(t,"getResultsWeeks",(function(){return L})),n.d(t,"getTreatmentHour",(function(){return G})),n.d(t,"getDaysForRepeatedInsemination",(function(){return F})),n.d(t,"getTimeFromInseminationToPartuition",(function(){return U})),n.d(t,"getMaxDelayForBirth",(function(){return B})),n.d(t,"getTimeOnMatingRoom",(function(){return W})),n.d(t,"getTimeOnSowsRoom",(function(){return Y})),n.d(t,"getTimeOnBirthRoom",(function(){return j})),n.d(t,"getTimeOnBirthRoomMommy",(function(){return V})),n.d(t,"getPassageAccuracy",(function(){return k})),n.d(t,"getShowAliases",(function(){return x})),n.d(t,"getOffline",(function(){return H})),n.d(t,"getRFIDTagReader",(function(){return z})),n.d(t,"getMinAgeForFirstMating",(function(){return K})),n.d(t,"getMinWeightForFirstMating",(function(){return X})),n.d(t,"getPreparationPeriodForMating",(function(){return Z})),n.d(t,"isUsingFakeData",(function(){return J})),n.d(t,"getNumberOfDaysToSale",(function(){return q})),n.d(t,"getTechnologyGroupSize",(function(){return Q})),n.d(t,"getFirstTechnologyGroupStart",(function(){return $})),n.d(t,"getFeedingDefaultInseminationCurveNumber",(function(){return ee})),n.d(t,"getFeedingDefaultParturitionCurveNumber",(function(){return te})),n.d(t,"getFeedingDefaultInseminationCurveDay",(function(){return ne})),n.d(t,"getFeedingDefaultParturitionCurveDay",(function(){return ae})),n.d(t,"getDefaultCurvesForSectors",(function(){return re})),n.d(t,"getDefaultCurve",(function(){return ie})),n.d(t,"getFeedingPunishmentSettings",(function(){return oe})),n.d(t,"getFeedingLevels",(function(){return ce})),n.d(t,"getSettingClass",(function(){return se}));var a=n("mwIZ"),r=n.n(a),i=n("B6RA"),o=n("wd/R"),c=n.n(o),s=n("P0Qa"),u=n("HYP7"),l=n("kB5K"),f=n("LFUJ"),d=n("Zx0i"),m=n("faQZ"),I=n("Wlyo"),g=n("DmpL"),T=n("wyc1"),E=n("PejV"),N=n("2UNB"),O=n("kDzr"),D=n("+bBF"),A=n("eASP"),S=n("1SJz"),y=n("zH/4"),p=n("ehys"),h=n("rBIo");function R(){try{return i.default.getState().settings.general.SetData.Settings.System.UnitSystem||"metric"}catch(e){return"metric"}}function P(){let e=A.a.MEDIUM;try{return r()(i.default.getState(),"settings.general.SetData.Settings.System.FeedingUnit",e)}catch(t){return e}}function v(){let e=A.a.MEDIUM;try{return r()(i.default.getState(),"settings.general.SetData.Settings.System.AnimalUnit",e)}catch(t){return e}}function b(){let e=A.a.BIG;try{return r()(i.default.getState(),"settings.general.SetData.Settings.System.ScaleUnit",e)}catch(t){return e}}function C(){let e=A.a.MEDIUM;try{return r()(i.default.getState(),"settings.general.SetData.Settings.System.CageUnit",e)}catch(t){return e}}function M(){try{return i.default.getState().settings.general.SetData.Settings.Cycle.NumberOfWeeksInCycle||1}catch(e){return 1}}function _(){try{return i.default.getState().settings.general.SetData.Settings.Cycle.TimeFromInseminationToPregnancy||28}catch(e){return 28}}function w(){try{let e=i.default.getState().settings.general;return c()(e.SetData.Settings.Result.Time).startOf("isoWeek")}catch(e){return c()().startOf("year")}}function L(){try{return i.default.getState().settings.general.SetData.Settings.Result.Days}catch(e){return 1}}function G(){try{return i.default.getState().settings.notifications.SetData.TreatmentHour||"08:00"}catch(e){return"08:00"}}function F(){try{return i.default.getState().settings.general.SetData.Settings.Cycle.TimeBetweenInseminations||5}catch(e){return 5}}function U(){try{return i.default.getState().settings.general.SetData.Settings.Cycle.TimeFromInseminationToPartuition||114}catch(e){return 114}}function B(){try{return i.default.getState().settings.general.SetData.Settings.Cycle.MaxPartuitionDelay||5}catch(e){return 5}}function W(){try{return i.default.getState().settings.general.SetData.Settings.Cycle.TimeOnMatingRoom||15}catch(e){return 15}}function Y(){try{return i.default.getState().settings.general.SetData.Settings.Cycle.TimeOnSowsRoom||100}catch(e){return 100}}function j(){try{return i.default.getState().settings.general.SetData.Settings.Cycle.TimeOnBirthRoom||28}catch(e){return 28}}function V(){try{return i.default.getState().settings.general.SetData.Settings.Cycle.TimeOnBirthRoomMommy||35}catch(e){return 35}}function k(){try{return i.default.getState().settings.general.SetData.Settings.Cage.Passage||.5}catch(e){return.5}}function x(){try{return i.default.getState().settings.general.SetData.Settings.Devices.ShowAliases||!1}catch(e){return!1}}function H(){try{return i.default.getState().settings.general.SetData.Settings.Devices.Offline||!1}catch(e){return!1}}function z(){try{return i.default.getState().settings.general.SetData.Settings.Devices.RFIDReader||!1}catch(e){return!1}}function K(){try{return i.default.getState().settings.general.SetData.Settings.Cycle.FirstMatingMinAge||240}catch(e){return 240}}function X(){try{return i.default.getState().settings.general.SetData.Settings.Cycle.FirstMatingMinWeight||14e4}catch(e){return 14e4}}function Z(){try{return i.default.getState().settings.general.SetData.Settings.Cycle.MatingPreparationPeriod||3}catch(e){return 3}}function J(){return"CypressFarm1"===document.location.href.split("/")[3]&&(console.log("Fake!!!!!!!!!"),!0)}function q(){try{return i.default.getState().settings.general.SetData.Settings.Cycle.NumberOfDaysToSale||100}catch(e){return 100}}function Q(){try{return i.default.getState().settings.general.SetData.Settings.Cycle.TechnologyGroupSize||200}catch(e){return 200}}function $(){const e=c.a.utc().startOf("year").isoWeekday(1);e.year()!==c()().year()&&e.isoWeekday(8);try{return i.default.getState().settings.general.SetData.Settings.Cycle.FirstTechnologyGroup||e.toDate().getTime()}catch(t){return e}}function ee(e="WST"){try{return i.default.getState().settings.general.SetData.Settings.Feeding[e].DefaultInseminationCurveNumber||0}catch(t){return 0}}function te(e="WST"){try{return i.default.getState().settings.general.SetData.Settings.Feeding[e].DefaultParturitionCurveNumber||0}catch(t){return 0}}function ne(e="WST"){try{return i.default.getState().settings.general.SetData.Settings.Feeding[e].DefaultInseminationCurveDay||1}catch(t){return 1}}function ae(e="WST"){try{return i.default.getState().settings.general.SetData.Settings.Feeding[e].DefaultParturitionCurveDay||1}catch(t){return 1}}function re(){const e={};try{return i.default.getState().settings.general.SetData.Settings.Feeding.DefaultCurves||e}catch(t){return e}}function ie(e){try{return i.default.getState().settings.general.SetData.Settings.Feeding.DefaultCurves[e]||null}catch(t){return null}}function oe(){const e=[{Time:1,Trigger:1,Percentage:95},{Time:1,Trigger:2,Percentage:90},{Time:2,Trigger:2,Percentage:85}];try{return i.default.getState().settings.general.SetData.Settings.Feeding.Punishment||e}catch(t){return e}}function ce(){const e={FeedingMinimumLevel:.1,FeedingMaximumLevel:.75};try{return i.default.getState().settings.general.SetData.Settings.FeedingLevels||e}catch(t){return e}}function se(e){try{switch(e.SetType){case s.a.GENERAL:return new u.a(e);case s.a.FEEDING_CURVE:return new l.a(e);case s.a.FEEDING_FORAGE:return new f.a(e);case s.a.FEEDING_SCHEDULE:return new d.a(e);case s.a.LAYOUT:return new m.a(e);case s.a.ENDPOINT_ARN:return new I.a(e);case s.a.NOTIFICATIONS:return new O.a(e);case s.a.ECONOMY:return new g.a(e);case s.a.YEARLY_PLANS:return new T.a(e);case s.a.FARM_MAP:return new E.a(e);case s.a.CLIMATE_CURVE:return new D.a(e);case s.a.CLIMATE_SK3_CURVE:return new h.a(e);case s.a.DEVICE_SETTINGS:return new S.a(e);case s.a.SYSTEM_SCHEDULE_WORKTYPE:return new y.a(e);case s.a.SYSTEM_SCHEDULE:return new p.a(e);default:return new N.a(e)}}catch(t){return console.error(t),e}}},r9cP:function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return i}));var a=n("B6RA");function r(e){if(e){let t=a.default.getState().language.locale;if(Array.isArray(e.Link)){let n=(Array.isArray(e.Lang)?e.Lang:[]).findIndex(e=>e===t);return n=n>-1?n:0,e.Link[n]}return e.Link}}function i(e){if(e){let t=a.default.getState().language.locale;if(Array.isArray(e.Name)){let n=(Array.isArray(e.Lang)?e.Lang:[]).findIndex(e=>e===t);return n=n>-1?n:0,e.Name[n]}return e.Name}}},t1mp:function(e,t,n){"use strict";n.d(t,"c",(function(){return O})),n.d(t,"a",(function(){return D})),n.d(t,"b",(function(){return A})),n.d(t,"d",(function(){return S})),n.d(t,"e",(function(){return y})),n.d(t,"g",(function(){return p})),n.d(t,"f",(function(){return h})),n.d(t,"h",(function(){return R}));var a=n("fz41"),r=n("n7pt"),i=n("BvFm"),o=n("s506"),c=n("kCmh"),s=n("ZRKa"),u=n("snN4"),l=n("pZsI"),f=n("BXH4"),d=n("aIXM"),m=n("Bffz"),I=n("GUWk"),g=n("EE6H");function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function E(e){for(var t=1;t0&&await f.a.insertIntoDictionaries(n)}async function D(e,t){try{let n=await Object(a.c)(E({},m.a.listBuilding({farmID:e}),{queryParams:{FarmID:e,DtaModTime:parseInt(r.a.getModificationTime(e).DtaModTime)},signal:t}));n.length>0&&await r.a.insertIntoBuildings(n)}catch(n){console.error(n)}}async function A(e,t,n){try{if(Object(i.d)(o.c._GENERAL_READ,e,t.Roles)){let t=await Object(a.c)(E({},m.a.listDevices({farmID:e}),{queryParams:{DtaModTime:parseInt(c.a.getModificationTime(e).DtaModTime),table:"Devices"},signal:n}));t.length>0?await c.a.insertIntoDevices(t):await g.f.asyncSaveDB()}}catch(r){console.error(r)}}async function S(e,t,n){const r=await Object(a.c)(E({},m.a.listSettings({clientID:e}),{queryParams:{DtaModTime:s.a.getModificationTime(t).DtaModTime},signal:n}));r.length>0&&await s.a.insertIntoSettings(r)}async function y(e,t){try{let n=await Object(a.c)(E({},m.a.listTechnologyGroups({farmID:e}),{method:"GET",queryParams:{DtaModTime:l.a.getModificationTime(e).DtaModTime},signal:t}));n.length>0&&await l.a.insertIntoTechnologyGroup(n)}catch(n){console.error(n)}}async function p(e,t){try{let n=await Object(a.c)(E({},m.a.listNotifications({farmID:e}),{queryParams:{DtaModTime:u.a.getModificationTime(e).DtaModTime},signal:t}));n.length>0&&await u.a.insertIntoNotifications(n)}catch(n){console.error(n)}}async function h(e,t){try{let n=await Object(a.c)(E({},m.a.listGroups({farmID:e}),{queryParams:{DtaModTime:d.a.getModificationTime(e).DtaModTime},signal:t}));n.length>0&&await d.a.insertIntoGroups(n)}catch(n){console.error(n)}}async function R(e,t,n){try{let r=await Object(a.c)(E({},m.a.getReports({clientID:e,localUserID:t}),{queryParams:{DtaModTime:I.a.getModificationTime().DtaModTime},signal:n}));r.items.length>0&&await I.a.insertAthenaReports(r.items)}catch(r){console.error(r)}}},uUZO:function(e,t,n){"use strict";n.d(t,"d",(function(){return A})),n.d(t,"a",(function(){return y})),n.d(t,"c",(function(){return p})),n.d(t,"b",(function(){return h}));var a=n("gPaA"),r=n.n(a),i=n("E+oP"),o=n.n(i),c=n("bt/X"),s=n.n(c),u=n("mwIZ"),l=n.n(u),f=n("BkRI"),d=n.n(f),m=n("PrG/"),I=n("wd/R"),g=n.n(I),T=n("q17X"),E=n("PRyg"),N=n("8vhO");function O(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e,t){let n=d()(e),a=Object(T.getTimeFromInseminationToPartuition)()+Object(T.getTimeOnBirthRoomMommy)();n=n||[];let i=n.find(e=>e.EvCode===m.SOW_CYCLES);n=n.filter(e=>void 0===e.DtaDelTime&&[m.INSEMINATION,m.NO_PREGNANCY,m.PARTURITION,m.SEPARATION,m.FALL_PIGLETS,m.WEIGHTING,m.SEPARATION_TO_MOMMY,m.USG,m.MOMMY,m.ACTIVE_NIPPLES,m.SOW_CYCLES].includes(e.EvCode)),n.sort((e,t)=>(void 0!==e.EvTime?e.EvTime:0)-(void 0!==t.EvTime?t.EvTime:0));let c=[],s=[],u=Object(T.getDaysForRepeatedInsemination)();const f=[],I=[];let E,N,O,D,A=0,y=0;if(o()(i))y=0,s=n.slice(0);else{c=n.filter(e=>e.EvTime<=i.EvData.LastSeparation||e.EvCode===m.SOW_CYCLES),s=n.filter(e=>e.EvTime>i.EvData.LastSeparation&&e.EvCode!==m.SOW_CYCLES),A=l()(i,"EvData.Cycles",1)-1,y=l()(i,"EvData.Cycles",1);let e=l()(i,"EvData.LastSeparation");E=g()(e).subtract(a,"days").startOf("day").toDate().getTime(),N=g()(e).endOf("day").toDate().getTime(),O=g()(e).add(1,"day").startOf("day").toDate().getTime(),D=g()(e).add(a+1,"days").endOf("day").toDate().getTime()}let p={cycle:A,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:E,EndTime:N},h={cycle:y,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:O,EndTime:D};o()(c)||c.forEach((e,t)=>{const{EvCode:n,EvTime:r}=e;if(o()(p[m.NO_PREGNANCY])||(p.EndTime=g()(r).endOf("day").toDate().getTime(),f.push(p),p={cycle:A,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()}),o()(p[m.SEPARATION_TO_MOMMY])||[m.INSEMINATION,m.USG,m.NO_PREGNANCY,m.PARTURITION].includes(n)&&(p.EndTime=g()(r).endOf("day").toDate().getTime(),f.push(p),A--,p={cycle:A,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()}),o()(p[m.MOMMY])||[m.INSEMINATION,m.USG,m.NO_PREGNANCY,m.PARTURITION].includes(n)&&(p.EndTime=g()(r).endOf("day").toDate().getTime(),f.push(p),A--,p={cycle:A,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()}),o()(p[m.FALL_PIGLETS])||[m.INSEMINATION,m.USG,m.PARTURITION,m.NO_PREGNANCY].includes(n)&&(p.EndTime=p.EndTime=g()(r).endOf("day").toDate().getTime(),f.push(p),A--,p={cycle:A,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()}),o()(p[m.SEPARATION])||[m.INSEMINATION,m.USG,m.NO_PREGNANCY,m.PARTURITION,m.SEPARATION].includes(n)&&(p.EndTime=g()(r).endOf("day").toDate().getTime(),f.push(p),A--,p={cycle:A,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()}),o()(p[m.PARTURITION])||[m.INSEMINATION,m.USG,m.NO_PREGNANCY,m.PARTURITION].includes(n)&&(p.EndTime=g()(r).endOf("day").toDate().getTime(),f.push(p),A--,p={cycle:A,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()}),!o()(p[m.USG])){const e=!!o()(p[m.USG])||p[m.USG][p[m.USG].length-1].EvData.Pregnant;e&&[m.INSEMINATION].includes(n)&&(p.EndTime=g()(r).endOf("day").toDate().getTime(),f.push(p),p={cycle:A,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()}),e||(p.EndTime=g()(r).endOf("day").toDate().getTime(),f.push(p),p={cycle:A,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()})}if(!o()(p[m.INSEMINATION])&&[m.INSEMINATION].includes(n)){let t=p[m.INSEMINATION][p[m.INSEMINATION].length-1];g()(+t.EvTime).startOf("day").diff(g()(+e.EvTime).startOf("day"),"days")>u&&(p.EndTime=g()(r).endOf("day").toDate().getTime(),f.push(p),p={cycle:A,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()})}c.length-1===t?(p[n].push(e),f.push(p)):p[n].push(e)}),o()(s)||s.forEach((e,t)=>{const{EvCode:n,EvTime:r}=e;if(o()(h[m.NO_PREGNANCY])||(h.EndTime=g()(r).endOf("day").toDate().getTime(),I.push(h),h={cycle:y,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()}),o()(h[m.SEPARATION_TO_MOMMY])||[m.INSEMINATION,m.USG,m.NO_PREGNANCY,m.PARTURITION].includes(n)&&(h.EndTime=g()(r).endOf("day").toDate().getTime(),I.push(h),y++,h={cycle:y,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()}),o()(h[m.MOMMY])||[m.INSEMINATION,m.USG,m.NO_PREGNANCY,m.PARTURITION].includes(n)&&(h.EndTime=g()(r).endOf("day").toDate().getTime(),I.push(h),y++,h={cycle:y,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()}),o()(h[m.FALL_PIGLETS])||[m.INSEMINATION,m.USG,m.PARTURITION,m.NO_PREGNANCY].includes(n)&&(h.EndTime=g()(r).endOf("day").toDate().getTime(),I.push(h),y++,h={cycle:y,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()}),o()(h[m.SEPARATION])||[m.INSEMINATION,m.USG,m.NO_PREGNANCY,m.PARTURITION,m.SEPARATION].includes(n)&&(h.EndTime=g()(r).endOf("day").toDate().getTime(),I.push(h),y++,h={cycle:y,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()}),o()(h[m.PARTURITION])||[m.INSEMINATION,m.USG,m.NO_PREGNANCY,m.PARTURITION].includes(n)&&(h.EndTime=g()(r).endOf("day").toDate().getTime(),I.push(h),y++,h={cycle:y,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()}),!o()(h[m.USG])){const e=!!o()(h[m.USG])||h[m.USG][h[m.USG].length-1].EvData.Pregnant;e&&[m.INSEMINATION].includes(n)&&(h.EndTime=g()(r).endOf("day").toDate().getTime(),I.push(h),h={cycle:y,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()}),e||(h.EndTime=g()(r).endOf("day").toDate().getTime(),I.push(h),h={cycle:y,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()})}if(!o()(h[m.INSEMINATION])&&[m.INSEMINATION].includes(n)){let t=h[m.INSEMINATION][h[m.INSEMINATION].length-1];g()(+e.EvTime).startOf("day").diff(g()(+t.EvTime).startOf("day"),"days")>u&&(h.EndTime=g()(r).endOf("day").toDate().getTime(),I.push(h),h={cycle:y,[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[],StartTime:g()(r).add(1,"day").startOf("day").toDate().getTime(),EndTime:g()(r).add(a+1,"days").endOf("day").toDate().getTime()})}s.length-1===t?(S(h)&&(h.StartTime=g()(r).startOf("day").toDate().getTime(),h.EndTime=g()(r).add(a,"days").endOf("day").toDate().getTime(),f.length>0&&(f[f.length-1].EndTime=g()(r).subtract(1,"day").endOf("day").toDate().getTime())),h[n].push(e),I.push(h)):(S(h)&&(h.StartTime=g()(r).startOf("day").toDate().getTime(),h.EndTime=g()(r).add(a,"days").endOf("day").toDate().getTime(),f.length>0&&(f[f.length-1].EndTime=g()(r).subtract(1,"day").endOf("day").toDate().getTime())),h[n].push(e))});const R=[],P=[...f.map((e,t)=>({cycle:f[f.length-1-t].cycle,[m.INSEMINATION]:e[m.INSEMINATION],[m.USG]:e[m.USG],[m.NO_PREGNANCY]:e[m.NO_PREGNANCY],[m.PARTURITION]:e[m.PARTURITION],[m.SEPARATION_TO_MOMMY]:e[m.SEPARATION_TO_MOMMY],[m.MOMMY]:e[m.MOMMY],[m.FALL_PIGLETS]:e[m.FALL_PIGLETS],[m.WEIGHTING]:e[m.WEIGHTING],[m.ACTIVE_NIPPLES]:e[m.ACTIVE_NIPPLES],[m.SEPARATION]:e[m.SEPARATION],[m.SOW_CYCLES]:e[m.SOW_CYCLES],StartTime:e.StartTime,EndTime:e.EndTime})),...I],v=o()(P)?0:r()(P,"cycle").cycle;let b=0;for(;b=0;r--)!o()(C[r-1])&&S(C[r-1])&&(C[r-1].EndTime=g()(C[r].StartTime).subtract(1,"day").endOf("day").toDate().getTime(),C[r-1].StartTime=g()(C[r].StartTime).subtract(a+1,"day").startOf("day").toDate().getTime());return{events:n,cycleTable:C,resultTable:P}}function S(e){let t=!0;for(const n in e)Array.isArray(e[n])&&!o()(e[n])&&(t=!1);return t}function y(e){const t=[];let n=d()(e);n=s()(n,"cycle");for(const a of Object.values(n))if(Array.isArray(a)){let e={[m.INSEMINATION]:[],[m.USG]:[],[m.NO_PREGNANCY]:[],[m.PARTURITION]:[],[m.SEPARATION_TO_MOMMY]:[],[m.MOMMY]:[],[m.FALL_PIGLETS]:[],[m.WEIGHTING]:[],[m.ACTIVE_NIPPLES]:[],[m.SEPARATION]:[],[m.SOW_CYCLES]:[]};for(const t of a){e.cycle=t.cycle,e.StartTime=t.StartTime,e.EndTime=t.EndTime;for(let[n,a]of Object.entries(t))Array.isArray(a)&&(e[n]=[...e[n],...a])}t.push(e)}return t}function p(e,t){const n=[];return e.map(e=>function(e){for(var t=1;t{const i=function(e){const t=[];for(let[n,a]of Object.entries(e))["cycle","invalidEvents"].includes(n)||Array.isArray(a)&&!o()(a)&&a.forEach(e=>t.push(e));return t}(a),c=a[m.INSEMINATION][0],s=a[m.USG][0],u=a[m.PARTURITION][0],f=a[m.SEPARATION][0],d=a[m.SEPARATION_TO_MOMMY][0],I=a[m.ACTIVE_NIPPLES][0],O=a[m.SOW_CYCLES][0];if(c){const e=t.DtaBrthTime?+t.DtaBrthTime:+t.DtaInTime;if(g()(+c.EvTime).startOf("day").diff(g()(e).startOf("day"),"days")t+n&&a.invalidEvents.push({EvCode:m.PARTURITION,Reason:N.a.PARTURITION_AFTER_X_DAYS,Cycle:a.cycle})}}else!c&&i.filter(e=>[m.USG,m.PARTURITION,m.FALL_PIGLETS,m.MOMMY,m.SEPARATION,m.ACTIVE_NIPPLES].includes(e.EvCode)).length&&a.invalidEvents.push({EvCode:m.INSEMINATION,Reason:N.a.NO_INSEMINATION_BEFORE_EV,Cycle:a.cycle});if(!s&&i.filter(e=>[m.PARTURITION,m.FALL_PIGLETS,m.SEPARATION,m.ACTIVE_NIPPLES].includes(e.EvCode)).length&&a.invalidEvents.push({EvCode:m.USG,Reason:N.a.NO_USG_BEFORE_EV,Cycle:a.cycle}),!u&&i.filter(e=>[m.SEPARATION,m.FALL_PIGLETS].includes(e.EvCode)).length&&a.invalidEvents.push({EvCode:m.PARTURITION,Reason:N.a.NO_PARTURITION_AFTER_EV,Cycle:a.cycle}),!f){i.find(e=>[m.PARTURITION].includes(e.EvCode))&&r!==e.length-1&&a.invalidEvents.push({EvCode:m.SEPARATION,Reason:N.a.NO_SEPARATION_AFTER_EV,Cycle:a.cycle})}if(c&&!u){let e=+g()(+c.EvTime).startOf("day").add(Object(T.getTimeFromInseminationToPartuition)(),"days");i.filter(t=>+t.EvTime>=e&&![m.SEPARATION].includes(t.EvCode)).length&&a.invalidEvents.push({EvCode:m.PARTURITION,Reason:N.a.NO_PARTURITION_AFTER_X_DAYS,Cycle:a.cycle})}if(u&&f){let e=0,t=f.EvData.PiCnt;[...a[m.FALL_PIGLETS],...a[m.SEPARATION_TO_MOMMY]].forEach(t=>{t.EvCode===m.FALL_PIGLETS&&(e-=+t.EvData.Piglets),t.EvCode===m.SEPARATION_TO_MOMMY&&(e-=+t.EvData.PiCnt)}),[...a[m.PARTURITION],...a[m.MOMMY]].forEach(t=>{t.EvCode===m.PARTURITION&&(e+=+t.EvData.HealthyCnt),t.EvCode===m.MOMMY&&(e+=+t.EvData.PiCnt)}),t>e&&a.invalidEvents.push({EvCode:m.SEPARATION,Reason:N.a.SEPARATION_CNT_BIGGER_THAN_PARTURITION_CNT,Cycle:a.cycle})}if(u&&d){const e=a[m.SEPARATION_TO_MOMMY][a[m.SEPARATION_TO_MOMMY].length-1],t=a[m.PARTURITION].reduce((e,t)=>e+ +t.EvData.HealthyCnt,0),n=o()(a[m.FALL_PIGLETS])?0:a[m.FALL_PIGLETS].filter(t=>+t.EvTime<=+e.EvTime).reduce((e,t)=>e+ +t.EvData.Piglets,0);(o()(a[m.SEPARATION_TO_MOMMY])?0:a[m.SEPARATION_TO_MOMMY].reduce((e,t)=>e+ +t.EvData.PiCnt,0))>t-n&&a.invalidEvents.push({EvCode:m.SEPARATION_TO_MOMMY,Reason:N.a.SEPARATION_CNT_BIGGER_THAN_BIRTH_CNT,Cycle:a.cycle})}if(I&&u){const e=a[m.ACTIVE_NIPPLES][a[m.ACTIVE_NIPPLES].length-1].Nipples,t=i.filter(e=>[m.PARTURITION,m.FALL_PIGLETS,m.SEPARATION_TO_MOMMY,m.SEPARATION,m.MOMMY,m.INSEMINATION].includes(e.EvCode)).filter(e=>+e.EvTime>=+u.EvTime);Object(E.getPigBalance)(t)>e&&a.invalidEvents.push({EvCode:m.ACTIVE_NIPPLES,Reason:N.a.PIGLET_CNT_BIGGER_THAN_NIPPLES,Cycle:a.cycle})}if(O){const e=g()(l()(O,"EvData.LastSeparation")).startOf("day");if(f){g()(l()(f,"EvTime")).startOf("day").isSame(e)||a.invalidEvents.push({EvCode:m.SEPARATION,Reason:N.a.LAST_SEPARATION_DIFF_THAN_IN_REALITY,Cycle:a.cycle,type:"warning"})}else a.invalidEvents.push({EvCode:m.SEPARATION,Reason:N.a.NO_SEPARATION_BUT_SOW_CYCLES,Cycle:a.cycle,type:"success",AdditionalData:{lastSeparation:e.format("DD.MM.YYYY")}})}n.push(a)}),n}function h(e){let t=[];for(let n=0;ne+t,0)/t.length}},ui7M:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var a=n("wd/R"),r=n.n(a),i=(n("f0Wu"),n("4AJ9")),o=n.n(i),c=n("B6RA"),s=n("9GTB");function u(e){let t=r.a.tz.guess(!0);if(e)try{let n=Object(s.b)(c.default.getState(),e),a=n.FarmCord.split(","),r=0,i=0;return n.FarmCord.includes("'")?(r=+a[0].split("'").join(".")||0,i=+a[1].split("'").join(".")||0):(r=+a[0]||0,i=+a[1]||0),t=o()(r,i),t}catch(n){t=r.a.tz.guess(!0)}return t}},v9qu:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var a=n("SjWX");function r(){try{const e=Object(a.detect)();if(e.os.startsWith("Android"))return!0;if(e.os.startsWith("iPad"))return!0;if(e.os.startsWith("iPhone"))return!0;if(e.os.startsWith("iOS"))return!0}catch(e){console.error("isMobile error",e.name,e.message)}return!1}},wQVC:function(e,t,n){"use strict";n.d(t,"a",(function(){return u})),n.d(t,"j",(function(){return l})),n.d(t,"k",(function(){return f})),n.d(t,"l",(function(){return d})),n.d(t,"g",(function(){return m})),n.d(t,"h",(function(){return I})),n.d(t,"c",(function(){return T})),n.d(t,"d",(function(){return E})),n.d(t,"f",(function(){return N})),n.d(t,"b",(function(){return O})),n.d(t,"e",(function(){return D})),n.d(t,"m",(function(){return A})),n.d(t,"i",(function(){return S}));var a=n("lFKM"),r=n.n(a),i=n("mwIZ"),o=n.n(i);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const u={NON_BLOCKING:0,MENU:1,LEFT_BAR:2,MODAL:3,DRAWER:4,RIGHT_DRAWER:5};function l(e,{block:t="start"}={}){try{return document.getElementById(e).scrollIntoView({block:t,behavior:"smooth"}),!0}catch(n){return console.error(n),!1}}function f(e={}){document.body.scrollIntoView(function(e){for(var t=1;te}const g=e=>e&&r()(e)?"lock-scroll-".concat(e):"lock-scroll";function T(e=0){document.body.classList.add(g(e))}function E(e=0){document.body.classList.remove(g(e))}function N(e=1){return e*parseFloat(getComputedStyle(document.documentElement).fontSize)}function O(e,{timeoutBefore:t=300,timeoutAfter:n=1e3}={}){try{setTimeout(()=>{try{const t=document.getElementById(e);t.classList.add("notice-me"),t.classList.add("noticable"),setTimeout(()=>{try{t.classList.remove("notice-me")}catch(e){}},n)}catch(t){}},t)}catch(a){console.error(a)}}function D(){let e;try{e=document.getElementById("app-header").getElementsByClassName("rmc-tabs-tab-bar")[0].getBoundingClientRect().height||0}catch(t){e=0}if(0===e)try{e=document.getElementById("app-header").getElementsByClassName("tabs")[0].getBoundingClientRect().height||0}catch(t){e=0}return e}function A(){try{console.log("Force unregister service worker"),"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then((function(e){for(let t of e)t.scope.includes("fetura")&&t.unregister().then(e=>console.log(t.scope," out!"))}))}catch(e){console.error(e)}}function S(e){setTimeout(()=>{requestAnimationFrame(e)})}},xohT:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var a=n("WmuQ");function r(e){let t;switch(e){case"codes":t="fa-text";break;case"date":t="fa-calendar-day";break;case"user":t="fa-user";break;case"anls":case a.a.ANIMALS:case a.b.ANIMALS:t="fa-pig";break;case a.a.DEVICES:case a.b.DEVICES:t="fa-microchip";break;case a.a.SETTINGS:case a.b.SETTINGS:case a.a.GENERAL:case a.b.GENERAL:t="fa-cog";break;case a.b.DICTIONARY:case a.a.DICTIONARY:t="fa-book";break;case"bugs":case a.a.BUILDINGS:case a.b.BUILDINGS:t="fa-farm";break;case"Medicine":t="fa-pills";break;case"ControlList":t="fa-list-alt";break;case"GraftingProgram":t="fa-syringe";break;case"Ingredient":t="fa-wheat";break;default:t=""}return"fas pr-1 fa-fw ".concat(t)}},"zk5+":function(e,t,n){"use strict";n.d(t,"a",(function(){return W})),n.d(t,"w",(function(){return Y})),n.d(t,"d",(function(){return j})),n.d(t,"m",(function(){return V})),n.d(t,"q",(function(){return k})),n.d(t,"o",(function(){return x})),n.d(t,"l",(function(){return H})),n.d(t,"p",(function(){return z})),n.d(t,"r",(function(){return K})),n.d(t,"k",(function(){return X})),n.d(t,"i",(function(){return Z})),n.d(t,"c",(function(){return J})),n.d(t,"z",(function(){return q})),n.d(t,"n",(function(){return Q})),n.d(t,"y",(function(){return $})),n.d(t,"g",(function(){return ee})),n.d(t,"j",(function(){return te})),n.d(t,"x",(function(){return ae})),n.d(t,"f",(function(){return re})),n.d(t,"h",(function(){return ie})),n.d(t,"b",(function(){return oe})),n.d(t,"B",(function(){return ce})),n.d(t,"t",(function(){return se})),n.d(t,"v",(function(){return ue})),n.d(t,"s",(function(){return le})),n.d(t,"u",(function(){return fe})),n.d(t,"C",(function(){return de})),n.d(t,"A",(function(){return me})),n.d(t,"e",(function(){return Ie}));var a=n("JELi"),r=n.n(a),i=n("P/G1"),o=n.n(i),c=n("44Ds"),s=n.n(c),u=n("J2iB"),l=n.n(u),f=n("Y+p1"),d=n.n(f),m=n("E+oP"),I=n.n(m),g=n("UfWW"),T=n.n(g),E=n("oSXT"),N=n.n(E),O=n("i8MS"),D=n("wd/R"),A=n.n(D),S=n("q1tI"),y=n.n(S),p=n("bHJJ"),h=n("B6RA"),R=n("hw2D"),P=n("y3qy"),v=n("91lk"),b=(n("wQmL"),n("PMCe")),C=n("PrG/"),M=n("7EKC"),_=n("pZsI"),w=n("kiXb"),L=n("PRyg");function G(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function F(e){for(var t=1;tfunction(e=[]){const t=r()(e,e=>e.EvCode===C.INSEMINATION);if(t>-1){const n=e.slice(t),a=Object(L.getPigBalance)(n);if(!l()(a)&&a>0)return!0}return!1}(e.events));return n=N()(n,t,"AnmID"),n}function H(e,t=[]){let n=O.a.getAllAnimals(e,void 0,!1,!1);return n=N()(n,t,"AnmID"),n}function z(e,t=[]){let n=O.a.getAllAnimals(e,b.PORKER,!1,!1);return n=N()(n,t,"AnmID"),n}function K(e,t=[]){let n=[...O.a.getAllAnimals(e,b.SOW,!1,!1),...O.a.getAllAnimals(e,b.RENOVATION_SOW,!1,!1)];return n=N()(n,t,"AnmID"),n}function X(e){return e.sort((e,t)=>(e.AnmNo1||"").localeCompare(t.AnmNo1)),e.map(e=>({name:e.AnmNo1,value:e}))}const Z=({column:{key:e},row:t})=>t[e]?A()(t[e]).format("DD.MM.YYYY"):null,J=({column:{key:e},row:t})=>t[e]?t[e].AnmNo1:null,q=({column:{key:e},row:t})=>{const{user:{employees:n}}=h.default.getState();let a=n.find(n=>n.LocalUserID===t[e]);return a?a.userName:null};function Q(){const{user:{employees:e}}=h.default.getState();return e.filter(e=>!e.userName.includes("erased")).map(e=>({value:e.LocalUserID,name:e.userName}))}const $=({value:e,onChange:t})=>y.a.createElement(R.a,{value:e,options:Q(),onChange:t,placeholder:w.a.t("operator")}),ee=({value:e,onChange:t})=>y.a.createElement(P.a,{type:"text",onChange:t,value:e,placeholder:w.a.t("comment")}),te=({value:e,onChange:t})=>y.a.createElement(P.a,{value:e,onChange:t,type:"date"}),ne=({value:e,onChange:t})=>{let n=_.a.getTechnologyGroups(h.default.getState().location.farm).sort((e,t)=>t.StartTime-e.StartTime).filter(e=>e.AnmList.filter(t=>!e.Rmvd.includes(t)).map(e=>O.a.getAnimalById(e,{joinEvents:!1})).filter(e=>e&&!e.DtaDthTime).length>0).map(e=>({value:e,name:A()(e.StartTime).format("DD.MM.YYYY")}));return y.a.createElement(R.a,{value:e,options:n,onChange:t,placeholder:w.a.t("technologyGroup")})},ae={name:w.a.t("operator"),key:"operator",editor:y.a.forwardRef((e,t)=>y.a.createElement(p.a,B({},e,{options:Q(),ref:t}))),formatter:q,filterRenderer:$},re={name:w.a.t("comment"),key:"comment",filterRenderer:ee,editor:y.a.forwardRef((e,t)=>y.a.createElement(M.a,B({type:"text",ref:t},e)))},ie={name:w.a.t("date"),key:"date",editor:y.a.forwardRef((e,t)=>y.a.createElement(M.a,B({},e,{ref:t,type:"date"}))),formatter:Z,filterRenderer:te};function oe(e,t){return{name:w.a.t("animalNumber"),key:"animal",editor:y.a.forwardRef((t,n)=>y.a.createElement(p.a,B({},t,{options:e,ref:n}))),formatter:J,filterRenderer:ne,disableAutoInsert:!0,disableDragAndDrop:!0,clearRowOnRemove:!0,onChange:t}}function ce(e,t,{field:n="animal",onRowChange:a=(()=>{})}={}){if(e){let r=e.AnmList.filter(t=>!e.Rmvd.includes(t)).map(e=>O.a.getAnimalById(e,{joinEvents:!1})).filter(e=>e&&!e.DtaDthTime);r.sort((e,t)=>e.AnmNo1&&e.AnmNo1.localeCompare(t.AnmNo1)),t=t.map(()=>{let e=r.shift();return F({[n]:e||null},a(e))});for(let e of r)t.push(F({[n]:e},a(e)))}else t=t.map(e=>({}));return t}function se(e,t,n,a,r=(()=>!0)){return n=l()(e)?n.map(e=>F({},e,{[t]:null})):n.map(n=>o()(n).every(I.a)?{}:F({},n,{[t]:l()(n[t])||d()(n[t],a)?r(n)?e:null:n[t]}))}function ue(e,t,n,a=(()=>!0)){if(e.hasOwnProperty("operator")){const{operator:r}=e;return se(r,"operator",t,n,a)}return t}function le(e,t,n,a=(()=>!0)){if(e.hasOwnProperty("comment")){const{comment:r}=e;return se(r,"comment",t,n,a)}return t}function fe(e,t,n){if(e.hasOwnProperty("animal")){const{animal:a}=e,{animal:r}=n;d()(a,r)||(t=ce(a,t))}if(e.hasOwnProperty("date")){const{date:a}=e;t=se(a,"date",t,n.date)}return t=le(e,t=ue(e,t,n.operator),n.comment)}function de(e,t,n=[],a=!1){let r=!1,i=e.map(i=>{let o={};return Y(i,n)||(i.animal?a||e.filter(e=>e.animal&&e.animal.AnmID===i.animal.AnmID).length>1&&(o.animal=w.a.t("errors.duplicate")):o.animal=w.a.t("required"),i.operator||(o.operator=w.a.t("required")),i.date||(o.date=w.a.t("required")),o=F({},o,{},t(i))),I()(o)||(r=!0),o});if(r)return i}const me=s()((e,t)=>{for(let n of t)if(n.animal){let t=T()(e,e=>e.AnmID===n.animal.AnmID);if(!(t>=0))return!1;e.splice(t,1)}return e.length<=0},(e,t)=>JSON.stringify(e)+JSON.stringify(t)),Ie=s()((e,t)=>{let n=e.AnmList.filter(t=>!e.Rmvd.includes(t)).map(e=>O.a.getAnimalById(e,{joinEvents:!1})).filter(e=>e&&!e.DtaDthTime);return me(n,t)},(e,t)=>e.TGID+JSON.stringify(t))}}]); //# sourceMappingURL=main~88441e2e.163a8039.chunk.js.map