(this["webpackJsonpgonzo-test-client"]=this["webpackJsonpgonzo-test-client"]||[]).push([[99],{"+0ec":function(e,t,r){"use strict";t.a=r.p+"static/media/hus.a7ef78eb.svg"},"+3lf":function(e,t,r){"use strict";t.a=r.p+"static/media/pig_walk.7b75b4e8.svg"},"+AL/":function(e,t,r){"use strict";t.a=r.p+"static/media/piglet.e79c36bd.svg"},"+OWA":function(e,t,r){},"/wPd":function(e,t,r){"use strict";t.a=r.p+"static/media/calibration_start.48dc4e7a.svg"},"02dk":function(e,t,r){"use strict";t.a=r.p+"static/media/pipe.cf5814ac.svg"},"0c/6":function(e,t,r){"use strict";t.a=r.p+"static/media/treatment.9aeb8339.svg"},"0hRy":function(e,t,r){"use strict";r.r(t),t.default=r.p+"static/media/dispenserWST.d2f5b7b2.svg"},"1+PD":function(e,t,r){"use strict";t.a=r.p+"static/media/pigletSingle.e54c09da.svg"},"1/Ix":function(e,t,r){"use strict";t.a=r.p+"static/media/inseminations.9a2cbf9d.svg"},"14zg":function(e,t,r){"use strict";t.a=r.p+"static/media/dispenser_usage.476cf46a.svg"},"15N+":function(e,t,r){"use strict";t.a=r.p+"static/media/ma.75dadf45.svg"},"1KXW":function(e,t,r){"use strict";t.a=r.p+"static/media/palette.0d8fa121.svg"},"25HA":function(e,t,r){"use strict";t.a=r.p+"static/media/chrome-mob-2.26091953.png"},"2rxW":function(e,t,r){"use strict";t.a=r.p+"static/media/weight.030c038e.svg"},"2x5x":function(e,t,r){"use strict";t.a=r.p+"static/media/waterFlowMeter.59bb8895.svg"},"39gQ":function(e,t,r){"use strict";t.a=r.p+"static/media/fetura_cloud_colour.10b3627b.svg"},"3SM+":function(e,t,r){"use strict";t.a=r.p+"static/media/alarm_max_icon.03a7e596.svg"},"3m4P":function(e,t,r){"use strict";t.a=r.p+"static/media/hms.019e0279.svg"},"4wAs":function(e,t,r){"use strict";t.a=r.p+"static/media/grafting.41915024.svg"},"5/MK":function(e,t,r){"use strict";t.a=r.p+"static/media/hu.0612be9a.svg"},"5/vq":function(e,t,r){"use strict";t.a=r.p+"static/media/piglets_treatment.06d57a44.svg"},"548a":function(e,t,r){"use strict";t.a=r.p+"static/media/electricityMeter.5d6d71bf.svg"},"5tiW":function(e,t,r){"use strict";r.r(t),t.default=r.p+"static/media/insemination.ad3a4715.svg"},"61CT":function(e,t,r){"use strict";t.a=r.p+"static/media/average_pig_walk.cc0eb3e5.svg"},"71VT":function(e,t,r){"use strict";r.r(t),t.default=r.p+"static/media/automatic_add_animal.b90bbb97.svg"},"71tM":function(e,t,r){"use strict";t.a=r.p+"static/media/total_consumption.d5e0e212.svg"},"9App":function(e,t,r){"use strict";t.a=r.p+"static/media/chain.c5ac1b6b.svg"},"9Z4+":function(e,t,r){"use strict";t.a=r.p+"static/media/sales.76dd7591.svg"},"9nK9":function(e,t,r){"use strict";t.a=r.p+"static/media/chrome-1.be4c5c60.png"},"9odO":function(e,t,r){"use strict";t.a=r.p+"static/media/average_weight.a07c0bbe.svg"},A2aW:function(e,t,r){"use strict";t.a=r.p+"static/media/separation.f03256aa.svg"},"B+hW":function(e,t,r){"use strict";t.a=r.p+"static/media/ps.a8e63ac9.svg"},B02h:function(e,t,r){"use strict";t.a=r.p+"static/media/average_day_consumption.151cef30.svg"},B6Rp:function(e,t,r){"use strict";t.a=r.p+"static/media/porkerSingle.574dd0f7.svg"},BoWw:function(e,t,r){"use strict";t.a=r.p+"static/media/l2.79bd388a.svg"},BvfJ:function(e,t,r){"use strict";t.a=r.p+"static/media/delay.ec2e9d72.svg"},CYnS:function(e,t,r){"use strict";t.a=r.p+"static/media/chrome-mob-1.74880826.png"},Crab:function(e,t,r){"use strict";t.a=r.p+"static/media/percentage_fill_icon.eb9d3b81.svg"},"D9/k":function(e,t,r){"use strict";t.a=r.p+"static/media/chainFeeding.7d89c40b.svg"},ECHa:function(e,t,r){"use strict";t.a=r.p+"static/media/fan_symbol_icon.8548d171.svg"},En8b:function(e,t,r){"use strict";r.r(t),t.default=r.p+"static/media/bridge.e09d1e43.svg"},FlbQ:function(e,t,r){"use strict";t.a=r.p+"static/media/usg.7fbe04e6.svg"},"H+Jz":function(e,t,r){"use strict";t.a=r.p+"static/media/fill_day_icon.35ca840d.svg"},"H+s/":function(e,t,r){"use strict";t.a=r.p+"static/media/heat.b2a65c51.svg"},HHIC:function(e,t,r){"use strict";r.r(t),t.default=r.p+"static/media/weightWST.4c9c5d5b.svg"},Hc9C:function(e,t,r){"use strict";r.r(t),t.default=r.p+"static/media/climateWST.451cb97e.svg"},HuqI:function(e,t,r){"use strict";t.a=r.p+"static/media/4.cf2dcdd7.svg"},IHQa:function(e,t,r){"use strict";t.a=r.p+"static/media/separation-mommy.5e3ccdd7.svg"},IWVJ:function(e,t,r){"use strict";t.a=r.p+"static/media/idle-days.6d96bac1.svg"},IqJe:function(e,t,r){"use strict";t.a=r.p+"static/media/selection.950ad102.svg"},Iugh:function(e,t,r){"use strict";r.r(t),t.default=r.p+"static/media/treatment.2280e674.svg"},Jxr4:function(e,t,r){"use strict";t.a=r.p+"static/media/0.02a096cc.svg"},K7Uc:function(e,t,r){"use strict";t.a=r.p+"static/media/firefox-1.7602970c.png"},KJ2v:function(e,t,r){"use strict";t.a=r.p+"static/media/dead.c21a6324.svg"},KVmA:function(e,t,r){"use strict";t.a=r.p+"static/media/1.9b6159c8.svg"},LfcS:function(e,t,r){"use strict";t.a=r.p+"static/media/insertion.8bf8f758.svg"},Lqnr:function(e,t,r){"use strict";r.r(t),t.default=r.p+"static/media/fall-piglets.b992f1ba.svg"},M3Xf:function(e,t,r){"use strict";t.a=r.p+"static/media/ban.98c4fca6.svg"},M64W:function(e,t,r){"use strict";t.a=r.p+"static/media/sow.300c8920.svg"},MyHe:function(e,t,r){"use strict";t.a=r.p+"static/media/schedule.64f87245.svg"},NnKB:function(e,t,r){"use strict";t.a=r.p+"static/media/gain.841ce45f.svg"},O9J6:function(e,t,r){"use strict";r.r(t),t.default=r.p+"static/media/mommy.5197e587.svg"},OwcS:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const a=r("2yJ6");function n(){return a("1234567890AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz-",20)}},"PGv+":function(e,t,r){"use strict";t.a=r.p+"static/media/humidity_symbol_icon.c52cb831.svg"},Pdmn:function(e,t,r){"use strict";t.a=r.p+"static/media/medicines.851421b2.svg"},"R+tp":function(e,t,r){"use strict";t.a=r.p+"static/media/nas.1cfdd563.svg"},RbfI:function(e,t,r){"use strict";r.r(t),t.default=r.p+"static/media/cage.601b468e.svg"},RutU:function(e,t,r){"use strict";t.a=r.p+"static/media/search.0992df33.svg"},"S/e0":function(e,t,r){"use strict";t.a=r.p+"static/media/thermoeye.8d13dd6e.svg"},SSS2:function(e){e.exports=JSON.parse('[{"lang":"en"},{"lang":"pl"},{"lang":"ru"},{"lang":"es"},{"lang":"ro"},{"lang":"cimode"}]')},STTX:function(e,t,r){"use strict";t.a=r.p+"static/media/new-sow.199031d0.svg"},Sy8u:function(e,t,r){"use strict";t.a=r.p+"static/media/forage_supply_icon.977d341f.svg"},TmEv:function(e,t,r){"use strict";t.a=r.p+"static/media/mas.d0e10533.svg"},UF3x:function(e,t,r){"use strict";t.a=r.p+"static/media/firefox-mob-1.dd29f1b2.png"},UROv:function(e,t,r){"use strict";t.a=r.p+"static/media/firefox-mob-2.cef1e5ae.png"},UltZ:function(e,t,r){"use strict";t.a=r.p+"static/media/lost-rfid.1a2dccad.svg"},Urc6:function(e,t,r){"use strict";t.a=r.p+"static/media/fall.c7a92b64.svg"},Uz7D:function(e,t,r){"use strict";t.a=r.p+"static/media/day_consumption.53816ca0.svg"},VRSS:function(e,t,r){"use strict";t.a=r.p+"static/media/poop_symbol_icon.4aaf39f0.svg"},VTF0:function(e,t,r){"use strict";t.a=r.p+"static/media/chrome-2.73a4a00d.png"},"X/ou":function(e,t,r){"use strict";t.a=r.p+"static/media/ventilation_max_icon.f9d4b9bd.svg"},XZUa:function(e,t,r){"use strict";r.r(t),t.default=r.p+"static/media/dispenserNRF.47fff4dc.svg"},XwVs:function(e,t,r){"use strict";t.a=r.p+"static/media/dispenser_bag.2845d500.svg"},Xyqo:function(e,t,r){"use strict";t.a=r.p+"static/media/sensor.ebfe1287.svg"},YOFI:function(e,t,r){"use strict";t.a=r.p+"static/media/dispenser.95490805.svg"},YPNF:function(e,t,r){"use strict";t.a=r.p+"static/media/ventilation_min_icon.c7c27c82.svg"},YRMh:function(e,t,r){"use strict";t.a=r.p+"static/media/pss.bce8fb90.svg"},ZOBY:function(e,t,r){"use strict";t.a=r.p+"static/media/rfid.00c56ec0.svg"},ZVDl:function(e,t,r){"use strict";t.a=r.p+"static/media/6.6d63e812.svg"},ZVcB:function(e,t,r){"use strict";t.a=r.p+"static/media/total_consumption.330b882b.svg"},ZdXc:function(e,t,r){"use strict";t.a=r.p+"static/media/selection.a40371c3.svg"},b9i1:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var a=r("j1RV"),n=r("wj3C"),i=r.n(n),c=(r("gHGA"),r("B6RA")),s=r("XzT5");const o=Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function l(e){if("serviceWorker"in navigator){if(new URL("",window.location.href).origin!==window.location.origin)return;window.addEventListener("load",()=>{const t="".concat("","/service-worker.js");o?(!function(e,t){fetch(e,{headers:{"Service-Worker":"script"}}).then(r=>{const a=r.headers.get("content-type");404===r.status||null!=a&&-1===a.indexOf("javascript")?navigator.serviceWorker.ready.then(e=>{e.unregister().then(()=>{window.location.reload()})}):u(e,t)}).catch(()=>{console.log("No internet connection found. App is running in offline mode.")})}(t,e),navigator.serviceWorker.ready.then(()=>{console.log("This web app is being served cache-first by a service worker. To learn more, visit https://bit.ly/CRA-PWA")})):u(t,e)})}}function u(e,t){navigator.serviceWorker.register(e).then(e=>{try{i.a.messaging().useServiceWorker(e)}catch(r){console.error("Error in firebase registration"+r)}e.onupdatefound=()=>{const r=e.installing;null!=r&&(r.onstatechange=()=>{"installed"===r.state&&(navigator.serviceWorker.controller?(c.default.dispatch(Object(a.addNotification)({title:s.a.t("registerServiceWorker.newVersion"),message:s.a.t("registerServiceWorker.newVersionText"),status:"info",dismissible:!1,dismissAfter:0,buttons:[{name:s.a.t("registerServiceWorker.refresh"),onClick:()=>{r.postMessage({type:"SKIP_WAITING"}),navigator.serviceWorker.addEventListener("controllerchange",()=>{window.location.reload()})}}]})),console.log("New content is available and will be used when all tabs for this page are closed. See https://bit.ly/CRA-PWA."),t&&t.onUpdate&&t.onUpdate(e)):(console.log("Content is cached for offline use."),t&&t.onSuccess&&t.onSuccess(e)))})}}).catch(e=>{console.error("Error during service worker registration:",e)})}},bmNN:function(e,t,r){"use strict";t.a=r.p+"static/media/na.45f1e760.svg"},cokx:function(e,t,r){"use strict";var a=r("ANjH");function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function i(e){for(var t=1;t(r.WData[e]?r.WData[e]=r.WData[e].concat(a.WData[e].map(e=>(e.isDefault=!0,e))):r.WData[e]=a.WData[e].map(e=>(e.isDefault=!0,e)),e)),r}function Ye(e,t){let r=e.slice(0),a=[];for(let n of t){let t=e.find(e=>e.WordID===n.WordID);t&&(r=r.filter(e=>e.WordID!==t.WordID)),a.push(t||n)}return a=[...a,...r.map(e=>e)],console.log(a),a}var Je=r("15cA");function xe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function Ke(e){for(var t=1;tp()(Xe()(e,e=>e.DtaModTime),"DtaModTime",0);var at=r("9Gtd"),nt=r("f0zD"),it=r("j1RV");function ct(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function st(e){for(var t=1;tt.AggTi-e.AggTi),r.set(a,i),r}function cr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function sr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const or={loading:!1};function lr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function ur(e){for(var t=1;t!e.DtaDelTime).slice(0)});case"USER_NEED_TO_ACCEPT_EULA":return y({},e,{fetching:!1,isAuthenticating:!1});case"UPDATE_AUTHORIZATIONS_REJECTED":case"UPDATE_AUTHORIZATIONS_FULFILLED":return y({},e,{updatingRoles:!1});case"UPDATE_AUTHORIZATIONS_PENDING":return y({},e,{updatingRoles:!0});case"LOADED_DATA":return y({},e,{loadedData:!0});case"CHANGE_CLIENT_PENDING":return y({},e,{isChangingClientID:!0});case"CHANGE_CLIENT_REJECTED":case"REFRESH_TOKEN_REJECTED":return y({},e,{isChangingClientID:!1});case"REFRESH_TOKEN_FULFILLED":return y({},e,{isChangingClientID:!1,user:y({},e.user,{ClientID:t.meta.ClientID})});case"USER_MAIL_VERIFY":return y({},e,{user:y({},e.user,{ClientID:t.meta.ClientID})});case"USER_CHANGE_MQTT_PASSWORD":return y({},e,{user:y({},e.user,{LocalMqttSecret:t.payload})});case"UPDATE_DOC_READ":{let r=e.user.DocRead||[];return y({},e,{user:y({},e.user,{DocRead:[...r,...l()(t.payload)?t.payload:[t.payload]]})})}case"UPDATE_LIC_PACKAGE":{const{user:{LicPackages:r}}=e,a=r.slice(0);return a[f()(a,e=>e.SubID===t.payload.SubID)]=t.payload,console.log(a),y({},e,{user:y({},e.user,{LicPackages:a})})}case"CHANGE_USER_SECRET":return y({},e,{user:y({},e.user,{LocalStorageSecret:t.payload})});default:return e}},farms:function(e=h,t){switch(t.type){case"GET_FARMS":return D({},e,{farms:t.payload});case"GET_USER_REJECTED":return D({},e,{farms:[]});case"CHANGE_FARM":return D({},e,{buildings:[]});case"GET_ALL_BUILDINGS":return D({},e,{fetching:!1,fetched:!0,buildings:T()(t.payload.sort(I("BName")))});case"FETCH_BUILDINGS_BY_FARM_ID_FULFILLED":return D({},e,{fetching:!1,fetched:!0});case"FETCH_BUILDINGS_BY_FARM_ID_PENDING":return D({},e,{fetching:!1});case"FETCH_BUILDINGS_BY_FARM_ID_REJECTED":return D({},e,{fetching:!1,fetched:!1,error:t.payload});case"USER_LOGOUT_FULFILLED":return h;case"ADD_LOCATION_PENDING":return D({},e,{adding:!0});case"ADD_LOCATION_REJECTED":case"ADD_LOCATION_FULFILLED":return D({},e,{adding:!1});case"UPDATE_LOCATION_PENDING":return D({},e,{updating:!0});case"UPDATE_LOCATION_REJECTED":case"UPDATE_LOCATION_FULFILLED":return D({},e,{updating:!1});case"DELETE_LOCATION_PENDING":return D({},e,{deleting:!0});case"DELETE_LOCATION_REJECTED":case"DELETE_LOCATION_FULFILLED":return D({},e,{deleting:!1});default:return e}},language:function(e=N,t){switch(t.type){case"FETCH_LANGUAGE":return A({},e,{fetching:!0});case"FETCH_LANGUAGE_REJECTED":return A({},e,{fetching:!1,error:t.payload});case"FETCH_LANGUAGE_FULFILLED":return A({},e,{fetching:!1,fetched:!0,lang:t.payload});case"SET_LANGUAGE":return A({},e,{locale:t.payload,lang:A({},e.lang,{lang:t.payload})});case"GET_LANGUAGE_CONTENT_FULFILLED":return A({},e,{lang:t.payload});case"GET_LANGUAGE_CONTENT_DYNAMIC":return A({},e,{langDynamic:t.payload});case"GET_LANGUAGES":return A({},e,{supportedLanguages:t.payload});case"GET_TRANSLATION_PENDING":return A({},e,{loading:A({},e.loading,{translations:t.meta})});case"GET_TRANSLATION_REJECTED":return A({},e,{loading:A({},e.loading,{translations:!1})});case"GET_TRANSLATION_FULFILLED":return A({},e,{translations:{content:A({},e.translations.content,{},t.payload.content),acceptance:A({},e.translations.acceptance,{},t.payload.acceptance)},loading:A({},e.loading,{translations:!1})});case"GET_ALL_TRANSLATION_LANGUAGES_PENDING":return A({},e,{loading:A({},e.loading,{translationLanguages:!0})});case"GET_ALL_TRANSLATION_LANGUAGES_REJECTED":return A({},e,{loading:A({},e.loading,{translationLanguages:!1})});case"GET_ALL_TRANSLATION_LANGUAGES_FULFILLED":return A({},e,{availableTranslationLanguages:t.payload,loading:A({},e.loading,{translationLanguages:!1})});case"ADD_LANGUAGE":{const r=e.availableTranslationLanguages.slice(0);return r.push(t.payload),A({},e,{availableTranslationLanguages:r})}case"CHANGE_TRANSLATION":return A({},e,{translations:A({},e.translations,{[t.meta]:t.payload})});default:return e}},modal:nt.c,history:function(e=w,t){switch(t.type){case"GOTO":return R({},e,{path:t.payload});case"REDIRECT":return R({},e,{path:t.payload,haveToRedirect:!0});case"REDIRECT_END":return R({},e,{haveToRedirect:!1});case"USER_LOGOUT_FULFILLED":case"CHANGE_FARM":return w;default:return e}},location:function(e=F,t){switch(t.type){case"CHANGE_ACTIVE_FUNCTION":return j({},e,{activeFun:t.payload});case"CHANGE_FARM":return j({},e,{farm:t.payload,sector:"",building:""});case"USER_LOGOUT_FULFILLED":return F;case"CHANGE_AREA_FARM":return j({},e,{area:j({},e.area,{currentView:"farm",farm:t.payload})});case"CHANGE_AREA_FARM_NEW":return j({},e,{area:j({},e.area,{currentView:"farm",farm:t.payload}),active:t.payload.FarmID});case"CHANGE_BUILDING":return j({},e,{building:t.payload,sector:""});case"CHANGE_AREA_BUILDING":{let r;return t.payload&&(r=t.payload.BgID),j({},e,{area:j({},e.area,{currentView:"building",building:t.payload}),active:r})}case"CHANGE_SECTOR":return j({},e,{sector:t.payload});case"CHANGE_AREA_SECTOR":{let r;return t.payload&&(r=t.payload.SID),j({},e,{area:j({},e.area,{currentView:"sector",sector:t.payload}),active:r})}case"CHANGE_CHAMBER":return j({},e,{chamber:t.payload});case"CHANGE_AREA_CHAMBER":return j({},e,{area:j({},e.area,{currentView:"chamber",chamber:t.payload.chamber,SType:t.payload.SType}),active:t.payload.chamber.CID});case"SET_SETTINGS_VIEW":return j({},e,{area:j({},e.area,{currentView:t.payload})});case"SET_DEFAULT_VALUES_ON_AREA":return j({},e,{active:"",area:{currentView:""}});case"CHANGE_RIGHT_SIDEBAR_CONTENT":return j({},e,{rightSideBarContent:t.payload});case"CHANGE_LEFT_SIDEBAR_CONTENT":return j({},e,{leftSideBarContent:t.payload});case"UPDATE_BUILDING_FULFILLED":case"DELETE_SECTOR_FULFILLED":return j({},e,{area:j({},e.area,{building:t.payload})});case"FETCH_BUILDINGS_BY_FARM_ID_FULFILLED":return j({},e,{area:j({},e.area)});case"CHANGE_SHOWING_FARM":return j({},e,{activeFarm:t.payload});case"CHANGE_DEVICE":return j({},e,{area:j({},e.area,{device:t.payload})});case"SHOW_HIDE_NAV_MENU_ELEMENT":return j({},e,{navMenuElementShow:t.payload});default:return e}},view:function(e=ee,t){switch(t.type){case"HIDE_NAVIGATION":return Z({},e,{viewProperties:{left:!1,right:!1,top:!1}});case"HIDE_SIDE_NAVIGATION":return Z({},e,{viewProperties:{left:!1,right:!1,top:!0}});case"SHOW_NAVIGATION":return Z({},e,{viewProperties:{left:!0,right:!0,top:!0}});case"SET_GLOBAL_LOADING":return Z({},e,{globalLoading:t.payload});case"MOBILE_SET_SHOW_BREEDING":return Z({},e,{showBreeding:t.payload});case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return ee;default:return e}},news:function(e=bt,t){switch(t.type){case"CREATE_NEWS_PENDING":case"GET_NEWS_PENDING":return _t({},e,{fetching:!0,fetched:!1});case"CREATE_NEWS_REJECTED":case"GET_NEWS_REJECTED":return _t({},e,{fetching:!1,error:t.payload});case"CREATE_NEWS_FULFILLED":return _t({},e,{fetching:!1,fetched:!0});case"GET_NEWS_FULFILLED":{const a=r("B6RA").default;return _t({},e,{fetching:!1,fetched:!0,newsValues:t.payload.filter(e=>e.Lang===a.getState().language.lang.lang)})}case"USER_LOGOUT_FULFILLED":return bt;default:return e}},notifications:Object(it.reducer)(),footerActions:function(e=k,t){switch(t.type){case"NEXT_PAGE":case"PREV_PAGE":return M({},e,{offset:t.payload});case"PAGE_INFO":return M({},e,{currentPage:t.payload.current,totalPages:t.payload.total});case"INIT_NOTIFICATION":return M({},e,{offset:0,listAmount:100,allElements:t.payload});case"GET_NOTIFICATION":return M({},e,{elementsOnPage:t.payload.length});case"SET_LIST_AMOUNT":if(parseInt(t.payload)<0&&(t.payload=100),parseInt(t.payload)>=e.allElements)return M({},e,{offset:0,listAmount:parseInt(t.payload)});{let r=parseInt(t.payload);return""===t.payload&&(r=100),M({},e,{listAmount:r})}case"SET_OFFSET":return M({},e,{offset:t.payload});case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return k;default:return e}},settings:function(e=Q,t){switch(t.type){case"CHANGE_SHOW_AREA_CONFIG":return q({},e,{showAreaConfig:t.payload,showDevicesConfig:!1,showNotifications:!1,showLicense:!1,showSMS:!1,showEmail:!1,showAppConf:!1});case"CHANGE_SHOW_DEVICES_CONFIG":return q({},e,{showAreaConfig:!1,showDevicesConfig:t.payload,showNotifications:!1,showLicense:!1,showSMS:!1,showEmail:!1,showAppConf:!1});case"CHANGE_SHOW_NOTIFICATIONS":return q({},e,{showAreaConfig:!1,showDevicesConfig:!1,showNotifications:t.payload,showLicense:!1,showSMS:!1,showEmail:!1,showAppConf:!1});case"CHANGE_SHOW_SMS":return q({},e,{showSMS:t.payload,showEmail:!1,showAppConf:!1});case"CHANGE_SHOW_EMAIL":return q({},e,{showEmail:t.payload,showSMS:!1,showAppConf:!1});case"CHANGE_SHOW_APP_CONF":return q({},e,{showAppConf:t.payload,showEmail:!1,showSMS:!1});case"CHANGE_SHOW_LICENSE":return q({},e,{showAreaConfig:!1,showDevicesConfig:!1,showNotifications:!1,showLicense:t.payload,showSMS:!1,showEmail:!1,showAppConf:!1});case"CHANGE_SHOW_PAYMENT_METHODS":return q({},e,{showPaymentMethods:t.payload,showSubscriptions:!1});case"CHANGE_SHOW_SUBSCRIPTIONS":return q({},e,{showPaymentMethods:!1,showSubscriptions:t.payload});case"CLOSE_ALL_TABS":return q({},e,{showAreaConfig:!1,showDevicesConfig:!1,showNotifications:!1,showLicense:!1,showSMS:!1,showEmail:!1,showAppConf:!1,showPaymentMethods:!1,showSubscriptions:!1});case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return Q;case"LIST_ALL_SETTINGS":{let r=T()(t.payload);r.sort((e,t)=>+t.DtaModTime-+e.DtaModTime),console.log(r,"sorted");let a=Y()(r.filter(e=>"C"===e.SetType&&void 0!==p()(e,"SetData.Index")&&Object.values(x.b).includes(e.SetData.Type)),e=>p()(e,"SetData.Index")),n=Y()(r.filter(e=>"S"===e.SetType&&void 0!==p()(e,"SetData.Index")).sort((e,t)=>t.DtaModTime-e.DtaModTime),e=>p()(e,"SetData.Index")),i=r.filter(e=>"P"===e.SetType)[0],c=Y()(r.filter(e=>"F"===e.SetType&&void 0!==p()(e,"SetData.Index")&&!e.DtaDelTime).sort((e,t)=>t.DtaModTime-e.DtaModTime),e=>p()(e,"SetData.Index")),s=r.filter(e=>"F"===e.SetType&&!W()(p()(e,"SetData.Index"))&&e.DtaDelTime),o=r.filter(e=>"X"===e.SetType)[0],l=r.filter(e=>"L"===e.SetType),u=r.filter(e=>"FM"===e.SetType&&e.SetData&&e.SetData.Levels),d=new Map;u.map(e=>{e.SetID.startsWith("farm_map_")&&d.set(e.SetID.replace("farm_map_",""),e)});let f=l[0],E=r.filter(e=>"E"===e.SetType)[0],y=r.filter(e=>"FRM"===e.SetType),O=r.filter(e=>"CMD"===e.SetType),g=r.filter(e=>"CC3"===e.SetType);f&&Object.keys(f.SetData.Layout).map(e=>f.SetData.Layout[e]=f.SetData.Layout[e].map(e=>q({},e,{y:-1===e.y?1/0:e.y})));let _=r.filter(e=>"T"===e.SetType),b=r.filter(e=>"ARN"===e.SetType),D=r.filter(e=>e.SetType===J.a.NOTIFICATIONS&&e.LocalUserID===t.meta.user.LocalUserID)[0],m=r.filter(e=>e.SetType===J.a.CLIMATE_CURVE),I=r.find(e=>e.SetType===J.a.DEVICE_SETTINGS),h=r.filter(e=>e.SetType===J.a.SYSTEM_SCHEDULE_WORKTYPE),S=r.filter(e=>e.SetType===J.a.SYSTEM_SCHEDULE);return q({},e,{settings:r,feedingCurves:a,feedingSchedules:n,plan:i,forage:c,forageHistory:s,general:o,fetching:!1,layouts:l,frames:y,commands:O,farmMap:d,layoutsSelect:l.map(e=>({label:e.SetData.Name,value:e})),economy:E,raspberrys:_,endpointArn:b,notifications:D,climateCurves:m,deviceSetting:I,scheduleWorktypes:h,systemSchedules:S,climateCurvesSK3:g})}case"CREATE_SETTING_PENDING":return q({},e,{adding:!0});case"CREATE_SETTING_REJECTED":case"CREATE_SETTING_FULFILLED":return q({},e,{adding:!1});case"UPDATE_SETTING_PENDING":return q({},e,{updating:!0});case"UPDATE_SETTING_REJECTED":case"UPDATE_SETTING_FULFILLED":return q({},e,{updating:!1});case"GET_SETTINGS_PENDING":return q({},e,{fetching:!0});case"GET_SETTINGS_REJECTED":case"GET_SETTINGS_FULFILLED":return q({},e,{fetching:!1});case"SET_LAYOUT":{let r=t.payload;return r&&Object.keys(r.SetData.Layout).map(e=>r.SetData.Layout[e]=r.SetData.Layout[e].map(e=>q({},e,{y:-1===e.y?1/0:e.y}))),q({},e,{layout:r})}default:return e}},loading:function(e=te,t){switch(t.type){case"START_LOADING":return{loading:!0};case"END_LOADING":case"FETCH_FARM_FULFILLED":return{loading:!1};case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return te;default:return e}},farmDevices:function(e=ie,t){switch(t.type){case"GET_DEVICES":return ae({},e,{fetching:!1,fetched:!0,devices:t.payload});case"DEVICES_CONNECTED":{let r=new Map(e.connectedDevices);for(let[e,a]of t.payload.entries())r.set(e,a);return ae({},e,{connectedDevices:r})}case"PING_DEVICE":{let r=new Map(e.pingedDevices);for(let[e,a]of t.payload.entries())r.set(e,a);return ae({},e,{pingedDevices:r})}case"SET_CURRENT_DEVICE":return ae({},e,{currentDevice:t.payload});case"START_DEVICES_SEARCH":return ae({},e,{devicesSearch:!0,devicesSearchTimeout:t.payload,devicesFound:[]});case"STOP_DEVICES_SEARCH":return e.devicesSearchTimeout&&clearTimeout(e.devicesSearchTimeout),ae({},e,{devicesSearch:!1,devicesSearchTimeout:void 0,devicesFound:t.payload?t.payload:[]});case"CHANGE_ADDRESSING":return ae({},e,{startedAddressing:t.payload.state,addressing:{address:0,howManyAdressed:0,toAddress:t.payload.toAddress||0,protocol:t.payload.protocol||""}});case"STANDINGS_REFRESH_VALUES":{let r=T()(e.updateSend);return r.set(t.payload.devID,t.payload),ae({},e,{updateSend:r})}case"UPDATE_DEVICE_PENDING":case"ADD_DEVICE_TO_GATEWAY_PENDING":case"CREATE_DEVICE_PENDING":return ae({},e,{fetching:!0});case"UPDATE_DEVICE_REJECTED":case"ADD_DEVICE_TO_GATEWAY_REJECTED":case"CREATE_DEVICE_REJECTED":case"CREATE_DEVICE_FULFILLED":return ae({},e,{fetching:!1});case"CHANGE_ADDRESSING_STATE":return ae({},e,{addressing:ae({},e.addressing,{},t.payload)});case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return ie;default:return e}},animalDocuments:function(e=Pe,t){let r;switch(t.type){case"ANIMAL_DOCUMENTS_CHANGE_SELECTED_ITEM":{const{payload:{item:e}}=t,r=e instanceof Ie.a||e instanceof me.a||e instanceof Se.a?e:null;return Le({},Pe,{selectedItem:r})}case"INVENTORY_INITIALIZE":{const{animals:r,groups:a,technoGroups:n}=t.payload;let i;return e.selectedItem instanceof me.a&&(i=r.find(t=>t.AnmID===e.selectedItem.AnmID)),e.selectedItem instanceof Ie.a&&(i=a.find(t=>t.AnmGrp===e.selectedItem.AnmID)),e.selectedItem instanceof Se.a&&(i=n.find(t=>t.TGID===e.selectedItem.TGID)),i?Le({},e,{selectedItem:i}):e}case"LIST_EVENT_4_ANM_PENDING":case"LIST_EVENT_4_ANIMAL_REJECTED":case"LIST_EVENT_4_ANIMAL_PENDING":return e.selectedItem instanceof me.a&&p()(t,"meta.AnmID")===e.selectedItem.AnmID?Le({},e,{fetchingEvent:t.type.endsWith("_PENDING"),events:t.type.endsWith("_PENDING")?e.events:[],cycleTable:t.type.endsWith("_PENDING")?e.cycleTable:[]}):e;case"LIST_EVENT_4_ANIMAL_FULFILLED":return e.selectedItem instanceof me.a&&p()(t,"meta.AnmID")===e.selectedItem.AnmID?(r=Object(De.d)(t.payload.items,t.meta.animal),Le({},e,{fetchingEvent:!1,events:_e()(t.payload.items)?[]:t.payload.items.filter(e=>void 0===e.DtaDelTime).sort((e,t)=>e.EvTime-t.EvTime),cycleTable:r.cycleTable})):e;case"LIST_EVENTS_FOR_ANIMALS_REJECTED":case"LIST_EVENTS_FOR_ANIMALS_PENDING":if(e.selectedItem instanceof Ie.a||e.selectedItem instanceof Se.a){const r=e.selectedItem instanceof Ie.a?"AnmGrp":"TGID";if(p()(t,"meta.".concat(r))===e.selectedItem[r])return Le({},e,{fetchingEvent:t.type.endsWith("_PENDING"),cycleTable:t.type.endsWith("_PENDING")?e.cycleTable:[],events:t.type.endsWith("_PENDING")?e.events:[]})}return e;case"LIST_EVENTS_FOR_ANIMALS_FULFILLED":if(e.selectedItem instanceof Ie.a||e.selectedItem instanceof Se.a){const r=e.selectedItem instanceof Ie.a?"AnmGrp":"TGID";if(p()(t,"meta.".concat(r))===e.selectedItem[r])return Le({},e,{fetchingEvent:!1,cycleTable:[],events:be()([...Object.values(t.payload)]).filter(e=>void 0===e.DtaDelTime).sort((e,t)=>e.EvTime-t.EvTime)})}return e;case"LIST_EVENT_FULFILLED":if(e.selectedItem instanceof me.a||e.selectedItem instanceof Ie.a||e.selectedItem instanceof Se.a){let r=[...e.events],a=!1;if((t.payload.items||[]).forEach(t=>{const n=p()(t,"AnmID");if(n){if((e.selectedItem instanceof me.a?[e.selectedItem.AnmID]:[...e.selectedItem[e.selectedItem instanceof Ie.a?"AnmIDs":"AnmList"],...e.selectedItem.Rmvd]).includes(n)){const e=r.find(e=>Oe()(e.EvID,t.EvID));e&&~r.indexOf(e)&&(a=!0,r.splice(r.indexOf(e),1)),t.DtaDelTime||(a=!0,r.push(Object(he.getClass)(t)))}}}),a)return r=r.sort((e,t)=>e.EvTime-t.EvTime).filter(e=>W()(e.DtaDelTime)),Le({},e,{events:r,cycleTable:e.selectedItem instanceof me.a?Object(De.d)(r).cycleTable:[]})}return e;case"ANIMAL_DOCUMENTS_RESET":case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return Pe;default:return e}},grid:function(e=Ce,t){switch(t.type){case"SET_RESULTS_GRID_DATA_PENDING":return ve({},e,{resultsGridData:[],loadingResultsGrid:!0});case"SET_RESULTS_GRID_DATA_FULFILLED":return ve({},e,{resultsGridData:t.payload,loadingResultsGrid:!1});case"SAVE_CURRENT_PLAN":return ve({},e,{resultsGridData:t.payload});case"CREATE_STANDINGS_GRID_FULFILLED":{let r=new Map(e.standingsMap);return r.set(t.payload.location,t.payload.array),ve({},e,{standingsMap:r})}case"FEEDING_SELECT_CLEAR":return ve({},e,{dispensersSelected:new Map});case"FEEDING_SELECT_STANDING_BY_CHAMBER":{const{location:{IndividualFeeding:r,CID:a},nodes:n,select:i}=t.payload;let c=new Map;if(i){let e=n.map(e=>{const{BID:t,RFID:n}=e,i=r?t:n;return{type:r?x.f.INDIVIDUAL:x.f.GROUP,id:i,locationID:a}});c.set(a,e)}return ve({},e,{dispensersSelected:c})}case"FEEDING_SELECT_STANDING":{let r=new Map(e.dispensersSelected),a=T()(t.payload),n=T()(r.get(a.locationID)||[]),i=f()(n,e=>Oe()(e,a));return i>-1?n.splice(i,1):n.push(a),r=new Map,r.set(a.locationID,n),ve({},e,{dispensersSelected:r})}case"CREATE_FEEDING_GRID_FULFILLED":{let r=new Map(e.feedingMap);return r.set(t.payload.location,t.payload.array),t.payload&&t.payload.array&&r.get(t.payload.location)&&r.get(t.payload.location).length!==t.payload.array.length?ve({},e,{feedingsSelected:[],feedingGrid:t.payload.array,feedingMap:r,loadingFeedingGrid:!1}):ve({},e,{feedingGrid:t.payload.array,feedingMap:r,loadingFeedingGrid:!1})}case"CREATE_FEEDING_GRID_REJECTED":return ve({},e,{feedingGrid:[],loadingFeedingGrid:!1});case"CREATE_FEEDING_GRID_PENDING":return ve({},e,{feedingGrid:[],loadingFeedingGrid:!0});case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return Ce;default:return e}},shadows:function(e=ze,t){switch(t.type){case"SET_SHADOW_LOADING":{let r=Object.assign({},e.loading);const{DevID:a,status:n}=t.payload,i=e=>null===n?delete r[e]:r[e]=!!n;return Array.isArray(a)?a.forEach(e=>{i(e)}):i(a),Ke({},e,{loading:r})}case"CHANGE_SHADOWS_DELTA":{let r=new Map(e.shadows);for(let e of[...t.payload.keys()])if(r.has(e)){let a=T()(Ke({},r.get(e),{},t.payload.get(e)));r.set(e,a)}return Ke({},e,{shadows:r})}case"CHANGE_SHADOWS":return Ke({},e,{shadows:new Map([...e.shadows,...t.payload])});case"CHANGE_SHADOWS_ANIMAL":{let r=new Map([...e.animals,...t.payload]);for(let e of t.payload.keys())r=Object(Je.n)(r,e);return Ke({},e,{animals:r})}case"CHANGE_SHADOWS_ANIMAL_DELTA":{let r=new Map(e.animals);for(let e of[...t.payload.keys()]){if(r.has(e)){let a=t.payload.get(e).map(e=>e.RFID),n=[...r.get(e).filter(e=>!a.includes(e.RFID)),...t.payload.get(e)];r.set(e,n)}r=Object(Je.n)(r,e)}return Ke({},e,{animals:r})}case"REMOVE_RFIDS_FROM_ANIMAL_SHADOW":{let r=new Map(e.animals),a=t.payload;for(let[e,t]of r.entries())r.set(e,T()(t.filter(e=>!a.includes(e.RFID))));return Ke({},e,{animals:r})}case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return ze;default:return e}},events:function(e=Ue,t){switch(t.type){case"CREATE_EVENT":return Ge({},e,{tmpEvents:t.payload.event});case"CREATE_EVENT_PENDING":return Ge({},e,{fetching:!0});case"CREATE_EVENT_REJECTED":return Ge({},e,{error:t.payload.message,fetching:!1});case"CREATE_EVENT_FULFILLED":return Ge({},e,{fetching:!1});case"GET_ALL_EVENTS_FOR_FARM":case"GET_ALL_EVENTS":return Ge({},e,{events:t.payload,eventsFetched:!0,eventsFetching:!1});case"CREATE_AND_UPDATE_GROUP_PENDING":return Ge({},e,{fetching:!0});case"CREATE_AND_UPDATE_GROUP_REJECTED":case"CREATE_AND_UPDATE_GROUP_FULFILLED":return Ge({},e,{fetching:!1});case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return Ue;case"LIST_EVENT_4_ANIMAL_LOADING":{let r=new Map(e.eventsForAnimalsLoading);return r.set(t.payload,!0),Ge({},e,{eventsForAnimalsLoading:r})}case"LIST_EVENT_4_ANIMALS_LOADING":{let r=new Map(e.eventsForAnimalsLoading);for(let e of t.payload)r.set(e,!0);return Ge({},e,{eventsForAnimalsLoading:r})}case"LIST_EVENT_4_ANIMAL_REJECTED":{let r=new Map(e.eventsForAnimalsLoading);return r.set(t.meta.AnmID,!1),Ge({},e,{eventsForAnimalsLoading:r})}case"LIST_EVENT_4_ANIMAL_FULFILLED":{let r=new Map(e.eventsForAnimals);r.set(t.meta.AnmID,t.payload.items);let a=new Map(e.eventsForAnimalsLoading);return a.set(t.meta.AnmID,!1),Ge({},e,{eventsForAnimals:r,eventsForAnimalsLoading:a})}case"LIST_EVENTS_FOR_ANIMALS_REJECTED":{let r=new Map(e.eventsForAnimalsLoading);for(let e of t.meta.AnmIDs)r.set(e,!1);return Ge({},e,{eventsForAnimalsLoading:r})}case"LIST_EVENTS_FOR_ANIMALS_FULFILLED":{let r=new Map(e.eventsForAnimals),a=new Map(e.eventsForAnimalsLoading);for(let e of t.meta.AnmIDs)r.set(e,t.payload[e]),a.set(e,!1);return Ge({},e,{eventsForAnimals:r,eventsForAnimalsLoading:a})}default:return e}},dictionary:function(e=We,t){switch(t.type){case"GET_ALL_DICTIONARIES":let r=t.payload.filter(e=>e.Type===Me.a.forageType&&"Default"!==e.ClientID)[0];r||(r={Type:Me.a.forageType,WData:{pl:[],en:[],ru:[],es:[]}});let a=Ve(r,t.payload.filter(e=>e.Type===Me.a.forageType&&"Default"===e.ClientID)[0]),n=t.payload.filter(e=>e.Type===Me.a.clients&&"Default"!==e.ClientID)[0];n||(n={Type:Me.a.clients,WData:{pl:[],en:[],ru:[],es:[]}});let i=Ve(n,t.payload.filter(e=>e.Type===Me.a.clients&&"Default"===e.ClientID)[0]),c=t.payload.filter(e=>e.Type===Me.a.fallReasons&&"Default"!==e.ClientID)[0];c||(c={Type:Me.a.fallReasons,WData:{pl:[],en:[],ru:[],es:[]}});let s=Ve(c,t.payload.filter(e=>e.Type===Me.a.fallReasons&&"Default"===e.ClientID)[0]),o=t.payload.filter(e=>e.Type===Me.a.noPreganancy&&"Default"!==e.ClientID)[0];o||(o={Type:Me.a.noPreganancy,WData:{pl:[],en:[],ru:[],es:[]}});let l=Ve(o,t.payload.filter(e=>e.Type===Me.a.noPreganancy&&"Default"===e.ClientID)[0]),u=t.payload.filter(e=>e.Type===Me.a.graftingReason&&"Default"!==e.ClientID)[0];u||(u={Type:Me.a.graftingReason,WData:{pl:[],en:[],ru:[],es:[]}});let p=Ve(u,t.payload.filter(e=>e.Type===Me.a.graftingReason&&"Default"===e.ClientID)[0]),d=t.payload.filter(e=>e.Type===Me.a.race&&"Default"!==e.ClientID)[0];d||(d={Type:Me.a.race,WData:{pl:[],en:[],ru:[],es:[]}});let f=Ve(d,t.payload.filter(e=>e.Type===Me.a.race&&"Default"===e.ClientID)[0]),E=t.payload.filter(e=>e.Type===Me.a.feedingCurves&&"Default"!==e.ClientID)[0];E||(E={Type:Me.a.feedingCurves,WData:{pl:[],en:[],ru:[],es:[]}});let y=Ve(E,t.payload.filter(e=>e.Type===Me.a.feedingCurves&&"Default"===e.ClientID)[0]),O=t.payload.filter(e=>e.Type===Me.a.selectionReason&&"Default"!==e.ClientID)[0];O||(O={Type:Me.a.selectionReason,WData:{pl:[],en:[],ru:[],es:[]}});let g=Ve(O,t.payload.filter(e=>e.Type===Me.a.selectionReason&&"Default"===e.ClientID)[0]),_=t.payload.filter(e=>e.Type===Me.a.employees&&"Default"!==e.ClientID)[0];_||(_={Type:Me.a.employees,WData:{pl:[],en:[],ru:[],es:[]}});let T=Ve(_,t.payload.filter(e=>e.Type===Me.a.employees&&"Default"===e.ClientID)[0]),b=t.payload.filter(e=>e.Type===Me.a.suppliers&&"Default"!==e.ClientID)[0];b||(b={Type:Me.a.suppliers,WData:{pl:[],en:[],ru:[],es:[]}});let D=Ve(b,t.payload.filter(e=>e.Type===Me.a.suppliers&&"Default"===e.ClientID)[0]),m=t.payload.filter(e=>e.Type===Me.a.incidentAnimal&&"Default"!==e.ClientID)[0];m||(m={Type:Me.a.incidentAnimal,WData:{pl:[],en:[],ru:[],es:[]}});let I=Ve(m,t.payload.filter(e=>e.Type===Me.a.incidentAnimal&&"Default"===e.ClientID)[0]),h=t.payload.filter(e=>e.Type===Me.a.incidentPlace&&"Default"!==e.ClientID)[0];h||(h={Type:Me.a.incidentPlace,WData:{pl:[],en:[],ru:[],es:[]}});let S=Ve(h,t.payload.filter(e=>e.Type===Me.a.incidentPlace&&"Default"===e.ClientID)[0]),A=t.payload.filter(e=>e.Type===Me.a.weighting&&"Default"!==e.ClientID)[0];A||(A={Type:Me.a.weighting,WData:{pl:[],en:[],ru:[],es:[]}});let L=Ve(A,t.payload.filter(e=>e.Type===Me.a.weighting&&"Default"===e.ClientID)[0]),N=t.payload.filter(e=>e.Type===Me.a.taskCategory&&"Default"!==e.ClientID)[0];N||(N={Type:Me.a.taskCategory,WData:{pl:[],en:[],ru:[],es:[]}});let P=Ve(N,t.payload.filter(e=>e.Type===Me.a.taskCategory&&"Default"===e.ClientID)[0]),R=t.payload.filter(e=>e.Type===Me.a.controlLists&&"Default"===e.ClientID),v=t.payload.filter(e=>e.Type===Me.a.controlLists&&"Default"!==e.ClientID),w=t.payload.filter(e=>e.Type===Me.a.medicine&&"Default"===e.ClientID),C=t.payload.filter(e=>e.Type===Me.a.medicine&&"Default"!==e.ClientID),j=t.payload.filter(e=>e.Type===Me.a.graftingProgram&&"Default"===e.ClientID),G=t.payload.filter(e=>e.Type===Me.a.graftingProgram&&"Default"!==e.ClientID),F=t.payload.filter(e=>e.Type===Me.a.forageIngredient&&"Default"!==e.ClientID);return ke({},e,{selectionReason:g,forageType:a,clients:i,fallReasons:s,medicine:Ye(C,w),noPreganancy:l,graftingReason:p,race:f,feedingCurves:y,employees:T,suppliers:D,incidentAnimal:I,incidentPlace:S,weighting:L,controlLists:Ye(v,R),graftingPrograms:Ye(G,j),forageIngredients:F,taskCategory:P});case"LIST_DICTIONARY_PENDING":return ke({},e,{fetching:!0});case"LIST_DICTIONARY_FULFILLED":case"LIST_DICTIONARY_REJECTED":return ke({},e,{fetching:!1});case"LIST_DEFAULT_DICTIONARY_PENDING":return ke({},e,{fetching:!0});case"LIST_DEFAULT_DICTIONARY_FULFILLED":case"LIST_DEFAULT_DICTIONARY_REJECTED":return ke({},e,{fetching:!1});case"CREATE_DEVICE_PENDING":return ke({},e,{fetching:!0});case"CREATE_DEVICE_REJECTED":case"CREATE_DEVICE_FULFILLED":return ke({},e,{fetching:!1});case"CLEAR_DICTIONARY":case"USER_LOGOUT_FULFILLED":return We;case"UPDATE_DICTIONARY_PENDING":return ke({},e,{fetching:!0});case"UPDATE_DICTIONARY_REJECTED":return ke({},e,{fetching:!1});default:return e}},technologyGroup:function(e=tt,t){switch(t.type){case"CHANGE_CREATE_DAY":case"GET_CREATE_DAY":return $e({},e,{createDay:t.payload});case"UPDATE_TECHNOLOGY_GROUP":{let r=Object.assign([],e.technologyGroups);return r.map(e=>(e.TGID===t.payload.TGID&&Object.keys(t.payload).map(r=>e[r]=t.payload[r]),e)),$e({},e,{technologyGroups:r,time:rt(r)})}case"INSERT_TECHNOLOGY_GROUP":{let r=Object.assign([],e.technologyGroups);return r.push(t.payload),$e({},e,{technologyGroups:r,time:rt(r)})}case"GET_TECHNOLOGY_GROUPS":return $e({},e,{technologyGroups:t.payload,time:rt(t.payload),fetching:!1});case"CLEAR_TECHNOLOGY_GROUPS":return $e({},e,{technologyGroups:[],time:0});case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return tt;default:return e}},mqtt:function(e=lt,t){switch(t.type){case"MQTT_CONNECT_PENDING":return st({},e,{connecting:!0,connected:!1});case"MQTT_CONNECT_FULFILLED":return st({},e,{connecting:!1,connected:!0,reconnecting:!1});case"MQTT_CONNECTION_FAILURE":case"MQTT_CONNECTION_LOST":return st({},e,{connecting:!1,connected:!1});case"USER_LOGOUT_FULFILLED":return lt;case"MQTT_CLEAR_STATUS":case"CHANGE_FARM":return st({},e,{status:new Map});case"MQTT_ON_PING_SEND":{let r=new Map(e.status),a=t.payload;return r.set(a,{send:+new Date}),st({},e,{status:r})}case"MQTT_ON_PING_SUCCESS":{let r=new Map(e.status),a=t.payload.GatewayID,n=p()(r.get(a),"send");return n?r.set(a,{delay:+new Date-n,compilation:t.payload.compilation,version:t.payload.version,GatewayID:a}):r.set(a,{delay:null,compilation:t.payload.compilation,version:t.payload.version,GatewayID:a}),st({},e,{status:r})}case"MQTT_ON_PING_FAILURE":{let r=new Map(e.status),a=t.payload;return r.delete(a),st({},e,{status:r})}case"SUBSCRIBE_MQTT_TOPICS":return st({},e,{subscriptions:t.payload});case"MQTT_KEEPS_RECONNECTING":return st({},e,{connecting:!1,reconnecting:!0});default:return e}},raports:function(e=Yt,t){switch(t.type){case"PREPARE_RAPORT_DATA_HISTORY_BIRTH":return Wt({},e,{Birth:t.payload,fetchBirth:!0});case"PREPARE_RAPORT_DATA_FEED_CONSUMPTION":return Wt({},e,{feedConsumptionDispensers:t.payload[0],feedConsumptionChambers:t.payload[1],fetchFeedConsumption:!0});case"PREPARE_RAPORT_DATA_DISPENSER_USAGE":return Wt({},e,{dispenserUsage:t.payload[0],dispenserChambersUsage:t.payload[1],dispenserSectorsUsage:t.payload[2],dispenserBuildingsUsage:t.payload[3],fetchDispenserUsage:!0});case"PREPARE_RAPORT_DATA_MEDICINE_CONSUMPTION":return Wt({},e,{medicineConsumption:t.payload,fetchMedicineConsumption:!0});case"PREPARE_RAPORT_DATA_FEED_DISPENSER":return console.log("Wesz\u0142o :("),Wt({},e,{feedDispensers:t.payload,fetchFeedDispensers:!0});case"PREPARE_RAPORT_DATA_INSEMINATIONS":return Wt({},e,{inseminations:t.payload,fetchInseminations:!0});case"PREPARE_RAPORT_DATA_HERD_STRUCTURE":return Wt({},e,{herdStructure:t.payload,fetchHerdStructure:!0});case"PREPARE_RAPORT_DATA_SALES":return Wt({},e,{sales:t.payload,fetchSales:!0});case"PREPARE_RAPORT_DATA_TREATMENT":return Wt({},e,{treatment:t.payload,fetchTreatment:!0});case"PREPARE_RAPORT_DATA_SEPARATION":return Wt({},e,{separation:t.payload,fetchSeparation:!0});case"PREPARE_RAPORT_DATA_IDLE_DAYS":return Wt({},e,{idleDays:t.payload,fetchIdleDays:!0});case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return Yt;case"GET_ALL_REPORTS":return Wt({},e,{reports:t.payload});default:return e}},routing:Jt.routerReducer,inactive:function(e=Ot,t){switch(t.type){case"SET_USER_STATE":return function(e){for(var t=1;te.token!==t.paymentMethodToken)});case"BT_CREATE_SUBSCRIPTION_REJECTED":return de({},e,{fetching:!1,error:t.payload,errorCode:Object(ue.a)(t.payload,""),subscription:null});case"BT_UPDATE_SUBSCRIPTION_REJECTED":return de({},e,{fetching:!1,error:t.payload,errorCode:Object(ue.a)(t.payload,"")});case"BT_CREATE_SUBSCRIPTION_FULFILLED":return de({},e,{fetching:!1,fetched:!0,error:!1,subscription:t.payload,hasSubscription:e.hasSubscription+1,subscriptionList:[...e.subscriptionList,{id:t.payload.subscription.id,status:t.payload.subscription.status,planId:t.payload.subscription.planId,price:t.payload.subscription.price.substr(0,t.payload.subscription.price.indexOf(".")).concat(" ").concat(t.payload.subscription.statusHistory[0].currencyIsoCode),firstBillingDate:t.payload.subscription.firstBillingDate,nextBillingDate:t.payload.subscription.nextBillingDate}]});case"BT_UPDATE_SUBSCRIPTION_FULFILLED":return de({},e,{fetching:!1,fetched:!0,error:!1,subscription:t.payload});case"BT_CANCEL_SUBSCRIPTION_REJECTED":return de({},e,{fetching:!1,error:t.payload,subscription:null});case"BT_CANCEL_SUBSCRIPTION_FULFILLED":return de({},e,{fetching:!1,fetched:!0,error:!1,subscription:t.payload,hasSubscription:e.hasSubscription-1,subscriptionList:[...e.subscriptionList].filter(e=>e.id!==t.payload.subscription.id)});case"BT_FIND_CUSTOMER_REJECTED":case"BT_DELETE_CUSTOMER_REJECTED":return de({},e,{fetching:!1,error:t.error,customer:null});case"BT_FIND_CUSTOMER_FULFILLED":if("notFoundError"!==t.payload.name){const r=t.payload.paymentMethods.map(e=>({maskedNumber:e.maskedNumber,cardType:e.cardType,imageUrl:e.imageUrl,expirationDate:e.expirationDate,token:e.token,data:e}));return de({},e,{fetching:!1,fetched:!0,error:!1,customer:t.payload,paymentMethodList:r})}return de({},e,{fetching:!1,fetched:!0,error:t.payload.name,customer:null,paymentMethodList:[]});case"BT_SEARCH_SUBSCRIPTION_FULFILLED":{let r=t.payload.map(e=>{const r=t.meta.farms.find(t=>e.id.slice(0,-20)===t.FarmID);return de({},e,{id:e.id,farmName:r?r.FarmName:e.id,planId:e.planId,price:e.nextBillAmount.substr(0,e.nextBillAmount.indexOf(".")).concat(" ").concat(e.statusHistory[0].currencyIsoCode),firstBillingDate:e.firstBillingDate,nextBillingDate:e.nextBillingDate,status:e.status})});const a=1===r.length?r[0]:e.selectedSubscription;return de({},e,{fetching:!1,fetched:!0,error:!1,hasSubscription:r.length,subscriptionList:r,selectedSubscription:a})}case"BT_CREATE_CUSTOMER_REJECTED":return de({},e,{fetching:!1,error:t.payload,customer:null});case"BT_CREATE_CUSTOMER_FULFILLED":case"BT_DELETE_CUSTOMER_FULFILLED":return de({},e,{fetching:!1,fetched:!0,error:!1,customer:t.payload,subscription:null});case"BT_FINALIZE_PAYMENT_FAILURE":return de({},e,{error:t.payload});case"BT_STORE_DROPIN_INSTANCE":return de({},e,{dropinInstance:t.payload,error:null,dropinLoaded:!0});case"BT_INITIALIZE_DROPIN":return de({},e,{dropinInstance:null,error:null,dropinLoaded:!1});case"BT_SET_PAYMENT_METHOD_REQUESTABLE":return de({},e,{paymentMethodRequestable:t.payload});case"BT_CHANGE_SELECTED_SUBSCRIPTION":return de({},e,{selectedSubscription:t.payload.subscription?t.payload.subscription:null});case"BT_UPDATE_SUBSCRIPTION_PENDING":return de({},e,{fetching:!0,fetched:!1,selectedSubscription:null});case"BT_TRANSACTION_HISTORY_FULFILLED":return de({},e,{fetching:!1,fetched:!0,error:!1,transactions:t.payload||[]});case"BT_TRANSACTION_HISTORY_REJECTED":return de({},e,{fetching:!1,fetched:!0,error:!1,transactions:[]});case"USER_LOGOUT_FULFILLED":return Ee;case"BT_UPDATE_SELECTED_PLANS":{const r=f()(e.selectedPlans,e=>"".concat(e," active")===t.payload);let a=e.selectedPlans.slice(0);r>=0?a.splice(r,1):a.push(t.payload);const n=t.payload.split("-");return a=a.filter(e=>"basic"===n[1]?e!=="".concat(n[0],"-extended"):e!=="".concat(n[0],"-basic")),de({},e,{selectedPlans:a})}case"BT_CLEAR_SELECTED_PLANS":return de({},e,{selectedPlans:[]});default:return e}},sns:function(e=Ft,t){switch(t.type){case"REGISTER_SNS_ENDPOINT_FAILURE":return jt({},e,{fetching:!1,error:t.payload,endpointArn:null});case"REGISTER_SNS_ENDPOINT_FULLFILLED":return jt({},e,{fetching:!1,fetched:!0,endpointArn:t.payload});case"SUBSCRIBE_SNS_TOPIC_PENDING":case"UNSUBSCRIBE_SNS_TOPIC_PENDING":return jt({},e,{fetching:!0,fetched:!1});case"SUBSCRIBE_SNS_TOPIC_REJECTED":case"UNSUBSCRIBE_SNS_TOPIC_REJECTED":return jt({},e,{fetching:!1,error:t.payload});case"SUBSCRIBE_SNS_TOPIC_FULLFILLED":return jt({},e,{fetching:!1,fetched:!0});case"UNSUBSCRIBE_SNS_TOPIC_FULLFILLED":return jt({},e,{fetching:!1,fetched:!0,endpointArn:null});case"USER_LOGOUT_FULFILLED":return Ft;default:return e}},documents:function(e=Nt,t){switch(t.type){case"LIST_DOCUMENTS_FULFILLED":return At({},e,{documents:t.payload});case"LIST_DOCUMENTS_PENDING":return At({},e,{documents:[]});default:return e}},dashboard:function(e=wt,t){switch(t.type){case"SET_EDITING_TILE":{let r=new Map(e.editingTiles);return r.set(t.payload.i,t.payload),Rt({},e,{editingTiles:r})}case"STOP_TILE_EDITING":{let r=new Map(e.editingTiles);return r.delete(t.payload),Rt({},e,{editingTiles:r})}case"ADD_TILE_TO_RESTORE":{let r=new Map(e.tilesToRestore);return r.has(t.payload.i)||r.set(t.payload.i,t.payload),Rt({},e,{tilesToRestore:r})}case"REMOVE_TILE_TO_RESTORE":{let r=new Map(e.tilesToRestore);return r.delete(t.payload),Rt({},e,{tilesToRestore:r})}case"UPDATED_LAYOUT":return Rt({},e,{updatedLayout:t.payload});case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return wt;default:return e}},time:function(e=kt,t){switch(t.type){case"GET_PI_TIME_REQUEST":return Mt({},e,{piRequestSentTime:+new Date});case"GET_PI_TIME_RESPONSE":{let r=+new Date;return Mt({},e,{piDelay:r-+t.payload-(e.piRequestSentTime?r-e.piRequestSentTime:0),piRequestResponseTime:r,piTime:+t.payload})}case"ZERO_PI_TIME":case"USER_LOGOUT_FULFILLED":return kt;default:return e}},notificationCenter:function(e=zt,t){switch(t.type){case"GET_ALL_NOTIFICATIONS":return Kt({},e,{notifications:t.payload.data.slice(0).sort((e,t)=>t.DtaCrtTime-e.DtaCrtTime),readTime:t.payload.notificationReadTime||0});case"LIST_NOTIFICATIONS_PENDING":return Kt({},e,{fetching:!0});case"SET_NOTIFICATIONS_READ_TIME":return Kt({},e,{readTime:t.payload});case"LIST_NOTIFICATIONS_FULFILLED":case"LIST_NOTIFICATIONS_REJECTED":return Kt({},e,{fetched:t.type.endsWith("_FULFILLED")});case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return zt;default:return e}},workers:function(e=er,t){switch(t.type){case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return er;case"ADD_WORKER":{let r=new Map(e.workers),a="".concat(t.meta,"_").concat(Object(Qt.a)());return r.has(a)&&r.get(a).terminate(),r.set(a,t.payload),Zt({},e,{workers:r})}case"REMOVE_WORKER":{let r=new Map(e.workers);return r.delete(t.payload),Zt({},e,{workers:r})}case"TERMINATE_WORKER":{let r=new Map(e.workers);for(let e of r.keys())e.startsWith(t.payload)&&(r.get(e).terminate(),r.delete(e));return Zt({},e,{workers:r})}case"SET_RESULTS_GRID_DATA_FULFILLED":{let t=new Map(e.workers);return t.delete("resultGrid"),Zt({},e,{workers:t})}default:return e}},aggregatedData:function(e=nr,t){if("USER_LOGOUT_FULFILLED"===t.type||"CHANGE_FARM"===t.type)return nr;if("FETCH_AGGREGATED_DATA_PENDING"===t.type){let r=new Map(e.fetchingMap);return r.set(t.meta.DevID,!0),rr({},e,{fetchingMap:r})}if("FETCH_AGGREGATED_DATA_FULFILLED"!==t.type){if("FETCH_AGGREGATED_DATA_REJECTED"===t.type){let r=new Map(e.fetchingMap);return r.set(t.meta.DevID,!1),rr({},e,{fetchingMap:r})}if("AGGREGATED_DATA_MQTT"===t.type){return rr({},e,{data:ir(e,t)})}return e}try{let a=new Map(e.fetchingMap);a.set(t.meta.DevID,!1);try{return rr({},e,{fetchingMap:a,data:ir(e,t)})}catch(r){return console.error(r),rr({},e,{fetchingMap:a})}}catch(r){console.error(r)}},dataLoader:function(e=or,t){switch(t.type){case"DATA_LOADER_STATE":return function(e){for(var t=1;te&&e.TableName&&l()(e.Codes))],e=>e.LogID).sort((e,t)=>t.DtaModTime-e.DtaModTime);return Rr({},e,{logs:a,lastEvaluatedKey:t.payload.LastEvaluatedKey,fetched:!0,fetching:!1})}case"CLEAR_LOGS":return t.payload?Rr({},wr,{logs:e.logs,lastEvaluatedKey:e.lastEvaluatedKey}):wr;case"LOGS_REMOVE_CODE":return Rr({},e,{lastEvaluatedKey:null,fetched:!1,fetching:!0,logs:[],searchCode:e.searchCode.filter(e=>e!==t.payload)});case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return wr;default:return e}},rfid:function(e=dr,t){switch(t.type){case"SCANNED_RFID":return ur({},e,{lastRFIDScanned:t.payload});case"PUSH_RFID_VALUES":{const r=e.rfidScanned.slice(0);return r.unshift(ur({},t.payload,{date:(new Date).getTime()})),ur({},e,{rfidScanned:r})}case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return dr;default:return e}},lastUsed:function(e=Or,t){switch(t.type){case"SET_BOARS":return Er({},e,{boars:gr(e,t,"boars")});case"SET_NO_PREGNANCY_REASON":return Er({},e,{noPregnancyReasons:gr(e,t,"noPregnancyReasons")});case"SET_GRAFTING_REASON":return Er({},e,{graftingReasons:gr(e,t,"graftingReasons")});case"SET_MEDICINE":return Er({},e,{medicines:gr(e,t,"medicines")});case"SET_FALL_REASON":return Er({},e,{fallReasons:gr(e,t,"fallReasons")});case"SET_CLIENT":return Er({},e,{clients:gr(e,t,"clients")});case"SET_SELECTION_REASON":return Er({},e,{selectionReasons:gr(e,t,"selectionReasons")});case"SET_WEIGHTING_REASON":return Er({},e,{weighting:gr(e,t,"weighting")});case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return Or;default:return e}},feeding:function(e=Lr,t){switch(t.type){case"FEEDING_DESTROY":{const r=t.payload.id,a=Object.assign({},e.feeding),n=Object.assign({},e.chamber),i=Object.assign({},e.chamberDeviceDict);return delete i[r],delete n[r],delete a[r],Sr({},e,{feeding:a,chamber:n,chamberDeviceDict:i,selectedChamber:r===e.selectedChamber?null:e.selectedChamber})}case"FEEDING_INITIALIZE":{const{id:r,chamber:a,chamber:{Boxes:n=[],IndividualFeeding:i=!1},options:c}=t.payload,s=c.dispensers?c.dispensers:Y()(br.a.getDevicesInPlcmnt(a,{showDevicesInChildren:i}).filter(e=>[mr.d.DISPENSER,mr.d.DISPENSER_NRF].includes(e.DevType)),e=>e.DevID),o=Object.assign({},e.chamberDeviceDict),l={},u={},d={},f={},E=+new Date,y=Object(Je.c)(a,c),O=Object.assign({},Nr),g={};if(i)n.forEach(e=>{d[e.BID]&&(delete d[e.BID].animal,delete d[e.BID].receiver),d[e.BID]=Sr({},d[e.BID]||[],{id:e.BID,box:e,name:e.BoxesName,animal:y.get(e.BID),modTime:E})}),s.forEach(e=>{let t;e.DevType===mr.d.DISPENSER?p()(e,"PlcmntID",[]).forEach(a=>{t=a.PlcmntID,t&&(l["".concat(e.DevID,"_").concat(a.Adr)]=t,o["".concat(e.DevID,"_").concat(a.Adr)]=r,d[t]&&(d[t].receiver={deviceId:e.DevID,index:a.Adr,gatewayId:e.GatewayID},d[t].device=e))}):(t=p()(e,"PlcmntID[0].PlcmntID"),t&&(l["".concat(e.DevID)]=t,o["".concat(e.DevID)]=r,d[t]&&(d[t].receiver={deviceId:e.DevID,gatewayId:e.GatewayID},d[t].device=e)))});else{for(let e of y.keys()){const t=y.get(e)||Dr.a.getAnimalByRfid(e,p()(Object.values(O.devices),"[0].device.FarmID"));d[e]={id:e,animal:t,feed:{},modTime:E}}s.forEach(e=>{e.DevType===mr.d.DISPENSER_NRF&&(f[e.DevID]={receiver:{deviceId:e.DevID,gatewayId:e.GatewayID},id:e.DevID,connected:!1,name:e.Name,device:e,modTime:E},o[e.DevID]=a.CID)})}return O.data=d,O.devices=f,g[r]={deviceToStanding:l,animalDict:y,individualFeeding:!!a.IndividualFeeding},u[r]=O,Sr({},e,{chamberDeviceDict:o,feeding:u,chamber:g,selectedChamber:r})}case"GET_FEED_STATE_DELTA":case"GET_FEED_STATE":{const r=t.payload,a=t.type.endsWith("_DELTA"),n=+new Date,i=Object.assign({},e.feeding);for(let[t,c]of r.entries()){const r=e.chamberDeviceDict[t],s=!!r&&e.chamber[r];if(s){const e=Object.assign({},i[r]||Nr),{individualFeeding:o,deviceToStanding:l,animalDict:u}=s;if(o){let r=l[t];const i=r&&e.data[r];i&&(i.animal=u.get(r),a?i.feed&&(e.data[r]=Sr({},i,{},c,{connected:!0,modTime:n})):e.data[r]=Sr({},i,{},c,{connected:!0,dateTime:c.oldest,modTime:n}))}else e.devices[t]&&(a?e.devices[t].connected&&(e.devices[t]=Sr({},e.devices[t],{connected:!0},Tr()(c,["RFID"]),{id:t,modTime:n})):e.devices[t]=Sr({},e.devices[t],{connected:!0},Tr()(c,["RFID"]),{id:t,dateTime:c.oldest,modTime:n}));i[r]=e}}return Sr({},e,{feeding:i})}case"GET_FEED_RFID_STATE_DELTA":case"GET_FEED_RFID_STATE":{const r=t.payload,a=+new Date,n=Object.assign({},e.feeding);for(let[t,i]of r.entries()){const r=!!t&&e.chamber[t];if(r){const e=Object.assign({},n[t]||Nr),{individualFeeding:c,animalDict:s}=r;c||(Object.keys(i).forEach(t=>{if(i[t]){const r=s.get(t)||Dr.a.getAnimalByRfid(t,p()(Object.values(e.devices),"[0].device.FarmID"));e.data[t]||(e.data[t]={}),e.data[t]=Sr({},e.data[t],{},i[t],{workType:x.g.RFID,animal:r,id:t,name:t,connected:!0,dateTime:i[t].oldest,modTime:a})}else delete e.data[t]}),n[t]=e)}}return Sr({},e,{feeding:n})}case"FEEDING_SELECT":{const r=Object.assign({},e.feeding),a=Object.assign({},r[t.payload.chamberId]);return a&&(a.data[t.payload.id]&&(a.data[t.payload.id].selected=!a.data[t.payload.id].selected),r[t.payload.chamberId]=Sr({},a)),Sr({},e,{feeding:r})}case"FEEDING_FILTER":{const{chamberId:r,feedingFilter:a}=t.payload,n=Object.assign({},e.feeding);if(r&&n[r]){const e=Object.assign({},n[r]);e.feedingFilter=a||"",n[r]=e}return Sr({},e,{feeding:n})}case"FEEDING_SORT":{const{chamberId:r,feedingSort:a}=t.payload,n=e.feeding;if(r&&n[r]){const e=Object.assign({},n[r]);e.feedingSort=Object.values(Ir.a).includes(a)?a:e.feedingSort,n[r]=e}return Sr({},e,{feeding:n})}case"FEEDING_UPDATE_ANIMALS":{const{chamberId:r,chamber:a,options:n}=t.payload,i=Object.assign({},e.feeding),c=Object.assign({},e.chamber);if(r&&i[r]&&c[r]){const e=+new Date,t=Object(Je.c)(a,n),s=Object.assign({},i[r]),o=Object.assign({},c[r]);o.animalDict=t,Object.values(s.data).forEach(r=>{s.data[r.id]=Sr({},r,{animal:t.get(r.id),modTime:e})}),c[r]=o,i[r]=s}return Sr({},e,{feeding:i,chamber:c})}case"FEEDING_SELECT_ALL":case"FEEDING_SELECT_NONE":{const{chamberId:r}=t.payload,a=Object.assign({},e.feeding);if(r&&a[r]){const e=Object.assign({},a[r]);Object.keys(e.data).forEach(r=>{e.data[r].selected=t.type.endsWith("_ALL")}),a[r]=e}return Sr({},e,{feeding:a})}case"FEEDING_CLEAR":case"USER_LOGOUT":case"CHANGE_FARM":return Lr;default:return e}},commandsHistory:function(e=Fr,t){switch(t.type){case"LIST_COMMANDS_HISTORY_PENDING":return jr({},e,{},Fr,{lastEvaluatedKey:e.lastEvaluatedKey,commandsHistory:e.commandsHistory,fetching:!0});case"LIST_COMMANDS_HISTORY_REJECTED":return jr({},e,{},Fr,{lastEvaluatedKey:e.lastEvaluatedKey,commandsHistory:e.commandsHistory});case"LIST_COMMANDS_HISTORY_FULFILLED":{let r=p()(t.payload.LastEvaluatedKey,"RTime",0),a=p()(e.lastEvaluatedKey,"RTime");const n=r>p()(e.commandsHistory[0],"RTime",0);let i=W()(a)||n||r<=a?t.payload.LastEvaluatedKey:e.lastEvaluatedKey;return jr({},e,{commandsHistory:Y()([...n?[]:e.commandsHistory,...t.payload.items],e=>e.MsgID),lastEvaluatedKey:i,fetched:!0,fetching:!1})}case"CHANGE_FARM":case"CLEAR_COMMANDS_HISTORY":case"USER_LOGOUT_FULFILLED":return Fr;default:return e}},inventory:function(e=kr,t){switch(t.type){case"INVENTORY_INITIALIZE":{const{animals:r=[],groups:a=[],animalTypeMap:n=new Map,technoGroups:i}=t.payload;return Mr({},e,{animals:r,groups:a,loading:!1,animalTypeMap:n,size:r.length,technoGroups:i})}case"INVENTORY_FILTER":{const{inventoryFilter:r=""}=t.payload;return Mr({},e,{inventoryFilter:r.trim()?r.trim().split(" "):null})}case"INVENTORY_SORT":{const{inventorySort:r}=t.payload;return Mr({},e,{inventorySort:r})}case"INVENTORY_LOCATION_FILTER":{const{location:r}=t.payload;return Mr({},e,{locationFilter:r||null})}case"INVENTORY_SHOW_DEAD":{const{showDead:r}=t.payload;return Mr({},e,{showDead:!!r})}case"INVENTORY_SHOW_COLLAPSED":{const{showCollapsed:r}=t.payload;return Mr({},e,{showCollapsed:!!r})}case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return kr;default:return e}},iotAlarms:function(e=ft,t){switch(t.type){case"IOT_ALARMS_SET_FETCHING":{const{gatewayId:r,fetching:a}=t.payload,n=pt({},e.fetching),i=pt({},e.fetched);return n[r]=a,i[r]=!1,pt({},e,{fetching:n,fetched:i})}case"IOT_ALARMS_ADD_ALARMS":{const{gatewayId:r,alarms:a=[]}=t.payload,n=[...e.alarms.filter(e=>e._gw!==r),...a.map(e=>({alarms:e.alarms.sort((e,t)=>t.time-e.time),_gw:r,DevID:e.DevID,Index:e.Index,newest:Xe()(e.alarms,e=>e.time)}))],i=pt({},e.fetching);i[r]=!1;const c=pt({},e.fetched);return c[r]=!0,pt({},e,{alarms:n,fetching:i,fetched:c})}case"IOT_ALARMS_RESET":case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return ft;default:return e}},settlement:function(e=Yr,t){switch(t.type){case"LIST_CHAMBER_SETTLEMENTS_PENDING":return Wr({},e,{fetchingSettlement:!0});case"LIST_CHAMBER_SETTLEMENTS_REJECTED":return Wr({},e,{fetchingSettlement:!1,fetchedSettlement:!1,settlement:[]});case"LIST_CHAMBER_SETTLEMENTS_FULFILLED":return Wr({},e,{fetchingSettlement:!1,fetchedSettlement:!0,settlement:t.payload.slice(0)});case"USER_LOGOUT":case"CHANGE_FARM":return Yr;default:return e}},maintenance:function(e=$r,t){switch(t.type){case"MAINTENANCE_STATUS_PENDING":return Xr({},e);case"MAINTENANCE_STATUS_FULFILLED":return Xr({},e,{inMaintenance:t.payload.serviceInMaintenance,currentMaintenance:t.payload.inMaintenance,futureMaintenance:t.payload.futureMaintenance});case"MAINTENANCE_STATUS_REJECTED":return Xr({},e,{inMaintenance:!1,currentMaintenance:void 0,futureMaintenance:void 0,data:t.payload});case"USER_LOGOUT_FULFILLED":return $r;default:return e}},eventCounter:function(e=zr,t){switch(t.type){case"ADD_ACTIVE_NIPPLES":return e.history.unshift({type:Jr.b.ACTIVE_NIPPLES,data:t.payload}),Kr({},e,{activeNipples:e.activeNipples+t.payload.length});case"ADD_FALL":return e.history.unshift({type:Jr.b.FALL,data:t.payload}),Kr({},e,{fall:e.fall+t.payload.length});case"ADD_FALL_PIGLETS":return e.history.unshift({type:Jr.b.FALL_PIGLETS,data:t.payload}),Kr({},e,{graftingPiglets:e.graftingPiglets+t.payload.length});case"ADD_GRAFTING":return e.history.unshift({type:Jr.b.GRAFTING,data:t.payload}),Kr({},e,{grafting:e.grafting+t.payload.length});case"ADD_GRAFTING_PIGLETS":return e.history.unshift({type:Jr.b.PIGLETS_TREATMENT,data:t.payload}),Kr({},e,{graftingPiglets:e.graftingPiglets+t.payload.length});case"ADD_HEAT":return e.history.unshift({type:Jr.b.HEAT,data:t.payload}),Kr({},e,{heat:e.heat+t.payload.length});case"ADD_INSEMINATION":return e.history.unshift({type:Jr.b.INSEMINATION,data:t.payload}),Kr({},e,{insemination:e.insemination+t.payload.length});case"ADD_MOMMY_ADD":return e.history.unshift({type:Jr.b.MOMMY,data:t.payload}),Kr({},e,{mommyAdd:e.mommyAdd+t.payload.animals.length});case"ADD_MOMMY_GET":return e.history.unshift({type:Jr.b.SEPARATION_TO_MOMMY,data:t.payload}),Kr({},e,{mommyGet:e.mommyGet+t.payload.length});case"ADD_NO_PREGNANCY":return e.history.unshift({type:Jr.b.NO_PREGNANCY,data:t.payload}),Kr({},e,{noPregnancy:e.noPregnancy+t.payload.length});case"ADD_PARTURITION":return e.history.unshift({type:Jr.b.PARTURITION,data:t.payload}),Kr({},e,{parturition:e.parturition+t.payload.length});case"ADD_SELECTION":return e.history.unshift({type:Jr.b.SELECTION,data:t.payload}),Kr({},e,{selection:e.selection+t.payload.length});case"ADD_SELL":return e.history.unshift({type:Jr.b.SELL,data:t.payload}),Kr({},e,{sell:e.sell+t.payload.length});case"ADD_SEPARATION_TO_PIGLETHOUSE":return e.history.unshift({type:Jr.b.SEPARATION,data:t.payload}),Kr({},e,{separationToPiglethouse:e.separationToPiglethouse+(t.payload.animals?t.payload.animals.length:t.payload.length)});case"ADD_TRANSFER":return e.history.unshift({type:Jr.b.TRANSFER,data:t.payload}),Kr({},e,{transfer:e.transfer+t.payload.length});case"ADD_USG":return e.history.unshift({type:Jr.b.USG,data:t.payload}),Kr({},e,{usg:e.usg+t.payload.length});case"ADD_WEIGHTING":return e.history.unshift({type:Jr.b.WEIGHTING,data:t.payload}),Kr({},e,{weighting:e.weighting+t.payload.length});case"ADD_CASTRATION":return e.history.unshift({type:Jr.b.CASTRATION,data:t.payload}),Kr({},e,{castration:e.castration+t.payload.length});case"ADD_TO_INSEMINATION":return e.history.unshift({type:Jr.b.TO_INSEMINATION,data:t.payload}),Kr({},e,{toInsemination:e.toInsemination+t.payload.length});case"ADD_TO_REPEAT_INSEMINATION":return e.history.unshift({type:Jr.b.TO_REPEAT,data:t.payload}),Kr({},e,{toRepeat:e.toRepeat+t.payload.length});case"ADD_RECLASSIFY":return e.history.unshift({type:Jr.b.RECLASSIFY,data:t.payload}),Kr({},e,{reclassify:e.reclassify+t.payload.length});case"ADD_INSERTION":return e.history.unshift({type:"INSERTION",data:t.payload}),Kr({},e,{insertion:e.insertion+t.payload.length});case"ADD_TREATMENT":return e.history.unshift({type:Jr.b.TREATMENT,data:t.payload}),Kr({},e,{treatment:e.treatment+t.payload[0].animals.length});case"USER_LOGOUT":case"CHANGE_FARM":return zr;default:return e}},mainTab:function(e=aa,t){switch(t.type){case"MAIN_TAB_TOGGLE":{const{key:r,id:a,type:n}=t.payload,i=ta({},e[n]||{});return i[r]||(i[r]={}),i[r]=ta({},i[r]),i[r].hasOwnProperty(a)?delete i[r][a]:i[r][a]=!0,ta({},e,{[n]:i})}case"MAIN_TAB_SET_IDS":{const{key:r,ids:a,select:n,type:i}=t.payload,c=ta({},e[i]||{});return c[r]||(c[r]={}),c[r]=ta({},c[r]),a.forEach(e=>{n?c[r][e]=!0:delete c[r][e]}),ta({},e,{[i]:c})}case"MAIN_TAB_CLEAR":{if(!t.payload)return aa;const{key:r}=t.payload,a=ta({},e);return Object.keys(a).forEach(t=>{const n=ta({},e[t]||{});delete n[r],a[t]=n}),ta({},a)}case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return aa;default:return e}},task:function(e=ua,t){switch(t.type){case"SET_FILTERS":return oa({},e,{filters:t.payload});case"GET_TASKS_PENDING":return oa({},e,{loading:!0});case"GET_TASKS_FULFILLED":let r=null;return e.selectedTask&&(r=t.payload.find(t=>t.IssueID===e.selectedTask.IssueID),r||(r=e.selectedTask)),oa({},e,{tasks:t.payload,loading:!1,selectedTask:r});case"GET_TASKS_REJECTED":return oa({},e,{tasks:[],loading:!1});case"CHANGE_DATE":return oa({},e,{date:t.payload});case"SET_SELECTED_TASK":return oa({},e,{selectedTask:t.payload});case"CHANGE_FARM":default:return e}},groups:function(e=fa,t){switch(t.type){case"GET_ALL_GROUPS":const r=t.payload.slice(0);return function(e){for(var t=1;te.DtaModTime),"DtaModTime",e.groupTime+1),groups:r});case"CHANGE_FARM":case"USER_LOGOUT_FULFILLED":return fa;default:return e}}})},cufz:function(e,t,r){"use strict";t.a=r.p+"static/media/sell.cea871b8.svg"},dBT4:function(e,t,r){"use strict";t.a=r.p+"static/media/previous_weight.5bffa65f.svg"},"e/p3":function(e,t,r){"use strict";r.r(t),t.default=r.p+"static/media/placeholder.44c12939.svg"},eKAg:function(e,t,r){"use strict";t.a=r.p+"static/media/h2s_symbol_icon.a31678c3.svg"},feJH:function(e,t,r){"use strict";t.a=r.p+"static/media/5.0b853fc9.svg"},fz41:function(e,t,r){"use strict";r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return f})),r.d(t,"e",(function(){return E})),r.d(t,"c",(function(){return y})),r.d(t,"d",(function(){return O}));var a=r("ST2B"),n=r("B6RA"),i=r("j1RV"),c=(r("OwcS"),r("AO/9")),s=(r("Bffz"),r("0b+E")),o=r("s4NR"),l=r.n(o),u=r("tK99"),p=r("XzT5");async function d(){try{c.a.currentSession().then(e=>console.log("authUser data",e)).catch(e=>console.log(e));let e=await c.a.currentAuthenticatedUser();if(c.a.currentUserCredentials().then(async e=>{console.log("credentials",e),e.expired&&await O()}).catch(e=>{console.error("currentUserCredentialsError",e)}),e)return!0;Promise.reject(!1)}catch(e){return Promise.reject(e)}}async function f(){try{return await c.a.currentAuthenticatedUser()}catch(e){return console.error(e),null}}async function E(){try{await c.a.signOut()}catch(e){console.error(e)}n.default.dispatch(Object(i.removeNotifications)())}async function y({path:e,method:t="GET",headers:r={},queryParams:o={},body:d,noAuthorization:f,signal:E}){let y;f||(y=await async function(){return await c.a.currentSession().then(e=>e.idToken.jwtToken).catch(e=>console.log(e))}()),d=d?JSON.stringify(d):d,r.authorization=f?"":y;let O=l.a.stringify(o);try{let c=new Date;const o=await fetch(a.a.apiGateway.URL+e+"?"+O,{method:t,headers:r,body:d,signal:E});let l=new Date;if(s.a.timing({category:"API calls",variable:o.url.split("?")[0],value:l-c}),200!==o.status){const e=await o.json();console.log(e);const t=e&&e.statusText?e.statusText:e.message?e.message:"Nie rozpoznano";if(422!==o.status&&404!==o.status){let e={title:p.a.t("error"),message:p.a.t("awsLib.errorNo",{status:o.status,message:p.a.t("awsLib.message"),backendMsg:t}),status:"error",dismissible:!0,dismissAfter:0};n.default.dispatch(Object(i.addNotification)(e))}return Promise.reject(e)}return o.json()}catch(g){if(console.error(g),console.error(g.name),"AbortError"!==g.name){let a={title:p.a.t("error"),message:p.a.t("awsLib.sync")+" [".concat(e," (").concat(t,")]"),status:"info",dismissible:!0,dismissAfter:0};n.default.dispatch(Object(i.addNotification)(a)),"GET"===t||e.includes("iot")||location.href.includes("eventChooser")||u.a.insert(e,t,r,O,d)}return Promise.reject("Failed to fetch")}}function O(){return new Promise(async(e,t)=>{try{let r=(await c.a.currentSession()).getRefreshToken(),a=await f();console.log(a,r),a.refreshSession(r,(r,a)=>{r?t(r):e(a)})}catch(r){t(r)}})}c.a.configure({identityPoolId:a.a.cognito.IDENTITY_POOL_ID,region:a.a.cognito.REGION,userPoolId:a.a.cognito.USER_POOL_ID,userPoolWebClientId:a.a.cognito.APP_CLIENT_ID})},gt5e:function(e,t,r){"use strict";t.a=r.p+"static/media/logo.09c524e1.svg"},gxzs:function(e,t,r){"use strict";t.a=r.p+"static/media/no-pregnancy.27d69475.svg"},"hN/4":function(e,t,r){"use strict";r.r(t),t.default=r.p+"static/media/parturition.21be12fd.svg"},"i0N+":function(e,t,r){"use strict";t.a=r.p+"static/media/weighting.0d1f3272.svg"},iINr:function(e,t,r){"use strict";t.a=r.p+"static/media/silo.156b0e1e.svg"},iaPM:function(e,t,r){"use strict";t.a=r.p+"static/media/porker.c8a12fd0.svg"},j2z9:function(e,t,r){"use strict";t.a=r.p+"static/media/calibration_start.f929e806.svg"},jP9d:function(e,t,r){"use strict";t.a=r.p+"static/media/comments.a97c2fca.svg"},jekD:function(e,t,r){"use strict";t.a=r.p+"static/media/safari-mob-2.c4f443b3.png"},k3WJ:function(e,t,r){"use strict";var a=r("IBmF");function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function i(e){for(var t=1;t{let n=[];for(let c of e){let e={DevID:t,key:"Settings.Configuration.".concat(a.f.SET_PARAM_OUTS,"[").concat(c.number-1,"]"),value:i({isSet:r,SetTime:(new Date).getTime()},c)};n.push(e)}return n}},[a.g.SET_FEED_EFC_TIME]:{keys:["feedOverTime","id","nr"]},[a.g.SET_SWITCH_MOTOR_ON_INFO]:{keys:["state"]},[a.i.SET_SCHEDULE_OUTPUT]:{keys:["nr","intervals"]},[a.g.SET_MINUS_CONFIG]:{parser:(e,t,r)=>{let n=[];return e.forEach((e,c)=>{let s="Settings.Configuration.".concat(a.g.SET_MINUS_CONFIG,"[").concat(c,"]"),o={DevID:t,key:s,value:i({isSet:r,SetTime:(new Date).getTime()},e)};n.push(o)}),n}}};t.a=class{constructor(e){this._msg=void 0,this._msg=e}parseCommand(e,t){let r=Array.isArray(this._msg.Command)?this._msg.Command:[this._msg.Command],a=[];for(let n of r){let r=s[n];if(r)if(r.parser){let n=r.parser(this._msg.CData,e,t);Array.isArray(n)?a=[...a,...n]:a.push(n)}else{let i={},c="Settings.Configuration.".concat(n);(this._msg.CData.number||this._msg.CData.nr)&&(c+="[".concat((this._msg.CData.number||this._msg.CData.nr)-1,"]"));let s={DevID:e,key:c,value:i};for(let e of r.keys){let t=this._msg.CData[e];void 0!==t&&(i[e]=t)}Object.keys(i).length>0&&(i.isSet=t,i.SetTime=(new Date).getTime(),a.push(s))}}return a.length>0?a:null}}},lHhd:function(e,t,r){"use strict";t.a=r.p+"static/media/active_nipples.a59cab65.svg"},lXf0:function(e,t,r){"use strict";r.r(t),t.default=r.p+"static/media/separation-porkhouse.3c088bde.svg"},"m6+T":function(e,t,r){"use strict";t.a=r.p+"static/media/wheat.98ac4b90.svg"},mXvJ:function(e,t,r){"use strict";t.a=r.p+"static/media/cooling_icon.da452c16.svg"},nGfT:function(e,t,r){"use strict";t.a=r.p+"static/media/curve_before.a3b292d9.svg"},nNb6:function(e,t,r){"use strict";t.a=r.p+"static/media/hm.fde62a90.svg"},nPqS:function(e,t,r){"use strict";t.a=r.p+"static/media/2.4641da5a.svg"},"o/vN":function(e,t,r){"use strict";t.a=r.p+"static/media/heating_icon.1768031a.svg"},o7nW:function(e,t,r){"use strict";t.a=r.p+"static/media/transfer.d944d6b4.svg"},oF2R:function(e,t,r){"use strict";t.a=r.p+"static/media/average_forage_consumption.d9a785a9.svg"},obOH:function(e,t,r){"use strict";t.a=r.p+"static/media/expecting-birth.2ec732b3.svg"},objY:function(e,t,r){"use strict";t.a=r.p+"static/media/pressure_symbol_icon.8f43a184.svg"},pEX4:function(e,t,r){"use strict";t.a=r.p+"static/media/7.6a98febb.svg"},pMvP:function(e,t,r){"use strict";t.a=r.p+"static/media/alarm_max_icon.8bfd9946.svg"},qXLe:function(e,t,r){"use strict";t.a=r.p+"static/media/safari-mob-1.64f54baa.png"},rOzv:function(e,t,r){"use strict";t.a=r.p+"static/media/current_flow.e9cff9d7.svg"},"s/FU":function(e,t,r){"use strict";t.a=r.p+"static/media/nh3_symbol_icon.843202c3.svg"},"t6+f":function(e,t,r){"use strict";t.a=r.p+"static/media/alarm_min_icon.cbf42c7b.svg"},unVT:function(e,t,r){"use strict";t.a=r.p+"static/media/3.169b8e4c.svg"},"uqr+":function(e,t,r){(function(t){e.exports={entry:"./ApiLanguage.js",output:{path:t,filename:"./test.json"},module:{loaders:[{test:/\.json$/,loader:"json"}]}};let a=r("SSS2"),n={getLanguage:()=>a};e.exports=n}).call(this,"/")},v8cL:function(e,t,r){"use strict";t.a=r.p+"static/media/boar.4e122993.svg"},voqg:function(e,t,r){"use strict";t.a=r.p+"static/media/l3.8848179d.svg"},w2eH:function(e,t,r){"use strict";t.a=r.p+"static/media/herd-structure.ab30acbf.svg"},wNKL:function(e,t,r){"use strict";t.a=r.p+"static/media/animal_number.4531d541.svg"},ydgf:function(e,t,r){"use strict";t.a=r.p+"static/media/reclassify.ed29ce7b.svg"},yf5f:function(e,t,r){"use strict";t.a=r.p+"static/media/l1.24b4e052.svg"},yv15:function(e,t,r){"use strict";t.a=r.p+"static/media/fattening_day.1b96faec.svg"},zWLE:function(e,t,r){"use strict";t.a=r.p+"static/media/firefox-2.a9beab38.png"},zv3H:function(e,t,r){"use strict";t.a=r.p+"static/media/co2_symbol_icon.95778b5b.svg"}}]); //# sourceMappingURL=main~e2550e02.e9937d0a.chunk.js.map