/* COPYRIGHT by SARTORIUS (Sartorius Lab Instruments GmbH & Co. KG) */
!function(e){var t={};function s(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,s),i.l=!0,i.exports}s.m=e,s.c=t,s.d=function(e,t,a){s.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:a})},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=107)}([function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.PARAM_GROUP="GROUP",e.PARAM_DATE_TIME="DATE_TIME",e.PARAM_MULTIPLE_SELECTION="MULTIPLE_SELECTION",e.PARAM_SELECTION="SELECTION",e.PARAM_QUANTITY="QUANTITY",e.PARAM_MEASURE="MEASURE",e.PARAM_STRING="STRING",e.ALIBI_IDENTIFIER="ALIBI_IDENTIFIER",e.PARAM_TEXT="TEXT",e.PARAM_FORMULA="FORMULA",e.PARAM_PASSWORD="PASSWORD",e.PARAM_BARCODE="BARCODE"}(t.EnumParameterTypes||(t.EnumParameterTypes={})),function(e){e.HIDDEN="HIDDEN",
e.DISABLED="DISABLED",e.ENABLED_PRIMARY="ENABLED_PRIMARY",e.ENABLED_SECONDARY="ENABLED_SECONDARY",e.ENABLED="ENABLED",e.ENABLED_EDITABLE="ENABLED_EDITABLE",e.ENABLED_INVALID="ENABLED_INVALID",e.ENABLED_INVALID_CFG="ENABLED_INVALID_CFG"}(t.EnumAppearance||(t.EnumAppearance={})),function(e){e.CODE128="CODE128",e.QR="QR",e.EAN13="EAN13",e.EAN8="EAN8",e.UPC="UPC",e.CODE39="CODE39",e.ITF14="ITF14",e.ITF="ITF",e.MSI="MSI",e.MSI10="MSI10",e.MSI11="MSI11",e.MSI1010="MSI1010",e.MSI1110="MSI1110",e.Pharmacode="Pharmacode"}(t.EnumBarcodeFormats||(t.EnumBarcodeFormats={})),t.EnumButtonType||(t.EnumButtonType={}),function(e){e.OPEN="OPEN",e.CLOSED="CLOSED",e.MOVE="MOVE"}(t.EnumDraftShieldPosition||(t.EnumDraftShieldPosition={})),function(e){e.NONE="NONE",e.UNLICENSED="UNLICENSED",e.ROWI="ROWI",e.LIWI="LIWI",e.LIRO="LIRO"}(t.EnumDraftShieldType||(t.EnumDraftShieldType={})),function(e){e.TOUCH="TOUCH"}(t.EnumUserEvent||(t.EnumUserEvent={})),function(e){e[e.OPEN=1]="OPEN",e[e.RUNNING=2]="RUNNING",
e[e.CLOSED_SUCCESS=3]="CLOSED_SUCCESS",e[e.CLOSED_FAILED=4]="CLOSED_FAILED"}(t.EnumJobStatus||(t.EnumJobStatus={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cloneJSON=function(e){return JSON.parse(JSON.stringify(e))}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MQTT_TOPIC_WILDCARD_UNIQUE_ID="_replaceWithUniqueID_",t.MQTT_TOPIC_WILDCARD_GENERATED_TOKEN="_generatedToken_",t.MQTT_TOPIC_WILDCARD_SCREEN_ID="_replaceWithScreenID_",t.MQTT_TOPIC_WILDCARD_BUTTON_ID="_replaceWithButtonID_",t.MQTT_TOPIC_WILDCARD_TAB_ID="_replaceWithTabID_",function(e){e.DEVELOPER_MODE="/DEVELOPER_MODE",e.QAPP_CLEANUP="/QAPP/CLEANUP",e.QAPP_NAMESPACE="/QAPP",e.QAPP_DEBUG_TOPIC_PREAMBLE="/QAPP/DEBUG",e.QAPP_DEBUG_STOP_HEARTBEAT="/QAPP/DEBUG/stopHeartbeat",e.QAPP_LOGOUT_REQUEST="/QAPP/LOGOUT_REQUEST",e.QAPP_STARTED="/QAPP/STATE/STARTED",e.QAPP_STOPPED="/QAPP/STATE/STOPPED",e.QAPP_ERROR="/QAPP/STATE/ERROR",e.QAPP_HEARTBEAT="/QAPP/HEARTBEAT",
e.QAPP_DATABASE_ACTION_DONE="/QAPP/DATABASE_ACTION_DONE",e.DEVICE_MODEL_NAME="/DEVICEINFORMATION/IDENTIFICATION/MODEL_NAME",e.DEVICE_IS_FUSION="/FIRMWARELOADER/VERSION/IS_FUSION",e.NETWORK_MAC_ADDRESS="/DEVICEINFORMATION/NETWORK/MACADDRESS",e.NETWORK_HOSTNAME="/DEVICEINFORMATION/NETWORK/HOSTNAME",e.SENSOR_ACTOR_INFO="SENSOR_ACTOR/BALANCE/BALANCE_INFO",e.SENSOR_ACTOR_WEIGHT="SENSOR_ACTOR/BALANCE/WEIGHT",e.LEVELING_STATUS="/LEVELING/STATUS",e.LEVELING_CLOSE="/HMI_LEVELING/CLOSE",e.CALADJ_ISOCAL_STATUS="/CALIBRATION_ADJUSTMENT/ISOCAL",e.CALADJ_INTERNAL_RESULT="/CALIBRATION_ADJUSTMENT/RESULT",e.CLIMATE_INT_VALUE="/CLIMA_CONTROL/INT/VALUE",e.CLIMATE_EXT_VALUE="/CLIMA_CONTROL/EXT/VALUE",e.CLIMATE_INT_ID_SERIAL="CLIMA_CONTROL_INT_ID_SERIAL",e.CLIMATE_EXT_ID_SERIAL="CLIMA_CONTROL_EXT_ID_SERIAL",e.CLIMATE_STATUS="/CLIMA_CONTROL/STATUS",e.DRAFTSHIELD_TYPE="/DRAFTSHIELD/TYPE",e.DRAFTSHIELD_POSITION="/DRAFTSHIELD/IONIZER_INFO",e.QAPP_PARAMETERS_TOPIC_PREAMBLE="/QAPP/PARAMS",
e.USERMANAGEMENT_AUTO_LOGOUT_EVENT="/USERMANAGEMENT/AUTO_LOG_OFF",e.USERMANAGEMENT_AUTO_LOGOUT_PREWARNING_EVENT="/USERMANAGEMENT/AUTO_LOG_OFF_PREWARNING",e.REPORTING_SICS_PROTOCOL_HELPER="/SICS/ADD_TO_PROTOCOL",e.REPORTING_SBI_PROTOCOL_HELPER="/REPORTING/SBI/SINGLE_PRINT",e.COMM_SBI_PRINT_AT_STABILITY="SBI_PROTOCOL/STABILITY",e.JOBMGMT_TASK_WORKFLOWDATA="/TASK/WORKFLOWDATA",e.HMI_QAPP_WIZARD_SCREEN_TITLE="/QAPP/SCREENS/WIZARDSCREEN/HEADING_TITLE",e.HMI_VISUAL_SCREEN="/VISUAL_SCREEN",e.HMI_VISUAL_SCREEN_CLOSED="/HMI/VISUAL_SCREEN/CLOSED",e.HMI_OVERLAY_TOP="/HMI/OVERLAY_TOP",e.HMI_EVENT="/HMI/USER/EVENT",e.HMI_LOCK_SCREEN_STATE="HMI/LOCKSCREEN/STATE",e.HMI_ACTIVE_QAPP_SCREEN="/QAPP/SCREEN",e.HMI_ABSTRACT_SCREEN_BARBUTTONS="/QAPP/SCREENS/_replaceWithScreenID_/BARBUTTONS",e.HMI_ABSTRACT_SCREEN_BUTTONS="/QAPP/SCREENS/_replaceWithScreenID_/_replaceWithButtonID_",e.HMI_ABSTRACT_SCREEN_TAB_SINGLE="/QAPP/SCREENS/_replaceWithScreenID_/TAB",
e.HMI_ABSTRACT_SCREEN_TABS="/QAPP/SCREENS/_replaceWithScreenID_/TABS/_replaceWithTabID_",e.HMI_TABBED_SCREEN="/QAPP/SCREENS/TABBEDSCREEN",e.HMI_WEIGHING_SCREEN_BARBUTTONS="/QAPP/SCREENS/WEIGHING/BARBUTTONS",e.HMI_WEIGHING_SCREEN_INSTRUCTION1="/QAPP/SCREENS/WEIGHING/TEXT1",e.HMI_WEIGHING_SCREEN_INSTRUCTION2="/QAPP/SCREENS/WEIGHING/TEXT2",e.HMI_WEIGHING_SCREEN_TITLE="/QAPP/SCREENS/WEIGHING/NAVIGATION/TEXT",e.HMI_WEIGHING_SCREEN_PARAM1_TOPIC="/QAPP/SCREENS/WEIGHING/PARAM1",e.HMI_WEIGHING_SCREEN_PARAM2_TOPIC="/QAPP/SCREENS/WEIGHING/PARAM2",e.HMI_WEIGHINGSPLIT_SCREEN_BARBUTTONS="/QAPP/SCREENS/WEIGHINGSPLIT/BARBUTTONS",e.HMI_WEIGHINGSPLIT_SCREEN_INSTRUCTION1="/QAPP/SCREENS/WEIGHINGSPLIT/TEXT1",e.HMI_WEIGHINGSPLIT_SCREEN_INSTRUCTION2="/QAPP/SCREENS/WEIGHINGSPLIT/TEXT2",e.HMI_WEIGHINGSPLIT_SCREEN_TITLE="/QAPP/SCREENS/WEIGHINGSPLIT/NAVIGATION/TEXT",e.HMI_WEIGHINGSPLIT_SCREEN_PARAM1_TOPIC="/QAPP/SCREENS/WEIGHINGSPLIT/PARAM1",
e.HMI_WEIGHINGSPLIT_SCREEN_PARAM2_TOPIC="/QAPP/SCREENS/WEIGHINGSPLIT/PARAM2",e.HMI_CHECKBARGRAPH_STATUS="/QAPP/CHECKBARGRAPH/STATUS",e.HMI_CHECKBARGRAPH_VALUE="/QAPP/CHECKBARGRAPH/VALUE",e.HMI_QAPP_PARAMETER_INPUT="/QAPP/PARAMETER_INPUT",e.HMI_LOCK_SCREEN="/QAPP/SCREENS/LOCK",e.HMI_LOCK_LOADING_MODAL="/QAPP/SCREENS/LOCK/LOADING_MODAL",e.HMI_SINGLETABBUTTONBAR_SCREEN="/QAPP/SCREENS/SINGLETABBUTTONBARSCREEN",e.HMI_SINGLETABBUTTONBAR_SCREEN_BARBUTTONS="/QAPP/SCREENS/SINGLETABBUTTONBARSCREEN/BARBUTTONS",e.HMI_SINGLETABBUTTONBAR_SCREEN_TOPLEFTBUTTON="/QAPP/SCREENS/SINGLETABBUTTONBARSCREEN/TOPLEFTBUTTON",e.HMI_LOCK_LOADING_MODAL_TEXT="/QAPP/SCREENS/LOCK/LOADING_MODAL/TEXT",e.HMI_LOCK_LOADING_MODAL_APPEARANCE="/QAPP/SCREENS/LOCK/LOADING_MODAL/APPEARANCE",e.HMI_LOCK_MESSAGEBOX="/QAPP/SCREENS/LOCK/MESSAGEBOX",e.HMI_LOCK_RESET="/QAPP/SCREENS/LOCK/RESET",e.HMI_LOCK_UNLOCK="/QAPP/SCREENS/LOCK/UNLOCK",e.HMI_LOADING_MODAL="HMI/LOADING_MODAL",e.HMI_LOADING_MODAL_TEXT="HMI/LOADING_MODAL/TEXT",
e.HMI_LOADING_MODAL_APPEARANCE="HMI/LOADING_MODAL/APPEARANCE",e.HMI_MESSAGEBOX="/QAPP/MESSAGEBOX",e.HMI_PARAMDETAILSOVERLAY="/QAPP/PARAMDETAILSOVERLAY",e.HMI_PRINT_HEADER="/HMI/PRINT_HEADER",e.MESSAGE_HANDLER_MESSAGE="/MESSAGE_HANDLER/MESSAGE",e.WEIGHING_VALUE_NET="WEIGHING/WEIGHT/NET",e.WEIGHING_VALUE_NET_HIGH_RES="WEIGHING/WEIGHT/NET_HIGH_RES",e.WEIGHING_VALUE_TARE="WEIGHING/WEIGHT/TARE",e.WEIGHING_VALUE_TARE1="WEIGHING/WEIGHT/TARE1",e.WEIGHING_VALUE_TARE2="WEIGHING/WEIGHT/TARE2",e.WEIGHING_VALUE_GROSS="WEIGHING/WEIGHT/GROSS_CALC",e.WEIGHING_VALUE_DISPLAY="WEIGHING/WEIGHT/DISPLAY",e.WEIGHING_SELECTED_DISPLAY_VALUE="WEIGHING/WEIGHT/DISPLAY/SELECTED",e.WEIGHING_WEIGHT_BLOCK="WEIGHING/WEIGHT/BLOCK",e.WEIGHING_WAITING_FOR_STABILITY="WEIGHING/WAITING_FOR_STABILITY",e.WEIGHING_STATUS_ERROR="WEIGHING/STATUS/ERROR ",e.WEIGHING_TARE_BLOCK="WEIGHING/DOING_ZERO_TARE",e.WEIGHING_STATE="WEIGHING/STATE",e.SURE_ACTIVE="/WEIGHING/SURE/ACTIVE",e.SURE_RANGE_1_A="/WEIGHING/SURE/PARAM_SURE_RANGE_1_A",
e.SURE_RANGE_1_B="/WEIGHING/SURE/PARAM_SURE_RANGE_1_B",e.SURE_RANGE_1_B_EXP="/WEIGHING/SURE/PARAM_SURE_RANGE_1_B_EXP",e.SURE_RANGE_2_A="/WEIGHING/SURE/PARAM_SURE_RANGE_2_A",e.SURE_RANGE_2_B="/WEIGHING/SURE/PARAM_SURE_RANGE_2_B",e.SURE_RANGE_2_B_EXP="/WEIGHING/SURE/PARAM_SURE_RANGE_2_B_EXP",e.SURE_RANGE_3_A="/WEIGHING/SURE/PARAM_SURE_RANGE_3_A",e.SURE_RANGE_3_B="/WEIGHING/SURE/PARAM_SURE_RANGE_3_B",e.SURE_RANGE_3_B_EXP="/WEIGHING/SURE/PARAM_SURE_RANGE_3_B_EXP",e.METROLOGY_MAX_DIGITS="WEIGHING/METROLOGY/MAXIMUM_DIGITS",e.METROLOGY_MAX_DIGITS_DEBUG="/QAPP/DEBUG/WEIGHING/METROLOGY/MAXIMUM_DIGITS",e.METROLOGY_RANGES="WEIGHING/METROLOGY/RANGES",e.METROLOGY_APPROVED_FOR_VERIFICATION="WEIGHING/METROLOGY/APPROVED_FOR_VERIFICATION",e.ESIGNATURE_PERFORM="/HMI/PERFORM_SIGNATURE",e.ESIGNATURE_RESULT="/HMI/ELECTRONIC_SIGNATURE_RESULT",e.REPORTING_PRINTABLE_VALUE="/REPORTING/PRINTABLE_VALUE",e.REPORTING_PRINTQUEUE_DISPLAYED="/HMI/PRINT_QUEUE",
e.REPORTING_PRINT_PROCESS_RESULT="/REPORTING/PRINT_PROCESS",e.CUSTOMIZED_WEIGHT_DISPLAY_VALUE="/QAPP/WEIGHING/WEIGHT/APPLICATION/_replaceWithUniqueID_/VALUE",e.CUSTOMIZED_REST_HANDLER_CONFIGURATION="/QAPP/REST/CFG",e.COMM_QAPP_DIRECT_INTERFACE="/QAPP/QAPP_DIRECT_INTERFACE",e.COMM_FILE_OPERATIONS_ASYNC_TOKEN="/CONNECTORMANAGEMENT/PROGRESS/_generatedToken_"}(t.MqttTopics||(t.MqttTopics={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(1),i=s(5),n=s(0);t.isTypeOfIDateTimeParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_DATE_TIME},t.isTypeOfIMultipleSelectionParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_MULTIPLE_SELECTION},t.isTypeOfISelectionParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_SELECTION},t.isTypeOfIQuantityParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_QUANTITY},t.isTypeOfIMeasureParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_MEASURE},
t.isTypeOfIStringParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_STRING},t.isTypeOfIAlibiIdentifierParameter=function(e){return e.type===n.EnumParameterTypes.ALIBI_IDENTIFIER},t.isTypeOfITextParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_TEXT},t.isTypeOfIFormulaParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_FORMULA},t.isTypeOfIPasswordParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_PASSWORD},t.isITextStructure=function(e){return"string"==typeof e.id&&"object"==typeof e.args&&e.args instanceof Array};const r={id:"",args:[]};function o(e){const t=a.cloneJSON(r);return i.isString(e)&&(t.id=e),t}t.createEmptyTextStructure=o;const E={id:"",type:n.EnumParameterTypes.PARAM_GROUP,title:o(),appearance:n.EnumAppearance.HIDDEN,parameters:[]};function _(e){const t=a.cloneJSON(E);return i.isString(e)&&(t.id=e),t}t.createEmptyParameterGroup=_;const l={id:"",type:n.EnumParameterTypes.PARAM_GROUP,title:o(),
appearance:n.EnumAppearance.HIDDEN,parameters:[_()]};t.createEmptyParameterGroupOfGroups=function(){return a.cloneJSON(l)};const c={appearance:n.EnumAppearance.HIDDEN,id:"",text:o()};t.createEmptySelectionParameterOption=function(){return a.cloneJSON(c)};const u={id:"",type:n.EnumParameterTypes.PARAM_SELECTION,value:{selection:{id:""}},header:o(),title:o(),info:{options:[c]},appearance:n.EnumAppearance.HIDDEN};t.createEmptySelectionParameter=function(e){const t=a.cloneJSON(u);return i.isString(e)&&(t.id=e),t};const T={id:"",type:n.EnumParameterTypes.PARAM_MULTIPLE_SELECTION,value:{selections:[]},header:o(),title:o(),info:{options:[c]},appearance:n.EnumAppearance.HIDDEN};t.createEmptyMultipleSelectionParameter=function(e){const t=a.cloneJSON(T);return i.isString(e)&&(t.id=e),t},t.SAMPLE_DATE_TIME_ID="SAMPLE_DATE_TIME_ID";const A={id:t.SAMPLE_DATE_TIME_ID,type:n.EnumParameterTypes.PARAM_DATE_TIME,value:{timestamp:0},title:{id:"_QAPP_LIB_PARAM_TITLE_SAMPLE_DATETIME",args:[]},header:{
id:"_QAPP_LIB_PARAM_HEADER_SAMPLE_DATETIME",args:[]},info:{isDate:!0,isTime:!0},appearance:n.EnumAppearance.HIDDEN};t.createEmptyDateTimeParameter=function(e){const t=a.cloneJSON(A);return i.isString(e)&&(t.id=e),t};const p={id:"",type:n.EnumParameterTypes.PARAM_STRING,value:{string:""},header:o(),title:o(),info:{minimum:{length:0},maximum:{length:0}},appearance:n.EnumAppearance.HIDDEN};t.createEmptyStringParameter=function(e){const t=a.cloneJSON(p);return i.isString(e)&&(t.id=e),t};const d={id:"",type:n.EnumParameterTypes.PARAM_BARCODE,value:{string:"",format:n.EnumBarcodeFormats.CODE128,width:120},header:o(),title:o(),appearance:n.EnumAppearance.HIDDEN};t.createEmptyBarcodeParameter=function(e){const t=a.cloneJSON(d);return i.isString(e)&&(t.id=e),t};const I={id:"",type:n.EnumParameterTypes.PARAM_PASSWORD,value:{string:""},header:o(),title:o(),info:{passwordLength:0,minimum:{length:0},maximum:{length:0}},appearance:n.EnumAppearance.HIDDEN};t.createEmptyPasswordParameter=function(e){
const t=a.cloneJSON(I);return i.isString(e)&&(t.id=e),t};const h={id:"",type:n.EnumParameterTypes.PARAM_TEXT,value:{text:o()},header:o(),title:o(),appearance:n.EnumAppearance.HIDDEN,info:{suppressTitle:!1}};t.createEmptyTextParameter=function(e){const t=a.cloneJSON(h);return i.isString(e)&&(t.id=e),t},t.createEmptyTextParameterValueOnly=function(){let e=a.cloneJSON(h);return e.info.suppressTitle=!0,e};const S={visual:"",eval:""};t.createEmptyFormulaParameterValue=function(){return a.cloneJSON(S)};const N={id:"",type:n.EnumParameterTypes.PARAM_FORMULA,value:[],header:o(),title:o(),appearance:n.EnumAppearance.HIDDEN,info:{maximum:{length:0}}};t.createEmptyFormulaParameter=function(e){const t=a.cloneJSON(N);return i.isString(e)&&(t.id=e),t};const m={mark:"",sign:"",number:"0",decimals:0,auxiliaryDigits:0,unit:"",interval:1,isStable:!1,isSpecial:!1,isWarning:!1,isInvalid:!0};t.createEmptyMeasureParameterValue=function(){return a.cloneJSON(m)};const P={id:"",
type:n.EnumParameterTypes.PARAM_MEASURE,value:m,header:o(),title:o(),appearance:n.EnumAppearance.HIDDEN};t.createEmptyMeasureParameter=function(e){const t=a.cloneJSON(P);return i.isString(e)&&(t.id=e),t};const R={decimals:0,preferredDecimals:0,numbers:[],unit:""};t.createEmptyQuantityParameterValue=function(){return a.cloneJSON(R)},t.QUANTITY_PARAM_MIN_MAX_NAN="nan",t.QUANTITY_PARAM_NUMBERS_MAX=3;const g={id:"",type:n.EnumParameterTypes.PARAM_QUANTITY,value:R,header:o(),title:o(),info:{minimum:{value:t.QUANTITY_PARAM_MIN_MAX_NAN},maximum:{value:t.QUANTITY_PARAM_MIN_MAX_NAN}},appearance:n.EnumAppearance.HIDDEN};t.createEmptyQuantityParameter=function(e){const t=a.cloneJSON(g);return i.isString(e)&&(t.id=e),t};const O={id:"",type:n.EnumParameterTypes.ALIBI_IDENTIFIER,value:{alibiIdentifier:NaN},header:o(),title:o(),appearance:n.EnumAppearance.ENABLED};t.createEmptyAlibiIdentifier=function(){return a.cloneJSON(O)}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{
value:!0}),function(e){e.printParameters="printParameters",e.printPrintQueueWithElectronicSignature="printPrintQueueWithElectronicSignature",e.printParametersDirect="printParametersDirect",e.getPrintQueue="getPrintQueue",e.isPrintQueueEmpty="isPrintQueueEmpty",e.clearPrintQueue="clearPrintQueue",e.requestPrintableValueComment="requestPrintableValueComment",e.setRedactionStatus="setRedactionStatus",e.getAlibiRecord="getAlibiRecord",e.getAlibiRecordList="getAlibiRecordList",e.setPathAndFilenameForNextReport="setPathAndFilenameForNextReport",e.setMetaDataInCurrentReport="setMetaDataInCurrentReport",e.applyProfiles="applyProfiles",e.printParametersWithProfile="printParametersWithProfile"}(t.RestMethodsREPORTING||(t.RestMethodsREPORTING={})),function(e){e.getTemperature="getTemperature",e.getHumidity="getHumidity",e.getAirPressure="getAirPressure",e.getAirDensity="getAirDensity",e.getTemperatureUncertainty="getTemperatureUncertainty",e.getHumidityUncertainty="getHumidityUncertainty",
e.getAirPressureUncertainty="getAirPressureUncertainty",e.getConfigurationData="getConfigurationData"}(t.RestMethodsCLIMATECONTROL||(t.RestMethodsCLIMATECONTROL={})),function(e){e.getWorkstate="getWorkstate",e.getTaskTemplate="getTaskTemplate",e.createTask="createTask",e.readTask="readTask",e.updateTask="updateTask",e.validate="validate",e.saveWorkstate="saveWorkstate",e.deleteWorkstate="deleteWorkstate",e.getTaskNamesByOrderNumber="getTaskNamesByOrderNumber",e.setTaskEvent="setTaskEvent"}(t.RestMethodsTASK_MANAGEMENT||(t.RestMethodsTASK_MANAGEMENT={})),function(e){e.getCurrentUser="getCurrentUser",e.checkRightsOfCurrentUser="checkRightsOfCurrentUser"}(t.RestMethodsACCESS_MANAGEMENT||(t.RestMethodsACCESS_MANAGEMENT={})),function(e){e.addEventExt="addEventExt",e.getRecords="getRecords"}(t.RestMethodsAUDITTRAIL||(t.RestMethodsAUDITTRAIL={})),function(e){e.startInternCal="startInternCal",e.disableAutoIsoCal="disableAutoIsoCal"}(t.RestMethodsCALIBRATION||(t.RestMethodsCALIBRATION={})),
function(e){e.getFormatConfiguration="getFormatConfiguration",e.getFormatConfigurationI18n="getFormatConfigurationI18n"}(t.RestMethodsCLOCK_HANDLER||(t.RestMethodsCLOCK_HANDLER={})),function(e){e.getConfigurations="getConfigurations",e.putFileAsync="putFileAsync",e.putFileAsyncWithoutMD5="putFileAsyncWithoutMD5",e.getFileAsyncWithoutMD5="getFileAsyncWithoutMD5",e.listDirectory="listDirectory"}(t.RestMethodsCONNECTOR_MANAGEMENT||(t.RestMethodsCONNECTOR_MANAGEMENT={})),function(e){e.getSerialNoBalance="getSerialNoBalance",e.getModelName="getModelName",e.getVersionBalance="getVersionBalance",e.getVersionPackage="getVersionPackage",e.getParameter="getParameter",e.sendUDPBroadcast="sendUDPBroadcast",e.cancelUDP="cancelUDP",e.listenUDP="listenUDP",e.addRunningActivity="addRunningActivity",e.removeRunningActivity="removeRunningActivity",e.setActuatorsActive="setActuatorsActive",e.setDeviceCleaned="setDeviceCleaned"}(t.RestMethodsDEVICE_INFORMATION||(t.RestMethodsDEVICE_INFORMATION={})),
function(e){e.getQappProtocolPortNumber="getQappProtocolPortNumber",e.getQappProtocolInterfaces="getQappProtocolInterfaces",e.isInterfaceActive="isInterfaceActive",e.setGPIOPorts="setGPIOPorts"}(t.RestMethodsINTERFACE_MANAGEMENT||(t.RestMethodsINTERFACE_MANAGEMENT={})),function(e){e.getLanguage="getLanguage",e.getText="getText",e.getTexts="getTexts"}(t.RestMethodsLOCALIZER||(t.RestMethodsLOCALIZER={})),function(e){e.addMessage="addMessage",e.deleteMessageByCategory="deleteMessageByCategory",e.getAllMessagesByCategory="getAllMessagesByCategory",e.deleteMessagesByCategory="deleteMessagesByCategory",e.removeMessage="removeMessage"}(t.RestMethodsMESSAGE_HANDLER||(t.RestMethodsMESSAGE_HANDLER={})),function(e){e.loadProfile="loadProfile",e.getProfiles="getProfiles"}(t.RestMethodsPROFILE_MANAGEMENT||(t.RestMethodsPROFILE_MANAGEMENT={})),function(e){e.playEndOfActionSound="playEndOfActionSound",e.playMessageSound="playMessageSound"
}(t.RestMethodsSOUND_MANAGEMENT||(t.RestMethodsSOUND_MANAGEMENT={})),function(e){e.isAutoLogout="isAutoLogout",e.getListRoles="getListRoles"}(t.RestMethodsUSER_MANAGEMENT||(t.RestMethodsUSER_MANAGEMENT={})),function(e){e.createWeightApplication="createWeightApplication",e.enableWeightApplication="enableWeightApplication",e.selectWeightApplication="selectWeightApplication",e.destroyWeightApplication="destroyWeightApplication",e.setButton="setButton",e.triggerStableWeightBlock="triggerStableWeightBlock",e.cancelStableWeightBlock="cancelStableWeightBlock",e.doZero="doZero",e.clearTare="clearTare",e.clearTare1="clearTare1",e.clearTare2="clearTare2",e.clearTareAll="clearTareAll",e.doTare="doTare",e.doTare1="doTare1",e.doTare2="doTare2",e.doTareAuto="doTareAuto",e.doZeroTare="doZeroTare",e.doZeroTareAuto="doZeroTareAuto",e.setTare1="setTare1",e.cancelDoing="cancelDoing",e.setTare2="setTare2",e.setUnit="setUnit",e.getParameter="getParameter",e.getParameterIds="getParameterIds",
e.getRangeParameters="getRangeParameters",e.setMinUsp="setMinUsp",e.setMinWeight="setMinWeight",e.insertWeightInvalidation="insertWeightInvalidation",e.removeWeightInvalidation="removeWeightInvalidation",e.setAmbientCondition="setAmbientCondition"}(t.RestMethodsWEIGHING||(t.RestMethodsWEIGHING={})),function(e){e.openLast="openLast",e.closeAll="closeAll",e.openLeft="openLeft",e.openRight="openRight",e.openTop="openTop"}(t.RestMethodsDRAFTSHIELD||(t.RestMethodsDRAFTSHIELD={})),function(e){e.setJobStatusAndReason="setJobStatusAndReason"}(t.RestMethodsJOB_MANAGEMENT||(t.RestMethodsJOB_MANAGEMENT={})),function(e){e.disableChecker="disableChecker",e.enableChecker="enableChecker"}(t.RestMethodsSELF_MONITOR||(t.RestMethodsSELF_MONITOR={})),function(e){e.start="start"}(t.RestMethodsLEVELING||(t.RestMethodsLEVELING={})),function(e){e.getConfigData="getConfigData"}(t.RestMethodsMENU_HANDLER||(t.RestMethodsMENU_HANDLER={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{
value:!0});const a=s(1);function i(e){return null!=e&&null!==e&&void 0!=e&&void 0!==e&&"string"==typeof e}function n(e){return null!=e&&null!==e&&void 0!=e&&void 0!==e&&"object"==typeof e}t.isNumber=function(e){return null!=e&&null!==e&&void 0!=e&&void 0!==e&&"number"==typeof e&&!isNaN(e)},t.isString=i,t.isObject=n,t.isBoolean=function(e){return null!=e&&null!==e&&void 0!=e&&void 0!==e&&"boolean"==typeof e},t.getObjectByID=function(e,t,s){if(!n(e))return null;i(s)||(s="id"),s=s;for(let a=0;a<e.length;a++)if(e[a].hasOwnProperty(s)&&i(e[a][s])&&e[a][s]===t)return e[a];return null},t.overwriteExistingAttributes=function(e,t){if(n(e)&&n(t)){let s=Object.keys(t);for(let i=0;i<s.length;i++)"function"!=typeof t[s[i]]&&e.hasOwnProperty(s[i])&&typeof t[s[i]]==typeof e[s[i]]&&(t[s[i]]=a.cloneJSON(e[s[i]]))}},t.setEnumSafely=function(e,t,s){const a=Object.keys(t);for(const s of a)if(t[s]===e)return t[s];return i(s)?s:a.length>0?t[a[0]]:void 0}},function(e,t,s){"use strict"
;Object.defineProperty(t,"__esModule",{value:!0}),t.QAPP_TIMER_EVENT="QAPP_TIMER_EVENT";t.QAppTimerEvent=class{constructor(e){this.payload=e,this.type=t.QAPP_TIMER_EVENT}},t.QAPP_INTERVAL_EVENT="QAPP_INTERVAL_EVENT";t.QAppIntervalEvent=class{constructor(e){this.payload=e,this.type=t.QAPP_INTERVAL_EVENT}},t.IMMEDIATE_EVENT="IMMEDIATE_EVENT";t.ImmediateEvent=class{constructor(e){this.payload=e,this.type=t.IMMEDIATE_EVENT}},t.SIMPLE_EVENT="SIMPLE_EVENT";t.SimpleEvent=class{constructor(e){this.payload=e,this.type=t.SIMPLE_EVENT}},t.QAPP_SYNC_CALL_DONE_EVENT="QAPP_SYNC_CALL_DONE_EVENT",function(e){e.SYNC_CALL_SAVE_WORKSTATE="SYNC_CALL_SAVE_WORKSTATE"}(t.QAPP_SYNC_CALL_DONE_EVENT_TYPE||(t.QAPP_SYNC_CALL_DONE_EVENT_TYPE={}));t.QAppSyncCallDoneEvent=class{constructor(e){this.payload=e,this.type=t.QAPP_SYNC_CALL_DONE_EVENT}},t.QAPP_ASYNC_CALL_DONE_EVENT="QAPP_ASYNC_CALL_DONE_EVENT",t.QAPP_ASYNC_CALL_FAIL_EVENT="QAPP_ASYNC_CALL_FAIL_EVENT";t.QAppAsyncCallDoneEvent=class{constructor(e){
this.payload=e,this.type=t.QAPP_ASYNC_CALL_DONE_EVENT}};t.QAppAsyncCallFailEvent=class{constructor(e){this.payload=e,this.type=t.QAPP_ASYNC_CALL_FAIL_EVENT}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(46),i="SUCCESS",n="FAILED";t.CubisRestResponse=class{constructor(e){if(this.restResponse=void 0,"boolean"==typeof e)this.result=e?i:n,this.rawReturns={};else{let t;this.restResponse=e;try{t=JSON.parse(this.restResponse.stdout.toString())}catch(e){throw e.message+="\nreceived: "+this.restResponse.stdout.toString(),e}this.rawReturns=t.returns,this.result=t.result}}isSuccess(){return this.result===i}};t.BaseProxy=class{constructor(){this.body={method:"",params:{}}}syncRequest(){let e,t=JSON.stringify(this.body),s=`http://127.0.0.1:8080/rest/${this.restEndpoint}`;const i=process.hrtime();let n=[s,"-H","Accept:application/json","-H","Content-Type:application/json","-H","Expect:","--data","@-"];e=a.spawnSync("curl",n,{input:t})
;const r=process.hrtime(i);return console.log(`${this.body.method} (hr): ${r[0]}s ${r[1]/1e6}ms`),e}}},function(e,t){e.exports=require("tslib")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(14),i=s(2);var n;!function(e){e[e.SHOW_SCREEN=0]="SHOW_SCREEN",e[e.HIDE_SCREEN=1]="HIDE_SCREEN",e[e.SHOW_OVERLAY=2]="SHOW_OVERLAY",e[e.HIDE_OVERLAY=3]="HIDE_OVERLAY",e[e.SHOW_LOADINGSCREEN=4]="SHOW_LOADINGSCREEN",e[e.HIDE_LOADINGSCREEN=5]="HIDE_LOADINGSCREEN",e[e.SHOW_MESSAGEBOX=6]="SHOW_MESSAGEBOX",e[e.HIDE_MESSAGEBOX=7]="HIDE_MESSAGEBOX",e[e.SHOW_LOCKSCREEN=8]="SHOW_LOCKSCREEN",e[e.HIDE_LOCKSCREEN=9]="HIDE_LOCKSCREEN",e[e.SHOW_LOCKLOADINGSCREEN=10]="SHOW_LOCKLOADINGSCREEN",e[e.HIDE_LOCKLOADINGSCREEN=11]="HIDE_LOCKLOADINGSCREEN",e[e.SHOW_LOCKMESSAGEBOX=12]="SHOW_LOCKMESSAGEBOX",e[e.HIDE_LOCKMESSAGEBOX=13]="HIDE_LOCKMESSAGEBOX"}(n=t.ScreenEventType||(t.ScreenEventType={}));t.AbstractScreen=class{constructor(e){this.events$=new a.Subject,this.mqttHandler=e}
show(){console.log("AbstractScreen: show "+this.getId()+" @ "+i.MqttTopics.HMI_ACTIVE_QAPP_SCREEN),this.mqttHandler.publish(i.MqttTopics.HMI_ACTIVE_QAPP_SCREEN,'{ "screen":"'+this.getId()+'" }'),this.events$.next({type:n.SHOW_SCREEN,id:this.getId()})}hide(){}publishContent(e,t,s=!0){let a=e?this.getMqttTopicBaseExtensible()+e:this.getMqttTopicBase();console.log("AbstractScreen: publishContent @ "+a),this.mqttHandler.publish(a,t,{retain:s})}getMqttTopicBase(){return"SCREENS/"+this.getId()}getMqttTopicBaseExtensible(){return this.getMqttTopicBase()+"/"}getButton(e){}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.INFO="INFO",e.ERROR="ERROR",e.WARNING="WARNING",e.QUESTION="QUESTION"}(t.EnumMessageboxType||(t.EnumMessageboxType={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.ZERO="_FONT_ICON_ZERO",e.TARE="_FONT_ICON_TARE",e.TARE_1="_FONT_ICON_TARE1",e.CLR_TARE1="_FONT_ICON_CLR_TARE1",
e.SHOW_TARE1="_FONT_ICON_SHOW_TARE1",e.HIDE_TARE1="_FONT_ICON_HIDE_TARE1",e.DELETE="_FONT_ICON_DELETE",e.EDIT="_FONT_ICON_EDIT",e.PRINT="_FONT_ICON_PRINT",e.OK="_FONT_ICON_OK",e.CANCEL="_FONT_ICON_CANCEL",e.ERROR="_FONT_ICON_ERROR",e.WARNING="_FONT_ICON_WARNING",e.INFO="_FONT_ICON_INFO",e.NEXT="_FONT_ICON_NEXT",e.PREV="_FONT_ICON_PREV",e.RESULT="_FONT_ICON_RESULT",e.IONIZER="_FONT_ICON_IONIZER",e.PRINT_ADD="_FONT_ICON_PRINT_ADD",e.X_ACROSS="_FONT_ICON_X_ACROSS",e.RESULT_ADD="_FONT_ICON_RESULT_ADD",e.RHO="_FONT_ICON_RHO",e.BACK="_FONT_ICON_BACK",e.MIN_USP="_FONT_ICON_MIN_USP",e.START="_FONT_ICON_START",e.END="_FONT_ICON_END",e.DOCU="_FONT_ICON_DOCU",e.INVALIDATE_SAMPLE="_FONT_ICON_INVALID_SAMPLE",e.SEARCH="_FONT_ICON_SEARCH",e.SEARCH_ACTIVE="_FONT_ICON_SEARCH_ACTIVE",e.FILTER="_FONT_ICON_FILTER",e.FILTER_ACTIVE="_FONT_ICON_FILTER_ACTIVE",e.ADD="_FONT_ICON_ADD",e.LOGOUT="_FONT_ICON_LOGOUT",e.RELOAD="_FONT_ICON_RELOAD",e.WEIGHING="_FONT_ICON_WEIGHING",e.QUESTION="_FONT_ICON_QUESTION",
e.SKIP="_FONT_ICON_SKIP"}(t.EnumFontLabels||(t.EnumFontLabels={}))},function(e,t){e.exports=require("typeorm")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(1);function n(e){return i.cloneJSON({module:"qappHandler",method:"buttonClickEvent",params:{buttonId:e||""}})}function r(e){let t={nameId:"",appearance:"HIDDEN",type:"",label:{id:"",args:[]},effect:n()};return void 0!==e.nameId&&(t.nameId=e.nameId),void 0!==e.labelCenter&&(t.labelCenter=e.labelCenter),void 0!==e.labelRight&&(t.labelRight=e.labelRight),void 0!==e.icon&&(t.icon=e.icon),void 0!==e.lastSelected&&(t.lastSelected=e.lastSelected),t.label=e.label,t.appearance=e.appearance,t.effect.params.buttonId=e.buttonId,e.longPressButtonId&&(t.longPressEffect=n(),t.longPressEffect.params.buttonId=e.longPressButtonId),void 0!==e.labelAlign&&(t.labelAlign=e.labelAlign),void 0!==e.labelCenterAlign&&(t.labelCenterAlign=e.labelCenterAlign),
void 0!==e.labelRightAlign&&(t.labelRightAlign=e.labelRightAlign),t}t.createButtonEmptyEffect=n,t.IButtonParameterInterface2IButtonJsonInterface=r,t.IButtonJsonInterface2IButtonParameterInterface=function(e){let t={buttonId:e.effect.params.buttonId,appearance:e.appearance,label:e.label};return e.nameId&&(t.nameId=e.nameId),e.labelCenter&&(t.labelCenter=e.labelCenter),e.labelRight&&(t.labelRight=e.labelRight),e.longPressEffect&&(t.longPressButtonId=e.longPressEffect.params.buttonId),void 0!==e.icon&&(t.icon=e.icon),void 0!==e.lastSelected&&(t.lastSelected=e.lastSelected),void 0!==e.labelAlign&&(t.labelAlign=e.labelAlign),void 0!==e.labelCenterAlign&&(t.labelCenterAlign=e.labelCenterAlign),void 0!==e.labelRightAlign&&(t.labelRightAlign=e.labelRightAlign),t};class o{constructor(e,t,s){this.lastPublishedTabContent="",this.mqttHandler=e,this.buttonTopic="SCREENS/"+t.getId()+"/"+s.buttonId,this.buttonJson=r(s)}setButtonId(e,t=!0){this.buttonJson.effect.params.buttonId=e,t&&this.publish()}
setLongPressButtonId(e,t=!0){e?(this.buttonJson.longPressEffect||(this.buttonJson.longPressEffect=n()),this.buttonJson.longPressEffect.params.buttonId=e):delete this.buttonJson.longPressEffect,t&&this.publish()}setJson(e){this.buttonJson=JSON.parse(e),this.publish()}setNameId(e,t=!0){this.buttonJson.nameId=e,t&&this.publish()}getNameId(){return this.buttonJson.nameId}setAppearance(e,t=!0){this.buttonJson.appearance=e,t&&this.publish()}setType(e,t=!0){this.buttonJson.type=e,t&&this.publish()}getType(){return this.buttonJson.type}getLabel(){return this.buttonJson.label}setLabel(e,t=!0){this.buttonJson.label=e,t&&this.publish()}getIcon(){return this.buttonJson.icon}setIcon(e,t=!0){void 0!==e&&e.length>0?this.buttonJson.icon=e:delete this.buttonJson.icon,t&&this.publish()}getLabelCenter(){return this.buttonJson.labelCenter}setLabelCenter(e,t=!0){this.buttonJson.labelCenter=e,t&&this.publish()}getLabelRight(){return this.buttonJson.labelRight}setLabelRight(e,t=!0){
this.buttonJson.labelRight=e,t&&this.publish()}getAppearance(){let e=a.EnumAppearance.HIDDEN;return this.buttonJson.appearance&&"string"==typeof this.buttonJson.appearance&&Object.keys(a.EnumAppearance).indexOf(this.buttonJson.appearance)?this.buttonJson.appearance:e}getJson(){return this.buttonJson}getTopic(){return this.buttonTopic}getButtonId(){return this.buttonJson.effect.params.buttonId}getLongPressButtonId(){return this.buttonJson.longPressEffect?this.buttonJson.longPressEffect.params.buttonId:null}publish(){let e=JSON.stringify(this.buttonJson);e!==this.lastPublishedTabContent&&(this.mqttHandler.publish(this.buttonTopic,e),this.lastPublishedTabContent=e)}show(){this.publish()}}t.Button=o,t.default=o},function(e,t){e.exports=require("rxjs/Subject")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const a=s(70),i=s(71),n=s(72),r=s(60),o=s(74),E=s(6),_=s(26),l=s(75),c=s(27),u=s(78),T=s(61),A=s(47),p=s(48),d=s(63),I=s(82),h=s(83),S=s(64),N=s(10),m=s(52),P=s(3),R=s(85),g=s(9),O=s(34),D=s(53),C=s(51),M=s(24),L=s(18),b=s(17),f=s(86),B=s(35),y=s(28),v=s(39),U=s(1),G=s(11),H=s(87),F=s(88),Q=s(89),x=s(44),w=s(90),V=s(36),W=s(2),k=s(0);s(91),t.HEARTBEAT_INTERVAL_MS=2e3;const Y=100,K=500;t.STORAGE_LOCATION_BASE="/data/installedQApps/qapps/data";const q="STATE_SUSPENDING_INTERNAL",j="STATE_RESTARTING_INTERNAL",X="_START_FSM_",J="_INTERNAL_DEVEL_VERSION_INFO_STATE_",$="BTN_INTERNAL_DEVEL_VERSION_INFO";t.FORCED_SUSPEND_HOME_BUTTON_ID="BTN_HOME",t.LOGOUT_BUTTON_ID="BTN_LOGOUT",t.PRINT_RESTART_BUTTON_ID="BTN_PRINT_RESTART";const Z="BTN_SUSPEND_QUESTION_YES",z="BTN_SUSPEND_QUESTION_NO",ee="BTN_LOGOUT_QUESTION_YES",te="BTN_LOGOUT_QUESTION_NO",se="BTN_RESTART_QUESTION_YES",ae="BTN_RESTART_QUESTION_NO",ie="CANCEL_LOGOUT",ne="REMEMBER_LOGOUT",re="TASK/IDENTIFICATION",oe="TASK/PROFILE";var Ee,_e
;t.TASK_PROFILE_REPORTING_ID_PREFIX=oe+"/REPORTING_PROFILES",t.TASK_PROFILE_WEIGHING_ID=oe+"/WEIGHING",t.ASYNC_CALL_DB_CONNECTION_CREATE="ASYNC_CALL_DB_CONNECTION_CREATE",function(e){e.FUNC_BTN_TAKEOVER="FUNC_BTN_TAKEOVER",e.FUNC_BTN_DOCU="FUNC_BTN_DOCU",e.FUNC_BTN_OTHER="FUNC_BTN_OTHER"}(Ee=t.EnumFunctionalButtonType||(t.EnumFunctionalButtonType={})),function(e){e.SUSPEND_NO_SUSPEND="SUSPEND_NO_SUSPEND",e.SUSPEND_HOME="SUSPEND_HOME",e.SUSPEND_LOGOUT="SUSPEND_LOGOUT",e.SUSPEND_APP="SUSPEND_APP"}(_e=t.EnumSuspendReason||(t.EnumSuspendReason={})),t.dbg=function(e){null===e?console.log(" ## DEBUG ## null"):void 0===e?console.log(" ## DEBUG ## undefined"):"string"==typeof e||"number"==typeof e||"boolean"==typeof e?console.log(" ## DEBUG ## "+b.inspect(e).toString()):(console.log(" ## DEBUG ##"),console.log(b.inspect(e,!1,20)),console.log(" ##########"))};class le{constructor(e){this.suppressGlobalHomeBtnHandling=!1,this.suppressGlobalLogoutBtnHandling=!1,
this.suppressGlobalRestartBtnHandling=!1,this.isDevelVersion=!1,this.screens={},this.hideLoadingScreenOnShowScreens=!0,this.buttons={takeoverBtn:void 0,docuButton:void 0,others:[]},this.lastRequestedTakeoverBtnAppearance=k.EnumAppearance.HIDDEN,this.aspects={},this.scriptPath=void 0,this.qAppOrderNumber=void 0,this.qAppVersion=void 0,this.taskId=void 0,this.isErrorStatePublished=!1,this.exitTimeOutPending=!1,this.suspendReason=_e.SUSPEND_NO_SUSPEND,this.heartbeatCount=0,this.eventQueue=[],this.eventQueuePending=!1,this.subscriptions=[],this.outstandingAsyncCalls=[],this.debugCfg={doConsoleLog:!0,enableHeartbeatLog:!1,url:null},this.pendingMsgBox=void 0,this.currentMsgBox=void 0,this.isCurrentMsgPrio=!1,this.debugCfg.doConsoleLog=e,console.error=((...e)=>{console.log("ERR: ",e)});let i=s(24);if(console.log("try reading debug config from file"),i.existsSync("/data/installedQApps/qapps/data/qapplog.conf"))try{console.log("...found config file")
;let e=JSON.parse(i.readFileSync("/data/installedQApps/qapps/data/qapplog.conf","utf8").toString());console.log("...got it"),Object.assign(this.debugCfg,e),console.log("...debug config (with defaults): "+b.inspect(this.debugCfg))}catch(e){console.log("...invalid JSON content in qapplog.conf: "+e),console.log("...disable logging at all"),console.log=((...e)=>{})}else console.log("No qapplog file found.");let n=console.log;console.log("...saved original stdout");let r=null;if(null!==this.debugCfg.url){console.log("...there seems to be an url for remote logging configured");try{r=new x.URL(this.debugCfg.url),console.log("...valid url for remote logging")}catch(e){r=null,console.log('...invalid URL like "ws://hostname.port" in qapplog.conf')}}if(this.debugCfg.doConsoleLog||(console.log("...disable local output"),console.log=((...e)=>{})),null!==r){console.log("...valid url for remote logging");let e=new w.Socket;e.on("error",()=>{try{console.log("...no logging redirected - error"),e.end()
}catch(e){}}),e.connect(Number.parseInt(r.port),r.hostname,()=>{try{console.log(`...logging remote redirected to external client (local: ${this.debugCfg.doConsoleLog})`),console.log=((...t)=>{let s="";if(t.forEach(e=>{s+=e}),this.debugCfg.doConsoleLog)try{n(s)}catch(e){}s+="\n";try{e.write(s)}catch(e){}}),e.setNoDelay(!0),e.write("Hello, server! Love, Client.")}catch(e){}})}console.log("QAppBase: constr"),le.clientSingleton=this,this.restHandler=new u.RestHandler,this.mqttHandler=new l.MqttHandler,this.taskMngProxy=new A.TaskProxy,this.localizerProxy=new T.LocalizerProxy,this.weighingProxy=new p.WeighingProxy,this.accessControlProxy=new I.AccessControlProxy,this.reportingProxy=new S.ReportingProxy,this.devicInformationProxy=new f.DeviceInformationProxy,this.messageHandlerProxy=new B.MessageHandlerProxy,this.messageHandlerHelper=new y.MessageHandlerHelper(this.messageHandlerProxy),this.taskHandler=new d.TaskHandler,this.heartbeatInterval$=a.interval(t.HEARTBEAT_INTERVAL_MS)}
getQAppOrderNumber(){return this.qAppOrderNumber}getQAppVersion(){return this.qAppVersion}getTaskId(){return this.taskId}getSerialNumber(){return this.devicInformationProxy.getSerialNo()}getWeighingProfileId(){let e=this.taskHandler.getParameter(t.TASK_PROFILE_WEIGHING_ID);return void 0!==e&&P.isTypeOfISelectionParameter(e)?e.value.selection.id:void 0}registerAspect(e){this.aspects[e.getId()]=e}init(){let e=new R.LoadingOverlay(this.mqttHandler);this.registerScreen(e)}postInit(){}loadTask(){if(this.taskId){console.log("QAppBase: read task for: ",this.taskId);try{this.taskHandler.setTask(this.taskMngProxy.readTask(this.taskId)),console.log("QAppBase: read task ...done");let e=this.taskHandler.getTask();e&&(this.qAppOrderNumber=e.qappOrderNumber,this.qAppVersion=e.qappVersion),console.log("QAppBase: got qAppOrderNumber from Task-Info: "+this.qAppOrderNumber+"@"+this.qAppVersion)}catch(e){this.exitError("QAppBase::loadTask - error reading: "+(e?e.toString():""))}
}else this.exitError("QAppBase::loadTask - Workflow script called without taskId")}getTaskName(){let e=void 0;if(void 0!==this.taskHandler){let t=this.taskHandler.getParameter("TASK/IDENTIFICATION/NAME");void 0!==t&&(e=t.value.string)}return e}registerScreen(e){console.log("QAppBase: register screen with id: "+e.getId()),this.screens[e.getId()]=e;try{e.events$.subscribe(e=>{e.type===g.ScreenEventType.SHOW_SCREEN&&this.hideLoadingScreenOnShowScreens&&this.hideLoadingScreen(),e.type,g.ScreenEventType.SHOW_LOADINGSCREEN,e.type,g.ScreenEventType.SHOW_MESSAGEBOX})}catch(e){}}showScreen(e){if(!this.exitTimeOutPending)switch(e.getId()){case R.LOADING_OVERLAY_ID:case h.MESSAGEBOX_ID:this.exitError("QAppBase::showScreen() was called for messagebox or loading screen - not allowed");break;default:let t=this.hideLoadingScreenOnShowScreens;this.hideLoadingScreenOnShowScreens=!1,e.show(),this.closeAllScreensExcept(e),this.hideLoadingScreenOnShowScreens=t}}closeAllScreensExcept(e){switch(e.getId()){
case R.LOADING_OVERLAY_ID:case h.MESSAGEBOX_ID:this.exitError("QAppBase::closeAllScreensExcept() was called for messagebox or loading screen - not allowed");break;default:for(let t in this.screens){let s=this.screens[t];s.getId()!==e.getId()&&s.getId()!==R.LOADING_OVERLAY_ID&&s.getId()!==Q.LOCK_LOADING_OVERLAY_ID&&s.getId()!==F.LOCKMESSAGEBOX_ID&&(s.getId()===h.MESSAGEBOX_ID?this.hideMsgBox():s.hide())}this.hidePrintQueue()}}getLoadingScreen(){let e=this.screens[R.LOADING_OVERLAY_ID];return void 0===e&&(e=new R.LoadingOverlay(this.mqttHandler),this.registerScreen(e)),e}showLoadingScreen(e){if(!this.exitTimeOutPending){console.log("QAppBase::showLoadingScreen()");let t=this.getLoadingScreen();e?t.setText(e):t.setText({id:"",args:[]}),t.show()}}hideLoadingScreen(){console.log("QAppBase::hideLoadingScreen()");try{this.getLoadingScreen().hide()}catch(e){}}checkForLoadingScreenEnableEvent(e){try{
return e.payload.event===O.MQTT_ADMIN_EVENT_PACKET_SENT&&e.payload.packet.topic===W.MqttTopics.HMI_LOADING_MODAL_APPEARANCE&&JSON.parse(e.payload.packet.payload.toString()).appearance===k.EnumAppearance.ENABLED}catch(e){return!1}}checkForLoadingScreenDisabledEvent(e){try{return e.payload.event===O.MQTT_ADMIN_EVENT_PACKET_SENT&&e.payload.packet.topic===W.MqttTopics.HMI_LOADING_MODAL_APPEARANCE&&JSON.parse(e.payload.packet.payload.toString()).appearance===k.EnumAppearance.HIDDEN}catch(e){return!1}}showMessageBox(e){this.exitTimeOutPending||(void 0===this.currentMsgBox?(console.log("QAppBase::showMessageBox(): check no current active one -> prep and show"),this.currentMsgBox=e,this.prepAndShowMsgBox(this.currentMsgBox),this.isCurrentMsgPrio=!1,this.pendingMsgBox=void 0):(console.log("QAppBase::showMessageBox(): queue msgbox"),this.pendingMsgBox=e))}hideMsgBox(){console.log("QAppBase::hideMsgBox()"),this.pendingMsgBox=void 0,
void 0===this.currentMsgBox||this.isCurrentMsgPrio||(console.log("QAppBase::hideMsgBox(): check non-prio -> hide"),this.currentMsgBox=void 0,this.hideMsgBoxInternal())}showPriorMsgBox(e){this.exitTimeOutPending||(void 0!==this.currentMsgBox&&(this.isCurrentMsgPrio||(console.log("QAppBase::showPriorMsgBox(): queue the current non prio msgbox"),this.pendingMsgBox=this.currentMsgBox)),console.log("QAppBase::showPriorMsgBox(): prep and how prio msgbox"),this.currentMsgBox=e,this.prepAndShowMsgBox(this.currentMsgBox),this.isCurrentMsgPrio=!0)}hidePriorMsgBox(){void 0!==this.pendingMsgBox?(this.currentMsgBox=this.pendingMsgBox,this.pendingMsgBox=void 0,this.prepAndShowMsgBox(this.currentMsgBox)):(this.currentMsgBox=void 0,this.hideMsgBoxInternal()),this.isCurrentMsgPrio=!1}hideAllMsgBox(){this.pendingMsgBox=void 0,this.currentMsgBox=void 0,this.isCurrentMsgPrio=!1,this.hideMsgBoxInternal()}getMsgbox(){let e=this.screens[h.MESSAGEBOX_ID]
;return void 0===e&&(e=new h.MessageBox(this.mqttHandler),this.registerScreen(e)),e}prepAndShowMsgBox(e){if(!this.exitTimeOutPending){let t=this.getMsgbox();t.setMessageBoxData(e),console.log("QAppBase::prepAndShowMsgBox(): show"),t.show(),console.log("QAppBase::prepAndShowMsgBox(): done")}}hideMsgBoxInternal(){console.log("QAppBase::hideMsgBoxInternal()"),this.getMsgbox().hide()}showPrintQueue(){if(!this.exitTimeOutPending){console.log("QAppBase::showPrintQueue()");let e={enabled:!0};this.mqttHandler.publish(W.MqttTopics.REPORTING_PRINTQUEUE_DISPLAYED,JSON.stringify(e),{retain:!1})}}hidePrintQueue(){console.log("QAppBase::hidePrintQueue()");this.mqttHandler.publish(W.MqttTopics.REPORTING_PRINTQUEUE_DISPLAYED,JSON.stringify({enabled:!1}),{retain:!1})}clearPrintQueue(){void 0!==this.buttons.docuButton&&this.buttons.docuButton.setAppearance(k.EnumAppearance.DISABLED),this.reportingProxy.clearPrintQueue()}registerButton(e,t){switch(e){case Ee.FUNC_BTN_TAKEOVER:this.buttons.takeoverBtn=t,
this.lastRequestedTakeoverBtnAppearance=t.getAppearance();break;case Ee.FUNC_BTN_DOCU:this.buttons.docuButton=t,this.buttons.docuButton.setAppearance(k.EnumAppearance.DISABLED);break;default:this.buttons.others.push(t)}}addTimer(e,t){const s=n.setTimeout(()=>{this.addToEventQueue(new E.QAppTimerEvent(t))},e);return s.unref(),s}cancelTimer(e){void 0!==e&&n.clearTimeout(e)}addInterval(e,t){return n.setInterval(()=>{this.addToEventQueue(new E.QAppIntervalEvent(t))},e)}cancelInterval(e){void 0!==e&&n.clearInterval(e)}generateAsyncCallidentifier(){let e=Math.random();for(;this.outstandingAsyncCalls.find(t=>t===e);)e=Math.random();return e}enqueAsyncCall(e,s,a=5*t.HEARTBEAT_INTERVAL_MS,i=!1){let r=this.getCurrentState();console.log("QAppBase::enqueAsyncCall in state: "+r+" (timeout: "+a+"/fetchAfter: "+i+") with metadata: "+b.inspect(s));let E=this.generateAsyncCallidentifier();this.outstandingAsyncCalls.push(E);let _=new v.QAppAsyncCallTimeoutError(r,s),l=n.setTimeout(()=>{
console.log("QAppBase async call timeout - add timeout to event queue");let e=new o.InternalAsyncCallEvent({type:i?o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT_WITH_FETCHING_RESP:o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT,data:{sourceState:r,reason:_,metadata:s},id:E});this.addToEventQueue(e)},a);e.then(e=>{console.log("QAppBase async call passed - add result to event queue");let t=new o.InternalAsyncCallEvent({type:o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_SUCCESS,data:{sourceState:r,result:e,metadata:s},id:E,timerId:l});this.addToEventQueue(t)}).catch(e=>{console.log("QAppBase async call failed - add reason to event queue"),console.log(b.inspect(e));let t=new o.InternalAsyncCallEvent({type:o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_FAIL,data:{sourceState:r,reason:e,metadata:s},id:E,timerId:l});this.addToEventQueue(t)}),console.log("QAppBase::enqueAsyncCall done...")}addToEventQueue(e){
e.type===E.IMMEDIATE_EVENT||e.type===o.INTERNAL_SUSPEND_EVENT||e.type===o.INTERNAL_RESTART_EVENT||e.type===o.HEARTBEAT_EVENT?this.eventQueue.push(e):this.eventQueue.unshift(e),this.eventQueuePending||(setImmediate(()=>{this.processEventQueue(this)}),this.eventQueuePending=!0)}processEventQueue(e){if(this.exitTimeOutPending)return;e.eventQueuePending=!1;let t=e.eventQueue.length,s=e.eventQueue.pop();for(;s&&t>0&&!this.exitTimeOutPending;)t--,e.handleEvent(s),t>0&&(s=e.eventQueue.pop())}run(){if(!this.isErrorStatePublished){console.log("QAppBase: run"),this.processCLParameters(process.argv),this.heartbeat({message:":-)",value:this.heartbeatCount++});let e=this.provideStartFsmState();this.qappStates=this.prepareAndExtendFsmStates(e),console.log("QAppBase: register internal event handler"),
this.subscriptions.push(i.merge(this.mqttHandler.mqttUpdateEvent$,this.mqttHandler.mqttAdminEvent$,this.restHandler.buttonClickEvent$,this.restHandler.paramChangedEvent$,this.restHandler.paramDetailEvent$,this.restHandler.restRequestEvent$).subscribe(e=>{this.addToEventQueue(e)})),this.subscriptions.push(this.mqttHandler.mqttUpdateEvent$.subscribe(e=>{try{switch(e.payload.topic){case W.MqttTopics.METROLOGY_MAX_DIGITS:case W.MqttTopics.METROLOGY_MAX_DIGITS_DEBUG:this.weighingProxy.updateWeighValueMaxDigits(parseInt(e.payload.value.toString(),10));break;case W.MqttTopics.METROLOGY_RANGES:this.weighingProxy.updateMetrologyRanges(JSON.parse(e.payload.value.toString()));break;case W.MqttTopics.WEIGHING_SELECTED_DISPLAY_VALUE:this.weighingProxy.updateLastSelectedDisplayValue(JSON.parse(e.payload.value.toString()))}}catch(t){this.exitError("unexpected value content for incoming MQTT event: "+e.payload.topic)}})),console.log("QAppBase: create the FSM with all custom states"),
this.qappFsm=r.createFsm(this.qappStates),delete this.__machina__,this.eventQueue.splice(0),this.qappFsm.on("transition",this.onFsmTransitionInternal),this.mqttHandler.subscribe(W.MqttTopics.QAPP_DEBUG_TOPIC_PREAMBLE+"/#"),this.onRunning(),console.log("QAppBase: schedule transition to custom start state"),setTimeout(()=>{console.log("QAppBase: start heartbeating"),this.heartbeatIntervalSubscription=this.heartbeatInterval$.subscribe(()=>{this.addHeartbeatEvent(":-)")}),console.log("QAppBase: initiate transition to custom start state"),this.qappFsm.handle(this,X,this.isDevelVersion?J:e),console.log("QAppBase: initiated transition to custom start state")},Y),console.log("QAppBase: run finished")}}canSuspend(){if(console.log("QAppBase: Can suspend?"),this.suspendReason===_e.SUSPEND_APP)return!0;if(console.log("QAppBase: Check printQueue"),this.reportingProxy.isPrintQueueEmpty())return console.log("QAppBase: printQueue is empty, exiting the QApp."),!0
;if(this.suspendReason===_e.SUSPEND_LOGOUT)this.showPriorMsgBox({type:N.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MBOX_LOGOUT_WARNING_TITLE",args:[]},buttons:[{id:ee,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:k.EnumAppearance.ENABLED_SECONDARY},{id:te,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},appearance:k.EnumAppearance.ENABLED_SECONDARY}],textList:[{id:"_QAPP_LIB_MBOX_LOGOUT_WARNING_TEXT_top",args:[]},{id:"_QAPP_LIB_MBOX_LOGOUT_WARNING_TEXT_mid",args:[this.getTaskName()]},{id:"_QAPP_LIB_MBOX_LOGOUT_WARNING_TEXT_bottom",args:[]}]});else{if(this.suspendReason!==_e.SUSPEND_HOME)return!1;this.showPriorMsgBox({type:N.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MBOX_HOME_WARNING_TITLE",args:[]},buttons:[{id:Z,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:k.EnumAppearance.ENABLED_SECONDARY},{id:z,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},appearance:k.EnumAppearance.ENABLED_SECONDARY}],textList:[{id:"_QAPP_LIB_MBOX_HOME_WARNING_TEXT_top",args:[]},{
id:"_QAPP_LIB_MBOX_HOME_WARNING_TEXT_mid",args:[this.getTaskName()]},{id:"_QAPP_LIB_MBOX_HOME_WARNING_TEXT_bottom",args:[]}]})}return console.log("QAppBase: printQueue is not empty, asking for permission to exist task."),!1}continueSuspend(){this.suspendReason!==_e.SUSPEND_NO_SUSPEND?(console.log("QAppBase: Continue last suspend request"),this.clearPrintQueue(),this.handleEvent(new o.InternalSuspendEvent(o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_EXECFINALLY))):console.log("QAppBase: No suspend pending continue")}cancelSuspend(){console.log("QAppBase: Cancel last suspend request"),this.suspendReason=_e.SUSPEND_NO_SUSPEND}cancelLogout(){console.log("QAppBase: Cancel last logout request"),this.cancelSuspend(),this.mqttHandler.publish(W.MqttTopics.QAPP_LOGOUT_REQUEST,JSON.stringify({request:ie}))}rememberLogout(){this.mqttHandler.publish(W.MqttTopics.QAPP_LOGOUT_REQUEST,JSON.stringify({request:ne}))}suspend(){console.log("QAppBase: QApp suspend request"),
this.suspendReason=_e.SUSPEND_APP,this.handleEvent(new o.InternalSuspendEvent(o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_EXECFINALLY))}doSuspend(){this.isErrorStatePublished||(console.log("QAppBase: suspend"),this.onSuspending(),this.doCloseAllOverlays(),console.log("QAppBase: publish STOPPED event of qapp"),this.mqttHandler.publish(W.MqttTopics.QAPP_STOPPED,this.taskId?""+this.taskId:"",{retain:!1}),setTimeout(()=>{console.log("process.exit"),process.exit(0)},K),this.exitTimeOutPending=!0)}canRestart(){return console.log("QAppBase: can restart? - check printQueue"),this.reportingProxy.isPrintQueueEmpty()?(console.log("QAppBase: printQueue is empty, restart the QApp."),!0):(this.showPriorMsgBox({type:N.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MBOX_RESTART_QUESTION_TITLE",args:[]},buttons:[{id:se,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:k.EnumAppearance.ENABLED_SECONDARY},{id:ae,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},
appearance:k.EnumAppearance.ENABLED_SECONDARY}],textList:[{id:"_QAPP_LIB_MBOX_RESTART_QUESTION_TEXT_top",args:[this.getTaskName()]},{id:"_QAPP_LIB_MBOX_RESTART_QUESTION_TEXT_bottom",args:[]}]}),console.log("QAppBase: printQueue is not empty, asking for permission to restart task."),!1)}continueRestart(){console.log("QAppBase: Continue last restart request"),this.handleEvent(new o.InternalRestartEvent(o.INTERNAL_RESTART_EVENT_TYPE.RESTART_EVENT_TYPE_EXECFINALLY))}doCloseAllOverlays(){this.hidePrintQueue();for(let e in this.screens){let t=this.screens[e].getButton(m.CANCEL_BARBUTTON_ID);if(t&&t.setAppearance(k.EnumAppearance.HIDDEN),e!==R.LOADING_OVERLAY_ID)try{this.screens[e].hide()}catch(e){}}this.hideAllMsgBox()}exitError(e){this.isErrorStatePublished=!0;let t=(new Error).stack;console.log("QAppBase: exit with error: "+e),console.log("exitError: "),console.log(t),this.doCloseAllOverlays(),
this.messageHandlerHelper.addMessage(y.EMsgHandlerMsgs.ERR_799_GENERIC_INTERNAL_ERROR,e,void 0,[B.createMessageHandlerButton(void 0,void 0,B.MessageHandlerCallTarget.REMOVE_MESSAGE)]),this.onErrorExiting(e),this.mqttHandler.publish(W.MqttTopics.QAPP_ERROR,(this.taskId?""+this.taskId:"")+"error: "+e,{retain:!1}),setTimeout(()=>{console.error("QAppBase: exit with error: "+e),process.exit(-1)},K),this.exitTimeOutPending=!0}heartbeat(e){this.isErrorStatePublished||(this.debugCfg.enableHeartbeatLog&&console.log("."),this.mqttHandler.publish(W.MqttTopics.QAPP_HEARTBEAT,JSON.stringify(e),{retain:!1}))}addHeartbeatEvent(e){this.addToEventQueue(new o.HeartbeatEvent({message:e,value:this.heartbeatCount++}))}checkForCustomHeartbeatEvent(e,t){try{return e.payload.event===O.MQTT_ADMIN_EVENT_PACKET_SENT&&e.payload.packet.topic===W.MqttTopics.QAPP_HEARTBEAT&&JSON.parse(e.payload.packet.payload.toString()).message===t}catch(e){return!1}}adaptFsmStates(e){}prepareAndExtendFsmStates(e){let t
;if(console.log("QAppBase::prepareAndExtendFsmStates: create state machine with QApp specific states"),void 0===this.qappStates){t=this.provideFsmStates();for(let e in this.aspects)Object.assign(t,this.aspects[e].getAspectStates());t[J]={_onEnter:function(e){e.showMessageBox({type:N.EnumMessageboxType.INFO,title:{id:"_QAPP_LIB_MBOX_DEMO_INFO_TITLE",args:[]},buttons:[{id:$,label:{id:G.EnumFontLabels.OK,args:[]},appearance:k.EnumAppearance.ENABLED_SECONDARY}],textList:[{id:"_QAPP_LIB_MBOX_DEMO_INFO_TEXT",args:[]}]})},_onExit:function(e){},EV_HMI_BTN_CLICKED:function(t,s){return s.payload.buttonId===$&&(t.hideMsgBox(),this.transition(t,e)),""}},this.adaptFsmStates(t);for(let e in this.aspects)if(this.aspects[e].getId()===H.LOCKING_ASPECT){this.aspects[e].adaptFsmStates(t);break}let s=function(e,t){e.heartbeat(t.payload)};for(let e in t)t.hasOwnProperty(e)&&(t[e]._FSM_HEARTBEAT_EVENT_=s,t[e]._INTERNAL_SUSPEND_EVENT_=function(e,t){switch(t.payload){
case o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_FORCED_HOME:case o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_FORCED_LOGOUT:console.log("QAppBase: HOME/LOGOUT button suspend request"),t.payload===o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_FORCED_HOME?e.suspendReason=_e.SUSPEND_HOME:e.suspendReason=_e.SUSPEND_LOGOUT,e.canSuspend()?this.transition(e,q):console.log("QAppBase: HOME/LOGOUT suspend interrupted by QApp");break;case o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_FORCED_AUTO_LOGOUT:console.log("QAppBase: auto logout suspend request"),e.suspendReason=_e.SUSPEND_HOME,this.transition(e,q);break;case o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_EXECFINALLY:this.transition(e,q)}},t[e]._INTERNAL_RESTART_EVENT_=function(e,t){switch(t.payload){case o.INTERNAL_RESTART_EVENT_TYPE.RESTART_EVENT_TYPE_REQUEST:e.canRestart()?this.transition(e,j):console.log("QAppBase: restart interrupted by QApp");break;case o.INTERNAL_RESTART_EVENT_TYPE.RESTART_EVENT_TYPE_EXECFINALLY:
this.transition(e,j)}});t[q]={_onEnter:function(e){e.showLoadingScreen({id:"",args:[]})},_onExit:function(e){},MQTT_ADMIN_EVENT:function(e,t){e.checkForLoadingScreenEnableEvent(t)&&e.doSuspend()},_FSM_HEARTBEAT_EVENT_:s},t[j]={_onEnter:function(e){e.showLoadingScreen({id:"_QAPP_LIB_LOADING_OVERLAY_TEXT_RESTARTING_APP",args:[e.getTaskName()]})},_onExit:function(e){},MQTT_ADMIN_EVENT:function(e,t){e.checkForLoadingScreenEnableEvent(t)&&(e.clearPrintQueue(),this.transition(e,r.STATE_UNINITIALIZED_INTERNAL),e.restart(),e.run())},_FSM_HEARTBEAT_EVENT_:s}}else t=this.qappStates;return t}handleEvent(e){if(this.qappFsm){if(e instanceof _.MqttUpdateDebugEvent&&e.payload.topic===W.MqttTopics.QAPP_DEBUG_STOP_HEARTBEAT&&(console.log("DEBUG: stop heartbeat received"),this.heartbeatIntervalSubscription&&(console.log("DEBUG: stop heartbeat > unsubscribe on heartbeatInterval"),this.heartbeatIntervalSubscription.unsubscribe())),
e instanceof c.HmiButtonClickedEvent)if(e.payload.buttonId!==V.BTN_HOME_ID||this.suppressGlobalHomeBtnHandling)if(e.payload.buttonId!==V.BTN_LOGOUT_ID||this.suppressGlobalLogoutBtnHandling){if(e.payload.buttonId===Z)return void this.continueSuspend();if(e.payload.buttonId===ee)return void this.continueSuspend();if(e.payload.buttonId===z)return this.cancelSuspend(),this.hidePriorMsgBox(),void this.hideLoadingScreen();if(e.payload.buttonId===te)return this.cancelLogout(),this.hidePriorMsgBox(),void this.hideLoadingScreen();if(e.payload.buttonId!==t.PRINT_RESTART_BUTTON_ID||this.suppressGlobalRestartBtnHandling){if(e.payload.buttonId===se)return void this.continueRestart();if(e.payload.buttonId===ae)return this.hidePriorMsgBox(),void this.hideLoadingScreen();if(void 0!==this.buttons.docuButton&&e.payload.buttonId===this.buttons.docuButton.getButtonId())return void this.handleDocuButton()}else e=new o.InternalRestartEvent(o.INTERNAL_RESTART_EVENT_TYPE.RESTART_EVENT_TYPE_REQUEST)
}else e=new o.InternalSuspendEvent(o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_FORCED_LOGOUT);else e=new o.InternalSuspendEvent(o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_FORCED_HOME);if(e instanceof _.MqttUpdateEvent&&e.payload.topic===W.MqttTopics.USERMANAGEMENT_AUTO_LOGOUT_EVENT)try{JSON.parse(e.payload.value.toString()).logOff&&(e=new o.InternalSuspendEvent(o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_FORCED_AUTO_LOGOUT))}catch(e){}if(e instanceof o.InternalAsyncCallEvent){let t=this.outstandingAsyncCalls.findIndex(t=>t===e.payload.id);if(-1===t)return void console.log(`QAppBase::handleEvent: async event already handled - discard result (${e.payload.type}) for metadata: ${e.payload.data.metadata}`);switch(e.payload.type){case o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_SUCCESS:e.payload.timerId&&n.clearTimeout(e.payload.timerId),this.outstandingAsyncCalls.splice(t,1),e=new E.QAppAsyncCallDoneEvent(e.payload.data);break
;case o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_FAIL:e.payload.timerId&&n.clearTimeout(e.payload.timerId),this.outstandingAsyncCalls.splice(t,1),e=new E.QAppAsyncCallFailEvent(e.payload.data);break;case o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT:this.outstandingAsyncCalls.splice(t,1),e=new E.QAppAsyncCallFailEvent(e.payload.data);break;case o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT_WITH_FETCHING_RESP:e=new E.QAppAsyncCallFailEvent(e.payload.data)}}this.qappFsm.handle(this,e.type,e)}else this.exitError("QAppBase::handleEvent - no fsm instance set, unexpectedly")}onFsmTransitionInternal(e){if(console.log("QAppBase: transition from <",e.fromState,"> to <",e.toState,"> (machina ev: <",e.action,">)"),e.fromState){let t=e.client.qappFsm.states[e.fromState]._transTo;if(t){let s=t[e.toState];s?s(e.client,e):(s=t["~"])&&s(e.client,e),(s=t["*"])&&s(e.client,e)}if(e.fromState===r.STATE_UNINITIALIZED_INTERNAL){
e.client.mqttHandler.subscribe(W.MqttTopics.METROLOGY_MAX_DIGITS),e.client.mqttHandler.subscribe(W.MqttTopics.METROLOGY_MAX_DIGITS_DEBUG),e.client.mqttHandler.subscribe(W.MqttTopics.METROLOGY_RANGES),e.client.mqttHandler.subscribe(W.MqttTopics.WEIGHING_SELECTED_DISPLAY_VALUE),e.client.mqttHandler.subscribe(W.MqttTopics.USERMANAGEMENT_AUTO_LOGOUT_EVENT),console.log("QAppBase: handle transition to custom initial state: initTaskHandler"),e.client.initTaskHandler(),console.log("QAppBase: handle transition to custom initial state: adaptTaskHandler"),e.client.adaptTaskHandler(),console.log("QAppBase: clear all task and QApp errors from messageHandler");let t=[],s=e.client.messageHandlerHelper.buildSecret(y.MESSAGE_HANDLER_SECRET_TYPE.QAPP);s&&t.push({categoryAsString:B.MessageHandlerCategory.QAPP,secret:s});let a=e.client.messageHandlerHelper.buildSecret(y.MESSAGE_HANDLER_SECRET_TYPE.QAPP_DB_ERROR);a&&t.push({categoryAsString:B.MessageHandlerCategory.QAPP,secret:a})
;let i=e.client.messageHandlerHelper.buildSecret(y.MESSAGE_HANDLER_SECRET_TYPE.QAPP_RUNTIME_COMM_ERROR);i&&t.push({categoryAsString:B.MessageHandlerCategory.QAPP,secret:i});let n=e.client.messageHandlerHelper.buildSecret(y.MESSAGE_HANDLER_SECRET_TYPE.QAPP_RUNTIME_EXIT_ERROR);n&&t.push({categoryAsString:B.MessageHandlerCategory.QAPP,secret:n});let r=void 0;void 0!==e.client.taskId&&(r=e.client.messageHandlerHelper.buildSecret(y.MESSAGE_HANDLER_SECRET_TYPE.TASKID))&&t.push({categoryAsString:B.MessageHandlerCategory.QAPP,secret:r});let o=!1;try{o=!e.client.messageHandlerProxy.deleteMessagesByCategory(t).isSuccess()}catch(e){o=!0}o&&(console.log("QAppBase: bulk call failed/not supported - use multiple messageHandler calls instead"),s&&e.client.messageHandlerProxy.deleteMessageByCategory(B.MessageHandlerCategory.QAPP,s),a&&e.client.messageHandlerProxy.deleteMessageByCategory(B.MessageHandlerCategory.QAPP,a),
i&&e.client.messageHandlerProxy.deleteMessageByCategory(B.MessageHandlerCategory.QAPP,i),n&&e.client.messageHandlerProxy.deleteMessageByCategory(B.MessageHandlerCategory.QAPP,n),r&&e.client.messageHandlerProxy.deleteMessageByCategory(B.MessageHandlerCategory.QAPP,r)),console.log("QAppBase: handle transition to custom initial state: init"),e.client.init(),console.log("QAppBase: handle transition to custom initial state: init all aspects");for(let t in e.client.aspects)console.log("init aspect: ",t),e.client.aspects[t].init(e.client);console.log("QAppBase: handle transition to custom initial state: postInit"),e.client.postInit(),console.log("QAppBase: handle transition to custom initial state: ...done")}}if(e.client.onFsmTransition(e),e.fromState===r.STATE_UNINITIALIZED_INTERNAL&&(console.log("QAppBase: publish running state of qapp"),e.client.mqttHandler.publish(W.MqttTopics.QAPP_STARTED,e.client.taskId?""+e.client.taskId:"create Task",{retain:!1})),e.toState){
let t=e.client.qappFsm.states[e.toState]._transFrom;if(t){let s=t[e.fromState];s?s(e.client,e):(s=t["~"])&&s(e.client,e),(s=t["*"])&&s(e.client,e)}}}getCurrentState(){let e=this.__machina__._qappStm_.state;return console.log("QAppBase::getCurrentState: ",e),e}onRunning(){console.log("QAppBase: default callback after QApp published RUNNING event")}restart(){this.announceRestart(),this.specificRestart(),this.onSuspending(),this.doCloseAllOverlays();for(let e of this.subscriptions)e.unsubscribe();this.heartbeatIntervalSubscription&&this.heartbeatIntervalSubscription.unsubscribe(),this.mqttHandler.unsubscribeTopics(),this.weighingProxy.clearTare1AndTare2()}announceRestart(){console.log("QAppBase: announce restart to system"),this.taskMngProxy.setTaskEvent(this.taskId?this.taskId:"---",A.EnumTaskManagementEvent.EVENT_RESTART)}specificRestart(){console.log("QAppBase: default callback before QApp restarts")}onSuspending(){
console.log("QAppBase: default callback before QApp publishes STOPPED event and exits")}onErrorExiting(e){console.log("QAppBase: default callback before QApp publishes ERROR event and aborts")}onFsmTransition(e){console.log("QAppBase: default callback for transitions")}getStorageLocation(e){let s=void 0,a=this.taskHandler.getTask();switch(e){case D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT:s=t.STORAGE_LOCATION_BASE;break;case D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC:a&&(s=this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT)+C.sep+a.qappOrderNumber);break;case D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION:a&&(s=this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC)+C.sep+a.qappVersion);break;case D.EnumPersistencyScope.PERSISTENCY_SCOPE_TASk_SPECIFIC:a&&this.taskId&&(s=this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION)+C.sep+this.taskId)}return s}
createStorageLocation(e){let t=s(24),a=this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT);if(void 0!==a){if(!t.existsSync(a))return!1;if(e!==D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT){let s=this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC);if(void 0!==s){if(t.existsSync(s)||t.mkdirSync(s),e!==D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC){let s=this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION);if(void 0!==s){if(t.existsSync(s)||t.mkdirSync(s),e!==D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION){return void 0!==this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_TASk_SPECIFIC)&&(t.existsSync(this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_TASk_SPECIFIC))||t.mkdirSync(this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_TASk_SPECIFIC)),!0)}return!0}return!1}return!0}return!1}return!0}return!1}
readQAppDescQTFAsJSON(e,t=!0){let s=void 0,a=void 0,i="";this.scriptPath?i=C.dirname(this.scriptPath)+"/../":t?this.exitError("QAppConfigBase::readQAppDescAsJSON - internal error - no scriptPath is set."):console.log("QAppConfigBase::readQAppDescAsJSON - internal error - no scriptPath is set.");let n="";try{n=i+"qapp.desc_"+e+".json",a=M.readFileSync(n)}catch(e){console.log("QAppConfigBase: - no "+n+" found - try DEFAULT");try{n=i+"qapp.desc_DEFAULT.json",a=M.readFileSync(n)}catch(e){t?this.exitError("QAppConfigBase::readQAppDescAsJSON - "+n+" (fallback) missing"):console.log("QAppConfigBase::readQAppDescAsJSON - "+n+" (fallback) missing")}}try{a&&(s=JSON.parse(a.toString("utf-8")))}catch(e){t?this.exitError("QAppConfigBase::readQAppDescAsJSON - "+n+" not valid JSON"):console.log("QAppConfigBase::readQAppDescAsJSON - "+n+" not valid JSON")}return s}relevantParamsAreEqual(e,s){let a=U.cloneJSON(e),i=U.cloneJSON(s);return a.forEach((e,s)=>{
e.id===re?delete a[s]:e.id===oe&&e.parameters.forEach((e,i)=>{e.id.startsWith(t.TASK_PROFILE_REPORTING_ID_PREFIX)?delete a[s].parameters[i]:e.id===t.TASK_PROFILE_WEIGHING_ID&&(e.info.options=[])})}),i.forEach((e,s)=>{e.id===re?delete i[s]:e.id===oe&&e.parameters.forEach((e,a)=>{e.id.startsWith(t.TASK_PROFILE_REPORTING_ID_PREFIX)?delete i[s].parameters[a]:e.id===t.TASK_PROFILE_WEIGHING_ID&&(e.info.options=[])})}),L.isEqual(a,i)}deleteDBError(){let e=this.messageHandlerHelper.buildSecret(y.MESSAGE_HANDLER_SECRET_TYPE.QAPP_DB_ERROR);e&&this.messageHandlerProxy.deleteMessageByCategory(B.MessageHandlerCategory.QAPP,e)}}t.QAppBase=le},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(3),i=s(43),n=s(17),r=s(37),o=s(0);t.QUANTITY_PARAM_MAX_DIGITS_GENERAL=9;class E{static setValue(e,s,a=0,i=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return E.setValueValueWithDecimals(e.value,s,e.value.preferredDecimals,a,i)}
static setValueValue(e,s,a=0,i=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return E.setValueValueWithDecimals(e,s,e.preferredDecimals,a,i)}static setValueWithDecimals(e,s,a,i=0,n=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return E.setValueValueWithDecimals(e.value,s,a,i,n)}static setValueValueWithDecimals(e,s,r,o=0,E=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL,_=!1){let l="number"==typeof s?s:s.value,c=E-Math.floor(Math.abs(l)).toString().length,u=Math.min(c,r);u=Math.max(u,0),0===o&&e&&(e.decimals=u);let T=i.SartoMath.roundExactToDecimals(l,u).toFixed(u);if(e){if(_||0!==o)"number"!=typeof s&&(n.isArray(e.unit)?e.unit[0]=s.unit:e.unit=s.unit);else{for(let t=a.QUANTITY_PARAM_NUMBERS_MAX-2;t>=o;t--)void 0!==e.numbers[t]&&(e.numbers[t+1]=e.numbers[t]);if("number"==typeof s){if(n.isArray(e.unit))for(let t=a.QUANTITY_PARAM_NUMBERS_MAX-2;t>=o;t--)void 0!==e.unit[t]&&(e.unit[t+1]=e.unit[t])}else if(n.isArray(e.unit)){for(let t=a.QUANTITY_PARAM_NUMBERS_MAX-2;t>=o;t--)void 0!==e.unit[t]&&(e.unit[t+1]=e.unit[t])
;e.unit[0]=s.unit}else e.unit=s.unit}e.numbers[o]=T}return T}static roundToDecimalPlaces(e,s=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return E.roundToDecimalPlacesValue(e.value,s)}static roundToDecimalPlacesAllNumbers(e,s=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return E.roundToDecimalPlacesValue(e.value,s,!0)}static roundToDecimalPlacesValue(e,s=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL,a=!1){return e.numbers.forEach((t,i)=>{(0===i||a)&&-1!==e.preferredDecimals&&E.setValueValueWithDecimals(e,parseFloat(t),e.preferredDecimals,i,s,!0)}),e.numbers.map(e=>parseFloat(e))}static getValue(e,t=0){let s,a=(s=void 0!==e.value?e.value:e).numbers[t];return void 0!==a?parseFloat(a):Number.NaN}static getIntValue(e,t=0){let s,a=(s=void 0!==e.value?e.value:e).numbers[t];return void 0!==a?parseInt(a,10):Number.NaN}static changeUnit(e,s){let a;a=void 0!==e.value?e.value:e;const i=r.unitStringToLong(a.unit);a.numbers.forEach((e,n)=>{const o=r.convertWgtUnit(parseFloat(e),i,s)
;E.setValueValueWithDecimals(a,o,a.preferredDecimals,n,t.QUANTITY_PARAM_MAX_DIGITS_GENERAL,!0)}),a.unit=r.unitStringToShort(s)}}t.QuantityParameter=E;t.WeightBlockHelper=class{static getMeasureParameter(e,t){for(const s of e.parameters)for(const e of s.parameters)if(e.id===t&&e.type===o.EnumParameterTypes.PARAM_MEASURE)return e}}},function(e,t){e.exports=require("util")},function(e,t){e.exports=require("lodash")},function(e,t){e.exports=require("mathjs")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(19),i=s(37),n=s(5),r=s(1);var o,E;function _(e,s,i){let n=t.unitsMap[E.NONE],r=t.unitsMap[E.NONE];if(null==e)return a.bignumber(NaN);if(!t.unitsMap.hasOwnProperty(s))return e;if(!t.unitsMap.hasOwnProperty(i))return e;if(n=t.unitsMap[s],r=t.unitsMap[i],n.id===r.id)return e;if(n.unitConversionBase===o.UNDEFINED||r.unitConversionBase===o.UNDEFINED||void 0==n.conversionFactor||void 0==r.conversionFactor)return e;const _=[o.MASS,o.VOLUME]
;if(!(n.unitConversionBase===r.unitConversionBase||_.includes(n.unitConversionBase)&&_.includes(r.unitConversionBase)))return e;switch(n.unitConversionBase){case o.MASS:case o.VOLUME:case o.PRESSURE:return e.times(r.conversionFactor).dividedBy(n.conversionFactor);case o.TEMPERATURE:{let t=e;switch(n.id){case E.GRAD_CELSIUS:t=e.add(273.15);break;case E.GRAD_FAHRENHEIT:t=e.sub(32).dividedBy(n.conversionFactor).add(273.15)}switch(r.id){case E.GRAD_CELSIUS:return t.sub(273.15);case E.GRAD_FAHRENHEIT:return t.sub(273.15).times(r.conversionFactor).add(32);case E.KELVIN:return t}return e}default:return e}}function l(e,t,s){let i=_(n.isNumber(e)?a.bignumber(e):e,t,s);return null==i?NaN:i.toNumber()}function c(e,t){return I(e,t).toFixed(Math.max(0,t))}function u(e,s){let a=r.cloneJSON(e);a.alibi=void 0,a.alibiId=void 0;let n=t.unitsMap[e.unit],E=t.unitsMap[s];if(n.id===E.id)return a;if(n.unitConversionBase===o.UNDEFINED||E.unitConversionBase===o.UNDEFINED)return a;const _=[o.MASS,o.VOLUME]
;return n.unitConversionBase===E.unitConversionBase||_.includes(n.unitConversionBase)&&_.includes(E.unitConversionBase)?(a.value=l(a.value,e.unit,s),a.unit=s,a.decimals=a.decimals-i.getUnitShift(e.unit)+i.getUnitShift(s),a.decimals<0&&(a.decimals=0),delete a.alibiId,a):a}function T(e){return e?t.unitsMap.hasOwnProperty(e.toString())?t.unitsMap[e].mark:e.toString():""}function A(e){const s=n.getObjectByID(Object.values(t.unitsMap),e,"mark");return null!=s?s.id:E.NONE}function p(e){let t=[];if(null==e||void 0===e)return t;if(0==e.length)return t;let s=E.NONE;for(let a=0;a<e.length;a++)n.isNumber(e[a])?t.push(e[a]):n.isObject(e[a])&&e[a].hasOwnProperty("value")&&n.isNumber(e[a].value)&&e[a].hasOwnProperty("unit")&&(s!==E.NONE?t.push(u(e[a],s).value):(t.push(e[a].value),s=e[a].unit));return t}function d(e){let t=0;if(null==e||void 0===e)return t;if(0==e.length)return t;for(let s=0;s<e.length;s++)"object"==typeof e[s]&&e[s].hasOwnProperty("decimals")&&(t=e[s].decimals>t?e[s].decimals:t)
;return t}function I(e,t){let s=a.bignumber(e),i=a.bignumber(10).pow(t);return s.times(i).round().dividedBy(i).toNumber()}function h(e){let t=p(e);return n.isObject(t)&&0!==t.length?a.sum(t):NaN}function S(e){let t=p(e);return n.isObject(e)&&0!==e.length?a.mean(t):NaN}function N(e,t){let s=[];for(let a=0;a<e.length;a++)n.isNumber(e[a].value)&&(s[a]=u(e[a],t));return{value:S(s),unit:t,decimals:d(s)}}function m(e,t){return n.isObject(e)?a.bignumber(e.value).dividedBy(t).toNumber():a.bignumber(e).dividedBy(t).toNumber()}function P(e){let t=p(e);return n.isObject(t)&&0!==t.length?a.std(t,"unbiased"):NaN}function R(e,t){let s=[];for(let a=0;a<e.length;a++)n.isNumber(e[a].value)&&(s[a]=u(e[a],t));return{value:P(s),unit:t,decimals:d(s)}}function g(e,t,s){if(e<2||!n.isNumber(t)||!n.isNumber(s))return NaN;const i=a.bignumber(1).dividedBy(a.bignumber(e).minus(1)),r=a.bignumber(s).minus(a.bignumber(t).pow(2).dividedBy(a.bignumber(e)))
;return i.isNaN()||r.isNaN()?NaN:a.sqrt(i.times(r.abs())).toNumber()}function O(e){let t=p(e);return n.isObject(t)&&0!==t.length?a.min(t):NaN}function D(e){let t=p(e);return n.isObject(t)&&0!==t.length?a.max(t):NaN}function C(e){let t=p(e);return n.isObject(t)&&0!==t.length?M(P(t),S(t)):NaN}function M(e,t){let s=0,i=0;return s=n.isObject(e)?e.value:e,i=n.isObject(t)?t.value:t,n.isObject(e)&&n.isObject(t)&&(s=u(e,t.unit).value),a.bignumber(s).dividedBy(i).times(100).toNumber()}function L(e,t,s){let i=NaN,r=NaN,o=NaN,_=E.NONE;return n.isObject(e)?(i=e.value,_=e.unit):i=e,n.isObject(t)?_!==E.NONE?r=u(t,_).value:(r=t.value,_=t.unit):r=t,n.isObject(s)?_!==E.NONE?o=u(s,_).value:(o=s.value,_=s.unit):o=s,a.bignumber(o).minus(r).dividedBy(a.bignumber(i).times(6)).toNumber()}function b(e,t,s){return{value:L(e,t,s),unit:E.NONE,decimals:3}}function f(e,t,s,i){let r=NaN,o=NaN,_=NaN,l=NaN,c=E.NONE;return n.isObject(e)?(r=e.value,c=e.unit):r=e,n.isObject(t)?c!==E.NONE?o=u(t,c).value:(o=t.value,
c=t.unit):o=t,n.isObject(s)?c!==E.NONE?_=u(s,c).value:(_=s.value,c=s.unit):_=s,n.isObject(i)?c!==E.NONE?l=u(i,c).value:(l=i.value,c=i.unit):l=i,a.min(a.bignumber(o).minus(_).dividedBy(a.bignumber(r).times(3)),a.bignumber(l).minus(o).dividedBy(a.bignumber(r).times(3))).toNumber()}function B(e,t,s,a){return{value:f(e,t,s,a),unit:E.NONE,decimals:3}}!function(e){e.UNDEFINED="UNDEFINED",e.MASS="MASS",e.TEMPERATURE="TEMPERATURE",e.PRESSURE="PRESSURE",e.VOLUME="VOLUME"}(o=t.EnumUnitType||(t.EnumUnitType={})),function(e){e.NONE="NONE",e.DIGIT="DIGIT",e.UNIVERSAL="UNIVERSAL",e.MICROGRAM="MICROGRAM",e.MILLIGRAM="MILLIGRAM",e.GRAM="GRAM",e.KILOGRAM="KILOGRAM",e.TONNE="TONNE",e.MILLICARAT="MILLICARAT",e.CARAT="CARAT",e.KILOCARAT="KILOCARAT",e.KARAT="KARAT",e.POUND="POUND",e.OUNCE="OUNCE",e.POUND_OUNCE="POUND_OUNCE",e.TROYOUNCE="TROYOUNCE",e.PENNYWEIGHT="PENNYWEIGHT",e.GRAIN="GRAIN",e.PARTS_PER_POUND="PARTS_PER_POUND",e.TAEL_HONGKONG="TAEL_HONGKONG",e.TAEL_SINGAPORE="TAEL_SINGAPORE",
e.TAEL_TAIWAN="TAEL_TAIWAN",e.TAEL_CHINA="TAEL_CHINA",e.MOMME="MOMME",e.TOLA="TOLA",e.BATH="BATH",e.MESGHAL="MESGHAL",e.NEWTON="NEWTON",e.WARNING="WARNING",e.PIECES="PIECES",e.PERCENT="PERCENT",e.MILLIMETER="MILLIMETER",e.CENTIMETER="CENTIMETER",e.METER="METER",e.KILOMETER="KILOMETER",e.GRAM_PER_MILLILITER="GRAM_PER_MILLILITER",e.MILLION_CELLS_PER_MILLILITER="MILLION_CELLS_PER_MILLILITER",e.MICROGRAM_PER_MILLILITER="MICROGRAM_PER_MILLILITER",e.MICROGRAM_PER_LITER="MICROGRAM_PER_LITER",e.MILLIGRAM_PER_MILLILITER="MILLIGRAM_PER_MILLILITER",e.MILLIGRAM_PER_LITER="MILLIGRAM_PER_LITER",e.MILLIMOL_PER_MILLILITER="MILLIMOL_PER_MILLILITER",e.GRAM_PER_CUBICCENTIMETRE="GRAM_PER_CUBICCENTIMETRE",e.CUBICCENTIMETRE="CUBICCENTIMETRE",e.SQUARECENTIMETRE="SQUARECENTIMETRE",e.SQUAREMETRE="SQUAREMETRE",e.GRAMMAGE="GRAMMAGE",e.MICROLITER="MICROLITER",e.MILLILITER="MILLILITER",e.MILLILITER_PER_SECOND="MILLILITER_PER_SECOND",e.MILLILITER_PER_MINUTE="MILLILITER_PER_MINUTE",
e.MILLILITER_PER_HOUR="MILLILITER_PER_HOUR",e.LITER="LITER",e.MILLIMOL="MILLIMOL",e.GRAD_CELSIUS="GRAD_CELSIUS",e.GRAD_FAHRENHEIT="GRAD_FAHRENHEIT",e.SECOND="SECOND",e.MINUTE="MINUTE",e.HOUR="HOUR",e.TIME_AM="TIME_AM",e.TIME_PM="TIME_PM",e.VOLT="VOLT",e.MILLIAMPER="MILLIAMPER",e.HECTOPASCAL="HECTOPASCAL",e.KILOPASCAL="KILOPASCAL",e.GRAM_PER_MOL="GRAM_PER_MOL",e.INVALID="INVALID",e.RPM="RPM",e.MILLIVOLT="MILLIVOLT",e.MILLIVOLT_PER_PH="MILLIVOLT_PER_PH",e.MICROSIEMENS_PER_CENTIMETER="MICROSIEMENS_PER_CENTIMETER",e.GRAM_PER_SQUARE_CENTIMETER="GRAM_PER_SQUARE_CENTIMETER",e.GRAM_PER_METER="GRAM_PER_METER",e.CENTILITER="CENTILITER",e.DENSITY="DENSITY",e.VOLUME="VOLUME",e.KG_M3="KG_M3",e.MMHG="MMHG",e.KELVIN="KELVIN",e.PASCAL="PASCAL"}(E=t.EnumUnit||(t.EnumUnit={})),t.unitsMap={NONE:{id:E.NONE,mark:"",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},DIGIT:{id:E.DIGIT,mark:"d",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,
conversionDecimalPlacesShift:void 0},UNIVERSAL:{id:E.UNIVERSAL,mark:"o",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MICROGRAM:{id:E.MICROGRAM,mark:"µg",unitConversionBase:o.MASS,conversionFactor:1e6,conversionDecimalPlacesShift:-6},MILLIGRAM:{id:E.MILLIGRAM,mark:"mg",unitConversionBase:o.MASS,conversionFactor:1e3,conversionDecimalPlacesShift:-3},GRAM:{id:E.GRAM,mark:"g",unitConversionBase:o.MASS,conversionFactor:1,conversionDecimalPlacesShift:0},KILOGRAM:{id:E.KILOGRAM,mark:"kg",unitConversionBase:o.MASS,conversionFactor:.001,conversionDecimalPlacesShift:3},TONNE:{id:E.TONNE,mark:"t",unitConversionBase:o.MASS,conversionFactor:1e-6,conversionDecimalPlacesShift:6},MILLICARAT:{id:E.MILLICARAT,mark:"mct",unitConversionBase:o.MASS,conversionFactor:5e3,conversionDecimalPlacesShift:-3},CARAT:{id:E.CARAT,mark:"ct",unitConversionBase:o.MASS,conversionFactor:5,conversionDecimalPlacesShift:0},KILOCARAT:{id:E.KILOCARAT,mark:"kct",
unitConversionBase:o.MASS,conversionFactor:.005,conversionDecimalPlacesShift:3},KARAT:{id:E.KARAT,mark:"K",unitConversionBase:o.MASS,conversionFactor:5,conversionDecimalPlacesShift:0},POUND:{id:E.POUND,mark:"lb",unitConversionBase:o.MASS,conversionFactor:.00220462262184878,conversionDecimalPlacesShift:3},OUNCE:{id:E.OUNCE,mark:"oz",unitConversionBase:o.MASS,conversionFactor:.0352739619495804,conversionDecimalPlacesShift:2},POUND_OUNCE:{id:E.POUND_OUNCE,mark:"lb:oz",unitConversionBase:o.MASS,conversionFactor:.035273962,conversionDecimalPlacesShift:2},TROYOUNCE:{id:E.TROYOUNCE,mark:"ozt",unitConversionBase:o.MASS,conversionFactor:.032150747,conversionDecimalPlacesShift:2},PENNYWEIGHT:{id:E.PENNYWEIGHT,mark:"dwt",unitConversionBase:o.MASS,conversionFactor:.643014931,conversionDecimalPlacesShift:1},GRAIN:{id:E.GRAIN,mark:"GN",unitConversionBase:o.MASS,conversionFactor:15.43235835,conversionDecimalPlacesShift:-1},PARTS_PER_POUND:{id:E.PARTS_PER_POUND,mark:"/lb",unitConversionBase:o.MASS,
conversionFactor:1.1287667712,conversionDecimalPlacesShift:0},TAEL_HONGKONG:{id:E.TAEL_HONGKONG,mark:"tlh",unitConversionBase:o.MASS,conversionFactor:.02671725,conversionDecimalPlacesShift:2},TAEL_SINGAPORE:{id:E.TAEL_SINGAPORE,mark:"tls",unitConversionBase:o.MASS,conversionFactor:.02645544638,conversionDecimalPlacesShift:2},TAEL_TAIWAN:{id:E.TAEL_TAIWAN,mark:"tlt",unitConversionBase:o.MASS,conversionFactor:.02666666,conversionDecimalPlacesShift:2},TAEL_CHINA:{id:E.TAEL_CHINA,mark:"tlc",unitConversionBase:o.MASS,conversionFactor:.02645547175,conversionDecimalPlacesShift:2},MOMME:{id:E.MOMME,mark:"mom",unitConversionBase:o.MASS,conversionFactor:.26666666666666666,conversionDecimalPlacesShift:1},TOLA:{id:E.TOLA,mark:"tol",unitConversionBase:o.MASS,conversionFactor:.0857333381,conversionDecimalPlacesShift:1},BATH:{id:E.BATH,mark:"bat",unitConversionBase:o.MASS,conversionFactor:.06578947436,conversionDecimalPlacesShift:2},MESGHAL:{id:E.MESGHAL,mark:"MS",unitConversionBase:o.MASS,
conversionFactor:.217,conversionDecimalPlacesShift:1},NEWTON:{id:E.NEWTON,mark:"N",unitConversionBase:o.MASS,conversionFactor:.00980665,conversionDecimalPlacesShift:2},WARNING:{id:E.WARNING,mark:"!",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},PIECES:{id:E.PIECES,mark:"pcs",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},PERCENT:{id:E.PERCENT,mark:"%",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLIMETER:{id:E.MILLIMETER,mark:"mm",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},CENTIMETER:{id:E.CENTIMETER,mark:"cm",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},METER:{id:E.METER,mark:"m",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},KILOMETER:{id:E.KILOMETER,mark:"km",unitConversionBase:o.UNDEFINED,
conversionFactor:void 0,conversionDecimalPlacesShift:void 0},GRAM_PER_MILLILITER:{id:E.GRAM_PER_MILLILITER,mark:"g/ml",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLION_CELLS_PER_MILLILITER:{id:E.MILLION_CELLS_PER_MILLILITER,mark:"10^6 cls/ml",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MICROGRAM_PER_MILLILITER:{id:E.MICROGRAM_PER_MILLILITER,mark:"µg/ml",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MICROGRAM_PER_LITER:{id:E.MICROGRAM_PER_LITER,mark:"µg/l",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLIGRAM_PER_MILLILITER:{id:E.MILLIGRAM_PER_MILLILITER,mark:"mg/ml",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLIGRAM_PER_LITER:{id:E.MILLIGRAM_PER_LITER,mark:"mg/l",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,
conversionDecimalPlacesShift:void 0},MILLIMOL_PER_MILLILITER:{id:E.MILLIMOL_PER_MILLILITER,mark:"mmol/ml",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},GRAM_PER_CUBICCENTIMETRE:{id:E.GRAM_PER_CUBICCENTIMETRE,mark:"g/cm³",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},CUBICCENTIMETRE:{id:E.CUBICCENTIMETRE,mark:"cm³",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},SQUARECENTIMETRE:{id:E.SQUARECENTIMETRE,mark:"cm²",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},SQUAREMETRE:{id:E.SQUAREMETRE,mark:"m²",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},GRAMMAGE:{id:E.GRAMMAGE,mark:"g/m²",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MICROLITER:{id:E.MICROLITER,mark:"µl",unitConversionBase:o.VOLUME,conversionFactor:1e3,
conversionDecimalPlacesShift:-3},MILLILITER:{id:E.MILLILITER,mark:"ml",unitConversionBase:o.VOLUME,conversionFactor:1,conversionDecimalPlacesShift:0},MILLILITER_PER_SECOND:{id:E.MILLILITER_PER_SECOND,mark:"ml/s",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLILITER_PER_MINUTE:{id:E.MILLILITER_PER_MINUTE,mark:"ml/min",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLILITER_PER_HOUR:{id:E.MILLILITER_PER_HOUR,mark:"ml/h",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},LITER:{id:E.LITER,mark:"l",unitConversionBase:o.VOLUME,conversionFactor:.001,conversionDecimalPlacesShift:3},MILLIMOL:{id:E.MILLIMOL,mark:"mmol",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},GRAD_CELSIUS:{id:E.GRAD_CELSIUS,mark:"°C",unitConversionBase:o.TEMPERATURE,conversionFactor:1,conversionDecimalPlacesShift:0},GRAD_FAHRENHEIT:{
id:E.GRAD_FAHRENHEIT,mark:"°F",unitConversionBase:o.TEMPERATURE,conversionFactor:1.8,conversionDecimalPlacesShift:0},SECOND:{id:E.SECOND,mark:"sec",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MINUTE:{id:E.MINUTE,mark:"min",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},HOUR:{id:E.HOUR,mark:"h",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},TIME_AM:{id:E.TIME_AM,mark:"am",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},TIME_PM:{id:E.TIME_PM,mark:"pm",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},VOLT:{id:E.VOLT,mark:"V",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLIAMPER:{id:E.MILLIAMPER,mark:"mA",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},HECTOPASCAL:{
id:E.HECTOPASCAL,mark:"hPa",unitConversionBase:o.PRESSURE,conversionFactor:.01,conversionDecimalPlacesShift:2},KILOPASCAL:{id:E.KILOPASCAL,mark:"kPa",unitConversionBase:o.PRESSURE,conversionFactor:.001,conversionDecimalPlacesShift:3},GRAM_PER_MOL:{id:E.GRAM_PER_MOL,mark:"g/mol",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},INVALID:{id:E.INVALID,mark:"!invalid!",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},RPM:{id:E.RPM,mark:"rpm",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLIVOLT:{id:E.MILLIVOLT,mark:"mV",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLIVOLT_PER_PH:{id:E.MILLIVOLT_PER_PH,mark:"mV/pH",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MICROSIEMENS_PER_CENTIMETER:{id:E.MICROSIEMENS_PER_CENTIMETER,mark:"µS/cm",unitConversionBase:o.UNDEFINED,
conversionFactor:void 0,conversionDecimalPlacesShift:void 0},GRAM_PER_SQUARE_CENTIMETER:{id:E.GRAM_PER_SQUARE_CENTIMETER,mark:"g/cm²",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},GRAM_PER_METER:{id:E.GRAM_PER_METER,mark:"g/m",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},CENTILITER:{id:E.CENTILITER,mark:"cl",unitConversionBase:o.VOLUME,conversionFactor:.1,conversionDecimalPlacesShift:1},DENSITY:{id:E.DENSITY,mark:"g/cm³",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},VOLUME:{id:E.VOLUME,mark:"cm³",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},KG_M3:{id:E.KG_M3,mark:"kg/m³",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MMHG:{id:E.MMHG,mark:"mmHg",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},KELVIN:{id:E.KELVIN,
mark:"K",unitConversionBase:o.TEMPERATURE,conversionFactor:1,conversionDecimalPlacesShift:0},PASCAL:{id:E.PASCAL,mark:"Pa",unitConversionBase:o.PRESSURE,conversionFactor:1,conversionDecimalPlacesShift:0}},t.convertValueToTargetUnitBigNumber=_,t.convertValueToTargetUnit=l,t.createQuantity=function(e,t,s){let a={value:NaN,unit:E.NONE,decimals:0};if(n.isObject(e)){a=Object.assign(a,e);for(const e of Object.keys(a))["value","unit","decimals","auxiliaryDigits","alibiId","alibi","deviceserial","stable","timestamp","info"].includes(e)||delete a[e]}else if(n.isObject(t))(t=t).value.numbers.length>0&&(a.value=parseFloat(t.value.numbers[0])),a.unit=A(t.value.unit),a.decimals=t.value.decimals;else if(n.isObject(s)){const e=(s=s).value;a.value=parseFloat(e.number),n.isNumber(a.value)||(a.info=e.number),n.isNumber(a.value)&&"-"===e.sign&&(a.value*=-1),a.decimals=e.decimals,a.unit=A(e.unit),a.stable=e.isStable,n.isNumber(e.auxiliaryDigits)&&e.auxiliaryDigits>0&&(a.auxiliaryDigits=e.auxiliaryDigits)}
return a.unit=n.setEnumSafely(a.unit,E,E.NONE),a},t._formatQuantityParam_numberOnly=c,t.formatQuantityParam_numberOnly=function(e){return null!==e&&e.hasOwnProperty("value")&&e.hasOwnProperty("decimals")?n.isNumber(e.value)?c(e.value,e.decimals):"NaN":"N.A."},t.formatQuantityParam=function(e){return null!==e&&e.hasOwnProperty("value")&&e.hasOwnProperty("unit")&&e.hasOwnProperty("decimals")?n.isNumber(e.value)?c(e.value,e.decimals)+" "+T(e.unit):"NaN":"N.A."},t.convertToTargetUnit=u,t.getUnitString=T,t.getUnitEnum=A,t.math_getSimple_numberArray=p,t.math_count=function(e){return p(e).length},t.math_getMaximumDecimals=d,t.math_roundUp=function(e,t){let s=a.bignumber(e),i=s.minus(s.floor()),n=(i=i.times(a.bignumber(10).pow(t))).minus(i.floor());return a.larger(n,0)&&(i=i.minus(n).add(1)),i=i.dividedBy(a.bignumber(10).pow(t)),s.floor().add(i).toNumber()},t.math_roundAuto=I,t.math_detectLeastSignificantDigit=function(e){let t=0,s=1,i=a.bignumber(e).abs(),n=i.floor(),r=i.minus(n)
;for(;r.greaterThan(0);)t++,n=(r=r.times(10)).floor(),r=r.minus(n);return t>0&&(s=n.dividedBy(a.bignumber(10).pow(t)).toNumber()),s},t.math_sum=h,t.math_Sum=function(e,t){let s=[];for(let a=0;a<e.length;a++)n.isNumber(e[a].value)&&(s[a]=u(e[a],t));return{value:h(s),unit:t,decimals:d(s)}},t.math_mean=S,t.math_Mean=N,t.math_mean_longterm=m,t.math_Mean_Longterm=function(e,t,s){const a=u(e,s);return a.value=m(a,t),a},t.math_standard_deviation=P,t.math_Standard_Deviation=R,t.math_standard_deviation_longterm=g,t.math_Standard_Deviation_Longterm=function(e,t,s,a){return u({value:g(e,(t=u(t,s.unit)).value,s.value),unit:s.unit,decimals:s.decimals},a)},t.math_minimum=O,t.math_Minimum=function(e,t){let s=[];for(let a=0;a<e.length;a++)n.isNumber(e[a].value)&&(s[a]=u(e[a],t));return{value:O(s),unit:t,decimals:d(s)}},t.math_maximum=D,t.math_Maximum=function(e,t){let s=[];for(let a=0;a<e.length;a++)n.isNumber(e[a].value)&&(s[a]=u(e[a],t));return{value:D(s),unit:t,decimals:d(s)}},
t.math_variation_coefficient=C,t.math_Variation_Coefficient=function(e){let t=[];for(let s=0;s<e.length;s++)n.isNumber(e[s].value)&&(t[s]=u(e[s],E.GRAM));return{value:C(t),unit:E.PERCENT,decimals:2}},t.math_variation_coefficient_longterm=M,t.math_Variation_Coefficient_Longterm=function(e,t){return{value:M(u(e,t.unit),t),unit:E.PERCENT,decimals:2}},t.math_cp=function(e,t,s){let a=p(e);return n.isObject(e)&&0!==e.length?L(P(a),t,s):NaN},t.math_Cp=function(e,t,s){return b(R(e,t.unit),t,s)},t.math_cp_longterm=L,t.math_Cp_Longterm=b,t.math_cpk=function(e,t,s){return f(P(e),S(e),t,s)},t.math_Cpk=function(e,t,s){return B(R(e,t.unit),N(e,t.unit),t,s)},t.math_cpk_longterm=f,t.math_Cpk_Longterm=B},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(29),i=s(20),n=s(5),r=s(40),o=s(0),E=s(19),_=s(16),l=s(1),c=s(3);var u,T,A,p,d,I,h,S,N,m;function P(e){let t={validDataset:!1,databaseId:-1,productId:"",prodTestType:p.PHARMACOPOEIA,autoZero:u.ENABLED,
prodType:A.TABLET,dynamicTolerances:u.ENABLED,countTarget:20,preferredUnit:i.EnumUnit.GRAM,prodWgtTarget:i.createQuantity({value:0,unit:i.EnumUnit.GRAM,decimals:_.QUANTITY_PARAM_MAX_DIGITS_GENERAL-1}),prodTolerance1:i.createQuantity({value:5,unit:i.EnumUnit.PERCENT,decimals:2}),prodTolerance2:i.createQuantity({value:10,unit:i.EnumUnit.PERCENT,decimals:2}),prodTolerancePlausibility:i.createQuantity({value:35,unit:i.EnumUnit.PERCENT,decimals:2}),prodToleranceThresholdMin:i.createQuantity({value:20,unit:i.EnumUnit.PERCENT,decimals:2}),calculationMode:T.FROM_TOTAL_MEAN};return n.isObject(e)&&n.overwriteExistingAttributes(e,t),t}function R(e){const t=i.convertToTargetUnit(e.prodWgtTarget,i.EnumUnit.GRAM);switch(e.prodType){case A.TABLET:if(E.bignumber(t.value).lessThanOrEqualTo(.08))return e.prodTolerance1.value=10,void(e.prodTolerance2.value=20);if(E.bignumber(t.value).greaterThan(.08)&&E.bignumber(t.value).lessThan(.25))return e.prodTolerance1.value=7.5,void(e.prodTolerance2.value=15)
;if(E.bignumber(t.value).greaterThanOrEqualTo(.25))return e.prodTolerance1.value=5,void(e.prodTolerance2.value=10);break;case A.CAPSULE:case A.POWDER:if(E.bignumber(t.value).lessThan(.3))return e.prodTolerance1.value=10,void(e.prodTolerance2.value=20);if(E.bignumber(t.value).greaterThanOrEqualTo(.3))return e.prodTolerance1.value=7.5,void(e.prodTolerance2.value=15)}e.prodTolerance1.value=0,e.prodTolerance2.value=0}function g(e){let t={counter:-1,sampleIDs:[],weight:i.createQuantity({value:NaN,unit:i.EnumUnit.NONE,decimals:0}),evaluation:I.PENDING,timestamp:r.getDateTime("isoTimezone"),invalidated:!1,invalidationReason:""};return n.isObject(e)&&n.overwriteExistingAttributes(e,t),t}function O(e,t){let s={databaseId:-1,get lotId(){return n.isObject(this.lotIDs[0])?this.lotIDs[0].value:""},set lotId(e){n.isObject(this.lotIDs[0])||(this.lotIDs[0]={title:"",header:"",value:"",automaticManipulation:a.EnumIdentifierAutoManipulation.NONE}),this.lotIDs[0].value=e},lotIDs:[],product:P(t),
status:S.ACTIVE,timeStart:r.getDateTime("isoTimezone",void 0,0),timeEnd:r.getDateTime("isoTimezone",void 0,0),numberOfTests:0,counters:{minimumOoP:0,minimum2:0,minimum1:0,passed:0,maximum1:0,maximum2:0,maximumOoP:0,totalPlausible:0,totalOoP:0,totalOoT:0,invalidated:0},statistics:{sum:i.createQuantity({value:0,unit:i.EnumUnit.GRAM,decimals:0}),squareSum:i.createQuantity({value:0,unit:i.EnumUnit.GRAM,decimals:10}),mean:i.createQuantity({value:NaN,unit:i.EnumUnit.GRAM,decimals:0}),stddev:i.createQuantity({value:NaN,unit:i.EnumUnit.GRAM,decimals:0}),varcoeff:i.createQuantity({value:NaN,unit:i.EnumUnit.PERCENT,decimals:2}),minimum:i.createQuantity({value:1/0,unit:i.EnumUnit.GRAM,decimals:0}),maximum:i.createQuantity({value:-1/0,unit:i.EnumUnit.GRAM,decimals:0}),range:i.createQuantity({value:0,unit:i.EnumUnit.GRAM,decimals:0}),dispersion:{unit:i.EnumUnit.NONE,decimals:0,levels:[]}},sumCapsuleWeights:i.createQuantity({value:0,unit:i.EnumUnit.GRAM,decimals:0}),
sumVesselWeights:i.createQuantity({value:0,unit:i.EnumUnit.GRAM,decimals:0}),get meanCapsuleWeights(){const e=l.cloneJSON(this.sumCapsuleWeights);return this.numberOfTests<=0?(e.value=0,e):(e.value=E.bignumber(e.value).dividedBy(this.numberOfTests).toNumber(),e)},set meanCapsuleWeights(e){},get meanVesselWeights(){const e=l.cloneJSON(this.sumVesselWeights);return this.numberOfTests<=0?(e.value=0,e):(e.value=E.bignumber(e.value).dividedBy(this.numberOfTests).toNumber(),e)},set meanVesselWeights(e){}};return n.isObject(e)&&(n.overwriteExistingAttributes(e,s),s.product=P(s.product)),s}function D(e){for(let t=0;t<e.levels.length;t++)for(let s=0;s<e.levels[t].breakpoints.length;s++){let a=e.levels[t].breakpoints[s];const n={value:a.minimum.value+(a.maximum.value-a.minimum.value)/2,unit:e.unit,decimals:e.decimals};a.label=i.formatQuantityParam_numberOnly(n),
0===t&&0===s?a.label="<"+i.formatQuantityParam_numberOnly(a.maximum):t===e.levels.length-1&&s===e.levels[t].breakpoints.length-1&&(a.label=">="+i.formatQuantityParam_numberOnly(a.minimum))}}t.QAPP_ID="QAPP002",t.OBJECT_STYLE_VERSION_PRODUCTS="1",t.MINIMUM_LOT_IDS=1,t.MAXIMUM_LOT_IDS=5,t.MINIMUM_SAMPLE_IDS=0,t.MAXIMUM_SAMPLE_IDS=5,t.MAXIMUM_SHIFT_COUNT=4,t.MAXIMUM_COUNT_PRODUCTS=500,t.MAXIMUM_COUNT_BATCHES=100,t.MAXIMUM_COUNT_PROCESSES_PER_BATCH=500,t.taskConfig_GUI_paramGroupMain="main",t.taskConfig_GUI_paramGroupPrintSamples="printsamples",t.taskConfig_GUI_paramGroupPrintStatistics="printstatistics",t.taskConfig_GUI_paramGroupShifts="shifts",t.taskConfig_GUI_paramReferences={supervisorRoles:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupMain)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"supervisorRoles",autoTakeover:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupMain)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"autoTakeover",
autoTakeoverMinload:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupMain)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"autoTakeoverMinload",enableQuicktest:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupMain)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"enableQuicktest",processBufferAutoDelete:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupMain)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"processBufferAutoDelete",printSamples:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupPrintSamples)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"printSamples",printFormatForSamples:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupPrintSamples)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"printFormatForSamples",printSamplesIndex:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupPrintSamples)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"printSamplesIndex",printSamplesEvaluation:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupPrintSamples)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"printSamplesEvaluation",
printTestEvaluation:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupPrintSamples)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"printTestEvaluation",printEvaluationCounters:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupPrintStatistics)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"printEvaluationCounters",printStatistics:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupPrintStatistics)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"printStatistics",printStatisticsCounter:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupPrintStatistics)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"printStatisticsCounter",printStatisticsMean:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupPrintStatistics)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"printStatisticsMean",printStatisticsStdDev:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupPrintStatistics)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"printStatisticsStdDev",
printStatisticsVarCoeff:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupPrintStatistics)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"printStatisticsVarCoeff",printStatisticsSum:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupPrintStatistics)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"printStatisticsSum",printStatisticsMinMax:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupPrintStatistics)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"printStatisticsMinMax",printStatisticsRange:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupPrintStatistics)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"printStatisticsRange",shiftsCount:a.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupShifts)+"/"+a.DYNAMIC_PARAMID_PREQUEL+"shiftsCount"},t.getSelectionListSIDmanipulators=function(){let e=[];for(let t of[a.EnumIdentifierAutoManipulation.NONE,a.EnumIdentifierAutoManipulation.INCREMENT,a.EnumIdentifierAutoManipulation.DECREMENT])e.push({id:t,text:{id:a.EnumMapIdentifierAutoManipulation[t],args:[]},
appearance:o.EnumAppearance.ENABLED});return e},t.getSelectionListBooleanOnOff=function(){let e=[];for(let s of[u.ENABLED,u.DISABLED])e.push({id:s,text:{id:t.EnumMapBooleanOnOff[s],args:[]},appearance:o.EnumAppearance.ENABLED});return e},t.getSelectionListBooleanYesNo=function(){let e=[];for(let s of[u.ENABLED,u.DISABLED])e.push({id:s,text:{id:t.EnumMapBooleanYesNo[s],args:[]},appearance:o.EnumAppearance.ENABLED});return e},t.getSelectionListBooleanAvailability=function(){let e=[];for(let s of[u.ENABLED,u.DISABLED])e.push({id:s,text:{id:t.EnumMapBooleanAvailability[s],args:[]},appearance:o.EnumAppearance.ENABLED});return e},t.getSelectionListBooleanTestResultFiFoDeletion=function(){let e=[];for(let s of[u.ENABLED,u.DISABLED])e.push({id:s,text:{id:t.EnumMapBooleanTestResultFiFoDeletion[s],args:[]},appearance:o.EnumAppearance.ENABLED});return e},t.getSelectionListShifts=function(){let e=[];for(let t of[1,2,3,4])e.push({id:t.toFixed(0),text:{id:t.toFixed(0),args:[]},
appearance:o.EnumAppearance.ENABLED});return e},t.getSelectionListPrintFormatSample=function(){let e=[];for(let s of[d.STANDARD,d.COMPACT])e.push({id:s,text:{id:t.EnumMapPrintFormatSample[s],args:[]},appearance:o.EnumAppearance.ENABLED});return e},function(e){e.ENABLED="ENABLED",e.DISABLED="DISABLED"}(u=t.EnumBoolean||(t.EnumBoolean={})),t.EnumMapBooleanOnOff={[u.ENABLED]:"_QAPP002_PARAMVAL_ON",[u.DISABLED]:"_QAPP002_PARAMVAL_OFF"},t.EnumMapBooleanYesNo={[u.ENABLED]:"_QAPP002_PARAMVAL_YES",[u.DISABLED]:"_QAPP002_PARAMVAL_NO"},t.EnumMapBooleanAvailability={[u.ENABLED]:"_QAPP002_PARAMVAL_QUICKTEST_ENABLED",[u.DISABLED]:"_QAPP002_PARAMVAL_QUICKTEST_DISABLED"},t.EnumMapBooleanTestResultFiFoDeletion={[u.ENABLED]:"_QAPP002_PARAMVAL_PROCESS_FIFO_DELETION_AUTOMATIC",[u.DISABLED]:"_QAPP002_PARAMVAL_PROCESS_FIFO_DELETION_CONFIRMATION"},function(e){e.FROM_TOTAL_MEAN="FROM_TOTAL_MEAN",e.AFTER_EACH_SAMPLE="AFTER_EACH_SAMPLE"}(T=t.EnumCalculationMode||(t.EnumCalculationMode={})),
t.EnumMapCalculationMode={[T.FROM_TOTAL_MEAN]:"_QAPP_WF_CALC_MODE_OPTION_FROM_TOTAL_MEAN",[T.AFTER_EACH_SAMPLE]:"_QAPP_WF_CALC_MODE_OPTION_AFTER_EACH_SAMPLE"},function(e){e.TABLET="TABLET",e.CAPSULE="CAPSULE",e.POWDER="POWDER"}(A=t.EnumProductType||(t.EnumProductType={})),t.EnumMapProductType={[A.TABLET]:"_QAPP_WF_PRODUCT_TYPE_OPTION_TABLET",[A.CAPSULE]:"_QAPP_WF_PRODUCT_TYPE_OPTION_CAPSULE",[A.POWDER]:"_QAPP_WF_PRODUCT_TYPE_OPTION_POWDER"},function(e){e.USER_DEFINED="USER_DEFINED",e.PHARMACOPOEIA="PHARMACOPOEIA"}(p=t.EnumProductTestType||(t.EnumProductTestType={})),t.EnumMapProductTestType={[p.USER_DEFINED]:"_QAPP002_PARAMVAL_PRODUCT_TEST_TYPE_USER_DEFINED",[p.PHARMACOPOEIA]:"_QAPP002_PARAMVAL_PRODUCT_TEST_TYPE_PHARMACOPOEIA"},function(e){e.STANDARD="STANDARD",e.COMPACT="COMPACT"}(d=t.EnumPrintFormatSample||(t.EnumPrintFormatSample={})),t.EnumMapPrintFormatSample={[d.STANDARD]:"_QAPP002_PARAMVAL_PRINT_FORMAT_SAMPLE_STANDARD",[d.COMPACT]:"_QAPP002_PARAMVAL_PRINT_FORMAT_SAMPLE_COMPACT"
},function(e){e.PENDING="PENDING",e.INVALID="INVALID",e.MIN2_VIOLATION="MIN2_VIOLATION",e.MIN1_VIOLATION="MIN1_VIOLATION",e.OK="OK",e.MAX1_VIOLATION="MAX1_VIOLATION",e.MAX2_VIOLATION="MAX2_VIOLATION"}(I=t.EnumSampleResultStatus||(t.EnumSampleResultStatus={})),t.EnumMapSampleResultStatus={[I.PENDING]:"_QAPP002_PRINTLABEL_SINGLE_VALUE_PENDING",[I.INVALID]:"INV",[I.MIN2_VIOLATION]:"_QAPP002_PRINTLABEL_SINGLE_VALUE_MIN2_VIOLATION",[I.MIN1_VIOLATION]:"_QAPP002_PRINTLABEL_SINGLE_VALUE_MIN1_VIOLATION",[I.OK]:"_QAPP002_PRINTLABEL_STAT_PASSED",[I.MAX1_VIOLATION]:"_QAPP002_PRINTLABEL_SINGLE_VALUE_MAX1_VIOLATION",[I.MAX2_VIOLATION]:"_QAPP002_PRINTLABEL_SINGLE_VALUE_MAX2_VIOLATION"},function(e){e.ENTER_FREE_VALUE="ENTER_FREE_VALUE",e.WEIGH_MEAN_10_10_30="WEIGH_10_10_30",e.WEIGH_MEAN_LAST_4="WEIGH_MEAN_LAST_4",e.WEIGH_MEAN_FREE_NUMBER="WEIGH_MEAN_FREE_NUMBER"}(h=t.EnumEmptyCapsuleWeightDetermination||(t.EnumEmptyCapsuleWeightDetermination={})),t.EnumMapEmptyCapsuleWeightDetermination={
[h.ENTER_FREE_VALUE]:"_QAPP002_PARAMVAL_EMPTY_CAPSWEIGHT_ENTER_FREE",[h.WEIGH_MEAN_10_10_30]:"_QAPP002_PARAMVAL_EMPTY_CAPSWEIGHT_WEIGH_10_10_30",[h.WEIGH_MEAN_LAST_4]:"_QAPP002_PARAMVAL_EMPTY_CAPSWEIGHT_WEIGH_MEAN_LAST_4",[h.WEIGH_MEAN_FREE_NUMBER]:"_QAPP002_PARAMVAL_EMPTY_CAPSWEIGHT_WEIGH_MEAN_FREE"},function(e){e.ACTIVE="ACTIVE",e.ARCHIVED="ARCHIVED"}(S=t.EnumBatchStatus||(t.EnumBatchStatus={})),function(e){e.PENDING="PENDING",e.ACTIVE="ACTIVE",e.PAUSED="PAUSED",e.FINISHED="FINISHED"}(N=t.EnumProcessStatus||(t.EnumProcessStatus={})),function(e){e.MIN_INF_VIOLATION="MIN_INF_VIOLATION",e.MIN4_VIOLATION="MIN4_VIOLATION",e.MIN3_VIOLATION="MIN3_VIOLATION",e.MIN2_VIOLATION="MIN2_VIOLATION",e.MIN1_VIOLATION="MIN1_VIOLATION",e.OK="OK",e.MAX1_VIOLATION="MAX1_VIOLATION",e.MAX2_VIOLATION="MAX2_VIOLATION",e.MAX3_VIOLATION="MAX3_VIOLATION",e.MAX4_VIOLATION="MAX4_VIOLATION",e.MAX_INF_VIOLATION="MAX_INF_VIOLATION"}(m=t.EnumToleranceViolation||(t.EnumToleranceViolation={})),
t.createConfig=function(e){let t={supervisorRoles:[],enableQuicktest:u.ENABLED,sampleIDs:[],lotIDs:[],autoTakeover:u.ENABLED,autoTakeoverMinload:i.createQuantity({value:10,unit:i.EnumUnit.DIGIT,decimals:0}),processBufferAutoDelete:u.ENABLED,printSamples:u.ENABLED,printFormatForSamples:d.STANDARD,printSamplesIndex:u.ENABLED,printSamplesEvaluation:u.ENABLED,printTestEvaluation:u.ENABLED,printEvaluationCounters:u.ENABLED,printStatistics:u.ENABLED,printStatisticsCounter:u.ENABLED,printStatisticsMean:u.ENABLED,printStatisticsStdDev:u.ENABLED,printStatisticsVarCoeff:u.ENABLED,printStatisticsSum:u.ENABLED,printStatisticsMinMax:u.ENABLED,printStatisticsRange:u.ENABLED,shiftsCount:1,shifts:[]};return n.isObject(e)&&n.overwriteExistingAttributes(e,t),t},t.createProduct=P,t.createProduct_fromPreviousDBstyle=function(e){e.userEnteredId=n.isString(e.userEnteredId)?e.userEnteredId:"Migration import",e.testMode=n.isString(e.testMode)?e.testMode:"test Pharmacopoeia",
e.calculationMode=n.isString(e.calculationMode)?e.calculationMode:"fromTotalMean",e.type=n.isString(e.type)?e.type:"tablet",e.dynamicTolerance=n.isString(e.dynamicTolerance)?e.dynamicTolerance:"yes";let t={validDataset:!1,databaseId:-1,productId:e.userEnteredId,prodTestType:"test Pharmacopoeia"===e.testMode?p.PHARMACOPOEIA:p.USER_DEFINED,autoZero:u.ENABLED,prodType:"tablet"===e.type?A.TABLET:"capsule"===e.type?A.CAPSULE:A.POWDER,dynamicTolerances:"yes"===e.dynamicTolerance?u.ENABLED:u.DISABLED,countTarget:20,preferredUnit:i.EnumUnit.GRAM,prodWgtTarget:i.createQuantity({value:0,unit:i.EnumUnit.GRAM,decimals:_.QUANTITY_PARAM_MAX_DIGITS_GENERAL-1}),prodTolerance1:i.createQuantity({value:5,unit:i.EnumUnit.PERCENT,decimals:2}),prodTolerance2:i.createQuantity({value:10,unit:i.EnumUnit.PERCENT,decimals:2}),prodTolerancePlausibility:i.createQuantity({value:35,unit:i.EnumUnit.PERCENT,decimals:2}),prodToleranceThresholdMin:i.createQuantity({value:20,unit:i.EnumUnit.PERCENT,decimals:2}),
calculationMode:"fromTotalMean"===e.calculationMode?T.FROM_TOTAL_MEAN:T.AFTER_EACH_SAMPLE};try{let s=JSON.parse(e.noOfSamplesPD?e.noOfSamplesPD:"{}");n.isObject(s)&&n.isObject(s.numbers)&&s.numbers.length>0&&(t.countTarget=parseInt(s.numbers[0]))}catch(e){}try{let s=JSON.parse(e.nominalValue?e.nominalValue:"{}");if(n.isObject(s)&&n.isObject(s.numbers)&&s.numbers.length>0){let e=c.createEmptyQuantityParameter();e.value=s,t.prodWgtTarget=i.createQuantity(void 0,e)}}catch(e){}try{let s=JSON.parse(e.minTolerance?e.minTolerance:"{}");if(n.isObject(s)&&n.isObject(s.numbers)&&s.numbers.length>0){let e=c.createEmptyQuantityParameter();e.value=s,t.prodTolerance1=i.createQuantity(void 0,e),t.prodTolerance1.decimals=2}}catch(e){}try{let s=JSON.parse(e.maxTolerance?e.maxTolerance:"{}");if(n.isObject(s)&&n.isObject(s.numbers)&&s.numbers.length>0){let e=c.createEmptyQuantityParameter();e.value=s,t.prodTolerance2=i.createQuantity(void 0,e),t.prodTolerance2.decimals=2}}catch(e){}try{
let s=JSON.parse(e.plausibility?e.plausibility:"{}");if(n.isObject(s)&&n.isObject(s.numbers)&&s.numbers.length>0){let e=c.createEmptyQuantityParameter();e.value=s,t.prodTolerancePlausibility=i.createQuantity(void 0,e),t.prodTolerancePlausibility.decimals=2}}catch(e){}return t},t.verifyProduct=function(e,t){return e.validDataset=!0,0===e.countTarget&&(e.validDataset=!1),e.prodWgtTarget.value<=0&&(e.validDataset=!1),e.prodWgtTarget=i.convertToTargetUnit(e.prodWgtTarget,e.preferredUnit),e.prodWgtTarget.decimals=E.max(0,_.QUANTITY_PARAM_MAX_DIGITS_GENERAL-1-E.bignumber(e.prodWgtTarget.value).trunc().toFixed(0).length),e.prodWgtTarget.value=i.math_roundAuto(e.prodWgtTarget.value,e.prodWgtTarget.decimals),e.prodTestType===p.PHARMACOPOEIA&&(!1===t&&(e.countTarget=20),R(e)),
0<=e.prodTolerance1.value&&e.prodTolerance1.value<e.prodTolerance2.value&&e.prodTolerance2.value<=100&&e.prodTolerancePlausibility.value<100-e.prodTolerance2.value&&e.prodToleranceThresholdMin.value<e.prodTolerancePlausibility.value||(e.validDataset=!1),e.validDataset},t.determineProductTolerancesPharamcopoeia=R,t.createSample=g,t.createBatchShort=function(){return{databaseId:-1,lotId:"",product:{databaseId:-1,productId:""},status:S.ACTIVE,timeStart:r.getDateTime("isoTimezone",void 0,0),timeEnd:r.getDateTime("isoTimezone",void 0,0)}},t.createBatch=O,t.createProcessShort=function(){return{isQuicktest:!0,sequenceNumber:0,databaseId:-1,databaseReferenceBatchFk:-1,lotId:"",databaseReferenceProductFk:-1,status:N.PENDING,timeStart:r.getDateTime("isoTimezone",void 0,0),timeEnd:r.getDateTime("isoTimezone",void 0,0)}},t.createProcess=function(e,t){let s=-1,a="",o=-1,E=20,l=i.createQuantity({value:0,unit:i.EnumUnit.GRAM,decimals:_.QUANTITY_PARAM_MAX_DIGITS_GENERAL-1});if(n.isObject(t)){
const e=O(t),i=P(e.product);s=e.databaseId,a=e.lotId,o=e.product.databaseId,E=i.countTarget,l=i.prodWgtTarget}let c={isQuicktest:!0,sequenceNumber:0,databaseId:-1,databaseReferenceBatchFk:s,lotId:a,databaseReferenceProductFk:o,status:N.PENDING,emptyCapsuleWeightDetermination:h.WEIGH_MEAN_10_10_30,emptyCapsuleWeight:i.createQuantity(),actualCountTarget:E,currSmplIndex:0,vessel:i.createQuantity(),samples:[],counters:{minimumOoP:0,minimum2:0,minimum1:0,passed:0,maximum1:0,maximum2:0,maximumOoP:0,totalPlausible:0,totalOoP:0,totalOoT:0,invalidated:0},appliedTolerances:{minimumThreshold:i.createQuantity({value:NaN,unit:l.unit,decimals:l.decimals}),minimumOop:i.createQuantity({value:NaN,unit:l.unit,decimals:l.decimals}),minimum2:i.createQuantity({value:NaN,unit:l.unit,decimals:l.decimals}),minimum1:i.createQuantity({value:NaN,unit:l.unit,decimals:l.decimals}),target:i.createQuantity({value:NaN,unit:l.unit,decimals:l.decimals}),maximum1:i.createQuantity({value:NaN,unit:l.unit,
decimals:l.decimals}),maximum2:i.createQuantity({value:NaN,unit:l.unit,decimals:l.decimals}),maximumOop:i.createQuantity({value:NaN,unit:l.unit,decimals:l.decimals})},statistics:{sum:i.createQuantity({value:NaN,unit:l.unit,decimals:l.decimals}),squareSum:{value:0,unit:i.EnumUnit.GRAM,decimals:10},mean:i.createQuantity({value:NaN,unit:l.unit,decimals:l.decimals}),stddev:i.createQuantity({value:NaN,unit:l.unit,decimals:l.decimals}),varcoeff:i.createQuantity({value:NaN,unit:i.EnumUnit.PERCENT,decimals:2}),minimum:i.createQuantity({value:NaN,unit:l.unit,decimals:l.decimals}),maximum:i.createQuantity({value:NaN,unit:l.unit,decimals:l.decimals}),range:i.createQuantity({value:NaN,unit:l.unit,decimals:l.decimals}),dispersion:{unit:l.unit,decimals:l.decimals,levels:[]}},timeStart:r.getDateTime("isoTimezone",void 0,0),timeEnd:r.getDateTime("isoTimezone",void 0,0),resultText:""};if(n.isObject(e)){n.overwriteExistingAttributes(e,c);for(let e=0;e<c.samples.length;e++)c.samples[e]=g(c.samples[e])}
return c},t.initializeDispersionDataset=function(e,t,s,a,r){const o={0:m.OK,1:m.MIN1_VIOLATION,2:m.MIN2_VIOLATION,3:m.MIN3_VIOLATION,4:m.MIN4_VIOLATION},E={0:m.MAX1_VIOLATION,1:m.MAX2_VIOLATION,2:m.MAX3_VIOLATION,3:m.MIN4_VIOLATION};e.levels=[],e.unit=t,e.decimals=s;let _={ok:0,oot:0};if(0!==a.length&&0!==r.length){1===a.length&&1===r.length?_={ok:18,oot:0}:(a.length>1||r.length>1)&&(_={ok:5,oot:Math.floor(13/(a.length+r.length-2))});for(let t=0;t<a.length;t++){let s=i.convertToTargetUnit(a[t],e.unit).value,E=0,l=0;n.isObject(a[t+1])?(E=i.convertToTargetUnit(a[t+1],e.unit).value,l=_.oot):(E=i.convertToTargetUnit(r[0],e.unit).value,l=_.ok);const c=(E-s)/l,u={toleranceLevel:o.hasOwnProperty(a.length-1-t)?o[a.length-1-t]:m.MIN_INF_VIOLATION,breakpoints:[]};for(let t=1;t<=l;t++){const a={label:"",counter:0,minimum:{value:s+c*(t-1),unit:e.unit,decimals:e.decimals},maximum:{value:E-c*(l-t),unit:e.unit,decimals:e.decimals},checkForMinimum:1!==t,checkForMaximum:t!==l};u.breakpoints.push(a)}
e.levels.push(u)}for(let t=0;t<r.length-1&&n.isObject(r[t+1]);t++){let s=i.convertToTargetUnit(r[t],e.unit).value,a=i.convertToTargetUnit(r[t+1],e.unit).value,n=_.oot;const o=(a-s)/n,l={toleranceLevel:E.hasOwnProperty(t)?E[t]:m.MAX_INF_VIOLATION,breakpoints:[]};for(let t=1;t<=n;t++){const a={label:"",counter:0,minimum:{value:s+o*(t-1),unit:e.unit,decimals:e.decimals},maximum:{value:s+o*t,unit:e.unit,decimals:e.decimals},checkForMinimum:1!==t,checkForMaximum:t!==n};l.breakpoints.push(a)}e.levels.push(l)}D(e)}},t.determineDispersionClassification=function(e,t,s){const a=i.convertToTargetUnit(t.weight,e.unit);for(let i=0;i<e.levels.length;i++){let n=!1;if(!0===s)switch(t.evaluation){case I.MIN2_VIOLATION:n=e.levels[i].toleranceLevel===m.MIN2_VIOLATION;break;case I.MIN1_VIOLATION:n=e.levels[i].toleranceLevel===m.MIN1_VIOLATION;break;case I.OK:n=e.levels[i].toleranceLevel===m.OK;break;case I.MAX1_VIOLATION:n=e.levels[i].toleranceLevel===m.MAX1_VIOLATION;break;case I.MAX2_VIOLATION:
n=e.levels[i].toleranceLevel===m.MAX2_VIOLATION}else switch(t.evaluation){case I.MIN2_VIOLATION:case I.MIN1_VIOLATION:case I.OK:case I.MAX1_VIOLATION:case I.MAX2_VIOLATION:n=!0}if(!0===n)for(let t=0;t<e.levels[i].breakpoints.length;t++){const s=e.levels[i].breakpoints[t];if(s.checkForMinimum&&s.checkForMaximum&&a.value>=s.minimum.value&&a.value<s.maximum.value||!s.checkForMinimum&&a.value<s.maximum.value||!s.checkForMaximum&&a.value>=s.minimum.value)return void e.levels[i].breakpoints[t].counter++}}},t.applyDispersionUnit=function(e,t,s){e.unit=t,e.decimals=s;for(let t=0;t<e.levels.length;t++)for(let s=0;s<e.levels[t].breakpoints.length;s++){let a=e.levels[t].breakpoints[s];a.minimum=i.convertToTargetUnit(a.minimum,e.unit),a.minimum.decimals=e.decimals,a.maximum=i.convertToTargetUnit(a.maximum,e.unit),a.maximum.decimals=e.decimals}D(e)},t.applyDispersionLabels=D,t.getSortedNumberKeys=function(e){let t=[];for(const s of Object.keys(e))t.push(parseInt(s));return t=t.sort(function(e,t){
return e-t})}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(1);t.AbstractQAppAspect=class{configure(e){this.cfg=Object.assign(void 0!==this.cfg?this.cfg:{},e)}getConfig(){return a.cloneJSON(this.cfg)}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TASK_DYNAMIC_ID_GROUPS_PREFIX="TASK/DYNAMIC_ID",t.TASK_DYNAMIC_ID_CNT_GROUP_ID=t.TASK_DYNAMIC_ID_GROUPS_PREFIX+"_CNT",t.TASK_DYNAMIC_ID_LID_GROUP_ID=t.TASK_DYNAMIC_ID_GROUPS_PREFIX+"_LID",t.TASK_DYNAMIC_ID_SID_GROUP_ID=t.TASK_DYNAMIC_ID_GROUPS_PREFIX+"_SID",t.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID=t.TASK_DYNAMIC_ID_GROUPS_PREFIX+"_DB_CONN_CONFIG",t.TASK_DYNAMIC_ID_LID_CNT_PARAM_ID=t.TASK_DYNAMIC_ID_CNT_GROUP_ID+"/LID_CNT",t.TASK_DYNAMIC_ID_LID_X_PARAM_ID_PREFIX=t.TASK_DYNAMIC_ID_LID_GROUP_ID+"/LID_",t.TASK_DYNAMIC_ID_LID_X_PARAM_ID_SUFFIX_HEADER="H_",t.TASK_DYNAMIC_ID_LID_X_PARAM_ID_SUFFIX_TITLE="T_",t.TASK_DYNAMIC_ID_LID_CNT_MIN=0,t.TASK_DYNAMIC_ID_LID_CNT_MAX=5,
t.TASK_DYNAMIC_ID_SID_CNT_PARAM_ID=t.TASK_DYNAMIC_ID_CNT_GROUP_ID+"/SID_CNT",t.TASK_DYNAMIC_ID_SID_X_PARAM_ID_PREFIX=t.TASK_DYNAMIC_ID_SID_GROUP_ID+"/SID_",t.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_HEADER="H_",t.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_TITLE="T_",t.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_MODE="M_",t.TASK_DYNAMIC_ID_SID_CNT_MIN=0,t.TASK_DYNAMIC_ID_SID_CNT_MAX=5,t.TASK_DYNAMIC_ID_DB_TYPES_PARAM_ID=t.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/TYPES",t.TASK_DYNAMIC_ID_DB_USERNAME_PARAM_ID=t.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/USERNAME",t.TASK_DYNAMIC_ID_DB_PASSWORD_PARAM_ID=t.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/PASSWORD",t.TASK_DYNAMIC_ID_DB_DATABASE_PARAM_ID=t.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/DATABASE",t.TASK_DYNAMIC_ID_DB_SCHEMA_PARAM_ID=t.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/SCHEMA",t.TASK_DYNAMIC_ID_DB_IP_PARAM_ID=t.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/IP",t.TASK_DYNAMIC_ID_DB_PORT_PARAM_ID=t.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/PORT",
t.TASK_DYNAMIC_ID_CNT_OPTION_PREFIX="CNT_",function(e){e.POSTGRES="postgres",e.MYSQL="mysql",e.MSSQL="mssql",e.SQLITE="sqlite"}(t.EnumDatabaseTypesOptions||(t.EnumDatabaseTypesOptions={})),function(e){e.OFF="OFF",e.ON="ON"}(t.EnumLotIdentifierOptions||(t.EnumLotIdentifierOptions={})),function(e){e.OFF="OFF",e.ON="ON",e.ON_AUTO_INC="ON_AUTO_INC",e.ON_AUTO_DEC="ON_AUTO_DEC"}(t.EnumSampleIdentifierOptions||(t.EnumSampleIdentifierOptions={})),t.createIDCntOption=function(e){return t.TASK_DYNAMIC_ID_CNT_OPTION_PREFIX+e.toFixed(0)},t.getConfiguredIds=function(e){return parseInt(e.value.selection.id.replace(t.TASK_DYNAMIC_ID_CNT_OPTION_PREFIX,""),10)},t.createLIDParamId=function(e,s){return t.TASK_DYNAMIC_ID_LID_X_PARAM_ID_PREFIX+s+e.toFixed(0)},t.createSIDParamId=function(e,s){return t.TASK_DYNAMIC_ID_SID_X_PARAM_ID_PREFIX+s+e.toFixed(0)}},function(e,t){e.exports=require("fs")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(3),i=s(1),n=s(2);class r{
constructor(e,t){this.publishedId="",this.publishPending=!0,this.parameter=t,this.publishedId=n.MqttTopics.QAPP_PARAMETERS_TOPIC_PREAMBLE+"/"+this.parameter.id,this.mqttHandler=e,this.publish()}getId(){return this.parameter.id}getPublishedId(){return this.publishedId}setValue(e){this.parameter=e,this.publish()}getValue(){return this.parameter}setParamId(e,t=!0){(this.parameter.id!==e||this.publishPending)&&(this.parameter.id=e,t?this.publish():this.publishPending=!0)}setParamAppearance(e,t=!0){(this.parameter.appearance!==e||this.publishPending)&&(this.parameter.appearance=e,t?this.publish():this.publishPending=!0)}setParamType(e,t=!0){(this.parameter.type!==e||this.publishPending)&&(this.parameter.type=e,t?this.publish():this.publishPending=!0)}setParamTitle(e,t=!0){(this.parameter.title.id!==e.id||this.parameter.title.args.join("")!==e.args.join("")||this.publishPending)&&(this.parameter.title=e,t?this.publish():this.publishPending=!0)}setParamHeader(e,t=!0){
(this.parameter.header.id!==e.id||this.parameter.header.args.join("")!==e.args.join("")||this.publishPending)&&(this.parameter.header=e,t?this.publish():this.publishPending=!0)}publish(){if(this.publishPending=!1,a.isTypeOfIPasswordParameter(this.parameter)){let e=i.cloneJSON(this.parameter);e.info.passwordLength=e.value.string.length,e.value.string="",this.mqttHandler.publish(this.publishedId,JSON.stringify(e))}else this.mqttHandler.publish(this.publishedId,JSON.stringify(this.parameter))}}t.Param=r,t.default=r},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EV_MQTT_UPDATE="EV_MQTT_UPDATE";class a{constructor(e){this.payload=e,this.type=t.EV_MQTT_UPDATE}}t.MqttUpdateEvent=a,t.EV_MQTT_UPDATE_DEBUG="EV_MQTT_UPDATE_DEBUG";t.MqttUpdateDebugEvent=class extends a{constructor(){super(...arguments),this.type=t.EV_MQTT_UPDATE_DEBUG}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EV_HMI_BTN_CLICKED="EV_HMI_BTN_CLICKED",
t.EV_HMI_PARAM_CHANGED="EV_HMI_PARAM_CHANGED",t.EV_HMI_PARAM_DETAIL="EV_HMI_PARAM_DETAIL",t.EV_REST_REQUEST="EV_REST_REQUEST";const a=s(44);t.HmiButtonClickedEvent=class{constructor(e){this.payload=e,this.type=t.EV_HMI_BTN_CLICKED}};t.HmiParamChangedEvent=class{constructor(e){this.payload=e,this.type=t.EV_HMI_PARAM_CHANGED}};t.HmiParamDetailEvent=class{constructor(e){this.payload=e,this.type=t.EV_HMI_PARAM_DETAIL}};t.RestRequestEvent=class{constructor(e){this.payload=e,this.type=t.EV_REST_REQUEST}},t.getParamsForRestRequestEvent=function(e){return new a.URL("http://127.0.0.1/"+e.payload.subUrl).searchParams}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(35),i=s(3),n=s(50),r=s(15),o=s(79),E="_QAPP_MSG_HANDLER_",_="_TITLE",l="_REASON",c="_SOLUTION";var u;function T(e){return e+"_"+a.MESSAGEHANDLER_OK_BTN_ID}!function(e){e.TASKID="TASKID",e.QAPP="QAPP",e.QAPP_DB_ERROR="QAPP_DB_ERROR",e.QAPP_RUNTIME_COMM_ERROR="QAPP_RUNTIME_COMM_ERROR",
e.QAPP_RUNTIME_EXIT_ERROR="QAPP_RUNTIME_EXIT_ERROR",e.MANUAL="MANUAL"}(u=t.MESSAGE_HANDLER_SECRET_TYPE||(t.MESSAGE_HANDLER_SECRET_TYPE={})),function(e){e.ERR_702_ACTION_LIMIT="ERR_702",e.ERR_703_ACTION_LIMIT="ERR_703",e.INFO_USERCAL_CAL_OVERALL_PASSED="INFO_USERCAL_CAL_OVERALL_PASSED",e.INFO_USERCAL_ERROR_NO_INVALIDATION="INFO_USERCAL_ERROR_NO_INVALIDATION",e.ERR_704_UNIT_UNAVAILABLE="ERR_704",e.ERR_710_STARLIMS_WARN_LIMIT="ERR_710",e.INFO_STARLIMS_CAL_OVERALL_PASSED="INFO_STARLIMS_CAL_OVERALL_PASSED",e.ERR_711_STARLIMS_WEIGHING_SERIAL="ERR_711",e.ERR_712_STARLIMS_CAL_SERIAL="ERR_712",e.ERR_713_STARLIMS_WEIGHING_PARAM="ERR_713",e.ERR_714_STARLIMS_CAL_PARAM="ERR_714",e.ERR_715_STARLIMS_ERROR_RESPONSE="ERR_715",e.ERR_716_STARLIMS_NO_CONNECTION="ERR_716",e.ERR_717_STARLIMS_USER_AUTORIZED="ERR_717",e.ERR_718_STARLIMS_NOT_IN_SERVICE="ERR_718",e.ERR_790_GENERIC_DB_ERROR="ERR_790",e.ERR_791_DB_MIGRATION_RUNTIME_ERROR="ERR_791",e.ERR_792_DB_CONN_WORKFLOW_ERROR="ERR_792",
e.ERR_793_DB_OPERATION_TIMEOUT_ERROR="ERR_793",e.ERR_794_DB_MIGRATION_UNSUPPORTED_ERROR="ERR_794",e.ERR_795_DB_MIGRATION_FAILED_ERROR="ERR_795",e.ERR_796_DB_CONN_LOST_ERROR="ERR_796",e.ERR_797_DB_CONN_CONFWORKFLOW_ERROR="ERR_797",e.ERR_798_GENERIC_EXTERNAL_COMM_ERROR="ERR_798",e.ERR_799_GENERIC_INTERNAL_ERROR="ERR_799"}(t.EMsgHandlerMsgs||(t.EMsgHandlerMsgs={})),t.getMessageHandlerOkButtonId=T,t.isMessageHandlerOkButton=function(e){return e.endsWith(a.MESSAGEHANDLER_OK_BTN_ID)};const A={ERR_702:{errorCode:702,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.USER_CAL,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_EXPLICIT_DELETION,secretType:u.MANUAL},ERR_703:{errorCode:703,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.WARNING,category:a.MessageHandlerCategory.USER_CAL,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.MANUAL},INFO_USERCAL_CAL_OVERALL_PASSED:{errorCode:0,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.INFORMATION,
category:a.MessageHandlerCategory.USER_CAL,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.MANUAL},INFO_USERCAL_ERROR_NO_INVALIDATION:{errorCode:0,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.USER_CAL,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.MANUAL},ERR_704:{errorCode:704,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.TASKID},ERR_710:{errorCode:710,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.WARNING,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.MANUAL},INFO_STARLIMS_CAL_OVERALL_PASSED:{errorCode:0,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.INFORMATION,category:a.MessageHandlerCategory.QAPP,
lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.MANUAL},ERR_711:{errorCode:711,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.MANUAL},ERR_712:{errorCode:712,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.MANUAL},ERR_713:{errorCode:713,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.MANUAL},ERR_714:{errorCode:714,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.MANUAL},ERR_715:{errorCode:715,
type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.MANUAL},ERR_716:{errorCode:716,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.MANUAL},ERR_717:{errorCode:717,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.MANUAL},ERR_718:{errorCode:718,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.MANUAL},ERR_790:{errorCode:790,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,
lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.QAPP_DB_ERROR,buttons:[a.createMessageHandlerButton(T(790))]},ERR_791:{errorCode:791,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.QAPP_DB_ERROR,buttons:[a.createMessageHandlerButton(T(791))]},ERR_792:{errorCode:792,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.QAPP_DB_ERROR,buttons:[a.createMessageHandlerButton(T(792))]},ERR_793:{errorCode:793,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.QAPP_DB_ERROR,buttons:[a.createMessageHandlerButton(T(793))]},ERR_794:{errorCode:794,
type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.QAPP_DB_ERROR,buttons:[a.createMessageHandlerButton(T(794))]},ERR_795:{errorCode:795,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.QAPP_DB_ERROR,buttons:[a.createMessageHandlerButton(T(795))]},ERR_796:{errorCode:796,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.QAPP_DB_ERROR,buttons:[a.createMessageHandlerButton(T(796))]},ERR_797:{errorCode:797,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.QAPP_DB_ERROR,
buttons:[a.createMessageHandlerButton(T(797))]},ERR_798:{errorCode:798,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.QAPP_RUNTIME_COMM_ERROR},ERR_799:{errorCode:799,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:u.QAPP_RUNTIME_EXIT_ERROR}};t.MessageHandlerHelper=class{constructor(e){this.messageHandlerProxy=e}buildSecret(e){switch(e){case u.TASKID:return r.QAppBase.clientSingleton.getTaskId();case u.QAPP:return r.QAppBase.clientSingleton.getQAppOrderNumber();case u.QAPP_DB_ERROR:return r.QAppBase.clientSingleton.getQAppOrderNumber()+u.QAPP_DB_ERROR;case u.QAPP_RUNTIME_COMM_ERROR:return r.QAppBase.clientSingleton.getQAppOrderNumber()+u.QAPP_RUNTIME_COMM_ERROR;case u.QAPP_RUNTIME_EXIT_ERROR:
return r.QAppBase.clientSingleton.getQAppOrderNumber()+u.QAPP_RUNTIME_EXIT_ERROR;case u.MANUAL:default:return}}addMessage(e,t,s,a){console.log(`messageHandlerHelper::addMessage: ${e}`);let u=i.createEmptyTextStructure(),T=i.createEmptyTextStructure(),p=i.createEmptyTextStructure(),d=0;0===A[e].errorCode?(u.id=E+e+_,T.id=E+e+l,p.id=E+e+c):d=A[e].errorCode;let I=[];for(799!==A[e].errorCode&&798!==A[e].errorCode||I.push(r.QAppBase.clientSingleton.getQAppOrderNumber()),790!==A[e].errorCode&&791!==A[e].errorCode&&792!==A[e].errorCode&&793!==A[e].errorCode&&794!==A[e].errorCode&&795!==A[e].errorCode&&796!==A[e].errorCode&&797!==A[e].errorCode||(I.push(r.QAppBase.clientSingleton.getQAppOrderNumber()),I.push(r.QAppBase.clientSingleton.getQAppVersion())),void 0!==t&&("string"==typeof t?(I.push("Error"),I.push(t)):n.isError(t)?o.isHttpRestError(t)?(I.push(`${t.name} (HTTP(s)/${t.statusCode})`),I.push(t.message)):(I.push(t.name),I.push(t.message)):I.push(...t));I.length<4;)I.push("");T.args=I
;let h=this.buildSecret(A[e].secretType);return void 0!==h&&(s=h),console.log(`messageHandlerHelper::addMessage: add msg handler msg ${d} with secret ${s}`),this.messageHandlerProxy.addMessage(d,A[e].type,A[e].category,A[e].lifetime,u,T,p,s||"",a||(A[e].buttons?A[e].buttons:void 0),A[e].showMessageInFutureSeconds?A[e].showMessageInFutureSeconds:void 0)}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(8),i=s(47),n=s(1),r=s(7),o=s(5),E=s(0),_=s(46),l=s(81),c=s(45),u=s(4),T=s(20);function A(e){return o.isNumber(e)&&(e=e.toFixed(0)),t.DYNAMIC_PARAMID_PREQUEL+"CONFIG_SCREEN"+e}function p(e,t){o.isString(t)||(t="_"),t=t,!1!==o.isString(e)&&0!==e.length||(e=t);let s=new RegExp(/[^0-9A-Za-z._-]+/g),a=new RegExp(/[\/\?<>\\:\*\|"]/g),i=new RegExp(/[\x00-\x1f\x80-\x9f]/g),n=new RegExp(/^\.+$/),r=new RegExp(/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i),E=new RegExp(/[\. ]+$/)
;return(e=(e=(e=(e=(e=(e=e.replace(s,t)).replace(a,t)).replace(i,t)).replace(n,t)).replace(r,t)).replace(E,t)).length>255&&(e=e.substring(0,255)),e}function d(e){if(t.fs.existsSync(e))if(t.fs.lstatSync(e).isDirectory()){let a=t.fs.readdirSync(e,{encoding:"utf8",withFileTypes:!1});for(var s=0;s<a.length;s++)d(t.path.join(e,a[s]));t.fs.rmdirSync(e)}else t.fs.unlinkSync(e)}var I;function h(e){let t={title:"",header:"",value:"",automaticManipulation:I.NONE};return o.isObject(e)&&(t=Object.assign(t,e)),t}function S(e,t,s){let a={method:t,params:s},i=JSON.stringify(a),n=["http://127.0.0.1:8080/rest/"+e,"-H","Accept:application/json","-H","Content-Type:application/json","-H","Expect:","--data","@-"],o=_.spawnSync("curl",n,{input:i}),E=new r.CubisRestResponse(!1);try{E=new r.CubisRestResponse(o)}catch(e){E.rawReturns=e}return E}function N(e,t,s){return a.__awaiter(this,void 0,void 0,function*(){let a=c;return"https"===e&&(a=l),new Promise(function(e,i){let n=a.request(t,function(t){let s=[]
;t.on("data",function(e){s.push(e)}),t.on("end",function(){try{e({headers:t.headers,url:t.url,statusCode:t.statusCode,body:Buffer.concat(s)})}catch(e){i(e)}})});n.on("error",function(e){i(e)}),n.on("timeout",function(){n.abort(),i("Request timeout")}),s&&n.write(s),n.end()})})}function m(e){let t={unit:T.EnumUnit.NONE,decimals:0,d:0,e:0,max:0,min:0,extended:{d:T.createQuantity(),e:T.createQuantity(),max:T.createQuantity(),min:T.createQuantity()},ranges:{1:{d:T.createQuantity(),e:T.createQuantity(),max:T.createQuantity(),min:T.createQuantity()}},activeRangeIndex:"1"};return o.isObject(e)&&o.overwriteExistingAttributes(e,t),t}t.fs=s(24),t.path=s(51),t.DYNAMIC_PARAMID_PREQUEL="TASK/DYNAMIC_",t.sortKeys=function(e){if(!1===o.isObject(e))return[];let t=[];t=Array.isArray(e)?e:Object.keys(e);let s=[],a=[],i=[];for(let e=0;e<t.length;e++)o.isNumber(Number(t[e]))?s.push(t[e]):o.isString(t[e])?a.push(t[e]):i.push(t[e]);return a=a.sort(),i=i.sort(),(s=(s=s.sort(function(e,t){
return Number(e)-Number(t)})).concat(a)).concat(i)},t.determineNearestNumberInArray=function(e,t){for(let s=0;s<t.length;s++)if(e<t[s])return s<=0?s:e<=t[s]-(t[s]-t[s-1])/2?s-1:s;return t.length-1},t.loadWorkstate_DATA_CONTAINER=function(e){let t=void 0;if(!o.isString(e))return t;let s=S("task/management",u.RestMethodsTASK_MANAGEMENT.getWorkstate,{id:e,workstate:{}});try{t=(t=JSON.parse(s.rawReturns.workstate).workstate).DATA_CONTAINER}catch(e){t=void 0}return t},t.storeWorkstate_DATA_CONTAINER=function(e,t){if(!o.isString(e))return new r.CubisRestResponse(!1);let s={DATA_CONTAINER:t};return S("task/management",u.RestMethodsTASK_MANAGEMENT.saveWorkstate,{id:e,workstate:s})},t.loadTaskConfig_DATA_CONTAINER=function(e){let s=e.getGroup(A(54321));if(void 0===s)return;let a=[],i=A(54321)+"/"+t.DYNAMIC_PARAMID_PREQUEL+"DATA_CONTAINER_";for(let e=0;e<s.parameters.length;e++)if(s.parameters[e].type===E.EnumParameterTypes.PARAM_STRING&&s.parameters[e].id.startsWith(i)){
let t=parseInt(s.parameters[e].id.substring(i.length));o.isNumber(t)&&(a[t]=s.parameters[e].value.string)}try{return JSON.parse(a.join())}catch(e){return}},t.storeTaskConfig_DATA_CONTAINER=function(e,s,a){let i=e.getGroup(A(54321));if(a=!!o.isBoolean(a)&&a,void 0===i&&(e.addDynamicGroup({id:A(54321),type:E.EnumParameterTypes.PARAM_GROUP,appearance:E.EnumAppearance.HIDDEN,title:{id:"",args:[]},parameters:[]}),i=e.getGroup(A(54321))),void 0===i)return new r.CubisRestResponse(!1);i.parameters=[];let n=JSON.stringify(s),_=0,l=0;for(;_<n.length;){(l=_+1e5)>n.length&&(l=n.length);let s={id:A(54321)+"/"+t.DYNAMIC_PARAMID_PREQUEL+"DATA_CONTAINER_"+i.parameters.length.toFixed(0),type:E.EnumParameterTypes.PARAM_STRING,appearance:E.EnumAppearance.HIDDEN,title:{id:"",args:[]},header:{id:"",args:[]},value:{string:n.substring(_,l)},info:{minimum:{length:0},maximum:{length:1e5}}};_=l,i.parameters.push(s),e.updateParameter(s)}return!1===a?S("task/management",u.RestMethodsTASK_MANAGEMENT.updateTask,{
task:JSON.stringify(e.getTask()),errorList:[]}):new r.CubisRestResponse(!0)},t.get_taskConfig_paramGroupID=A,t.getCompliantFilename=p,t.checkFileNameCompliancy=function(e,t){if(p(e)!==e)return!1;t=void 0!==t?t:[];for(let s=0;s<t.length;s++)if(e.includes(t[s]))return!1;return!0},t.getCreateTaskSpecificFolder=function(e,s){let a="",n=e.getTask(),r=e.getParameter("TASK/IDENTIFICATION/NAME"),o=t.fs.readdirSync(s,{encoding:"utf8",withFileTypes:!1}),E=new i.TaskProxy,_=[];try{_=E.getTaskNamesByOrderNumber(n.qappOrderNumber)}catch(e){}for(var l=0;l<o.length;l++)if(o[l].toString().startsWith("_RENAME_TASK_ID_")&&o[l].toString().endsWith(".json")){var c=t.fs.readFileSync(t.path.join(s,o[l]),"utf8");(u=JSON.parse(c))&&u.taskname&&u.foldername&&!_.includes(u.taskname)&&(d(t.path.join(s,u.foldername)),d(t.path.join(s,o[l])))}else if(o[l].toString().startsWith("_TASK_"))try{E.readTask(o[l].toString().substring("_TASK_".length))}catch(e){d(t.path.join(s,o[l]))}if(null==n._id||""==n._id){
let e=Date.now(),i={taskname:r.value.string,foldername:"_RENAME_TASK_ID_"+e};t.fs.writeFileSync(t.path.join(s,"_RENAME_TASK_ID_"+e+".json"),JSON.stringify(i)),a=t.path.join(s,"_RENAME_TASK_ID_"+e)}else for(a=t.path.join(s,"_TASK_"+n._id),l=0;l<o.length;l++)if(o[l].toString().startsWith("_RENAME_TASK_ID_")&&o[l].toString().endsWith(".json")){var u;c=t.fs.readFileSync(t.path.join(s,o[l]),"utf8"),(u=JSON.parse(c))&&u.taskname&&u.foldername&&u.taskname==r.value.string&&(t.fs.existsSync(t.path.join(s,u.foldername))?t.fs.existsSync(a)?(d(t.path.join(s,u.foldername)),d(t.path.join(s,o[l]))):(t.fs.renameSync(t.path.join(s,u.foldername),a),d(t.path.join(s,o[l]))):d(t.path.join(s,o[l])))}return t.fs.existsSync(a)||t.fs.mkdirSync(a),a},t.deleteFileFolderRecursive=d,t.createFolder=function(e){t.fs.existsSync(e)||t.fs.mkdirSync(e)},function(e){e.NONE="NONE",e.INCREMENT="INCREMENT",e.DECREMENT="DECREMENT"}(I=t.EnumIdentifierAutoManipulation||(t.EnumIdentifierAutoManipulation={})),
t.EnumMapIdentifierAutoManipulation={[I.NONE]:"_QAPP_LIB_PARAM_SELECT_OPTION_SID_ON",[I.INCREMENT]:"_QAPP_LIB_PARAM_SELECT_OPTION_SID_ON_AUTO_INC",[I.DECREMENT]:"_QAPP_LIB_PARAM_SELECT_OPTION_SID_ON_AUTO_DEC"},t.getLotIDsParameterID=function(e){o.isNumber(e)||(e=1),e=e;const s=A("_RESERVED_LOT_ID_SETTINGS");return{paramGroupID:s,settingsLockedInfo:s+"/"+t.DYNAMIC_PARAMID_PREQUEL+"RESERVED_LOT_ID_settingsLocked",mainCounter:s+"/"+t.DYNAMIC_PARAMID_PREQUEL+"RESERVED_LOT_ID_counter",header:s+"/"+t.DYNAMIC_PARAMID_PREQUEL+"RESERVED_LOT_ID_"+e.toFixed(0)+"_header",title:s+"/"+t.DYNAMIC_PARAMID_PREQUEL+"RESERVED_LOT_ID_"+e.toFixed(0)+"_title"}},t.getSampleIDsParameterID=function(e){o.isNumber(e)||(e=1),e=e;const s=A("_RESERVED_SAMPLE_ID_SETTINGS");return{paramGroupID:s,settingsLockedInfo:s+"/"+t.DYNAMIC_PARAMID_PREQUEL+"RESERVED_SAMPLE_ID_settingsLocked",mainCounter:s+"/"+t.DYNAMIC_PARAMID_PREQUEL+"RESERVED_SAMPLE_ID_counter",
header:s+"/"+t.DYNAMIC_PARAMID_PREQUEL+"RESERVED_SAMPLE_ID_"+e.toFixed(0)+"_header",title:s+"/"+t.DYNAMIC_PARAMID_PREQUEL+"RESERVED_SAMPLE_ID_"+e.toFixed(0)+"_title",manipulator:s+"/"+t.DYNAMIC_PARAMID_PREQUEL+"RESERVED_SAMPLE_ID_"+e.toFixed(0)+"_manipulator"}},t.createStandardIdentifier=h,t.preManipulateIdentifier=function(e){let t=h();void 0!==e&&(t=n.cloneJSON(e));let s=void 0,a=0;const i=/\d*$/,r=t.value.match(i);switch(null!=r&&r.length>0&&o.isString(r[0])&&(a=r[0].length,s=parseInt(r[0])),t.automaticManipulation){case I.INCREMENT:""===t.value?t.value="001":""===t.value||o.isNumber(s)?""!==t.value&&o.isNumber(s)&&(s++,t.value=t.value.replace(i,s.toFixed(0).padStart(a,"0"))):t.value+="-2";break;case I.DECREMENT:""!==t.value&&o.isNumber(s)&&s>0&&(s--,t.value=t.value.replace(i,s.toFixed(0).padStart(a,"0")))}return t},t.perform_InternalWebserviceRequest=S,t.perform_WebserviceRequest=function(e,t,s,i,n,r,E,_,u,T,A){return a.__awaiter(this,void 0,void 0,function*(){
o.isNumber(t)||(t="http"===s?80:443),o.isNumber(A)||(A=1e4);let a,p={hostname:e,port:t,path:n,method:i,followRedirects:!1,headers:r,timeout:A};u&&T&&(p.auth=u+":"+T),p.agent="https"===s?new l.Agent({host:e,keepAlive:!0,rejectUnauthorized:!1,port:t}):new c.Agent({keepAlive:!0}),E&&void 0!==E&&(_=JSON.stringify(E)),_&&(p.headers["content-length"]=Buffer.byteLength(_));try{a=yield N(s,p,_).then(e=>({isSuccess:!0,error:"",statusCode:e.statusCode,headers:e.headers,body:e.body,url:e.url,metadata:n}))}catch(e){return{isSuccess:!1,error:e?e.toString():"",statusCode:0,headers:{},body:void 0,url:p.hostname+p.path,metadata:n}}return a})},t.httpRequest=N,t.getConfiguredPrintProfiles=function(){let e=[];const t=S("profilemanagement",u.RestMethodsPROFILE_MANAGEMENT.getProfiles,{filter:'[{"type":{"ne":"WEIGHING_PROFILE_NAME"}}]',rProfiles:{}});if(t.isSuccess()&&o.isString(t.rawReturns.rProfiles)){const s=JSON.parse(t.rawReturns.rProfiles.toString());for(let t=0;t<s.data.length;t++){
const a=o.getObjectByID(s.data[t].params,"PROFILE/IDENTIFICATION","id");if(o.isObject(a)&&o.isObject(a.parameters)){const i=o.getObjectByID(a.parameters,"PROFILE/IDENTIFICATION/NAME","id");o.isObject(i)&&o.isObject(i.value)&&e.push({id:s.data[t]._id,type:s.data[t].type,title:i.value.string})}}}return e},t.createMetrology=m,t.getMetrology=function(e){let t=m(),s=S("weighing",u.RestMethodsWEIGHING.getParameter,{id:"WEIGHING/METROLOGY/RANGE",rObject:{}}),a="";if(s.isSuccess()&&s.hasOwnProperty("rawReturns")&&s.rawReturns.hasOwnProperty("rObject")&&(s=JSON.parse(s.rawReturns.rObject))&&s.hasOwnProperty("id")&&s.hasOwnProperty("parameters")){let e=o.getObjectByID(s.parameters,"WEIGHING/METROLOGY/RANGE/MAXIMUM");e&&(a=e.value.numbers[0])}const i=S("weighing",u.RestMethodsWEIGHING.getRangeParameters,{parameters:{}});if(!(i.isSuccess()&&i.hasOwnProperty("rawReturns")&&i.rawReturns.hasOwnProperty("parameters")))return t;const n=JSON.parse(i.rawReturns.parameters)
;if(!(n.hasOwnProperty("list")&&Array.isArray(n.list)&&n.list.length>0))return t;const r=o.getObjectByID(n.list,"WEIGHING/METROLOGY/RANGES");if(!o.isObject(r))return t;t.ranges={};for(let s of Object.values(r.parameters)){if(!o.isString(s.id)||!o.isObject(s.parameters))continue;let i="";const n=s.id.split("/");if(0===(i=n[n.length-1]).length)continue;const r={d:T.createQuantity(),e:T.createQuantity(),max:T.createQuantity(),min:T.createQuantity()};let E=o.getObjectByID(s.parameters,"WEIGHING/METROLOGY/RANGES/"+i+"/INTERVAL");E&&(r.d.value=parseFloat(E.value.numbers[0]),r.d.decimals=E.value.decimals,r.d.unit=T.getUnitEnum(E.value.unit.toString())),(E=o.getObjectByID(s.parameters,"WEIGHING/METROLOGY/RANGES/"+i+"/PRECISION"))&&(r.e.value=parseFloat(E.value.numbers[0]),r.e.decimals=E.value.decimals,r.e.unit=T.getUnitEnum(E.value.unit.toString())),(E=o.getObjectByID(s.parameters,"WEIGHING/METROLOGY/RANGES/"+i+"/MINIMUM"))&&(r.min.value=parseFloat(E.value.numbers[0]),
r.min.decimals=E.value.decimals,r.min.unit=T.getUnitEnum(E.value.unit.toString())),(E=o.getObjectByID(s.parameters,"WEIGHING/METROLOGY/RANGES/"+i+"/MAXIMUM"))&&(r.max.value=parseFloat(E.value.numbers[0]),r.max.decimals=E.value.decimals,r.max.unit=T.getUnitEnum(E.value.unit.toString()),a===E.value.numbers[0]&&(t.activeRangeIndex=i)),void 0===e&&(e=r.d.unit),r.d=T.convertToTargetUnit(r.d,e),r.e=T.convertToTargetUnit(r.e,e),r.e.decimals=r.d.decimals,r.min=T.convertToTargetUnit(r.min,e),r.min.decimals=r.d.decimals,r.max=T.convertToTargetUnit(r.max,e),r.max.decimals=r.d.decimals,t.ranges[i]=r}t.extended.d.value=1/0,t.extended.e.value=1/0,t.extended.min.value=1/0,t.extended.max.value=-1/0;for(let e of Object.values(t.ranges))e.d.value<t.extended.d.value&&(t.extended.d=e.d),e.e.value<t.extended.e.value&&(t.extended.e=e.e),e.min.value<t.extended.min.value&&(t.extended.min=e.min),e.max.value>t.extended.max.value&&(t.extended.max=e.max);return t.unit=t.extended.d.unit,
t.decimals=t.extended.d.decimals,t.d=t.extended.d.value,t.e=t.extended.e.value,t.min=t.extended.min.value,t.max=t.extended.max.value,t},t.get_device_roles=function(){let e=S("user",u.RestMethodsUSER_MANAGEMENT.getListRoles,{list:{},start:0,end:-1}),t=[];try{let s=JSON.parse(e.rawReturns.list).data;for(let e=0;e<s.length;e++)t.push({id:s[e]._id,name:o.getObjectByID(s[e].params,"ROLE/NAME").value.string,editable:s[e].editable,locked:s[e].locked})}catch(e){}return t},t.get_device_user=function(){let e={id:"",name:"",display_name:"",description:"",role_id:"",role_name:""},t=S("access",u.RestMethodsACCESS_MANAGEMENT.getCurrentUser,{user:""});try{let s=JSON.parse(t.rawReturns.user);e.id=s._id;let a=o.getObjectByID(s.params,"USER/SETTINGS");e.name=o.getObjectByID(a.parameters,"USER/SETTINGS/LOGINNAME").value.string,e.display_name=o.getObjectByID(a.parameters,"USER/SETTINGS/NAME").value.string,e.description=o.getObjectByID(a.parameters,"USER/SETTINGS/DESCRIPTION").value.string,
e.role_id=o.getObjectByID(a.parameters,"USER/SETTINGS/ROLES").value.selection.id,e.role_name=o.getObjectByID(a.parameters,"USER/SETTINGS/ROLES").value.selection.text.id}catch(e){}return e},t.EnumMapUnit=null,t.harmonizeWeightParam=function(e){},t.tryAssign_taskParameter_to_IQuantity=function(e,t,s){},t.tryAssign_IQuantity_to_taskParameter=function(e,t,s){}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CONNECTION_ASPECT="CONNECTION_ASPECT",t.STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE="STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE",function(e){e[e.MIGRATION_NEEDED=0]="MIGRATION_NEEDED",e[e.MIGRATION_NOT_NEEDED=1]="MIGRATION_NOT_NEEDED",e[e.MIGRATION_NOT_POSSIBLE=2]="MIGRATION_NOT_POSSIBLE",e[e.MIGRATION_DONE=3]="MIGRATION_DONE",e[e.MIGRATION_FAILED=4]="MIGRATION_FAILED"}(t.EMigrationResult||(t.EMigrationResult={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const a=s(8),i=s(15),n=s(6),r=s(5),o=s(10),E=s(17),_=s(12),l=s(55),c=s(56),u=s(57),T=s(21),A=s(30);function p(e,t){return a.__awaiter(this,void 0,void 0,function*(){const s=[l.DB_TABLE_NAME_PRODUCTS,c.DB_TABLE_NAME_BATCH,u.DB_TABLE_NAME_TESTPROCESS,l.DB_TABLE_NAME_PRODUCTS_1,l.DB_TABLE_NAME_PRODUCTS_2];let n=h();const o=yield function(e,t){return a.__awaiter(this,void 0,void 0,function*(){return new Promise(function(s,a){e.getTables(t).then(e=>{const a=e;let i=[];try{for(let s=0;s<a.length;s++)if(r.isString(a[s].name)){const a=e[s].name.split(".");t.includes(a[a.length-1])&&i.push(a[a.length-1])}}catch(e){}s(i)}).catch(e=>{console.log("Get table list failed"),i.dbg(e),s([])})})})}(t,s);if(o.includes(l.DB_TABLE_NAME_PRODUCTS))console.log("Expected table '"+l.DB_TABLE_NAME_PRODUCTS+"' already exists!");else{console.log("Expected table '"+l.DB_TABLE_NAME_PRODUCTS+"' does not exist - create a new table.")
;const s=_.Table.create(e.getRepository(l.ProductEntity).metadata,e.driver),a=yield d(t,s);if(console.log(" => table creation successfull? => "+a.toString()),!0===a){console.log("Check for migration from previous product tables...");let t=[];if(o.includes(l.DB_TABLE_NAME_PRODUCTS_2)?(console.log("Found previous product table '"+l.DB_TABLE_NAME_PRODUCTS_2+"'!"),t=yield I(e,l.EnumDbTableNamesPreviousProductsTables.QAPP002_productentity_2)):o.includes(l.DB_TABLE_NAME_PRODUCTS_1)?(console.log("Found previous product table '"+l.DB_TABLE_NAME_PRODUCTS_1+"'!"),t=yield I(e,l.EnumDbTableNamesPreviousProductsTables.QAPP002_productentity_1)):console.log("No previous product tables found!"),n.ProductEntity.itemsToMigrate=[],t.length>0){let e={};for(let s=0;s<t.length;s++){const a=T.createProduct_fromPreviousDBstyle(t[s]);if(r.isString(a.productId)&&""!==a.productId){a.databaseId=-1;const t=a.productId;let s=2;for(;e.hasOwnProperty(a.productId);)a.productId=t+"-"+s.toFixed(0),s++;e[a.productId]=!0,
T.verifyProduct(a,!1),n.ProductEntity.itemsToMigrate.push(a)}}}n.ProductEntity.itemsToMigrate.length>0?(n.ProductEntity.status=A.EMigrationResult.MIGRATION_NEEDED,n.ProductEntity.message="Successfully created table '"+l.DB_TABLE_NAME_PRODUCTS+"' (Need to migrate "+n.ProductEntity.itemsToMigrate.length.toFixed(0)+" existing products)"):(n.ProductEntity.status=A.EMigrationResult.MIGRATION_DONE,n.ProductEntity.message="Successfully created table '"+l.DB_TABLE_NAME_PRODUCTS+"'")}else n.ProductEntity.status=A.EMigrationResult.MIGRATION_FAILED,n.ProductEntity.message="Failed creating table '"+l.DB_TABLE_NAME_PRODUCTS+"'"}if(o.includes(c.DB_TABLE_NAME_BATCH))console.log("Expected table '"+c.DB_TABLE_NAME_BATCH+"' already exists!");else{console.log("Expected table '"+c.DB_TABLE_NAME_BATCH+"' does not exist - create a new table.");const s=_.Table.create(e.getRepository(c.BatchEntity).metadata,e.driver),a=yield d(t,s);console.log(" => table creation successfull? => "+a.toString()),
!0===a?(n.BatchEntity.status=A.EMigrationResult.MIGRATION_DONE,n.BatchEntity.message="Successfully created table '"+c.DB_TABLE_NAME_BATCH+"'"):(n.BatchEntity.status=A.EMigrationResult.MIGRATION_FAILED,n.BatchEntity.message="Failed creating table '"+c.DB_TABLE_NAME_BATCH+"'")}if(o.includes(u.DB_TABLE_NAME_TESTPROCESS))console.log("Expected table '"+u.DB_TABLE_NAME_TESTPROCESS+"' already exists!");else{console.log("Expected table '"+u.DB_TABLE_NAME_TESTPROCESS+"' does not exist - create a new table.");const s=_.Table.create(e.getRepository(u.ProcessEntity).metadata,e.driver),a=yield d(t,s);console.log(" => table creation successfull? => "+a.toString()),!0===a?(n.ProcessEntity.status=A.EMigrationResult.MIGRATION_DONE,n.ProcessEntity.message="Successfully created table '"+u.DB_TABLE_NAME_TESTPROCESS+"'"):(n.ProcessEntity.status=A.EMigrationResult.MIGRATION_FAILED,n.ProcessEntity.message="Failed creating table '"+u.DB_TABLE_NAME_TESTPROCESS+"'")}return n})}function d(e,t){
return a.__awaiter(this,void 0,void 0,function*(){return new Promise(function(s,a){e.createTable(t,!0,!1,!0).then(e=>{s(!0)}).catch(e=>{console.log("Table creation failed for '"+t+"'"),i.dbg(e),s(!1)})})})}function I(e,t){return a.__awaiter(this,void 0,void 0,function*(){return new Promise(function(s,a){e.query('SELECT *FROM "'+t+'"').then(e=>{s(e)}).catch(e=>{console.log("Table reading failed for '"+t+"'"),i.dbg(e),s([])})})})}function h(){return{ProductEntity:{tableName:l.DB_TABLE_NAME_PRODUCTS,status:A.EMigrationResult.MIGRATION_NOT_NEEDED,message:"",itemsToMigrate:[]},BatchEntity:{tableName:c.DB_TABLE_NAME_BATCH,status:A.EMigrationResult.MIGRATION_NOT_NEEDED,message:""},ProcessEntity:{tableName:u.DB_TABLE_NAME_TESTPROCESS,status:A.EMigrationResult.MIGRATION_NOT_NEEDED,message:""}}}t.DATABASE_ACTION_DONE_EVENT="/QAPP/DATABASE_ACTION_DONE",t.TIMEOUT_DATABASE_REQUEST=4e4,t.parseDatabaseEvent=function(e){if(r.isObject(e)&&r.isString(e.type))if(e.type===n.SIMPLE_EVENT){
if(r.isObject(e.payload)&&r.isString(e.payload.topic)&&e.payload.topic==t.DATABASE_ACTION_DONE_EVENT){const t=e.payload;return{isHandled:!0,success:t.success,context:t.context,result:t.result}}}else if(e.type===n.QAPP_TIMER_EVENT&&r.isObject(e.payload)&&r.isString(e.payload.topic)&&e.payload.topic==t.DATABASE_ACTION_DONE_EVENT){const t=e.payload;return{isHandled:!0,success:t.success,context:t.context,result:t.result}}return{isHandled:!1,success:!1,context:"",result:""}},t.DatabaseErrorMsg=function(e,t,s){e.hideMsgBox(),r.isObject(t)&&(t=E.inspect(t,!1,3)),e.showMessageBox(o.EnumMessageboxType.WARNING,e.l("_QAPP002_HEADER_DB_GENERIC_ERROR"),r.isString(t)?t:e.l("_QAPP002_MESSAGE_DB_GENERIC_ERROR"),s),e.hideLoadingScreen()},t.databaseMigration=function(e,s){e.showLoadingScreen({id:e.l("_QAPP002_INFO_DB_QUERY_READ"),args:["Tables (Migration)"]}),void 0!==e.dbConnection&&e.dbConnection.isConnected?(e.fsmTimers[t.DATABASE_ACTION_DONE_EVENT+"Migration"]=e.addTimer(t.TIMEOUT_DATABASE_REQUEST,{
topic:t.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Unexpected base timeout triggered after "+t.TIMEOUT_DATABASE_REQUEST.toFixed(0)+"ms."}),p(e.dbConnection,e.dbConnection.createQueryRunner()).then(a=>{e.cancelTimer(e.fsmTimers[t.DATABASE_ACTION_DONE_EVENT+"Migration"]),e.addToEventQueue(new n.SimpleEvent({topic:t.DATABASE_ACTION_DONE_EVENT,context:s,success:!0,result:a}))}).catch(a=>{e.cancelTimer(e.fsmTimers[t.DATABASE_ACTION_DONE_EVENT+"Migration"]),e.addToEventQueue(new n.SimpleEvent({topic:t.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:a}))})):e.addToEventQueue(new n.SimpleEvent({topic:t.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Database not accessible"}))},t.migrateTables=p,t.createTabletCheckerDbMigration=h},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(3),i=s(25),n=s(9);t.CANCEL_BUTTON_ID="BTN_CANCEL",t.CANCEL_BUTTON_NAME="_CANCEL";class r extends n.AbstractScreen{constructor(e){super(e),
this.paramList=[],this.parameterCategoryList=[],this.isLastCategoryVisible=!1,this.mqttHandler=e}setShowLastVisibleCategory(e,t=!0){this.isLastCategoryVisible=e,t&&this.createAndPublishParamsAndPage()}readFromTaskhandler(e){let t=e.getTaskGroupsAndParameters();this.readFromParameterGroupArray(t)}readFromParameterGroupArray(e){this.paramList.splice(0,this.paramList.length),this.parameterCategoryList.splice(0,this.parameterCategoryList.length);for(let t of e){let e={},s={},n=a.createEmptyTextStructure();n=t.title,s.title=n,e.category=s,e.category.id=t.id,e.params=[];for(let s of t.parameters){let t=new i.default(this.mqttHandler,s);this.paramList.push(t),e.params.push(t.getPublishedId())}this.parameterCategoryList.push(e)}}createAndPublishParamsAndPage(){let e={params:{}};e.params=this.parameterCategoryList,e.showLastVisibleCategory=this.isLastCategoryVisible;let t=JSON.stringify(e,null,2);this.publishContent("PARAMSANDPAGE",t)}updateParameter(e){
for(let t of this.paramList)if(t.getId()===e.id)return void t.setValue(e)}}t.ParamListBase=r,t.default=r},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(10),i=s(0),n=s(11);t.ParamUpdateUserActionSimpleAccept_OK_BUTTON_ID="BTN_OK",t.ParamUpdateUserActionSimpleAccept={type:a.EnumMessageboxType.ERROR,title:{id:"_QAPP_LIB_MSG_BOX_WARNING_UPDATE_TASK_PARAM",args:[]},textList:[],buttons:[{appearance:i.EnumAppearance.ENABLED_SECONDARY,label:{id:n.EnumFontLabels.OK,args:[]},id:t.ParamUpdateUserActionSimpleAccept_OK_BUTTON_ID}]}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MQTT_ADMIN_EVENT="MQTT_ADMIN_EVENT",t.MQTT_ADMIN_EVENT_PACKET_SENT="packetsend";t.MqttAdminEvent=class{constructor(e){this.payload=e,this.type=t.MQTT_ADMIN_EVENT}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(7),i=s(0),n=s(17),r=s(11),o=s(4);var E,_,l;function c(e,s,a){return{
appearance:i.EnumAppearance.ENABLED_SECONDARY,type:_.CALLBACK,name:s||r.EnumFontLabels.OK,effect:{method:"buttonClickEvent",module:"qappHandler",params:{buttonId:e||t.MESSAGEHANDLER_OK_BTN_ID},calltarget:a||l.ReST}}}!function(e){e.FATAL="FATAL",e.ERROR="ERROR",e.WARNING="WARNING",e.INFORMATION="INFORMATION"}(E=t.MESSAGE_HANDLER_MESSAGE_TYPE||(t.MESSAGE_HANDLER_MESSAGE_TYPE={})),function(e){e.UNTIL_EXPLICIT_DELETION="UNTIL_EXPLICIT_DELETION",e.UNTIL_EXPLICIT_DELETION_OR_REBOOT="UNTIL_EXPLICIT_DELETION_OR_REBOOT",e.UNTIL_USER_ACKNOWLEDGE_WITH_REBOOT_PERSISTENCE="UNTIL_USER_ACKNOWLEDGE_WITH_REBOOT_PERSISTENCE",e.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE="UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE"}(t.MESSAGE_HANDLER_LIFETIME||(t.MESSAGE_HANDLER_LIFETIME={})),function(e){e.NAVIGATETO="NavigateTo",e.CALLBACK="Callback"}(_=t.MESSAGE_HANDLER_BUTTON_TYPE||(t.MESSAGE_HANDLER_BUTTON_TYPE={})),function(e){e.MQTT="MQTT",e.ReST="ReST",e.REMOVE_MESSAGE="REMOVE_MESSAGE"
}(l=t.MessageHandlerCallTarget||(t.MessageHandlerCallTarget={})),function(e){e.NONE="NONE",e.USER_CAL="USER_CAL",e.QAPP="QAPP"}(t.MessageHandlerCategory||(t.MessageHandlerCategory={})),t.MESSAGEHANDLER_OK_BTN_ID="BTN_OK_MESSAGEHANDLER",t.MESSAGEHANDLER_CLOSE_QAPP_BTN_I18N="_QAPP_LIB_CONNECTION_ERROR_CLOSE_QAPP_BTN",t.createMessageHandlerButton=c;t.MessageHandlerProxy=class extends a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="messagehandler"}addMessage(e,t,s,i,r,E,_,l,u,T){return this.body.method=o.RestMethodsMESSAGE_HANDLER.addMessage,this.body.params={message:{errorCode:e,type:t,lifetime:i,title:r,reason:E,solution:_,buttons:u||[c()],category:s,categorysecret:l},showMessageInFutureMillis:T||0,uniqueMessageId:0},console.log("addMessageHandler: "+n.inspect(this.body.params.message)),new a.CubisRestResponse(this.syncRequest()).rawReturns.uniqueMessageId}deleteMessageByCategory(e,t){return this.body.method=o.RestMethodsMESSAGE_HANDLER.deleteMessageByCategory,
this.body.params={categoryAsString:e,secret:t},console.log("deleteMessageByCategory: "+n.inspect(this.body.params)),new a.CubisRestResponse(this.syncRequest())}deleteMessagesByCategory(e){return this.body.method=o.RestMethodsMESSAGE_HANDLER.deleteMessagesByCategory,this.body.params={categorySecretArray:JSON.stringify({arraySize:e.length,data:e})},console.log("deleteMessagesByCategory: "+n.inspect(this.body.params)),new a.CubisRestResponse(this.syncRequest())}getAllMessagesByCategory(e){this.body.method=o.RestMethodsMESSAGE_HANDLER.getAllMessagesByCategory,this.body.params={categoryAsString:e,messages:{}};let t=new a.CubisRestResponse(this.syncRequest());return JSON.parse(t.rawReturns.messages).data}getAllErrorMessagesByCategory(e){let t=this.getAllMessagesByCategory(e),s=[];for(let e of t)e.type===E.ERROR&&s.push(e);return s}removeMessage(e){return this.body.method=o.RestMethodsMESSAGE_HANDLER.removeMessage,this.body.params={uniqueMessageId:e},
new a.CubisRestResponse(this.syncRequest())}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(11),n=s(1),r={BTN_INVALIDATE_SAMPLE:10,BTN_DOCU:20,BTN_EVAL:30,BTN_PRINT_LABEL:40,BTN_ADD:50,BTN_START:60,BTN_PRINTADD:60,BTN_NEXT:60};t.getButtonPriority=function(e){return void 0!==r[e]?r[e]:0},t.BTN_EVAL_ID="BTN_EVAL";const o={buttonId:t.BTN_EVAL_ID,label:{id:i.EnumFontLabels.RESULT,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createEvalButtonData=function(){return n.cloneJSON(o)},t.BTN_NEXT_ID="BTN_NEXT";const E={buttonId:t.BTN_NEXT_ID,label:{id:i.EnumFontLabels.NEXT,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createNextButtonData=function(){return n.cloneJSON(E)},t.BTN_PREV_ID="BTN_PREV";const _={buttonId:t.BTN_PREV_ID,label:{id:i.EnumFontLabels.PREV,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createPrevButtonData=function(){return n.cloneJSON(_)},t.BTN_BACK_ID="BTN_BACK",t.BTN_LONG_BACK_ID="BTN_LONG_BACK";const l={
buttonId:t.BTN_BACK_ID,label:{id:i.EnumFontLabels.BACK,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createBackButtonData=function(e=!1){let s=n.cloneJSON(l);return e&&(s.longPressButtonId=t.BTN_LONG_BACK_ID),s},t.BTN_DOCU_ID="BTN_DOCU";const c={buttonId:t.BTN_DOCU_ID,label:{id:i.EnumFontLabels.DOCU,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createDocuButtonData=function(){return n.cloneJSON(c)},t.BTN_SEND_ID="BTN_SEND";const u={buttonId:t.BTN_SEND_ID,label:{id:i.EnumFontLabels.DOCU,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createSendButtonData=function(){return n.cloneJSON(u)},t.BTN_INVALIDATE_SAMPLE_ID="BTN_INVALIDATE_SAMPLE";const T={buttonId:t.BTN_INVALIDATE_SAMPLE_ID,label:{id:i.EnumFontLabels.INVALIDATE_SAMPLE,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createInvalidateSampleButtonData=function(){return n.cloneJSON(T)},t.BTN_PRINT_LABEL_ID="BTN_PRINT_LABEL";const A={buttonId:t.BTN_PRINT_LABEL_ID,label:{id:"_QAPP_LIB_PRINT_LABEL_BTN_TITLE",args:[]},
appearance:a.EnumAppearance.HIDDEN};t.createPrintLabelButtonData=function(){return n.cloneJSON(A)},t.BTN_START_ID="BTN_START";const p={buttonId:t.BTN_START_ID,label:{id:i.EnumFontLabels.START,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createStartButtonData=function(){return n.cloneJSON(p)},t.BTN_END_ID="BTN_END";const d={buttonId:t.BTN_END_ID,label:{id:i.EnumFontLabels.END,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createEndButtonData=function(){return n.cloneJSON(d)},t.BTN_PRINTADD_ID="BTN_PRINTADD";const I={buttonId:t.BTN_PRINTADD_ID,label:{id:i.EnumFontLabels.PRINT_ADD,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createPrintAddButtonData=function(){return n.cloneJSON(I)},t.BTN_CANCEL_ID="BTN_CANCEL";const h={buttonId:t.BTN_CANCEL_ID,label:{id:i.EnumFontLabels.CANCEL,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createCancelButtonData=function(){return n.cloneJSON(h)},t.BTN_SEARCH_ID="BTN_SEARCH";const S={buttonId:t.BTN_SEARCH_ID,label:{id:i.EnumFontLabels.SEARCH,args:[]},
appearance:a.EnumAppearance.HIDDEN};t.createSearchButtonData=function(){return n.cloneJSON(S)},t.setNoSearchActive=function(e,t=!0){e.setLabel({id:i.EnumFontLabels.SEARCH,args:[]},t)},t.setSearchActive=function(e,t=!0){e.setLabel({id:i.EnumFontLabels.SEARCH_ACTIVE,args:[]},t)},t.BTN_FILTER_ID="BTN_FILTER";const N={buttonId:t.BTN_FILTER_ID,label:{id:i.EnumFontLabels.FILTER,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createFilterButtonData=function(){return n.cloneJSON(N)},t.setNoFilterActive=function(e,t=!0){e.setLabel({id:i.EnumFontLabels.FILTER,args:[]},t)},t.setFilterActive=function(e,t=!0){e.setLabel({id:i.EnumFontLabels.FILTER_ACTIVE,args:[]},t)},t.BTN_ADD_ID="BTN_ADD";const m={buttonId:t.BTN_ADD_ID,label:{id:i.EnumFontLabels.ADD,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createAddButtonData=function(){return n.cloneJSON(m)},t.BTN_DELETE_ID="BTN_DELETE";const P={buttonId:t.BTN_DELETE_ID,label:{id:i.EnumFontLabels.DELETE,args:[]},appearance:a.EnumAppearance.HIDDEN}
;t.createDeleteButtonData=function(){return n.cloneJSON(P)},t.BTN_HOME_ID="BTN_HOME",t.HOME_BUTTON_ICON="./02_menu";const R={buttonId:t.BTN_HOME_ID,label:{id:i.EnumFontLabels.CANCEL,args:[]},icon:t.HOME_BUTTON_ICON,appearance:a.EnumAppearance.HIDDEN};t.createHomeButtonData=function(){return n.cloneJSON(R)},t.BTN_LOGOUT_ID="BTN_LOGOUT";const g={buttonId:t.BTN_LOGOUT_ID,label:{id:i.EnumFontLabels.LOGOUT,args:[]},appearance:a.EnumAppearance.ENABLED_SECONDARY};t.createLogoutButtonData=function(){return n.cloneJSON(g)},t.BTN_RELOAD_ID="BTN_RELOAD";const O={buttonId:t.BTN_RELOAD_ID,label:{id:i.EnumFontLabels.RELOAD,args:[]},appearance:a.EnumAppearance.ENABLED_SECONDARY};t.createReloadButtonData=function(){return n.cloneJSON(O)},t.BTN_OPEN_WEIGHING_ID="BTN_OPEN_WEIGHING";const D={buttonId:t.BTN_OPEN_WEIGHING_ID,label:{id:i.EnumFontLabels.WEIGHING,args:[]},appearance:a.EnumAppearance.ENABLED_SECONDARY};t.createOpenWeighingButtonData=function(){return n.cloneJSON(D)},t.BTN_OK_ID="BTN_OK"
;const C={buttonId:t.BTN_OK_ID,label:{id:i.EnumFontLabels.OK,args:[]},appearance:a.EnumAppearance.ENABLED_SECONDARY};t.createOKButtonData=function(){return n.cloneJSON(C)}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(43),i=s(19);var n=s(19);t.bignumber=n.bignumber,t.abs=n.abs;const r=s(20);function o(e){let t=void 0;return r.unitsMap.hasOwnProperty(e)&&(t=r.unitsMap[e].conversionDecimalPlacesShift),void 0===t&&(t=1),t}var E;t.calcInterval=function(e,t,s){return i.bignumber(s).times(a.SartoMath.decPowers(o(e))).times(a.SartoMath.decPowers(-1*o(t))).toNumber()},t.calcDecimals=function(e){return e>=1?0:Math.ceil(-1*Math.log10(e))},t.unitStringToShort=function(e){return r.unitsMap.hasOwnProperty(e)?r.unitsMap[e].mark:r.unitsMap[r.EnumUnit.INVALID].mark},t.getUnitFactor=function(e){let t=void 0;return r.unitsMap.hasOwnProperty(e)&&(t=r.unitsMap[e].conversionFactor),void 0===t&&(t=1),t},t.getUnitShift=o,function(e){e.none="NONE",e.o="UNIVERSAL",
e["µg"]="MICROGRAM",e.mg="MILLIGRAM",e.g="GRAM",e.kg="KILOGRAM",e.t="TONNE",e.mct="MILLICARAT",e.ct="CARAT",e.kct="KILOCARAT",e.K="KARAT",e.lb="POUND",e.oz="OUNCE",e.lb_oz="POUND_OUNCE",e.ozt="TROYOUNCE",e.dwt="PENNYWEIGHT",e.GN="GRAIN",e.per_lb="PARTS_PER_POUND",e.tlh="TAEL_HONGKONG",e.tls="TAEL_SINGAPORE",e.tlt="TAEL_TAIWAN",e.tlc="TAEL_CHINA",e.mom="MOMME",e.tol="TOLA",e.bat="BATH",e.MS="MESGHAL",e.N="NEWTON",e.war="WARNING",e.pcs="PIECES",e.per="PERCENT",e.mm="MILLIMETER",e.cm="CENTIMETER",e.m="METER",e.km="KILOMETER",e.g_ml="GRAM_PER_MILLILITER",e.Mcls_ml="MILLION_CELLS_PER_MILLILITER",e["µg_ml"]="MICROGRAM_PER_MILLILITER",e["µg_l"]="MICROGRAM_PER_LITER",e.mg_ml="MILLIGRAM_PER_MILLILITER",e.mg_l="MILLIGRAM_PER_LITER",e.mmol_ml="MILLIMOL_PER_MILLILITER",e.g_cm3="DENSITY",e.cm3="VOLUME",e.cm2="SQUARECENTIMETRE",e.m2="SQUAREMETRE",e.g_cm2="GRAM_PER_SQUARE_CENTIMETER",e.g_m2="GRAMMAGE",e.g_m="GRAM_PER_METER",e["µl"]="MICROLITER",e.ml="MILLILITER",e.cl="CENTILITER",e.l="LITER",
e.mmol="MILLIMOL",e.C="GRAD_CELSIUS",e.F="GRAD_FAHRENHEIT",e.sec="SECOND",e.min="MINUTE",e.h="HOUR",e.am="TIME_AM",e.pm="TIME_PM",e.V="VOLT",e.mA="MILLIAMPER",e.hPa="HECTOPASCAL",e.kPa="KILOPASCAL",e.g_mol="GRAM_PER_MOL",e.kg_m3="KG_M3",e.mmHg="MMHG",e.invalid="!invalid!",e.rpm="RPM"}(E=t.EnumUnitStrings||(t.EnumUnitStrings={}));const _={[E.none]:"none",[E.o]:"o",[E.µg]:"µg",[E.mg]:"mg",[E.g]:"g",[E.kg]:"kg",[E.t]:"t",[E.mct]:"mct",[E.ct]:"ct",[E.kct]:"kct",[E.K]:"K",[E.lb]:"lb",[E.oz]:"oz",[E.lb_oz]:"lb_oz",[E.ozt]:"ozt",[E.dwt]:"dwt",[E.GN]:"GN",[E.per_lb]:"per_lb",[E.tlh]:"tlh",[E.tls]:"tls",[E.tlt]:"tlt",[E.tlc]:"tlc",[E.mom]:"mom",[E.tol]:"tol",[E.bat]:"bat",[E.MS]:"MS",[E.N]:"N",[E.war]:"war",[E.pcs]:"pcs",[E.per]:"per",[E.mm]:"mm",[E.cm]:"cm",[E.m]:"m",[E.km]:"km",[E.g_ml]:"g_ml",[E.Mcls_ml]:"Mcls_ml",[E.µg_ml]:"µg_ml",[E.µg_l]:"µg_l",[E.mg_ml]:"mg_ml",[E.mg_l]:"mg_l",[E.mmol_ml]:"mmol_ml",[E.g_cm3]:"g_cm3",[E.cm3]:"cm3",[E.cm2]:"cm2",[E.m2]:"m2",[E.g_cm2]:"g_cm2",
[E.g_m2]:"g_m2",[E.g_m]:"g_m",[E.µl]:"µl",[E.ml]:"ml",[E.cl]:"cl",[E.l]:"l",[E.mmol]:"mmol",[E.C]:"C",[E.F]:"F",[E.sec]:"sec",[E.min]:"min",[E.h]:"h",[E.am]:"am",[E.pm]:"pm",[E.V]:"V",[E.mA]:"mA",[E.hPa]:"hPa",[E.kPa]:"kPa",[E.g_mol]:"g_mol",[E.kg_m3]:"kg_m3",[E.mmHg]:"mmHg",[E.invalid]:"invalid",[E.rpm]:"rpm"};t.unitStringToLong=function(e){const t=Array.isArray(e)?e[0]:e;if(0===t.length)return E.none;for(const[e,s]of Object.entries(_))if(s===t)return e;return E.invalid},t.convertWgtUnit=function(e,t,s){return r.convertValueToTargetUnit(e,t,s)},t.convertWgtUnitBigNumber=function(e,t,s){return r.convertValueToTargetUnitBigNumber(e,t,s)},t.convertTempUnit=function(e,t,s){const a=[r.EnumUnit.GRAD_CELSIUS,r.EnumUnit.GRAD_FAHRENHEIT,E.C,E.F];return a.includes(t)&&a.includes(s)?r.convertValueToTargetUnit(e,t,s):e},t.convertPressureUnit=function(e,t,s){const a=[r.EnumUnit.HECTOPASCAL,r.EnumUnit.KILOPASCAL,E.hPa,E.kPa];return a.includes(t)&&a.includes(s)?r.convertValueToTargetUnit(e,t,s):e},
t.UnitEnum_Api2Lib=function(e){let t=E;for(let s in t)if(t[s].toString()===e.toString())return s;return null},t.UnitEnum_Lib2Api=function(e){return r.getUnitEnum(e)}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(9);t.AbstractOverlay=class extends i.AbstractScreen{show(){this.publishContent("",'{ "appearance":"'+a.EnumAppearance.ENABLED+'" }'),this.events$.next({type:i.ScreenEventType.SHOW_OVERLAY,id:this.getId()})}hide(){this.publishContent("",'{ "appearance":"'+a.EnumAppearance.HIDDEN+'" }'),this.events$.next({type:i.ScreenEventType.HIDE_OVERLAY,id:this.getId()})}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QAppAsyncCallTimeoutErrorName="QAppAsyncCallTimeoutError";class a extends Error{constructor(e,s,i){super(),this.originalState=e,this.metadata=s,this.name=t.QAppAsyncCallTimeoutErrorName,i&&(this.stack=i),Object.setPrototypeOf(this,a.prototype),
this.message="Async call timeout."+(s?` metadata: ${s}`:"")}}t.QAppAsyncCallTimeoutError=a},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(92),i=s(18),n=s(67),r=s(5);var o,E,_;!function(e){e.DATE_FORMAT_CHARTS="DATE_FORMAT_CHARTS",e.DATE_FORMAT_DATEFORMAT_LIB="DATE_FORMAT_DATEFORMAT_LIB"}(o=t.EDateFormats||(t.EDateFormats={})),function(e){e.DD_MM_YYYY_SLASHSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_DD_MM_YYYY_SLASHSEPERATOR",e.MM_DD_YYYY_SLASHSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_MM_DD_YYYY_SLASHSEPERATOR",e.DD_MM_YYYY_POINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_DD_MM_YYYY_POINTSEPERATOR",e.YYYY_MM_DD_MINUSSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_YYYY_MM_DD_MINUSSEPERATOR",e.YYYY_MM_DD_DOUBLEPOINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_YYYY_MM_DD_DOUBLEPOINTSEPERATOR",
e.YYYY_MM_DD_POINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_YYYY_MM_DD_POINTSEPERATOR",e.DD_MMM_YYYY_MINUSSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_DD_MMM_YYYY_MINUSSEPERATOR",e.MMM_DD_YYYY_MINUSSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_MMM_DD_YYYY_MINUSSEPERATOR",e.YYYY_MM_DD_NO_SEPARATOR="CUSTOM_YYYY_MM_DD_NO_SEPARATOR"}(E=t.EDateConfiguration||(t.EDateConfiguration={})),function(e){e.HH_MM_SS_MINUSSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_TIMEFORMAT_TEXT_HH_MM_SS_MINUSSEPERATOR",e.HH_MM_SS_POINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_TIMEFORMAT_TEXT_HH_MM_SS_POINTSEPERATOR",e.HH_MM_SS_DOUBLEPOINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_TIMEFORMAT_TEXT_HH_MM_SS_DOUBLEPOINTSEPERATOR",e.HH_MM_SS_AM_PM_DOUBLEPOINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_TIMEFORMAT_TEXT_HH_MM_SS_AM_PM_DOUBLEPOINTSEPERATOR",e.HH_MM_SS_NO_SEPARATOR="CUSTOM_HH_MM_SS_NO_SEPARATOR"}(_=t.ETimeConfiguration||(t.ETimeConfiguration={}))
;const l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function c(e,t,s){let a="YYYY-MM-DD",i="HH:mm:ss";switch(console.log("parseDateTimeFormat: for format "+e),e){case o.DATE_FORMAT_CHARTS:a="YYYY-MM-DD",i="HH:mm:ss";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="yyyy-mm-dd",i="HH:MM:ss"}if(void 0!==t){let s=t.value.selection.text.id;switch(console.log("parseDateTimeFormat: date "+s),s){case E.DD_MM_YYYY_SLASHSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:a="DD/MM/YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="dd-mm-yyyy"}break;case E.MM_DD_YYYY_SLASHSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:a="MM/DD/YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="mm-dd-yyyy"}break;case E.DD_MM_YYYY_POINTSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:a="DD.MM.YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="dd.mm.yyyy"}break;case E.YYYY_MM_DD_MINUSSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:a="YYYY-MM-DD";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="yyyy-mm-dd"}break
;case E.YYYY_MM_DD_DOUBLEPOINTSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:a="YYYY:MM:DD";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="yyyy:mm:dd"}break;case E.DD_MMM_YYYY_MINUSSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:a="DD-MMM-YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="dd-mmm-yyyy"}break;case E.MMM_DD_YYYY_MINUSSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:a="MMM-DD-YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="mmm.dd.yyyy"}break;default:a=s}}if(void 0!==s){let t=s.value.selection.text.id;switch(console.log("parseDateTimeFormat: time "+t),t){case _.HH_MM_SS_POINTSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:i="HH.mm.ss";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="HH.MM.ss"}break;case _.HH_MM_SS_DOUBLEPOINTSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:i="HH:mm:ss";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="HH:MM:ss"}break;case _.HH_MM_SS_AM_PM_DOUBLEPOINTSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:i="hh:mm:ss a";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="hh:MM:ss TT"}
break;default:i=t}}let n=`${a} ${i}`;return console.log("parseDateTimeFormat: final format "+n),n}function u(e,t){let s=e.toFixed(0);for(;s.length<t;)s="0"+s;return s}function T(){let e=(new a.ClockHandlerProxy).getFormatConfigurationI18n();if(e.isSuccess()){let t,s,n=JSON.parse(e.rawReturns.configuration),r=i.find(n,e=>e.id===a.CLOCKHANDLER_DATEFORMAT_PARAM_ID),o=i.find(n,e=>e.id===a.CLOCKHANDLER_TIMEFORMAT_PARAM_ID);if(void 0!==r){let e=r.value.selection.text.id;t=Object.values(E).includes(e)?e:E.YYYY_MM_DD_MINUSSEPERATOR}else t=E.YYYY_MM_DD_MINUSSEPERATOR;if(void 0!==o){let e=o.value.selection.text.id;s=Object.values(_).includes(e)?e:_.HH_MM_SS_DOUBLEPOINTSEPERATOR}else s=_.HH_MM_SS_DOUBLEPOINTSEPERATOR;return{dateConfiguration:t,timeConfiguration:s}}return{dateConfiguration:E.YYYY_MM_DD_MINUSSEPERATOR,timeConfiguration:_.HH_MM_SS_DOUBLEPOINTSEPERATOR}}function A(e,t){let s,a,i=new Date(e);switch(t.dateConfiguration){case E.DD_MM_YYYY_SLASHSEPERATOR:
s=u(i.getDate(),2)+"/"+u(i.getMonth()+1,2)+"/"+u(i.getFullYear(),4);break;case E.MM_DD_YYYY_SLASHSEPERATOR:s=u(i.getMonth()+1,2)+"/"+u(i.getDate(),2)+"/"+u(i.getFullYear(),4);break;case E.DD_MM_YYYY_POINTSEPERATOR:s=u(i.getDate(),2)+"."+u(i.getMonth()+1,2)+"."+u(i.getFullYear(),4);break;case E.YYYY_MM_DD_MINUSSEPERATOR:s=u(i.getFullYear(),4)+"-"+u(i.getMonth()+1,2)+"-"+u(i.getDate(),2);break;case E.YYYY_MM_DD_DOUBLEPOINTSEPERATOR:s=u(i.getFullYear(),4)+":"+u(i.getMonth()+1,2)+":"+u(i.getDate(),2);break;case E.YYYY_MM_DD_POINTSEPERATOR:s=u(i.getFullYear(),4)+"."+u(i.getMonth()+1,2)+"."+u(i.getDate(),2);break;case E.DD_MMM_YYYY_MINUSSEPERATOR:s=u(i.getDate(),2)+"-"+l[i.getMonth()]+"-"+u(i.getFullYear(),4);break;case E.MMM_DD_YYYY_MINUSSEPERATOR:s=l[i.getMonth()]+"-"+u(i.getDate(),2)+"-"+u(i.getFullYear(),4);break;case E.YYYY_MM_DD_NO_SEPARATOR:s=u(i.getFullYear(),4)+u(i.getMonth()+1,2)+u(i.getDate(),2);break;default:s=u(i.getFullYear(),4)+"-"+u(i.getMonth()+1,2)+"-"+u(i.getDate(),2)}
switch(t.timeConfiguration){case _.HH_MM_SS_MINUSSEPERATOR:a=u(i.getHours(),2)+"-"+u(i.getMinutes(),2)+"-"+u(i.getSeconds(),2);break;case _.HH_MM_SS_POINTSEPERATOR:a=u(i.getHours(),2)+"."+u(i.getMinutes(),2)+"."+u(i.getSeconds(),2);break;case _.HH_MM_SS_DOUBLEPOINTSEPERATOR:a=u(i.getHours(),2)+":"+u(i.getMinutes(),2)+":"+u(i.getSeconds(),2);break;case _.HH_MM_SS_AM_PM_DOUBLEPOINTSEPERATOR:let e=function(e){let t=e>=12?"pm":"am";return{hours:e=0!=(e%=12)?e:12,ampm:t}}(i.getHours());a=u(e.hours,2)+":"+u(i.getMinutes(),2)+":"+u(i.getSeconds(),2)+" "+e.ampm;break;case _.HH_MM_SS_NO_SEPARATOR:a=u(i.getHours(),2)+u(i.getMinutes(),2)+u(i.getSeconds(),2);break;default:a=u(i.getHours(),2)+":"+u(i.getMinutes(),2)+":"+u(i.getSeconds(),2)}return{date:s,time:a}}t.getDateTimeFormat=function(e){let t="";switch(e){case o.DATE_FORMAT_CHARTS:t="YYYY-MM-DD HH:mm:ss";break;case o.DATE_FORMAT_DATEFORMAT_LIB:t="yyyy-mm-dd HH:MM:ss"}let s=(new a.ClockHandlerProxy).getFormatConfigurationI18n()
;if(s.isSuccess()){let n=JSON.parse(s.rawReturns.configuration);t=`${c(e,i.find(n,e=>e.id===a.CLOCKHANDLER_DATEFORMAT_PARAM_ID),i.find(n,e=>e.id===a.CLOCKHANDLER_TIMEFORMAT_PARAM_ID))}`}return t},t.parseDateTimeFormat=c,t.getDateTimeConfiguration=T,t.convertToDateTimeFormat=A,t.getDateTime=function(e,t,s,a,i=!0,o=!0){switch(void 0==s&&(s=Date.now()),r.isNumber(s)||r.isString(s)||(s=0),void 0==a&&(a=r.isString(s)?"iso":"ms"),void 0==e&&(e="ms"),a){case"ms":s=r.isNumber(s)?s:0;break;case"s":s=r.isNumber(s)?1e3*s:0;break;case"iso":case"isoTimezone":s=r.isString(s)?new Date(s).valueOf():0,s=r.isNumber(s)?s:0}if("ms"===e)return s;if("s"===e)return Math.trunc(s/1e3);if("iso"===e)return new Date(s).toISOString();if("isoTimezone"===e&&(e="frmt",t="yyyy-mm-dd HH:MM:sso"),void 0==t&&(t=T()),0===s&&(s=.1),t.hasOwnProperty("dateConfiguration")){let e=A(s,t),a=i?e.date:"";return a+=o&&""!==a?" ":"",a+=o?e.time:""}if("string"==typeof t.toLowerCase())return n(s,t);{let e=o?"HH:MM:ss":""
;return e+=i&&""!==e?" ":"",n(s,e+=i?"dd.mm.yyyy":"")}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(9),n=s(14),r=s(2);t.CANCEL_BUTTON_ID="BTN_CANCEL";class o{constructor(e){this.paramDetailsOverlayObject={appearance:a.EnumAppearance.HIDDEN,title:{id:"",args:[]},params:[]},this.events$=new n.Subject,this.mqttHandler=e}setAppearance(e){this.paramDetailsOverlayObject.appearance!==e&&(e!==a.EnumAppearance.HIDDEN&&e!==a.EnumAppearance.ENABLED||(this.paramDetailsOverlayObject.appearance=e,this.mqttHandler.publish(r.MqttTopics.HMI_PARAMDETAILSOVERLAY,JSON.stringify(this.paramDetailsOverlayObject))))}getAppearance(){return this.paramDetailsOverlayObject.appearance}setTitle(e,t){this.paramDetailsOverlayObject.title.id===e&&this.paramDetailsOverlayObject.title.args.join("")===t.join("")||(this.paramDetailsOverlayObject.title.id=e,this.paramDetailsOverlayObject.title.args=t,
this.paramDetailsOverlayObject.appearance!==a.EnumAppearance.HIDDEN&&this.mqttHandler.publish(r.MqttTopics.HMI_PARAMDETAILSOVERLAY,JSON.stringify(this.paramDetailsOverlayObject)))}getTitle(){return this.paramDetailsOverlayObject.title}setParams(e){this.paramDetailsOverlayObject.params.join("")!==e.join("")&&(this.paramDetailsOverlayObject.params=e,this.paramDetailsOverlayObject.appearance!==a.EnumAppearance.HIDDEN&&this.mqttHandler.publish(r.MqttTopics.HMI_PARAMDETAILSOVERLAY,JSON.stringify(this.paramDetailsOverlayObject)))}getParams(){return this.paramDetailsOverlayObject.params}getId(){return"PARAMDETAILSOVERLAY"}getButton(e){}hide(){this.paramDetailsOverlayObject.appearance===a.EnumAppearance.ENABLED&&(this.setAppearance(a.EnumAppearance.HIDDEN),this.events$.next({type:i.ScreenEventType.HIDE_OVERLAY,id:this.getId()}))}show(){this.paramDetailsOverlayObject.appearance===a.EnumAppearance.HIDDEN&&(this.setAppearance(a.EnumAppearance.ENABLED),this.events$.next({
type:i.ScreenEventType.SHOW_OVERLAY,id:this.getId()}))}}t.ParamDetailsOverlay=o,t.default=o},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(3),i=s(16),n=s(33),r=s(1);t.checkGeneralParamRules=function(e){let t=void 0;if(a.isTypeOfIQuantityParameter(e)){let s=i.QuantityParameter.getValue(e);if(Number.isNaN(s)){if(!0!==e.info.isNoValueAllowed){let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);void 0!==e.info.noValueErrorMsg?"string"==typeof e.info.noValueErrorMsg?s.textList=[{id:e.info.noValueErrorMsg,args:[]}]:s.textList=[e.info.noValueErrorMsg]:s.textList=[{id:"_QAPP_LIB_MSG_BOX_ERROR_CFG_QUANT_PARAM_EMPTY_NOT_ALLOWED",args:[]}],t={updatedParameter:e,message:s}}}else try{if(s<parseFloat(e.info.minimum.value)){let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);s.textList=[{id:e.info.minimum.errorMsg?e.info.minimum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_QUANT_PARAM_EXCEED_MIN",args:[]}],t={updatedParameter:e,message:s}
}else if(s>parseFloat(e.info.maximum.value)){let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);s.textList=[{id:e.info.maximum.errorMsg?e.info.maximum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_QUANT_PARAM_EXCEED_MAX",args:[]}],t={updatedParameter:e,message:s}}}catch(e){}}else if(a.isTypeOfIStringParameter(e)){let s=e.value.string;try{if(void 0===s){if(0!==e.info.minimum.length&&!0!==e.info.isNoValueAllowed){let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);void 0!==e.info.noValueErrorMsg?"string"==typeof e.info.noValueErrorMsg?s.textList=[{id:e.info.noValueErrorMsg,args:[]}]:s.textList=[e.info.noValueErrorMsg]:s.textList=[{id:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_MANDATORY",args:[]}],t={updatedParameter:e,message:s}}}else if(s.length<e.info.minimum.length)if(0===s.length){if(console.log("StringParam: empty"),!0!==e.info.isNoValueAllowed){let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);void 0!==e.info.noValueErrorMsg?"string"==typeof e.info.noValueErrorMsg?s.textList=[{
id:e.info.noValueErrorMsg,args:[]}]:s.textList=[e.info.noValueErrorMsg]:s.textList=[{id:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_MANDATORY",args:[]}],t={updatedParameter:e,message:s}}}else{console.log("StringParam: min exceed");let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);s.textList=[{id:e.info.minimum.errorMsg?e.info.minimum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_TOO_SHORT",args:[]}],t={updatedParameter:e,message:s}}else if(s.length>e.info.maximum.length)if(console.log("StringParam: max exceed"),!0===e.info.maximum.autoCut)console.log("StringParam: autocut"),e.value.string=s.substr(0,e.info.maximum.length);else{let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);s.textList=[{id:e.info.maximum.errorMsg?e.info.maximum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_TOO_LONG",args:[]}],t={updatedParameter:e,message:s}}}catch(e){}}else if(a.isTypeOfIPasswordParameter(e)){let s=e.value.string;try{if(void 0===s){
if(0!==e.info.minimum.length&&!0!==e.info.isNoValueAllowed){let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);void 0!==e.info.noValueErrorMsg?"string"==typeof e.info.noValueErrorMsg?s.textList=[{id:e.info.noValueErrorMsg,args:[]}]:s.textList=[e.info.noValueErrorMsg]:s.textList=[{id:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_MANDATORY",args:[]}],t={updatedParameter:e,message:s}}}else if(s.length<e.info.minimum.length)if(0===s.length){if(console.log("PasswordParam: empty"),!0!==e.info.isNoValueAllowed){let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);void 0!==e.info.noValueErrorMsg?"string"==typeof e.info.noValueErrorMsg?s.textList=[{id:e.info.noValueErrorMsg,args:[]}]:s.textList=[e.info.noValueErrorMsg]:s.textList=[{id:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_MANDATORY",args:[]}],t={updatedParameter:e,message:s}}}else{console.log("PasswordParam: min exceed");let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);s.textList=[{
id:e.info.minimum.errorMsg?e.info.minimum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_TOO_SHORT",args:[]}],t={updatedParameter:e,message:s}}else if(s.length>e.info.maximum.length){console.log("PasswordParam: max exceed");let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);s.textList=[{id:e.info.maximum.errorMsg?e.info.maximum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_TOO_LONG",args:[]}],t={updatedParameter:e,message:s}}}catch(e){}}return t}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(19);class i{static roundExactToDecimals(e,t){return this.nTimesTen(this.roundExact(this.nTimesTen(e,t)),-1*t)}static roundExact(e){return e=e>=0?Math.floor(e+.5+Number.EPSILON):Math.ceil(e-.5-Number.EPSILON)}static nTimesTen(e,t){return a.bignumber(e).times(i.decPowers(t)).toNumber()}static countDecimals(e){return a.bignumber(e).decimalPlaces()}static decPowers(e){switch(e){case-15:return 1e-15;case-14:return 1e-14;case-13:return 1e-13
;case-12:return 1e-12;case-11:return 1e-11;case-10:return 1e-10;case-9:return 1e-9;case-8:return 1e-8;case-7:return 1e-7;case-6:return 1e-6;case-5:return 1e-5;case-4:return 1e-4;case-3:return.001;case-2:return.01;case-1:return.1;case 0:return 1;case 1:return 10;case 2:return 100;case 3:return 1e3;case 4:return 1e4;case 5:return 1e5;case 6:return 1e6;case 7:return 1e7;case 8:return 1e8;case 9:return 1e9;case 10:return 1e10;case 11:return 1e11;case 12:return 1e12;case 13:return 1e13;case 14:return 1e14;case 15:return 1e15;default:return Math.pow(10,e)}}}t.SartoMath=i},function(e,t){e.exports=require("url")},function(e,t){e.exports=require("http")},function(e,t){e.exports=require("child_process")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(7),i=s(4);!function(e){e.EVENT_RESTART="restart"}(t.EnumTaskManagementEvent||(t.EnumTaskManagementEvent={}));class n extends a.CubisRestResponse{constructor(e){super(e)}getErrorList(){
return JSON.parse(this.rawReturns.errorList)}}t.TaskValCreaUpdResponse=n;t.TaskProxy=class extends a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="task/management"}getTaskTemplate(){let e,t;return this.body.method=i.RestMethodsTASK_MANAGEMENT.getTaskTemplate,this.body.params={taskTemplate:{}},e=new a.CubisRestResponse(this.syncRequest()),t=JSON.parse(e.rawReturns.taskTemplate)}readTask(e,t=!0){let s,n;if(this.body.method=i.RestMethodsTASK_MANAGEMENT.readTask,this.body.params={document:{},dbId:e,updateOptions:t},!(s=new a.CubisRestResponse(this.syncRequest())).isSuccess())throw new Error("Error reading task with id '"+e+"'");return n=JSON.parse(s.rawReturns.document)}getTaskName(e){try{let t=this.readTask(e).params.find(e=>"TASK/IDENTIFICATION"===e.id);if(void 0!==t){let e=t.parameters.find(e=>"TASK/IDENTIFICATION/NAME"===e.id);if(void 0!==e)return e.value.string}return}catch(e){return}}createTask(e){return this.body.method=i.RestMethodsTASK_MANAGEMENT.createTask,
this.body.params={task:JSON.stringify(e),errorList:[]},new n(this.syncRequest())}updateTask(e){return this.body.method=i.RestMethodsTASK_MANAGEMENT.updateTask,this.body.params={task:JSON.stringify(e),errorList:[]},new n(this.syncRequest())}validateTask(e){return this.body.method=i.RestMethodsTASK_MANAGEMENT.validate,this.body.params={task:JSON.stringify(e),errorList:[]},new n(this.syncRequest())}saveWorkstate(e,t){let s;if(this.body.method=i.RestMethodsTASK_MANAGEMENT.saveWorkstate,this.body.params={id:t,workstate:e},!(s=new a.CubisRestResponse(this.syncRequest())).isSuccess())throw new Error("Error saving workstate with id '"+t+"'");return s}deleteWorkstate(e){let t;if(this.body.method=i.RestMethodsTASK_MANAGEMENT.deleteWorkstate,this.body.params={id:e},!(t=new a.CubisRestResponse(this.syncRequest())).isSuccess())throw new Error("Error deleting workstate with id '"+e+"'");return t}getWorkstate(e){let t,s;if(this.body.method=i.RestMethodsTASK_MANAGEMENT.getWorkstate,this.body.params={
id:e,workstate:{}},!(t=new a.CubisRestResponse(this.syncRequest())).isSuccess())throw new Error("Error reading task with id '"+e+"'");return s=JSON.parse(t.rawReturns.workstate).workstate}getTaskNamesByOrderNumber(e){let t;if(this.body.method=i.RestMethodsTASK_MANAGEMENT.getTaskNamesByOrderNumber,this.body.params={orderNumber:e,taskNames:[]},(t=new a.CubisRestResponse(this.syncRequest())).isSuccess())return JSON.parse(t.rawReturns.taskNames);throw new Error("Error getting used taskNames for '"+e+"'")}setTaskEvent(e,t){let s;console.log(`TaskManagementProxy: send event: '${t}'`),this.body.method=i.RestMethodsTASK_MANAGEMENT.setTaskEvent,this.body.params={taskId:e,event:t};try{return(s=new a.CubisRestResponse(this.syncRequest())).isSuccess()}catch(e){return console.log("Something went wrong when calling sendTaskEvent"),console.log(e),!1}}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const a=s(18),i=s(49),n=s(7),r=s(16),o=s(35),E=s(28),_=s(15),l=s(80),c=s(4),u=s(20),T=s(62);var A,p=s(49);t.Subscription=p.Subscription,t.Observable=p.Observable,t.WEIGHING_BUTTON_UNIT="UNIT",t.WEIGHING_BUTTON_DO_ZERO="DO_ZERO",t.WEIGHING_BUTTON_DO_TARE="DO_TARE",t.WEIGHING_BUTTON_DO_TARE1="DO_TARE1",t.WEIGHING_BUTTON_CLR_TARE1="CLR_TARE1",t.WEIGHING_BUTTON_SET_TARE1="SET_TARE1",t.WEIGHING_BUTTON_SHOW_TARE1="SHOW_TARE1",t.WEIGHING_BUTTON_HIDE_TARE1="HIDE_TARE1",t.WEIGHING_BUTTON_DISPLAY="DISPLAY",function(e){e.WEIGHING_DOZEROTARE_BEHAVIOR_AS_CONFIGURED="AS_CONFIGURED",e.WEIGHING_DOZEROTARE_BEHAVIOR_WITHOUT_STABILITY="WITHOUT_STABILITY",e.WEIGHING_DOZEROTARE_BEHAVIOR_AFTER_STABILITY="AFTER_STABILITY"}(t.WEIGHING_DOZEROTARE_BEHAVIOR||(t.WEIGHING_DOZEROTARE_BEHAVIOR={})),function(e){e.SELECTED_DOMAIN_UNDEFINED="",e.SELECTED_DOMAIN_WEIGHING="ORIGINAL",e.SELECTED_DOMAIN_APP="APPLICATION"}(A=t.ISelectedWeightDisplayValueDomains||(t.ISelectedWeightDisplayValueDomains={}))
;const d="WEIGHING_ERROR_UNKNOWN_UNIT_ID";t.WeighingProxy=class extends n.BaseProxy{constructor(){super(...arguments),this.restEndpoint="weighing",this.weighValueMaxDigits=7,this.registeredApplications=[],this.weighingButtonAppearances={[T.WEIGHING_BUTTON_ID.UNIT]:"undefined",[T.WEIGHING_BUTTON_ID.DO_ZERO]:"undefined",[T.WEIGHING_BUTTON_ID.DO_TARE]:"undefined",[T.WEIGHING_BUTTON_ID.DO_TARE1]:"undefined",[T.WEIGHING_BUTTON_ID.CLR_TARE1]:"undefined",[T.WEIGHING_BUTTON_ID.SET_TARE1]:"undefined",[T.WEIGHING_BUTTON_ID.SHOW_TARE1]:"undefined",[T.WEIGHING_BUTTON_ID.HIDE_TARE1]:"undefined",[T.WEIGHING_BUTTON_ID.DISPLAY]:"undefined"},this.metrologyMaximum$=new i.ReplaySubject(1),this.metrologyMinimum$=new i.ReplaySubject(1),this.highestRangeInterval$=new i.ReplaySubject(1),this.lowestRangeInterval$=new i.ReplaySubject(1),this.highestRangePrecision$=new i.ReplaySubject(1),this.lowestRangePrecision$=new i.ReplaySubject(1),this.metrologyRanges$=new i.ReplaySubject(1),
this.selectedDisplayValue$=new i.ReplaySubject(1),this.lastSelectedDisplayValueInfo={currentSelectedDomain:A.SELECTED_DOMAIN_UNDEFINED,currentSelectedId:"",lastSelectedApplicationId:""}}createWeightApplication(e,t,s,a,i=!1){if(this.registeredApplications.find(t=>t===e))return this.enableWeightApplication(e,i);{this.body.method=c.RestMethodsWEIGHING.createWeightApplication,this.body.params={id:e,title:t,header:s,isDynamic:a};let r=new n.CubisRestResponse(this.syncRequest());if(r.isSuccess()){try{this.enableWeightApplication(e,i)}catch(e){}this.registeredApplications.push(e)}return r}}enableWeightApplication(e,t){return this.body.method=c.RestMethodsWEIGHING.enableWeightApplication,this.body.params={id:e,isEnabled:t},new n.CubisRestResponse(this.syncRequest())}enableWeightApplicationBulk(e,t){if(!t){let t=this.getSelectedDisplayValue();if(t){let s=t.lastSelectedApplicationId;if(s){let t=!1;return e.forEach(e=>{e!==s?this.enableWeightApplication(e,!1):t=!0}),
void(t&&this.enableWeightApplication(s,!1))}}}e.forEach(e=>{this.enableWeightApplication(e,t)})}selectWeightApplication(e){return this.body.method=c.RestMethodsWEIGHING.selectWeightApplication,this.body.params={id:e},new n.CubisRestResponse(this.syncRequest())}destroyWeightApplication(e){this.body.method=c.RestMethodsWEIGHING.destroyWeightApplication,this.body.params={id:e};let t=new n.CubisRestResponse(this.syncRequest());if(t.isSuccess()){let t=this.registeredApplications.findIndex(t=>t===e);t>=0&&this.registeredApplications.splice(t,1)}return t}setButton(e,t){return this.weighingButtonAppearances[e]===t?new n.CubisRestResponse(!0):(this.weighingButtonAppearances[e]=t,this.body.method=c.RestMethodsWEIGHING.setButton,this.body.params={name:e,appearance:t},new n.CubisRestResponse(this.syncRequest()))}triggerStableWeightBlock(){return this.body.method=c.RestMethodsWEIGHING.triggerStableWeightBlock,this.body.params={},new n.CubisRestResponse(this.syncRequest())}cancelStableWeightBlock(){
return this.body.method=c.RestMethodsWEIGHING.cancelStableWeightBlock,this.body.params={},new n.CubisRestResponse(this.syncRequest())}doZero(e){return this.body.method=c.RestMethodsWEIGHING.doZero,this.body.params={behavior:e},new n.CubisRestResponse(this.syncRequest())}clearTare1(){return this.body.method=c.RestMethodsWEIGHING.clearTare1,this.body.params={},new n.CubisRestResponse(this.syncRequest())}clearTare2(){return this.body.method=c.RestMethodsWEIGHING.clearTare2,this.body.params={},new n.CubisRestResponse(this.syncRequest())}clearTare1AndTare2(){return{clearTare1Response:this.clearTare1(),clearTare2Response:this.clearTare2()}}clearTareAll(){return this.body.method=c.RestMethodsWEIGHING.clearTareAll,this.body.params={},new n.CubisRestResponse(this.syncRequest())}doTare(e){return this.body.method=c.RestMethodsWEIGHING.doTare,this.body.params={behavior:e},new n.CubisRestResponse(this.syncRequest())}doTare1(e){return this.body.method=c.RestMethodsWEIGHING.doTare1,this.body.params={
behavior:e},new n.CubisRestResponse(this.syncRequest())}doTareAuto(e){return this.body.method=c.RestMethodsWEIGHING.doTareAuto,this.body.params={behavior:e},new n.CubisRestResponse(this.syncRequest())}doZeroTareAuto(e){return this.body.method=c.RestMethodsWEIGHING.doZeroTareAuto,this.body.params={behavior:e},new n.CubisRestResponse(this.syncRequest())}setTare1(e){return this.body.method=c.RestMethodsWEIGHING.setTare1,this.body.params={value:e},new n.CubisRestResponse(this.syncRequest())}cancelDoing(){return this.body.method=c.RestMethodsWEIGHING.cancelDoing,this.body.params={},new n.CubisRestResponse(this.syncRequest())}setTare2(e){return this.body.method=c.RestMethodsWEIGHING.setTare2,this.body.params={value:e},new n.CubisRestResponse(this.syncRequest())}setUnit(e,t=!0){this.body.method=c.RestMethodsWEIGHING.setUnit,this.body.params={unitId:e};let s=new n.CubisRestResponse(this.syncRequest());if(s.isSuccess())return!0;if(s.result===d){if(t){
let t=new E.MessageHandlerHelper(new o.MessageHandlerProxy),s=new l.ProfileManagementProxy,a=_.QAppBase.clientSingleton.getWeighingProfileId();t.addMessage(E.EMsgHandlerMsgs.ERR_704_UNIT_UNAVAILABLE,[_.QAppBase.clientSingleton.getTaskName()||"",u.getUnitString(e),a?s.getWeighingProfileName(a):""],void 0,[o.createMessageHandlerButton(void 0,void 0,o.MessageHandlerCallTarget.REMOVE_MESSAGE)]),_.QAppBase.clientSingleton.doSuspend()}return!1}return!1}getParameter(e){return this.body.method=c.RestMethodsWEIGHING.getParameter,this.body.params={rObject:{},id:e},new n.CubisRestResponse(this.syncRequest())}getParameterIds(){return this.body.method=c.RestMethodsWEIGHING.getParameterIds,this.body.params={rIds:{}},new n.CubisRestResponse(this.syncRequest())}setMinUsp(e){return this.body.method=c.RestMethodsWEIGHING.setMinUsp,this.body.params={isEnabled:!0,value:r.QuantityParameter.getValue(e),unit:e.unit},new n.CubisRestResponse(this.syncRequest())}setMinWeight(e){
return this.body.method=c.RestMethodsWEIGHING.setMinWeight,this.body.params=Object.assign({},e),new n.CubisRestResponse(this.syncRequest())}getWeighValueMaxDigits(){return this.weighValueMaxDigits}updateWeighValueMaxDigits(e){console.log("Weighing proxy: set new max weight value digit count: "+e),this.weighValueMaxDigits=e}updateMetrologyRanges(e){let t=a.last(e.parameters),s=a.head(e.parameters);if(this.metrologyRanges$.next(e),void 0!==t){let e=t.parameters.find(e=>"MAXIMUM"===a.last(e.id.split("/"))),s=t.parameters.find(e=>"INTERVAL"===a.last(e.id.split("/"))),i=t.parameters.find(e=>"PRECISION"===a.last(e.id.split("/")));void 0!==e&&this.metrologyMaximum$.next({maxUnit:e.value.unit,maxValue:r.QuantityParameter.getValue(e),maxDecimals:e.value.decimals}),void 0!==s&&this.highestRangeInterval$.next({intervalUnit:s.value.unit,intervalValue:r.QuantityParameter.getValue(s),intervalDecimals:s.value.decimals}),void 0!==i&&this.highestRangePrecision$.next({precisionUnit:i.value.unit,
precisionValue:r.QuantityParameter.getValue(i),precisionDecimals:i.value.decimals})}if(void 0!==s){let e=s.parameters.find(e=>"MINIMUM"===a.last(e.id.split("/"))),t=s.parameters.find(e=>"INTERVAL"===a.last(e.id.split("/"))),i=s.parameters.find(e=>"PRECISION"===a.last(e.id.split("/")));void 0!==e&&this.metrologyMinimum$.next({minUnit:e.value.unit,minValue:r.QuantityParameter.getValue(e),minDecimals:e.value.decimals}),void 0!==t&&this.lowestRangeInterval$.next({intervalUnit:t.value.unit,intervalValue:r.QuantityParameter.getValue(t),intervalDecimals:t.value.decimals}),void 0!==i&&this.lowestRangePrecision$.next({precisionUnit:i.value.unit,precisionValue:r.QuantityParameter.getValue(i),precisionDecimals:i.value.decimals})}}getSelectedDisplayValue(){return this.lastSelectedDisplayValueInfo}restoreLastSelectedDisplayValue(e){void 0!==this.lastSelectedDisplayValueInfo&&(this.lastSelectedDisplayValueInfo.lastSelectedApplicationId=e,
this.selectedDisplayValue$.next(this.lastSelectedDisplayValueInfo))}updateLastSelectedDisplayValue(e){try{console.log("WeighingProxy::updateLastSelectedDisplayValue: "+JSON.stringify(e));let t={currentSelectedDomain:e.show,currentSelectedId:e.id,lastSelectedApplicationId:""};t.currentSelectedDomain===A.SELECTED_DOMAIN_APP?t.lastSelectedApplicationId=e.id:void 0!==this.lastSelectedDisplayValueInfo&&(t.lastSelectedApplicationId=this.lastSelectedDisplayValueInfo.lastSelectedApplicationId),this.lastSelectedDisplayValueInfo=t,console.log("WeighingProxy::updateLastSelectedDisplayValue: new: "+JSON.stringify(this.lastSelectedDisplayValueInfo)),this.selectedDisplayValue$.next(this.lastSelectedDisplayValueInfo)}finally{}}insertWeightInvalidation(e,t){return this.body.method=c.RestMethodsWEIGHING.insertWeightInvalidation,this.body.params={group:e,topic:t},new n.CubisRestResponse(this.syncRequest())}removeWeightInvalidation(e,t){
return this.body.method=c.RestMethodsWEIGHING.removeWeightInvalidation,this.body.params={group:e,topic:t},new n.CubisRestResponse(this.syncRequest())}setAmbientCondition(e){return this.body.method=c.RestMethodsWEIGHING.setAmbientCondition,this.body.params={ambientConditionId:e},new n.CubisRestResponse(this.syncRequest())}}},function(e,t){e.exports=require("rxjs")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(3),i=s(11),n=s(0);function r(e){return"string"==typeof e.name&&"string"==typeof e.message}t.ERRORMSGBOX_OK_BTN_ID="BTN_OK_ERRORMSGBOX",t.isError=r,t.createMsgBoxData=function(e,s,o,E,_){let l=[];return r(o)?l.push({id:o.name+":"+o.message,args:[]}):a.isITextStructure(o)?l.push(o):l.push({id:o.error.name+":"+o.error.message,args:o.msgargs}),void 0!==E&&l.push(E),{type:e,title:s,textList:l,buttons:[{id:_||t.ERRORMSGBOX_OK_BTN_ID,label:{id:i.EnumFontLabels.OK,args:[]},appearance:n.EnumAppearance.ENABLED_SECONDARY}]}}},function(e,t){
e.exports=require("path")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(13),i=s(65),n=s(0),r=s(9),o=s(36),E=s(2);t.WEIGHING_SCREEN_ID="WEIGHING",t.CANCEL_BARBUTTON_ID="BTN_BAR_CANCEL";const _={buttonId:"BARBUTTON/CANCEL",label:{id:"",args:[]},appearance:n.EnumAppearance.HIDDEN};t.WeighingScreen=class extends r.AbstractScreen{constructor(e,t){super(e),this.buttonList=[],this.text1={value:"",wildcards:[]},this.text2={value:"",wildcards:[]},this.param1="",this.param2="",this.title=void 0,this.createBarButtons(t),this.publishBarButtons(),this.checkBarGraph=new i.CheckBarGraph(e),this.cancelBarButton=new a.default(this.mqttHandler,this,_)}getId(){return t.WEIGHING_SCREEN_ID}getBarButtonId(){return E.MqttTopics.HMI_WEIGHING_SCREEN_BARBUTTONS}createBarButtons(e){e.sort(this.compareButtonBarButtons);for(let t of e){let e=new a.default(this.mqttHandler,this,t);this.buttonList.push(e),e.publish()}}publishBarButtons(){let e=[]
;for(let t of this.buttonList)e.push(E.MqttTopics.QAPP_NAMESPACE+"/"+t.getTopic());this.mqttHandler.publish(this.getBarButtonId(),JSON.stringify(e))}setText1(e,t){let s=!1;this.text1.value!==e&&(this.text1.value=e,s=!0),t&&this.text1.wildcards.join()!==t.join()&&(this.text1.wildcards=t,s=!0),s&&this.publishText1()}compareButtonBarButtons(e,t){return o.getButtonPriority(e.buttonId)-o.getButtonPriority(t.buttonId)}publishText1(){this.mqttHandler.publish(E.MqttTopics.HMI_WEIGHING_SCREEN_INSTRUCTION1,JSON.stringify(this.text1),{retain:!0})}publishText2(){this.mqttHandler.publish(E.MqttTopics.HMI_WEIGHING_SCREEN_INSTRUCTION2,JSON.stringify(this.text2),{retain:!0})}setText2(e,t){let s=!1;this.text2.value!==e&&(this.text2.value=e,s=!0),t&&this.text2.wildcards.join()!==t.join()&&(this.text2.wildcards=t,s=!0),s&&this.publishText2()}publishTitle(){this.title?this.mqttHandler.publish(E.MqttTopics.HMI_WEIGHING_SCREEN_TITLE,JSON.stringify(this.title),{retain:!0
}):this.mqttHandler.publish(E.MqttTopics.HMI_WEIGHING_SCREEN_TITLE,"",{retain:!0})}setTitle(e){let t=void 0;this.title&&(t=JSON.stringify(this.title)),this.title=e,this.title!==t&&this.publishTitle()}getText1(){return this.text1}getText2(){return this.text2}publishParam1(){this.mqttHandler.publish(E.MqttTopics.HMI_WEIGHING_SCREEN_PARAM1_TOPIC,JSON.stringify(this.param1),{retain:!0})}publishParam2(){this.mqttHandler.publish(E.MqttTopics.HMI_WEIGHING_SCREEN_PARAM2_TOPIC,JSON.stringify(this.param2),{retain:!0})}setParam1(e){this.param1!==e&&(this.param1=e,this.publishParam1())}setParam2(e){this.param2!==e&&(this.param2=e,this.publishParam2())}getParam1(){return this.param1}getParam2(){return this.param2}getButton(e){if(e===t.CANCEL_BARBUTTON_ID)return this.cancelBarButton;for(let t of this.buttonList)if(t.getButtonId()===e)return t}show(){this.publishText1(),this.publishText2(),this.publishTitle(),this.publishParam1(),this.publishParam2();for(let e of this.buttonList)e.publish()
;super.show()}getCheckBarGraph(){return this.checkBarGraph}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.PERSISTENCY_SCOPE_QAPP_INDEPENDENT="PERSISTENCY_SCOPE_QAPP_INDEPENDENT",e.PERSISTENCY_SCOPE_QAPP_SPECIFIC="PERSISTENCY_SCOPE_QAPP_SPECIFIC",e.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION="PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION",e.PERSISTENCY_SCOPE_TASk_SPECIFIC="PERSISTENCY_SCOPE_TASk_SPECIFIC"}(t.EnumPersistencyScope||(t.EnumPersistencyScope={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(8),i=s(12);class n{constructor(){this.id=0,this.serial="",this.taskId="",this.version=0}static createTableNameNoSchemaVersion(e,t){return`${0===e.length?"global":e}_${t}`}static createTableName(e,t,s){return n.generateTableNameWithVersion(n.createTableNameNoSchemaVersion(e,t),s)}static generateTableNameWithVersion(e,t){if(isNaN(t))throw new Error("QApp entities are not permitted to have no schema version")
;return`${e}_${t}`}static getSchemaVersionFromTableName(e){return parseInt(e.substr(e.lastIndexOf("_")+1),10)}static getPureTableNameFromTableName(e){return e.substr(0,e.lastIndexOf("_"))}prepForUpdate(){delete this.version,delete this.serial,delete this.taskId}}a.__decorate([i.PrimaryGeneratedColumn(),a.__metadata("design:type",Number)],n.prototype,"id",void 0),a.__decorate([i.Column(),a.__metadata("design:type",String)],n.prototype,"serial",void 0),a.__decorate([i.Column(),a.__metadata("design:type",String)],n.prototype,"taskId",void 0),a.__decorate([i.VersionColumn(),a.__metadata("design:type",Number)],n.prototype,"version",void 0),t.QAppBaseEntity=n},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(8),i=s(12),n=s(21),r=s(5),o=s(31),E=s(6);t.DB_TABLE_NAME_PRODUCTS_1="QAPP002_productentity_1",t.DB_TABLE_NAME_PRODUCTS_2="QAPP002_productentity_2",function(e){e.QAPP002_productentity_1="QAPP002_productentity_1",
e.QAPP002_productentity_2="QAPP002_productentity_2"}(t.EnumDbTableNamesPreviousProductsTables||(t.EnumDbTableNamesPreviousProductsTables={})),t.DB_TABLE_NAME_PRODUCTS="QAPP002_product_3";let _=class{constructor(e){this.id=0,this.productId="",this.lockedBy="",this.validDataset=!1,this.content="",!1===r.isObject(e)&&(e=n.createProduct()),this.id=e.databaseId,this.productId=e.productId,this.validDataset=e.validDataset,this.content=JSON.stringify(e)}};a.__decorate([i.PrimaryGeneratedColumn("increment"),a.__metadata("design:type",Number)],_.prototype,"id",void 0),a.__decorate([i.Column({unique:!0,type:"varchar"}),a.__metadata("design:type",String)],_.prototype,"productId",void 0),a.__decorate([i.Column({type:"varchar"}),a.__metadata("design:type",String)],_.prototype,"lockedBy",void 0),a.__decorate([i.Column(),a.__metadata("design:type",Boolean)],_.prototype,"validDataset",void 0),a.__decorate([i.Column("simple-json"),a.__metadata("design:type",String)],_.prototype,"content",void 0),
_=a.__decorate([i.Entity(t.DB_TABLE_NAME_PRODUCTS),a.__metadata("design:paramtypes",[Object])],_),t.ProductEntity=_,t.loadProductList=function(e,s){e.showLoadingScreen({id:e.l("_QAPP002_INFO_DB_QUERY_READ"),args:[t.DB_TABLE_NAME_PRODUCTS]}),void 0!==e.dbConnection&&e.dbConnection.isConnected?(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]=e.addTimer(o.TIMEOUT_DATABASE_REQUEST,{topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Unexpected base timeout triggered after "+o.TIMEOUT_DATABASE_REQUEST.toFixed(0)+"ms."}),e.dbConnection.createQueryBuilder(_,"alias").select(["alias.id","alias.productId","alias.validDataset"]).orderBy("alias.productId").getMany().then(t=>{if(e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]),r.isObject(t)&&Array.isArray(t)){e.products={};for(let s=0;s<t.length;s++)r.isNumber(t[s].id)&&t[s].id>=0&&t[s].productId.length>0&&(e.products[t[s].id]=n.createProduct(),e.products[t[s].id].databaseId=t[s].id,
e.products[t[s].id].productId=t[s].productId,e.products[t[s].id].validDataset=t[s].validDataset);e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!0,result:!0}))}else e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Wrong format"}))}).catch(t=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))})):e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Database not accessible"}))},t.storeProduct=function(e,s,a){if(e.showLoadingScreen({id:e.l("_QAPP002_INFO_DB_QUERY_WRITE"),args:[t.DB_TABLE_NAME_PRODUCTS]}),void 0!==e.dbConnection&&e.dbConnection.isConnected){e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]=e.addTimer(o.TIMEOUT_DATABASE_REQUEST,{topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,
result:"Unexpected base timeout triggered after "+o.TIMEOUT_DATABASE_REQUEST.toFixed(0)+"ms."});let t=new _(a);-1===t.id?e.dbConnection.getRepository(_).insert(t).then(t=>(e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]),1===t.identifiers.length&&r.isNumber(t.identifiers[0].id)?(a.databaseId=t.identifiers[0].id,void e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!0,result:!0}))):void e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Missing Primary Key from insertResult"})))).catch(t=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))}):e.dbConnection.getRepository(_).save(t).then(()=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,
success:!0,result:!0}))}).catch(t=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))})}else e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Database not accessible"}))},t.loadProduct=function(e,s,a){e.showLoadingScreen({id:e.l("_QAPP002_INFO_DB_QUERY_READ"),args:[t.DB_TABLE_NAME_PRODUCTS]}),void 0!==e.dbConnection&&e.dbConnection.isConnected?(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]=e.addTimer(o.TIMEOUT_DATABASE_REQUEST,{topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Unexpected base timeout triggered after "+o.TIMEOUT_DATABASE_REQUEST.toFixed(0)+"ms."}),e.dbConnection.createQueryBuilder(_,"alias").select(["alias.id","alias.lockedBy","alias.productId","alias.content"]).where("alias.id = '"+a+"'").getOne().then(t=>{
if(e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]),r.isObject(t)&&r.isString(t.content))try{return e.product=n.createProduct(JSON.parse(t.content)),e.product.databaseId=t.id,n.verifyProduct(e.product,!1),void e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!0,result:!0}))}catch(t){return void e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))}}).catch(t=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))})):e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Database not accessible"}))},t.loadAllProducts=function(e,s){e.showLoadingScreen({id:e.l("_QAPP002_INFO_DB_QUERY_READ"),args:[t.DB_TABLE_NAME_PRODUCTS]}),
void 0!==e.dbConnection&&e.dbConnection.isConnected?(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]=e.addTimer(o.TIMEOUT_DATABASE_REQUEST,{topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Unexpected base timeout triggered after "+o.TIMEOUT_DATABASE_REQUEST.toFixed(0)+"ms."}),e.dbConnection.createQueryBuilder(_,"alias").select(["alias.id","alias.productId","alias.content"]).getMany().then(t=>{if(e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]),r.isObject(t)&&Array.isArray(t)){e.products={};for(let a=0;a<t.length;a++)if(r.isObject(t[a])&&r.isString(t[a].content)){let i=void 0;try{i=JSON.parse(t[a].content)}catch(t){return void e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))}e.products[t[a].id]=n.createProduct(i),e.products[t[a].id].databaseId=t[a].id,n.verifyProduct(e.products[t[a].id],!1)}e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!0,
result:!0}))}}).catch(t=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))})):e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Database not accessible"}))},t.removeProduct=function(e,s,a){if(e.showLoadingScreen({id:e.l("_QAPP002_INFO_DB_QUERY_DELETE"),args:[t.DB_TABLE_NAME_PRODUCTS]}),void 0!==e.dbConnection&&e.dbConnection.isConnected){e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]=e.addTimer(o.TIMEOUT_DATABASE_REQUEST,{topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Unexpected base timeout triggered after "+o.TIMEOUT_DATABASE_REQUEST.toFixed(0)+"ms."});let t=new _(a);e.dbConnection.getRepository(_).remove(t).then(()=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,
success:!0,result:!0}))}).catch(t=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProductEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))})}else e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Database not accessible"}))}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(8),i=s(12),n=s(21),r=s(5),o=s(31),E=s(6);t.DB_TABLE_NAME_BATCH="QAPP002_batch_3";let _=class{constructor(e){this.id=0,this.lockedBy="",this.status="",this.lotId="",this.productFk=-1,this.productId="",this.timeStart="",this.timeEnd="",this.content="",!1===r.isObject(e)&&(e=n.createBatch()),e=e,this.id=e.databaseId,this.lotId=e.lotId,this.productFk=e.product.databaseId,this.productId=e.product.productId,this.timeStart=e.timeStart,this.timeEnd=e.timeEnd,this.status=e.status,this.content=JSON.stringify(e)}}
;a.__decorate([i.PrimaryGeneratedColumn("increment"),a.__metadata("design:type",Number)],_.prototype,"id",void 0),a.__decorate([i.Column({type:"varchar"}),a.__metadata("design:type",String)],_.prototype,"lockedBy",void 0),a.__decorate([i.Column({type:"varchar"}),a.__metadata("design:type",String)],_.prototype,"status",void 0),a.__decorate([i.Column({unique:!0,type:"varchar"}),a.__metadata("design:type",String)],_.prototype,"lotId",void 0),a.__decorate([i.Column({type:"int"}),a.__metadata("design:type",Number)],_.prototype,"productFk",void 0),a.__decorate([i.Column({type:"varchar"}),a.__metadata("design:type",String)],_.prototype,"productId",void 0),a.__decorate([i.Column({type:"varchar"}),i.Column(),a.__metadata("design:type",String)],_.prototype,"timeStart",void 0),a.__decorate([i.Column({type:"varchar"}),i.Column(),a.__metadata("design:type",String)],_.prototype,"timeEnd",void 0),a.__decorate([i.Column("simple-json"),a.__metadata("design:type",String)],_.prototype,"content",void 0),
_=a.__decorate([i.Entity(t.DB_TABLE_NAME_BATCH),a.__metadata("design:paramtypes",[Object])],_),t.BatchEntity=_,t.loadBatchList=function(e,s){e.showLoadingScreen({id:e.l("_QAPP002_INFO_DB_QUERY_READ"),args:[t.DB_TABLE_NAME_BATCH]}),void 0!==e.dbConnection&&e.dbConnection.isConnected?(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"BatchEntity"]=e.addTimer(4e4,{topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Unexpected base timeout triggered after 40s."}),e.dbConnection.createQueryBuilder(_,"alias").select(["alias.id","alias.lotId","alias.productFk","alias.productId"]).getMany().then(t=>{if(e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"BatchEntity"]),r.isObject(t)){e.batchesOverview={};for(let s=0;s<t.length;s++)r.isNumber(t[s].id)&&t[s].id>=0&&t[s].lotId.length>0&&(e.batchesOverview[t[s].id]=n.createBatchShort(),e.batchesOverview[t[s].id].databaseId=t[s].id,e.batchesOverview[t[s].id].lotId=t[s].lotId,e.batchesOverview[t[s].id].product.databaseId=t[s].productFk,
e.batchesOverview[t[s].id].product.productId=t[s].productId);e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!0,result:!0}))}else e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Wrong format"}))}).catch(t=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"BatchEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))})):e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Database not accessible"}))},t.storeBatch=function(e,s,a){if(e.showLoadingScreen({id:e.l("_QAPP002_INFO_DB_QUERY_WRITE"),args:[t.DB_TABLE_NAME_BATCH]}),void 0!==e.dbConnection&&e.dbConnection.isConnected){e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"BatchEntity"]=e.addTimer(o.TIMEOUT_DATABASE_REQUEST,{topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,
result:"Unexpected base timeout triggered after "+o.TIMEOUT_DATABASE_REQUEST.toFixed(0)+"ms."});let t=new _(a);-1===t.id?e.dbConnection.getRepository(_).insert(t).then(t=>(e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"BatchEntity"]),1===t.identifiers.length&&r.isNumber(t.identifiers[0].id)?(a.databaseId=t.identifiers[0].id,void e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!0,result:!0}))):void e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Missing Primary Key from insertResult"})))).catch(t=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"BatchEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))}):e.dbConnection.getRepository(_).save(t).then(()=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"BatchEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!0,
result:!0}))}).catch(t=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"BatchEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))})}else e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Database not accessible"}))},t.loadBatch=function(e,s,a){e.showLoadingScreen({id:e.l("_QAPP002_INFO_DB_QUERY_READ"),args:[t.DB_TABLE_NAME_BATCH]}),void 0!==e.dbConnection&&e.dbConnection.isConnected?(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"BatchEntity"]=e.addTimer(o.TIMEOUT_DATABASE_REQUEST,{topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Unexpected base timeout triggered after "+o.TIMEOUT_DATABASE_REQUEST.toFixed(0)+"ms."}),e.dbConnection.createQueryBuilder(_,"alias").select(["alias.id","alias.lockedBy","alias.content"]).where("alias.id = '"+a+"'").getOne().then(t=>{if(e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"BatchEntity"]),
r.isObject(t)&&r.isString(t.content)){let a=void 0;try{a=JSON.parse(t.content)}catch(t){return void e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))}return e.batch=n.createBatch(a),e.batch.databaseId=t.id,void e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!0,result:!0}))}}).catch(t=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"BatchEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))})):e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Database not accessible"}))},t.removeBatch=function(e,s,a){if(e.showLoadingScreen({id:e.l("_QAPP002_INFO_DB_QUERY_DELETE"),args:[t.DB_TABLE_NAME_BATCH]}),void 0!==e.dbConnection&&e.dbConnection.isConnected){e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"BatchEntity"]=e.addTimer(o.TIMEOUT_DATABASE_REQUEST,{
topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Unexpected base timeout triggered after "+o.TIMEOUT_DATABASE_REQUEST.toFixed(0)+"ms."});let t=new _;t.id=a,e.dbConnection.getRepository(_).remove(t).then(()=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"BatchEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!0,result:!0}))}).catch(t=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"BatchEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))})}else e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Database not accessible"}))}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(8),i=s(12),n=s(21),r=s(5),o=s(31),E=s(6),_=s(1);t.DB_TABLE_NAME_TESTPROCESS="QAPP002_testprocess_3";let l=class{constructor(e,t){this.id=0,this.lockedBy="",this.batchFk=-1,
this.productFk=-1,this.status="",this.lotId="",this.productId="",this.sequenceNumber=0,this.timeStart="",this.timeEnd="",this.content="",!1===r.isObject(t)&&(t=n.createProcess()),!1===r.isObject(e)&&(e=n.createBatch()),t=t,e=e,this.id=t.databaseId,this.batchFk=e.databaseId,this.productFk=e.product.databaseId,this.lotId=e.lotId,this.productId=e.product.productId,this.timeStart=t.timeStart,this.timeEnd=t.timeEnd,this.sequenceNumber=t.sequenceNumber,this.status=t.status,this.content=JSON.stringify(t)}};a.__decorate([i.PrimaryGeneratedColumn("increment"),a.__metadata("design:type",Number)],l.prototype,"id",void 0),a.__decorate([i.Column({type:"varchar"}),a.__metadata("design:type",String)],l.prototype,"lockedBy",void 0),a.__decorate([i.Column({type:"int"}),a.__metadata("design:type",Number)],l.prototype,"batchFk",void 0),a.__decorate([i.Column({type:"int"}),a.__metadata("design:type",Number)],l.prototype,"productFk",void 0),a.__decorate([i.Column({type:"varchar"
}),a.__metadata("design:type",String)],l.prototype,"status",void 0),a.__decorate([i.Column({type:"varchar"}),a.__metadata("design:type",String)],l.prototype,"lotId",void 0),a.__decorate([i.Column({type:"varchar"}),a.__metadata("design:type",String)],l.prototype,"productId",void 0),a.__decorate([i.Column({type:"int"}),a.__metadata("design:type",Number)],l.prototype,"sequenceNumber",void 0),a.__decorate([i.Column({type:"varchar"}),i.Column(),a.__metadata("design:type",String)],l.prototype,"timeStart",void 0),a.__decorate([i.Column({type:"varchar"}),i.Column(),a.__metadata("design:type",String)],l.prototype,"timeEnd",void 0),a.__decorate([i.Column("simple-json"),a.__metadata("design:type",String)],l.prototype,"content",void 0),l=a.__decorate([i.Entity(t.DB_TABLE_NAME_TESTPROCESS),a.__metadata("design:paramtypes",[Object,Object])],l),t.ProcessEntity=l,t.storeProcess=function(e,s,a,i){if(e.showLoadingScreen({id:e.l("_QAPP002_INFO_DB_QUERY_WRITE"),args:[t.DB_TABLE_NAME_TESTPROCESS]}),
void 0!==e.dbConnection&&e.dbConnection.isConnected){e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProcessEntity"]=e.addTimer(o.TIMEOUT_DATABASE_REQUEST,{topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Unexpected base timeout triggered after "+o.TIMEOUT_DATABASE_REQUEST.toFixed(0)+"ms."});const t=_.cloneJSON(i);t.samples=[];let n=new l(a,t);-1===n.id?e.dbConnection.getRepository(l).insert(n).then(t=>(e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProcessEntity"]),1===t.identifiers.length&&r.isNumber(t.identifiers[0].id)?(i.databaseId=t.identifiers[0].id,void e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!0,result:!0}))):void e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Missing Primary Key from insertResult"})))).catch(t=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProcessEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,
context:s,success:!1,result:t}))}):e.dbConnection.getRepository(l).save(n).then(()=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProcessEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!0,result:!0}))}).catch(t=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProcessEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))})}else e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Database not accessible"}))},t.loadProcessList=function(e,s,a){e.showLoadingScreen({id:e.l("_QAPP002_INFO_DB_QUERY_READ"),args:[t.DB_TABLE_NAME_TESTPROCESS]});let i="";r.isNumber(a)&&(i="(alias.batchFk = "+a.toFixed(0)+")"),void 0!==e.dbConnection&&e.dbConnection.isConnected?(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProcessEntity"]=e.addTimer(4e4,{topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,
result:"Unexpected base timeout triggered after 40s."}),e.dbConnection.createQueryBuilder(l,"alias").select(["alias.id","alias.lockedBy","alias.status","alias.batchFk","alias.productFk","alias.lotId","alias.timeStart","alias.timeEnd"]).where(i).getMany().then(t=>{if(e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProcessEntity"]),r.isObject(t)){e.processesOverview={};for(let s=0;s<t.length;s++)r.isNumber(t[s].id)&&t[s].id>=0&&t[s].lotId.length>0&&(e.processesOverview[t[s].id]=n.createProcessShort(),e.processesOverview[t[s].id].databaseId=t[s].id,e.processesOverview[t[s].id].status=r.setEnumSafely(t[s].status,n.EnumProcessStatus,n.EnumProcessStatus.FINISHED),e.processesOverview[t[s].id].databaseReferenceBatchFk=t[s].batchFk,e.processesOverview[t[s].id].lotId=t[s].lotId,e.processesOverview[t[s].id].databaseReferenceProductFk=t[s].productFk,e.processesOverview[t[s].id].timeStart=t[s].timeStart,e.processesOverview[t[s].id].timeEnd=t[s].timeEnd);e.addToEventQueue(new E.SimpleEvent({
topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!0,result:!0}))}else e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Wrong format"}))}).catch(t=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProcessEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))})):e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Database not accessible"}))},t.loadProcesses=function(e,s,a){e.showLoadingScreen({id:e.l("_QAPP002_INFO_DB_QUERY_READ"),args:[t.DB_TABLE_NAME_TESTPROCESS]}),void 0!==e.dbConnection&&e.dbConnection.isConnected?(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProcessEntity"]=e.addTimer(o.TIMEOUT_DATABASE_REQUEST,{topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Unexpected base timeout triggered after "+o.TIMEOUT_DATABASE_REQUEST.toFixed(0)+"ms."}),
e.dbConnection.createQueryBuilder(l,"alias").select(["alias.id","alias.lockedBy","alias.content"]).where("alias.id IN ("+a.join(",")+")").getMany().then(t=>{if(e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProcessEntity"]),r.isObject(t)){e.processes={};for(let a=0;a<t.length;a++)if(r.isNumber(t[a].id)&&r.isString(t[a].content)){let i=void 0;try{i=JSON.parse(t[a].content)}catch(t){return void e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))}e.processes[t[a].id]=n.createProcess(i),e.processes[t[a].id].databaseId=t[a].id,e.processes[t[a].id].lotId=t[a].lotId}e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!0,result:!0}))}else e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Wrong format"}))}).catch(t=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProcessEntity"]),e.addToEventQueue(new E.SimpleEvent({
topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))})):e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Database not accessible"}))},t.removeProcesses=function(e,s,a){e.showLoadingScreen({id:e.l("_QAPP002_INFO_DB_QUERY_DELETE"),args:[t.DB_TABLE_NAME_TESTPROCESS]}),void 0!==e.dbConnection&&e.dbConnection.isConnected?(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProcessEntity"]=e.addTimer(o.TIMEOUT_DATABASE_REQUEST,{topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Unexpected base timeout triggered after "+o.TIMEOUT_DATABASE_REQUEST.toFixed(0)+"ms."}),e.dbConnection.getRepository(l).createQueryBuilder().delete().where("id IN ("+a.join(",")+")").execute().then(()=>{e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProcessEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!0,result:!0}))}).catch(t=>{
e.cancelTimer(e.fsmTimers[o.DATABASE_ACTION_DONE_EVENT+"ProcessEntity"]),e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:t}))})):e.addToEventQueue(new E.SimpleEvent({topic:o.DATABASE_ACTION_DONE_EVENT,context:s,success:!1,result:"Database not accessible"}))}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(3),n=s(109);t.TAB_MQTT_SCREENS_STRING="SCREENS/",t.TAB_MQTT_TABS_STRING="/TABS/",t.TAB_MQTT_TAB_STRING="/TAB";t.TabBase=class{constructor(e,t,s=!1){this.tabData=void 0,this.screenId="",this.publishPending=!1,this.lastPublishedTabContent="",this.mqttHandler=e,this.screenId=t,this.singleTab=s}setTabData(e,t=!0){this.tabData=e,t&&this.publishIfEnabled()}publishIfEnabled(){this.publishPending=!1,void 0!==this.tabData&&this.tabData.appearance===a.EnumAppearance.ENABLED&&this.publish()}getTabId(){return void 0!==this.tabData?this.tabData.id:""}setTabContainerTitle(e,t=!0){
void 0!==this.tabData&&(this.tabData.containerTitle=e,t&&this.publishIfEnabled())}getTabContainerTitle(){return void 0!==this.tabData?this.tabData.containerTitle:i.createEmptyTextStructure()}setTabTitle(e,t=!0){void 0!==this.tabData&&(this.tabData.title=e,t&&this.publishIfEnabled())}getTabContainerIcon(){return void 0!==this.tabData&&this.tabData.topIcon||""}setTabContainerIcon(e,t=!0){void 0!==this.tabData&&(this.tabData.topIcon=e,t&&this.publishIfEnabled())}getTabTitle(){return void 0!==this.tabData?this.tabData.title:i.createEmptyTextStructure()}clearTabTopButtons(e=!0){void 0!==this.tabData&&(this.tabData.topbuttons.splice(0,this.tabData.topbuttons.length),e&&this.publishIfEnabled())}getButton(e){}getTabTopButtons(){return void 0!==this.tabData?this.tabData.topbuttons:[]}publishId(){return this.singleTab?t.TAB_MQTT_SCREENS_STRING+this.screenId+t.TAB_MQTT_TAB_STRING:void 0!==this.tabData?t.TAB_MQTT_SCREENS_STRING+this.screenId+t.TAB_MQTT_TABS_STRING+this.tabData.id:""}publish(){
if(void 0!==this.tabData){let e=JSON.stringify(this.tabData,n.functionReplacer);e!==this.lastPublishedTabContent&&(this.lastPublishedTabContent=e,this.mqttHandler.publish(this.publishId(),this.lastPublishedTabContent))}}setAppearance(e,t=!0){void 0!==this.tabData&&(this.tabData.appearance=e,t&&this.publish())}getId(){return this.screenId}hide(){this.setAppearance(a.EnumAppearance.HIDDEN)}show(){this.setAppearance(a.EnumAppearance.ENABLED)}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(1),i=s(0);var n;!function(e){e.TAB_PARAMLIST="PARAMLIST",e.TAB_FIGURE="FIGURE",e.TAB_GRAPH="GRAPH",e.TAB_MENU="MENU",e.TAB_TABLE="TABLE",e.TAB_BASE=""}(n=t.EnumTabType||(t.EnumTabType={})),t.TAB_PARAMLIST_TYPE_TOPIC="topics",t.TAB_PARAMLIST_TYPE_BULK="bulk",t.isITabParamList=function(e){return e.paramType===t.TAB_PARAMLIST_TYPE_TOPIC||void 0===e.paramType},t.isITabBulkParamList=function(e){return e.paramType===t.TAB_PARAMLIST_TYPE_BULK};const r={id:"",
appearance:i.EnumAppearance.HIDDEN,type:n.TAB_FIGURE,containerTitle:{id:"",args:[]},topIcon:"",title:{id:"",args:[]},topbuttons:[],imgref:{}};t.createEmptyITabFigure=function(){return a.cloneJSON(r)};const o={id:"",appearance:i.EnumAppearance.HIDDEN,type:n.TAB_PARAMLIST,displayHeader:!0,containerTitle:{id:"",args:[]},topIcon:"",title:{id:"",args:[]},topbuttons:[],params:[],paramType:t.TAB_PARAMLIST_TYPE_TOPIC};t.createEmptyITabGraph=function(){return _};const E={};t.createEmptyIGraphInterface=function(){return a.cloneJSON(E)},t.createEmptyITabParamList=function(){return a.cloneJSON(o)};const _={id:"",appearance:i.EnumAppearance.HIDDEN,type:n.TAB_GRAPH,containerTitle:{id:"",args:[]},topIcon:"",title:{id:"",args:[]},topbuttons:[],data:{}};t.TAB_MENU_TYPE_TOPIC="topics",t.TAB_MENU_TYPE_BULK="bulk",t.isITabMenu=function(e){return e.menuType===t.TAB_MENU_TYPE_TOPIC},t.isITabBulkMenu=function(e){return e.menuType===t.TAB_MENU_TYPE_BULK};const l={id:"",appearance:i.EnumAppearance.HIDDEN,
type:n.TAB_MENU,containerTitle:{id:"",args:[]},topIcon:"",title:{id:"",args:[]},topbuttons:[],menuType:t.TAB_MENU_TYPE_TOPIC,menubuttons:[],scrollToTop:!1};t.createEmptyITabMenu=function(){return a.cloneJSON(l)},t.isITabTable=function(e){return e.tableType===t.TAB_MENU_TYPE_TOPIC},t.isITabBulkTable=function(e){return e.tableType===t.TAB_MENU_TYPE_BULK}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=s(73);t.STATE_UNINITIALIZED_INTERNAL="STATE_UNINITIALIZED_INTERNAL",t.createFsm=function(e){return new a.BehavioralFsm({namespace:"_qappStm_",states:{STATE_UNINITIALIZED_INTERNAL:{_onEnter:function(e){console.log("FSM: enter STATE_UNINITIALIZED_INTERNAL state")},_onExit:function(e){console.log("FSM: exit STATE_UNINITIALIZED_INTERNAL state")},_transTo:{},_transFom:{},_START_FSM_:function(e,t){this.transition(e,t)},"*":function(e){this.deferUntilTransition(e)}}},initialize:function(t){Object.assign(t.states,t.states,e)},
initialState:t.STATE_UNINITIALIZED_INTERNAL,myHandler:function(e,t,s){let a;t.some(function(t){return a=t.nextState,t.guardFn(e,s)})&&a&&this.transition(e,a)}})}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(7),i=s(4);t.LocalizerProxy=class extends a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="localizer"}getLanguage(){let e;return this.body.method=i.RestMethodsLOCALIZER.getLanguage,this.body.params={rLanguageId:""},(e=new a.CubisRestResponse(this.syncRequest())).isSuccess()?e.rawReturns.rLanguageId:""}getText(e,t=[]){let s;return this.body.method=i.RestMethodsLOCALIZER.getText,this.body.params={id:e,rText:"",args:t},(s=new a.CubisRestResponse(this.syncRequest())).isSuccess()?s.rawReturns.rText:e}getTexts(e){let t;return this.body.method=i.RestMethodsLOCALIZER.getTexts,this.body.params={textObjects:e,rTexts:""},(t=new a.CubisRestResponse(this.syncRequest())).isSuccess()?JSON.parse(t.rawReturns.rTexts):[]}}},function(e,t,s){
"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.UNIT="UNIT",e.DO_ZERO="DO_ZERO",e.DO_TARE="DO_TARE",e.DO_TARE1="DO_TARE1",e.CLR_TARE1="CLR_TARE1",e.SET_TARE1="SET_TARE1",e.SHOW_TARE1="SHOW_TARE1",e.HIDE_TARE1="HIDE_TARE1",e.DISPLAY="DISPLAY"}(t.WEIGHING_BUTTON_ID||(t.WEIGHING_BUTTON_ID={})),function(e){e.AS_CONFIGURED="AS_CONFIGURED",e.WITHOUT_STABILITY="WITHOUT_STABILITY",e.AFTER_STABILITY="AFTER_STABILITY"}(t.WEIGHING_ZEROTARE_BEHAVIOR||(t.WEIGHING_ZEROTARE_BEHAVIOR={})),function(e){e.VERY_STABLE="VERY_STABLE",e.STABLE="STABLE",e.UNSTABLE="UNSTABLE",e.VERY_UNSTABLE="VERY_UNSTABLE"}(t.WEIGHING_AMBIENT_CONDITION||(t.WEIGHING_AMBIENT_CONDITION={})),function(e){e.MANAGE_USERS="MANAGE_USERS",e.MANAGE_TASKS="MANAGE_TASKS",e.SETUP_MENU_ACCESS="SETUP_MENU_ACCESS",e.ACCESS_QAPP_CENTER="ACCESS_QAPP_CENTER",e.ACCESS_AUDIT_TRAIL="ACCESS_AUDIT_TRAIL",e.ACCESS_ALIBI="ACCESS_ALIBI",e.EXECUTE_TASKS="EXECUTE_TASKS",e.MANAGE_PROFILES="MANAGE_PROFILES",
e.MANAGE_DEVICE_SETTINGS="MANAGE_DEVICE_SETTINGS",e.MANAGE_ROLES="MANAGE_ROLES",e.MANAGE_ACCESS_MANAGEMENT="MANAGE_ACCESS_MANAGEMENT",e.MANAGE_LDAP_SETTINGS="MANAGE_LDAP_SETTINGS",e.MANAGE_TIMER_CONTROLLED_ACTIONS="MANAGE_TIMER_CONTROLLED_ACTIONS",e.MANAGE_CONNECTIONS="MANAGE_CONNECTIONS",e.REDIRECT_FAILED_TRANSFERS="REDIRECT_FAILED_TRANSFERS",e.DELETE_FAILED_TRANSFERS="DELETE_FAILED_TRANSFERS",e.MAINTENANCE_FIRMWARE_UPDATE="MAINTENANCE_FIRMWARE_UPDATE",e.MAINTENANCE_MANAGE_QAPPS="MAINTENANCE_MANAGE_QAPPS",e.MAINTENANCE_BACKUP_RESTORE="MAINTENANCE_BACKUP_RESTORE",e.MAINTENANCE_EXPORT_IMPORT="MAINTENANCE_EXPORT_IMPORT",e.MAINTENANCE_FACTORY_RESET="MAINTENANCE_FACTORY_RESET",e.UNLOCK_DEVICE="UNLOCK_DEVICE",e.REMOTE_VIEW="REMOTE_VIEW",e.REMOTE_CONTROL="REMOTE_CONTROL",e.MANAGE_JOBS="MANAGE_JOBS",e.ACCESS_CALIBRATION_REPORTS="ACCESS_CALIBRATION_REPORTS",e.ACCESS_LAST_REPORTS="ACCESS_LAST_REPORTS",e.ACCESS_MASS_STORAGES="ACCESS_MASS_STORAGES",
e.REMOVE_USERCAL_INVALIDATION="REMOVE_USERCAL_INVALIDATION"}(t.ACCESS_CONTROL_USER_RIGHTS||(t.ACCESS_CONTROL_USER_RIGHTS={})),function(e){e.ADMIN_ROLE_ID="adminRoleDbId",e.SERVICE_ROLE_ID="serviceRoleDbId",e.OPERATOR_ROLE_ID="operatorRoleDbId",e.GUEST_ROLE_ID="guestRoleDbId"}(t.ACCESS_CONTROL_ROLE_DB_IDS||(t.ACCESS_CONTROL_ROLE_DB_IDS={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(23),n=s(1),r=s(29);class o{constructor(e){this.task=e||void 0}splitParamId(e){let t=e.split("/");return t.length>1&&(t[0]=`${t[0]}/${t[1]}`,t.splice(1,1)),t}setTask(e){this.task=e}getTaskGroupsAndParameters(){return this.task?this.task.params:[]}getTask(){return this.task}updateGroup(e){if(!this.task)return!1;return!!this.task.params.some((t,s)=>!!this.task&&(t.id===e.id&&(this.task.params[s]=e,!0)))&&(console.log(`Group ${e.id} updated!`),!0)}updateParameter(e){let t=this.splitParamId(e.id)[0];return!!this.task&&(!!this.task.params.some((s,a)=>{
if(s.id===t)return s.parameters.some((t,s)=>!(t.id!==e.id||!this.task)&&(this.task.params[a].parameters[s]=e,!0))})&&(console.log(`Parameter ${e.id} updated!`),!0))}getGroup(e){let t;if(this.task)return(t=this.task.params.find(t=>t.id===e))||void console.log(`Group ${e} not found!`)}getParameter(e){let t,s=this.splitParamId(e)[0];if(this.task)return this.task.params.find(a=>a.id===s&&(t=a.parameters.find(t=>t.id===e),!0)),t||void console.log(`Parameter ${e} not found!`)}addDynamicGroup(e){if(!this.task)return!1;if(!e.id.startsWith(r.DYNAMIC_PARAMID_PREQUEL))return console.log(`GroupId does not start with '${r.DYNAMIC_PARAMID_PREQUEL}'`),!1;if(e.id.includes("/",r.DYNAMIC_PARAMID_PREQUEL.length))return console.log('No additional "/" allowed in the name of a dynamic group!',e.id),!1;if(this.task.params.some(t=>t.id===e.id))return console.log("The DynamicGroup already exists!",e.id),!1;e.parameters.forEach(t=>{
t.id.startsWith(e.id)||(console.log(`parameterId starts with parameterName only. Extend parameterId with own groupId '${e.id}'.`),t.id=e.id+"/"+t.id)});let t=!1;for(let s=0;s<this.task.params.length;s++)if(this.task.params[s].id.startsWith(i.TASK_DYNAMIC_ID_GROUPS_PREFIX)||!this.task.params[s].id.startsWith(r.DYNAMIC_PARAMID_PREQUEL)){this.task.params.splice(s,0,e),t=!0;break}return t||this.task.params.push(e),!0}addDynamicParameter(e){let t="";if(this.getParameter(e.id))return this.updateParameter(e),!0;{t=this.splitParamId(e.id)[0];let s=this.getGroup(t);if(s)return s.parameters.push(e),!0}return!1}addDynamicParameterToFront(e){let t="";if(this.getParameter(e.id))return this.updateParameter(e),!0;{t=this.splitParamId(e.id)[0];let s=this.getGroup(t);if(s)return s.parameters.unshift(e),!0}return!1}addDynamicParameterInFrontOf(e,t){let s=this.splitParamId(e.id)[0],a=this.splitParamId(t)[0];if(s===a){let a=this.getGroup(s);if(void 0!==a){let s=a.parameters.findIndex(e=>e.id===t)
;if(-1!==s)return a.parameters.splice(s,0,e),!0}}return console.log("addDynamicParameterInFrontOf - groups of new and existing parameter do not match: "+s+" vs. "+a),!1}static sortGroup(e){let t=e.parameters.map(function(e,t){return{idx:t,data:e}});t.sort((e,t)=>{if((void 0===e.data.fixed||!0===e.data.fixed)>(void 0===t.data.fixed||!0===t.data.fixed))return 1;if((void 0===e.data.fixed||!0===e.data.fixed)<(void 0===t.data.fixed||!0===t.data.fixed))return-1;if(!(void 0!==e.data.fixed&&!0!==e.data.fixed||void 0!==t.data.fixed&&!0!==t.data.fixed)){if((e.data.appearance===a.EnumAppearance.ENABLED||e.data.appearance===a.EnumAppearance.ENABLED_INVALID_CFG)<(t.data.appearance===a.EnumAppearance.ENABLED||t.data.appearance===a.EnumAppearance.ENABLED_INVALID_CFG))return 1;if((e.data.appearance===a.EnumAppearance.ENABLED||e.data.appearance===a.EnumAppearance.ENABLED_INVALID_CFG)>(t.data.appearance===a.EnumAppearance.ENABLED||t.data.appearance===a.EnumAppearance.ENABLED_INVALID_CFG))return-1}
return e.idx-t.idx}),e.parameters=t.map(function(e){return e.data})}getFilteredTask(){let e,t;return this.task&&((t=(e=n.cloneJSON(this.task)).params.filter(e=>e.id.startsWith(r.DYNAMIC_PARAMID_PREQUEL))).forEach(e=>{e.id.startsWith(i.TASK_DYNAMIC_ID_GROUPS_PREFIX)?e.parameters.forEach((e,t)=>{e.appearance=a.EnumAppearance.HIDDEN}):(e.parameters.forEach((e,t)=>{void 0!==e.fixed&&!0!==e.fixed||e.appearance===a.EnumAppearance.HIDDEN||(e.appearance=a.EnumAppearance.DISABLED)}),o.sortGroup(e),e.parameters.forEach((e,t)=>{void 0!==e.fixed&&delete e.fixed}))}),e.params=t),e}}t.TaskHandler=o},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(7),i=s(3),n=s(16),r=s(2),o=s(4);var E;!function(e){e.STABLE="STABLE",e.CANCELED="CANCELED"}(t.ReportingPrintableValueStateEnum||(t.ReportingPrintableValueStateEnum={})),function(e){e.wrongAlibiId="No alibi entry exists for this alibi id.",e.wrongTopic="Weighing topic not found for this alibi entry.",
e.getAlibiListFailed="The rest call to get the Alibilist has failed!"}(E=t.AlibiEntryError||(t.AlibiEntryError={})),t.isAlibiEntryError=function(e){return e===E.wrongAlibiId||e===E.wrongTopic||e===E.getAlibiListFailed},t.REPORTING_CATEGORY_NONE="",t.REPORTING_CATEGORY_INIT="_QAPP_LIB_REPORTING_CATERGORY_INIT",t.REPORTING_CATEGORY_COMPONENTS="_QAPP_LIB_REPORTING_CATERGORY_COMPONENTS",t.REPORTING_CATEGORY_RESULT="_QAPP_LIB_REPORTING_CATERGORY_RESULT",t.REPORTING_CATEGORY_STATISTIC="_QAPP_LIB_REPORTING_CATERGORY_STATISTIC";class _ extends a.CubisRestResponse{constructor(e){super(e)}getPrintItemIdentifier(){return this.rawReturns.printItemIdentifier}}t.ReportingPrintParamResponse=_;t.ReportingProxy=class extends a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="reporting",this._isPrintQueueEmpty=!0}printParameters(e,t,s,a=-1){this.body.method=o.RestMethodsREPORTING.printParameters,this.body.params={parameters:JSON.stringify(e),category:t,redactable:s,printItemIdentifier:a}
;let i=new _(this.syncRequest());return i.isSuccess()&&(this._isPrintQueueEmpty=!1),i}printPrintQueue(){return this.body.method=o.RestMethodsREPORTING.printPrintQueueWithElectronicSignature,this.body.params={},new a.CubisRestResponse(this.syncRequest())}printParametersDirect(e,t,s){return this.body.method=o.RestMethodsREPORTING.printParametersDirect,this.body.params={parameters:JSON.stringify(e),category:t,silent:s},new a.CubisRestResponse(this.syncRequest())}getPrintQueue(){return this.body.method=o.RestMethodsREPORTING.getPrintQueue,this.body.params={printQueue:{}},new a.CubisRestResponse(this.syncRequest())}isPrintQueueEmpty(){let e;this.body.method=o.RestMethodsREPORTING.isPrintQueueEmpty,this.body.params={rResult:!1};try{return!!(e=new a.CubisRestResponse(this.syncRequest())).isSuccess()&&e.rawReturns.rResult}catch(e){return console.log("Something went wrong when calling isPrintQueueEmpty"),console.log(e),this._isPrintQueueEmpty}}clearPrintQueue(){
this.body.method=o.RestMethodsREPORTING.clearPrintQueue,this.body.params={};let e=new a.CubisRestResponse(this.syncRequest());return e.isSuccess()&&(this._isPrintQueueEmpty=!0),console.log("clearPrintQueue() result: "+e.isSuccess()),e}requestPrintableValue(e){return this.body.method=o.RestMethodsREPORTING.requestPrintableValueComment,this.body.params={comment:e},new a.CubisRestResponse(this.syncRequest())}setRedactionStatus(e,t,s){return this.body.method=o.RestMethodsREPORTING.setRedactionStatus,this.body.params={printItemIdentifier:e,redacted:t,reason:s},new a.CubisRestResponse(this.syncRequest())}getAlibiRecord(e){return this.body.method=o.RestMethodsREPORTING.getAlibiRecord,this.body.params={identifier:e,record:""},new a.CubisRestResponse(this.syncRequest())}getAlibiRecordList(e){return this.body.method=o.RestMethodsREPORTING.getAlibiRecordList,this.body.params={identifiers:e,records:[]},new a.CubisRestResponse(this.syncRequest())}getDateFromAlibi(e){let t
;if(e instanceof a.CubisRestResponse){if(!e.isSuccess())return E.getAlibiListFailed;t=JSON.parse(e.rawReturns.record)}else{if("number"==typeof e){let t=this.getAlibiRecord(e);return t.isSuccess()?JSON.parse(t.rawReturns.record).timestamp:E.wrongAlibiId}t=e}return t.timestamp}getWeightFromAlibi(e,t){let s;if(e instanceof a.CubisRestResponse){if(!e.isSuccess())return E.getAlibiListFailed;s=JSON.parse(e.rawReturns.record)}else if("number"==typeof e){let t=this.getAlibiRecord(e);if(!t.isSuccess())return E.wrongAlibiId;s=JSON.parse(t.rawReturns.record)}else s=e;return this.parseMeasureParameterFromAlibiResponse(s,t)}getWeightFromAlibiList(e,t){let s=[],i=[];if(e instanceof a.CubisRestResponse){if(!e.isSuccess())return E.getAlibiListFailed;i=JSON.parse(e.rawReturns.records)}else if(0!==(n=e).length&&"number"!=typeof n[0])i=e;else{let t=this.getAlibiRecordList(e);if(!t.isSuccess())return E.getAlibiListFailed;i=JSON.parse(t.rawReturns.records)}var n;return i.forEach(e=>{
s=[...s,this.parseMeasureParameterFromAlibiResponse(e,t)]}),s}parseMeasureParameterFromAlibiResponse(e,t){let s=i.createEmptyParameterGroupOfGroups();if(null===e)return E.wrongAlibiId;{s.parameters[0].parameters=JSON.parse(e.weighingblock);let a=n.WeightBlockHelper.getMeasureParameter(s,t||r.MqttTopics.WEIGHING_VALUE_NET);return void 0===a?E.wrongTopic:a}}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(84),n=s(2),r=1;t.CheckBarGraph=class{constructor(e){this.barGraphStatusObject={appearance:a.EnumAppearance.HIDDEN,areas:i.EnumAreaCount.FOUR_AREAS},this.barGraphValueObject={area:1,perc:0},this.mqttHandler=e}publishValue(){this.mqttHandler.publish(n.MqttTopics.HMI_CHECKBARGRAPH_VALUE,JSON.stringify(this.barGraphValueObject))}publishStatus(){this.mqttHandler.publish(n.MqttTopics.HMI_CHECKBARGRAPH_STATUS,JSON.stringify(this.barGraphStatusObject))}setAppearance(e,t=!0){
this.barGraphStatusObject.appearance!==e&&(e!==a.EnumAppearance.ENABLED&&e!==a.EnumAppearance.HIDDEN||(this.barGraphStatusObject.appearance=e,t&&(this.publishStatus(),this.publishValue())))}getAppearance(){return this.barGraphStatusObject.appearance}setAreas(e,t=!0){this.barGraphStatusObject.areas!==e&&(e!==i.EnumAreaCount.FOUR_AREAS&&e!==i.EnumAreaCount.SIX_AREAS||(this.barGraphStatusObject.areas=e,t&&this.publishStatus()))}getAreas(){return this.barGraphStatusObject.areas}setAreaPerc(e,t=!0){this.barGraphValueObject.area===e.area&&this.barGraphValueObject.perc===e.perc||e.area>=r&&e.area<=(this.barGraphStatusObject.areas===i.EnumAreaCount.FOUR_AREAS?4:6)&&(this.barGraphValueObject=e,t&&this.publishValue())}calc4AreaPerc(e,t,s,a,i,n=!0){let r=1,o=0;return e>0&&(0<e&&e<t?(r=1,o=e/t*100):t<=e&&e<=i?(r=2,o=(e-t)/(i-t)*100):i<e&&e<=s?(r=3,o=(e-i)/(s-i)*100):s<e&&e<=a&&(r=4,o=(e-s)/(a-s)*100)),n&&this.setAreaPerc({area:r,perc:o}),{area:r,perc:o}}calc6AreaPerc(e,t,s,a,i,n,r,o=!0){
let E=1,_=0;return e>0&&(0<e&&e<t?(E=1,_=e/t*100):t<=e&&e<s?(E=2,_=(e-t)/(s-t)*100):s<=e&&e<=r?(E=3,_=(e-s)/(r-s)*100):r<e&&e<=a?(E=4,_=(e-r)/(a-r)*100):a<e&&e<=i?(E=5,_=(e-a)/(i-a)*100):i<e&&e<=n&&(E=6,_=(e-i)/(n-i)*100)),this.setAreaPerc({area:E,perc:_},o),{area:E,perc:_}}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PARAM_TITLE=40,t.PARAM_HEADER=8,t.USER_GUIDANCE=45,t.BUTTON_DISPLAY=8,t.BUTTON_APPL=8,t.PARAMLIST_TITLE=40,t.MSG_TITLE=25,t.MSG_DESCRIPTION=200,t.BUTTON_MSG=20,t.GROUP_PARAM_TITLE=25,t.PARAM_SELECTION=25,t.DETAIL_TITLE=25,t.USER_INPUT_STRING_NAMES=50,t.LID_SID_USER_INPUT_STRING_VALUES=60},function(e,t){e.exports=require("dateformat")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(69),n=s(41),r=s(33),o=s(6),E=s(22),_=s(41),l=s(25),c=s(42);t.CFG_PARAMS_ASPECT="CFG_PARAMS_ASPECT",t.STATE_ASPECT_CFG_PARAM_EDIT_ENTER="STATE_ASPECT_CFG_PARAM_EDIT_ENTER",
t.STATE_ASPECT_CFG_PARAM_EDIT_REENTER="STATE_ASPECT_CFG_PARAM_EDIT_REENTER";const u="STATE_ASPECT_CFG_PARAM_EDIT",T="STATE_ASPECT_CFG_PARAM_EDIT_USER_ACTION",A="STATE_ASPECT_CFG_PARAM_INSPECT",p="TASK_HANDLER_NO_PARAMETERS";t.ConfigParamsAspect=class extends E.AbstractQAppAspect{constructor(){super(...arguments),this.states={STATE_ASPECT_CFG_PARAM_EDIT_ENTER:{_onEnter:function(e){e.aspects[t.CFG_PARAMS_ASPECT].parametersEmpty()?e.addToEventQueue(new o.ImmediateEvent(p)):e.addToEventQueue(new o.ImmediateEvent(u))},_onExit:function(e){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,s){s.payload===u&&this.transition(e,u),s.payload===p&&this.transition(e,e.aspects[t.CFG_PARAMS_ASPECT].cfg.returnState)},"*":function(e){this.deferUntilTransition(e)}},STATE_ASPECT_CFG_PARAM_EDIT_REENTER:{_onEnter:function(e){e.aspects[t.CFG_PARAMS_ASPECT].parametersEmpty()?e.addToEventQueue(new o.ImmediateEvent(p)):e.addToEventQueue(new o.ImmediateEvent(u))},_onExit:function(e){},_transTo:{},
_transFrom:{},IMMEDIATE_EVENT:function(e,s){s.payload===u&&this.transition(e,u),s.payload===p&&this.transition(e,e.aspects[t.CFG_PARAMS_ASPECT].cfg.returnState)},"*":function(e){this.deferUntilTransition(e)}},STATE_ASPECT_CFG_PARAM_EDIT:{_onEnter:function(e){let s=e.screens[i.PARAM_LIST_SCREENID].getButton(i.FINISH_BUTTON_ID);if(void 0!==s){let i=e.aspects[t.CFG_PARAMS_ASPECT].cfg.isValidFn();s.setAppearance(i?a.EnumAppearance.ENABLED_PRIMARY:a.EnumAppearance.DISABLED)}},_onExit:function(e){},_transTo:{},_transFrom:{STATE_ASPECT_CFG_PARAM_EDIT_ENTER:function(e,s){let n=e.screens[i.PARAM_LIST_SCREENID];n.readFromTaskhandler(e.aspects[t.CFG_PARAMS_ASPECT].cfg.taskHandler),n.setShowLastVisibleCategory(!1);let r=n.getButton(i.FINISH_BUTTON_ID);if(void 0!==r){let s=e.aspects[t.CFG_PARAMS_ASPECT].cfg.isValidFn();r.setAppearance(s?a.EnumAppearance.ENABLED_PRIMARY:a.EnumAppearance.DISABLED)}n.show()},STATE_ASPECT_CFG_PARAM_EDIT_REENTER:function(e,s){let n=e.screens[i.PARAM_LIST_SCREENID]
;n.readFromTaskhandler(e.aspects[t.CFG_PARAMS_ASPECT].cfg.taskHandler),n.setShowLastVisibleCategory(!0);let r=n.getButton(i.FINISH_BUTTON_ID);if(void 0!==r){let s=e.aspects[t.CFG_PARAMS_ASPECT].cfg.isValidFn();r.setAppearance(s?a.EnumAppearance.ENABLED_PRIMARY:a.EnumAppearance.DISABLED)}n.show()}},EV_HMI_BTN_CLICKED:function(e,s){s.payload.buttonId===i.FINISH_BUTTON_ID&&e.aspects[t.CFG_PARAMS_ASPECT].cfg.isValidFn()&&this.transition(e,e.aspects[t.CFG_PARAMS_ASPECT].cfg.returnState),s.payload.buttonId===i.CANCEL_BUTTON_ID&&e.suspend()},EV_HMI_PARAM_CHANGED:function(e,s){let a=e.aspects[t.CFG_PARAMS_ASPECT].updateTaskParameterGeneric(s.payload.parameter),i=[{guardFn:function(e,t){return void 0===a},nextState:""},{guardFn:function(e,t){return void 0!==a},nextState:T}];this.myHandler(e,i,s)},EV_HMI_PARAM_DETAIL:function(e,s){e.aspects[t.CFG_PARAMS_ASPECT].inspectTaskParameter(s.payload.parameter),this.transition(e,A)}},STATE_ASPECT_CFG_PARAM_INSPECT:{_onEnter:function(e){},
_onExit:function(e){},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===n.CANCEL_BUTTON_ID&&this.transition(e,u)}},STATE_ASPECT_CFG_PARAM_EDIT_USER_ACTION:{_onEnter:function(e){},_onExit:function(e){},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(e,s){if(s.payload.buttonId===i.CANCEL_BUTTON_ID)e.suspend();else{let a=e.aspects[t.CFG_PARAMS_ASPECT].handleParamUpdateUserActionGeneric(s);"boolean"==typeof a&&a&&this.transition(e,u)}}}},this.currentParamUpdateUserAction=void 0,this.isLastUserActionGenericError=!1}getId(){return t.CFG_PARAMS_ASPECT}getAspectStates(){return this.states}init(e){if(this.client=e,this.client){console.log("ConfigParamAspect::init");let e=new i.ParameterListScreen(this.client.mqttHandler);this.client.registerScreen(e)}else console.log("ConfigParamAspect::init - aspect not correctly initialized (no client set) - skip init")}publishParameter(e){
void 0!==this.client&&this.client.screens[i.PARAM_LIST_SCREENID]&&this.client.screens[i.PARAM_LIST_SCREENID].updateParameter(e)}setCurrentParamUpdateUserAction(e){e?this.updateMessageBoxFromActionMessageAndShow(e.message):this.currentParamUpdateUserAction&&this.client.hideMsgBox(),this.currentParamUpdateUserAction=e}getCurrentParamUpdateUserAction(){return this.currentParamUpdateUserAction}updateTaskParameterGeneric(e){console.log("ConfigParamAspect: updateTaskParameterGeneric");let t=void 0;!0!==e.suppressLibRuleChecks&&(t=c.checkGeneralParamRules(e)),void 0!==t?this.isLastUserActionGenericError=!0:(this.isLastUserActionGenericError=!1,t=this.cfg.updateTaskParameterFn(e)),this.setCurrentParamUpdateUserAction(t);let s=this.client.screens[i.PARAM_LIST_SCREENID].getButton(i.FINISH_BUTTON_ID);return void 0!==s&&s.setAppearance(this.cfg.isValidFn()?a.EnumAppearance.ENABLED_PRIMARY:a.EnumAppearance.DISABLED),t}handleParamUpdateUserActionGeneric(e){
console.log("ConfigParamsAspect: handleParamUpdateUserActionGeneric");let t=!1,s=this.getCurrentParamUpdateUserAction();return s?(this.isLastUserActionGenericError&&e.payload.buttonId===r.ParamUpdateUserActionSimpleAccept_OK_BUTTON_ID?(this.isLastUserActionGenericError=!1,t=!0):t=this.cfg.handleParamUpdateUserActionFn(s,e),("boolean"==typeof t&&t||"object"==typeof t)&&(console.log("action handled"),this.setCurrentParamUpdateUserAction(void 0)),"object"==typeof t&&(console.log("new action present"),this.setCurrentParamUpdateUserAction(t))):this.client.exitError("ConfigParamsAspect: handleParamUpdateUserActionGeneric - called in state, although no action set"),t}updateMessageBoxFromActionMessageAndShow(e){this.client.showMessageBox(e)}inspectTaskParameter(e){if(this.cfg.getDetailForTaskParameterFn){let t=this.cfg.getDetailForTaskParameterFn(e);this.showDetailTaskParameter(t)
}else console.log("Error: Inspect parameter was clicked, but no getDetailForTaskParameterFn was configured in ConfigParamsAspect")}showDetailTaskParameter(e){let t=new _.default(this.client.mqttHandler);t.setTitle(e.title.id,e.title.args),t.setAppearance(a.EnumAppearance.HIDDEN);let s=[];for(const t of e.params){let e=new l.default(this.client.mqttHandler,t);e.publish(),s.push(e.getPublishedId())}t.setParams(s),t.show()}parametersEmpty(){let e=this.cfg.taskHandler.getTaskGroupsAndParameters(),t=!0;for(let s of e)for(let e of s.parameters)e.appearance!==a.EnumAppearance.HIDDEN&&(t=!1);return t}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(13),i=s(0),n=s(32);t.PARAM_LIST_SCREENID="PARAMLIST";var r=s(32);t.CANCEL_BUTTON_ID=r.CANCEL_BUTTON_ID,t.FINISH_BUTTON_ID="BTN_FIN";t.ParameterListScreen=class extends n.default{constructor(e){super(e);let s={};s.label={id:n.CANCEL_BUTTON_NAME,args:[]},s.appearance=i.EnumAppearance.ENABLED_PRIMARY,
s.buttonId=n.CANCEL_BUTTON_ID,this.cancelButton=new a.default(e,this,s),s.appearance=i.EnumAppearance.HIDDEN,s.label.id="_FINISH",s.buttonId=t.FINISH_BUTTON_ID,this.finishButton=new a.default(e,this,s)}getId(){return"PARAMLIST"}getButton(e){let s;return s=e===n.CANCEL_BUTTON_ID?this.cancelButton:e===t.FINISH_BUTTON_ID?this.finishButton:void 0}setFinishButtonLabel(e){this.finishButton.setLabel(e,!1)}show(){this.finishButton.publish(),this.createAndPublishParamsAndPage(),super.show()}}},function(e,t){e.exports=require("rxjs/observable/interval")},function(e,t){e.exports=require("rxjs/observable/merge")},function(e,t){e.exports=require("timers")},function(e,t){e.exports=require("machina")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.INTERNAL_SUSPEND_EVENT="_INTERNAL_SUSPEND_EVENT_",function(e){e.SUSPEND_EVENT_TYPE_FORCED_HOME="SUSPEND_EVENT_TYPE_FORCED_HOME",e.SUSPEND_EVENT_TYPE_FORCED_LOGOUT="SUSPEND_EVENT_TYPE_FORCED_LOGOUT",
e.SUSPEND_EVENT_TYPE_FORCED_AUTO_LOGOUT="SUSPEND_EVENT_TYPE_FORCED_AUTO_LOGOUT",e.SUSPEND_EVENT_TYPE_EXECFINALLY="SUSPEND_EVENT_TYPE_EXECFINALLY"}(t.INTERNAL_SUSPEND_EVENT_TYPE||(t.INTERNAL_SUSPEND_EVENT_TYPE={}));t.InternalSuspendEvent=class{constructor(e){this.payload=e,this.type=t.INTERNAL_SUSPEND_EVENT}},t.INTERNAL_RESTART_EVENT="_INTERNAL_RESTART_EVENT_",function(e){e.RESTART_EVENT_TYPE_REQUEST="RESTART_EVENT_TYPE_REQUEST",e.RESTART_EVENT_TYPE_EXECFINALLY="RESTART_EVENT_TYPE_EXECFINALLY"}(t.INTERNAL_RESTART_EVENT_TYPE||(t.INTERNAL_RESTART_EVENT_TYPE={}));t.InternalRestartEvent=class{constructor(e){this.payload=e,this.type=t.INTERNAL_RESTART_EVENT}},t.HEARTBEAT_EVENT="_FSM_HEARTBEAT_EVENT_";t.HeartbeatEvent=class{constructor(e){this.payload=e,this.type=t.HEARTBEAT_EVENT}},function(e){e.INTERNAL_ASYNC_CALL_EVENT_TYPE_SUCCESS="SUCCESS",e.INTERNAL_ASYNC_CALL_EVENT_TYPE_FAIL="FAIL",e.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT="TIMEOUT",
e.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT_WITH_FETCHING_RESP="TIMEOUT_FETCH_RESP"}(t.INTERNAL_ASYNC_CALL_EVENT_TYPE||(t.INTERNAL_ASYNC_CALL_EVENT_TYPE={})),t.INTERNAL_ASYNC_CALL_EVENT="_INTERNAL_ASYNC_CALL_EVENT_";t.InternalAsyncCallEvent=class{constructor(e){this.payload=e,this.type=t.INTERNAL_ASYNC_CALL_EVENT}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(76),i=s(14),n=s(77),r=s(34),o=s(26),E=s(2);t.MqttHandler=class{constructor(){this.mqttOptions={host:"127.0.0.1",port:1883,clientId:`qapp_${Math.random().toString(16).substr(2,8)}`,will:{topic:E.MqttTopics.QAPP_CLEANUP,payload:"",qos:1,retain:0}},this.listeningForUpdateEvent=!1,this.listeningForAdminEvent=!1,this.mqttUpdateEvent$=new i.Subject,this.mqttAdminEvent$=new i.Subject,this.weighingNet={str:E.MqttTopics.WEIGHING_VALUE_NET,subscribe:()=>this.subscribe(E.MqttTopics.WEIGHING_VALUE_NET),unsubscribe:()=>this.unsubscribe(E.MqttTopics.WEIGHING_VALUE_NET)},
this.client=a.connect(this.mqttOptions),this.startListeningForUpdateEvent(),this.startListeningForAdminEvent(),this.listOfPublishedTopics=[],this.listOfSubscribedTopics=[]}startListeningForUpdateEvent(){this.listeningForUpdateEvent||(this.client.on("message",(e,t,s)=>{let a={topic:e,value:t,packet:s};a.topic.startsWith(E.MqttTopics.QAPP_DEBUG_TOPIC_PREAMBLE)?this.mqttUpdateEvent$.next(new o.MqttUpdateDebugEvent(a)):this.mqttUpdateEvent$.next(new o.MqttUpdateEvent(a))}),this.listeningForUpdateEvent=!0)}startListeningForAdminEvent(){this.listeningForAdminEvent||(this.client.on("offline",()=>{this.mqttAdminEvent$.next(new r.MqttAdminEvent({event:"offline",message:"client is offline!"}))}),this.client.on("close",()=>{this.mqttAdminEvent$.next(new r.MqttAdminEvent({event:"close",message:"client has disconnected!"}))}),this.client.on("reconnect",()=>{this.mqttAdminEvent$.next(new r.MqttAdminEvent({event:"reconnect",message:"client is reconnecting!"}))}),this.client.on("error",e=>{
this.mqttAdminEvent$.next(new r.MqttAdminEvent({event:"error",message:"client cannot connect or a parsing error occured!",error:e}))}),this.client.on("packetsend",e=>{this.mqttAdminEvent$.next(new r.MqttAdminEvent({event:"packetsend",message:"client send packet!",packet:e}))}),this.client.on("packetreceive",e=>{this.mqttAdminEvent$.next(new r.MqttAdminEvent({event:"packetreceive",message:"client recieved packet!",packet:e}))}),this.client.on("connect",e=>{this.mqttAdminEvent$.next(new r.MqttAdminEvent({event:"connect",message:"client has successfully connected!",connack:e}))}),this.listeningForAdminEvent=!0)}publish(e,t,s,a){let i,r;"function"==typeof s?(r=s,i=void 0):(i=s,r=a);let o={qos:n.EnumMqttQos.AtMostOnce,retain:!0,dup:!1};Object.assign(o,i),"/"!==e.substring(0,1)&&(e="~"===e.substring(0,1)?e.substr(1):`${E.MqttTopics.QAPP_NAMESPACE}/${e}`),e.startsWith(E.MqttTopics.QAPP_NAMESPACE)&&-1===this.listOfPublishedTopics.indexOf(e)&&this.listOfPublishedTopics.push(e),
this.client.publish(e,t,o,e=>{r&&r(e)})}subscribe(e,t,s){if("object"==typeof e)this.subscribe(e,(e,t)=>{s&&s(e,t)});else{"function"==typeof t&&(s=t,t=void 0);let a={qos:0};Object.assign(a,t),-1===this.listOfSubscribedTopics.indexOf(e)&&this.listOfSubscribedTopics.push(e),this.client.subscribe(e,a,(e,t)=>{s&&s(e,t)})}}unsubscribe(e,t){this.client.unsubscribe(e,e=>{t&&t(e)})}end(e,t){let s=!1,a=void 0;"function"==typeof e?(s=!1,a=e):"boolean"==typeof e&&(s=e,a=t),this.client.end(s,()=>{a&&a()})}removeOutgoingMessage(e){this.client.removeOutgoingMessage(e)}reconnect(e){this.client.reconnect(e)}getLastMessageId(){return this.client.getLastMessageId()}handleMessage(e,t){this.client.handleMessage(e,(e,s)=>{t(e,s)})}reconnecting(){return this.client.reconnecting}connected(){return this.client.connected}clearPublishedTopics(){this.publish(E.MqttTopics.QAPP_CLEANUP,"");for(let e of this.listOfPublishedTopics)this.publish(e,"");this.publish(E.MqttTopics.QAPP_CLEANUP,"")}unsubscribeTopics(){
this.unsubscribe(this.listOfSubscribedTopics)}}},function(e,t){e.exports=require("mqtt")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.AtMostOnce=0]="AtMostOnce",e[e.AtLeastOnce=1]="AtLeastOnce",e[e.ExactlyOnce=2]="ExactlyOnce"}(t.EnumMqttQos||(t.EnumMqttQos={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(45),i=s(14),n=s(27),r=s(17),o=s(2),E="/rest/qapp/paramDetail",_="/rest/qapp/paramChanged",l="/rest/qapp/buttonClick",c="/rest/qapp/extern",u=5e3;function T(e,t,s,a,i){e.statusCode=t,void 0!==s&&(e.statusMessage=s),console.log(`RestHandler::finalizeResponse: send ${t} (${s}) response: ${r.inspect(a)}`),void 0===a?e.end():"object"==typeof a?(e.setHeader("Content-Type","application/json"),e.end(JSON.stringify(a,i))):(e.setHeader("Content-Type","plain/text"),e.end(a))}t.RestHandler=class{constructor(e){this.buttonClickEvent$=new i.Subject,this.paramChangedEvent$=new i.Subject,
this.paramDetailEvent$=new i.Subject,this.restRequestEvent$=new i.Subject,this.restController=((e,t)=>{if(e.url)if(e.url.startsWith(c)){let s=e.url.replace(c,"");console.log(`RestHandler: rx extern REST request (${e.method})for URL ${s}`),this.handleRequest(e,a=>{console.log("RestHandler: rx all data for REST request - create and enqueue event"),t.setTimeout(u);let i={subUrl:s,request:e,body:a,response:t};this.restRequestEvent$.next(new n.RestRequestEvent(i))})}else switch(console.log(`RestHandler: rx internal REST request: ${e.url}`),e.url){case l:"POST"===e.method?this.handleRequest(e,e=>{e.buttonId&&(console.log(`RestHandler::restController received buttonID: ${e.buttonId}`),this.buttonClickEvent$.next(new n.HmiButtonClickedEvent(e)),T(t,200,"Event Accepted and Forwarded","ok"))}):T(t,405,"Method Not Allowed","failure");break;case _:"POST"===e.method?this.handleRequest(e,e=>{e&&(this.paramChangedEvent$.next(new n.HmiParamChangedEvent({parameter:e})),
T(t,200,"Event Accepted and Forwarded","ok"))}):T(t,405,"Method Not Allowed","failure");break;case E:"POST"===e.method?this.handleRequest(e,e=>{e&&(this.paramDetailEvent$.next(new n.HmiParamDetailEvent({parameter:e})),T(t,200,"Event Accepted and Forwarded","ok"))}):T(t,405,"Method Not Allowed","failure");break;default:T(t,404,"Not Found","failure")}else T(t,404,"Not Found","failure")}),this.port=e||8081,this.server=a.createServer(this.restController),this.server.listen(this.port,e=>{e&&console.log(e),console.log(`listening on port ${this.port}`)}),this.server.on("clientError",(e,t)=>{console.log("clientError"),console.log(e),console.log(e.stack),t.end("HTTP/1.1 400 Bad Request\r\n\r\n")})}stopServer(){this.server.close(()=>{console.log("HttpServer closed")})}handleRequest(e,t){let s,a=[""];e.on("error",t=>{console.log("RestHandler::handleRequest: "+t),e.socket.end()}).on("data",e=>{console.log("RestHandler::handleRequest: data"),"string"!=typeof e?a.push(e.toString()):a.push(e)
}).on("end",()=>{if(console.log("RestHandler::handleRequest: end"),s=a.reduce((e,t)=>e+t),"application/json"===e.headers["content-type"])try{t(JSON.parse(s))}catch(e){t(s)}else t(s)})}registerRestEndpoints(e,t){e.publish(o.MqttTopics.CUSTOMIZED_REST_HANDLER_CONFIGURATION,JSON.stringify(t))}},t.finalizeResponse=T},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HttpRestErrorName="HttpRestError";class a extends Error{constructor(e,s,i,n){super(),this.statusCode=s,this.headers=i,this.body=n,this.name=t.HttpRestErrorName,Object.setPrototypeOf(this,a.prototype),this.message=e}}t.HttpRestError=a,t.isHttpRestError=function(e){return"object"==typeof e&&e.hasOwnProperty("statusCode")&&e.hasOwnProperty("headers")&&e.hasOwnProperty("body")}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const a=s(7),i=s(0),n=s(4),r="WEIGHING/CONFIGURATION/PROFILE/ZERO_TARE",o=r+"/TARE1",E="ON",_="PROFILE/IDENTIFICATION",l="PROFILE/IDENTIFICATION/NAME";t.ProfileManagementProxy=class extends a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="profilemanagement"}loadProfile(e){return this.body.method=n.RestMethodsPROFILE_MANAGEMENT.loadProfile,this.body.params={rProfile:"",id:e},new a.CubisRestResponse(this.syncRequest())}isPresetTareEnabled(e){let t;if(e instanceof a.CubisRestResponse)t=JSON.parse(e.rawReturns.rProfile).params;else if("string"==typeof e){let s=this.loadProfile(e);t=JSON.parse(s.rawReturns.rProfile).params}else t=e.params;for(let e of t)if(e.id===r)for(let t of e.parameters)if(t.id===o)return t.value.selection.id===E;return!1}getWeighingProfileName(e){let t;if(e instanceof a.CubisRestResponse)t=JSON.parse(e.rawReturns.rProfile).params;else if("string"==typeof e){let s=this.loadProfile(e);t=JSON.parse(s.rawReturns.rProfile).params}else t=e.params
;for(let e of t)if(e.id===_)for(let t of e.parameters)if(t.id===l)return t.value.string;return""}getAvailableWeighingUnitsInWeighingProfile(e){let t=e.params.find(e=>"WEIGHING/CONFIGURATION/PROFILE/UNITS_ACCURACY"===e.id);if(void 0!==t){let e=t.parameters.find(e=>"WEIGHING/CONFIGURATION/PROFILE/UNITS_ACCURACY/UNITS"===e.id);return void 0===e?void 0:e.value.selections.map(e=>e.id)}}getUnitsAvailableOnBalance(e){let t=e.params.find(e=>"WEIGHING/CONFIGURATION/PROFILE/UNITS_ACCURACY"===e.id);if(void 0!==t){let e=t.parameters.find(e=>"WEIGHING/CONFIGURATION/PROFILE/UNITS_ACCURACY/UNITS"===e.id);if(void 0===e)return;{let t=[];return e.info.options.forEach(e=>{e.appearance===i.EnumAppearance.ENABLED&&(t=[...t,e.id])}),0===t.length?void 0:t}}}}},function(e,t){e.exports=require("https")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(7),i=s(3),n=s(4);t.AccessControlProxy=class extends a.BaseProxy{constructor(){super(...arguments),
this.restEndpoint="access"}getCurrentUser(){let e,t;return this.body.method=n.RestMethodsACCESS_MANAGEMENT.getCurrentUser,this.body.params={user:""},e=new a.CubisRestResponse(this.syncRequest()),t=JSON.parse(e.rawReturns.user)}getCurrentUserName(e){let t,s="";return(t=void 0!==e?e:this.getCurrentUser()).params.find(e=>"USER/SETTINGS"===e.id&&e.parameters.find(e=>"USER/SETTINGS/NAME"===e.id&&(s=e.value.string,!0))),s}getCurrentUserRoles(e){let t;t=void 0!==e?e:this.getCurrentUser();let s=i.createEmptySelectionParameter();return t.params.find(e=>"USER/SETTINGS"===e.id&&e.parameters.find(e=>"USER/SETTINGS/ROLES"===e.id&&(s=e,!0))),s}checkRightsOfCurrentUser(e){let t;return this.body.method=n.RestMethodsACCESS_MANAGEMENT.checkRightsOfCurrentUser,this.body.params={permissionGranted:!1,arrayOfRightsToCheck:e},(t=new a.CubisRestResponse(this.syncRequest())).rawReturns.permissionGranted}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const a=s(13),i=s(0),n=s(10),r=s(9),o=s(14),E=s(2);t.MESSAGEBOX_ID="MESSAGEBOX";class _{constructor(e){this.appearance=i.EnumAppearance.HIDDEN,this.lastPublishedTabContent={appearance:i.EnumAppearance.HIDDEN,type:n.EnumMessageboxType.INFO,title:{id:"",args:[]},text:{id:"",args:[]},textsList:[],buttons:[]},this.messageBoxObject={appearance:i.EnumAppearance.HIDDEN,type:n.EnumMessageboxType.INFO,title:{id:"",args:[]},text:{id:"",args:[]},textsList:[],buttons:[]},this.events$=new o.Subject,this.mqttHandler=e,this.buttonList=[]}setMessageBoxData(e,t=!0){this.setBackgroundColor(e.backgroundColor,!1),this.setIconColor(e.iconColor,!1),this.setType(e.type,!1),this.setTitle(e.title,!1),this.setTextsList(e.textList,!1),this.createButtons(e.buttons.map(e=>({buttonId:e.id,label:e.label,appearance:e.appearance}))),this.publish(t)}createButtons(e){this.buttonList.splice(0,this.buttonList.length),this.messageBoxObject.buttons.splice(0,this.messageBoxObject.buttons.length),
console.log("MessageBox: createButtons buttonlist cleared: "+this.buttonList.length),console.log("MessageBox: createButtons buttonlist json cleared: "+this.messageBoxObject.buttons.length);for(let t of e)if(void 0===this.getButton(t.buttonId)){let e=new a.default(this.mqttHandler,this,t);this.buttonList.push(e),this.messageBoxObject.buttons.push(e.getJson())}else console.error("MessageBox: Duplicate Button: "+t.buttonId);console.log("MessageBox: createButtons number of buttons: "+this.buttonList.length),console.log("MessageBox: createButtons json result: "+JSON.stringify(this.messageBoxObject))}removeButtons(e){console.log("MessageBox: removeButtons ");for(let t of e){for(let e=0;e<this.buttonList.length;e++)this.buttonList[e].getButtonId()===t&&(console.log("MessageBox: splice for index: "+e),this.buttonList.splice(e,1),console.log("MessageBox: Buttonlist buttons left: "+this.buttonList.length),e=0);console.log("MessageBox: Clearing json buttons")
;for(let e=0;e<this.messageBoxObject.buttons.length;e++){let s=this.messageBoxObject.buttons[e];if(console.log("MessageBox: buttonId "+s.effect.params.buttonId),s.effect.params.buttonId===t){let t=this.messageBoxObject.buttons.splice(e,1);console.log("MessageBox: Removed JSON Button: "+t[0]),console.log("MessageBox: ButtonJSON buttons left: "+this.messageBoxObject.buttons.length),e=0}}}console.log("MessageBox: Messagebox json: "+JSON.stringify(this.messageBoxObject))}publish(e=!0){let t=JSON.stringify(this.messageBoxObject),s=JSON.stringify(this.lastPublishedTabContent);e&&(t!==s&&this.messageBoxObject.appearance===i.EnumAppearance.ENABLED||this.lastPublishedTabContent.appearance===i.EnumAppearance.ENABLED&&this.messageBoxObject.appearance===i.EnumAppearance.HIDDEN)&&(this.mqttHandler.publish(E.MqttTopics.HMI_MESSAGEBOX,t),this.lastPublishedTabContent=JSON.parse(t))}getButtonByTopic(e){for(let t of this.buttonList){if(t.getTopic().substring(t.getTopic().lastIndexOf("/")+1)===e)return t
}}getButton(e){for(let t of this.buttonList)if(t.getButtonId()===e)return t}setAppearance(e,t=!0){"HIDDEN"!==e&&"ENABLED"!==e||(this.appearance=e,this.messageBoxObject.appearance=e,this.publish(t))}getAppearance(){return this.appearance}setBackgroundColor(e,t=!0){this.messageBoxObject.backgroundColor=e,this.publish(t)}getBackgroundColor(){return this.messageBoxObject.backgroundColor}setIconColor(e,t=!0){this.messageBoxObject.iconColor=e,this.publish(t)}getIconColor(){return this.messageBoxObject.iconColor}setType(e,t=!0){this.messageBoxObject.type=e,this.publish(t)}getType(){return this.messageBoxObject.type}setTitle(e,t=!0){this.messageBoxObject.title=e,this.publish(t)}getTitle(){return this.messageBoxObject.title}setTextsList(e,t=!0){this.messageBoxObject.textsList=e,this.publish(t)}getTextsList(){return this.messageBoxObject.textsList}getText(){return this.messageBoxObject.textsList[0]}getId(){return t.MESSAGEBOX_ID}hide(){
this.appearance===i.EnumAppearance.ENABLED&&(this.setAppearance(i.EnumAppearance.HIDDEN),this.events$.next({type:r.ScreenEventType.HIDE_MESSAGEBOX,id:this.getId()}))}show(){this.appearance===i.EnumAppearance.HIDDEN&&(this.setAppearance(i.EnumAppearance.ENABLED),this.events$.next({type:r.ScreenEventType.SHOW_MESSAGEBOX,id:this.getId()}))}}t.MessageBox=_,t.default=_},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.FOUR_AREAS="4",e.SIX_AREAS="6"}(t.EnumAreaCount||(t.EnumAreaCount={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(38),n=s(9),r=s(2);t.LOADING_OVERLAY_ID="LOADING_MODAL";t.LoadingOverlay=class extends i.AbstractOverlay{setText(e){this.publishContent("TEXT",JSON.stringify(e))}show(){this.publishContent("APPEARANCE",'{ "appearance":"'+a.EnumAppearance.ENABLED+'" }'),this.events$.next({type:n.ScreenEventType.SHOW_LOADINGSCREEN,id:this.getId()})}hide(){this.publishContent("TEXT",""),
this.publishContent("APPEARANCE",'{ "appearance":"'+a.EnumAppearance.HIDDEN+'" }'),this.events$.next({type:n.ScreenEventType.HIDE_LOADINGSCREEN,id:this.getId()})}getMqttTopicBase(){return"~"+r.MqttTopics.HMI_LOADING_MODAL}getId(){return t.LOADING_OVERLAY_ID}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(7),i=s(4);t.DeviceInformationProxy=class extends a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="deviceinformation"}getSerialNo(){let e;return this.body.method=i.RestMethodsDEVICE_INFORMATION.getSerialNoBalance,this.body.params={rString:""},(e=new a.CubisRestResponse(this.syncRequest())).isSuccess()?e.rawReturns.rString:""}getModelName(){let e;return this.body.method=i.RestMethodsDEVICE_INFORMATION.getModelName,this.body.params={rString:""},(e=new a.CubisRestResponse(this.syncRequest())).isSuccess()?e.rawReturns.rString:""}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),
t.LOCKING_ASPECT="LOCKING_ASPECT"},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(13),i=s(0),n=s(10),r=s(9),o=s(14),E=s(2);t.LOCKMESSAGEBOX_ID="LOCKMESSAGEBOX";class _{constructor(e){this.appearance=i.EnumAppearance.HIDDEN,this.lastPublishedTabContent={appearance:i.EnumAppearance.HIDDEN,type:n.EnumMessageboxType.INFO,title:{id:"",args:[]},text:{id:"",args:[]},textsList:[],buttons:[]},this.messageBoxObject={appearance:i.EnumAppearance.HIDDEN,type:n.EnumMessageboxType.INFO,title:{id:"",args:[]},text:{id:"",args:[]},textsList:[],buttons:[]},this.events$=new o.Subject,this.mqttHandler=e,this.buttonList=[]}setMessageBoxData(e,t=!0){this.setBackgroundColor(e.backgroundColor,!1),this.setIconColor(e.iconColor,!1),this.setType(e.type,!1),this.setTitle(e.title,!1),this.setTextsList(e.textList,!1),this.createButtons(e.buttons.map(e=>({buttonId:e.id,label:e.label,appearance:e.appearance}))),this.publish(t)}createButtons(e){
this.buttonList.splice(0,this.buttonList.length),this.messageBoxObject.buttons.splice(0,this.messageBoxObject.buttons.length),console.log("LockMessageBox: createButtons buttonlist cleared: "+this.buttonList.length),console.log("LockMessageBox: createButtons buttonlist json cleared: "+this.messageBoxObject.buttons.length);for(let t of e)if(void 0===this.getButton(t.buttonId)){let e=new a.default(this.mqttHandler,this,t);this.buttonList.push(e),this.messageBoxObject.buttons.push(e.getJson())}else console.error("LockMessageBox: Duplicate Button: "+t.buttonId);console.log("LockMessageBox: createButtons number of buttons: "+this.buttonList.length),console.log("LockMessageBox: createButtons json result: "+JSON.stringify(this.messageBoxObject))}removeButtons(e){console.log("LockMessageBox: removeButtons ");for(let t of e){for(let e=0;e<this.buttonList.length;e++)this.buttonList[e].getButtonId()===t&&(console.log("LockMessageBox: splice for index: "+e),this.buttonList.splice(e,1),
console.log("LockMessageBox: Buttonlist buttons left: "+this.buttonList.length),e=0);console.log("LockMessageBox: Clearing json buttons");for(let e=0;e<this.messageBoxObject.buttons.length;e++){let s=this.messageBoxObject.buttons[e];if(console.log("LockMessageBox: buttonId "+s.effect.params.buttonId),s.effect.params.buttonId===t){let t=this.messageBoxObject.buttons.splice(e,1);console.log("LockMessageBox: Removed JSON Button: "+t[0]),console.log("LockMessageBox: ButtonJSON buttons left: "+this.messageBoxObject.buttons.length),e=0}}}}publish(e=!0){let t=JSON.stringify(this.messageBoxObject),s=JSON.stringify(this.lastPublishedTabContent);e&&(t!==s&&this.messageBoxObject.appearance===i.EnumAppearance.ENABLED||this.lastPublishedTabContent.appearance===i.EnumAppearance.ENABLED&&this.messageBoxObject.appearance===i.EnumAppearance.HIDDEN)&&(this.mqttHandler.publish(E.MqttTopics.HMI_LOCK_MESSAGEBOX,t),this.lastPublishedTabContent=JSON.parse(t))}getButtonByTopic(e){
for(let t of this.buttonList){if(t.getTopic().substring(t.getTopic().lastIndexOf("/")+1)===e)return t}}getButton(e){for(let t of this.buttonList)if(t.getButtonId()===e)return t}setAppearance(e,t=!0){"HIDDEN"!==e&&"ENABLED"!==e||(this.appearance=e,this.messageBoxObject.appearance=e,this.publish(t))}getAppearance(){return this.appearance}setBackgroundColor(e,t=!0){this.messageBoxObject.backgroundColor=e,this.publish(t)}getBackgroundColor(){return this.messageBoxObject.backgroundColor}setIconColor(e,t=!0){this.messageBoxObject.iconColor=e,this.publish(t)}getIconColor(){return this.messageBoxObject.iconColor}setType(e,t=!0){this.messageBoxObject.type=e,this.publish(t)}getType(){return this.messageBoxObject.type}setTitle(e,t=!0){this.messageBoxObject.title=e,this.publish(t)}getTitle(){return this.messageBoxObject.title}setTextsList(e,t=!0){this.messageBoxObject.textsList=e,this.publish(t)}getTextsList(){return this.messageBoxObject.textsList}getText(){
return this.messageBoxObject.textsList[0]}getId(){return t.LOCKMESSAGEBOX_ID}hide(){this.appearance===i.EnumAppearance.ENABLED&&(this.setAppearance(i.EnumAppearance.HIDDEN),this.events$.next({type:r.ScreenEventType.HIDE_LOCKMESSAGEBOX,id:this.getId()}))}show(){this.appearance===i.EnumAppearance.HIDDEN&&(this.setAppearance(i.EnumAppearance.ENABLED),this.events$.next({type:r.ScreenEventType.SHOW_LOCKMESSAGEBOX,id:this.getId()}))}}t.LockMessageBox=_,t.default=_},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(38),n=s(9),r=s(2);t.LOCK_LOADING_OVERLAY_ID="LOCK_LOADING_MODAL";t.LockLoadingOverlay=class extends i.AbstractOverlay{setText(e){this.publishContent("TEXT",JSON.stringify(e))}show(){this.publishContent("APPEARANCE",'{ "appearance":"'+a.EnumAppearance.ENABLED+'" }'),this.events$.next({type:n.ScreenEventType.SHOW_LOCKLOADINGSCREEN,id:this.getId()})}hide(){this.publishContent("TEXT",""),
this.publishContent("APPEARANCE",'{ "appearance":"'+a.EnumAppearance.HIDDEN+'" }'),this.events$.next({type:n.ScreenEventType.HIDE_LOCKLOADINGSCREEN,id:this.getId()})}getMqttTopicBase(){return r.MqttTopics.HMI_LOCK_LOADING_MODAL}getId(){return t.LOCK_LOADING_OVERLAY_ID}}},function(e,t){e.exports=require("net")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTime=function(){return Math.trunc(Date.now()/1e3)}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(7),i=s(4);t.CLOCKHANDLER_DATEFORMAT_PARAM_ID="CLOCKHANDLER/CONFIGURATION/TIME/DATEFORMAT",t.CLOCKHANDLER_TIMEFORMAT_PARAM_ID="CLOCKHANDLER/CONFIGURATION/TIME/TIMEFORMAT",t.CLOCKHANDLER_TIMEZONE_PARAM_ID="CLOCKHANDLER/CONFIGURATION/TIME/TIMEZONE";t.ClockHandlerProxy=class extends a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="clockHandler"}getFormatConfiguration(){return this.body.method=i.RestMethodsCLOCK_HANDLER.getFormatConfiguration,
this.body.params={configuration:""},new a.CubisRestResponse(this.syncRequest())}getFormatConfigurationI18n(){return this.body.method=i.RestMethodsCLOCK_HANDLER.getFormatConfigurationI18n,this.body.params={configuration:""},new a.CubisRestResponse(this.syncRequest())}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const a=s(8),i=s(15),n=s(12),r=s(94),o=s(22),E=s(95),_=s(6),l=s(50),c=s(10),u=s(28),T=s(54),A=s(39),p=s(23),d=s(30),I=s(0),h=s(96),S=s(17),N=s(53),m=s(16),P=s(97),R="STATE_CONNECTION_ASPECT_GET_TABLES",g="STATE_CONNECTION_ASPECT_CHECK_LOG_ENTITY",O="STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE",D="STATE_CONNECTION_ASPECT_CHECK_ENTITIES",C="STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES",M="STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION",L="STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION",b="STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF",f="STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE",B="STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE",y="STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND",v="ASYNC_CHECK_LOG_ENTITY_TABLE_OPEN_CONN",U="ASYNC_CHECK_LOG_ENTITY_TABLE_GET_TABLE",G="ASYNC_CREATE_LOG_ENTITY_TABLE",H="ASYNC_CREATE_LOG_ENTITY_TABLE_LOG_CREATION",F="ASYNC_CHECK_ENTITIES_ADD_MIGRATION_LOG",Q="ASYNC_CHECK_CLOSE_MAIN_CONNECTION",x="ASYNC_CHECK_CLOSE_LOG_CONNECTION",w="TYPEORM_MAIN_CONNECTION",V="TYPEORM_LOG_CONNECTION",W="BTN_ID_CONNECTION_ASPECT_YES",k="BTN_ID_CONNECTION_ASPECT_NO"
;t.ConnectionAspect=class extends o.AbstractQAppAspect{constructor(){super(),this.foundTablesInDb=[],this.entityCheckResults=[],this.foundMissingTables=[],this.generalCheckMigrationLogStr="",this.migrationResult=void 0,this.databaseType="sqlite",this.databaseUpdateQAsked=!1,this.states={STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE:{_onEnter:function(e){e.aspects[d.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE()},_onExit:function(){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,t){t.payload.from===d.STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE&&this.transition(e,t.payload.to)},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];this.transition(e,s.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE(t))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){e.aspects[d.CONNECTION_ASPECT].handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE(t)},EV_HMI_BTN_CLICKED:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT]
;(t.payload.buttonId===l.ERRORMSGBOX_OK_BTN_ID||u.isMessageHandlerOkButton(t.payload.buttonId))&&(e.hideMsgBox(),e.deleteDBError(),s.cfg.workflow?this.transition(e,y):this.transition(e,B))}},STATE_CONNECTION_ASPECT_CHECK_LOG_ENTITY:{_onEnter:function(e){e.aspects[d.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_CHECK_LOG_ENTITY()},_onExit:function(){},_transTo:{},_transFrom:{},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];this.transition(e,s.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_LOG_ENTITY(t))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){e.aspects[d.CONNECTION_ASPECT].handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE(t)},EV_HMI_BTN_CLICKED:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];(t.payload.buttonId===l.ERRORMSGBOX_OK_BTN_ID||u.isMessageHandlerOkButton(t.payload.buttonId))&&(e.hideMsgBox(),e.deleteDBError(),s.cfg.workflow?this.transition(e,y):this.transition(e,B))}},
STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE:{_onEnter:function(e){e.aspects[d.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE()},_onExit:function(){},_transTo:{},_transFrom:{},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];this.transition(e,s.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE(t))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){e.aspects[d.CONNECTION_ASPECT].handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE(t)},EV_HMI_BTN_CLICKED:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];u.isMessageHandlerOkButton(t.payload.buttonId)||t.payload.buttonId===k?(e.hideMsgBox(),e.deleteDBError(),s.cfg.workflow?this.transition(e,y):this.transition(e,B)):t.payload.buttonId===W&&(e.hideMsgBox(),s.doCreateLogEntityTable())}},STATE_CONNECTION_ASPECT_GET_TABLES:{_onEnter:function(e){e.aspects[d.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_GET_TABLES()},_onExit:function(){},
_transTo:{},_transFrom:{},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];this.transition(e,s.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_GET_TABLES(t))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){e.aspects[d.CONNECTION_ASPECT].handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_GET_TABLES(t)},EV_HMI_BTN_CLICKED:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];u.isMessageHandlerOkButton(t.payload.buttonId)&&(e.hideMsgBox(),e.deleteDBError(),s.cfg.workflow?this.transition(e,y):this.transition(e,B))}},STATE_CONNECTION_ASPECT_CHECK_ENTITIES:{_onEnter:function(e){e.aspects[d.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES()},_onExit:function(){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,t){t.payload.from===D&&this.transition(e,t.payload.to)}},STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES:{_onEnter:function(e){e.aspects[d.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES()},
_onExit:function(){},_transTo:{},_transFrom:{},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];this.transition(e,s.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES(t))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){e.aspects[d.CONNECTION_ASPECT].handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES(t)},IMMEDIATE_EVENT:function(e,t){t.payload.from===C&&this.transition(e,t.payload.to)},EV_HMI_BTN_CLICKED:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];u.isMessageHandlerOkButton(t.payload.buttonId)&&(e.hideMsgBox(),e.deleteDBError(),s.cfg.workflow?this.transition(e,y):this.transition(e,B))}},STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION:{_onEnter:function(e){e.aspects[d.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION()},_onExit:function(){},_transTo:{},_transFrom:{},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT]
;this.transition(e,s.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION(t))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){e.aspects[d.CONNECTION_ASPECT].handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION(t)},EV_HMI_BTN_CLICKED:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];u.isMessageHandlerOkButton(t.payload.buttonId)&&(e.hideMsgBox(),e.deleteDBError(),s.cfg.workflow?this.transition(e,y):this.transition(e,B))}},STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION:{_onEnter:function(e){e.aspects[d.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION()},_onExit:function(){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,t){t.payload.from===L&&this.transition(e,t.payload.to)},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];this.transition(e,s.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION(t))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){
let s=e.aspects[d.CONNECTION_ASPECT];this.transition(e,s.handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION(t))},EV_HMI_BTN_CLICKED:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];u.isMessageHandlerOkButton(t.payload.buttonId)||t.payload.buttonId===k?(e.hideMsgBox(),e.deleteDBError(),s.cfg.workflow?this.transition(e,y):this.transition(e,B)):t.payload.buttonId===W&&(e.hideMsgBox(),s.doMigration())}},STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF:{_onEnter:function(e){e.aspects[d.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF()},_onExit:function(){},_transTo:{},_transFrom:{},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){e.aspects[d.CONNECTION_ASPECT].handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF(t)},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){e.aspects[d.CONNECTION_ASPECT].handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF(t)},IMMEDIATE_EVENT:function(e,t){
t.payload.from===b&&this.transition(e,t.payload.to)},EV_HMI_BTN_CLICKED:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];u.isMessageHandlerOkButton(t.payload.buttonId)&&(e.hideMsgBox(),e.deleteDBError(),s.cfg.workflow?this.transition(e,y):this.transition(e,B))}},STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE:{_onEnter:function(e){e.aspects[d.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE()},_onExit:function(){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,t){t.payload.from===f&&this.transition(e,t.payload.to)},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];this.transition(e,s.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE(t))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];this.transition(e,s.handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE(t))}},STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE:{_onEnter:function(e){
e.aspects[d.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE()},_onExit:function(){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,t){t.payload.from===B&&this.transition(e,t.payload.to)},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];this.transition(e,s.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE(t))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){let s=e.aspects[d.CONNECTION_ASPECT];this.transition(e,s.handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE(t))}},STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND:{_onEnter:function(e){e.aspects[d.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND()},_onExit:function(){},_transTo:{},_transFrom:{},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){e.aspects[d.CONNECTION_ASPECT].handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND(t)},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){
e.aspects[d.CONNECTION_ASPECT].handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND(t)}}}}getId(){return d.CONNECTION_ASPECT}getAspectStates(){return this.states}init(e){this.client=e}configure(e){e.qappSpecificSqliteDatabaseLocation=void 0===e.qappSpecificSqliteDatabaseLocation||e.qappSpecificSqliteDatabaseLocation,super.configure(e);let t=this.cfg.taskHandler.getParameter(p.TASK_DYNAMIC_ID_DB_TYPES_PARAM_ID);void 0!==t?this.databaseType=t.value.selection.id:this.client.exitError("ConnectAspect::configure: ConnectionURLParameter not found in the taskHandler")}getConnection(){let e=void 0;try{e=n.getConnection(w)}catch(e){console.log("ConnectionAspect::getConnection: no connection found")}return e}getLogConnection(){let e=void 0;try{e=n.getConnection(V)}catch(e){console.log("ConnectionAspect::getLogConnection: no connection found")}return e}createLogEntry(e,t,s){if(!0===this.cfg.useLogTable){let a=new r.LogEntity;a.qappOrderNo=this.client.getQAppOrderNumber(),
a.qappVersion=this.client.getQAppVersion(),a.action=e,a.details=t,this.client.enqueAsyncCall(this.getLogConnection().getRepository(r.LogEntity).save(a),s)}else this.client.addToEventQueue(new _.QAppAsyncCallDoneEvent({sourceState:this.client.getCurrentState(),result:void 0,metadata:s}))}getConnectionOptions(e,t,s=!1){if("sqlite"===this.databaseType){let a=`${this.client.getStorageLocation(N.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT)}/qapp.sqlite`;return!0===this.cfg.qappSpecificSqliteDatabaseLocation&&(a=`${this.client.getStorageLocation(N.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC)}/qapp.sqlite`),{name:e,type:this.databaseType,database:a,synchronize:s,entities:t,subscribers:[E.QAppBaseSubscriber]}}if("postgres"===this.databaseType){
let a=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_USERNAME_PARAM_ID}/${this.databaseType.toUpperCase()}`),i=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_PASSWORD_PARAM_ID}/${this.databaseType.toUpperCase()}`),n=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_DATABASE_PARAM_ID}/${this.databaseType.toUpperCase()}`),r=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_IP_PARAM_ID}/${this.databaseType.toUpperCase()}`),o=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_PORT_PARAM_ID}/${this.databaseType.toUpperCase()}`);return{name:e,type:this.databaseType,host:r.value.string,port:m.QuantityParameter.getValue(o),username:a.value.string,password:i.value.string,database:n.value.string,synchronize:s,entities:t,subscribers:[E.QAppBaseSubscriber]}}if("mssql"===this.databaseType){
let a=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_USERNAME_PARAM_ID}/${this.databaseType.toUpperCase()}`),i=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_PASSWORD_PARAM_ID}/${this.databaseType.toUpperCase()}`),n=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_DATABASE_PARAM_ID}/${this.databaseType.toUpperCase()}`),r=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_SCHEMA_PARAM_ID}/${this.databaseType.toUpperCase()}`),o=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_IP_PARAM_ID}/${this.databaseType.toUpperCase()}`),_=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_PORT_PARAM_ID}/${this.databaseType.toUpperCase()}`);return{name:e,type:this.databaseType,host:o.value.string,port:m.QuantityParameter.getValue(_),username:a.value.string,password:i.value.string,database:n.value.string,schema:r.value.string,synchronize:s,entities:t,subscribers:[E.QAppBaseSubscriber],requestTimeout:15e3,connectionTimeout:1e4,
maxQueryExecutionTime:1e4,dialectOptions:{options:{requestTimeout:1e4}},pool:{acquireTimeoutMillis:2e4}}}return{name:""}}onEnter_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE"),this.client.showLoadingScreen({id:"_QAPP_LIB_LOADING_SCREEN_ESTABLISHING_DATABASE_CONNECTION",args:[]});let e=this.getConnection();this.databaseUpdateQAsked=!1,void 0!==e&&e.isConnected?(console.log("already connected"),this.client.addToEventQueue(new _.ImmediateEvent({from:d.STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE,to:f}))):(console.log("open new connection"),this.client.enqueAsyncCall(n.createConnection(this.getConnectionOptions(w,this.cfg.qappEntities,this.cfg.syncByTypeorm)),d.STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE))}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE(e){return console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE"),
console.log("Connected successfully"),g}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE(e){console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE"),this.cfg.workflow?this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_792_DB_CONN_WORKFLOW_ERROR,e.payload.reason):this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_797_DB_CONN_CONFWORKFLOW_ERROR,e.payload.reason)}onEnter_STATE_CONNECTION_ASPECT_CHECK_LOG_ENTITY(){if(console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_CHECK_LOG_ENTITY"),!0===this.cfg.useLogTable){let e=this.getLogConnection();void 0!==e&&e.isConnected?(console.log("Log connection already exists!"),this.getLogTable()):(console.log("Creating new log connection."),this.client.enqueAsyncCall(n.createConnection(this.getConnectionOptions(V,[r.LogEntity],this.cfg.syncByTypeorm)),v))}else{console.log("Skipping log table checking/creation!");let e=function(){
return a.__awaiter(this,void 0,void 0,function*(){})};this.client.enqueAsyncCall(e(),R)}}getLogTable(){let e=n.getConnection(V);this.client.enqueAsyncCall(function(){return a.__awaiter(this,void 0,void 0,function*(){let t=e.createQueryRunner();yield t.connect();try{return yield t.getTables([e.entityMetadatas[0].tableName])}finally{yield t.release()}})}(),U)}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_LOG_ENTITY(e){if(console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_LOG_ENTITY"),!0!==this.cfg.useLogTable)return R;if(e.payload.metadata===v)return this.getLogTable(),"";if(e.payload.metadata===U){let t=n.getConnection(V);return void 0!==e.payload.result.find(e=>e.name===t.entityMetadatas[0].tableName)?R:this.cfg.workflow?(this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_791_DB_MIGRATION_RUNTIME_ERROR),""):O}return""}onEnter_STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE(){
console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE"),this.client.showMessageBox({type:c.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MSG_BOX_TITLE_DATABASE_NOT_PREPARED_ERROR",args:[]},textList:[{id:"_QAPP_LIB_MSG_BOX_QUESTION_DATABASE_NOT_PREPARED_ERROR",args:[]}],buttons:[{appearance:I.EnumAppearance.ENABLED_SECONDARY,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},id:W},{appearance:I.EnumAppearance.ENABLED_SECONDARY,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},id:k}]}),this.databaseUpdateQAsked=!0}doCreateLogEntityTable(){let e=this.getLogConnection();if(e&&e.isConnected){let t=this.databaseType,s=function(e){return a.__awaiter(this,void 0,void 0,function*(){let s=e.createQueryRunner();yield s.connect();try{return yield s.query(r.LOG_QUERY_STRINGS[t])}finally{yield s.release()}})};this.client.enqueAsyncCall(s(e),G)}else this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_796_DB_CONN_LOST_ERROR)}
handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE(e){return console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE"),e.payload.metadata===G?(this.createLogEntry(r.DB_LOG_ACTION_ADMIN,"Created log table in DB.",H),""):e.payload.metadata===H?R:""}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE(e){e.payload.reason.name===A.QAppAsyncCallTimeoutErrorName?this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_793_DB_OPERATION_TIMEOUT_ERROR):e.payload.reason.name===h.ConnectionLostErrorName?this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_796_DB_CONN_LOST_ERROR):this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_790_GENERIC_DB_ERROR,e.payload.reason)}onEnter_STATE_CONNECTION_ASPECT_GET_TABLES(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_GET_TABLES");let e=this.getConnection();if(e&&e.isConnected){
let t=this.getTableNamesForAllEntities(e),s=function(e){return a.__awaiter(this,void 0,void 0,function*(){let s=e.createQueryRunner();yield s.connect();try{return yield s.getTables(t)}finally{yield s.release()}})};this.client.enqueAsyncCall(s(e),R)}else this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_796_DB_CONN_LOST_ERROR)}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_GET_TABLES(e){return console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_GET_TABLES"),this.foundTablesInDb=e.payload.result,D}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_GET_TABLES(e){console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_GET_TABLES"),
e.payload.reason.name===A.QAppAsyncCallTimeoutErrorName?this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_793_DB_OPERATION_TIMEOUT_ERROR):e.payload.reason.name===h.ConnectionLostErrorName?this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_796_DB_CONN_LOST_ERROR):this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_790_GENERIC_DB_ERROR,e.payload.reason)}onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES");let e=this.getConnection();if(e&&e.isConnected){this.generalCheckMigrationLogStr="",this.entityCheckResults=[],console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES: check expected tables to be found in DB");let t=!1;e.entityMetadatas.forEach(e=>{if(e.target!==r.LogEntity){let s=T.QAppBaseEntity.getSchemaVersionFromTableName(e.tableName);this.foundTablesInDb.find((t,s)=>t.name===e.tableName)?(console.log(`found table ${e.tableName}`),
this.entityCheckResults.push({metadata:e,expectedEntitySchemaVersion:s,lastFoundVersion:s,migrationNeeded:!0,migrationPossible:!1,migrationDoneSameVersion:!1,migrationDone:!1})):(t=!0,this.generalCheckMigrationLogStr+=`Missing table ${e.tableName}\n`,console.log(`missing table ${e.tableName} -> mark for searching older versions`),this.entityCheckResults.push({metadata:e,expectedEntitySchemaVersion:s,lastFoundVersion:NaN,migrationNeeded:!0,migrationPossible:!1,migrationDoneSameVersion:!1,migrationDone:!1}))}}),t?(console.log("some tables missing for this version of QApp"),this.client.addToEventQueue(new _.ImmediateEvent({from:D,to:C}))):(console.log("all current versions of tables found - nevertheless ask QApps for migrations (for the case that a QApp needs to update data in existing tables)"),this.client.addToEventQueue(new _.ImmediateEvent({from:D,to:M})))}else this.client.exitError("onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES: no connection object")}
onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES");let e=this.getConnection();if(e&&e.isConnected){let t=[];if(this.entityCheckResults.forEach(e=>{if(Number.isNaN(e.lastFoundVersion)&&e.expectedEntitySchemaVersion>1){this.generalCheckMigrationLogStr+=`Check for older schema version tables for ${e.metadata.tableName}.\n`,console.log(`Check for older schema version tables for ${e.metadata.tableName}.`);for(let s=e.expectedEntitySchemaVersion;s>=1;s--){let a=T.QAppBaseEntity.generateTableNameWithVersion(T.QAppBaseEntity.getPureTableNameFromTableName(e.metadata.tableName),s);console.log(`add search for ${a}`),t.push(a)}
}else Number.isNaN(e.lastFoundVersion)?console.log(`Table ${e.metadata.tableName} not found but expected in schema version 1 - skip...`):console.log(`Table ${e.metadata.tableName} found in expected version ${e.expectedEntitySchemaVersion} - skip getting older schema version tables`)}),t.length<=0)console.log("No tables to search for."),this.client.addToEventQueue(new _.ImmediateEvent({from:C,to:M}));else{console.log(`Find tables: '${t}'`);let s=function(e){return a.__awaiter(this,void 0,void 0,function*(){let s=e.createQueryRunner();yield s.connect();try{return yield s.getTables(t)}finally{yield s.release()}})};this.client.enqueAsyncCall(s(e),C)}}else this.client.exitError("onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES: no connection object")}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES(e){return console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES"),
e.payload.metadata===C?(this.foundMissingTables=e.payload.result,this.entityCheckResults.forEach(e=>{if(Number.isNaN(e.lastFoundVersion)&&e.expectedEntitySchemaVersion>1)for(let t=e.expectedEntitySchemaVersion;t>=1;t--){let s=T.QAppBaseEntity.generateTableNameWithVersion(T.QAppBaseEntity.getPureTableNameFromTableName(e.metadata.tableName),t);if(this.foundMissingTables.find(e=>e.name===s)){e.lastFoundVersion=t,this.generalCheckMigrationLogStr+=`Found older schema version table ${s}.\n`,console.log(`Found older schema version table ${s}.`);break}}else Number.isNaN(e.lastFoundVersion)?console.log(`Table ${e.metadata.tableName} not found but expected in schema version 1 - skip...`):console.log(`Table ${e.metadata.tableName} found in expected version - skip...`)}),M):""}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES(e){console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES"),
e.payload.reason.name===A.QAppAsyncCallTimeoutErrorName?this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_793_DB_OPERATION_TIMEOUT_ERROR):e.payload.reason.name===h.ConnectionLostErrorName?this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_796_DB_CONN_LOST_ERROR):this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_790_GENERIC_DB_ERROR,e.payload.reason)}onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION"),this.client.enqueAsyncCall(this.cfg.checkMigration(this.getConnection(),this.entityCheckResults),M)}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION(e){if(console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION"),e.payload.metadata===M){this.migrationResult=e.payload.result,
this.migrationResult.logStr="QApp checkMigration() result:\n"+this.migrationResult.logStr,this.generalCheckMigrationLogStr.length>0&&(this.migrationResult.logStr=this.generalCheckMigrationLogStr+"\n"+this.migrationResult.logStr);let t="";switch(this.migrationResult.result){case d.EMigrationResult.MIGRATION_NOT_NEEDED:t=f;break;case d.EMigrationResult.MIGRATION_NEEDED:this.cfg.workflow?(this.migrationResult.logStr+="\nQApp not prepared in DB for running workflow",t=b):t=L;break;case d.EMigrationResult.MIGRATION_NOT_POSSIBLE:this.migrationResult.logStr+="\nQApp cannot migrate DB",t=b;break;default:this.client.exitError("ConnectAspec::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION: EMigrationResult has unexpected value: "+this.migrationResult.result)}return t}return""}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION(e){
console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION"),e.payload.reason.name===A.QAppAsyncCallTimeoutErrorName?this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_793_DB_OPERATION_TIMEOUT_ERROR):e.payload.reason.name===h.ConnectionLostErrorName?this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_796_DB_CONN_LOST_ERROR):this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_790_GENERIC_DB_ERROR,e.payload.reason)}onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION"),!1===this.databaseUpdateQAsked?(this.client.showMessageBox({type:c.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MSG_BOX_TITLE_DATABASE_MIGRATION_NEEDED",args:[]},textList:[{id:"_QAPP_LIB_MSG_BOX_QUESTION_DATABASE_MIGRATION_NEEDED",args:[]}],buttons:[{appearance:I.EnumAppearance.ENABLED_SECONDARY,label:{
id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},id:W},{appearance:I.EnumAppearance.ENABLED_SECONDARY,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},id:k}]}),this.databaseUpdateQAsked=!0):this.doMigration()}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION(e){if(console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION"),e.payload.metadata===L){this.migrationResult.result=e.payload.result.result,this.migrationResult.logStr+="\nQApp doMigration() result:\n"+e.payload.result.logStr;let t="";switch(this.migrationResult.result){case d.EMigrationResult.MIGRATION_FAILED:this.migrationResult.logStr+="\nQApp failed during DB migration",t=b;break;case d.EMigrationResult.MIGRATION_DONE:this.migrationResult.logStr+="\nQApp succeeded DB migration",console.log(`QApp succeeded DB migration: ${this.migrationResult.logStr}`),console.log("record migration log - after that we should be successfully connected"),
this.createLogEntry(r.DB_LOG_ACTION_MIGRATION_SUCCEEDED,this.migrationResult.logStr,F);break;default:this.client.exitError("EMigrationResult has unexpected value")}return t}return e.payload.metadata===F?(console.log("migration log successfully recorded - connected"),f):""}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION(e){return console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION"),e.payload.metadata===L?(this.migrationResult.result=d.EMigrationResult.MIGRATION_FAILED,e.payload.reason.name===A.QAppAsyncCallTimeoutErrorName?(this.migrationResult.logStr+="\nQApp failed during DB migration with timeout",b):(this.migrationResult.logStr+=`\nQApp failed during DB migration with error: ${this.getRootCauseStringForMigrationError(e.payload.reason)}`,
b)):e.payload.metadata===F?(e.payload.reason.name===A.QAppAsyncCallTimeoutErrorName?this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_793_DB_OPERATION_TIMEOUT_ERROR):this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_790_GENERIC_DB_ERROR,e.payload.reason),""):""}doMigration(){this.client.enqueAsyncCall(function(e,t,s,i){return a.__awaiter(this,void 0,void 0,function*(){let a=e.createQueryRunner();yield a.connect(),yield a.startTransaction(P.getIsolationLevel(i));try{let e=yield t(a,s);return yield a.commitTransaction(),e}catch(e){throw yield a.rollbackTransaction(),e}finally{yield a.release()}})}(this.getConnection(),this.cfg.doMigration,this.entityCheckResults,this.databaseType),L)}getRootCauseStringForMigrationError(e){return`${e.name}: ${e.message}`}onEnter_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF"),
this.cfg.workflow?this.createLogEntry(r.DB_LOG_ACTION_MIGRATION_NEEDED_WORKFLOW,this.migrationResult.logStr,b):this.createLogEntry(r.DB_LOG_ACTION_MIGRATION_FAILED,this.migrationResult.logStr,b)}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF(e){switch(console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF"),this.migrationResult.result){case d.EMigrationResult.MIGRATION_FAILED:this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_795_DB_MIGRATION_FAILED_ERROR);break;case d.EMigrationResult.MIGRATION_NOT_POSSIBLE:this.cfg.workflow?this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_791_DB_MIGRATION_RUNTIME_ERROR):this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_794_DB_MIGRATION_UNSUPPORTED_ERROR);break;case d.EMigrationResult.MIGRATION_NEEDED:this.cfg.workflow&&this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_791_DB_MIGRATION_RUNTIME_ERROR)
;break;default:this.client.exitError("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF: incorrect migr result: "+this.migrationResult.result)}}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF(e){console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF"),e.payload.reason.name===A.QAppAsyncCallTimeoutErrorName?this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_793_DB_OPERATION_TIMEOUT_ERROR):e.payload.reason.name===h.ConnectionLostErrorName?this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_796_DB_CONN_LOST_ERROR):this.client.messageHandlerHelper.addMessage(u.EMsgHandlerMsgs.ERR_790_GENERIC_DB_ERROR,e.payload.reason)}onEnter_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE");const e=this.getLogConnection()
;e&&e.isConnected?this.client.enqueAsyncCall(e.close(),x,i.HEARTBEAT_INTERVAL_MS):(console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE - log connection already closed or lost."),this.client.addToEventQueue(new _.ImmediateEvent({from:f,to:this.cfg.nextState})))}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE(e){return console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE"),this.cfg.nextState}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE(e){return console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE: "+S.inspect(e.payload)),this.cfg.nextState}onEnter_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE");const e=this.getConnection(),t=this.getLogConnection();e&&e.isConnected?(console.log("Closing main connection"),
this.client.enqueAsyncCall(e.close(),Q,i.HEARTBEAT_INTERVAL_MS)):t&&t.isConnected?(console.log("Closing log connection"),this.client.enqueAsyncCall(t.close(),x,i.HEARTBEAT_INTERVAL_MS)):(console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE - log connection already closed or lost."),this.client.addToEventQueue(new _.ImmediateEvent({from:B,to:this.cfg.cancelState})))}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE(e){if(console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE"),e.payload.metadata===Q){const e=this.getLogConnection();if(e&&e.isConnected)return console.log("Closing log connection"),this.client.enqueAsyncCall(e.close(),x,i.HEARTBEAT_INTERVAL_MS),""}return this.cfg.cancelState}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE(e){
if(console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE: "+S.inspect(e.payload)),e.payload.metadata===Q){const e=this.getLogConnection();if(e&&e.isConnected)return console.log("Closing log connection"),this.client.enqueAsyncCall(e.close(),x,i.HEARTBEAT_INTERVAL_MS),""}return this.cfg.cancelState}onEnter_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND"),this.client.suspend()}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND(e){console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND"),this.client.suspend()}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND(e){console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND: "+S.inspect(e.payload)),this.client.suspend()}getTableNamesForAllEntities(e){return e.entityMetadatas.map(e=>e.tableName)}}},function(e,t,s){
"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(8),i=s(12),n=s(54);t.DB_LOG_ACTION_MIGRATION_FAILED="MIGRATION_FAILED",t.DB_LOG_ACTION_MIGRATION_NEEDED_WORKFLOW="MIGRATION_NEEDED_WORKFLOW",t.DB_LOG_ACTION_MIGRATION_SUCCEEDED="MIGRATION_SUCCEEDED",t.DB_LOG_ACTION_ADMIN="ADMIN",t.LOG_QUERY_STRINGS={mssql:"",mysql:"CREATE TABLE `log` (`id` int NOT NULL AUTO_INCREMENT, `serial` varchar(255) NOT NULL, `taskId` varchar(255) NOT NULL, `version` int NOT NULL, `date` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `qappOrderNo` varchar(255) NOT NULL, `qappVersion` varchar(255) NOT NULL, `action` varchar(255) NOT NULL, `details` text NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB",
postgres:'CREATE TABLE "log" ("id" SERIAL NOT NULL, "serial" character varying NOT NULL, "taskId" character varying NOT NULL, "version" integer NOT NULL, "date" TIMESTAMP NOT NULL DEFAULT now(), "qappOrderNo" character varying NOT NULL, "qappVersion" character varying NOT NULL, "action" character varying NOT NULL, "details" text NOT NULL, CONSTRAINT "PK_f77cbf8486ae8b6fd0342d62208" PRIMARY KEY ("id"))',sqlite:'CREATE TABLE "log" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "serial" varchar NOT NULL, "taskId" varchar NOT NULL, "version" integer NOT NULL, "date" datetime NOT NULL DEFAULT (datetime(\'now\')), "qappOrderNo" varchar NOT NULL, "qappVersion" varchar NOT NULL, "action" varchar NOT NULL, "details" text NOT NULL)'};let r=class extends n.QAppBaseEntity{constructor(){super(...arguments),this.id=0,this.qappOrderNo="",this.qappVersion="",this.action="",this.details=""}getEntityTableNameNoSchemaVersion(){return"log"}getSchemaVersion(){return NaN}}
;a.__decorate([i.PrimaryGeneratedColumn(),a.__metadata("design:type",Number)],r.prototype,"id",void 0),a.__decorate([i.CreateDateColumn(),a.__metadata("design:type",Date)],r.prototype,"date",void 0),a.__decorate([i.Column(),a.__metadata("design:type",String)],r.prototype,"qappOrderNo",void 0),a.__decorate([i.Column(),a.__metadata("design:type",String)],r.prototype,"qappVersion",void 0),a.__decorate([i.Column(),a.__metadata("design:type",String)],r.prototype,"action",void 0),a.__decorate([i.Column({type:"text"}),a.__metadata("design:type",String)],r.prototype,"details",void 0),r=a.__decorate([i.Entity("log")],r),t.LogEntity=r},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(8),i=s(12),n=s(15);let r=class{beforeInsert(e){""===e.entity.serial&&(e.entity.serial=n.QAppBase.clientSingleton.getSerialNumber()),""===e.entity.taskId&&(e.entity.taskId=n.QAppBase.clientSingleton.getTaskId()||"create Task")}beforeUpdate(e){
void 0!==e.entity&&(""===e.entity.serial&&(e.entity.serial=n.QAppBase.clientSingleton.getSerialNumber()),""===e.entity.taskId&&(e.entity.taskId=n.QAppBase.clientSingleton.getTaskId()||"create Task"))}};r=a.__decorate([i.EventSubscriber()],r),t.QAppBaseSubscriber=r},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionLostErrorName="ConnectionLostError";class a extends Error{constructor(){super(),this.name=t.ConnectionLostErrorName,Object.setPrototypeOf(this,a.prototype),this.message="Lost connection to database."}}t.ConnectionLostError=a},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getIsolationLevel=function(e){switch(e){case"sqlite":return"SERIALIZABLE";case"postgres":case"mysql":case"mssql":return"READ COMMITTED";default:return}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const a=s(108),i=s(110),n=s(111),r=s(36),o=s(112),E=s(113),_="SCREENS/",l="/TABLIST",c="/REQUESTEDTAB",u="/QAPP/";class T{constructor(e,t){this.tabScreenTablistObject=[],this.tabScreenRequestedObject="",this.tabList=[],this.mqttHandler=e,this.screenId=t,this.tabScreenTopic=_+this.screenId,this.tabScreenTablistTopic=this.tabScreenTopic+l,this.tabScreenRequestedTopic=this.tabScreenTopic+c}publishTabList(){this.mqttHandler.publish(this.tabScreenTablistTopic,JSON.stringify(this.tabScreenTablistObject))}publishRequestedTab(){this.mqttHandler.publish(this.tabScreenRequestedTopic,JSON.stringify(this.tabScreenRequestedObject))}static createFigureTab(e,t,s,i,n){return s.topbuttons=void 0!==n?T.sortTopButtons(n):s.topbuttons,new a.TabFigure(s,e,t,i)}addFigureTab(e,t,s){t.id=e;let a=T.createFigureTab(this.mqttHandler,this.screenId,t,!1,s);return this.tabScreenTablistObject.push(u+a.publishId()),this.tabList.push(a),a}static createGraphTab(e,t,s,a,n){
return s.topbuttons=void 0!==n?T.sortTopButtons(n):s.topbuttons,new i.TabGraph(s,e,t,a)}addGraphTab(e,t,s){t.id=e;let a=T.createGraphTab(this.mqttHandler,this.screenId,t,!1,s);return this.tabScreenTablistObject.push(u+a.publishId()),this.tabList.push(a),a}static createParamListTab(e,t,s,a,i){return s.topbuttons=void 0!==i?T.sortTopButtons(i):s.topbuttons,new n.TabParamList(s,e,t,a)}addParamListTab(e,t,s){t.id=e;let a=T.createParamListTab(this.mqttHandler,this.screenId,t,!1,s);return this.tabScreenTablistObject.push(u+a.publishId()),this.tabList.push(a),a}static createMenuTab(e,t,s,a,i){return s.topbuttons=void 0!==i?T.sortTopButtons(i):s.topbuttons,new o.TabMenu(s,e,t,a)}static createTableTab(e,t,s,a,i){return s.topbuttons=void 0!==i?T.sortTopButtons(i):s.topbuttons,new E.TabTable(s,e,t,a)}addMenuTab(e,t,s){t.id=e;let a=T.createMenuTab(this.mqttHandler,this.screenId,t,!1,s);return this.tabScreenTablistObject.push(u+a.publishId()),this.tabList.push(a),a}addTableTab(e,t,s){t.id=e
;let a=T.createTableTab(this.mqttHandler,this.screenId,t,!1,s);return this.tabScreenTablistObject.push(u+a.publishId()),this.tabList.push(a),a}getTab(e){let t=void 0;for(let s of this.tabList)s.getTabId()===e&&(t=s);return t}getTabList(){return this.tabList}clearTabList(){this.tabList.splice(0,this.tabList.length),this.tabScreenTablistObject.splice(0,this.tabScreenTablistObject.length)}requestTab(e){void 0!==this.getTab(e)&&(this.tabScreenRequestedObject=e,this.publishRequestedTab())}static sortTopButtons(e){return e.sort((e,t)=>r.getButtonPriority(e.getButtonId())-r.getButtonPriority(t.getButtonId())).map(e=>`/QAPP/${e.getTopic()}`)}}t.TabApi=T},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(3),n=s(18),r=s(9),o=s(14),E=s(2);t.KEYBOARD_SCREEN_ID="PARAMETER_INPUT";t.KeyboardScreen=class{constructor(e,t){this.keyboardObject={appearance:a.EnumAppearance.HIDDEN,param:{}},this.events$=new o.Subject,
t?(this.keyboardParam=i.createEmptySelectionParameter(),this.keyboardParam.appearance=a.EnumAppearance.HIDDEN):(this.keyboardParam=i.createEmptyStringParameter(),this.keyboardParam.appearance=a.EnumAppearance.HIDDEN),this.keyboardObject.param=this.keyboardParam,this.mqttHandler=e}setAppearance(e){this.keyboardObject.appearance!==e&&(e!==a.EnumAppearance.HIDDEN&&e!==a.EnumAppearance.ENABLED||(this.keyboardObject.appearance=e,this.mqttHandler.publish(E.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify(this.keyboardObject))))}getAppearance(){return this.keyboardObject.appearance}publishIfEnabled(){this.keyboardObject.appearance===a.EnumAppearance.ENABLED&&this.mqttHandler.publish(E.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify(this.keyboardObject))}setParamId(e){this.keyboardObject.param.id!==e&&(this.keyboardObject.param.id=e,this.publishIfEnabled())}getParamId(){return this.keyboardObject.param.id}setParamType(e){
this.keyboardObject.param.type!==e&&(this.keyboardObject.param.type=e,this.publishIfEnabled())}getParamType(){return this.keyboardObject.param.type}setParamAppearance(e){this.keyboardObject.param.appearance=e,this.publishIfEnabled()}getParamAppearance(){return this.keyboardObject.param.appearance}checkTextStructEqual(e,t){let s=!0;return e.id!==t.id&&(s=!1),e.args.join()!==t.args.join()&&(s=!1),s}setParamTitle(e){this.checkTextStructEqual(e,this.keyboardObject.param.title)||(this.keyboardObject.param.title=e,this.publishIfEnabled())}getParamTitle(){return this.keyboardObject.param.title}setParamHeader(e){this.checkTextStructEqual(e,this.keyboardObject.param.header)||(this.keyboardObject.param.header=e,this.publishIfEnabled())}getParamHeader(){return this.keyboardObject.param.header}setParam(e){n.isEqual(this.keyboardObject.param,e)||(this.keyboardObject.param=e,this.publishIfEnabled())}getParam(){return this.keyboardObject.param}getId(){return t.KEYBOARD_SCREEN_ID}getButton(e){}hide(){
this.keyboardObject.appearance===a.EnumAppearance.ENABLED&&(this.setAppearance(a.EnumAppearance.HIDDEN),this.events$.next({type:r.ScreenEventType.HIDE_OVERLAY,id:this.getId()}))}show(){this.keyboardObject.appearance===a.EnumAppearance.HIDDEN&&(this.setAppearance(a.EnumAppearance.ENABLED),this.events$.next({type:r.ScreenEventType.SHOW_OVERLAY,id:this.getId()}))}}},,function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(13),i=s(98),n=s(0),r=s(9),o=s(14),E=s(2);t.TAB_SCREEN_ID="TABBEDSCREEN",t.BACK_BUTTON_ID="BTN_BACK",t.BACK_BUTTON_ID_PREFIX=t.BACK_BUTTON_ID+"_";const _={buttonId:"BUTTONS/"+t.BACK_BUTTON_ID,label:{id:"",args:[]},appearance:n.EnumAppearance.ENABLED};t.TabScreen=class extends i.TabApi{constructor(e){super(e,t.TAB_SCREEN_ID),this.events$=new o.Subject,this.backButton=new a.Button(this.mqttHandler,this,_)}hide(){this.mqttHandler.publish(E.MqttTopics.HMI_TABBED_SCREEN,'{ "appearance":"'+n.EnumAppearance.HIDDEN+'" }'),this.events$.next({
type:r.ScreenEventType.HIDE_OVERLAY,id:this.getId()})}show(){this.backButton.publish(),this.getTabList().forEach(e=>e.publish()),this.mqttHandler.publish(E.MqttTopics.HMI_TABBED_SCREEN,'{ "appearance":"'+n.EnumAppearance.ENABLED+'" }'),this.events$.next({type:r.ScreenEventType.SHOW_OVERLAY,id:this.getId()})}getId(){return t.TAB_SCREEN_ID}getButton(e){if(e===t.BACK_BUTTON_ID)return this.backButton}hideBackButton(){this.backButton.setAppearance(n.EnumAppearance.HIDDEN)}showBackButton(){this.backButton.setAppearance(n.EnumAppearance.ENABLED)}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(22),i=s(99),n=s(25),r=s(0),o=s(6),E=s(23),_=s(11),l=s(10),c=s(66),u=s(18),T=s(33),A=s(42),p=s(1),d=s(3);t.IDENTIFIER_ASPECT="IDENTIFIER_ASPECT",t.STATE_ASPECT_IDENTIFIER_PREFIX="STATE_ASPECT_IDENTIFIER",t.STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT=t.STATE_ASPECT_IDENTIFIER_PREFIX+"_ENTER_LOT_INPUT",
t.STATE_ASPECT_IDENTIFIER_ENTER_SID_INPUT=t.STATE_ASPECT_IDENTIFIER_PREFIX+"_ENTER_SID_INPUT";const I=t.STATE_ASPECT_IDENTIFIER_PREFIX+"_LOT_INPUT_DO",h=t.STATE_ASPECT_IDENTIFIER_PREFIX+"_SID_INPUT_DO";t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE=c.LID_SID_USER_INPUT_STRING_VALUES,t.IDENTIFIER_MAX_LENGTH_LID_SID_NUMBER_VALUE=15;const S=0,N="-1";t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_OK="BTN_ID_ASP_ID_A_INC_WARN_OK",t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_YES="BTN_ID_ASP_ID_A_INC_WARN_YES",t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_NO="BTN_ID_ASP_ID_A_INC_WARN_NO";const m="PARAM_ID_RT_LOT",P="PARAM_ID_RT_SID",R="PARAM_ID_RT_IDENTIFIER_INP";class g extends a.AbstractQAppAspect{constructor(){super(),this.states={STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT:{_onEnter:function(e){let s=e.aspects[t.IDENTIFIER_ASPECT];s.inputIdx=0,s.evalLotInput()?(console.log("IdentifierAspect - at least one (more) LID configured"),e.addToEventQueue(new o.ImmediateEvent({
from:t.STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT,to:I}))):(console.log("IdentifierAspect - no (further) LIDs configured"),e.addToEventQueue(new o.ImmediateEvent({from:t.STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT,to:s.cfg.returnState})))},_onExit:function(e){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,s){s.payload.from===t.STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT&&this.transition(e,s.payload.to)}},STATE_ASPECT_IDENTIFIER_LOT_INPUT_DO:{_onEnter:function(e){},_onExit:function(e){e.screens[i.KEYBOARD_SCREEN_ID].hide()},_transTo:{},_transFrom:{},EV_HMI_PARAM_CHANGED:function(e,s){console.log("IdentifierAspect - param change in STATE_ASPECT_IDENTIFIER_LOT_INPUT_DO");let a=e.aspects[t.IDENTIFIER_ASPECT];if(s.payload.parameter.id===R+a.inputIdx){let t=A.checkGeneralParamRules(s.payload.parameter),n=s.payload.parameter.value.string;void 0===t?(a.setLotID(a.inputIdx,n),a.inputIdx++,a.evalLotInput()||(console.log("IdentifierAspect - no (further) LIDs configured"),
this.transition(e,a.cfg.returnState))):(e.showMessageBox(t.message),a.sPIn_4_identifier.value.string=n,a.client.screens[i.KEYBOARD_SCREEN_ID].setParam(a.sPIn_4_identifier))}},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===T.ParamUpdateUserActionSimpleAccept_OK_BUTTON_ID&&e.hideMsgBox()}},STATE_ASPECT_IDENTIFIER_ENTER_SID_INPUT:{_onEnter:function(e){let s=e.aspects[t.IDENTIFIER_ASPECT];s.inputIdx=0,s.evalSidInput()?(console.log("IdentifierAspect - at least one (more) SID configured"),e.addToEventQueue(new o.ImmediateEvent({from:t.STATE_ASPECT_IDENTIFIER_ENTER_SID_INPUT,to:h}))):(console.log("IdentifierAspect - no (further) SIDs configured"),e.addToEventQueue(new o.ImmediateEvent({from:t.STATE_ASPECT_IDENTIFIER_ENTER_SID_INPUT,to:s.cfg.returnState})))},_onExit:function(e){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,s){s.payload.from===t.STATE_ASPECT_IDENTIFIER_ENTER_SID_INPUT&&this.transition(e,s.payload.to)}},STATE_ASPECT_IDENTIFIER_SID_INPUT_DO:{
_onEnter:function(e){},_onExit:function(e){e.screens[i.KEYBOARD_SCREEN_ID].hide();let s=e.aspects[t.IDENTIFIER_ASPECT];s.cfg.autoRememberSIDs&&(s.sIDsPrevSample=s.sIDs)},_transTo:{},_transFrom:{},EV_HMI_PARAM_CHANGED:function(e,s){console.log("IdentifierAspect - param change in STATE_ASPECT_IDENTIFIER_SID_INPUT_DO");let a=e.aspects[t.IDENTIFIER_ASPECT];if(s.payload.parameter.id===R+a.inputIdx){let t=A.checkGeneralParamRules(s.payload.parameter),n=s.payload.parameter.value.string;if(void 0===t){a.setSID(a.inputIdx,n);let t=g.getSIDState(a.inputIdx,a.getTaskHandler());if(t===E.EnumSampleIdentifierOptions.ON_AUTO_INC||t===E.EnumSampleIdentifierOptions.ON_AUTO_DEC){let r=t===E.EnumSampleIdentifierOptions.ON_AUTO_INC,o=D(r,s.payload.parameter.value.string);o.success?this.transition(e,a.sIdInputDone()):(a.sPIn_4_identifier.value.string=n,a.client.screens[i.KEYBOARD_SCREEN_ID].setParam(a.sPIn_4_identifier),a.client.showMessageBox(C(r,o.result,!0)))}else this.transition(e,a.sIdInputDone())
}else e.showMessageBox(t.message),a.sPIn_4_identifier.value.string=n,a.client.screens[i.KEYBOARD_SCREEN_ID].setParam(a.sPIn_4_identifier)}},EV_HMI_BTN_CLICKED:function(e,s){let a=e.aspects[t.IDENTIFIER_ASPECT];s.payload.buttonId===t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_OK?(e.screens[i.KEYBOARD_SCREEN_ID].show(),e.hideMsgBox()):s.payload.buttonId===T.ParamUpdateUserActionSimpleAccept_OK_BUTTON_ID?e.hideMsgBox():s.payload.buttonId===t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_YES?(e.hideMsgBox(),this.transition(e,a.sIdInputDone())):s.payload.buttonId===t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_NO&&e.hideMsgBox()}}},this.sP_4_lotA=[],this.sP_4_sidA=[],this.lotIDs=[],this.sIDs=[],this.sIDsPrevSample=void 0,this.inputIdx=0,this.cfgGroupCnt=void 0,this.cfgGroupLID=void 0,this.cfgGroupSID=void 0,this.sPIn_4_identifier=d.createEmptyStringParameter()}getId(){return t.IDENTIFIER_ASPECT}getAspectStates(){return this.states}static getConfiguredLIDCount(e){
let t=e.getParameter(E.TASK_DYNAMIC_ID_LID_CNT_PARAM_ID);return void 0!==t?E.getConfiguredIds(t):0}static getConfiguredSIDCount(e){let t=e.getParameter(E.TASK_DYNAMIC_ID_SID_CNT_PARAM_ID);return void 0!==t?E.getConfiguredIds(t):0}static createLIDParams(e,s,a){let i=[],o=g.getConfiguredLIDCount(a);console.log("IdentifierAspect::createLIDParams: create params for "+o+" LIDs");for(let _=1;_<=o;_++){let o=a.getParameter(E.createLIDParamId(_,E.TASK_DYNAMIC_ID_LID_X_PARAM_ID_SUFFIX_TITLE)),l=a.getParameter(E.createLIDParamId(_,E.TASK_DYNAMIC_ID_LID_X_PARAM_ID_SUFFIX_HEADER)),c=d.createEmptyStringParameter();c.id=m+_+(e?"_"+e:""),c.appearance=r.EnumAppearance.HIDDEN,c.title={id:o.value.string,args:[]},c.header={id:l.value.string,args:[]},c.info={minimum:{length:0},maximum:{length:t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE}},i.push(new n.default(s,c))}return i}static createSIDParams(e,s,a){let i=[],o=g.getConfiguredSIDCount(a)
;console.log("IdentifierAspect::createSIDParams: create params for "+o+" SIDs");for(let _=1;_<=o;_++){let o=a.getParameter(E.createSIDParamId(_,E.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_TITLE)),l=a.getParameter(E.createSIDParamId(_,E.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_HEADER)),c=d.createEmptyStringParameter();c.id=P+_+(e?"_"+e:""),c.appearance=r.EnumAppearance.HIDDEN,c.title={id:o.value.string,args:[]},c.header={id:l.value.string,args:[]},c.info={minimum:{length:0},maximum:{length:t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE}},i.push(new n.default(s,c))}return i}init(e){if(this.client=e,this.client){if(console.log("IdentifierAspect::init"),!this.client.screens[i.KEYBOARD_SCREEN_ID]){let e=new i.KeyboardScreen(this.client.mqttHandler);this.client.registerScreen(e)}this.sPIn_4_identifier=d.createEmptyStringParameter(),this.sPIn_4_identifier.id=R,this.sPIn_4_identifier.appearance=r.EnumAppearance.ENABLED,this.sPIn_4_identifier.title={id:"",args:[]},this.sPIn_4_identifier.header={id:"",args:[]},
this.sPIn_4_identifier.info={isNoValueAllowed:!0,minimum:{length:0},maximum:{autoCut:!1,length:t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE}}}else console.log("IdentifierAspect::init - aspect not correctly initialized (no client set) - skip init")}configure(e){super.configure(e),void 0===this.cfg.showPreviouslySetLIDs&&(this.cfg.showPreviouslySetLIDs=!1);let t=this.getTaskHandler().getGroup(E.TASK_DYNAMIC_ID_CNT_GROUP_ID),s=this.getTaskHandler().getGroup(E.TASK_DYNAMIC_ID_LID_GROUP_ID),a=this.getTaskHandler().getGroup(E.TASK_DYNAMIC_ID_SID_GROUP_ID);console.log("IdentifierAspect::configure"),u.isEqual(this.cfgGroupCnt,t)&&u.isEqual(this.cfgGroupLID,s)&&u.isEqual(this.cfgGroupSID,a)?console.log("IdentifierAspect::configure: no content update of taskHandler - keep params for IDs"):(console.log("IdentifierAspect::configure: update of taskHandler - create params for IDs"),this.cfgGroupCnt=p.cloneJSON(t),this.cfgGroupLID=p.cloneJSON(s),this.cfgGroupSID=p.cloneJSON(a),
t&&s&&a&&(console.log("IdentifierAspect::configure - create LID params"),this.sP_4_lotA=g.createLIDParams("",this.client.mqttHandler,this.getTaskHandler()),this.sP_4_lotA.forEach(e=>{e.publish()}),console.log("IdentifierAspect::configure - create SID params"),this.sP_4_sidA=g.createSIDParams("",this.client.mqttHandler,this.getTaskHandler()),this.sP_4_sidA.forEach(e=>{e.publish()})))}getTaskHandler(){return this.cfg.taskHandler}getLotVisualParams(){return this.sP_4_lotA}getSIDVisualParams(){return this.sP_4_sidA}prepLotInput(e){this.client.screens[i.KEYBOARD_SCREEN_ID].hide(),this.sPIn_4_identifier.id=R+e,this.sPIn_4_identifier.title=this.sP_4_lotA[this.inputIdx].getValue().title,this.sPIn_4_identifier.header=this.sP_4_lotA[this.inputIdx].getValue().header,this.sPIn_4_identifier.info.maximum.length=t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE,this.cfg.showPreviouslySetLIDs?this.sPIn_4_identifier.value.string=void 0!==this.lotIDs[e]?this.lotIDs[e]:"":this.sPIn_4_identifier.value.string="",
console.log("IdentifierAspect::prepLotInput - prepare input of: "+JSON.stringify(this.sPIn_4_identifier.header)),this.client.screens[i.KEYBOARD_SCREEN_ID].setParam(this.sPIn_4_identifier),this.client.screens[i.KEYBOARD_SCREEN_ID].show()}prepSidInput(e,s,a){if(this.client.screens[i.KEYBOARD_SCREEN_ID].hide(),this.sPIn_4_identifier.id=R+e,this.sPIn_4_identifier.title=this.sP_4_sidA[e].getValue().title,this.sPIn_4_identifier.header=this.sP_4_sidA[e].getValue().header,this.sPIn_4_identifier.info.maximum.length=t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE,!s.length||0===s.length)switch(g.getSIDState(e,this.getTaskHandler())){case E.EnumSampleIdentifierOptions.ON_AUTO_INC:case E.EnumSampleIdentifierOptions.ON_AUTO_DEC:this.sPIn_4_identifier.info.maximum.length=t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE}this.sPIn_4_identifier.value.string=s,console.log("IdentifierAspect::prepSidInput - prepare input of: "+JSON.stringify(this.sPIn_4_identifier.header)),
this.client.screens[i.KEYBOARD_SCREEN_ID].setParam(this.sPIn_4_identifier),a&&this.client.screens[i.KEYBOARD_SCREEN_ID].show()}static updateAndPublishIDParamStatic(e,t){t&&t.length>0?(e.getValue().value.string=t,e.getValue().appearance=r.EnumAppearance.ENABLED):(e.getValue().value.string="",e.getValue().appearance=r.EnumAppearance.HIDDEN),e.publish()}static setLotIDsStatic(e,t){for(let s=0;s<t.length;s++)this.updateAndPublishIDParamStatic(t[s],e[s])}setLotIDs(e){this.lotIDs=e,g.setLotIDsStatic(this.lotIDs,this.sP_4_lotA)}setLotID(e,t){this.lotIDs[e]=t,g.updateAndPublishIDParamStatic(this.sP_4_lotA[e],this.lotIDs[e])}static setSIDsStatic(e,t){for(let s=0;s<t.length;s++)g.updateAndPublishIDParamStatic(t[s],e[s])}setSIDs(e,t){this.sIDs=e,this.cfg.autoRememberSIDs||(this.sIDsPrevSample=t),g.setSIDsStatic(this.sIDs,this.sP_4_sidA)}isPreviouSampleIdsPresent(){return void 0!==this.sIDsPrevSample&&void 0!==this.sIDsPrevSample[this.inputIdx]}setSID(e,t){this.sIDs[e]=t,
g.updateAndPublishIDParamStatic(this.sP_4_sidA[e],this.sIDs[e])}static getLotState(e,t){let s=E.EnumLotIdentifierOptions.OFF,a=t.getParameter(E.TASK_DYNAMIC_ID_LID_CNT_PARAM_ID);return e>=0&&e<E.getConfiguredIds(a)&&(s=E.EnumLotIdentifierOptions.ON),console.log("IdentifierAspect::getLotState for idx:"+e+" -> "+s),s}static getSIDState(e,t){let s=e+1,a=E.EnumSampleIdentifierOptions.OFF,i=t.getParameter(E.TASK_DYNAMIC_ID_SID_CNT_PARAM_ID);return e>=0&&e<E.getConfiguredIds(i)&&(a=t.getParameter(E.createSIDParamId(s,E.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_MODE)).value.selection.id),a}static getIdxFirstEnabledSID(e){let t=e.getParameter(E.TASK_DYNAMIC_ID_SID_CNT_PARAM_ID);return E.getConfiguredIds(t)>0?0:NaN}evalLotInput(){let e=this.getTaskHandler().getParameter(E.TASK_DYNAMIC_ID_LID_CNT_PARAM_ID);for(let t=this.inputIdx;t<E.getConfiguredIds(e);t++)return this.inputIdx=t,this.prepLotInput(this.inputIdx),!0;return!1}evalSidInput(){console.log("IdentifierAspect - evalSidInput")
;let e=this.getTaskHandler().getParameter(E.TASK_DYNAMIC_ID_SID_CNT_PARAM_ID);for(let t=this.inputIdx;t<E.getConfiguredIds(e);t++){console.log("IdentifierAspect - evalSidInput: loop:"+t);let e=g.getSIDState(t,this.getTaskHandler());if(e===E.EnumSampleIdentifierOptions.ON)return console.log("IdentifierAspect - request input for SID idx:"+t),this.inputIdx=t,this.prepSidInput(this.inputIdx,this.sIDsPrevSample&&this.sIDsPrevSample[this.inputIdx]?this.sIDsPrevSample[this.inputIdx]:"",!0),!0;if(e===E.EnumSampleIdentifierOptions.ON_AUTO_INC||e===E.EnumSampleIdentifierOptions.ON_AUTO_DEC){this.inputIdx=t;let s=e===E.EnumSampleIdentifierOptions.ON_AUTO_INC;if(this.sIDsPrevSample&&void 0!==this.sIDsPrevSample[this.inputIdx]){console.log("IdentifierAspect - AutoInc/Dec for SID idx:"+this.inputIdx);let e=D(s,this.sIDsPrevSample[this.inputIdx]);return e.success?this.prepSidInput(this.inputIdx,e.result,!0):(console.log("IdentifierAspect - AutoInc/Dec failed show warning for SID idx:"+this.inputIdx),
this.prepSidInput(this.inputIdx,this.sIDsPrevSample[this.inputIdx],!1),this.client.showMessageBox(C(s,e.result))),!0}return console.log("IdentifierAspect - AutoInc/Dec, but first sample -> request input for SID idx:"+this.inputIdx),this.prepSidInput(this.inputIdx,"",!0),!0}}return!1}resetSIDsPrevSample(){this.sIDsPrevSample=void 0}sIdInputDone(){let e="";return console.log("IdentifierAspect - sIdInputDone"),this.inputIdx++,this.evalSidInput()?console.log("IdentifierAspect - at least one more SIDs configured"):(console.log("IdentifierAspect - no (further) SIDs configured"),e=this.cfg.returnState),e}}var O;function D(e,s,a=t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE){console.log("IdentifierAspect - AutoInc/Dec, not first sample > check for number");let i=s.match("^\\d*$");if(i&&void 0!==i[0]){let s;if(console.log("IdentifierAspect - AutoInc, not first sample > inc number"),""===i[0]){if(s=0,!e)return{success:!1,result:{id:O.NONUMBERFOUND,args:[]}}}else{
if(i[0].length>t.IDENTIFIER_MAX_LENGTH_LID_SID_NUMBER_VALUE)return{success:!1,result:{id:O.NUMBERTOOLARGE,args:[]}};s=parseInt(i[0],10)}if(e)s++;else{if(!(s>S))return{success:!1,result:{id:O.LOWERBOUNDARY,args:[]}};s--}let n=s.toFixed(0);return n.length>a?{success:!1,result:{id:O.SIDTOOLARGE,args:[a.toString()]}}:{success:!0,result:n}}{let i=s.match("(.*[\\-_.#\\s])(\\d*)$");if(i&&void 0!==i[2]){let s;if(console.log("IdentifierAspect - AutoInc/Dec, not first sample > inc/dec suffix"),""===i[2]){if(s=0,!e)return{success:!1,result:{id:O.NONUMBERFOUND,args:[]}}}else{if(i[2].length>t.IDENTIFIER_MAX_LENGTH_LID_SID_NUMBER_VALUE)return{success:!1,result:{id:O.NUMBERTOOLARGE,args:[]}};s=parseInt(i[2],10)}if(e)s++;else{if(!(s>S))return{success:!1,result:{id:O.LOWERBOUNDARY,args:[]}};s--}let n=i[1]+s.toFixed();return n.length>a?{success:!1,result:{id:O.SIDTOOLARGE,args:[a.toString()]}}:{success:!0,result:n}}if(console.log("IdentifierAspect - AutoInc, not first sample > add suffix"),e){let e=s+N
;return e.length>a?{success:!1,result:{id:O.SIDTOOLARGE,args:[a.toString()]}}:{success:!0,result:e}}return{success:!1,result:{id:O.NOSEPARATORFOUND,args:[]}}}}function C(e,s,a=!1){let i=[],n=[];return e?a?i.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_WARNING_FOR_NEXT_SID",args:[]}):i.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_WARNING",args:[]}):a?i.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING_FOR_NEXT_SID",args:[]}):i.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING",args:[]}),i.push(s),a&&i.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_DEC_WARNING_CONTINUE",args:[]}),n=a?[{id:t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_YES,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:r.EnumAppearance.ENABLED_SECONDARY},{id:t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_NO,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},appearance:r.EnumAppearance.ENABLED_SECONDARY}]:[{id:t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_OK,label:{id:_.EnumFontLabels.OK,
args:[]},appearance:r.EnumAppearance.ENABLED_SECONDARY}],{type:l.EnumMessageboxType.WARNING,title:{id:"_QAPP_LIB_MBOX_TITLE_IDENTIFIER_AUTO_INC_DEC_WARNING",args:[]},textList:i,buttons:n}}t.IdentifierAspect=g,function(e){e.NUMBERTOOLARGE="_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_DEC_WARNING_NO_TOO_LARGE",e.LOWERBOUNDARY="_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING_LOWER_BOUNDARY",e.SIDTOOLARGE="_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_DEC_WARNING_SID_TOO_LARGE",e.NOSEPARATORFOUND="_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING_NO_SEPARATOR_FOUND",e.NONUMBERFOUND="_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING_NO_NUMBER_FOUND"}(O=t.IncreaseDecreaseFailEnum||(t.IncreaseDecreaseFailEnum={})),t.increaseDecreaseId=D,t.getWarningNoIdChange=C},,,,,function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const a=s(8),i=s(15),n=s(27),r=s(3),o=s(101),E=s(10),_=s(59),l=s(11),c=s(26),u=s(48),T=s(1),A=s(29),p=s(114),d=s(123),I=s(21),h=s(6),S=s(30),N=s(93),m=s(19),P=s(2),R=s(4),g=s(5),O=s(40),D=s(20),C=s(31),M=s(25),L=s(0),b=s(55),f=s(56),B=s(57),y="Count",v="Check",U="05_Counting_Tare.png",G="05_Counting_InitCount.png",H="05_Counting_SampleCount.png",F="05_Statistics_RemoveSample.png",Q="05_Statistics_NextSampleInVessel.png",x=10,w={start:0,end:0,startDate:"",endDate:"",startTime:"",endTime:""};var V,W,k,Y,K;!function(e){e[e.IDLE=0]="IDLE",e[e.CREATE_PRODUCT=1]="CREATE_PRODUCT",e[e.MODIFY_PRODUCT=2]="MODIFY_PRODUCT",e[e.CREATE_BATCH=3]="CREATE_BATCH",e[e.CREATE_QUICK_TEST=4]="CREATE_QUICK_TEST",e[e.PERFORM_TEST=5]="PERFORM_TEST",e[e.RESULT_FINISHED_PROCESS=6]="RESULT_FINISHED_PROCESS",e[e.RESULT_LOADED_FINISHED_PROCESS=7]="RESULT_LOADED_FINISHED_PROCESS",e[e.RESULT_ACTIVE_BATCH=8]="RESULT_ACTIVE_BATCH",e[e.RESULT_ACTIVE_BATCH_TIMERANGE=9]="RESULT_ACTIVE_BATCH_TIMERANGE",
e[e.RESULT_ACTIVE_BATCH_SHIFT=10]="RESULT_ACTIVE_BATCH_SHIFT",e[e.RESULT_FINISHED_BATCH=11]="RESULT_FINISHED_BATCH"}(V||(V={})),function(e){e[e.IDLE=0]="IDLE",e[e.WAIT_CLEAR_PAN=1]="WAIT_CLEAR_PAN",e[e.WAIT_PLACE_TARE_CONTAINER=2]="WAIT_PLACE_TARE_CONTAINER",e[e.WAIT_ACQUISITION_TRIGGER=3]="WAIT_ACQUISITION_TRIGGER",e[e.WAIT_STABILITY_FOR_CLEARING_PAN=4]="WAIT_STABILITY_FOR_CLEARING_PAN",e[e.WAIT_DSD=5]="WAIT_DSD",e[e.GOT_DSD=6]="GOT_DSD"}(W||(W={})),function(e){e[e.PRODUCTS_IMPORT=0]="PRODUCTS_IMPORT",e[e.IMPORT_LIST_FILES=1]="IMPORT_LIST_FILES",e[e.IMPORT_DO_TRANSFER=2]="IMPORT_DO_TRANSFER",e[e.PRODUCTS_EXPORT=3]="PRODUCTS_EXPORT",e[e.EXPORT_DO_TRANSFER=4]="EXPORT_DO_TRANSFER"}(k||(k={})),function(e){e[e.SHOW_DATES=0]="SHOW_DATES",e[e.SHOW_TIMES=1]="SHOW_TIMES"}(Y||(Y={})),function(e){e[e.ENTER_FREE_TIMES=0]="ENTER_FREE_TIMES",e[e.SELECT_PROCESS_TIMESTAMP=1]="SELECT_PROCESS_TIMESTAMP",e[e.SELECT_START_PROCESS_TIMESTAMP=2]="SELECT_START_PROCESS_TIMESTAMP",
e[e.SELECT_END_PROCESS_TIMESTAMP=3]="SELECT_END_PROCESS_TIMESTAMP"}(K||(K={}));let q="";function j(){A.fs.existsSync(i.STORAGE_LOCATION_BASE)||A.fs.mkdirSync(i.STORAGE_LOCATION_BASE);let e=A.path.join(i.STORAGE_LOCATION_BASE,I.QAPP_ID);A.fs.existsSync(e)||A.fs.mkdirSync(e),q=e,console.log("Directories initiated")}t.initDirectories=j;class X extends p.wfRunner{constructor(){super(!0),this.dbConnection=void 0,this.dbMigrationResult=C.createTabletCheckerDbMigration(),this.config=I.createConfig(),this.products={},this.batchesOverview={},this.processesOverview={},this.timeSortedProcessIDs={},this.processBufferDeleteCount=5,this.processes={},this.product=I.createProduct(),this.batch=I.createBatch(),this.batchStatisticsCollector=I.createBatch(),this.process=I.createProcess(),this.currentGross=D.createQuantity(),this.workflowState=V.CREATE_PRODUCT,this.weighingState=W.IDLE,this.dataTransferState=k.PRODUCTS_EXPORT,this.dateOrTimeSelection=Y.SHOW_DATES,
this.dateTimeSelectionType=K.ENTER_FREE_TIMES,this.dataTransferProgressTopic="",this.dataTransferSelectedConnector="",this.dataTransferTransferFilename="",this.dataTransferCacheFilePath="",this.dataTransferImportDbProducts=[],this.weighingWaitingTimeout=0,this.lastSelectedWeightApplication=u.ISelectedWeightDisplayValueDomains.SELECTED_DOMAIN_APP,this.currentSampleIDindex=0,this.currentStartIndexOfDisplayedListButtons=0,this.selectableListButtons={},this.selectableArrayButtonIDs=[],this.selectedTimeRangeForResults=T.cloneJSON(w),this.searchStringProduct="",this.searchStringBatch="",this.searchStringTimestamp="",this.emptyCapsuleWeightBuffer=[],this.emptyCapsWgtSequence=0,this.emptyCapsWgtSets=[{displayText:"10",capsuleCount:10,measured:D.createQuantity(),done:!1},{displayText:"10",capsuleCount:20,measured:D.createQuantity(),done:!1},{displayText:"30",capsuleCount:50,measured:D.createQuantity(),done:!1}],
this.tabScreenParametersEmptyCapsWgtSets=[new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_capsRefPcs10")),new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_capsRefPcs20")),new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_capsRefPcs50"))],this.fsmTimers={},this.globalSubscribeParameters={averageEmptyCapsule:new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_averageEmptyCapsule")),averageVessel:new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_averageVessel")),countTotal:new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_countTotal")),countOop:new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_countOop")),countTargetNumber:new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_countTargetNumber")),
emptyCapsuleWeight:new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_emptyCapsuleWeight")),mean:new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_mean")),stdDev:new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_stdDev")),varCoeff:new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_varCoeff")),sum:new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_sum")),minimum:new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_minimum")),maximum:new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_maximum")),range:new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_range")),diffLastTwo:new M.default(this.mqttHandler,r.createEmptyTextParameter("reservedGlobalParameters_diffLastTwo"))},this.registerAspect(new N.ConnectionAspect)}
GET_QAPP_META_DATA(){return{qappID:I.QAPP_ID,qappToken:I.QAPP_ID,stateScreenFunctions:[this.alias_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE.name,this.INITIAL_ENTRY.name,this.CHECK_FOR_DATABASE_MIGRATION.name,this.MAIN_MENU.name,this.SELECT_BATCH.name,this.ENTER_BATCH_DATA.name,this.SELECT_PRODUCT.name,this.SELECT_PROCESS_DATETIMES.name,this.ENTER_PRODUCT_DATA.name,this.BATCH_MENU.name,this.INITIALIZE_PROCESS.name,this.ENTER_PROCESS_DATA.name,this.INITIALIZE_MAIN_MEASUREMENT.name,this.FINALIZE_PROCESS.name,this.PROCESS_SAMPLE_WEIGHING.name,this.PROCESS_EMPTY_CAPS_WEIGHING_MEAN.name,this.PROCESS_EMPTY_CAPS_WEIGHING_10_10_30.name,this.PERFORM_PRODUCT_EXPORT.name,this.PERFORM_PRODUCT_IMPORT.name,this.SHOW_PROCESS_RESULT.name,this.SHOW_BATCH_RESULT.name,this.SELECT_SHIFT.name,this.ENTER_TIME_RANGE.name],initialStateFunction:this.alias_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE.name}}get currentSample(){
return g.isObject(this.process.samples[this.process.currSmplIndex])?this.process.samples[this.process.currSmplIndex]:I.createSample()}get lastProcessedSample(){for(let e=this.process.samples.length-1;e>=0;e--)if(this.process.samples[e].evaluation!==I.EnumSampleResultStatus.PENDING)return this.process.samples[e]}get alreadyProcessedSamplesCount(){let e=0;for(let t of this.process.samples)e+=t.evaluation!==I.EnumSampleResultStatus.PENDING?1:0;return e}_____________________SCREENS__________________(){}postInit(){super.postInit(),this.config=I.createConfig(A.loadTaskConfig_DATA_CONTAINER(this.taskHandler)),j(),this.dataTransferCacheFilePath=A.path.join(q,"transfer.cache"),this.aspects[S.CONNECTION_ASPECT].configure({nextState:this.INITIAL_ENTRY(),cancelState:this.INITIAL_ENTRY(),workflow:!0,qappEntities:[b.ProductEntity,f.BatchEntity,B.ProcessEntity],checkMigration:function(e){return a.__awaiter(this,void 0,void 0,function*(){return{result:S.EMigrationResult.MIGRATION_NOT_NEEDED,logStr:""}
})},doMigration:function(){return a.__awaiter(this,void 0,void 0,function*(){return{result:S.EMigrationResult.MIGRATION_NOT_NEEDED,logStr:""}})},taskHandler:this.taskHandler,qappSpecificSqliteDatabaseLocation:!0,useLogTable:!1,syncByTypeorm:!1}),this.mqttHandler.subscribe(P.MqttTopics.WEIGHING_WAITING_FOR_STABILITY),this.mqttHandler.subscribe(P.MqttTopics.WEIGHING_VALUE_GROSS),this.triggerTabletFeeder(!1),this.postInit_createWeighingSplitScreenTabs(),this.postInit_createTabScreenTabs(),this.report_clearPrintQueue(),
this.preloadTextBuffer(["_QAPP_WF_PRODUCT_ID_TITLE","_QAPP_WF_PRODUCT_ID_HEADER","_QAPP_WF_PRODUCT_TYPE_TITLE","_QAPP_WF_PRODUCT_TYPE_HEADER","_QAPP_CFG_TEST_MODE_TITLE","_QAPP_CFG_TEST_MODE_HEADER","_QAPP_WF_NO_SAMPLES_TITLE","_QAPP_WF_NO_SAMPLES_HEADER","_QAPP_WF_NOMINAL_TITLE","_QAPP_WF_NOMINAL_HEADER","_QAPP_WF_MIN_TOL_TITLE","_QAPP_WF_TOL_HEADER","_QAPP_WF_MAX_TOL_TITLE","_QAPP_LIB_REPORTING_CATERGORY_INIT","_QAPP002_PRINTLABEL_QUICKTEST_REPORT_HEADER","_QAPP_LIB_PARAM_TITLE_SAMPLE_NO","_QAPP_LIB_PARAM_HEADER_SAMPLE_NO","_QAPP_WF_CHECK_TITLE","_QAPP_WF_CHECK_HEADER","_QAPP_LIB_REPORTING_CATERGORY_COMPONENTS","_QAPP_WF_CNT_TOTAL_TITLE","_QAPP_WF_CNT_TOTAL_HEADER","_QAPP_WF_CNT_PLAUS_TITLE","_QAPP_WF_CNT_PLAUS_HEADER","_QAPP_WF_CNT_STOL_TITLE","_QAPP_WF_CNT_STOL_HEADER","_QAPP_WF_CNT_OK_TITLE","_QAPP_WF_CNT_OK_HEADER","_QAPP_WF_CNT_GTOL_TITLE","_QAPP_WF_CNT_GTOL_HEADER","_QAPP_LIB_REPORTING_CATERGORY_RESULT","_QAPP_WF_PARAM_CAPSULE_TITLE","_QAPP_WF_PARAM_CAPSULE_HEADER","_QAPP_LIB_PARAM_TITLE_STAT_NUMSAM","_QAPP_LIB_PARAM_HEADER_STAT_NUMSAM","_QAPP_LIB_PARAM_TITLE_STAT_AVG","_QAPP_LIB_PARAM_HEADER_STAT_AVG","_QAPP_LIB_PARAM_TITLE_STAT_DEV","_QAPP_LIB_PARAM_HEADER_STAT_DEV","_QAPP_LIB_PARAM_TITLE_STAT_VAR","_QAPP_LIB_PARAM_HEADER_STAT_VAR","_QAPP_LIB_PARAM_TITLE_STAT_SUM","_QAPP_LIB_PARAM_HEADER_STAT_SUM","_QAPP_LIB_PARAM_TITLE_STAT_MIN","_QAPP_LIB_PARAM_HEADER_STAT_MIN","_QAPP_LIB_PARAM_TITLE_STAT_MAX","_QAPP_LIB_PARAM_HEADER_STAT_MAX","_QAPP_LIB_PARAM_TITLE_STAT_DIFF","_QAPP_LIB_PARAM_HEADER_STAT_DIFF","_QAPP_LIB_REPORTING_CATERGORY_STATISTIC","_QAPP002_PARAM_TITLE_COUNT_TESTS_OF_LOT","_QAPP002_PARAM_HEADER_COUNT_TESTS_OF_LOT","_QAPP002_PARAM_TITLE_TEST_RESULT","_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MIN_2_LABEL","_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MIN_1_LABEL","_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_OK_LABEL","_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MAX_1_LABEL","_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MAX_2_LABEL","_QAPP_LIB_CHART_OCCURENCES_LABEL","_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_OOP_LABEL"])
}postInit_createWeighingSplitScreenTabs(){this.weighingSplitScreen.getTabApi().clearTabList(),this.weighingSplitscreenTabInfoImage=this.weighingSplitScreen.getTabApi().addFigureTab("TAB_WEIGHING_SPLITSCREEN_INFO_IMAGE",{id:"TAB_WEIGHING_SPLITSCREEN_INFO_IMAGE",appearance:L.EnumAppearance.HIDDEN,type:_.EnumTabType.TAB_FIGURE,containerTitle:r.createEmptyTextStructure(),title:r.createEmptyTextStructure(),topbuttons:[],imgref:{id:U}}),this.weighingSplitscreenTabCounterChart=this.weighingSplitScreen.getTabApi().addGraphTab("TAB_WEIGHING_SPLITSCREEN_COUNTER_BARCHART",{id:"TAB_WEIGHING_SPLITSCREEN_COUNTER_BARCHART",appearance:L.EnumAppearance.HIDDEN,type:_.EnumTabType.TAB_GRAPH,containerTitle:r.createEmptyTextStructure(),title:{id:"",args:[]},topbuttons:[],data:this.getCounterChartData(100,this.process.counters)}),this.weighingSplitscreenTabCounterOverview=this.weighingSplitScreen.getTabApi().addParamListTab("TAB_WEIGHING_SPLITSCREEN_COUNTER_OVERVIEW",{
id:"TAB_WEIGHING_SPLITSCREEN_COUNTER_OVERVIEW",appearance:L.EnumAppearance.HIDDEN,type:_.EnumTabType.TAB_PARAMLIST,displayHeader:!0,topbuttons:[],containerTitle:r.createEmptyTextStructure(),title:{id:p.l("_QAPP002_PRINTLABEL_STATISTIC_COUNTER"),args:[]},paramType:_.TAB_PARAMLIST_TYPE_TOPIC,params:[this.globalSubscribeParameters.countTotal.getPublishedId(),this.globalSubscribeParameters.countOop.getPublishedId()]}),this.weighingSplitscreenTabStatistics=this.weighingSplitScreen.getTabApi().addParamListTab("TAB_WEIGHING_SPLITSCREEN_STATISTICS",{id:"TAB_WEIGHING_SPLITSCREEN_STATISTICS",appearance:L.EnumAppearance.HIDDEN,type:_.EnumTabType.TAB_PARAMLIST,displayHeader:!0,topbuttons:[],containerTitle:r.createEmptyTextStructure(),title:{id:p.l("_QAPP_LIB_REPORTING_CATERGORY_STATISTIC"),args:[]},paramType:_.TAB_PARAMLIST_TYPE_TOPIC,
params:[this.globalSubscribeParameters.averageEmptyCapsule.getPublishedId(),this.globalSubscribeParameters.averageVessel.getPublishedId(),this.globalSubscribeParameters.countTargetNumber.getPublishedId(),this.globalSubscribeParameters.emptyCapsuleWeight.getPublishedId(),this.globalSubscribeParameters.countTotal.getPublishedId(),this.globalSubscribeParameters.mean.getPublishedId(),this.globalSubscribeParameters.stdDev.getPublishedId(),this.globalSubscribeParameters.varCoeff.getPublishedId(),this.globalSubscribeParameters.sum.getPublishedId(),this.globalSubscribeParameters.minimum.getPublishedId(),this.globalSubscribeParameters.maximum.getPublishedId(),this.globalSubscribeParameters.range.getPublishedId()]}),this.weighingSplitscreenTabCapsDetermination10_10_30=this.weighingSplitScreen.getTabApi().addParamListTab("TAB_WEIGHING_SPLITSCREEN_CAPSULE_DETERMINATION_10_10_30",{id:"TAB_WEIGHING_SPLITSCREEN_CAPSULE_DETERMINATION_10_10_30",appearance:L.EnumAppearance.HIDDEN,
type:_.EnumTabType.TAB_PARAMLIST,displayHeader:!0,topbuttons:[],containerTitle:r.createEmptyTextStructure(),title:{id:"",args:[]},paramType:_.TAB_PARAMLIST_TYPE_TOPIC,params:[this.tabScreenParametersEmptyCapsWgtSets[0].getPublishedId(),this.tabScreenParametersEmptyCapsWgtSets[1].getPublishedId(),this.tabScreenParametersEmptyCapsWgtSets[2].getPublishedId()]}),this.weighingSplitScreen.getTabApi().publishTabList()}postInit_createTabScreenTabs(){this.tabScreenTabLastSample={id:"TAB_TABSCREEN_EVALUATION_LAST_SAMPLE",appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_PARAMLIST,displayHeader:!0,topbuttons:[],title:r.createEmptyTextStructure(),containerTitle:{id:p.l("_QAPP_WF_EVALUTATION_SAMPLE_TITLE"),args:[]},paramType:_.TAB_PARAMLIST_TYPE_TOPIC,params:[new M.default(this.mqttHandler,r.createEmptyTextParameter()).getPublishedId()]},this.tabScreenTabCounterChart={id:"TAB_TABSCREEN_COUNTER_BARCHART",appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_GRAPH,containerTitle:{
id:p.l("_QAPP_WF_EVALUTATION_COUNTER_TITLE"),args:[]},title:r.createEmptyTextStructure(),topbuttons:[],data:this.getCounterChartData(40,this.process.counters)},this.tabScreenTabCounterOverview={id:"TAB_TABSCREEN_COUNTER_OVERVIEW",appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_PARAMLIST,displayHeader:!0,topbuttons:[],title:r.createEmptyTextStructure(),containerTitle:{id:p.l("_QAPP_WF_EVALUTATION_COUNTER_TITLE"),args:[]},paramType:_.TAB_PARAMLIST_TYPE_TOPIC,params:[this.globalSubscribeParameters.countTotal.getPublishedId(),this.globalSubscribeParameters.countOop.getPublishedId()]},this.tabScreenTabBatchOverview={id:"TAB_TABSCREEN_BATCH_OVERVIEW",appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_PARAMLIST,displayHeader:!0,topbuttons:[],title:r.createEmptyTextStructure(),containerTitle:{id:p.l("_QAPP_WF_LOT_STAT"),args:[]},paramType:_.TAB_PARAMLIST_TYPE_TOPIC,params:[]},this.tabScreenTabStatistics={id:"TAB_TABSCREEN_STATISTICS",appearance:L.EnumAppearance.ENABLED,
type:_.EnumTabType.TAB_PARAMLIST,displayHeader:!0,topbuttons:[],title:r.createEmptyTextStructure(),containerTitle:{id:p.l("_QAPP_WF_EVALUTATION_STATISTICS_TITLE"),args:[]},paramType:_.TAB_PARAMLIST_TYPE_TOPIC,params:[this.globalSubscribeParameters.averageEmptyCapsule.getPublishedId(),this.globalSubscribeParameters.averageVessel.getPublishedId(),this.globalSubscribeParameters.countTotal.getPublishedId(),this.globalSubscribeParameters.mean.getPublishedId(),this.globalSubscribeParameters.stdDev.getPublishedId(),this.globalSubscribeParameters.varCoeff.getPublishedId(),this.globalSubscribeParameters.sum.getPublishedId(),this.globalSubscribeParameters.minimum.getPublishedId(),this.globalSubscribeParameters.maximum.getPublishedId(),this.globalSubscribeParameters.range.getPublishedId()]},this.tabScreenTabDispersionChart={id:"TAB_TABSCREEN_DISPERSION_CHART",appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_GRAPH,containerTitle:{id:p.l("_QAPP_WF_EVALUTATION_STATISTICS_GRAPH_TITLE"),
args:[]},title:r.createEmptyTextStructure(),topbuttons:[],data:this.getCounterChartData(100,this.process.counters)}}handleMqttEventsGlobally(e){switch(super.handleMqttEventsGlobally(e),e.payload.topic){case P.MqttTopics.WEIGHING_VALUE_GROSS:if(e.payload&&g.isString(e.payload.topic)&&e.payload.topic===P.MqttTopics.WEIGHING_VALUE_GROSS){const t=JSON.parse(e.payload.value.toString());this.currentGross=D.createQuantity(void 0,void 0,t)}return}}alias_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE(e,t){return e||t?!e&&t&&g.isString(t)&&"GET_EVENT_LISTENER"===t?JSON.stringify([]):t&&e?"":(console.log(" ## DEBUG ## "+this.alias_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE()+": Missing argument"),""):S.STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE}INITIAL_ENTRY(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.INITIAL_ENTRY.name;if(!e&&t&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,h.SIMPLE_EVENT])
;if(!t||!e)return console.log(" ## DEBUG ## "+this.INITIAL_ENTRY()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t){p.btn.msgOk=this.createMessageButton(l.EnumFontLabels.OK);const t=this.aspects[S.CONNECTION_ASPECT].getConnection();return this.dbConnection=void 0===t?void 0:t,void 0!==this.dbConnection&&this.dbConnection.isConnected?(e.transition(this,this.CHECK_FOR_DATABASE_MIGRATION()),""):(this.showMessageBox(E.EnumMessageboxType.WARNING,p.l("_QAPP002_HEADER_DB_NOT_ACCESSIBLE"),p.l("_QAPP002_MESSAGE_DB_NOT_ACCESSIBLE"),[p.btn.msgOk]),this.hideMsgBox(),this.hideLoadingScreen(),"")}return g.isString(t)&&"onExit"===t?(this.hideMsgBox(),this.showLoadingScreen(),""):g.isObject(t)&&t.type&&t.type===n.EV_HMI_BTN_CLICKED&&t.payload.buttonId===p.btn.msgOk.getButtonId()?(this.suspend(),""):""}CHECK_FOR_DATABASE_MIGRATION(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.CHECK_FOR_DATABASE_MIGRATION.name
;if(!e&&t&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.CHECK_FOR_DATABASE_MIGRATION()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t)return p.btn.msgDbQueryFailed=this.createMessageButton(l.EnumFontLabels.OK),p.btn.msgDbMigrationDone=this.createMessageButton(l.EnumFontLabels.OK),C.databaseMigration(this,"DATABASE_MIGRATION"),"";if(g.isString(t)&&"onExit"===t)return this.hideMsgBox(),this.showLoadingScreen(),"";if(g.isObject(t)&&t.type&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.msgDbQueryFailed.getButtonId())return this.suspend(),"";if(t.payload.buttonId===p.btn.msgDbMigrationDone.getButtonId())return this.dbMigrationResult.ProductEntity.status===S.EMigrationResult.MIGRATION_NEEDED&&this.dbMigrationResult.ProductEntity.itemsToMigrate.length>0?(this.hideMsgBox(),
b.storeProduct(this,"STORE_NEW_MIGRATE_PRODUCT",this.dbMigrationResult.ProductEntity.itemsToMigrate[0]),""):(e.transition(this,this.MAIN_MENU()),"")}const s=C.parseDatabaseEvent(t);if(!0===s.isHandled){if(!0!==s.success)return C.DatabaseErrorMsg(this,s.result,[p.btn.msgDbQueryFailed]),"";switch(s.context){case"DATABASE_MIGRATION":{this.dbMigrationResult=s.result;let t=!0,a="";switch(this.dbMigrationResult.ProductEntity.status){case S.EMigrationResult.MIGRATION_DONE:case S.EMigrationResult.MIGRATION_NEEDED:a+="<br>- "+this.dbMigrationResult.ProductEntity.message;break;case S.EMigrationResult.MIGRATION_FAILED:t=!1,a+="<br>- "+this.dbMigrationResult.ProductEntity.message}switch(this.dbMigrationResult.BatchEntity.status){case S.EMigrationResult.MIGRATION_DONE:a+="<br>- "+this.dbMigrationResult.BatchEntity.message;break;case S.EMigrationResult.MIGRATION_FAILED:t=!1,a+="<br>- "+this.dbMigrationResult.BatchEntity.message}switch(this.dbMigrationResult.ProcessEntity.status){
case S.EMigrationResult.MIGRATION_DONE:a+="<br>- "+this.dbMigrationResult.ProcessEntity.message;break;case S.EMigrationResult.MIGRATION_FAILED:t=!1,a+="<br>- "+this.dbMigrationResult.ProcessEntity.message}return a.length>0?!0===t?(this.showMessageBox(E.EnumMessageboxType.INFO,p.l("_QAPP002_HEADER_DB_MIGRATION"),p.l("_QAPP002_MESSAGE_DB_MIGRATION_SUCCESSFULL",[a]),[p.btn.msgDbMigrationDone]),""):(this.showMessageBox(E.EnumMessageboxType.WARNING,p.l("_QAPP002_HEADER_DB_MIGRATION"),p.l("_QAPP002_MESSAGE_DB_MIGRATION_FAILED",[a]),[p.btn.msgDbMigrationDone]),""):(e.transition(this,this.MAIN_MENU()),"")}case"STORE_NEW_MIGRATE_PRODUCT":return!0!==s.success?(C.DatabaseErrorMsg(this,s.result,[p.btn.msgDbQueryFailed]),this.hideLoadingScreen(),this.dbMigrationResult.ProductEntity.itemsToMigrate=[],""):(this.products[this.dbMigrationResult.ProductEntity.itemsToMigrate[0].databaseId]=this.dbMigrationResult.ProductEntity.itemsToMigrate[0],this.dbMigrationResult.ProductEntity.itemsToMigrate.shift(),
0===this.dbMigrationResult.ProductEntity.itemsToMigrate.length?(this.dbMigrationResult.ProductEntity.status=S.EMigrationResult.MIGRATION_DONE,e.transition(this,this.MAIN_MENU()),""):(b.storeProduct(this,"STORE_NEW_MIGRATE_PRODUCT",this.dbMigrationResult.ProductEntity.itemsToMigrate[0]),""))}}return""}MAIN_MENU(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.MAIN_MENU.name;if(!e&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.MAIN_MENU()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t){this.batchesOverview={},this.processesOverview={},p.btn.quickTest=this.createMenuButton(p.l("_QAPP002_QUICK_TEST"),this.config.enableQuicktest===I.EnumBoolean.ENABLED?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),
p.btn.configureProducts=this.createMenuButton(p.l("_QAPP_WF_SELECT_ACTION_OPTION_CREATE"),this.config.supervisorRoles.includes(this.USER.role_id)?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),p.btn.selectLot=this.createMenuButton(p.l("_QAPP002_SELECT_BATCH_SELECTION"),L.EnumAppearance.ENABLED);let e={id:this.IDEXTEND_SCREEN+this.MAIN_MENU.name,appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_MENU,containerTitle:{id:p.l("_QAPP002_SCREENTITLE_MAIN_MENU"),args:[]},title:r.createEmptyTextStructure(),topbuttons:[],menuType:_.TAB_MENU_TYPE_TOPIC,menubuttons:["/QAPP/"+p.btn.quickTest.getTopic(),"/QAPP/"+p.btn.configureProducts.getTopic(),"/QAPP/"+p.btn.selectLot.getTopic()],scrollToTop:!1};return this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.CANCEL,args:[]}),this.mainScreen.showTopLeftButton(),this.mainScreen.setMenuTab(e),this.showScreen(this.mainScreen),this.hideLoadingScreen(),""}if(g.isString(t)&&"onExit"===t)this.showLoadingScreen(),this.mainScreen.hide(),
this.hideMsgBox();else if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.selectLot.getButtonId())return this.workflowState=V.IDLE,e.transition(this,this.SELECT_BATCH()),"";if(t.payload.buttonId===p.btn.configureProducts.getButtonId())return this.workflowState=V.MODIFY_PRODUCT,e.transition(this,this.SELECT_PRODUCT()),"";if(t.payload.buttonId===p.btn.quickTest.getButtonId())return this.workflowState=V.CREATE_QUICK_TEST,this.product=I.createProduct(),this.batch=I.createBatch(void 0,this.product),this.batch.timeStart=O.getDateTime("isoTimezone"),this.batch.lotIDs=T.cloneJSON(this.config.lotIDs),this.batch.lotId=p.l("_QAPP002_QUICK_TEST",!0),e.transition(this,this.SELECT_PRODUCT()),"";if(t.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID)return this.suspend(),"";if(t.payload.buttonId===p.btn.msgDbQueryFailed.getButtonId())return this.hideMsgBox(),""}return""}SELECT_PRODUCT(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.SELECT_PRODUCT.name
;if(!e&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.SELECT_PRODUCT()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t)return this.currentStartIndexOfDisplayedListButtons=0,p.btn.nextListBlock=this.createMenuButton("+"+x.toFixed(0),L.EnumAppearance.ENABLED),p.btn.previousListBlock=this.createMenuButton("-"+x.toFixed(0),L.EnumAppearance.ENABLED),p.btn.newProduct=this.createMenuButton(l.EnumFontLabels.ADD),p.btn.transferProducts=this.createMenuButton(p.l("_QAPP002_BUTTON_TRANSFER"),L.EnumAppearance.ENABLED),p.btn.quickTestFreeInput=this.createMenuButton(p.l("_QAPP002_BUTTON_FREE_INPUT"),L.EnumAppearance.HIDDEN),p.btn.searchProducts=this.createMenuButton(""===this.searchStringProduct?l.EnumFontLabels.SEARCH:l.EnumFontLabels.SEARCH_ACTIVE),p.btn.transferProductsCancel=this.createMessageButton(l.EnumFontLabels.BACK),
p.btn.msgImport=this.createMessageButton(p.l("_QAPP002_BUTTON_TRANSFER_IMPORT")),p.btn.msgExport=this.createMessageButton(p.l("_QAPP002_BUTTON_TRANSFER_EXPORT")),p.btn.msgDbQueryFailed=this.createMessageButton(l.EnumFontLabels.OK),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),b.loadProductList(this,"LOAD_PRODUCT_LIST"),"";if(g.isString(t)&&"onExit"===t)return this.searchStringProduct="",this.showLoadingScreen(),this.mainScreen.hide(),this.hideMsgBox(),"";if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.newProduct.getButtonId())return this.product=I.createProduct(),this.workflowState=V.CREATE_PRODUCT,e.transition(this,this.ENTER_PRODUCT_DATA()),"";if(t.payload.buttonId===p.btn.quickTestFreeInput.getButtonId()){const t=" ("+p.l("_QAPP002_QUICK_TEST",!0)+")"
;return this.product.productId=0===this.product.productId.length?p.l("_QAPP002_QUICK_TEST",!0):this.product.productId,this.product.productId=this.product.productId.includes(p.l("_QAPP002_QUICK_TEST",!0))?this.product.productId:this.product.productId+t,e.transition(this,this.ENTER_PRODUCT_DATA()),""}if(t.payload.buttonId===p.btn.searchProducts.getButtonId())return this.openInputText("SELECT_PRODUCT_SEARCH_PRODUCT",p.l("_QAPP_LIB_SEARCH_PARAM_HEADER"),this.searchStringProduct),"";if(this.selectableListButtons.hasOwnProperty(t.payload.buttonId))return this.workflowState===V.CREATE_PRODUCT&&(this.workflowState=V.MODIFY_PRODUCT),b.loadProduct(this,"LOAD_PRODUCT",this.selectableListButtons[t.payload.buttonId].metadata),"";if(t.payload.buttonId===p.btn.transferProducts.getButtonId())return this.showMessageBox(E.EnumMessageboxType.QUESTION,p.l("_QAPP002_HEADER_IM_EXPORT_PRODUCTS"),p.l("_QAPP002_MESSAGE_IM_EXPORT_PRODUCTS"),[p.btn.transferProductsCancel,p.btn.msgExport,p.btn.msgImport]),""
;if(t.payload.buttonId===p.btn.transferProductsCancel.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId===p.btn.msgExport.getButtonId())return this.dataTransferState=k.PRODUCTS_EXPORT,e.transition(this,this.PERFORM_PRODUCT_EXPORT()),"";if(t.payload.buttonId===p.btn.msgImport.getButtonId())return this.dataTransferState=k.PRODUCTS_IMPORT,e.transition(this,this.PERFORM_PRODUCT_IMPORT()),"";if(t.payload.buttonId===p.btn.msgDbQueryFailed.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId===p.btn.nextListBlock.getButtonId())return this.rejectFastButtonPressSetNextDuration(0),this.currentStartIndexOfDisplayedListButtons+=x,this.SELECT_PRODUCT_updateScreen(),"";if(t.payload.buttonId===p.btn.previousListBlock.getButtonId())return this.rejectFastButtonPressSetNextDuration(0),this.currentStartIndexOfDisplayedListButtons=Math.max(0,this.currentStartIndexOfDisplayedListButtons-x),this.SELECT_PRODUCT_updateScreen(),""
;if(t.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID)switch(this.workflowState){case V.CREATE_BATCH:case V.CREATE_QUICK_TEST:return e.transition(this,this.ENTER_BATCH_DATA()),"";default:return e.transition(this,this.MAIN_MENU()),""}}const s=this.parseParamInput(t);if(!0===s.isHandled)return!0===s.isValid&&"SELECT_PRODUCT_SEARCH_PRODUCT"===s.id&&(this.searchStringProduct=s.rString,p.btn.searchProducts.setLabel({id:""===this.searchStringProduct?l.EnumFontLabels.SEARCH:l.EnumFontLabels.SEARCH_ACTIVE,args:[]},!0),this.SELECT_PRODUCT_updateSelectionButtons(),this.SELECT_PRODUCT_updateScreen()),this.hideInput(),"";const a=C.parseDatabaseEvent(t);if(!0===a.isHandled){if(!0!==a.success)return C.DatabaseErrorMsg(this,a.result,[p.btn.msgDbQueryFailed]),"";switch(a.context){case"LOAD_PRODUCT_LIST":return this.SELECT_PRODUCT_updateSelectionButtons(),this.SELECT_PRODUCT_updateScreen(),"";case"LOAD_PRODUCT":switch(this.workflowState){case V.MODIFY_PRODUCT:return I.verifyProduct(this.product,!1),
f.loadBatchList(this,"LOAD_BATCH_LIST_FOR_PRODUCT_MODIFICATION"),"";case V.CREATE_QUICK_TEST:case V.CREATE_BATCH:return this.batch.product=T.cloneJSON(this.product),e.transition(this,this.ENTER_BATCH_DATA()),""}break;case"LOAD_BATCH_LIST_FOR_PRODUCT_MODIFICATION":return e.transition(this,this.ENTER_PRODUCT_DATA()),""}}return""}SELECT_PRODUCT_updateSelectionButtons(){this.selectableListButtons={},this.selectableArrayButtonIDs=[],this.currentStartIndexOfDisplayedListButtons=0;const e=A.sortKeys(this.products);for(let t=0;t<e.length;t++)if(0===this.searchStringProduct.length||this.products[e[t]].productId.toLowerCase().includes(this.searchStringProduct.toLowerCase())){const s=this.createMenuButton(this.products[e[t]].productId,L.EnumAppearance.ENABLED,!1);if(!1===this.products[e[t]].validDataset){if(s.setLabelCenter({id:p.l("_QAPP002_PARAMVAL_INFO_INVALID"),args:[]}),this.workflowState===V.CREATE_QUICK_TEST||this.workflowState===V.CREATE_BATCH)continue
}else this.workflowState!==V.CREATE_QUICK_TEST&&this.workflowState!==V.CREATE_BATCH||this.batch.product.databaseId===this.products[e[t]].databaseId&&s.setAppearance(L.EnumAppearance.ENABLED_PRIMARY);this.selectableListButtons[s.getButtonId()]={button:s,metadata:e[t]},this.selectableArrayButtonIDs.push(s.getButtonId())}}SELECT_PRODUCT_updateScreen(){let e=[];for(let t=this.currentStartIndexOfDisplayedListButtons;t<Math.min(this.currentStartIndexOfDisplayedListButtons+x,this.selectableArrayButtonIDs.length);t++)this.selectableListButtons.hasOwnProperty(this.selectableArrayButtonIDs[t])&&e.push(this.selectableListButtons[this.selectableArrayButtonIDs[t]].button.getJson());const t={id:this.IDEXTEND_SCREEN+this.SELECT_PRODUCT.name,appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_MENU,containerTitle:{id:p.l("_QAPP002_SCREENTITLE_SELECT_PRODUCTS"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:_.TAB_MENU_TYPE_BULK,menuBulkButtons:e,scrollToTop:!1};let s=[]
;const a=Object.keys(this.products).length;switch(this.workflowState){case V.CREATE_QUICK_TEST:this.products.hasOwnProperty(this.batch.product.databaseId)?p.btn.quickTestFreeInput.setAppearance(L.EnumAppearance.ENABLED):p.btn.quickTestFreeInput.setAppearance(L.EnumAppearance.ENABLED_PRIMARY),s.push(p.btn.quickTestFreeInput);break;case V.MODIFY_PRODUCT:case V.CREATE_PRODUCT:s.push(p.btn.transferProducts),a<I.MAXIMUM_COUNT_PRODUCTS&&s.push(p.btn.newProduct)}a>0&&(this.currentStartIndexOfDisplayedListButtons>0&&s.push(p.btn.previousListBlock),this.selectableArrayButtonIDs.length>x&&this.selectableArrayButtonIDs.length>this.currentStartIndexOfDisplayedListButtons+x&&s.push(p.btn.nextListBlock),s.push(p.btn.searchProducts)),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.mainScreen.setMenuTab(t,s),this.hideLoadingScreen()}PERFORM_PRODUCT_EXPORT(e,t){
if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.PERFORM_PRODUCT_EXPORT.name;if(!e&&t&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,c.EV_MQTT_UPDATE,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.PERFORM_PRODUCT_EXPORT()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t){p.btn.msgTransferSucceeded=this.createMessageButton(l.EnumFontLabels.OK),p.btn.msgTransferFailed=this.createMessageButton(l.EnumFontLabels.OK),p.btn.msgDbQueryFailed=this.createMessageButton(l.EnumFontLabels.OK),p.btn.infoSelectConnector=this.createMenuButton(p.l("_QAPP002_SCREENTITLE_SELECT_CONNECTOR"),L.EnumAppearance.DISABLED);const e=this.perform_InternalWebserviceRequest("connman",R.RestMethodsCONNECTOR_MANAGEMENT.getConfigurations,{type:"",category:"MASS_STORAGE",rConfigurations:{}}),t=JSON.parse(e.rawReturns.rConfigurations).data;let s=[];s.push("/QAPP/"+p.btn.infoSelectConnector.getTopic()),this.selectableListButtons={}
;for(let e=0;e<t.length;e++)if("INTERNAL_SD"!==t[e].configType){let a="RESERVED_BUTTONID_fileconnectorList_"+e.toFixed(0),i="";for(let s=0;s<t[e].params.length;s++)"FILETRANSFERNAME/CONFIGURATION/NAME"===t[e].params[s].id&&(i=t[e].params[s].value.string);p.btn[a]=this.createMenuButton(i),s.push("/QAPP/"+p.btn[a].getTopic()),this.selectableListButtons[p.btn[a].getButtonId()]={button:p.btn[a],metadata:t[e]._id}}let a={id:this.IDEXTEND_SCREEN+this.PERFORM_PRODUCT_EXPORT.name,appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_MENU,containerTitle:{id:p.l("_QAPP002_SCREENTITLE_EXPORT_FILE"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:_.TAB_MENU_TYPE_TOPIC,menubuttons:s,scrollToTop:!1};this.mainScreen.setMenuTab(a,[]),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else if(g.isString(t)&&"onExit"===t)this.showLoadingScreen(),
this.hideMsgBox();else if(g.isObject(t)&&t.type&&t.type===n.EV_HMI_BTN_CLICKED)if(this.selectableListButtons.hasOwnProperty(t.payload.buttonId)){if(this.dataTransferState===k.PRODUCTS_EXPORT)return this.dataTransferSelectedConnector=this.selectableListButtons[t.payload.buttonId].metadata,b.loadAllProducts(this,"LOAD_ALL_PRODUCTS"),""}else t.payload.buttonId===p.btn.msgTransferSucceeded.getButtonId()?e.transition(this,this.SELECT_PRODUCT()):t.payload.buttonId===p.btn.msgTransferFailed.getButtonId()?this.hideMsgBox():t.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID?e.transition(this,this.SELECT_PRODUCT()):t.payload.buttonId===p.btn.msgDbQueryFailed.getButtonId()&&this.hideMsgBox();else if(g.isObject(t)&&t.type&&t.type===c.EV_MQTT_UPDATE&&t.payload.topic===this.dataTransferProgressTopic){let e=JSON.parse(t.payload.value.toString())
;g.isObject(e)&&g.isString(e.state)&&("SUCCESS"===e.state?(this.showMessageBox(E.EnumMessageboxType.INFO,p.l("_QAPP002_HEADER_TRANSFER_SUCCESS"),p.l("_QAPP002_MESSAGE_TRANSFER_SUCCESS",[this.dataTransferTransferFilename]),[p.btn.msgTransferSucceeded]),this.hideLoadingScreen(),A.fs.unlinkSync(this.dataTransferCacheFilePath)):"FAILURE"===e.state&&(this.dataTransferState=k.PRODUCTS_EXPORT,this.showMessageBox(E.EnumMessageboxType.WARNING,p.l("_QAPP002_HEADER_TRANSFER_FAIL"),p.l("_QAPP002_MESSAGE_TRANSFER_FAIL",[this.dataTransferTransferFilename,e.resultInfo]),[p.btn.msgTransferFailed]),this.hideLoadingScreen()))}const s=C.parseDatabaseEvent(t);if(!0===s.isHandled){if(!0!==s.success)return C.DatabaseErrorMsg(this,s.result,[p.btn.msgDbQueryFailed]),"";switch(s.context){case"LOAD_ALL_PRODUCTS":{this.showLoadingScreen({id:p.l("_QAPP002_LOADING_SCREEN_DATA_TRANSFER"),args:[]}),A.fs.writeFileSync(this.dataTransferCacheFilePath,JSON.stringify(this.products)),
this.dataTransferTransferFilename=O.getDateTime("frmt","yyyymmdd_HHMMss")+"."+I.QAPP_ID+".products"+I.OBJECT_STYLE_VERSION_PRODUCTS;let e=this.perform_InternalWebserviceRequest("connman",R.RestMethodsCONNECTOR_MANAGEMENT.putFileAsyncWithoutMD5,{connectorIdentifier:this.dataTransferSelectedConnector,targetFilePathInConnector:this.dataTransferTransferFilename,sourceFilePathOnFileSystem:this.dataTransferCacheFilePath,progressTopic:""});return e&&e.isSuccess()&&g.isObject(e.rawReturns)&&g.isString(e.rawReturns.progressTopic)?(this.dataTransferState=k.EXPORT_DO_TRANSFER,this.dataTransferProgressTopic=e.rawReturns.progressTopic,this.mqttHandler.subscribe(this.dataTransferProgressTopic)):(this.showMessageBox(E.EnumMessageboxType.WARNING,p.l("_QAPP002_HEADER_TRANSFER_FAIL"),p.l("_QAPP002_MESSAGE_TRANSFER_FAIL",[this.dataTransferTransferFilename,g.isObject(e.restResponse)?e.restResponse.error.message:"- unknown error -"]),[p.btn.msgTransferFailed]),this.hideLoadingScreen()),""}}}return""}
PERFORM_PRODUCT_IMPORT(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.PERFORM_PRODUCT_IMPORT.name;if(!e&&t&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,c.EV_MQTT_UPDATE,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.PERFORM_PRODUCT_IMPORT()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t){p.btn.msgTransferSucceeded=this.createMessageButton(l.EnumFontLabels.OK),p.btn.msgTransferFailed=this.createMessageButton(l.EnumFontLabels.OK),p.btn.msgDbQueryFailed=this.createMessageButton(l.EnumFontLabels.OK),p.btn.infoSelectConnector=this.createMenuButton(p.l("_QAPP002_SCREENTITLE_SELECT_CONNECTOR"),L.EnumAppearance.DISABLED),p.btn.infoSelectFile=this.createMenuButton(p.l("_QAPP002_SCREENTITLE_SELECT_FILE"),L.EnumAppearance.DISABLED);let e=this.perform_InternalWebserviceRequest("connman",R.RestMethodsCONNECTOR_MANAGEMENT.getConfigurations,{type:"",category:"MASS_STORAGE",rConfigurations:{}
}),t=JSON.parse(e.rawReturns.rConfigurations).data,s=[];s.push("/QAPP/"+p.btn.infoSelectConnector.getTopic()),this.selectableListButtons={};for(let e=0;e<t.length;e++)if("INTERNAL_SD"!==t[e].configType){let a="RESERVED_BUTTONID_fileconnectorList_"+e.toFixed(0),i="";for(let s=0;s<t[e].params.length;s++)"FILETRANSFERNAME/CONFIGURATION/NAME"===t[e].params[s].id&&(i=t[e].params[s].value.string);p.btn[a]=this.createMenuButton(i),s.push("/QAPP/"+p.btn[a].getTopic()),this.selectableListButtons[p.btn[a].getButtonId()]={button:p.btn[a],metadata:t[e]._id}}let a={id:this.IDEXTEND_SCREEN+this.PERFORM_PRODUCT_IMPORT.name,appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_MENU,containerTitle:{id:p.l("_QAPP002_SCREENTITLE_IMPORT_FILE"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:_.TAB_MENU_TYPE_TOPIC,menubuttons:s,scrollToTop:!1};return this.mainScreen.setMenuTab(a,[]),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),
this.showScreen(this.mainScreen),this.hideLoadingScreen(),""}if(g.isString(t)&&"onExit"===t)this.showLoadingScreen(),this.hideMsgBox();else if(g.isObject(t)&&t.type&&t.type===h.QAPP_TIMER_EVENT){if("LOADING_SCREEN_IS_OVERWHELMING"===t.payload){let e=this.perform_InternalWebserviceRequest("connman",R.RestMethodsCONNECTOR_MANAGEMENT.listDirectory,{connectorIdentifier:this.dataTransferSelectedConnector,directoryPath:"",filter:JSON.stringify({type:"DONT_CARE",regex:".*"}),sorting:JSON.stringify({type:"ALPHANUMERIC",order:"DESCENDING"}),contentList:[]});if(e&&e.isSuccess()&&g.isObject(e.rawReturns)&&g.isObject(e.rawReturns.contentList)){this.dataTransferState=k.IMPORT_LIST_FILES;let t=[];t.push("/QAPP/"+p.btn.infoSelectFile.getTopic()),this.selectableListButtons={};for(let s=0;s<e.rawReturns.contentList.length;s++)if(e.rawReturns.contentList[s].endsWith("."+I.QAPP_ID+".products"+I.OBJECT_STYLE_VERSION_PRODUCTS)){let a="RESERVED_BUTTONID_fileList_"+s.toFixed(0)
;p.btn[a]=this.createMenuButton(e.rawReturns.contentList[s]),t.push("/QAPP/"+p.btn[a].getTopic()),this.selectableListButtons[p.btn[a].getButtonId()]={button:p.btn[a],metadata:e.rawReturns.contentList[s]}}let s={id:this.IDEXTEND_SCREEN+this.PERFORM_PRODUCT_IMPORT.name+"_2",appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_MENU,containerTitle:{id:p.l("_QAPP002_SCREENTITLE_IMPORT_FILE"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:_.TAB_MENU_TYPE_TOPIC,menubuttons:t,scrollToTop:!1};this.mainScreen.setMenuTab(s,[]),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else this.showMessageBox(E.EnumMessageboxType.WARNING,p.l("_QAPP002_HEADER_TRANSFER_FAIL"),p.l("_QAPP002_MESSAGE_TRANSFER_FAIL",["<dir>","Unexpected error at listDirectory"]),[p.btn.msgTransferFailed]),this.hideLoadingScreen();return""}
}else if(g.isObject(t)&&t.type&&t.type===n.EV_HMI_BTN_CLICKED)if(this.selectableListButtons.hasOwnProperty(t.payload.buttonId)){if(this.dataTransferState===k.PRODUCTS_IMPORT)return this.dataTransferSelectedConnector=this.selectableListButtons[t.payload.buttonId].metadata,this.showLoadingScreen({id:p.l("_QAPP002_LOADING_SCREEN_DATA_TRANSFER"),args:[]}),this.cancelTimer(this.fsmTimers.LOADING_SCREEN_IS_OVERWHELMING),this.fsmTimers.LOADING_SCREEN_IS_OVERWHELMING=this.addTimer(200,"LOADING_SCREEN_IS_OVERWHELMING"),this.rejectFastButtonPressSetNextDuration(2e3),"";if(this.dataTransferState===k.IMPORT_LIST_FILES){this.dataTransferTransferFilename=this.selectableListButtons[t.payload.buttonId].metadata,this.showLoadingScreen({id:p.l("_QAPP002_LOADING_SCREEN_DATA_TRANSFER"),args:[]});let e=this.perform_InternalWebserviceRequest("connman",R.RestMethodsCONNECTOR_MANAGEMENT.getFileAsyncWithoutMD5,{connectorIdentifier:this.dataTransferSelectedConnector,
targetFileOnFilesystem:this.dataTransferCacheFilePath,sourceFilePathInConnector:this.dataTransferTransferFilename,progressTopic:""});return e&&e.isSuccess()&&g.isObject(e.rawReturns)&&g.isString(e.rawReturns.progressTopic)?(this.dataTransferState=k.IMPORT_DO_TRANSFER,this.dataTransferProgressTopic=e.rawReturns.progressTopic,this.mqttHandler.subscribe(this.dataTransferProgressTopic),""):(this.showMessageBox(E.EnumMessageboxType.WARNING,p.l("_QAPP002_HEADER_TRANSFER_FAIL"),p.l("_QAPP002_MESSAGE_TRANSFER_FAIL",[this.dataTransferTransferFilename,g.isObject(e.restResponse)?e.restResponse.error.message:"- unknown error -"]),[p.btn.msgTransferFailed]),this.hideLoadingScreen(),"")}}else{if(t.payload.buttonId===p.btn.msgTransferSucceeded.getButtonId())return e.transition(this,this.SELECT_PRODUCT()),"";if(t.payload.buttonId===p.btn.msgTransferFailed.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID)return e.transition(this,this.SELECT_PRODUCT()),""
;if(t.payload.buttonId===p.btn.msgDbQueryFailed.getButtonId())return this.hideMsgBox(),""}else if(g.isObject(t)&&t.type&&t.type===c.EV_MQTT_UPDATE&&t.payload.topic===this.dataTransferProgressTopic){let e=JSON.parse(t.payload.value.toString());if(g.isObject(e)&&g.isString(e.state)){if("SUCCESS"===e.state){let e={};this.dataTransferImportDbProducts=[];try{var s=A.fs.readFileSync(this.dataTransferCacheFilePath,"utf8");e=JSON.parse(s),A.fs.unlinkSync(this.dataTransferCacheFilePath)}catch(e){return A.fs.existsSync(this.dataTransferCacheFilePath)&&A.fs.unlinkSync(this.dataTransferCacheFilePath),this.dataTransferState=k.IMPORT_LIST_FILES,this.showMessageBox(E.EnumMessageboxType.WARNING,p.l("_QAPP002_HEADER_TRANSFER_FAIL"),p.l("_QAPP002_MESSAGE_TRANSFER_FAIL",[this.dataTransferTransferFilename,"<br>"+e]),[p.btn.msgTransferFailed]),this.hideLoadingScreen(),""}let t=Object.values(this.products),a={};for(let e of t)a[e.productId]=!0;for(let t of Object.values(e)){const e=I.createProduct(t)
;if(g.isString(e.productId)&&""!==e.productId){e.databaseId=-1;const t=e.productId;let s=2;for(;a.hasOwnProperty(e.productId);)e.productId=t+"-"+s.toFixed(0),s++;a[e.productId]=!0,I.verifyProduct(e,!1),this.dataTransferImportDbProducts.push(e)}}return I.MAXIMUM_COUNT_PRODUCTS<this.dataTransferImportDbProducts.length+t.length?(this.showMessageBox(E.EnumMessageboxType.WARNING,p.l("_QAPP002_HEADER_TRANSFER_FAIL"),p.l("_QAPP002_MESSAGE_TRANSFER_FAIL",[this.dataTransferTransferFilename,p.l("_QAPP002_MESSAGE_TRANSFER_FAIL_MAXIMUM_WOULD_EXCEED",[I.MAXIMUM_COUNT_PRODUCTS.toFixed(0),(this.dataTransferImportDbProducts.length+t.length-I.MAXIMUM_COUNT_PRODUCTS).toFixed(0)])]),[p.btn.msgTransferFailed]),this.dataTransferState=k.IMPORT_LIST_FILES,this.hideLoadingScreen(),""):this.dataTransferImportDbProducts.length>0?(b.storeProduct(this,"STORE_NEW_PRODUCT",this.dataTransferImportDbProducts[0]),""):(this.dataTransferState=k.IMPORT_LIST_FILES,
this.showMessageBox(E.EnumMessageboxType.WARNING,p.l("_QAPP002_HEADER_TRANSFER_FAIL"),p.l("_QAPP002_MESSAGE_TRANSFER_FAIL",[this.dataTransferTransferFilename,p.l("_QAPP002_MESSAGE_TRANSFER_FAIL_EMPTY_FILE",!0)]),[p.btn.msgTransferFailed]),this.dataTransferState=k.IMPORT_LIST_FILES,this.hideLoadingScreen(),"")}if("FAILURE"===e.state)return this.dataTransferState=k.IMPORT_LIST_FILES,this.showMessageBox(E.EnumMessageboxType.WARNING,p.l("_QAPP002_HEADER_TRANSFER_FAIL"),p.l("_QAPP002_MESSAGE_TRANSFER_FAIL",[this.dataTransferTransferFilename,e.resultInfo]),[p.btn.msgTransferFailed]),this.dataTransferState=k.IMPORT_LIST_FILES,this.hideLoadingScreen(),""}}const a=C.parseDatabaseEvent(t);if(!0===a.isHandled)switch(a.context){case"STORE_NEW_PRODUCT":return!0!==a.success?(this.dataTransferState=k.IMPORT_LIST_FILES,C.DatabaseErrorMsg(this,a.result,[p.btn.msgDbQueryFailed]),this.hideLoadingScreen(),this.dataTransferImportDbProducts=[],
""):(this.products[this.dataTransferImportDbProducts[0].databaseId]=this.dataTransferImportDbProducts[0],this.dataTransferImportDbProducts.shift(),0===this.dataTransferImportDbProducts.length?(this.showMessageBox(E.EnumMessageboxType.INFO,p.l("_QAPP002_HEADER_TRANSFER_SUCCESS"),p.l("_QAPP002_MESSAGE_TRANSFER_SUCCESS",[this.dataTransferTransferFilename]),[p.btn.msgTransferSucceeded]),this.hideLoadingScreen(),""):(b.storeProduct(this,"STORE_NEW_PRODUCT",this.dataTransferImportDbProducts[0]),""))}return""}ENTER_PRODUCT_DATA(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.ENTER_PRODUCT_DATA.name;if(!e&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,n.EV_HMI_PARAM_CHANGED,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.ENTER_PRODUCT_DATA()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t){p.btn.paramProductId=this.createParameterButton(p.l("_QAPP_WF_PRODUCT_ID_TITLE"),L.EnumAppearance.DISABLED),
p.btn.paramProductType=this.createParameterButton(p.l("_QAPP_WF_PRODUCT_TYPE_TITLE"),L.EnumAppearance.DISABLED),p.btn.paramProductAutoZero=this.createParameterButton(p.l("_QAPP002_PARAM_TITLE_AUTOMATIC_ZERO"),L.EnumAppearance.DISABLED),p.btn.paramProductDynTol=this.createParameterButton(p.l("_QAPP_WF_DYN_TOLERANCE_TITLE"),L.EnumAppearance.DISABLED),p.btn.paramProductCalcMode=this.createParameterButton(p.l("_QAPP_WF_CALC_MODE_TITLE"),L.EnumAppearance.DISABLED),p.btn.paramProductTestType=this.createParameterButton(p.l("_QAPP_CFG_TEST_MODE_TITLE"),L.EnumAppearance.DISABLED),p.btn.paramProductSampleCount=this.createParameterButton(p.l("_QAPP_WF_NO_SAMPLES_TITLE"),L.EnumAppearance.DISABLED),p.btn.paramProductPrefUnit=this.createParameterButton(p.l("_QAPP002_PARAM_TITLE_PREFERRED_UNIT"),L.EnumAppearance.DISABLED),p.btn.paramProductTargetWgt=this.createParameterButton(p.l("_QAPP_WF_NOMINAL_TITLE"),L.EnumAppearance.DISABLED),
p.btn.paramProductTolerance1=this.createParameterButton(p.l("_QAPP_WF_MIN_TOL_TITLE"),L.EnumAppearance.DISABLED),p.btn.paramProductTolerance2=this.createParameterButton(p.l("_QAPP_WF_MAX_TOL_TITLE"),L.EnumAppearance.DISABLED),p.btn.paramProductPlausibility=this.createParameterButton(p.l("_QAPP_WF_PLAUSIBILITY_TITLE"),L.EnumAppearance.DISABLED),p.btn.paramProductThresholdMin=this.createParameterButton(p.l("_QAPP002_PARAM_TITLE_THRESHOLD_MINIMUM"),L.EnumAppearance.DISABLED),this.ENTER_PRODUCT_DATA_updateParameterButtons(),p.btn.continueQuickTest=this.createMenuButton(l.EnumFontLabels.NEXT),p.btn.save=this.createMenuButton(l.EnumFontLabels.OK),p.btn.delete=this.createMenuButton(l.EnumFontLabels.DELETE),p.btn.infoProductInUse=this.createMenuButton(l.EnumFontLabels.INFO),p.btn.msgOk=this.createMessageButton(l.EnumFontLabels.OK),p.btn.msgDeleteYes=this.createMessageButton(p.l("_QAPP002_BUTTON_YES")),p.btn.msgDeleteNo=this.createMessageButton(p.l("_QAPP002_BUTTON_NO")),
p.btn.msgDbQueryFailed=this.createMessageButton(l.EnumFontLabels.OK);let e="",t=[];switch(this.workflowState){case V.CREATE_PRODUCT:e=p.l("_QAPP002_SCREENTITLE_CREATE_PRODUCT"),t=[p.btn.save];break;case V.MODIFY_PRODUCT:for(let e of Object.values(this.batchesOverview))if(e.product.databaseId===this.product.databaseId){t.push(p.btn.infoProductInUse);break}e=p.l("_QAPP002_SCREENTITLE_MODIFY_PRODUCT"),t.push(p.btn.delete,p.btn.save);break;case V.CREATE_QUICK_TEST:e=p.l("_QAPP002_QUICK_TEST"),t=[p.btn.continueQuickTest]}const s={id:this.IDEXTEND_SCREEN+this.ENTER_PRODUCT_DATA.name,appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_MENU,containerTitle:{id:e,args:[]},title:{id:"",args:[]},topbuttons:[],menuType:_.TAB_MENU_TYPE_TOPIC,
menubuttons:["/QAPP/"+p.btn.paramProductId.getTopic(),"/QAPP/"+p.btn.paramProductType.getTopic(),"/QAPP/"+p.btn.paramProductAutoZero.getTopic(),"/QAPP/"+p.btn.paramProductDynTol.getTopic(),"/QAPP/"+p.btn.paramProductCalcMode.getTopic(),"/QAPP/"+p.btn.paramProductTestType.getTopic(),"/QAPP/"+p.btn.paramProductSampleCount.getTopic(),"/QAPP/"+p.btn.paramProductPrefUnit.getTopic(),"/QAPP/"+p.btn.paramProductTargetWgt.getTopic(),"/QAPP/"+p.btn.paramProductTolerance1.getTopic(),"/QAPP/"+p.btn.paramProductTolerance2.getTopic(),"/QAPP/"+p.btn.paramProductPlausibility.getTopic(),"/QAPP/"+p.btn.paramProductThresholdMin.getTopic()],scrollToTop:!1};this.mainScreen.setMenuTab(s,t),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.CANCEL,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else if(g.isString(t)&&"onExit"===t)this.showLoadingScreen(),this.mainScreen.hide(),
this.hideMsgBox();else if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.save.getButtonId()||t.payload.buttonId===p.btn.continueQuickTest.getButtonId()){if(I.verifyProduct(this.product,this.workflowState===V.CREATE_QUICK_TEST),(this.workflowState===V.CREATE_PRODUCT||this.workflowState===V.CREATE_QUICK_TEST)&&""===this.product.productId)return this.showMessageBox(E.EnumMessageboxType.WARNING,{id:p.l("_QAPP002_HEADER_INVALID_PARAMETER"),args:[p.l("_QAPP_WF_PRODUCT_ID_TITLE")]},p.l("_QAPP002_MESSAGE_MANDATORY_INPUT"),[p.btn.msgOk]),"";if(0===this.product.countTarget)return this.showMessageBox(E.EnumMessageboxType.WARNING,{id:p.l("_QAPP002_HEADER_INVALID_PARAMETER"),args:[p.l("_QAPP_WF_NO_SAMPLES_TITLE")]},p.l("_QAPP002_MESSAGE_MANDATORY_INPUT"),[p.btn.msgOk]),"";if(this.product.prodWgtTarget.value<=0)return this.showMessageBox(E.EnumMessageboxType.WARNING,{id:p.l("_QAPP002_HEADER_INVALID_PARAMETER"),args:[p.l("_QAPP_WF_NOMINAL_TITLE")]
},p.l("_QAPP002_MESSAGE_MANDATORY_INPUT"),[p.btn.msgOk]),"";if(!(0<=this.product.prodTolerance1.value&&this.product.prodTolerance1.value<this.product.prodTolerance2.value&&this.product.prodTolerance2.value<=100&&this.product.prodTolerancePlausibility.value<100-this.product.prodTolerance2.value&&this.product.prodToleranceThresholdMin.value<this.product.prodTolerancePlausibility.value))return this.showMessageBox(E.EnumMessageboxType.WARNING,{id:p.l("_QAPP002_HEADER_INVALID_TOLERANCES"),args:[]},p.l("_QAPP002_MESSAGE_INVALID_TOLERANCES_PRODUCT",[p.l("_QAPP_WF_MIN_TOL_TITLE",!0),p.l("_QAPP_WF_MAX_TOL_TITLE",!0),p.l("_QAPP_WF_PLAUSIBILITY_TITLE",!0),p.l("_QAPP002_PARAM_TITLE_THRESHOLD_MINIMUM",!0)]),[p.btn.msgOk]),"";switch(this.workflowState){case V.CREATE_PRODUCT:return b.loadProductList(this,"LOAD_PRODUCTS_BEFORE_STORE_PRODUCT"),"";case V.MODIFY_PRODUCT:return b.storeProduct(this,"STORE_PRODUCT",this.product),"";case V.CREATE_QUICK_TEST:
return this.batch.product=T.cloneJSON(this.product),e.transition(this,this.ENTER_BATCH_DATA()),""}return""}if(t.payload.buttonId===p.btn.infoProductInUse.getButtonId())return this.showMessageBox(E.EnumMessageboxType.INFO,p.l("_QAPP002_HEADER_INFO_PRODUCT_IN_USE"),[{id:p.l("_QAPP002_MESSAGE_INFO_PRODUCT_IN_USE"),args:[]}],[p.btn.msgOk]),"";if(t.payload.buttonId===p.btn.msgOk.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId===p.btn.delete.getButtonId())return this.showMessageBox(E.EnumMessageboxType.QUESTION,p.l("_QAPP002_HEADER_PRODUCT_REMOVE"),[{id:p.l("_QAPP002_MESSAGE_PRODUCT_REMOVE"),args:[this.product.productId]}],[p.btn.msgDeleteNo,p.btn.msgDeleteYes]),"";if(t.payload.buttonId===p.btn.msgDeleteYes.getButtonId())return b.removeProduct(this,"DELETE_PRODUCT",this.product),this.hideMsgBox(),"";if(t.payload.buttonId===p.btn.msgDeleteNo.getButtonId())return this.hideMsgBox(),""
;if(t.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID)return e.transition(this,this.SELECT_PRODUCT()),"";if(t.payload.buttonId===p.btn.msgDbQueryFailed.getButtonId())return this.hideMsgBox(),""}const s=C.parseDatabaseEvent(t);if(!0===s.isHandled){if(!0!==s.success)return C.DatabaseErrorMsg(this,s.result,[p.btn.msgDbQueryFailed]),"";switch(s.context){case"STORE_PRODUCT":case"DELETE_PRODUCT":return e.transition(this,this.SELECT_PRODUCT()),"";case"LOAD_PRODUCTS_BEFORE_STORE_PRODUCT":if(this.workflowState===V.CREATE_PRODUCT){for(let e of Object.values(this.products))if(e.productId===this.product.productId)return this.hideLoadingScreen(),this.showMessageBox(E.EnumMessageboxType.WARNING,{id:p.l("_QAPP002_HEADER_INVALID_PARAMETER"),args:[p.l("_QAPP_WF_PRODUCT_ID_TITLE")]},p.l("_QAPP002_MESSAGE_ID_ALREADY_EXIST"),[p.btn.msgOk]),"";return b.storeProduct(this,"STORE_PRODUCT",this.product),""}}}return!0===this.ENTER_PRODUCT_DATA_handleParameters(t)&&this.ENTER_PRODUCT_DATA_updateParameterButtons(),
""}ENTER_PRODUCT_DATA_updateParameterButtons(){p.btn.paramProductId.setAppearance(this.workflowState===V.CREATE_PRODUCT||this.workflowState===V.CREATE_QUICK_TEST?L.EnumAppearance.ENABLED:L.EnumAppearance.DISABLED),p.btn.paramProductAutoZero.setAppearance([I.EnumProductType.POWDER,I.EnumProductType.TABLET].includes(this.product.prodType)?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),p.btn.paramProductCalcMode.setAppearance(this.product.dynamicTolerances===I.EnumBoolean.ENABLED?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),this.product.prodTestType===I.EnumProductTestType.PHARMACOPOEIA?(p.btn.paramProductSampleCount.setAppearance(this.workflowState===V.CREATE_QUICK_TEST?L.EnumAppearance.ENABLED:L.EnumAppearance.DISABLED),p.btn.paramProductTolerance1.setAppearance(L.EnumAppearance.DISABLED),p.btn.paramProductTolerance2.setAppearance(L.EnumAppearance.DISABLED)):(p.btn.paramProductSampleCount.setAppearance(L.EnumAppearance.ENABLED),
p.btn.paramProductTolerance1.setAppearance(L.EnumAppearance.ENABLED),p.btn.paramProductTolerance2.setAppearance(L.EnumAppearance.ENABLED)),p.btn.paramProductType.setAppearance(L.EnumAppearance.ENABLED),p.btn.paramProductDynTol.setAppearance(L.EnumAppearance.ENABLED),p.btn.paramProductTestType.setAppearance(L.EnumAppearance.ENABLED),p.btn.paramProductPrefUnit.setAppearance(L.EnumAppearance.ENABLED),p.btn.paramProductTargetWgt.setAppearance(L.EnumAppearance.ENABLED),p.btn.paramProductPlausibility.setAppearance(L.EnumAppearance.ENABLED),p.btn.paramProductThresholdMin.setAppearance(L.EnumAppearance.ENABLED),p.btn.paramProductId.setLabelRight({id:this.product.productId,args:[]}),p.btn.paramProductType.setLabelRight({id:I.EnumMapProductType[this.product.prodType],args:[]}),p.btn.paramProductAutoZero.setLabelRight({id:I.EnumMapBooleanOnOff[this.product.autoZero],args:[]}),p.btn.paramProductDynTol.setLabelRight({id:I.EnumMapBooleanYesNo[this.product.dynamicTolerances],args:[]}),
p.btn.paramProductCalcMode.setLabelRight({id:I.EnumMapCalculationMode[this.product.calculationMode],args:[]}),p.btn.paramProductTestType.setLabelRight({id:I.EnumMapProductTestType[this.product.prodTestType],args:[]}),p.btn.paramProductSampleCount.setLabelRight({id:this.product.countTarget.toFixed(0),args:[]}),p.btn.paramProductPrefUnit.setLabelRight({id:D.unitsMap[this.product.preferredUnit].mark,args:[]}),p.btn.paramProductTargetWgt.setLabelRight({id:D.formatQuantityParam(this.product.prodWgtTarget),args:[]}),p.btn.paramProductTolerance1.setLabelRight({id:"+/- "+D.formatQuantityParam(this.product.prodTolerance1),args:[]}),p.btn.paramProductTolerance2.setLabelRight({id:"+/- "+D.formatQuantityParam(this.product.prodTolerance2),args:[]}),p.btn.paramProductPlausibility.setLabelRight({id:D.formatQuantityParam(this.product.prodTolerancePlausibility),args:[]}),p.btn.paramProductThresholdMin.setLabelRight({id:D.formatQuantityParam(this.product.prodToleranceThresholdMin),args:[]})}
ENTER_PRODUCT_DATA_handleParameters(e){if(g.isObject(e)&&g.isString(e.type)&&e.type===n.EV_HMI_BTN_CLICKED){if(e.payload.buttonId===p.btn.paramProductId.getButtonId())return this.openInputText(p.btn.paramProductId.getButtonId()+"_param",p.l("_QAPP_WF_PRODUCT_ID_HEADER"),this.product.productId),!0;if(e.payload.buttonId===p.btn.paramProductType.getButtonId())return this.openInputSelection(p.btn.paramProductType.getButtonId()+"_param",p.l("_QAPP_WF_PRODUCT_TYPE_HEADER"),[{id:I.EnumProductType.TABLET,text:{id:I.EnumMapProductType[I.EnumProductType.TABLET],args:[]},appearance:L.EnumAppearance.ENABLED},{id:I.EnumProductType.CAPSULE,text:{id:I.EnumMapProductType[I.EnumProductType.CAPSULE],args:[]},appearance:L.EnumAppearance.ENABLED},{id:I.EnumProductType.POWDER,text:{id:I.EnumMapProductType[I.EnumProductType.POWDER],args:[]},appearance:L.EnumAppearance.ENABLED}],this.product.prodType),!0
;if(e.payload.buttonId===p.btn.paramProductAutoZero.getButtonId())return this.openInputSelection(p.btn.paramProductAutoZero.getButtonId()+"_param",p.l("_QAPP002_PARAM_HEADER_AUTOMATIC_ZERO"),[{id:I.EnumBoolean.ENABLED,text:{id:I.EnumMapBooleanOnOff[I.EnumBoolean.ENABLED],args:[]},appearance:L.EnumAppearance.ENABLED},{id:I.EnumBoolean.DISABLED,text:{id:I.EnumMapBooleanOnOff[I.EnumBoolean.DISABLED],args:[]},appearance:L.EnumAppearance.ENABLED}],this.product.autoZero),!0;if(e.payload.buttonId===p.btn.paramProductDynTol.getButtonId())return this.openInputSelection(p.btn.paramProductDynTol.getButtonId()+"_param",p.l("_QAPP_WF_DYN_TOLERANCE_HEADER"),[{id:I.EnumBoolean.ENABLED,text:{id:I.EnumMapBooleanYesNo[I.EnumBoolean.ENABLED],args:[]},appearance:L.EnumAppearance.ENABLED},{id:I.EnumBoolean.DISABLED,text:{id:I.EnumMapBooleanYesNo[I.EnumBoolean.DISABLED],args:[]},appearance:L.EnumAppearance.ENABLED}],this.product.dynamicTolerances),!0
;if(e.payload.buttonId===p.btn.paramProductCalcMode.getButtonId())return this.openInputSelection(p.btn.paramProductCalcMode.getButtonId()+"_param",p.l("_QAPP_WF_CALC_MODE_HEADER"),[{id:I.EnumCalculationMode.FROM_TOTAL_MEAN,text:{id:I.EnumMapCalculationMode[I.EnumCalculationMode.FROM_TOTAL_MEAN],args:[]},appearance:L.EnumAppearance.ENABLED},{id:I.EnumCalculationMode.AFTER_EACH_SAMPLE,text:{id:I.EnumMapCalculationMode[I.EnumCalculationMode.AFTER_EACH_SAMPLE],args:[]},appearance:L.EnumAppearance.ENABLED}],this.product.calculationMode),!0;if(e.payload.buttonId===p.btn.paramProductTestType.getButtonId())return this.openInputSelection(p.btn.paramProductTestType.getButtonId()+"_param",p.l("_QAPP_CFG_TEST_MODE_HEADER"),[{id:I.EnumProductTestType.PHARMACOPOEIA,text:{id:I.EnumMapProductTestType[I.EnumProductTestType.PHARMACOPOEIA],args:[]},appearance:L.EnumAppearance.ENABLED},{id:I.EnumProductTestType.USER_DEFINED,text:{id:I.EnumMapProductTestType[I.EnumProductTestType.USER_DEFINED],args:[]},
appearance:L.EnumAppearance.ENABLED}],this.product.prodTestType),!0;if(e.payload.buttonId===p.btn.paramProductSampleCount.getButtonId())return this.openInputNumber(p.btn.paramProductSampleCount.getButtonId()+"_param",p.l("_QAPP_WF_NO_SAMPLES_HEADER"),this.product.countTarget,1,200),!0;if(e.payload.buttonId===p.btn.paramProductPrefUnit.getButtonId()){let e=[];for(let t of Object.values(D.unitsMap))t.unitConversionBase===D.EnumUnitType.MASS&&e.push({id:t.id,text:{id:t.mark,args:[]},appearance:L.EnumAppearance.ENABLED});return this.openInputSelection(p.btn.paramProductPrefUnit.getButtonId()+"_param",p.l("_QAPP002_PARAM_HEADER_PREFERRED_UNIT"),e,this.product.preferredUnit),!0}if(e.payload.buttonId===p.btn.paramProductTargetWgt.getButtonId()){let e=Math.pow(10,-1*this.product.prodWgtTarget.decimals),t=void 0;return this.workflowState===V.CREATE_QUICK_TEST&&(e=10*A.getMetrology(this.product.prodWgtTarget.unit).d,t=A.getMetrology(this.product.prodWgtTarget.unit).max),
this.openInputNumber(p.btn.paramProductTargetWgt.getButtonId()+"_param",p.l("_QAPP_WF_NOMINAL_HEADER"),this.product.prodWgtTarget,e,t),!0}if(e.payload.buttonId===p.btn.paramProductTolerance1.getButtonId())return this.openInputNumber(p.btn.paramProductTolerance1.getButtonId()+"_param",p.l("_QAPP_WF_TOL_HEADER",["1"]),this.product.prodTolerance1,.01,100),!0;if(e.payload.buttonId===p.btn.paramProductTolerance2.getButtonId())return this.openInputNumber(p.btn.paramProductTolerance2.getButtonId()+"_param",p.l("_QAPP_WF_TOL_HEADER",["2"]),this.product.prodTolerance2,.01,100),!0;if(e.payload.buttonId===p.btn.paramProductPlausibility.getButtonId())return this.openInputNumber(p.btn.paramProductPlausibility.getButtonId()+"_param",p.l("_QAPP_WF_PLAUSIBILITY_HEADER"),this.product.prodTolerancePlausibility,.01,100),!0
;if(e.payload.buttonId===p.btn.paramProductThresholdMin.getButtonId())return this.openInputNumber(p.btn.paramProductThresholdMin.getButtonId()+"_param",p.l("_QAPP002_PARAM_HEADER_THRESHOLD_MINIMUM"),this.product.prodToleranceThresholdMin,.01,100),!0}const t=this.parseParamInput(e);if(t.isHandled&&t.isValid){if(this.hideInput(),t.id===p.btn.paramProductId.getButtonId()+"_param")return this.product.productId=t.rString,!0;if(t.id===p.btn.paramProductType.getButtonId()+"_param")return this.product.prodType=t.rSelectionID,I.verifyProduct(this.product,this.workflowState===V.CREATE_QUICK_TEST),!0;if(t.id===p.btn.paramProductAutoZero.getButtonId()+"_param")return this.product.autoZero=t.rSelectionID,!0;if(t.id===p.btn.paramProductDynTol.getButtonId()+"_param")return this.product.dynamicTolerances=t.rSelectionID,!0;if(t.id===p.btn.paramProductCalcMode.getButtonId()+"_param")return this.product.calculationMode=t.rSelectionID,!0
;if(t.id===p.btn.paramProductTestType.getButtonId()+"_param")return this.product.prodTestType=t.rSelectionID,I.verifyProduct(this.product,this.workflowState===V.CREATE_QUICK_TEST),!0;if(t.id===p.btn.paramProductSampleCount.getButtonId()+"_param")return this.product.countTarget=t.rFloat,!0;if(t.id===p.btn.paramProductPrefUnit.getButtonId()+"_param")return this.product.preferredUnit=t.rSelectionID,I.verifyProduct(this.product,this.workflowState===V.CREATE_QUICK_TEST),!0;if(t.id===p.btn.paramProductTargetWgt.getButtonId()+"_param")return this.product.prodWgtTarget.value=t.rFloat,I.verifyProduct(this.product,this.workflowState===V.CREATE_QUICK_TEST),!0;if(t.id===p.btn.paramProductTolerance1.getButtonId()+"_param")return this.product.prodTolerance1.value=t.rFloat,!0;if(t.id===p.btn.paramProductTolerance2.getButtonId()+"_param")return this.product.prodTolerance2.value=t.rFloat,!0
;if(t.id===p.btn.paramProductPlausibility.getButtonId()+"_param")return this.product.prodTolerancePlausibility.value=t.rFloat,!0;if(t.id===p.btn.paramProductThresholdMin.getButtonId()+"_param")return this.product.prodToleranceThresholdMin.value=t.rFloat,!0}return!1}SELECT_BATCH(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.SELECT_BATCH.name;if(!e&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.SELECT_BATCH()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t)return this.processesOverview={},this.currentStartIndexOfDisplayedListButtons=0,p.btn.nextListBlock=this.createMenuButton("+"+x.toFixed(0),L.EnumAppearance.ENABLED),p.btn.previousListBlock=this.createMenuButton("-"+x.toFixed(0),L.EnumAppearance.ENABLED),p.btn.newBatch=this.createMenuButton(l.EnumFontLabels.ADD),
p.btn.searchBatches=this.createMenuButton(""===this.searchStringBatch?l.EnumFontLabels.SEARCH:l.EnumFontLabels.SEARCH_ACTIVE),p.btn.msgOk=this.createMessageButton(l.EnumFontLabels.OK),p.btn.msgDbQueryFailed=this.createMessageButton(l.EnumFontLabels.OK),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),f.loadBatchList(this,"LOAD_BATCH_LIST"),"";if(g.isString(t)&&"onExit"===t)this.searchStringBatch="",this.showLoadingScreen(),this.mainScreen.hide(),this.hideMsgBox();else if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.newBatch.getButtonId())return b.loadProductList(this,"LOAD_PRODUCT_LIST_FOR_NEW_BATCH"),"";if(t.payload.buttonId===p.btn.searchBatches.getButtonId())return this.openInputText("SELECT_BATCH_SEARCH_BATCH",p.l("_QAPP_LIB_SEARCH_PARAM_HEADER"),this.searchStringBatch),""
;if(this.selectableListButtons.hasOwnProperty(t.payload.buttonId))return f.loadBatch(this,"LOAD_BATCH",this.selectableListButtons[t.payload.buttonId].metadata),"";if(t.payload.buttonId===p.btn.msgDbQueryFailed.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId===p.btn.msgOk.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId===p.btn.nextListBlock.getButtonId())return this.rejectFastButtonPressSetNextDuration(0),this.currentStartIndexOfDisplayedListButtons+=x,this.SELECT_BATCH_updateScreen(),"";if(t.payload.buttonId===p.btn.previousListBlock.getButtonId())return this.rejectFastButtonPressSetNextDuration(0),this.currentStartIndexOfDisplayedListButtons=Math.max(0,this.currentStartIndexOfDisplayedListButtons-x),this.SELECT_BATCH_updateScreen(),"";if(t.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID)return e.transition(this,this.MAIN_MENU()),""}const s=this.parseParamInput(t)
;if(!0===s.isHandled)return!0===s.isValid&&"SELECT_BATCH_SEARCH_BATCH"===s.id&&(this.searchStringBatch=s.rString,p.btn.searchBatches.setLabel({id:""===this.searchStringBatch?l.EnumFontLabels.SEARCH:l.EnumFontLabels.SEARCH_ACTIVE,args:[]},!0),this.SELECT_BATCH_updateSelectionButtons(),this.SELECT_BATCH_updateScreen()),this.hideInput(),"";const a=C.parseDatabaseEvent(t);if(!0===a.isHandled){if(!0!==a.success)return C.DatabaseErrorMsg(this,a.result,[p.btn.msgDbQueryFailed]),"";switch(a.context){case"LOAD_BATCH_LIST":return this.SELECT_BATCH_updateSelectionButtons(),this.SELECT_BATCH_updateScreen(),"";case"LOAD_BATCH":return this.selectedTimeRangeForResults=T.cloneJSON(w),B.loadProcessList(this,"LOAD_BATCH_PROCESSES_OVERVIEW",this.batch.databaseId),"";case"LOAD_BATCH_PROCESSES_OVERVIEW":return e.transition(this,this.BATCH_MENU()),"";case"LOAD_PRODUCT_LIST_FOR_NEW_BATCH":{let e=-1;for(let t of Object.values(this.products))if(t.validDataset){e=t.databaseId;break}
return-1===e?(this.showMessageBox(E.EnumMessageboxType.WARNING,p.l("_QAPP002_HEADER_MISSING_CONFIG"),p.l("_QAPP002_MESSAGE_MISSING_CONFIG_PRODUCT"),[p.btn.msgOk]),this.hideLoadingScreen(),""):(b.loadProduct(this,"LOAD_PRODUCT_FOR_NEW_BATCH",e),"")}case"LOAD_PRODUCT_FOR_NEW_BATCH":return this.batch=I.createBatch(void 0,this.product),this.batch.timeStart=O.getDateTime("isoTimezone"),this.batch.lotIDs=T.cloneJSON(this.config.lotIDs),this.workflowState=V.CREATE_BATCH,e.transition(this,this.ENTER_BATCH_DATA()),""}}return""}SELECT_BATCH_updateSelectionButtons(){this.selectableListButtons={},this.selectableArrayButtonIDs=[],this.currentStartIndexOfDisplayedListButtons=0;const e=A.sortKeys(this.batchesOverview);for(let t=0;t<e.length;t++)if(0===this.searchStringBatch.length||this.batchesOverview[e[t]].lotId.toLowerCase().includes(this.searchStringBatch.toLowerCase())){const s=this.createMenuButton(this.batchesOverview[e[t]].lotId,L.EnumAppearance.ENABLED,!1);s.setLabelRight({
id:p.l("_QAPP002_BUTTON_INFO_PRODUCT_OF_BATCH"),args:[this.batchesOverview[e[t]].product.productId]}),this.selectableListButtons[s.getButtonId()]={button:s,metadata:e[t]},this.selectableArrayButtonIDs.push(s.getButtonId())}}SELECT_BATCH_updateScreen(){let e=[];for(let t=this.currentStartIndexOfDisplayedListButtons;t<Math.min(this.currentStartIndexOfDisplayedListButtons+x,this.selectableArrayButtonIDs.length);t++)this.selectableListButtons.hasOwnProperty(this.selectableArrayButtonIDs[t])&&e.push(this.selectableListButtons[this.selectableArrayButtonIDs[t]].button.getJson());const t={id:this.IDEXTEND_SCREEN+this.SELECT_BATCH.name,appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_MENU,containerTitle:{id:p.l("_QAPP002_SCREENTITLE_SELECT_BATCH"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:_.TAB_MENU_TYPE_BULK,menuBulkButtons:e,scrollToTop:!1};let s=[];const a=Object.keys(this.batchesOverview).length;a<I.MAXIMUM_COUNT_BATCHES&&s.push(p.btn.newBatch),
a>0&&(this.currentStartIndexOfDisplayedListButtons>0&&s.push(p.btn.previousListBlock),this.selectableArrayButtonIDs.length>x&&this.selectableArrayButtonIDs.length>this.currentStartIndexOfDisplayedListButtons+x&&s.push(p.btn.nextListBlock)),s.push(p.btn.searchBatches),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.mainScreen.setMenuTab(t,s),this.hideLoadingScreen()}ENTER_BATCH_DATA(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.ENTER_BATCH_DATA.name;if(!e&&t&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,n.EV_HMI_PARAM_CHANGED,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.ENTER_BATCH_DATA()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t){p.btn.param_product=this.createParameterButton(p.l("_QAPP002_PARAM_TITLE_PRODUCT_ID"));let e=["/QAPP/"+p.btn.param_product.getTopic()]
;for(let t=0;t<this.batch.lotIDs.length;t++)p.btn["param_lot_id_"+t.toFixed(0)]=this.createParameterButton(this.batch.lotIDs[t].title),p.btn["param_lot_id_"+t.toFixed(0)].setLabelRight({id:this.batch.lotIDs[t].value,args:[]}),e.push("/QAPP/"+p.btn["param_lot_id_"+t.toFixed(0)].getTopic());p.btn.param_product.setLabelRight({id:this.batch.product.productId,args:[]},!0),p.btn.continue=this.createMenuButton(l.EnumFontLabels.OK),p.btn.msgOk=this.createMessageButton(l.EnumFontLabels.OK),p.btn.msgDbQueryFailed=this.createMessageButton(l.EnumFontLabels.OK);let t={id:this.IDEXTEND_SCREEN+this.ENTER_BATCH_DATA.name,appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_MENU,containerTitle:{id:this.workflowState===V.CREATE_BATCH?p.l("_QAPP002_SCREENTITLE_NEW_BATCH"):p.l("_QAPP002_QUICK_TEST"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:_.TAB_MENU_TYPE_TOPIC,menubuttons:e,scrollToTop:!1};this.mainScreen.setMenuTab(t,[p.btn.continue]),this.mainScreen.topLeftButton.setLabel({
id:l.EnumFontLabels.CANCEL,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else if(g.isString(t)&&"onExit"===t)this.showLoadingScreen(),this.hideMsgBox(),this.mainScreen.hide();else if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.param_product.getButtonId())return e.transition(this,this.SELECT_PRODUCT()),"";if(t.payload.buttonId===p.btn.msgDbQueryFailed.getButtonId())this.hideMsgBox();else{if(t.payload.buttonId===p.btn.continue.getButtonId()){if(this.workflowState===V.CREATE_BATCH){if(""===this.batch.lotId)return this.showMessageBox(E.EnumMessageboxType.WARNING,{id:p.l("_QAPP002_HEADER_INVALID_PARAMETER"),args:[this.batch.lotIDs[0].title]},p.l("_QAPP002_MESSAGE_MANDATORY_INPUT"),[p.btn.msgOk]),"";for(let e of Object.values(this.batchesOverview))if(e.lotId===this.batch.lotId)return this.showMessageBox(E.EnumMessageboxType.WARNING,{id:p.l("_QAPP002_HEADER_INVALID_PARAMETER"),
args:[p.l("_QAPP002_PARAM_TITLE_BATCH_ID")]},p.l("_QAPP002_MESSAGE_ID_ALREADY_EXIST"),[p.btn.msgOk]),""}switch(this.workflowState){case V.CREATE_BATCH:return""===this.batch.lotId?(this.showMessageBox(E.EnumMessageboxType.WARNING,{id:p.l("_QAPP002_HEADER_INVALID_PARAMETER"),args:[this.batch.lotIDs[0].title]},p.l("_QAPP002_MESSAGE_MANDATORY_INPUT"),[p.btn.msgOk]),""):(f.storeBatch(this,"STORE_NEW_BATCH",this.batch),"");case V.CREATE_QUICK_TEST:return""===this.batch.product.productId?(this.showMessageBox(E.EnumMessageboxType.WARNING,{id:p.l("_QAPP002_HEADER_INVALID_PARAMETER"),args:[p.l("_QAPP002_PARAM_TITLE_PRODUCT_ID")]},p.l("_QAPP002_MESSAGE_MANDATORY_INPUT"),[p.btn.msgOk]),""):(this.process=I.createProcess(void 0,this.batch),this.process.isQuicktest=!0,this.workflowState=V.PERFORM_TEST,e.transition(this,this.INITIALIZE_PROCESS()),"")}return""}
if(t.payload.buttonId===p.btn.msgOk.getButtonId())this.hideMsgBox();else if(t.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID)return this.workflowState===V.CREATE_QUICK_TEST?e.transition(this,this.MAIN_MENU()):e.transition(this,this.SELECT_BATCH()),""}for(let e=0;e<this.batch.lotIDs.length;e++)if(t.payload.buttonId===p.btn["param_lot_id_"+e.toFixed(0)].getButtonId())return this.openInputText(p.btn["param_lot_id_"+e.toFixed(0)].getButtonId()+"_param",this.batch.lotIDs[e].header,this.batch.lotIDs[e].value),""}const s=this.parseParamInput(t);if(s.isHandled&&s.isValid){this.hideInput();for(let e=0;e<this.batch.lotIDs.length;e++)if(s.id===p.btn["param_lot_id_"+e.toFixed(0)].getButtonId()+"_param")return this.batch.lotIDs[e].value=s.rString,p.btn["param_lot_id_"+e.toFixed(0)].setLabelRight({id:this.batch.lotIDs[e].value,args:[]}),""}const a=C.parseDatabaseEvent(t);if(!0===a.isHandled){if(!0!==a.success)return C.DatabaseErrorMsg(this,a.result,[p.btn.msgDbQueryFailed]),"";switch(a.context){
case"STORE_NEW_BATCH":return this.processesOverview={},e.transition(this,this.BATCH_MENU()),""}}return""}BATCH_MENU(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.BATCH_MENU.name;if(!e&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.BATCH_MENU()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t){this.report_clearPrintQueue(),p.btn.startNewTest=this.createMenuButton(p.l("_QAPP002_SELECT_START_TEST")),p.btn.resultLot=this.createMenuButton(p.l("_QAPP_WF_SELECT_ACTION_OPTION_FINISH_LOT_STATISTIC")),p.btn.resultShifts=this.createMenuButton(p.l("_QAPP_WF_SELECT_ACTION_OPTION_GENERATE_SHIFT_STATISTIC"),L.EnumAppearance.HIDDEN),p.btn.resultSingleTest=this.createMenuButton(p.l("_QAPP_WF_SELECT_ACTION_OPTION_RESULT"),L.EnumAppearance.DISABLED),p.btn.resultMultiTests=this.createMenuButton(p.l("_QAPP_WF_SELECT_ACTION_OPTION_MULTIPLE_RESULT_STATISTICS"),L.EnumAppearance.DISABLED),
p.btn.resultShifts.setAppearance(this.config.shifts.length>1?Object.keys(this.processesOverview).length>0?L.EnumAppearance.ENABLED:L.EnumAppearance.DISABLED:L.EnumAppearance.HIDDEN),p.btn.resultSingleTest.setAppearance(Object.keys(this.processesOverview).length>0?L.EnumAppearance.ENABLED:L.EnumAppearance.DISABLED),p.btn.resultMultiTests.setAppearance(Object.keys(this.processesOverview).length>0?L.EnumAppearance.ENABLED:L.EnumAppearance.DISABLED),p.btn.finishBatch=this.createMenuButton(l.EnumFontLabels.DELETE),p.btn.msgFinishYes=this.createMessageButton(p.l("_QAPP002_BUTTON_YES")),p.btn.msgFinishNo=this.createMessageButton(p.l("_QAPP002_BUTTON_NO")),p.btn.msgDbQueryFailed=this.createMessageButton(l.EnumFontLabels.OK);let e={id:this.IDEXTEND_SCREEN+this.BATCH_MENU.name,appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_MENU,containerTitle:{id:p.l("_QAPP002_SCREENTITLE_BATCH_MENU"),args:[this.batch.lotId]},title:{id:"",args:[]},topbuttons:[],menuType:_.TAB_MENU_TYPE_TOPIC,
menubuttons:["/QAPP/"+p.btn.startNewTest.getTopic(),"/QAPP/"+p.btn.resultLot.getTopic(),"/QAPP/"+p.btn.resultShifts.getTopic(),"/QAPP/"+p.btn.resultSingleTest.getTopic(),"/QAPP/"+p.btn.resultMultiTests.getTopic()],scrollToTop:!1},t=[];return this.config.supervisorRoles.includes(this.USER.role_id)&&t.push(p.btn.finishBatch),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.mainScreen.setMenuTab(e,t),this.showScreen(this.mainScreen),this.hideLoadingScreen(),""}if(g.isString(t)&&"onExit"===t)this.showLoadingScreen(),this.mainScreen.hide(),this.hideMsgBox();else if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.startNewTest.getButtonId())return this.process=I.createProcess(void 0,this.batch),this.process.isQuicktest=!1,this.workflowState=V.PERFORM_TEST,e.transition(this,this.INITIALIZE_PROCESS()),""
;if(t.payload.buttonId===p.btn.finishBatch.getButtonId())return this.showMessageBox(E.EnumMessageboxType.QUESTION,p.l("_QAPP_WF_MSG_BOX_DELETE_LOT_STATISTIC_TITLE"),p.l("_QAPP_WF_MSG_BOX_DELETE_LOT_STATISTIC_TEXT",[this.batch.lotId,this.batch.product.productId]),[p.btn.msgFinishYes,p.btn.msgFinishNo]),"";if(t.payload.buttonId===p.btn.msgFinishYes.getButtonId())return this.hideMsgBox(),this.workflowState=V.RESULT_FINISHED_BATCH,B.loadProcessList(this,"RELOAD_BATCH_PROCESSES_OVERVIEW",this.batch.databaseId),"";if(t.payload.buttonId===p.btn.msgFinishNo.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID)return e.transition(this,this.SELECT_BATCH()),"";if(t.payload.buttonId===p.btn.resultShifts.getButtonId())return this.workflowState=V.RESULT_ACTIVE_BATCH_SHIFT,B.loadProcessList(this,"RELOAD_BATCH_PROCESSES_OVERVIEW",this.batch.databaseId),"";if(t.payload.buttonId===p.btn.resultLot.getButtonId())return this.workflowState=V.RESULT_ACTIVE_BATCH,
B.loadProcessList(this,"RELOAD_BATCH_PROCESSES_OVERVIEW",this.batch.databaseId),"";if(t.payload.buttonId===p.btn.resultSingleTest.getButtonId())return this.workflowState=V.RESULT_LOADED_FINISHED_PROCESS,B.loadProcessList(this,"RELOAD_BATCH_PROCESSES_OVERVIEW",this.batch.databaseId),"";if(t.payload.buttonId===p.btn.resultMultiTests.getButtonId())return this.workflowState=V.RESULT_ACTIVE_BATCH_TIMERANGE,B.loadProcessList(this,"RELOAD_BATCH_PROCESSES_OVERVIEW",this.batch.databaseId),"";if(t.payload.buttonId===p.btn.msgDbQueryFailed.getButtonId())return this.hideMsgBox(),""}const s=C.parseDatabaseEvent(t);return!0===s.isHandled?(this.BATCH_MENU_handleDatabaseEvent(e,s),""):""}BATCH_MENU_handleDatabaseEvent(e,t){if(!0===t.success)switch(t.context){case"REMOVE_BATCH":{let t=[];for(let e of Object.values(this.processesOverview))t.push(e.databaseId)
;return void(Object.keys(this.processesOverview).length>0?B.removeProcesses(this,"REMOVE_ALL_PROCESSES_OF_FINISHED_BATCH",t):e.transition(this,this.SHOW_BATCH_RESULT()))}case"REMOVE_ALL_PROCESSES_OF_FINISHED_BATCH":return void e.transition(this,this.SHOW_BATCH_RESULT());case"RELOAD_BATCH_PROCESSES_OVERVIEW":switch(this.workflowState){case V.RESULT_ACTIVE_BATCH:return this.batchStatisticsCollector=T.cloneJSON(this.batch),void e.transition(this,this.SHOW_BATCH_RESULT());case V.RESULT_FINISHED_BATCH:return this.batch.timeEnd=O.getDateTime("isoTimezone"),this.batch.status=I.EnumBatchStatus.ARCHIVED,this.batchStatisticsCollector=T.cloneJSON(this.batch),void f.removeBatch(this,"REMOVE_BATCH",this.batch.databaseId);case V.RESULT_ACTIVE_BATCH_SHIFT:return void e.transition(this,this.SELECT_SHIFT());case V.RESULT_ACTIVE_BATCH_TIMERANGE:this.selectedTimeRangeForResults.start=1/0,this.selectedTimeRangeForResults.end=-1/0;for(let e of Object.values(this.processesOverview)){
const t=O.getDateTime("ms",void 0,e.timeEnd,"isoTimezone");t<this.selectedTimeRangeForResults.start&&(this.selectedTimeRangeForResults.start=t),t>this.selectedTimeRangeForResults.end&&(this.selectedTimeRangeForResults.end=t)}return this.selectedTimeRangeForResults.startDate=O.getDateTime("frmt","dd.mm.yyyy",this.selectedTimeRangeForResults.start,"ms"),this.selectedTimeRangeForResults.startTime=O.getDateTime("frmt","HH:MM",this.selectedTimeRangeForResults.start,"ms"),this.selectedTimeRangeForResults.endDate=O.getDateTime("frmt","dd.mm.yyyy",this.selectedTimeRangeForResults.end,"ms"),this.selectedTimeRangeForResults.endTime=O.getDateTime("frmt","HH:MM",this.selectedTimeRangeForResults.end,"ms"),this.dateTimeSelectionType=K.ENTER_FREE_TIMES,void e.transition(this,this.ENTER_TIME_RANGE());case V.RESULT_LOADED_FINISHED_PROCESS:return this.dateOrTimeSelection=Y.SHOW_DATES,this.searchStringTimestamp="",void e.transition(this,this.SELECT_PROCESS_DATETIMES())}
}else C.DatabaseErrorMsg(this,t.result,[p.btn.msgDbQueryFailed])}__________________PROCESS_MANAGEMENT__________________(){}INITIALIZE_PROCESS(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.INITIALIZE_PROCESS.name;if(!e&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.INITIALIZE_PROCESS()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t){this.report_clearPrintQueue(),p.btn.msgProductIncompatible=this.createMessageButton(l.EnumFontLabels.OK),p.btn.msgDbQueryFailed=this.createMessageButton(l.EnumFontLabels.OK),p.btn.msgShrinkProcBufferYes=this.createMessageButton(p.l("_QAPP_LIB_MBOX_BTN_YES")),p.btn.msgShrinkProcBufferNo=this.createMessageButton(p.l("_QAPP_LIB_MBOX_BTN_NO")),p.btn.msgShrinkProcBufferSetNumber=this.createMessageButton(p.l("_QAPP002_BUTTON_EDIT_COUNT",[this.processBufferDeleteCount.toFixed(0)]));const t=A.getMetrology(this.batch.product.preferredUnit)
;this.applyProcessProductLimits(this.batch.product.preferredUnit,t.decimals);const s=m.bignumber(this.process.appliedTolerances.minimum2.value),a=m.bignumber(this.process.appliedTolerances.maximum2.value);if(!s.greaterThanOrEqualTo(t.d)||!a.lessThanOrEqualTo(t.max)){const e={value:t.d,unit:t.unit,decimals:t.decimals},s={value:t.max,unit:t.unit,decimals:t.decimals};return this.showMessageBox(E.EnumMessageboxType.ERROR,p.l("_QAPP002_HEADER_BALANCE_NOT_SUITABLE_FOR_PRODUCT"),p.l("_QAPP002_MESSAGE_BALANCE_NOT_SUITABLE_FOR_PRODUCT_TOLERANCES",[D.formatQuantityParam(e),D.formatQuantityParam(s),D.formatQuantityParam(this.process.appliedTolerances.minimum2),D.formatQuantityParam(this.process.appliedTolerances.maximum2)]),[p.btn.msgProductIncompatible]),""}return this.weighingProxy.clearTareAll,this.process.timeStart=O.getDateTime("isoTimezone"),!1===this.process.isQuicktest?(B.loadProcessList(this,"NEW_PROCESS_LOAD_ALL_PROCESSES_OVERVIEW",this.batch.databaseId),
""):(e.transition(this,this.ENTER_PROCESS_DATA()),"")}if(g.isString(t)&&"onExit"===t)return this.showLoadingScreen(),this.hideMsgBox(),"";if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.msgProductIncompatible.getButtonId()||t.payload.buttonId===p.btn.msgDbQueryFailed.getButtonId())return!0===this.process.isQuicktest?(this.workflowState=V.CREATE_QUICK_TEST,e.transition(this,this.ENTER_BATCH_DATA()),""):(e.transition(this,this.BATCH_MENU()),"");if(t.payload.buttonId===p.btn.msgShrinkProcBufferYes.getButtonId()){this.hideMsgBox();const e=I.getSortedNumberKeys(this.timeSortedProcessIDs);let t=[];for(let s=0;s<this.processBufferDeleteCount;s++)t.push(this.timeSortedProcessIDs[e[s]]);return B.removeProcesses(this,"NEW_PROCESS_REMOVE_PROCESSES_TO_FIT_MAX_BUFFER",t),""}if(t.payload.buttonId===p.btn.msgShrinkProcBufferNo.getButtonId())return e.transition(this,this.BATCH_MENU()),""
;if(t.payload.buttonId===p.btn.msgShrinkProcBufferSetNumber.getButtonId()){const e=I.getSortedNumberKeys(this.timeSortedProcessIDs);return this.openInputNumber("SHRINK_PROCESS_BUFFER_COUNT",p.l("_QAPP002_PARAM_HEADER_PROCESSES_COUNT"),this.processBufferDeleteCount,Math.max(1,e.length-I.MAXIMUM_COUNT_PROCESSES_PER_BATCH),e.length),this.hideMsgBox(),""}this.HandleHomeOrLogoutButtons(t)}else if(g.isObject(t)&&g.isString(t.type)&&t.type===h.SIMPLE_EVENT&&"CHECK_FOR_PREVIOUS_TEST_RUN"===t.payload){if(!1===this.process.isQuicktest&&this.batch.product.prodType===I.EnumProductType.CAPSULE){const e=I.getSortedNumberKeys(this.processesOverview);if(e.length>0)return B.loadProcesses(this,"LOAD_LATEST_PREVIOUS_TEST",[e[e.length-1]]),""}return e.transition(this,this.ENTER_PROCESS_DATA()),""}const s=C.parseDatabaseEvent(t);if(!0===s.isHandled){if(!0!==s.success)return C.DatabaseErrorMsg(this,s.result,[p.btn.msgDbQueryFailed]),"";switch(s.context){case"LOAD_LATEST_PREVIOUS_TEST":{
const t=I.getSortedNumberKeys(this.processes);if(t.length>0){const e=this.processes[t[t.length-1]];this.process.emptyCapsuleWeightDetermination=e.emptyCapsuleWeightDetermination,this.process.emptyCapsuleWeight=e.emptyCapsuleWeight}return e.transition(this,this.ENTER_PROCESS_DATA()),""}case"NEW_PROCESS_LOAD_ALL_PROCESSES_OVERVIEW":{const e=I.getSortedNumberKeys(this.processesOverview);if(e.length<I.MAXIMUM_COUNT_PROCESSES_PER_BATCH)return this.addToEventQueue(new h.SimpleEvent("CHECK_FOR_PREVIOUS_TEST_RUN")),"";{this.timeSortedProcessIDs={};for(let t of e){let e=O.getDateTime("ms",void 0,this.processesOverview[t].timeEnd,"isoTimezone");for(;this.timeSortedProcessIDs.hasOwnProperty(e);)e+=1;this.timeSortedProcessIDs[e]=t}const t=I.getSortedNumberKeys(this.timeSortedProcessIDs),s=t.length-I.MAXIMUM_COUNT_PROCESSES_PER_BATCH;if(this.config.processBufferAutoDelete===I.EnumBoolean.ENABLED){let e=[];for(let a=0;a<s;a++)e.push(this.timeSortedProcessIDs[t[a]])
;return B.removeProcesses(this,"NEW_PROCESS_REMOVE_PROCESSES_TO_FIT_MAX_BUFFER",e),""}return this.processBufferDeleteCount=Math.min(t.length,5+s),this.INITIALIZE_PROCESS_showShrinkBufferConfirmation(),""}}case"NEW_PROCESS_REMOVE_PROCESSES_TO_FIT_MAX_BUFFER":return this.addToEventQueue(new h.SimpleEvent("CHECK_FOR_PREVIOUS_TEST_RUN")),""}}const a=this.parseParamInput(t);return a.isHandled&&a.isValid&&(this.hideInput(),"SHRINK_PROCESS_BUFFER_COUNT"===a.id)?(this.processBufferDeleteCount=a.rInteger,this.INITIALIZE_PROCESS_showShrinkBufferConfirmation(),""):""}INITIALIZE_PROCESS_showShrinkBufferConfirmation(){const e=I.getSortedNumberKeys(this.timeSortedProcessIDs);let t=[];for(let s=0;s<this.processBufferDeleteCount;s++){const a=this.processesOverview[this.timeSortedProcessIDs[e[s]]];t.push("- "+a.lotId+": "+O.getDateTime("frmt","dd.mm.yyyy HH:MM:ss",a.timeEnd,"isoTimezone"))}p.btn.msgShrinkProcBufferSetNumber.setLabel({
id:p.l("_QAPP002_BUTTON_EDIT_COUNT",[this.processBufferDeleteCount.toFixed(0)]),args:[]}),this.showMessageBox(E.EnumMessageboxType.QUESTION,p.l("_QAPP002_HEADER_PROCESSES_SHRINK_BUFFER"),p.l("_QAPP002_MESSAGE_PROCESSES_SHRINK_BUFFER",[I.MAXIMUM_COUNT_PROCESSES_PER_BATCH.toFixed(0),this.processBufferDeleteCount.toFixed(0),t.join("<br>")]),[p.btn.msgShrinkProcBufferYes,p.btn.msgShrinkProcBufferSetNumber,p.btn.msgShrinkProcBufferNo]),this.hideLoadingScreen()}ENTER_PROCESS_DATA(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.ENTER_PROCESS_DATA.name;if(!e&&t&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,n.EV_HMI_PARAM_CHANGED,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.ENTER_PROCESS_DATA()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t){p.btn.param_product=this.createParameterButton(p.l("_QAPP_WF_PRODUCT_ID_TITLE"),L.EnumAppearance.DISABLED),
p.btn.param_sampleCount=this.createParameterButton(p.l("_QAPP_WF_NO_SAMPLES_TITLE")),p.btn.param_emptyCapsuleDetermination=this.createParameterButton(p.l("_QAPP002_PARAM_TITLE_TARE_DETERMINATION")),p.btn.param_emptyCapsuleWeight=this.createParameterButton(p.l("_QAPP_WF_AVG_EMPTY_TITLE")),p.btn.param_product.setLabelRight({id:this.batch.product.productId,args:[]},!0),this.ENTER_PROCESS_DATA_updateButtons(),p.btn.continue=this.createMenuButton(l.EnumFontLabels.OK),p.btn.msgOk=this.createMessageButton(l.EnumFontLabels.OK),p.btn.msgDbQueryFailed=this.createMessageButton(l.EnumFontLabels.OK);let e={id:this.IDEXTEND_SCREEN+this.ENTER_BATCH_DATA.name,appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_MENU,containerTitle:{id:p.l("_QAPP_WF_TABLET_CHECK_PARAMETER_GROUP_TITLE"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:_.TAB_MENU_TYPE_TOPIC,
menubuttons:["/QAPP/"+p.btn.param_product.getTopic(),"/QAPP/"+p.btn.param_sampleCount.getTopic(),"/QAPP/"+p.btn.param_emptyCapsuleDetermination.getTopic(),"/QAPP/"+p.btn.param_emptyCapsuleWeight.getTopic()],scrollToTop:!1};this.mainScreen.setMenuTab(e,[p.btn.continue]),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else if(g.isString(t)&&"onExit"===t)this.showLoadingScreen(),this.hideMsgBox(),this.mainScreen.hide();else if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.param_sampleCount.getButtonId())return this.openInputNumber("PROCESS_SAMPLE_COUNT",p.l("_QAPP_WF_NO_SAMPLES_HEADER"),this.process.actualCountTarget,1,200),"";if(t.payload.buttonId===p.btn.param_emptyCapsuleDetermination.getButtonId())return this.openInputSelection("PROCESS_EMPTY_CAPSULE_DETERMINATION",p.l("_QAPP002_PARAM_HEADER_TARE_DETERMINATION"),[{
id:I.EnumEmptyCapsuleWeightDetermination.ENTER_FREE_VALUE,text:{id:I.EnumMapEmptyCapsuleWeightDetermination[I.EnumEmptyCapsuleWeightDetermination.ENTER_FREE_VALUE],args:[]},appearance:L.EnumAppearance.ENABLED},{id:I.EnumEmptyCapsuleWeightDetermination.WEIGH_MEAN_FREE_NUMBER,text:{id:I.EnumMapEmptyCapsuleWeightDetermination[I.EnumEmptyCapsuleWeightDetermination.WEIGH_MEAN_FREE_NUMBER],args:[]},appearance:L.EnumAppearance.ENABLED},{id:I.EnumEmptyCapsuleWeightDetermination.WEIGH_MEAN_10_10_30,text:{id:I.EnumMapEmptyCapsuleWeightDetermination[I.EnumEmptyCapsuleWeightDetermination.WEIGH_MEAN_10_10_30],args:[]},appearance:L.EnumAppearance.ENABLED},{id:I.EnumEmptyCapsuleWeightDetermination.WEIGH_MEAN_LAST_4,text:{id:I.EnumMapEmptyCapsuleWeightDetermination[I.EnumEmptyCapsuleWeightDetermination.WEIGH_MEAN_LAST_4],args:[]},appearance:L.EnumAppearance.ENABLED}],this.process.emptyCapsuleWeightDetermination),""
;if(t.payload.buttonId===p.btn.param_emptyCapsuleWeight.getButtonId())return this.process.emptyCapsuleWeight=D.convertToTargetUnit(this.process.emptyCapsuleWeight,this.Metrology.unit),this.process.emptyCapsuleWeight.unit=this.Metrology.unit,this.process.emptyCapsuleWeight.decimals=this.Metrology.decimals,this.openInputNumber("PROCESS_EMPTY_CAPSULE_WEIGHT",p.l("_QAPP_WF_PARAM_CAPSULE_HEADER"),this.process.emptyCapsuleWeight,this.Metrology.d,this.Metrology.max),"";if(t.payload.buttonId===p.btn.continue.getButtonId()){if(this.batch.product.prodType===I.EnumProductType.CAPSULE&&this.process.emptyCapsuleWeightDetermination===I.EnumEmptyCapsuleWeightDetermination.ENTER_FREE_VALUE){const e=A.getMetrology(this.process.emptyCapsuleWeight.unit);if(!g.isNumber(this.process.emptyCapsuleWeight.value)||this.process.emptyCapsuleWeight.value<e.d||this.process.emptyCapsuleWeight.value>e.max)return this.showMessageBox(E.EnumMessageboxType.WARNING,{id:p.l("_QAPP002_HEADER_INVALID_PARAMETER"),
args:[p.l("_QAPP_WF_AVG_EMPTY_TITLE",!0)]},p.l("_QAPP002_MESSAGE_MANDATORY_INPUT"),[p.btn.msgOk]),""}this.process.status=I.EnumProcessStatus.ACTIVE,this.process.samples=[];for(let e=0;e<this.process.actualCountTarget;e++)this.process.samples[e]=I.createSample(),this.process.samples[e].counter=e+1;if(this.batch.product.prodType===I.EnumProductType.CAPSULE){switch(this.process.emptyCapsuleWeightDetermination){case I.EnumEmptyCapsuleWeightDetermination.ENTER_FREE_VALUE:this.emptyCapsuleWeightBuffer=[],e.transition(this,this.INITIALIZE_MAIN_MEASUREMENT());break;case I.EnumEmptyCapsuleWeightDetermination.WEIGH_MEAN_10_10_30:this.emptyCapsWgtSequence=0;for(let e=0;e<this.emptyCapsWgtSets.length;e++)this.emptyCapsWgtSets[e].measured=D.createQuantity(),this.emptyCapsWgtSets[e].done=!1;e.transition(this,this.PROCESS_EMPTY_CAPS_WEIGHING_10_10_30());break;case I.EnumEmptyCapsuleWeightDetermination.WEIGH_MEAN_LAST_4:case I.EnumEmptyCapsuleWeightDetermination.WEIGH_MEAN_FREE_NUMBER:
this.emptyCapsuleWeightBuffer=[],e.transition(this,this.PROCESS_EMPTY_CAPS_WEIGHING_MEAN())}return""}return e.transition(this,this.INITIALIZE_MAIN_MEASUREMENT()),""}if(t.payload.buttonId===p.btn.msgOk.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID)return!0===this.process.isQuicktest?(this.workflowState=V.CREATE_QUICK_TEST,e.transition(this,this.ENTER_BATCH_DATA())):e.transition(this,this.BATCH_MENU()),""}const s=this.parseParamInput(t);if(s.isHandled&&s.isValid){if(this.hideInput(),"PROCESS_SAMPLE_COUNT"===s.id)return this.process.actualCountTarget=s.rInteger,this.ENTER_PROCESS_DATA_updateButtons(),"";if("PROCESS_EMPTY_CAPSULE_DETERMINATION"===s.id)return this.process.emptyCapsuleWeightDetermination=s.rSelectionID,this.ENTER_PROCESS_DATA_updateButtons(),"";if("PROCESS_EMPTY_CAPSULE_WEIGHT"===s.id)return this.process.emptyCapsuleWeight.value=s.rFloat,this.ENTER_PROCESS_DATA_updateButtons(),""}return""}ENTER_PROCESS_DATA_updateButtons(){
p.btn.param_sampleCount.setLabelRight({id:this.process.actualCountTarget.toFixed(0),args:[]},!0),p.btn.param_emptyCapsuleDetermination.setLabelRight({id:p.l(I.EnumMapEmptyCapsuleWeightDetermination[this.process.emptyCapsuleWeightDetermination]),args:[]},!0),p.btn.param_emptyCapsuleWeight.setLabelRight({id:D.formatQuantityParam(this.process.emptyCapsuleWeight),args:[]},!0);let e=this.batch.product.prodTestType===I.EnumProductTestType.USER_DEFINED;e=(e=e&&this.config.supervisorRoles.includes(this.USER.role_id))||!0===this.process.isQuicktest,p.btn.param_sampleCount.setAppearance(e?L.EnumAppearance.ENABLED:L.EnumAppearance.DISABLED),this.batch.product.prodType===I.EnumProductType.CAPSULE?(p.btn.param_emptyCapsuleDetermination.setAppearance(L.EnumAppearance.ENABLED),
p.btn.param_emptyCapsuleWeight.setAppearance(this.process.emptyCapsuleWeightDetermination===I.EnumEmptyCapsuleWeightDetermination.ENTER_FREE_VALUE?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN)):(p.btn.param_emptyCapsuleDetermination.setAppearance(L.EnumAppearance.HIDDEN),p.btn.param_emptyCapsuleWeight.setAppearance(L.EnumAppearance.HIDDEN))}FINALIZE_PROCESS(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.FINALIZE_PROCESS.name;if(!e&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.FINALIZE_PROCESS()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t){if(p.btn.msgPharmacopTolViolationOK=this.createMessageButton(l.EnumFontLabels.OK),p.btn.msgDbQueryFailedCancel=this.createMessageButton(p.l("_QAPP002_BUTTON_CANCEL")),p.btn.msgDbQueryFailedRetryStoreBatch=this.createMessageButton(p.l("_QAPP_WF_BTN_RETRY_LABEL")),
p.btn.msgDbQueryFailedRetryStoreProcess=this.createMessageButton(p.l("_QAPP_WF_BTN_RETRY_LABEL")),this.process.status=I.EnumProcessStatus.FINISHED,this.process.timeEnd=O.getDateTime("isoTimezone"),this.calculateProcessStatistics(),this.batch.product.dynamicTolerances===I.EnumBoolean.ENABLED&&this.batch.product.calculationMode===I.EnumCalculationMode.FROM_TOTAL_MEAN){for(let e=0;e<this.process.samples.length;e++)this.evaluateSampleResult(this.process.samples[e]);this.calculateProcessStatistics(),this.calculateProcessDispersion(!0)}else this.calculateProcessDispersion(this.batch.product.dynamicTolerances===I.EnumBoolean.DISABLED);if(this.process.resultText=p.l("_QAPP002_PARAMVAL_PROCESS_FINAL_EVALUATION_PASSED",!0),this.batch.product.prodTestType===I.EnumProductTestType.PHARMACOPOEIA){if(this.process.counters.minimum2+this.process.counters.maximum2>0)return this.process.resultText=p.l("_QAPP002_PARAMVAL_PROCESS_FINAL_EVALUATION_PHARMACOPOEIA_TOLVIOLATION",!0),
this.showMessageBox(E.EnumMessageboxType.WARNING,p.l("_QAPP_WF_TOLERANCE_EXCEEDED_MSG_BOX_TITLE"),p.l("_QAPP_WF_MAX_TOLERANCE_EXCEEDED_MSG_BOX_TEXT"),[p.btn.msgPharmacopTolViolationOK]),"";if(this.process.counters.minimum1+this.process.counters.maximum1>2)return this.process.resultText=p.l("_QAPP002_PARAMVAL_PROCESS_FINAL_EVALUATION_PHARMACOPOEIA_TOLVIOLATION",!0),this.showMessageBox(E.EnumMessageboxType.WARNING,p.l("_QAPP_WF_TOLERANCE_EXCEEDED_MSG_BOX_TITLE"),p.l("_QAPP_WF_MIN_TOLERANCE_EXCEEDED_MSG_BOX_TEXT"),[p.btn.msgPharmacopTolViolationOK]),""}else this.process.counters.totalOoT>0&&(this.process.resultText=p.l("_QAPP002_PARAMVAL_PROCESS_FINAL_EVALUATION_ANY_TOLVIOLATION",!0));return this.addToEventQueue(new h.SimpleEvent("FINISH_TEST_PROCESS")),""}if(g.isString(t)&&"onExit"===t)this.showLoadingScreen(),this.hideMsgBox();else if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){
if(t.payload.buttonId===p.btn.msgPharmacopTolViolationOK.getButtonId())return this.hideMsgBox(),this.addToEventQueue(new h.SimpleEvent("FINISH_TEST_PROCESS")),"";if(t.payload.buttonId===p.btn.msgDbQueryFailedRetryStoreBatch.getButtonId())return this.hideMsgBox(),f.loadBatch(this,"LOAD_BATCH_TO_ADD_FINISHED_PROCESS",this.batch.databaseId),"";if(t.payload.buttonId===p.btn.msgDbQueryFailedRetryStoreProcess.getButtonId())return this.hideMsgBox(),B.storeProcess(this,"STORE_FINISHED_PROCESS",this.batch,this.process),"";if(t.payload.buttonId===p.btn.msgDbQueryFailedCancel.getButtonId())return e.transition(this,this.SHOW_PROCESS_RESULT()),"";this.HandleHomeOrLogoutButtons(t)}else if(g.isObject(t)&&g.isString(t.type)&&t.type===h.SIMPLE_EVENT&&"FINISH_TEST_PROCESS"===t.payload)return!0===this.process.isQuicktest?(this.reportTestProcessResult(this.batch,this.process),this.workflowState=V.RESULT_FINISHED_PROCESS,e.transition(this,this.SHOW_PROCESS_RESULT()),
""):(f.loadBatch(this,"LOAD_BATCH_TO_ADD_FINISHED_PROCESS",this.batch.databaseId),"");const s=C.parseDatabaseEvent(t);if(!0===s.isHandled)if(!0===s.success)switch(s.context){case"LOAD_BATCH_TO_ADD_FINISHED_PROCESS":return this.addTestResultToBatchStatistics(this.batch,this.process),f.storeBatch(this,"STORE_BATCH_TO_ADD_FINISHED_PROCESS",this.batch),"";case"STORE_BATCH_TO_ADD_FINISHED_PROCESS":return this.process.sequenceNumber=this.batch.numberOfTests,B.storeProcess(this,"STORE_FINISHED_PROCESS",this.batch,this.process),"";case"STORE_FINISHED_PROCESS":return this.reportTestProcessResult(this.batch,this.process),this.processesOverview[this.process.databaseId]=I.createProcessShort(),this.processesOverview[this.process.databaseId].databaseId=this.process.databaseId,this.processesOverview[this.process.databaseId].status=this.process.status,this.processesOverview[this.process.databaseId].databaseReferenceBatchFk=this.process.databaseReferenceBatchFk,
this.processesOverview[this.process.databaseId].lotId=this.process.lotId,this.processesOverview[this.process.databaseId].databaseReferenceProductFk=this.process.databaseReferenceProductFk,this.processesOverview[this.process.databaseId].timeStart=this.process.timeStart,this.processesOverview[this.process.databaseId].timeEnd=this.process.timeEnd,this.workflowState=V.RESULT_FINISHED_PROCESS,e.transition(this,this.SHOW_PROCESS_RESULT()),""}else switch(s.context){case"LOAD_BATCH_TO_ADD_FINISHED_PROCESS":case"STORE_BATCH_TO_ADD_FINISHED_PROCESS":return C.DatabaseErrorMsg(this,s.result,[p.btn.msgDbQueryFailedCancel,p.btn.msgDbQueryFailedRetryStoreBatch]),"";case"STORE_FINISHED_PROCESS":return C.DatabaseErrorMsg(this,s.result,[p.btn.msgDbQueryFailedCancel,p.btn.msgDbQueryFailedRetryStoreProcess]),""}return""}__________________CAPSULE_TARE_DETERMINATION__________________(){}PROCESS_EMPTY_CAPS_WEIGHING_MEAN(e,t){
if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.PROCESS_EMPTY_CAPS_WEIGHING_MEAN.name;if(!e&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,c.EV_MQTT_UPDATE,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.PROCESS_EMPTY_CAPS_WEIGHING_MEAN()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t)return this.weighingState=W.IDLE,this.weighingProxy.clearTareAll(),p.btn.continue=this.createWeighingSplitScreenButton(2,l.EnumFontLabels.NEXT,L.EnumAppearance.DISABLED),p.btn.confirm=this.createWeighingSplitScreenButton(3,l.EnumFontLabels.OK,L.EnumAppearance.HIDDEN),p.btn.takeover=this.createWeighingSplitScreenButton(4,l.EnumFontLabels.PRINT_ADD,L.EnumAppearance.DISABLED),this.weighingSplitscreenTabInfoImage.setAppearance(L.EnumAppearance.ENABLED,!0),this.showScreen(this.weighingSplitScreen),this.PROCESS_EMPTY_CAPS_WEIGHING_MEAN_prepareForTareWeight(),"";if(g.isString(t)&&"onExit"===t)this.showLoadingScreen(),
this.weighingSplitScreen.setText1(""),this.weighingSplitScreen.setText2(""),this.setWeighingSplitScreenParams(1,"","",""),this.setWeighingSplitScreenParams(2,"","",""),this.weighingSplitscreenTabInfoImage.setAppearance(L.EnumAppearance.HIDDEN,!0),this.weighingSplitScreen.hide(),this.hideBargraph(),this.hideMsgBox();else if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.continue.getButtonId())return this.showLoadingScreen(),this.weighingProxy.doZeroTareAuto(u.WEIGHING_DOZEROTARE_BEHAVIOR.WEIGHING_DOZEROTARE_BEHAVIOR_AFTER_STABILITY),this.PROCESS_EMPTY_CAPS_WEIGHING_MEAN_prepareForCapsuleWeight(),"";if(t.payload.buttonId===p.btn.takeover.getButtonId())return this.weighingState=W.WAIT_DSD,this.reportingProxy.requestPrintableValue(this.getTaskName()+"; Capsule weight determination #"+(this.emptyCapsuleWeightBuffer.length+1).toFixed(0)),this.weighingWaitingTimeout=O.getDateTime("ms")+6e4,""
;if(t.payload.buttonId===p.btn.confirm.getButtonId())return e.transition(this,this.INITIALIZE_MAIN_MEASUREMENT()),"";this.HandleHomeOrLogoutButtons(t)}else if(g.isObject(t)&&g.isString(t.type)&&t.type===c.EV_MQTT_UPDATE){if(t.payload&&g.isString(t.payload.topic)&&t.payload.topic===P.MqttTopics.WEIGHING_VALUE_GROSS)return"";switch(this.weighingState){case W.WAIT_PLACE_TARE_CONTAINER:{const e=this.parse_MQTT_Weight(t,"valid");p.btn.continue.setAppearance(null!==e&&e.value>=0?L.EnumAppearance.ENABLED_PRIMARY:L.EnumAppearance.DISABLED,!0);break}case W.WAIT_ACQUISITION_TRIGGER:{const e=this.parse_MQTT_Weight(t,"valid");p.btn.takeover.setAppearance(null!==e&&e.value>0?L.EnumAppearance.ENABLED_PRIMARY:L.EnumAppearance.DISABLED,!0);break}case W.WAIT_DSD:{if(t&&t.payload&&t.payload.topic===P.MqttTopics.WEIGHING_WAITING_FOR_STABILITY){return!1===JSON.parse(t.payload.value.toString()).state&&(this.weighingWaitingTimeout=O.getDateTime("ms")+1500),""}
if(O.getDateTime("ms")>this.weighingWaitingTimeout)return this.weighingState=W.WAIT_ACQUISITION_TRIGGER,"";const e=this.parse_MQTT_Weight(t,"alibi");if(e){if(this.weighingState=W.GOT_DSD,e.value<=0)return this.weighingState=W.WAIT_ACQUISITION_TRIGGER,"";switch(this.emptyCapsuleWeightBuffer.push(e),this.process.emptyCapsuleWeightDetermination){case I.EnumEmptyCapsuleWeightDetermination.WEIGH_MEAN_LAST_4:this.emptyCapsuleWeightBuffer.length>=4&&(this.process.emptyCapsuleWeight=D.math_Mean(this.emptyCapsuleWeightBuffer.slice(-4),this.Metrology.unit));break;default:this.process.emptyCapsuleWeight=D.math_Mean(this.emptyCapsuleWeightBuffer,this.Metrology.unit)}return this.weighingProxy.doTare(u.WEIGHING_DOZEROTARE_BEHAVIOR.WEIGHING_DOZEROTARE_BEHAVIOR_AFTER_STABILITY),this.PROCESS_EMPTY_CAPS_WEIGHING_MEAN_prepareForCapsuleWeight(),""}break}}}return""}PROCESS_EMPTY_CAPS_WEIGHING_MEAN_prepareForTareWeight(){this.weighingState=W.WAIT_PLACE_TARE_CONTAINER,
this.weighingSplitScreen.setText1(p.l("_QAPP_WF_REMOVE_INFO"),[]),this.weighingSplitScreen.setText2(p.l("_QAPP_WF_TARE_INFO"),[p.btn.continue.getLabel().id]),this.weighingSplitscreenTabInfoImage.setTabImgRefId(U),p.btn.confirm.setAppearance(L.EnumAppearance.HIDDEN),p.btn.takeover.setAppearance(L.EnumAppearance.HIDDEN),this.hideLoadingScreen()}PROCESS_EMPTY_CAPS_WEIGHING_MEAN_prepareForCapsuleWeight(){this.weighingState=W.WAIT_ACQUISITION_TRIGGER,this.weighingSplitScreen.setText1(p.l("_QAPP002_INFO_PROCESS_EMPTY_CAPSULE_MEAN_WEIGHING_1"),[]),this.weighingSplitscreenTabInfoImage.setTabImgRefId(G),p.btn.continue.setAppearance(L.EnumAppearance.HIDDEN);let e=1;this.process.emptyCapsuleWeightDetermination===I.EnumEmptyCapsuleWeightDetermination.WEIGH_MEAN_LAST_4&&(e=4),this.emptyCapsuleWeightBuffer.length>=e?(this.weighingSplitScreen.setText2(p.l("_QAPP002_INFO_PROCESS_EMPTY_CAPSULE_MEAN_WEIGHING_2"),[p.btn.confirm.getLabel().id]),p.btn.confirm.setAppearance(L.EnumAppearance.ENABLED),
this.setWeighingSplitScreenParams(1,p.l("_QAPP_WF_PARAM_CAPSULE_HEADER"),p.l("_QAPP_WF_PARAM_CAPSULE_TITLE"),D.formatQuantityParam(this.process.emptyCapsuleWeight))):(this.weighingSplitScreen.setText2(""),p.btn.confirm.setAppearance(L.EnumAppearance.HIDDEN),this.setWeighingSplitScreenParams(1,"","","")),this.emptyCapsuleWeightBuffer.length>0&&this.setWeighingSplitScreenParams(2,p.l("_QAPP_LIB_PARAM_HEADER_STAT_NUMSAM"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_NUMSAM"),this.emptyCapsuleWeightBuffer.length.toFixed(0)),this.hideLoadingScreen()}PROCESS_EMPTY_CAPS_WEIGHING_10_10_30(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.PROCESS_EMPTY_CAPS_WEIGHING_10_10_30.name;if(!e&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,c.EV_MQTT_UPDATE,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.PROCESS_EMPTY_CAPS_WEIGHING_10_10_30()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t)return this.weighingState=W.IDLE,
this.weighingProxy.clearTareAll(),p.btn.continue=this.createWeighingSplitScreenButton(2,l.EnumFontLabels.NEXT,L.EnumAppearance.DISABLED),p.btn.finish=this.createWeighingSplitScreenButton(3,l.EnumFontLabels.NEXT,L.EnumAppearance.DISABLED),p.btn.takeover=this.createWeighingSplitScreenButton(4,l.EnumFontLabels.PRINT_ADD,L.EnumAppearance.DISABLED),this.weighingProxy.createWeightApplication(y,{id:y,args:[]},{id:y,args:[]},!1,!1),this.weighingSplitscreenTabInfoImage.setAppearance(L.EnumAppearance.ENABLED,!0),this.showScreen(this.weighingSplitScreen),this.PROCESS_EMPTY_CAPS_WEIGHING_10_10_30_prepareForTareWeight(),"";if(g.isString(t)&&"onExit"===t)this.showLoadingScreen(),this.weighingSplitscreenTabInfoImage.setAppearance(L.EnumAppearance.HIDDEN,!0),this.weighingSplitscreenTabCapsDetermination10_10_30.setAppearance(L.EnumAppearance.HIDDEN,!0),this.weighingProxy.destroyWeightApplication(y),this.weighingSplitScreen.setText1(""),this.weighingSplitScreen.setText2(""),
this.setWeighingSplitScreenParams(1,"","",""),this.weighingSplitScreen.hide(),this.hideBargraph(),this.hideMsgBox();else if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.continue.getButtonId())return this.showLoadingScreen(),this.weighingProxy.doZeroTareAuto(u.WEIGHING_DOZEROTARE_BEHAVIOR.WEIGHING_DOZEROTARE_BEHAVIOR_AFTER_STABILITY),this.PROCESS_EMPTY_CAPS_WEIGHING_10_10_30_prepareForCapsuleWeight(),"";if(t.payload.buttonId===p.btn.takeover.getButtonId())return this.rejectFastButtonPressSetNextDuration(1500),this.weighingState=W.WAIT_DSD,this.reportingProxy.requestPrintableValue(this.getTaskName()+"; Capsule weight determination - weighing "+this.emptyCapsWgtSets[this.emptyCapsWgtSequence].capsuleCount.toFixed(0)+" empty capsules"),this.weighingWaitingTimeout=O.getDateTime("ms")+6e4,"";if(t.payload.buttonId===p.btn.finish.getButtonId())return e.transition(this,this.INITIALIZE_MAIN_MEASUREMENT()),"";this.HandleHomeOrLogoutButtons(t)
}else if(g.isObject(t)&&g.isString(t.type)&&t.type===c.EV_MQTT_UPDATE){if(t.payload&&g.isString(t.payload.topic)&&t.payload.topic===P.MqttTopics.WEIGHING_VALUE_GROSS)return"";switch(this.PROCESS_EMPTY_CAPS_WEIGHING_10_10_30_updateCustomizedDisplayedValue(t),this.weighingState){case W.WAIT_PLACE_TARE_CONTAINER:{const e=this.parse_MQTT_Weight(t,"valid");p.btn.continue.setAppearance(null!==e&&e.value>=0?L.EnumAppearance.ENABLED_PRIMARY:L.EnumAppearance.DISABLED,!0);break}case W.WAIT_ACQUISITION_TRIGGER:{const e=this.parse_MQTT_Weight(t,"valid");p.btn.takeover.setAppearance(null!==e&&e.value>0?L.EnumAppearance.ENABLED_PRIMARY:L.EnumAppearance.DISABLED,!0);break}case W.WAIT_DSD:{if(t&&t.payload&&t.payload.topic===P.MqttTopics.WEIGHING_WAITING_FOR_STABILITY){return!1===JSON.parse(t.payload.value.toString()).state&&(this.weighingWaitingTimeout=O.getDateTime("ms")+1500),""}if(O.getDateTime("ms")>this.weighingWaitingTimeout)return this.weighingState=W.WAIT_ACQUISITION_TRIGGER,""
;const e=this.parse_MQTT_Weight(t,"alibi");if(e)return this.weighingState=W.GOT_DSD,e.value<=0?(this.weighingState=W.WAIT_ACQUISITION_TRIGGER,""):(this.process.emptyCapsuleWeight=e,this.process.emptyCapsuleWeight.alibiId=void 0,this.process.emptyCapsuleWeight.alibi="",this.process.emptyCapsuleWeight.value=m.bignumber(e.value).dividedBy(this.emptyCapsWgtSets[this.emptyCapsWgtSequence].capsuleCount).toNumber(),this.emptyCapsWgtSets[this.emptyCapsWgtSequence].measured=T.cloneJSON(this.process.emptyCapsuleWeight),this.emptyCapsWgtSets[this.emptyCapsWgtSequence].done=!0,this.emptyCapsWgtSequence<this.emptyCapsWgtSets.length-1?(this.emptyCapsWgtSequence++,this.PROCESS_EMPTY_CAPS_WEIGHING_10_10_30_prepareForCapsuleWeight(),""):(this.PROCESS_EMPTY_CAPS_WEIGHING_10_10_30_prepareForClearingPan(),""));break}}}return""}PROCESS_EMPTY_CAPS_WEIGHING_10_10_30_updateCustomizedDisplayedValue(e){
if(e.payload&&g.isString(e.payload.topic)&&e.payload.topic===P.MqttTopics.WEIGHING_VALUE_NET)switch(this.weighingState){case W.WAIT_CLEAR_PAN:case W.WAIT_ACQUISITION_TRIGGER:{const t=this.parse_MQTT_Weight(e,"valid");if(this.emptyCapsWgtSequence>0){const e={mark:"",sign:"",number:"ERR",decimals:0,auxiliaryDigits:0,unit:D.getUnitString(D.EnumUnit.PIECES),interval:1,isStable:!0,isSpecial:!1,isWarning:!1,isInvalid:!1};if(t)if(t.value>0){const s=D.convertToTargetUnit(this.emptyCapsWgtSets[this.emptyCapsWgtSequence-1].measured,t.unit);e.number=m.bignumber(t.value).dividedBy(s.value).toFixed(0)}else e.number=(0).toFixed(0);this.mqttHandler.publish(P.MqttTopics.CUSTOMIZED_WEIGHT_DISPLAY_VALUE.replace(P.MQTT_TOPIC_WILDCARD_UNIQUE_ID,y),JSON.stringify(e),{retain:!1})}break}}}PROCESS_EMPTY_CAPS_WEIGHING_10_10_30_prepareForTareWeight(){this.weighingState=W.WAIT_PLACE_TARE_CONTAINER,this.weighingSplitScreen.setText1(p.l("_QAPP_WF_REMOVE_INFO"),[]),
this.weighingSplitScreen.setText2(p.l("_QAPP_WF_TARE_INFO"),[p.btn.continue.getLabel().id]),this.weighingSplitscreenTabInfoImage.setTabImgRefId(U),p.btn.finish.setAppearance(L.EnumAppearance.HIDDEN),p.btn.takeover.setAppearance(L.EnumAppearance.HIDDEN),this.hideLoadingScreen()}PROCESS_EMPTY_CAPS_WEIGHING_10_10_30_prepareForCapsuleWeight(){this.weighingState=W.WAIT_ACQUISITION_TRIGGER,this.weighingSplitScreen.setText2("");let e=G;0===this.emptyCapsWgtSequence?(this.weighingSplitScreen.setText1(p.l("_QAPP_WF_PLACE_CAPSULES"),[this.emptyCapsWgtSets[this.emptyCapsWgtSequence].displayText]),this.weighingProxy.enableWeightApplication(y,!1),this.setWeighingSplitScreenParams(1,"","","")):this.emptyCapsWgtSequence>0&&(this.weighingSplitScreen.setText1(p.l("_QAPP_WF_PLACE_ADDITIONAL_CAPSULES"),[this.emptyCapsWgtSets[this.emptyCapsWgtSequence].displayText]),this.weighingProxy.enableWeightApplication(y,!0),this.weighingProxy.selectWeightApplication(y),
this.publishResultParameters_EmptyCapsDetermination10_10_30(),this.weighingSplitscreenTabCapsDetermination10_10_30.setAppearance(L.EnumAppearance.ENABLED,!0)),this.emptyCapsWgtSequence>1&&(e=H),this.weighingSplitscreenTabInfoImage.setTabImgRefId(e),p.btn.continue.setAppearance(L.EnumAppearance.HIDDEN),p.btn.finish.setAppearance(L.EnumAppearance.HIDDEN),this.hideLoadingScreen()}PROCESS_EMPTY_CAPS_WEIGHING_10_10_30_prepareForClearingPan(){this.weighingState=W.WAIT_CLEAR_PAN,this.weighingSplitScreen.setText1(p.l("_QAPP_WF_REMOVE_INFO"),[]),this.publishResultParameters_EmptyCapsDetermination10_10_30(),this.weighingSplitscreenTabInfoImage.setTabImgRefId(F),p.btn.finish.setAppearance(L.EnumAppearance.ENABLED_PRIMARY),p.btn.takeover.setAppearance(L.EnumAppearance.HIDDEN),this.hideLoadingScreen()}__________________WEIGHING_PROCESS__________________(){}INITIALIZE_MAIN_MEASUREMENT(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.INITIALIZE_MAIN_MEASUREMENT.name
;if(!e&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,c.EV_MQTT_UPDATE,h.SIMPLE_EVENT,h.QAPP_TIMER_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.INITIALIZE_MAIN_MEASUREMENT()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t)this.weighingState=W.IDLE,this.weighingProxy.clearTareAll(),this.reportTestProcessInitial(this.batch,this.process),p.btn.takeover=this.createWeighingSplitScreenButton(2,l.EnumFontLabels.PRINT_ADD,L.EnumAppearance.DISABLED),this.weighingSplitScreen.setText1(p.l("_QAPP_WF_REMOVE_INFO"),[]),this.weighingSplitScreen.setText2(p.l("_QAPP002_INFO_PROCESS_EMPTY_VESSEL"),[p.btn.takeover.getLabel().id]),this.weighingSplitscreenTabInfoImage.setAppearance(L.EnumAppearance.ENABLED,!0),this.weighingSplitscreenTabInfoImage.setTabImgRefId(U),this.showScreen(this.weighingSplitScreen),this.hideLoadingScreen(),
this.weighingState=W.WAIT_ACQUISITION_TRIGGER;else if(g.isString(t)&&"onExit"===t)this.weighingSplitscreenTabInfoImage.setAppearance(L.EnumAppearance.HIDDEN,!0),this.showLoadingScreen(),this.weighingSplitScreen.setText1("",[]),this.weighingSplitScreen.hide(),this.hideBargraph(),this.hideMsgBox();else if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.takeover.getButtonId())return this.weighingState=W.WAIT_DSD,this.reportingProxy.requestPrintableValue(this.getTaskName()+"; Empty vessel"),this.weighingWaitingTimeout=O.getDateTime("ms")+6e4,"";this.HandleHomeOrLogoutButtons(t)}else if(g.isObject(t)&&g.isString(t.type)&&t.type===c.EV_MQTT_UPDATE){if(t.payload&&g.isString(t.payload.topic)&&t.payload.topic===P.MqttTopics.WEIGHING_VALUE_GROSS)return"";switch(this.weighingState){case W.WAIT_ACQUISITION_TRIGGER:{const e=this.parse_MQTT_Weight(t,"valid")
;p.btn.takeover.setAppearance(null!==e&&e.value>0?L.EnumAppearance.ENABLED_PRIMARY:L.EnumAppearance.DISABLED,!0);break}case W.WAIT_DSD:{if(t&&t.payload&&t.payload.topic===P.MqttTopics.WEIGHING_WAITING_FOR_STABILITY){return!1===JSON.parse(t.payload.value.toString()).state&&(this.weighingWaitingTimeout=O.getDateTime("ms")+1500),""}if(O.getDateTime("ms")>this.weighingWaitingTimeout)return this.weighingState=W.WAIT_ACQUISITION_TRIGGER,"";const e=this.parse_MQTT_Weight(t,"alibi");if(e)return this.weighingState=W.GOT_DSD,e.value<=0?(this.weighingState=W.WAIT_ACQUISITION_TRIGGER,""):(this.process.vessel=e,this.weighingProxy.doTare(u.WEIGHING_DOZEROTARE_BEHAVIOR.WEIGHING_DOZEROTARE_BEHAVIOR_AFTER_STABILITY),this.weighingProxy.setUnit(this.batch.product.preferredUnit,!1),this.showLoadingScreen(),this.cancelTimer(this.fsmTimers.SWITCH_TO_SAMPLE_WEIGHING),this.fsmTimers.SWITCH_TO_SAMPLE_WEIGHING=this.addTimer(250,"SWITCH_TO_SAMPLE_WEIGHING"),"");break}}
}else if(g.isObject(t)&&g.isString(t.type)&&t.type===h.QAPP_TIMER_EVENT&&"SWITCH_TO_SAMPLE_WEIGHING"===t.payload)return e.transition(this,this.PROCESS_SAMPLE_WEIGHING()),"";return""}PROCESS_SAMPLE_WEIGHING(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.PROCESS_SAMPLE_WEIGHING.name;if(!e&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,c.EV_MQTT_UPDATE,h.SIMPLE_EVENT,h.QAPP_TIMER_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.PROCESS_SAMPLE_WEIGHING()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t)return this.weighingState=W.IDLE,p.btn.clearForReTare=this.createWeighingSplitScreenButton(0,l.EnumFontLabels.TARE,L.EnumAppearance.HIDDEN),p.btn.result=this.createWeighingSplitScreenButton(2,l.EnumFontLabels.RESULT,L.EnumAppearance.HIDDEN),p.btn.confirm=this.createWeighingSplitScreenButton(3,l.EnumFontLabels.OK,L.EnumAppearance.HIDDEN),
p.btn.takeover=this.createWeighingSplitScreenButton(4,l.EnumFontLabels.PRINT_ADD,L.EnumAppearance.HIDDEN),p.btn.msgPharmacopTolViolationOK=this.createMessageButton(l.EnumFontLabels.OK),this.weighingSplitscreenTabInfoImage.setAppearance(L.EnumAppearance.ENABLED,!0),this.publishStatisticParameters_Process(this.process.statistics,this.process.counters,this.batch,this.process),this.setWeighingSplitScreenParams(1,"",p.l("_QAPP_WF_MIN_TOL_TITLE"),D.formatQuantityParam(this.batch.product.prodTolerance1)),this.setWeighingSplitScreenParams(2,"",p.l("_QAPP_WF_MAX_TOL_TITLE"),D.formatQuantityParam(this.batch.product.prodTolerance2)),this.weighingProxy.createWeightApplication(v,{id:v,args:[]},{id:v,args:[]},!1,!1),this.batch.product.dynamicTolerances===I.EnumBoolean.ENABLED&&this.batch.product.calculationMode===I.EnumCalculationMode.FROM_TOTAL_MEAN?(this.weighingSplitscreenTabCounterOverview.setAppearance(L.EnumAppearance.ENABLED,!0),
this.weighingSplitscreenTabCounterChart.setAppearance(L.EnumAppearance.HIDDEN,!0)):(this.weighingSplitscreenTabCounterOverview.setAppearance(L.EnumAppearance.HIDDEN,!0),this.weighingSplitscreenTabCounterChart.setAppearance(L.EnumAppearance.ENABLED,!0),this.updateWeighingScreenCounterChart(this.batch,this.process)),this.weighingSplitscreenTabStatistics.setAppearance(L.EnumAppearance.ENABLED,!0),this.showScreen(this.weighingSplitScreen),this.PROCESS_SAMPLE_WEIGHING_updateProcessLimits(),this.PROCESS_SAMPLE_WEIGHING_checkForNextOrLastSample(),"";if(g.isString(t)&&"onExit"===t)return this.showLoadingScreen(),this.weighingSplitscreenTabInfoImage.setAppearance(L.EnumAppearance.HIDDEN,!0),this.weighingSplitscreenTabCounterChart.setAppearance(L.EnumAppearance.HIDDEN,!0),this.weighingSplitscreenTabCounterOverview.setAppearance(L.EnumAppearance.HIDDEN,!0),this.weighingSplitscreenTabStatistics.setAppearance(L.EnumAppearance.HIDDEN,!0),this.weighingProxy.destroyWeightApplication(v),
this.weighingProxy.setButton(u.WEIGHING_BUTTON_DO_TARE,L.EnumAppearance.ENABLED_SECONDARY),this.weighingSplitScreen.setText1(""),this.weighingSplitScreen.setText2(""),this.setWeighingSplitScreenParams(1,"","",""),this.setWeighingSplitScreenParams(2,"","",""),this.weighingSplitScreen.hide(),this.hideBargraph(),this.hideMsgBox(),"";if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.takeover.getButtonId())return this.weighingState=W.WAIT_DSD,this.reportingProxy.requestPrintableValue(this.getTaskName()+"; Sample #"+this.currentSample.counter.toFixed(0)),this.weighingWaitingTimeout=O.getDateTime("ms")+6e4,"";if(t.payload.buttonId===p.btn.clearForReTare.getButtonId())return this.PROCESS_SAMPLE_WEIGHING_prepareForNewSample(),"";if(t.payload.buttonId===p.btn.result.getButtonId())return this.weighingState=W.IDLE,e.transition(this,this.SHOW_PROCESS_RESULT()),""
;if(t.payload.buttonId===p.btn.confirm.getButtonId())return e.transition(this,this.FINALIZE_PROCESS()),"";this.HandleHomeOrLogoutButtons(t)}else if(g.isObject(t)&&g.isString(t.type)&&t.type===h.QAPP_TIMER_EVENT){if("HIDE_TOLERANCE_VIOLATION_MESSAGEBOX"===t.payload)return this.hideMsgBox(),this.PROCESS_SAMPLE_WEIGHING_initializeEnterSampleIDs(),""}else if(g.isObject(t)&&g.isString(t.type)&&t.type===c.EV_MQTT_UPDATE){if(t.payload&&g.isString(t.payload.topic)&&t.payload.topic===P.MqttTopics.WEIGHING_VALUE_GROSS)return"";if(t.payload&&g.isString(t.payload.topic)&&t.payload.topic===P.MqttTopics.METROLOGY_RANGES)return this.PROCESS_SAMPLE_WEIGHING_updateProcessLimits(),"";switch(this.PROCESS_SAMPLE_WEIGHING_updateCustomizedDisplayedValue(t),this.weighingState){case W.WAIT_STABILITY_FOR_CLEARING_PAN:{const e=this.parse_MQTT_Weight(t,"valid");if(e&&!0===e.stable){switch(this.weighingState=W.IDLE,this.batch.product.prodType){case I.EnumProductType.TABLET:case I.EnumProductType.POWDER:
this.config.autoTakeover===I.EnumBoolean.ENABLED&&(this.weighingState=W.WAIT_CLEAR_PAN),this.batch.product.autoZero===I.EnumBoolean.ENABLED&&(this.weighingProxy.doZeroTareAuto(u.WEIGHING_DOZEROTARE_BEHAVIOR.WEIGHING_DOZEROTARE_BEHAVIOR_AFTER_STABILITY),this.weighingState=W.WAIT_CLEAR_PAN);break;case I.EnumProductType.CAPSULE:{let e=D.convertToTargetUnit(this.process.emptyCapsuleWeight,this.Metrology.unit);if(g.isNumber(this.currentGross.value)){const t=D.convertToTargetUnit(this.currentGross,this.Metrology.unit);e.value=m.bignumber(e.value).add(t.value).toNumber()}this.weighingProxy.setTare1(e.value),p.btn.clearForReTare.setAppearance(L.EnumAppearance.ENABLED),this.weighingProxy.setButton(u.WEIGHING_BUTTON_DO_TARE,L.EnumAppearance.HIDDEN),this.weighingState=W.WAIT_CLEAR_PAN;break}}if(this.weighingState!==W.WAIT_CLEAR_PAN)return this.PROCESS_SAMPLE_WEIGHING_prepareSampleWeighing(),""}return""}case W.WAIT_CLEAR_PAN:{const e=this.parse_MQTT_Weight(t,"anyNumber");if(e){
const t=m.bignumber(this.Metrology.d).times(this.config.autoTakeoverMinload.value),s=this.config.autoTakeover===I.EnumBoolean.ENABLED?t:this.Metrology.d;if(m.bignumber(e.value).lessThan(s))return this.weighingState=W.IDLE,this.PROCESS_SAMPLE_WEIGHING_prepareSampleWeighing(),""}return""}case W.WAIT_ACQUISITION_TRIGGER:{const e=this.parse_MQTT_Weight(t,"valid");if(this.config.autoTakeover===I.EnumBoolean.ENABLED){if(e&&!0===e.stable&&m.bignumber(e.value).greaterThanOrEqualTo(m.bignumber(this.Metrology.d).times(this.config.autoTakeoverMinload.value)))return this.weighingState=W.WAIT_DSD,this.reportingProxy.requestPrintableValue(this.getTaskName()+"; Sample #"+this.currentSample.counter.toFixed(0)),this.weighingWaitingTimeout=O.getDateTime("ms")+6e4,""}else{const t=null!==e&&m.bignumber(e.value).greaterThanOrEqualTo(this.process.appliedTolerances.minimumThreshold.value);p.btn.takeover.setAppearance(t?L.EnumAppearance.ENABLED_PRIMARY:L.EnumAppearance.DISABLED,!0)}return""}case W.WAIT_DSD:{
if(t&&t.payload&&t.payload.topic===P.MqttTopics.WEIGHING_WAITING_FOR_STABILITY){return!1===JSON.parse(t.payload.value.toString()).state&&(this.weighingWaitingTimeout=O.getDateTime("ms")+1500),""}if(O.getDateTime("ms")>this.weighingWaitingTimeout)return this.weighingState=W.WAIT_ACQUISITION_TRIGGER,"";const e=this.parse_MQTT_Weight(t,"alibi");return e&&(this.weighingState=W.GOT_DSD,this.PROCESS_SAMPLE_WEIGHING_evaluateAcquiredWeight(e)),""}}}const s=this.parseParamInput(t);return s.isHandled&&s.isValid&&(this.hideInput(),"RESERVED_SAMPLE_ID"===s.id)?(this.PROCESS_SAMPLE_WEIGHING_continueEnterSampleIDs(s.rString),""):""}PROCESS_SAMPLE_WEIGHING_updateCustomizedDisplayedValue(e){if(e.payload&&g.isString(e.payload.topic)&&e.payload.topic===P.MqttTopics.WEIGHING_VALUE_NET&&(this.batch.product.dynamicTolerances!==I.EnumBoolean.ENABLED||this.batch.product.calculationMode!==I.EnumCalculationMode.FROM_TOTAL_MEAN))switch(this.weighingState){case W.WAIT_ACQUISITION_TRIGGER:case W.WAIT_DSD:{
const t=this.parse_MQTT_Weight(e,"any");if(t){let s={mark:"",sign:"",number:"ERR",decimals:0,auxiliaryDigits:0,unit:"",interval:1,isStable:!0,isSpecial:!0,isWarning:!1,isInvalid:!1};if(t&&g.isNumber(t.value))if(t.value<this.process.appliedTolerances.minimum2.value)s.number="LL";else if(t.value>this.process.appliedTolerances.maximum2.value)s.number="HH";else{s=JSON.parse(e.payload.value.toString()).value}this.mqttHandler.publish(P.MqttTopics.CUSTOMIZED_WEIGHT_DISPLAY_VALUE.replace(P.MQTT_TOPIC_WILDCARD_UNIQUE_ID,v),JSON.stringify(s),{retain:!1})}}}}PROCESS_SAMPLE_WEIGHING_updateProcessLimits(){this.applyProcessProductLimits(this.Metrology.unit,this.Metrology.decimals),
this.batch.product.dynamicTolerances===I.EnumBoolean.ENABLED&&this.batch.product.calculationMode===I.EnumCalculationMode.FROM_TOTAL_MEAN||this.showBargraph(this.process.appliedTolerances.target,this.process.appliedTolerances.minimum1,this.process.appliedTolerances.maximum1,this.process.appliedTolerances.minimum2,this.process.appliedTolerances.maximum2)}PROCESS_SAMPLE_WEIGHING_prepareForNewSample(){this.batch.product.dynamicTolerances===I.EnumBoolean.ENABLED&&this.PROCESS_SAMPLE_WEIGHING_updateProcessLimits(),this.weighingSplitScreen.setText1(p.l("_QAPP002_INFO_PROCESS_WAIT_FOR_STABILITY"),[]),this.weighingSplitScreen.setText2(p.l(""),[]),this.batch.product.autoZero!==I.EnumBoolean.ENABLED&&this.batch.product.prodType!==I.EnumProductType.CAPSULE||(this.lastSelectedWeightApplication=this.weighingProxy.getSelectedDisplayValue().currentSelectedDomain,this.weighingProxy.enableWeightApplication(v,!1),this.batch.product.prodType===I.EnumProductType.CAPSULE&&this.weighingProxy.clearTareAll(),
this.weighingSplitscreenTabInfoImage.setTabImgRefId(U),p.btn.takeover.setAppearance(L.EnumAppearance.HIDDEN),p.btn.clearForReTare.setAppearance(L.EnumAppearance.HIDDEN),this.weighingProxy.setButton(u.WEIGHING_BUTTON_DO_TARE,L.EnumAppearance.ENABLED_SECONDARY),this.hideLoadingScreen()),this.weighingState=W.WAIT_STABILITY_FOR_CLEARING_PAN}PROCESS_SAMPLE_WEIGHING_prepareSampleWeighing(){this.triggerTabletFeeder(!0),this.weighingSplitScreen.setText1(p.l("_QAPP_WF_PLACE_SAMPLE_INFO"),[this.currentSample.counter.toFixed(0),this.process.samples.length.toFixed(0)]),this.weighingSplitscreenTabInfoImage.setTabImgRefId(Q),this.batch.product.dynamicTolerances===I.EnumBoolean.ENABLED&&this.batch.product.calculationMode===I.EnumCalculationMode.FROM_TOTAL_MEAN||(this.weighingProxy.enableWeightApplication(v,!0),0!==this.process.currSmplIndex&&this.lastSelectedWeightApplication!==u.ISelectedWeightDisplayValueDomains.SELECTED_DOMAIN_APP||this.weighingProxy.selectWeightApplication(v)),
this.hideLoadingScreen(),this.weighingState=W.WAIT_ACQUISITION_TRIGGER}PROCESS_SAMPLE_WEIGHING_evaluateAcquiredWeight(e){this.applyProcessProductLimits(e.unit,e.decimals);const t=A.getMetrology(e.unit),s=m.bignumber(t.d).times(this.config.autoTakeoverMinload.value),a=this.config.autoTakeover===I.EnumBoolean.ENABLED?s:t.d;return m.bignumber(e.value).lessThan(a)?(this.weighingState=W.WAIT_ACQUISITION_TRIGGER,!0):m.bignumber(e.value).lessThan(this.process.appliedTolerances.minimumThreshold.value)?(this.PROCESS_SAMPLE_WEIGHING_prepareForNewSample(),!0):m.bignumber(e.value).lessThan(this.process.appliedTolerances.minimumOop.value)?(this.process.counters.minimumOoP+=1,this.process.counters.totalOoP=this.process.counters.minimumOoP+this.process.counters.maximumOoP,this.publishStatisticParameters_Process(this.process.statistics,this.process.counters,this.batch,this.process),this.updateWeighingScreenCounterChart(this.batch,this.process),this.PROCESS_SAMPLE_WEIGHING_prepareForNewSample(),
!0):m.bignumber(e.value).greaterThan(this.process.appliedTolerances.maximumOop.value)?(this.process.counters.maximumOoP+=1,this.process.counters.totalOoP=this.process.counters.minimumOoP+this.process.counters.maximumOoP,this.publishStatisticParameters_Process(this.process.statistics,this.process.counters,this.batch,this.process),this.updateWeighingScreenCounterChart(this.batch,this.process),this.PROCESS_SAMPLE_WEIGHING_prepareForNewSample(),!0):(this.currentSample.weight=e,this.currentSample.timestamp=O.getDateTime("isoTimezone"),this.evaluateSampleResult(this.currentSample),this.calculateProcessStatistics(),this.calculateProcessDispersion(this.batch.product.dynamicTolerances===I.EnumBoolean.DISABLED),this.PROCESS_SAMPLE_WEIGHING_showToleranceMessage(),!1)}PROCESS_SAMPLE_WEIGHING_showToleranceMessage(){let e=""
;if(this.batch.product.dynamicTolerances!==I.EnumBoolean.ENABLED||this.batch.product.calculationMode!==I.EnumCalculationMode.FROM_TOTAL_MEAN)switch(this.currentSample.evaluation){case I.EnumSampleResultStatus.MIN1_VIOLATION:e=p.l("_QAPP_WF_MESSAGEBOX_SMALLER_TOL",["1"]);break;case I.EnumSampleResultStatus.MAX1_VIOLATION:e=p.l("_QAPP_WF_MESSAGEBOX_GREATER_TOL",["1"]);break;case I.EnumSampleResultStatus.MIN2_VIOLATION:e=p.l("_QAPP_WF_MESSAGEBOX_SMALLER_TOL",["2"]);break;case I.EnumSampleResultStatus.MAX2_VIOLATION:e=p.l("_QAPP_WF_MESSAGEBOX_GREATER_TOL",["2"])}if(e.length>0)return this.showMessageBox(E.EnumMessageboxType.WARNING,p.l("_QAPP_WF_MESSAGEBOX_WARNING_TITLE"),e,[]),this.cancelTimer(this.fsmTimers.HIDE_TOLERANCE_VIOLATION_MESSAGEBOX),void(this.fsmTimers.HIDE_TOLERANCE_VIOLATION_MESSAGEBOX=this.addTimer(2500,"HIDE_TOLERANCE_VIOLATION_MESSAGEBOX"));this.PROCESS_SAMPLE_WEIGHING_initializeEnterSampleIDs()}PROCESS_SAMPLE_WEIGHING_initializeEnterSampleIDs(){
if(this.process.currSmplIndex>0&&g.isObject(this.process.samples[this.process.currSmplIndex-1])?this.currentSample.sampleIDs=T.cloneJSON(this.process.samples[this.process.currSmplIndex-1].sampleIDs):this.currentSample.sampleIDs=T.cloneJSON(this.config.sampleIDs),0===this.currentSample.sampleIDs.length)return this.reportTestProcessSample(this.batch,this.currentSample),void this.PROCESS_SAMPLE_WEIGHING_checkForNextOrLastSample();this.currentSampleIDindex=0,this.currentSample.sampleIDs[this.currentSampleIDindex]=A.preManipulateIdentifier(this.currentSample.sampleIDs[this.currentSampleIDindex]),this.openInputText("RESERVED_SAMPLE_ID",this.currentSample.sampleIDs[this.currentSampleIDindex].header,this.currentSample.sampleIDs[this.currentSampleIDindex].value)}PROCESS_SAMPLE_WEIGHING_continueEnterSampleIDs(e){if(this.currentSample.sampleIDs[this.currentSampleIDindex].value=e,this.currentSampleIDindex+1<this.currentSample.sampleIDs.length)return this.currentSampleIDindex++,
this.currentSample.sampleIDs[this.currentSampleIDindex]=A.preManipulateIdentifier(this.currentSample.sampleIDs[this.currentSampleIDindex]),void this.openInputText("RESERVED_SAMPLE_ID",this.currentSample.sampleIDs[this.currentSampleIDindex].header,this.currentSample.sampleIDs[this.currentSampleIDindex].value);this.reportTestProcessSample(this.batch,this.currentSample),this.PROCESS_SAMPLE_WEIGHING_checkForNextOrLastSample()}PROCESS_SAMPLE_WEIGHING_checkForNextOrLastSample(){this.publishStatisticParameters_Process(this.process.statistics,this.process.counters,this.batch,this.process),this.updateWeighingScreenCounterChart(this.batch,this.process),p.btn.result.setAppearance(this.alreadyProcessedSamplesCount>0?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN,!0),this.process.currSmplIndex=-1;for(let e=0;e<this.process.samples.length&&(this.process.currSmplIndex=e,this.process.samples[e].evaluation!==I.EnumSampleResultStatus.PENDING);e++);this.hideLoadingScreen(),
this.process.currSmplIndex>=0&&this.process.samples[this.process.currSmplIndex].evaluation===I.EnumSampleResultStatus.PENDING?this.PROCESS_SAMPLE_WEIGHING_prepareForNewSample():(this.weighingState=W.GOT_DSD,this.lastSelectedWeightApplication=this.weighingProxy.getSelectedDisplayValue().currentSelectedDomain,this.weighingProxy.enableWeightApplication(v,!1),p.btn.takeover.setAppearance(L.EnumAppearance.HIDDEN),p.btn.confirm.setAppearance(L.EnumAppearance.ENABLED_PRIMARY),p.btn.clearForReTare.setAppearance(L.EnumAppearance.HIDDEN),this.weighingProxy.setButton(u.WEIGHING_BUTTON_DO_TARE,L.EnumAppearance.ENABLED_SECONDARY),this.weighingSplitscreenTabInfoImage.setTabImgRefId(F),this.weighingSplitScreen.setText1(p.l("_QAPP002_INFO_PROCESS_ALL_SAMPLES_DONE1"),[]),this.process.status===I.EnumProcessStatus.FINISHED?this.weighingSplitScreen.setText2(""):(this.weighingSplitScreen.setText2(p.l("_QAPP002_INFO_PROCESS_ALL_SAMPLES_DONE2"),[p.btn.confirm.getLabel().id]),
p.btn.confirm.setAppearance(L.EnumAppearance.ENABLED_PRIMARY)))}__________________RESULT_VIEWS__________________(){}SHOW_PROCESS_RESULT(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.SHOW_PROCESS_RESULT.name;if(!e&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,n.EV_HMI_PARAM_CHANGED]);if(!t||!e)return console.log(" ## DEBUG ## "+this.SHOW_PROCESS_RESULT()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t)return p.btn.endProcess=this.createTabscreenButton(l.EnumFontLabels.CANCEL,L.EnumAppearance.HIDDEN),p.btn.newProcess=this.createTabscreenButton(p.l("_QAPP_WF_NEW_BUTTON_LABEL"),L.EnumAppearance.HIDDEN),p.btn.removeLastSample=this.createTabscreenButton(l.EnumFontLabels.DELETE,L.EnumAppearance.HIDDEN),p.btn.docu=this.createTabscreenButton(l.EnumFontLabels.PRINT),p.btn.msgInvalidateYes=this.createMessageButton(p.l("_QAPP_LIB_MBOX_BTN_YES")),p.btn.msgInvalidateNo=this.createMessageButton(p.l("_QAPP_LIB_MBOX_BTN_NO")),
p.btn.msgOk=this.createMessageButton(l.EnumFontLabels.OK),this.SHOW_PROCESS_RESULT_setupTabs(),this.tabScreen.show(),this.hideLoadingScreen(),"";if(g.isString(t)&&"onExit"===t)return this.showLoadingScreen(),this.hidePrintQueue(),this.tabScreen.hide(),this.hideMsgBox(),"";if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.docu.getButtonId())return this.showPrintQueue(),"";if(t.payload.buttonId===p.btn.endProcess.getButtonId())return this.report_clearPrintQueue(),this.workflowState=V.IDLE,!0===this.process.isQuicktest?(e.transition(this,this.MAIN_MENU()),""):(e.transition(this,this.BATCH_MENU()),"");if(t.payload.buttonId===p.btn.newProcess.getButtonId()){const t=T.cloneJSON(this.process);return this.process=I.createProcess(void 0,this.batch),this.process.isQuicktest=t.isQuicktest,this.process.actualCountTarget=t.actualCountTarget,this.process.emptyCapsuleWeight=t.emptyCapsuleWeight,this.workflowState=V.PERFORM_TEST,
e.transition(this,this.INITIALIZE_PROCESS()),""}if(t.payload.buttonId===p.btn.removeLastSample.getButtonId())return void 0===this.lastProcessedSample?"":(this.showMessageBox(E.EnumMessageboxType.QUESTION,"",p.l("_QAPP_LIB_MSG_BOX_QUESTION_INVALIDATE_TEXT",[this.lastProcessedSample.counter.toFixed(0)]),[p.btn.msgInvalidateYes,p.btn.msgInvalidateNo]),"");if(t.payload.buttonId===p.btn.msgInvalidateYes.getButtonId())return this.hideMsgBox(),this.openInputText("INVALIDATION_REASON",p.l("_QAPP_LIB_PARAM_HEADER_RT_INVAL_REASON"),"",1),"";if(t.payload.buttonId===p.btn.msgInvalidateNo.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId===p.btn.msgOk.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId.startsWith(o.BACK_BUTTON_ID)){if(this.workflowState===V.PERFORM_TEST)return e.transition(this,this.PROCESS_SAMPLE_WEIGHING()),"";if(this.workflowState===V.RESULT_LOADED_FINISHED_PROCESS)return e.transition(this,this.SELECT_PROCESS_DATETIMES()),""
}else this.HandleHomeOrLogoutButtons(t)}const s=this.parseParamInput(t);if(s.isHandled&&s.isValid){if("INVALIDATION_REASON"===s.id)return s.rString.length<=0?(this.showMessageBox(E.EnumMessageboxType.WARNING,p.l("_QAPP002_HEADER_INVALID_PARAMETER",[p.l("_QAPP_LIB_PARAM_HEADER_RT_INVAL_REASON",!0)]),p.l("_QAPP002_MESSAGE_MANDATORY_INPUT"),[p.btn.msgOk]),""):(this.lastProcessedSample.invalidated=!0,this.lastProcessedSample.invalidationReason=s.rString,this.report_enqueueInvalidateBlock(!0,this.reportGetSamplePrintItemIdentifierMapID(this.lastProcessedSample),this.lastProcessedSample.invalidationReason),this.calculateProcessStatistics(),this.calculateProcessDispersion(this.batch.product.dynamicTolerances===I.EnumBoolean.DISABLED),this.SHOW_PROCESS_RESULT_setupTabs(),this.hideInput(),"");this.hideInput()}return""}SHOW_PROCESS_RESULT_setupTabs(){this.workflowState===V.RESULT_LOADED_FINISHED_PROCESS?(p.btn.docu.setAppearance(L.EnumAppearance.ENABLED,!0),
this.tabScreen.showBackButton()):this.process.status===I.EnumProcessStatus.FINISHED?(p.btn.endProcess.setAppearance(L.EnumAppearance.ENABLED),p.btn.newProcess.setAppearance(L.EnumAppearance.ENABLED),p.btn.docu.setAppearance(L.EnumAppearance.ENABLED_PRIMARY,!0),this.tabScreen.hideBackButton()):(p.btn.removeLastSample.setAppearance(void 0!==this.lastProcessedSample&&!1===this.lastProcessedSample.invalidated?L.EnumAppearance.ENABLED:L.EnumAppearance.DISABLED,!0),this.tabScreen.showBackButton()),this.tabScreenTabLastSample.topbuttons=["/QAPP/"+p.btn.endProcess.getTopic(),"/QAPP/"+p.btn.newProcess.getTopic(),"/QAPP/"+p.btn.removeLastSample.getTopic(),"/QAPP/"+p.btn.docu.getTopic()];const e=["/QAPP/"+p.btn.endProcess.getTopic(),"/QAPP/"+p.btn.newProcess.getTopic(),"/QAPP/"+p.btn.docu.getTopic()];this.tabScreenTabCounterChart.topbuttons=e,this.tabScreenTabCounterOverview.topbuttons=e,this.tabScreenTabStatistics.topbuttons=e,this.tabScreenTabDispersionChart.topbuttons=e,
this.tabScreenTabStatistics.containerTitle.id=p.l("_QAPP_WF_EVALUTATION_STATISTICS_TITLE"),this.tabScreenTabCounterChart.containerTitle.id=p.l("_QAPP_WF_EVALUTATION_COUNTER_TITLE"),this.tabScreen.clearTabList(),void 0!==this.lastProcessedSample&&this.lastProcessedSample.evaluation!==I.EnumSampleResultStatus.PENDING&&this.workflowState!==V.RESULT_LOADED_FINISHED_PROCESS&&(this.lastProcessedSample.invalidated,this.tabScreenTabLastSample.params=this.SHOW_PROCESS_RESULT_createLastSampleTabParameters(this.lastProcessedSample),this.tabScreen.addParamListTab(this.tabScreenTabLastSample.id,this.tabScreenTabLastSample)),
this.workflowState===V.RESULT_LOADED_FINISHED_PROCESS||this.batch.product.dynamicTolerances===I.EnumBoolean.DISABLED||this.batch.product.dynamicTolerances===I.EnumBoolean.ENABLED&&this.batch.product.calculationMode===I.EnumCalculationMode.AFTER_EACH_SAMPLE||this.batch.product.dynamicTolerances===I.EnumBoolean.ENABLED&&this.batch.product.calculationMode===I.EnumCalculationMode.FROM_TOTAL_MEAN&&this.process.status===I.EnumProcessStatus.FINISHED?(this.tabScreenTabCounterChart.data=this.getCounterChartData(30,this.process.counters),this.tabScreen.addGraphTab(this.tabScreenTabCounterChart.id,this.tabScreenTabCounterChart)):this.tabScreen.addParamListTab(this.tabScreenTabCounterOverview.id,this.tabScreenTabCounterOverview),this.tabScreen.addParamListTab(this.tabScreenTabStatistics.id,this.tabScreenTabStatistics),this.publishStatisticParameters_Process(this.process.statistics,this.process.counters,this.batch,this.process)
;let t=this.batch.product.dynamicTolerances===I.EnumBoolean.DISABLED||this.batch.product.dynamicTolerances===I.EnumBoolean.ENABLED&&this.batch.product.calculationMode===I.EnumCalculationMode.FROM_TOTAL_MEAN&&this.process.status===I.EnumProcessStatus.FINISHED;this.tabScreenTabDispersionChart.data=this.getDispersionChartData(this.process.statistics.dispersion,t),this.tabScreen.addGraphTab(this.tabScreenTabDispersionChart.id,this.tabScreenTabDispersionChart),this.tabScreen.publishTabList()}SHOW_PROCESS_RESULT_createLastSampleTabParameters(e){if(void 0===e||e.evaluation===I.EnumSampleResultStatus.PENDING)return[];let t=[];for(let e=0;e<this.batch.lotIDs.length;e++)t.push(new M.default(this.mqttHandler,this.report_getStringParam("reservedGlobalParameters_lotID"+e.toFixed(0),this.batch.lotIDs[e].title,this.batch.lotIDs[e].header,this.batch.lotIDs[e].value)))
;let s=new M.default(this.mqttHandler,this.report_getQuantityParam("reservedGlobalParameters_sampleNo",p.l("_QAPP_LIB_PARAM_TITLE_SAMPLE_NO"),p.l("_QAPP_LIB_PARAM_HEADER_SAMPLE_NO"),e.counter));s.setParamAppearance(!0===e.invalidated?L.EnumAppearance.ENABLED_INVALID:L.EnumAppearance.ENABLED),t.push(s);for(let a=0;a<e.sampleIDs.length;a++)(s=new M.default(this.mqttHandler,this.report_getStringParam("reservedGlobalParameters_sampleID"+a.toFixed(0),e.sampleIDs[a].title,e.sampleIDs[a].header,e.sampleIDs[a].value))).setParamAppearance(!0===e.invalidated?L.EnumAppearance.ENABLED_INVALID:L.EnumAppearance.ENABLED),t.push(s);(s=new M.default(this.mqttHandler,this.report_getStringParam("reservedGlobalParameters_sampleDatetime",p.l("_QAPP_LIB_PARAM_TITLE_SAMPLE_DATETIME"),p.l("_QAPP_LIB_PARAM_HEADER_SAMPLE_DATETIME"),O.getDateTime("frmt",void 0,e.timestamp,"isoTimezone")))).setParamAppearance(!0===e.invalidated?L.EnumAppearance.ENABLED_INVALID:L.EnumAppearance.ENABLED),t.push(s),
(s=new M.default(this.mqttHandler,this.report_getDSDParam("reservedGlobalParameters_sampleMeasurand",e.weight.alibiId))).setParamAppearance(!0===e.invalidated?L.EnumAppearance.ENABLED_INVALID:L.EnumAppearance.ENABLED),t.push(s),this.batch.product.dynamicTolerances===I.EnumBoolean.ENABLED&&this.batch.product.calculationMode===I.EnumCalculationMode.FROM_TOTAL_MEAN||((s=new M.default(this.mqttHandler,this.report_getStringParam("reservedGlobalParameters_sampleCheck",p.l("_QAPP_WF_CHECK_TITLE"),p.l("_QAPP_WF_CHECK_HEADER"),I.EnumMapSampleResultStatus[e.evaluation]))).setParamAppearance(!0===e.invalidated?L.EnumAppearance.ENABLED_INVALID:L.EnumAppearance.ENABLED),t.push(s)),!0===e.invalidated&&t.push(new M.default(this.mqttHandler,this.report_getStringParam("reservedGlobalParameters_sampleInvalidationReason",p.l("_QAPP_LIB_PARAM_TITLE_RT_INVAL_REASON"),p.l("_QAPP_LIB_PARAM_HEADER_RT_INVAL_REASON"),e.invalidationReason)));let a=[]
;for(let e=0;e<t.length;e++)t[e].setParamAppearance(this.process.status===I.EnumProcessStatus.FINISHED?L.EnumAppearance.DISABLED:t[e].getValue().appearance),a.push(t[e].getPublishedId());return a}SHOW_BATCH_RESULT(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.SHOW_BATCH_RESULT.name;if(!e&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,n.EV_HMI_PARAM_CHANGED]);if(!t||!e)return console.log(" ## DEBUG ## "+this.SHOW_BATCH_RESULT()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t)return this.reportBatchResults(this.batchStatisticsCollector),p.btn.docu=this.createTabscreenButton(l.EnumFontLabels.PRINT),p.btn.msgOk=this.createMessageButton(l.EnumFontLabels.OK),this.SHOW_BATCH_RESULT_setupTabs(),this.tabScreen.show(),this.tabScreen.showBackButton(),this.hideLoadingScreen(),"";if(g.isString(t)&&"onExit"===t)this.showLoadingScreen(),this.hidePrintQueue(),this.tabScreen.hide(),
this.hideMsgBox();else if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.docu.getButtonId())return this.showPrintQueue(),"";if(t.payload.buttonId===p.btn.msgOk.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId.startsWith(o.BACK_BUTTON_ID))switch(this.report_clearPrintQueue(),this.workflowState){case V.RESULT_ACTIVE_BATCH:return e.transition(this,this.BATCH_MENU()),"";case V.RESULT_ACTIVE_BATCH_TIMERANGE:return e.transition(this,this.ENTER_TIME_RANGE()),"";case V.RESULT_ACTIVE_BATCH_SHIFT:return e.transition(this,this.SELECT_SHIFT()),"";case V.RESULT_FINISHED_BATCH:return this.workflowState=V.IDLE,e.transition(this,this.SELECT_BATCH()),""}else this.HandleHomeOrLogoutButtons(t)}return""}SHOW_BATCH_RESULT_setupTabs(){const e=["/QAPP/"+p.btn.docu.getTopic()];this.tabScreenTabBatchOverview.topbuttons=e,this.tabScreenTabStatistics.topbuttons=e,this.tabScreenTabCounterChart.topbuttons=e,
this.tabScreenTabStatistics.containerTitle.id=p.l("_QAPP_WF_LOT_STAT"),this.tabScreenTabCounterChart.containerTitle.id=p.l("_QAPP_WF_LOT_STAT"),this.tabScreen.clearTabList(),this.tabScreen.addParamListTab(this.tabScreenTabBatchOverview.id,this.tabScreenTabBatchOverview),this.tabScreenTabBatchOverview.params=this.SHOW_BATCH_RESULT_createBatchOverviewTabParameters(this.batchStatisticsCollector),this.tabScreen.addParamListTab(this.tabScreenTabStatistics.id,this.tabScreenTabStatistics),this.publishStatisticParameters_Batch(this.batchStatisticsCollector.statistics,this.batchStatisticsCollector.counters,this.batchStatisticsCollector),this.tabScreenTabCounterChart.data=this.getCounterChartData(30,this.batchStatisticsCollector.counters),this.tabScreen.addGraphTab(this.tabScreenTabCounterChart.id,this.tabScreenTabCounterChart),this.tabScreen.publishTabList()}SHOW_BATCH_RESULT_createBatchOverviewTabParameters(e){let t=[]
;for(let s=0;s<e.lotIDs.length;s++)t.push(new M.default(this.mqttHandler,this.report_getStringParam("reservedGlobalParameters_lotID"+s.toFixed(0),e.lotIDs[s].title,e.lotIDs[s].header,e.lotIDs[s].value)));t.push(new M.default(this.mqttHandler,this.report_getStringParam("reservedGlobalParameters_prodID",p.l("_QAPP_WF_PRODUCT_ID_TITLE"),p.l("_QAPP_WF_PRODUCT_ID_HEADER"),e.product.productId))),t.push(new M.default(this.mqttHandler,this.report_getStringParam("reservedGlobalParameters_prodType",p.l("_QAPP_WF_PRODUCT_TYPE_TITLE"),p.l("_QAPP_WF_PRODUCT_TYPE_HEADER"),p.l(I.EnumMapProductType[e.product.prodType],!0)))),t.push(new M.default(this.mqttHandler,this.report_getStringParam("reservedGlobalParameters_prodTestMode",p.l("_QAPP_CFG_TEST_MODE_TITLE"),p.l("_QAPP_CFG_TEST_MODE_HEADER"),p.l(I.EnumMapProductTestType[e.product.prodTestType],!0)))),
t.push(new M.default(this.mqttHandler,this.report_getStringParam("reservedGlobalParameters_prodDynTol",p.l("_QAPP_WF_DYN_TOLERANCE_TITLE"),p.l("_QAPP_WF_DYN_TOLERANCE_HEADER"),p.l(I.EnumMapBooleanYesNo[e.product.dynamicTolerances],!0)))),e.product.dynamicTolerances===I.EnumBoolean.ENABLED&&t.push(new M.default(this.mqttHandler,this.report_getStringParam("reservedGlobalParameters_prodCalcMode",p.l("_QAPP_WF_CALC_MODE_TITLE"),p.l("_QAPP_WF_CALC_MODE_HEADER"),p.l(I.EnumMapCalculationMode[e.product.calculationMode],!0)))),t.push(new M.default(this.mqttHandler,this.report_getQuantityParam("reservedGlobalParameters_prodNominal",p.l("_QAPP_WF_NOMINAL_TITLE"),p.l("_QAPP_WF_NOMINAL_HEADER"),e.product.prodWgtTarget))),t.push(new M.default(this.mqttHandler,this.report_getQuantityParam("reservedGlobalParameters_prodTol1",p.l("_QAPP_WF_MIN_TOL_TITLE"),p.l("_QAPP_WF_TOL_HEADER",["1"]),e.product.prodTolerance1))),
t.push(new M.default(this.mqttHandler,this.report_getQuantityParam("reservedGlobalParameters_prodTol2",p.l("_QAPP_WF_MAX_TOL_TITLE"),p.l("_QAPP_WF_TOL_HEADER",["2"]),e.product.prodTolerance2)));let s=[];for(let e=0;e<t.length;e++)s.push(t[e].getPublishedId());return s}SELECT_SHIFT(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.SELECT_SHIFT.name;if(!e&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.SELECT_SHIFT()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t){this.report_clearPrintQueue(),p.btn.msgNoTestsFound=this.createMessageButton(l.EnumFontLabels.OK),p.btn.msgDbQueryFailed=this.createMessageButton(l.EnumFontLabels.OK),this.selectableListButtons={};let e=[];for(let t=0;t<this.config.shifts.length;t++){const s=this.config.shifts[t].end<this.config.shifts[t].start
;p.btn["RESERVED_BUTTON_SHIFT_"+t.toFixed(0)]=this.createMenuButton(p.l("_QAPP002_BUTTON_SHIFT_SELECTION",[(t+1).toFixed(0),this.config.shifts[t].startTime,this.config.shifts[t].endTime]));const a=new Date,i=1e3*(60*a.getHours()*60+60*a.getMinutes());this.config.shifts[t].start<=i&&(i<this.config.shifts[t].end||s)&&p.btn["RESERVED_BUTTON_SHIFT_"+t.toFixed(0)].setAppearance(L.EnumAppearance.ENABLED_PRIMARY),e.push("/QAPP/"+p.btn["RESERVED_BUTTON_SHIFT_"+t.toFixed(0)].getTopic()),this.selectableListButtons[p.btn["RESERVED_BUTTON_SHIFT_"+t.toFixed(0)].getButtonId()]={button:p.btn["RESERVED_BUTTON_SHIFT_"+t.toFixed(0)],metadata:t}}let t={id:this.IDEXTEND_SCREEN+this.SELECT_SHIFT.name,appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_MENU,containerTitle:{id:p.l("_QAPP002_SCREENTITLE_SELECT_SHIFT"),args:[]},title:r.createEmptyTextStructure(),topbuttons:[],menuType:_.TAB_MENU_TYPE_TOPIC,menubuttons:e,scrollToTop:!1};return this.mainScreen.topLeftButton.setLabel({
id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.mainScreen.setMenuTab(t),this.showScreen(this.mainScreen),this.hideLoadingScreen(),""}if(g.isString(t)&&"onExit"===t)this.showLoadingScreen(),this.mainScreen.hide(),this.hideMsgBox();else if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(this.selectableListButtons.hasOwnProperty(t.payload.buttonId)){this.selectedTimeRangeForResults=T.cloneJSON(this.config.shifts[this.selectableListButtons[t.payload.buttonId].metadata]);const e=this.selectedTimeRangeForResults.end<this.selectedTimeRangeForResults.start;let s=[];for(let t of Object.values(this.processesOverview)){const a=new Date(t.timeEnd),i=1e3*(60*a.getHours()*60+60*a.getMinutes());this.selectedTimeRangeForResults.start<=i&&(i<this.selectedTimeRangeForResults.end||e)&&s.push(t.databaseId)}
return 0===s.length?(this.showMessageBox(E.EnumMessageboxType.INFO,p.l("_QAPP002_HEADER_MISSING_FILTERED_RESULTS"),p.l("_QAPP002_MESSAGE_MISSING_FILTERED_RESULTS"),[p.btn.msgNoTestsFound]),""):(B.loadProcesses(this,"LOAD_SHIFT_PROCESSES",s),"")}if(t.payload.buttonId===p.btn.msgNoTestsFound.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID)return e.transition(this,this.BATCH_MENU()),"";if(t.payload.buttonId===p.btn.msgDbQueryFailed.getButtonId())return this.hideMsgBox(),""}const s=C.parseDatabaseEvent(t);if(!0===s.isHandled){if(!0!==s.success)return C.DatabaseErrorMsg(this,s.result,[p.btn.msgDbQueryFailed]),"";switch(s.context){case"LOAD_SHIFT_PROCESSES":return this.batchStatisticsCollector=this.generateFilteredBatchStatistics(this.batch,Object.values(this.processes)),e.transition(this,this.SHOW_BATCH_RESULT()),""}}return""}ENTER_TIME_RANGE(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.ENTER_TIME_RANGE.name
;if(!e&&t&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,n.EV_HMI_PARAM_CHANGED,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.ENTER_TIME_RANGE()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t){this.report_clearPrintQueue(),p.btn.msgNoTestsFound=this.createMessageButton(l.EnumFontLabels.OK),p.btn.param_startDate=this.createParameterButton(p.l("_QAPP_WF_START_TIME")),p.btn.param_endDate=this.createParameterButton(p.l("_QAPP_WF_END_TIME")),p.btn.param_startDate.setLabelRight({id:O.getDateTime("frmt",this.DATETIME_CONFIGURATION,this.selectedTimeRangeForResults.start,"ms"),args:[]},!0),p.btn.param_endDate.setLabelRight({id:O.getDateTime("frmt",this.DATETIME_CONFIGURATION,this.selectedTimeRangeForResults.end,"ms"),args:[]},!0),p.btn.switchInputType=this.createMenuButton(this.dateTimeSelectionType===K.ENTER_FREE_TIMES?p.l("_QAPP002_BUTTON_TIMERANGE_INPUT"):p.l("_QAPP002_BUTTON_TIMERANGE_SELECTION")),
p.btn.continue=this.createMenuButton(l.EnumFontLabels.OK,this.selectedTimeRangeForResults.end>=this.selectedTimeRangeForResults.start?L.EnumAppearance.ENABLED:L.EnumAppearance.DISABLED),p.btn.msgOk=this.createMessageButton(l.EnumFontLabels.OK),p.btn.msgDbQueryFailed=this.createMessageButton(l.EnumFontLabels.OK);let e={id:this.IDEXTEND_SCREEN+this.ENTER_BATCH_DATA.name,appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_MENU,containerTitle:{id:p.l("_QAPP002_SCREENTITLE_ENTER_TIMERANGE"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:_.TAB_MENU_TYPE_TOPIC,menubuttons:["/QAPP/"+p.btn.param_startDate.getTopic(),"/QAPP/"+p.btn.param_endDate.getTopic()],scrollToTop:!1};this.mainScreen.setMenuTab(e,[p.btn.switchInputType,p.btn.continue]),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else if(g.isString(t)&&"onExit"===t)this.showLoadingScreen(),
this.hideMsgBox(),this.mainScreen.hide();else if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.param_startDate.getButtonId())return this.dateTimeSelectionType===K.ENTER_FREE_TIMES?(this.openInputDateTime(p.btn.param_startDate.getButtonId()+"_param",p.l("_QAPP_WF_START_DATE"),O.getDateTime("s",void 0,this.selectedTimeRangeForResults.start,"ms"),!0,!0),""):(this.dateTimeSelectionType=K.SELECT_START_PROCESS_TIMESTAMP,this.dateOrTimeSelection=Y.SHOW_DATES,e.transition(this,this.SELECT_PROCESS_DATETIMES()),"");if(t.payload.buttonId===p.btn.param_endDate.getButtonId())return this.dateTimeSelectionType===K.ENTER_FREE_TIMES?(this.openInputDateTime(p.btn.param_endDate.getButtonId()+"_param",p.l("_QAPP_WF_END_DATE"),O.getDateTime("s",void 0,this.selectedTimeRangeForResults.end,"ms"),!0,!0),""):(this.dateTimeSelectionType=K.SELECT_END_PROCESS_TIMESTAMP,this.dateOrTimeSelection=Y.SHOW_DATES,e.transition(this,this.SELECT_PROCESS_DATETIMES()),"")
;if(t.payload.buttonId===p.btn.msgDbQueryFailed.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId===p.btn.switchInputType.getButtonId())return this.dateTimeSelectionType===K.ENTER_FREE_TIMES?this.dateTimeSelectionType=K.SELECT_PROCESS_TIMESTAMP:this.dateTimeSelectionType=K.ENTER_FREE_TIMES,p.btn.switchInputType.setLabel({id:this.dateTimeSelectionType===K.ENTER_FREE_TIMES?p.l("_QAPP002_BUTTON_TIMERANGE_INPUT"):p.l("_QAPP002_BUTTON_TIMERANGE_SELECTION"),args:[]}),"";if(t.payload.buttonId===p.btn.continue.getButtonId()){let e=[];for(let t of Object.values(this.processesOverview)){const s=O.getDateTime("ms",void 0,t.timeEnd,"isoTimezone");this.selectedTimeRangeForResults.start<=s&&s<=this.selectedTimeRangeForResults.end&&e.push(t.databaseId)}return 0===e.length?(this.showMessageBox(E.EnumMessageboxType.INFO,p.l("_QAPP002_HEADER_MISSING_FILTERED_RESULTS"),p.l("_QAPP002_MESSAGE_MISSING_FILTERED_RESULTS"),[p.btn.msgNoTestsFound]),
""):(B.loadProcesses(this,"LOAD_FILTERED_PROCESSES",e),"")}if(t.payload.buttonId===p.btn.msgOk.getButtonId()||t.payload.buttonId===p.btn.msgNoTestsFound.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID)return e.transition(this,this.BATCH_MENU()),""}const s=this.parseParamInput(t);if(s.isHandled&&s.isValid){if(this.hideInput(),s.id===p.btn.param_startDate.getButtonId()+"_param")return this.selectedTimeRangeForResults.start=O.getDateTime("ms",void 0,s.rDateTimeISOtimezone,"isoTimezone"),p.btn.param_startDate.setLabelRight({id:O.getDateTime("frmt",this.DATETIME_CONFIGURATION,this.selectedTimeRangeForResults.start,"ms"),args:[]},!0),p.btn.continue.setAppearance(this.selectedTimeRangeForResults.end>=this.selectedTimeRangeForResults.start?L.EnumAppearance.ENABLED:L.EnumAppearance.DISABLED),this.selectedTimeRangeForResults.startDate=O.getDateTime("frmt","dd.mm.yyyy",this.selectedTimeRangeForResults.start,"ms"),
this.selectedTimeRangeForResults.startTime=O.getDateTime("frmt","HH:MM:ss",this.selectedTimeRangeForResults.start,"ms"),"";if(s.id===p.btn.param_endDate.getButtonId()+"_param")return this.selectedTimeRangeForResults.end=O.getDateTime("ms",void 0,s.rDateTimeISOtimezone,"isoTimezone"),p.btn.param_endDate.setLabelRight({id:O.getDateTime("frmt",this.DATETIME_CONFIGURATION,this.selectedTimeRangeForResults.end,"ms"),args:[]},!0),p.btn.continue.setAppearance(this.selectedTimeRangeForResults.end>=this.selectedTimeRangeForResults.start?L.EnumAppearance.ENABLED:L.EnumAppearance.DISABLED),this.selectedTimeRangeForResults.endDate=O.getDateTime("frmt","dd.mm.yyyy",this.selectedTimeRangeForResults.end,"ms"),this.selectedTimeRangeForResults.endTime=O.getDateTime("frmt","HH:MM:ss",this.selectedTimeRangeForResults.end,"ms"),""}const a=C.parseDatabaseEvent(t);if(!0===a.isHandled){if(!0!==a.success)return C.DatabaseErrorMsg(this,a.result,[p.btn.msgDbQueryFailed]),"";switch(a.context){
case"LOAD_FILTERED_PROCESSES":return this.batchStatisticsCollector=this.generateFilteredBatchStatistics(this.batch,Object.values(this.processes)),e.transition(this,this.SHOW_BATCH_RESULT()),""}}return""}SELECT_PROCESS_DATETIMES(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.SELECT_PROCESS_DATETIMES.name;if(!e&&g.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([n.EV_HMI_BTN_CLICKED,h.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.SELECT_PROCESS_DATETIMES()+": Missing argument"),"";if(g.isString(t)&&"onEnter"===t)return this.report_clearPrintQueue(),this.currentStartIndexOfDisplayedListButtons=0,p.btn.nextListBlock=this.createMenuButton("+"+x.toFixed(0),L.EnumAppearance.ENABLED),p.btn.previousListBlock=this.createMenuButton("-"+x.toFixed(0),L.EnumAppearance.ENABLED),p.btn.searchTimestamps=this.createMenuButton(""===this.searchStringTimestamp?l.EnumFontLabels.SEARCH:l.EnumFontLabels.SEARCH_ACTIVE),
p.btn.msgOk=this.createMessageButton(l.EnumFontLabels.OK),p.btn.msgDbQueryFailed=this.createMessageButton(l.EnumFontLabels.OK),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),this.SELECT_PROCESS_DATETIMES_updateSelectionButtons(),this.SELECT_PROCESS_DATETIMES_updateScreen(),"";if(g.isString(t)&&"onExit"===t)return this.showLoadingScreen(),this.mainScreen.hide(),this.hideMsgBox(),"";if(g.isObject(t)&&g.isString(t.type)&&t.type===n.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===p.btn.searchTimestamps.getButtonId())return this.openInputText("SELECT_PROCESS_SEARCH_TIMESTAMP",p.l("_QAPP_LIB_SEARCH_PARAM_HEADER"),this.searchStringTimestamp),"";if(this.selectableListButtons.hasOwnProperty(t.payload.buttonId)){if(this.dateOrTimeSelection===Y.SHOW_DATES)return this.selectedTimeRangeForResults.startDate=this.selectableListButtons[t.payload.buttonId].metadata,this.dateOrTimeSelection=Y.SHOW_TIMES,
this.searchStringTimestamp="",p.btn.searchTimestamps.setLabel({id:""===this.searchStringTimestamp?l.EnumFontLabels.SEARCH:l.EnumFontLabels.SEARCH_ACTIVE,args:[]},!0),this.SELECT_PROCESS_DATETIMES_updateSelectionButtons(),this.SELECT_PROCESS_DATETIMES_updateScreen(),"";if(this.dateOrTimeSelection===Y.SHOW_TIMES){if(this.workflowState===V.RESULT_LOADED_FINISHED_PROCESS)return B.loadProcesses(this,"LOAD_PROCESS",[this.selectableListButtons[t.payload.buttonId].metadata]),"";if(this.workflowState===V.RESULT_ACTIVE_BATCH_TIMERANGE)return this.dateTimeSelectionType===K.SELECT_START_PROCESS_TIMESTAMP?this.selectedTimeRangeForResults.start=O.getDateTime("ms",void 0,this.processesOverview[this.selectableListButtons[t.payload.buttonId].metadata].timeEnd,"isoTimezone"):this.dateTimeSelectionType===K.SELECT_END_PROCESS_TIMESTAMP&&(this.selectedTimeRangeForResults.end=O.getDateTime("ms",void 0,this.processesOverview[this.selectableListButtons[t.payload.buttonId].metadata].timeEnd,"isoTimezone")),
e.transition(this,this.ENTER_TIME_RANGE()),""}}else{if(t.payload.buttonId===p.btn.msgDbQueryFailed.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId===p.btn.msgOk.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId===p.btn.nextListBlock.getButtonId())return this.rejectFastButtonPressSetNextDuration(0),this.currentStartIndexOfDisplayedListButtons+=x,this.SELECT_PROCESS_DATETIMES_updateScreen(),"";if(t.payload.buttonId===p.btn.previousListBlock.getButtonId())return this.rejectFastButtonPressSetNextDuration(0),this.currentStartIndexOfDisplayedListButtons=Math.max(0,this.currentStartIndexOfDisplayedListButtons-x),this.SELECT_PROCESS_DATETIMES_updateScreen(),"";if(t.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID)if(this.dateOrTimeSelection===Y.SHOW_DATES){if(this.workflowState===V.RESULT_LOADED_FINISHED_PROCESS)return e.transition(this,this.BATCH_MENU()),"";if(this.workflowState===V.RESULT_ACTIVE_BATCH_TIMERANGE)return e.transition(this,this.ENTER_TIME_RANGE()),""
}else if(this.dateOrTimeSelection===Y.SHOW_TIMES)return this.dateOrTimeSelection=Y.SHOW_DATES,this.searchStringTimestamp="",p.btn.searchTimestamps.setLabel({id:""===this.searchStringTimestamp?l.EnumFontLabels.SEARCH:l.EnumFontLabels.SEARCH_ACTIVE,args:[]},!0),this.SELECT_PROCESS_DATETIMES_updateSelectionButtons(),this.SELECT_PROCESS_DATETIMES_updateScreen(),""}}const s=this.parseParamInput(t);if(!0===s.isHandled)return!0===s.isValid&&"SELECT_PROCESS_SEARCH_TIMESTAMP"===s.id&&(this.searchStringTimestamp=s.rString,p.btn.searchTimestamps.setLabel({id:""===this.searchStringTimestamp?l.EnumFontLabels.SEARCH:l.EnumFontLabels.SEARCH_ACTIVE,args:[]},!0),this.SELECT_PROCESS_DATETIMES_updateSelectionButtons(),this.SELECT_PROCESS_DATETIMES_updateScreen()),this.hideInput(),"";const a=C.parseDatabaseEvent(t);if(!0===a.isHandled){if(!0!==a.success)return C.DatabaseErrorMsg(this,a.result,[p.btn.msgDbQueryFailed]),"";switch(a.context){case"LOAD_PROCESS":
return Object.keys(this.processes).length<1?(C.DatabaseErrorMsg(this,"Unexpected error: Missing entry for queried process PK!",[p.btn.msgDbQueryFailed]),""):(this.process=Object.values(this.processes)[0],this.reportTestProcessInitial(this.batch,this.process),this.reportTestProcessResult(this.batch,this.process),e.transition(this,this.SHOW_PROCESS_RESULT()),"")}}return""}SELECT_PROCESS_DATETIMES_updateSelectionButtons(){if(this.selectableListButtons={},this.selectableArrayButtonIDs=[],this.currentStartIndexOfDisplayedListButtons=0,this.dateOrTimeSelection===Y.SHOW_DATES){let e={};for(let t of Object.values(this.processesOverview)){const s=O.getDateTime("frmt","yyyy-mm-dd",t.timeEnd,"isoTimezone");e.hasOwnProperty(s)||(e[s]=[]),e[s].push(t.databaseId)}const t=A.sortKeys(e);for(let s=0;s<t.length;s++){const a=this.createMenuButton(t[s],L.EnumAppearance.ENABLED,!1);a.setLabelRight({id:p.l("_QAPP002_PARAMVAL_TESTS"),args:[e[t[s]].length.toFixed(0)]}),
(0===this.searchStringTimestamp.length||t[s].toLowerCase().includes(this.searchStringTimestamp.toLowerCase()))&&(this.selectableListButtons[a.getButtonId()]={button:a,metadata:t[s]},this.selectableArrayButtonIDs.push(a.getButtonId()))}}else if(this.dateOrTimeSelection===Y.SHOW_TIMES){let e={};for(let t of Object.values(this.processesOverview)){const s=O.getDateTime("frmt","yyyy-mm-dd",t.timeEnd,"isoTimezone");let a=O.getDateTime("frmt","HH:MM:ss",t.timeEnd,"isoTimezone");if(s===this.selectedTimeRangeForResults.startDate){let s=1;for(;e.hasOwnProperty(a);)a=a+" ("+(++s).toFixed(0)+")";e[a]=t.databaseId}}const t=A.sortKeys(e);for(let s=0;s<t.length;s++){const a=this.createMenuButton(t[s],L.EnumAppearance.ENABLED,!1);(0===this.searchStringTimestamp.length||t[s].toLowerCase().includes(this.searchStringTimestamp.toLowerCase()))&&(this.selectableListButtons[a.getButtonId()]={button:a,metadata:e[t[s]]},this.selectableArrayButtonIDs.push(a.getButtonId()))}}}
SELECT_PROCESS_DATETIMES_updateScreen(){let e=[];for(let t=this.currentStartIndexOfDisplayedListButtons;t<Math.min(this.currentStartIndexOfDisplayedListButtons+x,this.selectableArrayButtonIDs.length);t++)this.selectableListButtons.hasOwnProperty(this.selectableArrayButtonIDs[t])&&e.push(this.selectableListButtons[this.selectableArrayButtonIDs[t]].button.getJson());let t="";this.dateOrTimeSelection===Y.SHOW_DATES?t=p.l("_QAPP_LIB_SELECT_ITEM",[p.l("_QAPP_WF_DATE",!0)]):this.dateOrTimeSelection===Y.SHOW_TIMES&&(t=p.l("_QAPP_LIB_SELECT_ITEM",[p.l("_QAPP_WF_TIME",!0)]));const s={id:this.IDEXTEND_SCREEN+this.SELECT_PROCESS_DATETIMES.name,appearance:L.EnumAppearance.ENABLED,type:_.EnumTabType.TAB_MENU,containerTitle:{id:t,args:[]},title:{id:"",args:[]},topbuttons:[],menuType:_.TAB_MENU_TYPE_BULK,menuBulkButtons:e,scrollToTop:!1};this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),
this.mainScreen.setMenuTab(s,[p.btn.searchTimestamps]),this.hideLoadingScreen()}onSuspending(){A.storeTaskConfig_DATA_CONTAINER(this.taskHandler,this.config);for(let e of Object.values(this.fsmTimers))this.cancelTimer(e);super.onSuspending()}__________________METHODS__________________(){}HandleHomeOrLogoutButtons(e){p.btn.msg_RESERVED_logout_yes.getButtonId()===p.PROXY_BUTTON_DEFAULT_ID&&(p.btn.msg_RESERVED_logout_yes=this.createMessageButton(p.l("_QAPP002_BUTTON_YES"))),p.btn.msg_RESERVERD_home_yes.getButtonId()===p.PROXY_BUTTON_DEFAULT_ID&&(p.btn.msg_RESERVERD_home_yes=this.createMessageButton(p.l("_QAPP002_BUTTON_YES"))),p.btn.msg_RESERVED_close_no.getButtonId()===p.PROXY_BUTTON_DEFAULT_ID&&(p.btn.msg_RESERVED_close_no=this.createMessageButton(p.l("_QAPP002_BUTTON_NO"))),
"BTN_HOME"===e.payload.buttonId?this.showMessageBox(E.EnumMessageboxType.QUESTION,p.l("_QAPP_LIB_MBOX_HOME_WARNING_TITLE"),p.l("_QAPP_LIB_MBOX_HOME_WARNING_TEXT_top",!0)+"<br>"+p.l("_QAPP_LIB_MBOX_HOME_WARNING_TEXT_mid",[void 0!==this.getTaskName()?this.getTaskName():""])+"<br>"+p.l("_QAPP_LIB_MBOX_HOME_WARNING_TEXT_bottom"),[p.btn.msg_RESERVERD_home_yes,p.btn.msg_RESERVED_close_no]):"BTN_LOGOUT"===e.payload.buttonId?this.showMessageBox(E.EnumMessageboxType.QUESTION,p.l("_QAPP_LIB_MBOX_LOGOUT_WARNING_TITLE"),p.l("_QAPP_LIB_MBOX_LOGOUT_WARNING_TEXT_top",!0)+"<br>"+p.l("_QAPP_LIB_MBOX_LOGOUT_WARNING_TEXT_mid",[void 0!==this.getTaskName()?this.getTaskName():""])+"<br>"+p.l("_QAPP_LIB_MBOX_LOGOUT_WARNING_TEXT_bottom",!0),[p.btn.msg_RESERVED_logout_yes,p.btn.msg_RESERVED_close_no]):e.payload.buttonId===p.btn.msg_RESERVERD_home_yes.getButtonId()?(this.hideMsgBox(),this.suspend()):e.payload.buttonId===p.btn.msg_RESERVED_logout_yes.getButtonId()?(this.hideMsgBox(),this.rememberLogout(),
this.suspend()):e.payload.buttonId===p.btn.msg_RESERVED_close_no.getButtonId()&&this.hideMsgBox()}getCounterChartData(e,t){const s=p.l("_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_OOP_LABEL",!0),a=p.l("_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MIN_2_LABEL",!0),i=p.l("_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MIN_1_LABEL",!0),n=p.l("_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_OK_LABEL",!0),r=p.l("_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MAX_1_LABEL",!0),o=p.l("_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MAX_2_LABEL",!0),E=p.l("_QAPP_LIB_CHART_OCCURENCES_LABEL",!0);return this.getXYbarsChartData([s,a,i,n,r,o],[t.totalOoP.toFixed(0),t.minimum2.toFixed(0),t.minimum1.toFixed(0),t.passed.toFixed(0),t.maximum1.toFixed(0),t.maximum2.toFixed(0)],"","",[{values:[{x:s,y:t.totalOoP}],color:d.EnumColors.GREY,tooltipTitle:E+" "+s},{values:[{x:a,y:t.minimum2}],color:d.EnumColors.RED,tooltipTitle:E+" "+a},{values:[{x:i,y:t.minimum1}],color:d.EnumColors.YELLOW,tooltipTitle:E+" "+i},{values:[{x:n,y:t.passed}],
color:d.EnumColors.GREEN,tooltipTitle:E+" "+n},{values:[{x:r,y:t.maximum1}],color:d.EnumColors.YELLOW,tooltipTitle:E+" "+r},{values:[{x:o,y:t.maximum2}],color:d.EnumColors.RED,tooltipTitle:E+" "+o}],e,!1,!1,!0,!1)}getDispersionChartData(e,t){t=!g.isBoolean(t)||t;const s=p.l("_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MIN_2_LABEL",!0),a=p.l("_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MIN_1_LABEL",!0),i=p.l("_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_OK_LABEL",!0),n=p.l("_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MAX_1_LABEL",!0),r=p.l("_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MAX_2_LABEL",!0),o=p.l("_QAPP_LIB_CHART_OCCURENCES_LABEL",!0);let E=[],_=[];for(let l=0;l<e.levels.length;l++){let c={values:[],color:d.EnumColors.GREY,tooltipTitle:""};switch(e.levels[l].toleranceLevel){case I.EnumToleranceViolation.MIN2_VIOLATION:c.color=t?d.EnumColors.RED:d.EnumColors.GREY,c.tooltipTitle=t?o+" "+s:"";break;case I.EnumToleranceViolation.MIN1_VIOLATION:c.color=t?d.EnumColors.YELLOW:d.EnumColors.GREY,
c.tooltipTitle=t?o+" "+a:"";break;case I.EnumToleranceViolation.OK:c.color=t?d.EnumColors.GREEN:d.EnumColors.GREY,c.tooltipTitle=t?o+" "+i:"";break;case I.EnumToleranceViolation.MAX1_VIOLATION:c.color=t?d.EnumColors.YELLOW:d.EnumColors.GREY,c.tooltipTitle=t?o+" "+n:"";break;case I.EnumToleranceViolation.MAX2_VIOLATION:c.color=t?d.EnumColors.RED:d.EnumColors.GREY,c.tooltipTitle=t?o+" "+r:""}for(let t=0;t<e.levels[l].breakpoints.length;t++)E.push(e.levels[l].breakpoints[t].label),c.values.push({x:e.levels[l].breakpoints[t].label,y:e.levels[l].breakpoints[t].counter});_.push(c)}return this.getXYbarsChartData(E,[],p.l("_QAPP_LIB_CHART_AXIS_LABEL_APPROX",[D.getUnitString(e.unit)]),"",_,95,!1,!0,!0,!0)}getXYbarsChartData(e,t,s,a,i,n,r,o,E,_){let l=(800-n/100*800)/2,c=n/100*800/1.8/(e.length>0?e.length:1),u=[],T=[];for(let t=0;t<i.length;t++){T[t]={backgroundColor:i[t].color,borderColor:i[t].color},u[t]={maxBarThickness:c,data:[],label:i[t].tooltipTitle}
;for(let s=0;s<e.length;s++)u[t].data[s]=0;for(let s=0;s<i[t].values.length;s++)for(let a=0;a<e.length;a++)i[t].values[s].x===e[a]&&(u[t].data[a]=i[t].values[s].y)}let A=[];for(let e=0;e<t.length;e++)A.push("_i18n{ id: '"+t[e]+"', args: []}");return{chartType:"bar",legend:!1,labels:e,datasets:u,colors:T,options:{responsive:!1,showLines:!1,animation:!1,legend:{display:!1},layout:{padding:{left:l,right:l,top:50,bottom:0}},tooltips:{mode:"nearest",intersect:!0,bodyFontFamily:"Roboto Bold",bodyFontSize:12,footerFontFamily:"Roboto Regular",footerFontSize:12,titleFontFamily:"Roboto Regular",titleFontSize:12,callbacks:{title:function(e){return""}}},scales:{xAxes:[{stacked:!0,gridLines:{display:r,drawBorder:!1,drawTicks:!1,lineWidth:2,color:"#e6e6e6"},scaleLabel:{display:s.length>0,labelString:s},ticks:{fontFamily:"Roboto Regular",fontSize:14,display:E,min:0,padding:10,minRotation:0,maxRotation:90}}],yAxes:[{type:"linear",scaleLabel:{display:a.length>0,labelString:a},gridLines:{display:o,
drawBorder:!1,drawTicks:!1,lineWidth:2,color:"#e6e6e6"},ticks:{fontFamily:"Roboto Regular",fontSize:14,padding:10,display:_,min:0,minRotation:0,maxRotation:0,precision:0}}]},qappChartData:{tooltipTitles:[],yAxisTicksUnit:"",labels:A},qappPluginFunction:{beforeDatasetsDraw:function(e){let t=e[0],s=t.chart.ctx,a=t.options.qappChartData,i=t.scales["y-axis-0"],n=t.scales["x-axis-0"],r=n.getPixelForTick(1)-n.getPixelForTick(0)-3;if(a.labels.length>0){let e=t.options.layout.padding.top,l=function(e,t){let a=[];return e.forEach(e=>{a.push(function(e,t){s.save(),s.font=t;let a=s.measureText(e);return s.restore(),a.width}(e,t))}),a.reduce((e,t)=>e>t?e:t)}(a.labels,"14px Roboto Regular");s.save();let u=function(e,t,s){let a,i,n=0,r=e;for(;r>t&&n<90;){let t=c(n);if(a=Math.cos(t),(i=Math.sin(t))*e>s){n--;break}n++,r=a*e}return c(-n)}(l,r,e);a.labels.forEach((e,t)=>{o=e,E=n.getPixelForTick(t),_=i.top-15,u=u,s.save(),s.fillStyle="#666666",s.font="14px Roboto Regular",s.textBaseline="middle",
s.textAlign=0===u?"center":"left",s.translate(0===u?E:E-r/2+3,_),s.rotate(u),s.fillText(o.replace(/&#(\d+);/g,function(e,t){return s.font="14px Roboto Bold",String.fromCharCode(t)}),0,0),s.restore()}),s.restore()}var o,E,_,l;function c(e){return e*(Math.PI/180)}}}}}}applyProcessProductLimits(e,t){const s=this.batch.product;s.dynamicTolerances===I.EnumBoolean.ENABLED&&this.alreadyProcessedSamplesCount>0?this.process.appliedTolerances.target=D.convertToTargetUnit(this.process.statistics.mean,e):this.process.appliedTolerances.target=D.convertToTargetUnit(s.prodWgtTarget,e),this.process.appliedTolerances.target.decimals=t;const a=m.bignumber(this.process.appliedTolerances.target.value);this.process.appliedTolerances.minimumThreshold.value=a.times(m.bignumber(s.prodToleranceThresholdMin.value).dividedBy(100)).toNumber(),this.process.appliedTolerances.minimumThreshold.decimals=t,this.process.appliedTolerances.minimumThreshold.unit=e,
this.process.appliedTolerances.minimumOop.value=a.times(m.bignumber(s.prodTolerancePlausibility.value).dividedBy(100)).toNumber(),this.process.appliedTolerances.minimumOop.decimals=t,this.process.appliedTolerances.minimumOop.unit=e,this.process.appliedTolerances.maximumOop.value=a.times(m.bignumber(200).minus(s.prodTolerancePlausibility.value).dividedBy(100)).toNumber(),this.process.appliedTolerances.maximumOop.decimals=t,this.process.appliedTolerances.maximumOop.unit=e,this.process.appliedTolerances.minimum2.value=a.times(m.bignumber(100).minus(s.prodTolerance2.value).dividedBy(100)).toNumber(),this.process.appliedTolerances.minimum2.decimals=t,this.process.appliedTolerances.minimum2.unit=e,this.process.appliedTolerances.maximum2.value=a.times(m.bignumber(100).plus(s.prodTolerance2.value).dividedBy(100)).toNumber(),this.process.appliedTolerances.maximum2.decimals=t,this.process.appliedTolerances.maximum2.unit=e,
this.process.appliedTolerances.minimum1.value=a.times(m.bignumber(100).minus(s.prodTolerance1.value).dividedBy(100)).toNumber(),this.process.appliedTolerances.minimum1.decimals=t,this.process.appliedTolerances.minimum1.unit=e,this.process.appliedTolerances.maximum1.value=a.times(m.bignumber(100).plus(s.prodTolerance1.value).dividedBy(100)).toNumber(),this.process.appliedTolerances.maximum1.decimals=t,this.process.appliedTolerances.maximum1.unit=e}evaluateSampleResult(e){if(!g.isNumber(e.weight.value))return void(e.evaluation=I.EnumSampleResultStatus.INVALID);const t=D.convertToTargetUnit(this.process.appliedTolerances.minimum1,e.weight.unit),s=D.convertToTargetUnit(this.process.appliedTolerances.maximum1,e.weight.unit),a=D.convertToTargetUnit(this.process.appliedTolerances.minimum2,e.weight.unit),i=D.convertToTargetUnit(this.process.appliedTolerances.maximum2,e.weight.unit)
;m.bignumber(e.weight.value).lessThan(a.value)?e.evaluation=I.EnumSampleResultStatus.MIN2_VIOLATION:m.bignumber(e.weight.value).greaterThan(i.value)?e.evaluation=I.EnumSampleResultStatus.MAX2_VIOLATION:m.bignumber(e.weight.value).lessThan(t.value)?e.evaluation=I.EnumSampleResultStatus.MIN1_VIOLATION:m.bignumber(e.weight.value).greaterThan(s.value)?e.evaluation=I.EnumSampleResultStatus.MAX1_VIOLATION:e.evaluation=I.EnumSampleResultStatus.OK}calculateProcessStatistics(){this.process.counters.passed=0,this.process.counters.minimum2=0,this.process.counters.minimum1=0,this.process.counters.maximum1=0,this.process.counters.maximum2=0,this.process.counters.totalOoP=this.process.counters.minimumOoP+this.process.counters.maximumOoP,this.process.counters.totalOoT=0,this.process.counters.totalPlausible=0,this.process.counters.invalidated=0;const e=A.getMetrology(this.batch.product.preferredUnit);let t=[];this.process.statistics.squareSum.value=0
;for(let e=0;e<this.process.samples.length;e++)if(!0===this.process.samples[e].invalidated)this.process.counters.invalidated++;else{switch(this.process.samples[e].evaluation){case I.EnumSampleResultStatus.MIN2_VIOLATION:this.process.counters.minimum2++,this.process.counters.totalOoT++;break;case I.EnumSampleResultStatus.MIN1_VIOLATION:this.process.counters.minimum1++,this.process.counters.totalOoT++;break;case I.EnumSampleResultStatus.MAX2_VIOLATION:this.process.counters.maximum2++,this.process.counters.totalOoT++;break;case I.EnumSampleResultStatus.MAX1_VIOLATION:this.process.counters.maximum1++,this.process.counters.totalOoT++;break;case I.EnumSampleResultStatus.OK:this.process.counters.passed++}switch(this.process.samples[e].evaluation){case I.EnumSampleResultStatus.MIN2_VIOLATION:case I.EnumSampleResultStatus.MIN1_VIOLATION:case I.EnumSampleResultStatus.MAX2_VIOLATION:case I.EnumSampleResultStatus.MAX1_VIOLATION:case I.EnumSampleResultStatus.OK:{
this.process.counters.totalPlausible++,t.push(this.process.samples[e].weight);let s=D.convertToTargetUnit(this.process.samples[e].weight,this.process.statistics.squareSum.unit);this.process.statistics.squareSum.value=m.bignumber(this.process.statistics.squareSum.value).add(m.bignumber(s.value).pow(2)).toNumber();break}}}this.process.statistics.sum=D.math_Sum(t,this.batch.product.preferredUnit),this.process.statistics.mean=D.math_Mean_Longterm(this.process.statistics.sum,this.process.counters.totalPlausible,this.batch.product.preferredUnit),this.process.statistics.stddev=D.math_Standard_Deviation_Longterm(this.process.counters.totalPlausible,this.process.statistics.sum,this.process.statistics.squareSum,this.batch.product.preferredUnit),this.process.statistics.varcoeff=D.math_Variation_Coefficient_Longterm(this.process.statistics.stddev,this.process.statistics.mean),this.process.statistics.minimum=D.math_Minimum(t,this.batch.product.preferredUnit),
this.process.statistics.maximum=D.math_Maximum(t,this.batch.product.preferredUnit),this.process.statistics.range={value:m.bignumber(this.process.statistics.maximum.value).minus(this.process.statistics.minimum.value).toNumber(),unit:this.process.statistics.maximum.unit,decimals:this.process.statistics.maximum.decimals},this.process.statistics.mean.decimals=e.decimals+1,this.process.statistics.stddev.decimals=e.decimals+1,this.process.statistics.minimum.decimals=e.decimals,this.process.statistics.maximum.decimals=e.decimals,this.process.statistics.range.decimals=e.decimals,this.process.statistics.sum.decimals=e.decimals}calculateProcessDispersion(e){const t=A.getMetrology(this.batch.product.preferredUnit);!0===e?I.initializeDispersionDataset(this.process.statistics.dispersion,this.batch.product.preferredUnit,t.decimals,[D.createQuantity({value:0,unit:t.unit,decimals:t.decimals
}),this.process.appliedTolerances.minimum2,this.process.appliedTolerances.minimum1],[this.process.appliedTolerances.maximum1,this.process.appliedTolerances.maximum2,D.createQuantity({value:3*this.process.appliedTolerances.target.value,unit:this.process.appliedTolerances.target.unit,decimals:this.process.appliedTolerances.target.decimals})]):I.initializeDispersionDataset(this.process.statistics.dispersion,this.batch.product.preferredUnit,t.decimals,[D.createQuantity({value:.5*this.process.statistics.minimum.value,unit:this.process.statistics.minimum.unit,decimals:this.process.statistics.minimum.decimals})],[D.createQuantity({value:1.5*this.process.statistics.maximum.value,unit:this.process.statistics.maximum.unit,decimals:this.process.statistics.maximum.decimals})]);for(let t=0;t<this.process.samples.length;t++)!1===this.process.samples[t].invalidated&&I.determineDispersionClassification(this.process.statistics.dispersion,this.process.samples[t],e)}addTestResultToBatchStatistics(e,t){
e.numberOfTests+=1,e.counters.passed+=t.counters.passed,e.counters.minimum2+=t.counters.minimum2,e.counters.minimum1+=t.counters.minimum1,e.counters.maximum1+=t.counters.maximum1,e.counters.maximum2+=t.counters.maximum2,e.counters.totalOoP+=t.counters.totalOoP,e.counters.totalOoT+=t.counters.totalOoT,e.counters.totalPlausible+=t.counters.totalPlausible,e.counters.invalidated+=t.counters.invalidated,e.counters.minimumOoP+=t.counters.minimumOoP,e.counters.maximumOoP+=t.counters.maximumOoP;const s=D.convertToTargetUnit(t.statistics.squareSum,e.statistics.squareSum.unit);e.statistics.squareSum.value=m.bignumber(e.statistics.squareSum.value).add(s.value).toNumber(),e.statistics.sum=D.math_Sum([e.statistics.sum,t.statistics.sum],e.product.preferredUnit),e.statistics.mean=D.math_Mean_Longterm(e.statistics.sum,e.counters.totalPlausible,e.product.preferredUnit),e.statistics.mean.decimals+=1,
e.statistics.stddev=D.math_Standard_Deviation_Longterm(e.counters.totalPlausible,e.statistics.sum,e.statistics.squareSum,e.product.preferredUnit),e.statistics.stddev.decimals=e.statistics.mean.decimals,e.statistics.varcoeff=D.math_Variation_Coefficient_Longterm(e.statistics.stddev,e.statistics.mean),e.statistics.minimum=D.math_Minimum([e.statistics.minimum,t.statistics.minimum],e.product.preferredUnit),e.statistics.maximum=D.math_Maximum([e.statistics.maximum,t.statistics.maximum],e.product.preferredUnit),e.statistics.range={value:m.bignumber(e.statistics.maximum.value).minus(e.statistics.minimum.value).toNumber(),unit:e.statistics.maximum.unit,decimals:e.statistics.maximum.decimals},e.sumVesselWeights=D.math_Sum([e.sumVesselWeights,t.vessel],e.product.preferredUnit),e.sumCapsuleWeights=D.math_Sum([e.sumCapsuleWeights,t.emptyCapsuleWeight],e.product.preferredUnit)}generateFilteredBatchStatistics(e,t){const s=I.createBatch(e);s.numberOfTests=0,s.counters={minimumOoP:0,minimum2:0,
minimum1:0,passed:0,maximum1:0,maximum2:0,maximumOoP:0,totalPlausible:0,totalOoP:0,totalOoT:0,invalidated:0},s.statistics={sum:D.createQuantity({value:0,unit:D.EnumUnit.GRAM,decimals:0}),squareSum:D.createQuantity({value:0,unit:D.EnumUnit.GRAM,decimals:10}),mean:D.createQuantity({value:NaN,unit:D.EnumUnit.GRAM,decimals:0}),stddev:D.createQuantity({value:NaN,unit:D.EnumUnit.GRAM,decimals:0}),varcoeff:D.createQuantity({value:NaN,unit:D.EnumUnit.PERCENT,decimals:2}),minimum:D.createQuantity({value:1/0,unit:D.EnumUnit.GRAM,decimals:0}),maximum:D.createQuantity({value:-1/0,unit:D.EnumUnit.GRAM,decimals:0}),range:D.createQuantity({value:0,unit:D.EnumUnit.GRAM,decimals:0}),dispersion:{unit:D.EnumUnit.NONE,decimals:0,levels:[]}},s.sumCapsuleWeights=D.createQuantity({value:0,unit:D.EnumUnit.GRAM,decimals:0}),s.sumVesselWeights=D.createQuantity({value:0,unit:D.EnumUnit.GRAM,decimals:0});for(let e of Object.values(t))this.addTestResultToBatchStatistics(s,e);return s}
publishResultParameters_EmptyCapsDetermination10_10_30(){for(let e=0;e<this.tabScreenParametersEmptyCapsWgtSets.length;e++)!0===this.emptyCapsWgtSets[e].done?(this.tabScreenParametersEmptyCapsWgtSets[e].setValue(this.report_getQuantityParam("",p.l("_QAPP_WF_PARAM_CAPSULE_REF_TITLE",[this.emptyCapsWgtSets[e].capsuleCount.toFixed(0),D.getUnitString(D.EnumUnit.PIECES)]),"",this.emptyCapsWgtSets[e].measured)),this.tabScreenParametersEmptyCapsWgtSets[e].setParamAppearance(L.EnumAppearance.ENABLED,!0)):this.tabScreenParametersEmptyCapsWgtSets[e].setParamAppearance(L.EnumAppearance.HIDDEN,!0);this.setWeighingSplitScreenParams(1,p.l("_QAPP_WF_PARAM_CAPSULE_HEADER"),p.l("_QAPP_WF_PARAM_CAPSULE_TITLE"),D.formatQuantityParam(this.process.emptyCapsuleWeight))}updateWeighingScreenCounterChart(e,t){
e.product.dynamicTolerances===I.EnumBoolean.ENABLED&&e.product.calculationMode===I.EnumCalculationMode.FROM_TOTAL_MEAN||this.weighingSplitscreenTabCounterChart.setData(this.getCounterChartData(100,t.counters))}publishStatisticParameters_Process(e,t,s,a){this.globalSubscribeParameters.countTargetNumber.setValue(this.report_getQuantityParam("",p.l("_QAPP_WF_NO_SAMPLES_TITLE"),p.l("_QAPP_WF_NO_SAMPLES_HEADER"),a.actualCountTarget)),this.globalSubscribeParameters.countOop.setValue(this.report_getQuantityParam("",p.l("_QAPP_WF_CNT_PLAUS_TITLE"),p.l("_QAPP_WF_CNT_PLAUS_HEADER"),t.totalOoP)),this.globalSubscribeParameters.countTotal.setValue(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_NUMSAM"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_NUMSAM"),t.totalPlausible)),this.globalSubscribeParameters.emptyCapsuleWeight.setValue(this.report_getQuantityParam("",p.l("_QAPP_WF_PARAM_CAPSULE_TITLE"),p.l("_QAPP_WF_PARAM_CAPSULE_HEADER"),a.emptyCapsuleWeight)),
this.globalSubscribeParameters.mean.setValue(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_AVG"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_AVG"),e.mean)),this.globalSubscribeParameters.stdDev.setValue(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_DEV"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_DEV"),e.stddev)),this.globalSubscribeParameters.varCoeff.setValue(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_VAR"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_VAR"),e.varcoeff)),this.globalSubscribeParameters.sum.setValue(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_SUM"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_SUM"),e.sum)),this.globalSubscribeParameters.minimum.setValue(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_MIN"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_MIN"),e.minimum)),this.globalSubscribeParameters.maximum.setValue(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_MAX"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_MAX"),e.maximum)),
this.globalSubscribeParameters.range.setValue(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_DIFF"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_DIFF"),e.range)),this.globalSubscribeParameters.averageEmptyCapsule.setParamAppearance(L.EnumAppearance.HIDDEN),this.globalSubscribeParameters.averageVessel.setParamAppearance(L.EnumAppearance.HIDDEN),this.globalSubscribeParameters.sum.setParamAppearance(t.totalPlausible>=1?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),this.globalSubscribeParameters.mean.setParamAppearance(t.totalPlausible>=1?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),this.globalSubscribeParameters.minimum.setParamAppearance(t.totalPlausible>=1?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),this.globalSubscribeParameters.maximum.setParamAppearance(t.totalPlausible>=1?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),this.globalSubscribeParameters.range.setParamAppearance(t.totalPlausible>=1?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),
this.globalSubscribeParameters.stdDev.setParamAppearance(t.totalPlausible>=2?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),this.globalSubscribeParameters.varCoeff.setParamAppearance(t.totalPlausible>=2?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),this.globalSubscribeParameters.emptyCapsuleWeight.setParamAppearance(s.product.prodType===I.EnumProductType.CAPSULE?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN)}publishStatisticParameters_Batch(e,t,s){this.globalSubscribeParameters.averageEmptyCapsule.setValue(this.report_getQuantityParam("",p.l("_QAPP_WF_AVG_EMPTY_TITLE"),p.l("_QAPP_WF_PRODUCT_TYPE_OPTION_CAPSULE"),s.meanCapsuleWeights)),this.globalSubscribeParameters.averageVessel.setValue(this.report_getQuantityParam("",p.l("_QAPP_WF_AVG_VESSEL_TITLE"),p.l("_QAPP_WF_AVG_VESSEL_HEADER"),s.meanVesselWeights)),
this.globalSubscribeParameters.countTotal.setValue(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_NUMSAM"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_NUMSAM"),t.totalPlausible)),this.globalSubscribeParameters.mean.setValue(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_AVG"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_AVG"),e.mean)),this.globalSubscribeParameters.stdDev.setValue(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_DEV"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_DEV"),e.stddev)),this.globalSubscribeParameters.varCoeff.setValue(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_VAR"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_VAR"),e.varcoeff)),this.globalSubscribeParameters.sum.setValue(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_SUM"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_SUM"),e.sum)),
this.globalSubscribeParameters.minimum.setValue(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_MIN"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_MIN"),e.minimum)),this.globalSubscribeParameters.maximum.setValue(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_MAX"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_MAX"),e.maximum)),this.globalSubscribeParameters.range.setValue(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_DIFF"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_DIFF"),e.range)),this.globalSubscribeParameters.averageEmptyCapsule.setParamAppearance(s.product.prodType===I.EnumProductType.CAPSULE?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),this.globalSubscribeParameters.averageVessel.setParamAppearance(L.EnumAppearance.ENABLED),this.globalSubscribeParameters.sum.setParamAppearance(t.totalPlausible>=1?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),
this.globalSubscribeParameters.mean.setParamAppearance(t.totalPlausible>=1?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),this.globalSubscribeParameters.minimum.setParamAppearance(t.totalPlausible>=1?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),this.globalSubscribeParameters.maximum.setParamAppearance(t.totalPlausible>=1?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),this.globalSubscribeParameters.range.setParamAppearance(t.totalPlausible>=1?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),this.globalSubscribeParameters.stdDev.setParamAppearance(t.totalPlausible>=2?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN),this.globalSubscribeParameters.varCoeff.setParamAppearance(t.totalPlausible>=2?L.EnumAppearance.ENABLED:L.EnumAppearance.HIDDEN)}triggerTabletFeeder(e){try{this.perform_InternalWebserviceRequest("interfacemanagement",R.RestMethodsINTERFACE_MANAGEMENT.setGPIOPorts,{pin15:!1,pin16:!1,pin17:!1,pin18:!1,pin19:e})}catch(e){console.log(e?e.toString():"")}
!0===e&&setTimeout(function(e){e.triggerTabletFeeder(!1)},500,this)}reportTestProcessInitial(e,t){let s=[];for(let t=0;t<e.lotIDs.length;t++)e.lotIDs[t].value.length>0&&s.push(this.report_getStringParam("",e.lotIDs[t].title,e.lotIDs[t].header,e.lotIDs[t].value));s.push(this.report_getStringParam("",p.l("_QAPP_WF_PRODUCT_ID_TITLE"),p.l("_QAPP_WF_PRODUCT_ID_HEADER"),e.product.productId)),s.push(this.report_getStringParam("",p.l("_QAPP_WF_PRODUCT_TYPE_TITLE"),p.l("_QAPP_WF_PRODUCT_TYPE_HEADER"),p.l(I.EnumMapProductType[e.product.prodType],!0))),s.push(this.report_getStringParam("",p.l("_QAPP_CFG_TEST_MODE_TITLE"),p.l("_QAPP_CFG_TEST_MODE_HEADER"),p.l(I.EnumMapProductTestType[e.product.prodTestType],!0))),s.push(this.report_getQuantityParam("",p.l("_QAPP_WF_NO_SAMPLES_TITLE"),p.l("_QAPP_WF_NO_SAMPLES_HEADER"),this.process.actualCountTarget)),s.push(this.report_getQuantityParam("",p.l("_QAPP_WF_NOMINAL_TITLE"),p.l("_QAPP_WF_NOMINAL_HEADER"),e.product.prodWgtTarget)),
s.push(this.report_getQuantityParam("",p.l("_QAPP_WF_MIN_TOL_TITLE"),p.l("_QAPP_WF_TOL_HEADER",["1"]),e.product.prodTolerance1)),s.push(this.report_getQuantityParam("",p.l("_QAPP_WF_MAX_TOL_TITLE"),p.l("_QAPP_WF_TOL_HEADER",["2"]),e.product.prodTolerance2)),e.product.prodType===I.EnumProductType.CAPSULE&&s.push(this.report_getQuantityParam("",p.l("_QAPP_WF_PARAM_CAPSULE_TITLE"),p.l("_QAPP_WF_PARAM_CAPSULE_HEADER"),t.emptyCapsuleWeight)),s.push(this.report_getTextParam(""," "));let a=p.l("_QAPP_LIB_REPORTING_CATERGORY_INIT",!0);!0===this.process.isQuicktest&&(a=p.l("_QAPP002_PRINTLABEL_QUICKTEST_REPORT_HEADER",!0)),this.report_enqueuePrintBlock(a,s,!1)}reportTestProcessSample(e,t){if(this.config.printSamples===I.EnumBoolean.DISABLED)return;let s=[];if(this.config.printFormatForSamples===I.EnumPrintFormatSample.COMPACT){let a="",i="";if(t.sampleIDs.length>0&&(a=t.sampleIDs[0].value),this.config.printSamplesIndex===I.EnumBoolean.ENABLED&&(i=t.counter.toFixed(0)),
this.config.printSamplesEvaluation===I.EnumBoolean.ENABLED&&(e.product.dynamicTolerances!==I.EnumBoolean.ENABLED||e.product.calculationMode!==I.EnumCalculationMode.FROM_TOTAL_MEAN))switch(t.evaluation){case I.EnumSampleResultStatus.MAX1_VIOLATION:case I.EnumSampleResultStatus.MAX2_VIOLATION:case I.EnumSampleResultStatus.MIN1_VIOLATION:case I.EnumSampleResultStatus.MIN2_VIOLATION:i+=" ("+p.l(I.EnumMapSampleResultStatus[t.evaluation],!0)+")"}s.push(this.report_getQuantityParam("",a,i,t.weight))}else if(this.config.printFormatForSamples===I.EnumPrintFormatSample.STANDARD){this.config.printSamplesIndex===I.EnumBoolean.ENABLED&&s.push(this.report_getStringParam("",p.l("_QAPP_LIB_PARAM_TITLE_SAMPLE_NO"),p.l("_QAPP_LIB_PARAM_HEADER_SAMPLE_NO"),t.counter.toFixed(0)));for(let e=0;e<t.sampleIDs.length;e++)t.sampleIDs[e].value.length>0&&s.push(this.report_getStringParam("",t.sampleIDs[e].title,t.sampleIDs[e].header,t.sampleIDs[e].value));s.push(this.report_getDSD_IDParam("",t.weight)),
this.config.printSamplesEvaluation===I.EnumBoolean.ENABLED&&(e.product.dynamicTolerances===I.EnumBoolean.ENABLED&&e.product.calculationMode===I.EnumCalculationMode.FROM_TOTAL_MEAN||s.push(this.report_getStringParam("",p.l("_QAPP_WF_CHECK_TITLE"),p.l("_QAPP_WF_CHECK_HEADER"),p.l(I.EnumMapSampleResultStatus[t.evaluation],!0))))}this.report_enqueuePrintBlock(p.l("_QAPP_LIB_REPORTING_CATERGORY_COMPONENTS"),s,!1,void 0,void 0,this.reportGetSamplePrintItemIdentifierMapID(t)),this.config.printFormatForSamples===I.EnumPrintFormatSample.STANDARD&&this.report_enqueuePrintBlock(p.l("_QAPP_LIB_REPORTING_CATERGORY_COMPONENTS"),[this.report_getTextParam(""," ")],!1)}reportGetSamplePrintItemIdentifierMapID(e){return"SAMPLE_"+e.counter.toFixed(0)}reportStatisticalResults(e,t,s){let a=[];this.config.printEvaluationCounters===I.EnumBoolean.ENABLED&&(a.push(this.report_getQuantityParam("",p.l("_QAPP_WF_CNT_TOTAL_TITLE"),p.l("_QAPP_WF_CNT_TOTAL_HEADER"),t.totalPlausible)),
a.push(this.report_getQuantityParam("",p.l("_QAPP_WF_CNT_PLAUS_TITLE"),p.l("_QAPP_WF_CNT_PLAUS_HEADER"),t.totalOoP)),a.push(this.report_getQuantityParam("",p.l("_QAPP_WF_CNT_STOL_TITLE",["2"]),p.l("_QAPP_WF_CNT_STOL_HEADER",["2"]),t.minimum2)),a.push(this.report_getQuantityParam("",p.l("_QAPP_WF_CNT_STOL_TITLE",["1"]),p.l("_QAPP_WF_CNT_STOL_HEADER",["1"]),t.minimum1)),a.push(this.report_getQuantityParam("",p.l("_QAPP_WF_CNT_OK_TITLE"),p.l("_QAPP_WF_CNT_OK_HEADER"),t.passed)),a.push(this.report_getQuantityParam("",p.l("_QAPP_WF_CNT_GTOL_TITLE",["1"]),p.l("_QAPP_WF_CNT_GTOL_HEADER",["1"]),t.maximum1)),a.push(this.report_getQuantityParam("",p.l("_QAPP_WF_CNT_GTOL_TITLE",["2"]),p.l("_QAPP_WF_CNT_GTOL_HEADER",["2"]),t.maximum2)),this.config.printStatistics!==I.EnumBoolean.ENABLED&&this.config.printTestEvaluation!==I.EnumBoolean.ENABLED||a.push(this.report_getTextParam(""," ")),this.report_enqueuePrintBlock(p.l("_QAPP_LIB_REPORTING_CATERGORY_RESULT"),a,!1)),
this.config.printStatistics===I.EnumBoolean.ENABLED&&((a=[]).push(...s),this.config.printStatisticsCounter===I.EnumBoolean.ENABLED&&a.push(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_NUMSAM"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_NUMSAM"),t.totalPlausible)),this.config.printStatisticsMean===I.EnumBoolean.ENABLED&&a.push(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_AVG"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_AVG"),e.mean)),this.config.printStatisticsStdDev===I.EnumBoolean.ENABLED&&a.push(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_DEV"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_DEV"),e.stddev)),this.config.printStatisticsVarCoeff===I.EnumBoolean.ENABLED&&a.push(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_VAR"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_VAR"),e.varcoeff)),
this.config.printStatisticsSum===I.EnumBoolean.ENABLED&&a.push(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_SUM"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_SUM"),e.sum)),this.config.printStatisticsMinMax===I.EnumBoolean.ENABLED&&(a.push(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_MIN"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_MIN"),e.minimum)),a.push(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_MAX"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_MAX"),e.maximum))),this.config.printStatisticsRange===I.EnumBoolean.ENABLED&&a.push(this.report_getQuantityParam("",p.l("_QAPP_LIB_PARAM_TITLE_STAT_DIFF"),p.l("_QAPP_LIB_PARAM_HEADER_STAT_DIFF"),e.range)),this.config.printTestEvaluation===I.EnumBoolean.ENABLED&&a.push(this.report_getTextParam(""," ")),this.report_enqueuePrintBlock(p.l("_QAPP_LIB_REPORTING_CATERGORY_STATISTIC"),a,!1))}reportTestProcessResult(e,t){
this.config.printSamples===I.EnumBoolean.ENABLED&&this.config.printFormatForSamples===I.EnumPrintFormatSample.COMPACT&&this.report_enqueuePrintBlock("",[this.report_getTextParam(""," ")],!1),this.reportStatisticalResults(t.statistics,t.counters,[]);let s=[];!1===this.process.isQuicktest&&s.push(this.report_getStringParam("",p.l("_QAPP002_PARAM_TITLE_COUNT_TESTS_OF_LOT"),p.l("_QAPP002_PARAM_HEADER_COUNT_TESTS_OF_LOT"),t.sequenceNumber.toFixed(0))),this.config.printTestEvaluation===I.EnumBoolean.ENABLED&&s.push(this.report_getTextParam("",t.resultText)),s.length>0&&this.report_enqueuePrintBlock(p.l("_QAPP002_PARAM_TITLE_TEST_RESULT"),s,!1)}reportBatchResults(e){let t=[];for(let s=0;s<e.lotIDs.length;s++)e.lotIDs[s].value.length>0&&t.push(this.report_getStringParam("",e.lotIDs[s].title,e.lotIDs[s].header,e.lotIDs[s].value));switch(t.push(this.report_getStringParam("",p.l("_QAPP_WF_PRODUCT_ID_TITLE"),p.l("_QAPP_WF_PRODUCT_ID_HEADER"),e.product.productId)),
t.push(this.report_getStringParam("",p.l("_QAPP_WF_PRODUCT_TYPE_TITLE"),p.l("_QAPP_WF_PRODUCT_TYPE_HEADER"),p.l(I.EnumMapProductType[e.product.prodType],!0))),t.push(this.report_getQuantityParam("",p.l("_QAPP_WF_NOMINAL_TITLE"),p.l("_QAPP_WF_NOMINAL_HEADER"),e.product.prodWgtTarget)),t.push(this.report_getQuantityParam("",p.l("_QAPP_WF_MIN_TOL_TITLE"),p.l("_QAPP_WF_TOL_HEADER",["1"]),e.product.prodTolerance1)),t.push(this.report_getQuantityParam("",p.l("_QAPP_WF_MAX_TOL_TITLE"),p.l("_QAPP_WF_TOL_HEADER",["2"]),e.product.prodTolerance2)),t.push(this.report_getStringParam("",p.l("_QAPP_WF_START_TIME"),p.l("_QAPP_WF_START"),O.getDateTime("frmt",this.DATETIME_CONFIGURATION,e.timeStart,"isoTimezone"))),e.status===I.EnumBatchStatus.ARCHIVED&&t.push(this.report_getStringParam("",p.l("_QAPP_WF_END_TIME"),p.l("_QAPP_WF_END"),O.getDateTime("frmt",this.DATETIME_CONFIGURATION,e.timeEnd,"isoTimezone"))),t.push(this.report_getTextParam(""," ")),
this.report_enqueuePrintBlock(p.l("_QAPP_LIB_REPORTING_CATERGORY_INIT",!0),t,!1),this.workflowState){case V.RESULT_ACTIVE_BATCH_SHIFT:this.report_enqueuePrintBlock("",[this.report_getTextParam("",p.l("_QAPP002_PARAMVAL_INFO_FILTERED_STATISTICS_SHIFT",[this.selectedTimeRangeForResults.startTime,this.selectedTimeRangeForResults.endTime])),this.report_getTextParam(""," ")],!1);break;case V.RESULT_ACTIVE_BATCH_TIMERANGE:this.report_enqueuePrintBlock("",[this.report_getTextParam("",p.l("_QAPP002_PARAMVAL_INFO_FILTERED_STATISTICS_TIMERANGE",[O.getDateTime("frmt",this.DATETIME_CONFIGURATION,this.selectedTimeRangeForResults.start,"ms"),O.getDateTime("frmt",this.DATETIME_CONFIGURATION,this.selectedTimeRangeForResults.end,"ms")])),this.report_getTextParam(""," ")],!1)}t=[],e.product.prodType===I.EnumProductType.CAPSULE&&t.push(this.report_getQuantityParam("",p.l("_QAPP_WF_AVG_EMPTY_TITLE"),p.l("_QAPP_WF_PRODUCT_TYPE_OPTION_CAPSULE"),e.meanCapsuleWeights)),
t.push(this.report_getQuantityParam("",p.l("_QAPP_WF_AVG_VESSEL_TITLE"),p.l("_QAPP_WF_AVG_VESSEL_HEADER"),e.meanVesselWeights)),this.reportStatisticalResults(e.statistics,e.counters,t)}}if(t.QAPP=X,__dirname.endsWith("workflow")){(new X).run()}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(58);t.TabFigure=class extends a.TabBase{constructor(e,t,s,a=!1){super(t,s,a),this.imageUrl={url:""},this.imageId={id:""},this.setTabData(e)}setTabImgRefUrl(e){this.imageUrl.url!==e&&(this.imageUrl.url=e,this.tabData.imgref=this.imageUrl,this.publishIfEnabled())}setTabImgRefId(e){this.imageId.id!==e&&(this.imageId.id=e,this.tabData.imgref=this.imageId,this.publishIfEnabled())}getTabImgRef(){return this.tabData.imgref}getTabData(){return this.tabData}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.functionReplacer=function(e,t){
return"function"==typeof t?t.toString().replace(/(\/\*([\s\S]*?)\*\/)|(\/\/(.*)$)/gm,"").replace(/\s\s+/g,""):t},t.functionReviver=function(e,t){if(""===e)return t;if("string"==typeof t){let e=/function[^\(]*\(([^\)]*)\)[^\{]*\{([^]*)\}/,s=t.match(e);if(s){let e=s[1].split(",").map(function(e){return e.replace(/\s+/,"")});return new Function(...e,s[2])}}return t}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(58),i=s(18);t.TabGraph=class extends a.TabBase{constructor(e,t,s,a=!1){super(t,s,a),this.setTabData(e)}setData(e,t=!0){i.isEqual(this.tabData.data,e)||(this.tabData.data=e,t?this.publishIfEnabled():this.publishPending=!0)}getData(){return this.tabData.data}getTabData(){return this.tabData}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(58),i=s(59);t.TabParamList=class extends a.TabBase{constructor(e,t,s,a=!1){super(t,s,a),this.setTabData(e)}setTabParams(e){
if(this.tabData)if(!i.isITabParamList(this.tabData)||"string"!=typeof e[0]&&0!==e.length){if(!i.isITabBulkParamList(this.tabData)||"object"!=typeof e[0]&&0!==e.length)throw new Error("TabParamList: given type for parameters and mode of tab does not match");this.tabData.bulkParameters.join()!==e.join()&&(this.tabData.bulkParameters=e,this.publishIfEnabled())}else this.tabData.params.join()!==e.join()&&(this.tabData.params=e,this.publishIfEnabled())}getTabParams(){if(this.tabData){if(i.isITabParamList(this.tabData))return this.tabData.params;if(i.isITabBulkParamList(this.tabData))return this.tabData.bulkParameters;throw new Error("TabParamList expected type of tabdata found")}return[]}setTabDisplayHeader(e){this.tabData.displayHeader!==e&&(this.tabData.displayHeader=e,this.publishIfEnabled())}getTabDisplayHeader(){return this.tabData.displayHeader}publishTabParams(){this.publish()}getTabData(){return this.tabData}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{
value:!0});const a=s(58),i=s(59),n=s(13);t.TabMenu=class extends a.TabBase{constructor(e,t,s,a=!1){super(t,s,a),this.setTabData(e)}setTabMenuButtons(e,t=!0){if(this.tabData&&e.length>0)if(console.log("isMenu:"+i.isITabMenu(this.tabData)),console.log("isMenuBulk:"+i.isITabBulkMenu(this.tabData)),console.log("buttons:"+JSON.stringify(e)),i.isITabMenu(this.tabData)&&"string"==typeof e[0])this.tabData.menubuttons.join()!==e.join()&&(this.tabData.menubuttons=e,t&&this.publishIfEnabled());else{if(!i.isITabBulkMenu(this.tabData)||"object"!=typeof e[0])throw new Error("TabMenu: given type for buttons and mode of tab does not match");JSON.stringify(this.tabData.menuBulkButtons)!==JSON.stringify(e)&&(this.tabData.menuBulkButtons=e.map(e=>n.IButtonParameterInterface2IButtonJsonInterface(e)),t&&this.publishIfEnabled())}}getTabMenuButtons(){if(this.tabData){if(i.isITabMenu(this.tabData))return this.tabData.menubuttons
;if(i.isITabBulkMenu(this.tabData))return this.tabData.menuBulkButtons.map(e=>n.IButtonJsonInterface2IButtonParameterInterface(e));throw new Error("TabMenu expected type of tabdata found")}return[]}getTabData(){return this.tabData}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(58),i=s(59);t.TabTable=class extends a.TabBase{constructor(e,t,s,a=!1){super(t,s,a),this.setTabData(e)}setTabMenuButtons(e,t=!0){if(this.tabData&&e.length>0)if(console.log("isTable:"+i.isITabTable(this.tabData)),console.log("isMTableBulk:"+i.isITabBulkTable(this.tabData)),console.log("buttons:"+JSON.stringify(e)),i.isITabTable(this.tabData)&&"string"==typeof e[0])this.tabData.menubuttons.join()!==e.join()&&(this.tabData.menubuttons=e,t&&this.publishIfEnabled());else{if(!i.isITabBulkTable(this.tabData)||"object"!=typeof e[0])throw new Error("TabMTable: given type for buttons and mode of tab does not match")
;JSON.stringify(this.tabData.menuBulkButtons)!==JSON.stringify(e)&&(this.tabData.menuBulkButtons=e,t&&this.publishIfEnabled())}}getTabMenuButtons(){if(this.tabData){if(i.isITabTable(this.tabData))return this.tabData.menubuttons;if(i.isITabBulkTable(this.tabData))return this.tabData.menuBulkButtons;throw new Error("TabTable expected type of tabdata found")}return[]}getTabData(){return this.tabData}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(8),i=s(115),n=s(3),r=s(27),o=s(26),E=s(6),_=s(34),l=s(13),c=s(101),u=s(25),T=s(59),A=s(29),p=s(40),d=s(120),I=s(99),h=s(52),S=s(121),N=s(11),m=s(7),P=s(122),R=s(1),g=s(2),O=s(0),D=s(4),C=s(20),M=s(5),L=s(37),b=s(62);let f,B=s(67);function y(e,t){return void 0!==f?f.l(e,t):e}t.PROXY_BUTTON_DEFAULT_ID="BUTTON_DOES_NOT_EXIST_proxy_default",t.REPORTING_QUEUE_PROCESS_NEXT_ITEM_TOPIC="RESERVED_REPORTING_INTERVAL",t.REPORTING_QUEUE_DONE_EVENT="RESERVED_REPORTING_INTERVAL_DONE",
t.REPORTING_QUEUE_MINIMUM_WAIT_MS=25,t.REPORTING_QUEUE_FAILED_WAIT_MS=100,t.REPORTING_QUEUE_REQUEST_TIMEOUT=1e4,t.PREVENT_AUTO_LOGOUT_INTERVAL_EVENT="RESERVED_PREVENT_AUTO_LOGOUT",t.l=y;let v={},U={get:function(e,s,a){return null!=s&&void 0!==s&&e.hasOwnProperty(s)&&null!=e[s]&&void 0!==e[s]?Reflect.get(e,s,a):void 0!==f?new l.Button(f.mqttHandler,f.mainScreen,{buttonId:t.PROXY_BUTTON_DEFAULT_ID,appearance:O.EnumAppearance.ENABLED,label:{id:"ERR_PXY_BTN",args:[]}}):void 0}};t.btn=new Proxy(v,U);t.wfRunner=class extends i.QAppAdvBase{constructor(e){super(e),this.QAPP_ID="",this.QAPP_TOKEN="",this.IDEXTEND_PARAM="TASK/DYNAMIC_PARAMETER_",this.IDEXTEND_BUTTON="TASK/DYNAMIC_BUTTON_",this.IDEXTEND_BUTTON_MENU="TASK/DYNAMIC_BUTTON_MENU_",this.IDEXTEND_BUTTON_PARAM="TASK/DYNAMIC_BUTTON_PARAM_",this.IDEXTEND_BUTTON_MSG="TASK/DYNAMIC_BUTTON_MSG_",this.IDEXTEND_BUTTON_TAB="TASK/DYNAMIC_BUTTON_TAB_",this.IDEXTEND_BUTTON_WEIGHING="TASK/DYNAMIC_BUTTON_WGH_",
this.IDEXTEND_SCREEN="TASK/DYNAMIC_SCREEN_",this.IDEXTEND_STATE_SCREEN="STATE_SCREEN_",this.DEFAULT_CANCEL_BTN_ID="_CANCEL",this.STATES={},this.STATE_FUNCTIONS=[],this.ENTRY_STATE="",this.SERIAL_NUMBER="",this.MODEL_NAME="",this.DEVICE_ID1="",this.DEVICE_ID2="",this.DEVICE_APPROVED=!1,this.USER={id:"",name:"",display_name:"",description:"",role_id:"",role_name:""},this.IS_SERVICE=!1,this.IS_ADMIN=!1,this.IS_OPERATOR=!1,this.IS_GUEST=!1,this.localizerTextBuffer={},this.weighingScreenButtons=[],this.weighingSplitScreenButtons=[],this.auditTrailProxy=new P.AuditTrailProxy,this.Metrology=A.createMetrology(),this.lastHeartbeatTimestamp=0,this.reportingPrintBlocksQueue=[],this.reportingQueueActive=!1,this.reportingPrintItemIdentifierMap={},this.reportingQueueTimer=void 0,this.bargraphObject={active:!1,updateTimestamp:0,areaCount:1,effectiveMinimum:0,effectiveMaximum:0,min2:0,min1:0,target:0,max1:0,max2:0},this.messageBoxesCache={},this.preventAutoLogoutInterval=void 0,
this.rejectFastButtonPressWaitDuration=650,this.rejectFastButtonPress=!1,this.rejectFastButtonPressUntilTimestamp=0,f=this;let t=this.GET_QAPP_META_DATA();t.hasOwnProperty("qappID")&&(this.QAPP_ID=t.qappID),t.hasOwnProperty("qappToken")&&(this.QAPP_TOKEN=t.qappToken,this.IDEXTEND_PARAM+=this.QAPP_TOKEN+"_",this.IDEXTEND_BUTTON+=this.QAPP_TOKEN+"_",this.IDEXTEND_BUTTON_MENU+=this.QAPP_TOKEN+"_",this.IDEXTEND_BUTTON_PARAM+=this.QAPP_TOKEN+"_",this.IDEXTEND_BUTTON_MSG+=this.QAPP_TOKEN+"_",this.IDEXTEND_BUTTON_WEIGHING+=this.QAPP_TOKEN+"_",this.IDEXTEND_SCREEN+=this.QAPP_TOKEN+"_",this.IDEXTEND_STATE_SCREEN+=this.QAPP_TOKEN+"_",this.DEFAULT_CANCEL_BTN_ID=this.QAPP_TOKEN+"_"+this.DEFAULT_CANCEL_BTN_ID),t.hasOwnProperty("stateScreenFunctions")&&(this.STATE_FUNCTIONS=t.stateScreenFunctions),t.hasOwnProperty("initialStateFunction")&&(this.ENTRY_STATE=this[t.initialStateFunction]()),this.SERIAL_NUMBER=this.getSerialNumber(),this.MODEL_NAME=this.devicInformationProxy.getModelName(),
this.USER=A.get_device_user(),this.IS_SERVICE=this.USER.role_id===b.ACCESS_CONTROL_ROLE_DB_IDS.SERVICE_ROLE_ID,this.IS_ADMIN=this.USER.role_id===b.ACCESS_CONTROL_ROLE_DB_IDS.ADMIN_ROLE_ID||this.IS_SERVICE,this.IS_OPERATOR=this.USER.role_id===b.ACCESS_CONTROL_ROLE_DB_IDS.OPERATOR_ROLE_ID,this.IS_GUEST=this.USER.role_id===b.ACCESS_CONTROL_ROLE_DB_IDS.GUEST_ROLE_ID,this.DATETIME_CONFIGURATION=p.getDateTimeConfiguration(),this.mqttHandler.mqttUpdateEvent$.subscribe(e=>{M.isObject(e)&&M.isObject(e.payload)&&M.isString(e.payload.topic)&&this.handleMqttEventsGlobally(e)});let s=this.perform_InternalWebserviceRequest("deviceinformation",D.RestMethodsDEVICE_INFORMATION.getParameter,{rObject:{},id:"DEVICEINFORMATION/SETUP"});try{let e=JSON.parse(s.rawReturns.rObject),t=M.getObjectByID(e.parameters,"DEVICEINFORMATION/SETUP/ID1");t&&(this.DEVICE_ID1=t.value.string),(t=M.getObjectByID(e.parameters,"DEVICEINFORMATION/SETUP/ID2"))&&(this.DEVICE_ID2=t.value.string)}catch(e){}this.skipLotInput=!0,
this.ignoreSaveWorkstate=!0,this.skipConfigParamAspect=!0,this.suppressGlobalHomeBtnHandling=!0,this.suppressGlobalLogoutBtnHandling=!0,this.constructor_screens(),this.constructor_states()}constructor_screens(){let e=[];this.mainScreen=new d.SingleTabButtonBarScreen(this.mqttHandler,[],{buttonId:this.DEFAULT_CANCEL_BTN_ID,appearance:O.EnumAppearance.ENABLED,label:{id:N.EnumFontLabels.CANCEL,args:[]}}),this.registerScreen(this.mainScreen);let t={id:"",appearance:O.EnumAppearance.ENABLED,containerTitle:{id:"",args:[]},title:{id:"",args:[]},topbuttons:[],type:T.EnumTabType.TAB_MENU,menuType:T.TAB_MENU_TYPE_TOPIC,menubuttons:[],scrollToTop:!1};this.mainScreen.setMenuTab(t),this.paramSelectionScreen=new I.KeyboardScreen(this.mqttHandler,!0),this.registerScreen(this.paramSelectionScreen),this.weighingScreen=new h.WeighingScreen(this.mqttHandler,[]),this.registerScreen(this.weighingScreen),
this.mqttHandler.publish(g.MqttTopics.HMI_ACTIVE_QAPP_SCREEN,'{ "screen":"'+this.weighingScreen.getId()+'" }'),e=[];for(let t=0;t<5;t++)this.weighingScreenButtons[t]=new l.Button(this.mqttHandler,this.weighingScreen,{buttonId:this.IDEXTEND_BUTTON_WEIGHING+t.toFixed(0),appearance:O.EnumAppearance.HIDDEN,label:n.createEmptyTextStructure()}),this.weighingScreenButtons[t].publish(),e.push("/QAPP/"+this.weighingScreenButtons[t].getTopic());this.mqttHandler.publish(this.weighingScreen.getBarButtonId(),JSON.stringify(e)),this.weighingSplitScreen=new S.WeighingSplitScreen(this.mqttHandler,[]),this.registerScreen(this.weighingSplitScreen),e=[];for(let t=0;t<5;t++)this.weighingSplitScreenButtons[t]=new l.Button(this.mqttHandler,this.weighingSplitScreen,{buttonId:this.IDEXTEND_BUTTON_WEIGHING+"SPLIT"+t.toFixed(0),appearance:O.EnumAppearance.HIDDEN,label:n.createEmptyTextStructure()}),this.weighingSplitScreenButtons[t].publish(),e.push("/QAPP/"+this.weighingSplitScreenButtons[t].getTopic())
;this.mqttHandler.publish(this.weighingSplitScreen.getBarButtonId(),JSON.stringify(e)),this.tabScreen=new c.TabScreen(this.mqttHandler),this.registerScreen(this.tabScreen)}constructor_states(){this.STATE_FUNCTIONS.forEach(e=>{try{if(""===this[e]())return;let s=JSON.parse(this[e](void 0,"GET_EVENT_LISTENER"));s.push(r.EV_HMI_BTN_CLICKED,r.EV_HMI_PARAM_CHANGED,E.QAPP_TIMER_EVENT,E.QAPP_INTERVAL_EVENT,E.IMMEDIATE_EVENT),this.STATES[this[e]()]={_onEnter:function(t){t[e](this,"onEnter")},_onExit:function(s){s[e](this,"onExit");for(const e of Object.values(t.btn))try{s.mqttHandler.publish(e.getTopic(),"")}catch(e){}v={},t.btn=new Proxy(v,U);for(let e=0;e<s.weighingScreenButtons.length;e++)s.weighingScreenButtons[e].setAppearance(O.EnumAppearance.HIDDEN);for(let e=0;e<s.weighingSplitScreenButtons.length;e++)s.weighingSplitScreenButtons[e].setAppearance(O.EnumAppearance.HIDDEN);s.hideBargraph()}},s.includes(r.EV_HMI_BTN_CLICKED)&&(this.STATES[this[e]()].EV_HMI_BTN_CLICKED=function(t,s){
t[e](this,s)}),s.includes(r.EV_HMI_PARAM_CHANGED)&&(this.STATES[this[e]()].EV_HMI_PARAM_CHANGED=function(t,s){t[e](this,s)}),s.includes(r.EV_HMI_PARAM_DETAIL)&&(this.STATES[this[e]()].EV_HMI_PARAM_DETAIL=function(t,s){t[e](this,s)}),this.STATES[this[e]()].EV_MQTT_UPDATE=function(t,a){s.includes(o.EV_MQTT_UPDATE)&&t[e](this,a)},s.includes(E.IMMEDIATE_EVENT)&&(this.STATES[this[e]()].IMMEDIATE_EVENT=function(t,s){t[e](this,s)}),s.includes(r.EV_REST_REQUEST)&&(this.STATES[this[e]()].EV_REST_REQUEST=function(t,s){t[e](this,s)}),s.includes(_.MQTT_ADMIN_EVENT)&&(this.STATES[this[e]()].MQTT_ADMIN_EVENT=function(t,s){t[e](this,s)}),s.includes(_.MQTT_ADMIN_EVENT_PACKET_SENT)&&(this.STATES[this[e]()].MQTT_ADMIN_EVENT_PACKET_SENT=function(t,s){t[e](this,s)}),s.includes(E.SIMPLE_EVENT)&&(this.STATES[this[e]()].SIMPLE_EVENT=function(t,s){t[e](this,s)}),s.includes(E.QAPP_SYNC_CALL_DONE_EVENT)&&(this.STATES[this[e]()].QAPP_SYNC_CALL_DONE_EVENT=function(t,s){t[e](this,s)}),
s.includes(E.QAPP_ASYNC_CALL_DONE_EVENT)&&(this.STATES[this[e]()].QAPP_ASYNC_CALL_DONE_EVENT=function(t,s){t[e](this,s)}),s.includes(E.QAPP_ASYNC_CALL_FAIL_EVENT)&&(this.STATES[this[e]()].QAPP_ASYNC_CALL_FAIL_EVENT=function(t,s){t[e](this,s)}),this.STATES[this[e]()].QAPP_TIMER_EVENT=function(t,a){s.includes(E.QAPP_TIMER_EVENT)&&t[e](this,a)},this.STATES[this[e]()].QAPP_INTERVAL_EVENT=function(t,a){s.includes(E.QAPP_INTERVAL_EVENT)&&t[e](this,a)}}catch(e){}})}adaptFsmStates(e){super.adaptFsmStates(e);for(let s of Object.keys(e)){const a=e[s].EV_MQTT_UPDATE,i=e[s].EV_HMI_BTN_CLICKED,n=e[s].QAPP_TIMER_EVENT,r=e[s].QAPP_INTERVAL_EVENT;e[s].EV_MQTT_UPDATE=function(e,t){void 0!==a&&a.call(this,e,t),t&&t.payload&&t.payload.topic===g.MqttTopics.WEIGHING_VALUE_NET&&e.handleBargraphUpdate(t),e.report_handleReportingMessages(t)},e[s].EV_HMI_BTN_CLICKED=function(e,t){if(!0===e.rejectFastButtonPress){
if(p.getDateTime("ms")<e.rejectFastButtonPressUntilTimestamp)return void console.log("wfRunner: Fast button press rejected");e.rejectFastButtonPress=!1}e.rejectFastButtonPress=!0,e.rejectFastButtonPressUntilTimestamp=p.getDateTime("ms")+e.rejectFastButtonPressWaitDuration,void 0!==i&&i.call(this,e,t)},e[s].QAPP_TIMER_EVENT=function(e,t){void 0!==n&&n.call(this,e,t),e.report_handleQueuedPrintBlocks(t)},e[s].QAPP_INTERVAL_EVENT=function(e,s){void 0!==r&&r.call(this,e,s),M.isObject(s)&&M.isString(s.payload)&&s.payload===t.PREVENT_AUTO_LOGOUT_INTERVAL_EVENT&&e.preventAutoLogout("justOnce")}}}postInit(){super.postInit(),this.mqttHandler.subscribe(g.MqttTopics.WEIGHING_VALUE_NET),this.mqttHandler.subscribe(g.MqttTopics.REPORTING_PRINTABLE_VALUE),this.mqttHandler.subscribe(g.MqttTopics.MESSAGE_HANDLER_MESSAGE),this.mqttHandler.subscribe(g.MqttTopics.METROLOGY_APPROVED_FOR_VERIFICATION),this.mqttHandler.subscribe(g.MqttTopics.METROLOGY_RANGES)}handleMqttEventsGlobally(e){
switch(e.payload.topic){case g.MqttTopics.METROLOGY_APPROVED_FOR_VERIFICATION:{const t=JSON.parse(e.payload.value.toString());return void(M.isBoolean(t.isApproved)&&(this.DEVICE_APPROVED=t.isApproved,console.log("wfRunner: Changed approval state")))}case g.MqttTopics.METROLOGY_RANGES:return void this.updateMetrology()}}updateMetrology(){return this.Metrology=A.getMetrology(),this.Metrology.unit!==C.EnumUnit.NONE}onSuspending(){super.onSuspending(),this.showLoadingScreen(),this.hideInput(),this.paramSelectionScreen.hide(),this.weighingScreen.hide(),this.weighingSplitScreen.hide(),this.mainScreen.hide(),this.tabScreen.hide(),this.hideMsgBox(),this.preventAutoLogout("disableConstantly"),this.cancelTimer(this.reportingQueueTimer),this.reportingQueueTimer=void 0,this.mqttHandler.publish(g.MqttTopics.HMI_VISUAL_SCREEN,JSON.stringify({closed:!0})),this.weighingProxy.clearTareAll(),this.mqttHandler.unsubscribeTopics()}_____________________GUI__________________(){}l(e,t){
if(null!=t&&void 0!==t){if(this.localizerTextBuffer.hasOwnProperty(e)||(this.localizerTextBuffer[e]=this.localizerProxy.getText(e)),M.isBoolean(t))return this.localizerTextBuffer[e].valueOf();if(Array.isArray(t)){let s=this.localizerTextBuffer[e].valueOf();for(let e=0;e<t.length;e++)s=s.replace(new RegExp("%arg"+e.toFixed(0)+"%","g"),t[e]);return s}}return e}preloadTextBuffer(e){let t=[];for(let s=0;s<e.length;s++)this.localizerTextBuffer.hasOwnProperty(e[s])||t.push({id:e[s],args:[]});if(t.length<=0)return!0;const s=this.localizerProxy.getTexts(t);if(s.length===e.length){for(let t=0;t<e.length;t++)this.localizerTextBuffer[e[t]]=s[t];return!0}return!1}rejectFastButtonPressSetNextDuration(e){this.rejectFastButtonPress=!0,this.rejectFastButtonPressUntilTimestamp=p.getDateTime("ms")+e}createWeighingScreenButton(e,t,s){let a=n.createEmptyTextStructure();return"string"==typeof t?a.id=t:a=t,a.id=void 0!==a.id?a.id:"",void 0===s&&(s=O.EnumAppearance.ENABLED),
this.weighingScreenButtons[e].setAppearance(s),this.weighingScreenButtons[e].setLabel(a),this.weighingScreenButtons[e].publish(),this.weighingScreenButtons[e]}showBargraph(e,t,s,a,i){void 0!=e?(this.bargraphObject.areaCount=1,this.bargraphObject.effectiveMinimum=0,this.bargraphObject.effectiveMaximum=this.Metrology.max,void 0!==e&&void 0!==t&&void 0!==s&&(M.isNumber(e)?this.bargraphObject.target=e:this.bargraphObject.target=C.convertToTargetUnit(e,this.Metrology.unit).value,M.isNumber(t)?this.bargraphObject.min1=t:this.bargraphObject.min1=C.convertToTargetUnit(t,this.Metrology.unit).value,M.isNumber(s)?this.bargraphObject.max1=s:this.bargraphObject.max1=C.convertToTargetUnit(s,this.Metrology.unit).value,this.bargraphObject.min1<this.bargraphObject.target&&this.bargraphObject.target<this.bargraphObject.max1&&(this.bargraphObject.areaCount=4,
this.bargraphObject.effectiveMinimum=this.bargraphObject.min1<=this.bargraphObject.effectiveMinimum?this.bargraphObject.min1-this.Metrology.d:this.bargraphObject.effectiveMinimum,this.bargraphObject.effectiveMaximum=this.bargraphObject.max1>=this.bargraphObject.effectiveMaximum?this.bargraphObject.max1+this.Metrology.d:this.bargraphObject.effectiveMaximum)),4===this.bargraphObject.areaCount&&void 0!==a&&void 0!==i&&(M.isNumber(a)?this.bargraphObject.min2=a:this.bargraphObject.min2=C.convertToTargetUnit(a,this.Metrology.unit).value,M.isNumber(i)?this.bargraphObject.max2=i:this.bargraphObject.max2=C.convertToTargetUnit(i,this.Metrology.unit).value,this.bargraphObject.min2<this.bargraphObject.min1&&this.bargraphObject.max1<this.bargraphObject.max2&&(this.bargraphObject.areaCount=6,this.bargraphObject.effectiveMinimum=this.bargraphObject.min2<=this.bargraphObject.effectiveMinimum?this.bargraphObject.min2-this.Metrology.d:this.bargraphObject.effectiveMinimum,
this.bargraphObject.effectiveMaximum=this.bargraphObject.max2>=this.bargraphObject.effectiveMaximum?this.bargraphObject.max2+this.Metrology.d:this.bargraphObject.effectiveMaximum)),this.mqttHandler.publish(g.MqttTopics.HMI_CHECKBARGRAPH_STATUS,JSON.stringify({appearance:O.EnumAppearance.ENABLED,areas:this.bargraphObject.areaCount.toFixed(0)})),this.bargraphObject.updateTimestamp=0,this.bargraphObject.active=this.bargraphObject.areaCount>1):this.bargraphObject.areaCount>1&&(this.mqttHandler.publish(g.MqttTopics.HMI_CHECKBARGRAPH_STATUS,JSON.stringify({appearance:O.EnumAppearance.ENABLED,areas:this.bargraphObject.areaCount.toFixed(0)})),this.bargraphObject.updateTimestamp=0,this.bargraphObject.active=!0)}hideBargraph(){this.bargraphObject.active=!1,this.mqttHandler.publish(g.MqttTopics.HMI_CHECKBARGRAPH_STATUS,JSON.stringify({appearance:O.EnumAppearance.HIDDEN,areas:this.bargraphObject.areaCount.toFixed(0)}))}handleBargraphUpdate(e){
if(1==this.bargraphObject.active&&Date.now()-this.bargraphObject.updateTimestamp>200){const t=this.parse_MQTT_Weight(e,"any");if(t){let e={area:1,perc:0},s=0,a=0,i=t.value;if(M.isNumber(i)){switch(this.bargraphObject.areaCount){case 4:i<this.bargraphObject.min1?(e.area=1,s=this.bargraphObject.effectiveMinimum,a=this.bargraphObject.min1):i<this.bargraphObject.target?(e.area=2,s=this.bargraphObject.min1,a=this.bargraphObject.target):i<=this.bargraphObject.max1?(e.area=3,s=this.bargraphObject.target,a=this.bargraphObject.max1):(e.area=4,s=this.bargraphObject.max1,a=this.bargraphObject.effectiveMaximum);break;case 6:i<this.bargraphObject.min2?(e.area=1,s=this.bargraphObject.effectiveMinimum,a=this.bargraphObject.min2):i<this.bargraphObject.min1?(e.area=2,s=this.bargraphObject.min2,a=this.bargraphObject.min1):i<this.bargraphObject.target?(e.area=3,s=this.bargraphObject.min1,a=this.bargraphObject.target):i<=this.bargraphObject.max1?(e.area=4,s=this.bargraphObject.target,
a=this.bargraphObject.max1):i<=this.bargraphObject.max2?(e.area=5,s=this.bargraphObject.max1,a=this.bargraphObject.max2):(e.area=6,s=this.bargraphObject.max2,a=this.bargraphObject.effectiveMaximum)}e.perc=(i-s)/Math.abs(a-s)*100,e.perc=Math.max(e.perc,0),e.perc=Math.min(e.perc,100)}else t.info&&"HIGH"===t.info.toString().toUpperCase()?(i=this.bargraphObject.effectiveMaximum,e.area=this.bargraphObject.areaCount,e.perc=100):(i=this.bargraphObject.effectiveMinimum,e.area=1,e.perc=0);this.mqttHandler.publish(g.MqttTopics.HMI_CHECKBARGRAPH_VALUE,JSON.stringify(e))}this.bargraphObject.updateTimestamp=Date.now()}}createWeighingSplitScreenButton(e,t,s){let a=n.createEmptyTextStructure();return M.isString(t)?a.id=t:a=t,a.id=void 0!==a.id?a.id:"",void 0===s&&(s=O.EnumAppearance.ENABLED),this.weighingSplitScreenButtons[e].setAppearance(s),this.weighingSplitScreenButtons[e].setLabel(a),this.weighingSplitScreenButtons[e].publish(),this.weighingSplitScreenButtons[e]}createParameterButton(e,t){
return this.createButton(this.mainScreen,this.IDEXTEND_BUTTON_PARAM,e,t)}createMenuButton(e,t,s){return this.createButton(this.mainScreen,this.IDEXTEND_BUTTON_MENU,e,t,s)}createMessageButton(e,t){return this.createButton(this.mainScreen,this.IDEXTEND_BUTTON_MSG,e,t)}createTabscreenButton(e,t){return this.createButton(this.tabScreen,this.IDEXTEND_BUTTON_TAB,e,t)}createButton(e,t,s,a,i){let r=n.createEmptyTextStructure();M.isString(s)?r.id=s:r=s,r.id=void 0!==r.id?r.id:"",void 0===a&&(a=O.EnumAppearance.ENABLED),M.isBoolean(i)||(i=!0);let o=t;o+=((r.id.length+1)*Math.floor(100*Math.random()+1)).toString().substring(-4)+Math.floor(p.getDateTime("ms")).toString().substring(-4)+Math.floor(10*Math.random()+1).toString();let E=new l.Button(this.mqttHandler,e,{buttonId:o,appearance:a,label:r});return!0===i&&E.publish(),E}showMessageBox(e,t,s,a,i,n){if(M.isObject(e))return void super.showMessageBox(e);if(e=e,
void 0===t||void 0===s||!Array.isArray(a))return void console.log("wfRunner: showMessageBox: missing arguments");let r=[];for(let e=0;e<a.length;e++)r[e]={appearance:a[e].getAppearance(),label:a[e].getLabel(),id:a[e].getButtonId()};M.isString(t)&&(t={id:t,args:[]}),t=t;let o=[];if(Array.isArray(s))o=s;else{let e="";M.isString(s)&&(e=this.l(s,!0));let t=e.split("<br>");1===t.length&&(t=e.split("\n"));for(var E=0;E<t.length;E++)o.push({id:t[E],args:[]})}i=M.isString(i)&&7===i.length?i:"#FFFFFF",M.isNumber(n)||(n=1),n=n;let _={type:e,title:t,textList:o,buttons:r,backgroundColor:i};this.messageBoxesCache[n]=_,n>=this.getMostPriorMessageBoxIndex()&&this.showMostPriorMessageBox(),console.log("wfRunner: Number of messages in cache: "+Object.keys(this.messageBoxesCache).length)}hideMsgBox(e){if(M.isNumber(e)||(e=1),-1===(e=e))return this.hideMostPriorMessageBox(),void(this.messageBoxesCache={});e===this.getMostPriorMessageBoxIndex()&&this.hideMostPriorMessageBox(),
this.messageBoxesCache.hasOwnProperty(e)&&delete this.messageBoxesCache[e],this.showMostPriorMessageBox(),console.log("wfRunner: Number of messages in cache: "+Object.keys(this.messageBoxesCache).length)}showMostPriorMessageBox(){const e=this.getMostPriorMessageBoxIndex();e>0&&(super.hideMsgBox(),super.showMessageBox(this.messageBoxesCache[e]))}hideMostPriorMessageBox(){super.hideMsgBox()}getMostPriorMessageBoxIndex(){let e=A.sortKeys(this.messageBoxesCache);return e.length>0?parseInt(e[e.length-1]):0}setWeighingScreenParams(e,t,s,a,i,n){return this._setWeighingScreenParams(this.weighingScreen,e,t,s,a,i,n)}setWeighingSplitScreenParams(e,t,s,a,i,n){return this._setWeighingScreenParams(this.weighingSplitScreen,e,t,s,a,i,n)}_setWeighingScreenParams(e,t,s,a,i,r,o){let E=n.createEmptyTextStructure();M.isString(s)?E.id=s:E=s;let _=n.createEmptyTextStructure();M.isString(a)?_.id=a:_=a,M.isString(r)||(r=this.QAPP_TOKEN+"_WGHSCR_PARAM_"+t.toFixed()),M.isBoolean(o)||(o=!1)
;const l=new u.Param(this.mqttHandler,{id:r,header:E,title:_,type:O.EnumParameterTypes.PARAM_STRING,appearance:!0===o?O.EnumAppearance.ENABLED_EDITABLE:O.EnumAppearance.ENABLED,info:{minimum:{length:0},maximum:{length:1/0}},value:{string:i}});return l.publish(),1===t?e.setParam1(l.getPublishedId()):2===t&&e.setParam2(l.getPublishedId()),l}getSplitScreenTabParamList(e){let t={id:this.IDEXTEND_SCREEN+Math.floor(Math.random()*Math.floor(1e6)).toString(),appearance:O.EnumAppearance.ENABLED,type:T.EnumTabType.TAB_PARAMLIST,containerTitle:n.createEmptyTextStructure(),title:n.createEmptyTextStructure(),topbuttons:[],displayHeader:!1,params:[]};for(var s=0;s<e.length;s++){let a=new u.Param(this.mqttHandler,{id:this.IDEXTEND_PARAM+Math.floor(Math.random()*Math.floor(1e5)).toString(),type:O.EnumParameterTypes.PARAM_STRING,appearance:O.EnumAppearance.ENABLED,value:{string:e[s].value},title:{id:e[s].title,args:[]},header:{id:"",args:[]},info:{maximum:{length:NaN},minimum:{length:NaN}}})
;a.publish(),t.params.push(a.getPublishedId())}return t}setSplitScreenTabHeader(e,t){if(e>0)for(let t=0;t<e;t++){let e=this.weighingSplitScreen.getTabApi().getTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+t.toString());e&&void 0!==e||this.addSplitScreenTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+t.toString())}let s=this.IDEXTEND_SCREEN+"SPLITSCREEN_"+e.toString(),a=this.weighingSplitScreen.getTabApi().getTab(s);a&&void 0!==a||(a=this.addSplitScreenTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+e.toString())),(a=a).setTabTitle({id:t,args:[]})}setSplitScreenTabParamList(e,t,s,a,i){if(M.isBoolean(i)||(i=!0),e>0)for(let t=0;t<e;t++){let e=this.weighingSplitScreen.getTabApi().getTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+t.toString());e&&void 0!==e||this.addSplitScreenTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+t.toString())}let r=this.IDEXTEND_SCREEN+"SPLITSCREEN_"+e.toString(),o=this.weighingSplitScreen.getTabApi().getTab(r)
;o&&void 0!==o||(o=this.addSplitScreenTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+e.toString())),o=o;let E=n.createEmptyStringParameter();M.isString(s)?(E.value.string=s,E.info={minimum:{length:NaN},maximum:{length:NaN}}):E=s,E.id=this.IDEXTEND_PARAM+"SPLITSCREEN_"+e.toString()+"_PARAM"+t,E.appearance=O.EnumAppearance.ENABLED,E.title={id:void 0!==a?a:"",args:[]};const _=new u.Param(this.mqttHandler,E);let l=o.getTabParams();l.includes(_.getPublishedId())||l.push(_.getPublishedId()),o.setTabParams(l),!0===i&&o.publishTabParams()}setSplitScreenTabText(e,t,s){if(e>0)for(let t=0;t<e;t++){let e=this.weighingSplitScreen.getTabApi().getTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+t.toString());e&&void 0!==e||this.addSplitScreenTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+t.toString())}let a=this.IDEXTEND_SCREEN+"SPLITSCREEN_"+e.toString(),i=this.weighingSplitScreen.getTabApi().getTab(a);i&&void 0!==i||(i=this.addSplitScreenTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+e.toString())),i=i
;let n=new u.Param(this.mqttHandler,{id:this.IDEXTEND_PARAM+"SPLITSCREEN_"+e.toString()+"_TEXT",type:O.EnumParameterTypes.PARAM_STRING,appearance:O.EnumAppearance.ENABLED,value:{string:t},title:{id:"",args:[]},header:{id:"",args:[]},info:{maximum:{length:NaN},minimum:{length:NaN}}});n.publish();let r=i.getTabParams();r.includes(n.getPublishedId())||r.push(n.getPublishedId()),i.setTabParams(r),void 0!==s&&i.setTabTitle({id:s,args:[]}),i.publishTabParams()}addSplitScreenTab(e,t){let s={id:e,appearance:O.EnumAppearance.ENABLED,type:T.EnumTabType.TAB_PARAMLIST,containerTitle:n.createEmptyTextStructure(),title:n.createEmptyTextStructure(),topbuttons:[],displayHeader:!1,params:[]};return this.weighingSplitScreen.getTabApi().addParamListTab(e,s),this.weighingSplitScreen.getTabApi().publishTabList(),this.weighingSplitScreen.getTabApi().getTab(e)}_____________________PARAMETER_INPUT__________________(){}openESignature(){return this.hideMostPriorMessageBox(),
this.mqttHandler.publish(g.MqttTopics.ESIGNATURE_PERFORM,JSON.stringify({appearance:O.EnumAppearance.ENABLED})),!0}openInputText(e,t,s,a,i){let r=n.createEmptyStringParameter();r.id=e,r.appearance=O.EnumAppearance.ENABLED;let o=n.createEmptyTextStructure();return M.isString(t)?o.id=t:o=t,r.header=o,r.title=o,r.value.string=M.isString(s)?s:"",r.info={minimum:{length:M.isNumber(a)?a:0},maximum:{length:M.isNumber(i)?i:0}},this.mqttHandler.publish(g.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify({appearance:O.EnumAppearance.ENABLED,param:r})),!0}openInputDateTime(e,t,s,a,i){let r=n.createEmptyDateTimeParameter();r.id=e,r.appearance=O.EnumAppearance.ENABLED;let o=n.createEmptyTextStructure();return M.isString(t)?o.id=t:o=t,r.header=o,r.title=o,r.value.timestamp=M.isNumber(s)?s:p.getDateTime("s",void 0,s,"iso"),r.info={isDate:!M.isBoolean(a)||a,isTime:!M.isBoolean(i)||i},this.mqttHandler.publish(g.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify({appearance:O.EnumAppearance.ENABLED,
param:r})),!0}openInputNumber(e,t,s,a,i,r){let o=n.createEmptyQuantityParameter();o.id=e,o.appearance=O.EnumAppearance.ENABLED;let E=n.createEmptyTextStructure();M.isString(t)?E.id=t:E=t,o.header=E,o.title=E;let _={value:0,unit:C.EnumUnit.NONE,decimals:0},l=[];if(M.isNumber(s)?l.push(s.toString()):M.isObject(s)&&(l.push(C.formatQuantityParam_numberOnly(s)),_=s),o.directInput=!0,M.isObject(r)&&r.length>0){r=r;for(let e=0;e<r.length;e++){let t="";M.isNumber(r[e])?t=r[e].toString():M.isObject(r[e])&&(t=C.formatQuantityParam_numberOnly(r[e])),l.indexOf(t)>=0||l.push(t)}l.length>1&&(o.directInput=!1)}return o.value={decimals:_.decimals,preferredDecimals:_.decimals,numbers:l,unit:C.getUnitString(_.unit)},(a=M.isNumber(a)?a:-1/0)>(i=M.isNumber(i)?i:1/0)&&(i=1/0),o.info={minimum:{value:a.toString()},maximum:{value:i.toString()}},this.mqttHandler.publish(g.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify({appearance:O.EnumAppearance.ENABLED,param:o})),!0}openInputSelection(e,t,s,a,i){
let r,o={id:""},E=[];if(!0===(i=!!M.isBoolean(i)&&i)){r=n.createEmptyMultipleSelectionParameter(),void 0!=a&&M.isString(a)&&(a=[a]);for(let e=0;e<a.length;e++)E.push({id:a[e]})}else r=n.createEmptySelectionParameter(),void 0!=a&&(Array.isArray(a)&&a.length>0&&(a=a[0]),o.id=M.isString(a)?a:"");r.id=e,r.appearance=O.EnumAppearance.ENABLED;let _=n.createEmptyTextStructure();M.isString(t)?_.id=t:_=t,r.header=_,r.title=_;let l=[];for(let e=0;e<s.length;e++)if(""!==s[e].id){let t=n.createEmptyTextStructure();M.isString(s[e].text)?t.id=s[e].text:t=s[e].text,null==M.getObjectByID(l,s[e].id)&&l.push({id:s[e].id,text:t,appearance:M.isString(s[e].appearance)?s[e].appearance:O.EnumAppearance.ENABLED})}return r.info={options:l},r.type===O.EnumParameterTypes.PARAM_SELECTION?r.value.selection=o:r.type===O.EnumParameterTypes.PARAM_MULTIPLE_SELECTION&&(r.value.selections=E),this.mqttHandler.publish(g.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify({appearance:O.EnumAppearance.ENABLED,param:r})),!0}
parseParamInput(e){let t="";return M.isObject(e)&&M.isString(e.type)&&e.type===r.EV_HMI_PARAM_CHANGED&&M.isObject(e.payload)&&M.isObject(e.payload.parameter)?{id:t=e.payload.parameter.id,isHandled:!0,get isValid(){if(e.payload.parameter.type===O.EnumParameterTypes.PARAM_STRING){if(M.isObject(e.payload.parameter.value)&&M.isString(e.payload.parameter.value.string))return!0}else if(e.payload.parameter.type===O.EnumParameterTypes.PARAM_SELECTION){if(M.isObject(e.payload.parameter.value)&&M.isObject(e.payload.parameter.value.selection)&&M.isString(e.payload.parameter.value.selection.id)&&M.isObject(e.payload.parameter.value.selection.text))return!0}else if(e.payload.parameter.type===O.EnumParameterTypes.PARAM_MULTIPLE_SELECTION){if(M.isObject(e.payload.parameter.value)&&M.isObject(e.payload.parameter.value.selections)&&Array.isArray(e.payload.parameter.value.selections))return!0}else if(e.payload.parameter.type===O.EnumParameterTypes.PARAM_QUANTITY){
if(M.isObject(e.payload.parameter.value)&&M.isObject(e.payload.parameter.value.numbers)&&M.isString(e.payload.parameter.value.numbers[0])&&M.isNumber(parseFloat(e.payload.parameter.value.numbers[0])))return!0}else if(e.payload.parameter.type===O.EnumParameterTypes.PARAM_DATE_TIME&&M.isObject(e.payload.parameter.value)&&M.isNumber(e.payload.parameter.value.timestamp))return!0;return!1},get rString(){return M.isObject(e.payload.parameter.value)&&M.isString(e.payload.parameter.value.string)?e.payload.parameter.value.string:""},get rInteger(){return M.isObject(e.payload.parameter.value)&&M.isObject(e.payload.parameter.value.numbers)&&M.isString(e.payload.parameter.value.numbers[0])&&M.isNumber(parseInt(e.payload.parameter.value.numbers[0]))?parseInt(e.payload.parameter.value.numbers[0]):NaN},get rFloat(){
return M.isObject(e.payload.parameter.value)&&M.isObject(e.payload.parameter.value.numbers)&&M.isString(e.payload.parameter.value.numbers[0])&&M.isNumber(parseFloat(e.payload.parameter.value.numbers[0]))?parseFloat(e.payload.parameter.value.numbers[0]):NaN},get rSelectionID(){return M.isObject(e.payload.parameter.value)&&M.isObject(e.payload.parameter.value.selection)&&M.isString(e.payload.parameter.value.selection.id)?e.payload.parameter.value.selection.id:""},get rMultipleSelectionIDs(){if(M.isObject(e.payload.parameter.value)&&M.isObject(e.payload.parameter.value.selections)&&Array.isArray(e.payload.parameter.value.selections)){let t=[];for(let s=0;s<e.payload.parameter.value.selections.length;s++)t.push(e.payload.parameter.value.selections[s].id);return t}return[]},get rDateTimeISO(){return M.isObject(e.payload.parameter.value)&&M.isNumber(e.payload.parameter.value.timestamp)?p.getDateTime("iso",void 0,e.payload.parameter.value.timestamp,"s"):p.getDateTime("iso",void 0,0)},
get rDateTimeISOtimezone(){return M.isObject(e.payload.parameter.value)&&M.isNumber(e.payload.parameter.value.timestamp)?p.getDateTime("isoTimezone",void 0,e.payload.parameter.value.timestamp,"s"):p.getDateTime("isoTimezone",void 0,0)},get rDateTimeSeconds(){return M.isObject(e.payload.parameter.value)&&M.isNumber(e.payload.parameter.value.timestamp)?e.payload.parameter.value.timestamp:0}}:{id:"",isHandled:!1,isValid:!1,get rString(){return""},get rInteger(){return 0},get rFloat(){return 0},get rSelectionID(){return""},get rMultipleSelectionIDs(){return[]},get rDateTimeISO(){return p.getDateTime("iso",void 0,0)},get rDateTimeISOtimezone(){return p.getDateTime("isoTimezone",void 0,0)},get rDateTimeSeconds(){return 0}}}hideInput(){this.mqttHandler.publish(g.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify({appearance:O.EnumAppearance.HIDDEN,param:{}}))}_____________________EVENT_HANDLING__________________(){}parse_MQTT_Weight(e,t){void 0===t&&(t="any");let s=null
;e&&e.payload&&e.payload.value&&(s=JSON.parse(e.payload.value.toString()));let a=!1,i=!1,n=!1,r={value:NaN,unit:C.EnumUnit.NONE,decimals:0,timestamp:p.getDateTime("ms"),deviceserial:this.SERIAL_NUMBER};if(s&&s.alibiId&&s.alibiId>0&&e.payload.topic&&e.payload.topic===g.MqttTopics.REPORTING_PRINTABLE_VALUE){if("STABLE"!==s.state)return null;if(r.alibiId=s.alibiId,s.hasOwnProperty("weightBlock")&&s.weightBlock.length>0&&s.weightBlock[0].hasOwnProperty("value")&&(r.value=parseFloat(s.weightBlock[0].value.number),M.isNumber(r.value)||(r.info=s.weightBlock[0].value.number),M.isNumber(r.value)&&"-"===s.weightBlock[0].value.sign&&(r.value*=-1),r.decimals=s.weightBlock[0].value.decimals,r.unit=L.UnitEnum_Lib2Api(s.weightBlock[0].value.unit),r.stable=s.weightBlock[0].value.isStable,a=s.weightBlock[0].value.isSpecial,i=s.weightBlock[0].value.isInvalid,n=s.weightBlock[0].value.isWarning,M.isNumber(r.value))){if(r.alibi=C._formatQuantityParam_numberOnly(r.value,r.decimals),
M.isNumber(s.weightBlock[0].value.auxiliaryDigits)&&s.weightBlock[0].value.auxiliaryDigits>0){r.auxiliaryDigits=s.weightBlock[0].value.auxiliaryDigits;let e=r.alibi.length-(s.weightBlock[0].value.auxiliaryDigits+(s.weightBlock[0].value.auxiliaryDigits>r.decimals?1:0)),t=r.alibi.substring(0,e)+"[";r.alibi=t+r.alibi.substring(e)+"]"}r.stable&&(r.alibi+=" "+C.getUnitString(r.unit))}}else if(s&&s.id&&s.id==g.MqttTopics.WEIGHING_WEIGHT_BLOCK){if(s.hasOwnProperty("parameters")&&s.parameters.length>0)for(var o=0;o<s.parameters.length;o++)if(s.parameters[o].id&&s.parameters[o].id==g.MqttTopics.WEIGHING_WEIGHT_BLOCK+"/ORIGINAL"&&s.parameters[o].parameters&&s.parameters[o].parameters.length>0){r.value=parseFloat(s.parameters[o].parameters[0].value.number),M.isNumber(r.value)||(r.info=s.parameters[o].parameters[0].value.number),M.isNumber(r.value)&&"-"===s.parameters[o].parameters[0].value.sign&&(r.value*=-1),r.decimals=s.parameters[o].parameters[0].value.decimals,
r.unit=L.UnitEnum_Lib2Api(s.parameters[o].parameters[0].value.unit),r.stable=s.parameters[o].parameters[0].value.isStable,M.isNumber(s.parameters[o].parameters[0].value.auxiliaryDigits)&&s.parameters[o].parameters[0].value.auxiliaryDigits>0&&(r.auxiliaryDigits=s.parameters[o].parameters[0].value.auxiliaryDigits),a=s.parameters[o].parameters[0].value.isSpecial,i=s.parameters[o].parameters[0].value.isInvalid,n=s.parameters[o].parameters[0].value.isWarning;break}}else s&&s.id&&[g.MqttTopics.WEIGHING_VALUE_NET,g.MqttTopics.WEIGHING_VALUE_GROSS,g.MqttTopics.WEIGHING_VALUE_TARE,g.MqttTopics.WEIGHING_VALUE_TARE1,g.MqttTopics.WEIGHING_VALUE_TARE2].indexOf(s.id)>=0&&s.hasOwnProperty("value")&&(r.value=parseFloat(s.value.number),M.isNumber(r.value)||(r.info=s.value.number),M.isNumber(r.value)&&"-"===s.value.sign&&(r.value*=-1),r.decimals=s.value.decimals,r.unit=L.UnitEnum_Lib2Api(s.value.unit),r.stable=s.value.isStable,
M.isNumber(s.value.auxiliaryDigits)&&s.value.auxiliaryDigits>0&&(r.auxiliaryDigits=s.value.auxiliaryDigits),a=s.value.isSpecial,i=s.value.isInvalid,n=s.value.isWarning);return a&&M.isNumber(r.value)&&(r.info=r.value.toString(),r.value=Number.NaN),"any"!==t&&!M.isNumber(r.value)||("valid"===t||"alibi"===t)&&(a||i)?null:"alibi"===t&&(n||void 0===r.alibiId||r.alibiId<0)?null:r}parse_MQTT_WebserviceRequest(e){if(!e||!e.payload)return;let t={isSuccess:!0,error:"",statusCode:0,headers:{},body:null,url:"",metadata:""};if(t.metadata=M.isString(e.payload.metadata)?e.payload.metadata:"",void 0===e.payload.result)return t.isSuccess=!1,t.error="Missing WebserviceRequest Promise data",t;try{t.isSuccess=!0===e.payload.result.isSuccess,t.error=e.payload.result.error.toString(),t.statusCode=1*e.payload.result.statusCode,t.headers=e.payload.result.headers,t.body=e.payload.result.body,t.url=e.payload.result.url.toString()}catch(e){return t.isSuccess=!1,
t.error="Malformated WebserviceRequest Promise data",t}return t.isSuccess&&M.isString(e.payload.sourceState)&&e.payload.sourceState!==this.getCurrentState()?void 0:(t.isSuccess&&t.statusCode>=300&&(t.isSuccess=!1,t.error="Server responded with status code: "+t.statusCode),t)}parse_MQTT_ESignature(e){if(M.isObject(e)&&M.isString(e.type)&&e.type===o.EV_MQTT_UPDATE&&M.isObject(e)&&M.isObject(e.payload)&&e.payload.topic===g.MqttTopics.ESIGNATURE_RESULT){let t=JSON.parse(e.payload.value.toString());return this.showMostPriorMessageBox(),{isHandled:!0,signatureSucessful:t.signatureSucessful,hasUserPassword:t.hasUserPassword}}return{isHandled:!1,signatureSucessful:!1,hasUserPassword:!1}}_____________________REPORTING__________________(){}report_clearPrintQueue(){return this.reportingQueueActive=!1,this.reportingPrintBlocksQueue=[],this.reportingPrintItemIdentifierMap={},this.reportingProxy.clearPrintQueue().isSuccess()}report_getTitleHeaderValue(e,t,s){return this.report_getKeyValuePair(t,s,e)
}report_getValueString(e){return this.report_getKeyValuePair("","",e)}report_getTitleValue(e,t){return this.report_getKeyValuePair("",t,e)}report_getKeyValuePair(e,t,s){let a;return null!=s&&void 0!==s&&""!==s||(s=" "),null!=e&&void 0!==e&&""!==e||(e=" "),(a=M.isString(t)?this.report_getStringParam("",s,e,t):M.isObject(t)&&M.isNumber(t.value)&&M.isNumber(t.decimals)?this.report_getMeasureParam("",s,e,t):this.report_getStringParam("",s,e,"N.A.")).appearance=O.EnumAppearance.ENABLED,a}report_getStringParam(e,t,s,a){let i=n.createEmptyStringParameter();return null!=t&&void 0!==t&&""!==t||(t=" "),null!=s&&void 0!==s&&""!==s||(s=" "),i.id=e,i.title.id=t,i.header.id=s,i.value.string=a,i.info={minimum:{length:0},maximum:{length:1e6}},i.appearance=O.EnumAppearance.ENABLED,i}report_getDateTimeParam(e,t,s){let a=n.createEmptyDateTimeParameter();return t=M.isString(t)?t.length>0?t:" ":y("_QAPP_LIB_PARAM_TITLE_SAMPLE_DATETIME"),a.id=e,a.title.id=t,a.value.timestamp=s,
a.appearance=O.EnumAppearance.ENABLED,a}report_getTextParam(e,t){let s=n.createEmptyTextParameter();return s.id=e,s.info.suppressTitle=!0,s.title.id=" ",s.header.id=" ",s.value.text.id=t,s.appearance=O.EnumAppearance.ENABLED,s}report_getDSDParam(e,t){let s=this.report_getTextParam(e,"WRONG DSD FORMAT"),a=-1;if(M.isNumber(t)?a=t:M.isObject(t)&&M.isNumber(t.value)&&(a=t.alibiId),M.isNumber(a)&&a>0){let t=this.reportingProxy.getAlibiRecord(a);s=t.isSuccess()?this.reportingProxy.getWeightFromAlibi(t):this.report_getTextParam(e,"MISSING DSD ENTRY ("+a.toFixed(0)+")")}return s.id=e,s.appearance=O.EnumAppearance.ENABLED,s}report_getDSD_IDParam(e,t){let s=this.report_getTextParam(e,"WRONG DSD FORMAT"),a=-1;return M.isNumber(t)?a=t:M.isObject(t)&&M.isNumber(t.value)&&(a=t.alibiId),M.isNumber(a)&&a>0&&(this.reportingProxy.getAlibiRecord(a).isSuccess()?(s=n.createEmptyAlibiIdentifier()).value.alibiIdentifier=a:s=this.report_getTextParam(e,"MISSING DSD ENTRY ("+a.toFixed(0)+")")),s.id=e,
s.appearance=O.EnumAppearance.ENABLED,s}report_getQuantityParam(e,t,s,a){let i=n.createEmptyQuantityParameter();return null!=t&&void 0!==t&&""!==t||(t=" "),null!=s&&void 0!==s&&""!==s||(s=" "),i.id=e,i.title.id=t,i.header.id=s,M.isNumber(a)?(i.value.numbers[0]=a.toFixed(0),i.value.decimals=0,i.value.preferredDecimals=0,i.value.unit=" "):M.isObject(a)&&M.isNumber(a.value)&&(a=a,i.value.numbers[0]=C.formatQuantityParam_numberOnly(a),i.value.decimals=a.decimals,i.value.preferredDecimals=a.decimals,i.value.unit=" "+C.getUnitString(a.unit)),i.appearance=O.EnumAppearance.ENABLED,i}report_getMeasureParam(e,t,s,a){let i=n.createEmptyMeasureParameter();return null!=t&&void 0!==t&&""!==t||(t=" "),null!=s&&void 0!==s&&""!==s||(s=" "),i.id=e,i.title.id=t,i.header.id=s,M.isNumber(a)?(a=a,i.value=n.createEmptyMeasureParameterValue(),i.value.mark=y(s,!0),i.value.sign=a<0?"-":"",i.value.number=a.toFixed(0),i.value.decimals=0,i.value.auxiliaryDigits=0,i.value.unit=" ",i.value.interval=1,
i.value.isStable=!0,i.value.isSpecial=!1,i.value.isWarning=!1,i.value.isInvalid=!1):M.isObject(a)&&M.isNumber(a.value)&&(a=a,i.value=n.createEmptyMeasureParameterValue(),i.value.mark=y(s,!0),i.value.sign=a.value<0?"-":"",i.value.number=a.value.toFixed(a.decimals),i.value.decimals=a.decimals,i.value.auxiliaryDigits=void 0!==a.auxiliaryDigits?a.auxiliaryDigits:0,i.value.unit=" "+C.getUnitString(a.unit),i.value.interval=Math.pow(10,-1*a.decimals),i.value.isStable=void 0!==a.stable&&a.stable,i.value.isSpecial=!1,i.value.isWarning=!1,i.value.isInvalid=!1),i.appearance=O.EnumAppearance.ENABLED,i}report_getCodeParam(e,t,s){let a=n.createEmptyBarcodeParameter();return s=void 0!==s?s:O.EnumBarcodeFormats.QR,a.id=e,a.title.id=" ",a.header.id=" ",a.value.string=t,a.value.format=s,a.appearance=O.EnumAppearance.ENABLED,a}report_enqueuePrintBlock(e,s,a,i,n,r){return M.isBoolean(a)||(a=!1),M.isBoolean(i)||(i=!1),M.isString(n)||(n=""),this.reportingPrintBlocksQueue.push({requestType:"ADD_PRINT_BLOCK",
printItemIdentifierMapID:r,printItemIdentifierReference:-1,lines:s,blockHeader:e,redactable:a,timeoutTimestamp:-1,invalidationPreset:i,invalidationPresetComment:n}),!1===this.reportingQueueActive&&(this.reportingQueueActive=!0,this.reportingQueueTimer=this.addTimer(t.REPORTING_QUEUE_MINIMUM_WAIT_MS,t.REPORTING_QUEUE_PROCESS_NEXT_ITEM_TOPIC),console.log("wfRunner: Start processing queued REPORTING requests")),!0}report_enqueueInvalidateBlock(e,s,a){return M.isString(a)||(a=""),this.reportingPrintBlocksQueue.push({requestType:"SET_INVALIDATION",printItemIdentifierMapID:void 0,printItemIdentifierReference:s,lines:[],blockHeader:"",redactable:!0,timeoutTimestamp:-1,invalidationPreset:e,invalidationPresetComment:a}),!1===this.reportingQueueActive&&(this.reportingQueueActive=!0,this.reportingQueueTimer=this.addTimer(t.REPORTING_QUEUE_MINIMUM_WAIT_MS,t.REPORTING_QUEUE_PROCESS_NEXT_ITEM_TOPIC),console.log("wfRunner: Start processing queued REPORTING requests")),!0}
report_setupDestinationDirectory(e,t){void 0===e?e="CUBIS_"+this.getSerialNumber()+"_"+B(Date.now(),"yyyy-mm-dd_HH-MM-ss"):e.startsWith("/")&&(e=e.substring(1)),""===e&&(e="CUBIS_"+this.getSerialNumber()+"_"+B(Date.now(),"yyyy-mm-dd_HH-MM-ss")),void 0===t?t="":(t.endsWith("/")||(t+="/"),t.startsWith("/")&&(t=t.substring(1))),this.perform_InternalWebserviceRequest("reporting",D.RestMethodsREPORTING.setPathAndFilenameForNextReport,{path:t+A.getCompliantFilename(e)})}report_printQueue(e,t){return(M.isString(e)||M.isString(t))&&this.report_setupDestinationDirectory(e,t),this.perform_InternalWebserviceRequest("reporting",D.RestMethodsREPORTING.printPrintQueueWithElectronicSignature,{}).isSuccess()}report_handleQueuedPrintBlocks(e){if(M.isObject(e)&&M.isString(e.payload)&&e.payload===t.REPORTING_QUEUE_PROCESS_NEXT_ITEM_TOPIC){if(!1===this.reportingQueueActive)return;if(0===this.reportingPrintBlocksQueue.length)return console.log("wfRunner: Stopped REPORTING with empty queue"),
this.reportingQueueActive=!1,void this.addToEventQueue(new E.ImmediateEvent({topic:t.REPORTING_QUEUE_DONE_EVENT,success:!1}));this.reportingPrintBlocksQueue[0].timeoutTimestamp<0&&(this.reportingPrintBlocksQueue[0].timeoutTimestamp=Date.now()+t.REPORTING_QUEUE_REQUEST_TIMEOUT,console.log("wfRunner: Started processing REPORTING request with ID #"+this.reportingPrintBlocksQueue[0].timeoutTimestamp.toString()));const e=R.cloneJSON(this.reportingPrintBlocksQueue[0]);this.reportingQueueActive=!0;let s=new m.CubisRestResponse(!1),a=!1;return"ADD_PRINT_BLOCK"===e.requestType?a=(s=this.reportingProxy.printParameters(e.lines,e.blockHeader,e.redactable)).isSuccess()&&s.rawReturns.printItemIdentifier>=0:"SET_INVALIDATION"===e.requestType&&(a=(s=this.report_setPrintBlockInvalidation(!0,e.printItemIdentifierReference,e.invalidationPresetComment)).isSuccess()),
!1===a?void(Date.now()<e.timeoutTimestamp?this.reportingQueueTimer=this.addTimer(t.REPORTING_QUEUE_FAILED_WAIT_MS,t.REPORTING_QUEUE_PROCESS_NEXT_ITEM_TOPIC):(console.log("wfRunner: Timeout for processing REPORTING request with ID #"+e.timeoutTimestamp.toString()),console.log("wfRunner: Cancelled processing queued REPORTING requests"),this.reportingPrintBlocksQueue=[],this.reportingQueueActive=!1,this.addToEventQueue(new E.ImmediateEvent({topic:t.REPORTING_QUEUE_DONE_EVENT,success:!1})))):("ADD_PRINT_BLOCK"===e.requestType?(M.isString(e.printItemIdentifierMapID)&&(this.reportingPrintItemIdentifierMap[e.printItemIdentifierMapID]=s.rawReturns.printItemIdentifier),!0===e.invalidationPreset&&this.report_enqueueInvalidateBlock(!0,s.rawReturns.printItemIdentifier,e.invalidationPresetComment),console.log("wfRunner: Successfully printed new block (request ID #"+e.timeoutTimestamp.toString()+")"),
this.reportingPrintBlocksQueue.splice(0,1)):"SET_INVALIDATION"===e.requestType&&(console.log("wfRunner: Successfully set redaction status for printItemIdentifier "+e.printItemIdentifierReference+" (request ID #"+e.timeoutTimestamp.toString()+")"),this.reportingPrintBlocksQueue.splice(0,1)),0===this.reportingPrintBlocksQueue.length?(console.log("wfRunner: Done all queued REPORTING requests"),this.reportingQueueActive=!1,void this.addToEventQueue(new E.ImmediateEvent({topic:t.REPORTING_QUEUE_DONE_EVENT,success:!0}))):void(this.reportingQueueTimer=this.addTimer(t.REPORTING_QUEUE_MINIMUM_WAIT_MS,t.REPORTING_QUEUE_PROCESS_NEXT_ITEM_TOPIC)))}}report_setPrintBlockInvalidation(e,t,s){let a=-1;return M.isString(t)&&this.reportingPrintItemIdentifierMap.hasOwnProperty(t)?a=this.reportingPrintItemIdentifierMap[t]:M.isNumber(t)&&(a=t),!M.isNumber(a)||a<0?(console.log("wfRunner: call for setRedactionStatus failed due to missing printItemIdentifier"),
new m.CubisRestResponse(!1)):(M.isString(s)||(s=""),this.reportingProxy.setRedactionStatus(a,e,s))}report_handleReportingMessages(e){if(M.isObject(e)&&M.isString(e.payload.topic)&&e.payload.topic===g.MqttTopics.MESSAGE_HANDLER_MESSAGE){let s={_id:-1,title:{id:"",args:[]}};try{s=JSON.parse(e.payload.value.toString())}catch(e){return}if(s.title.id.includes("ERROR861_")&&this.reportingPrintBlocksQueue.length>0&&this.messageHandlerProxy.removeMessage(s._id),s.title.id.includes("ERROR860_"))return!0===this.reportingQueueActive&&(console.log("wfRunner: Stopped reporting queue because of error 860 (maximum number of lines)"),this.addToEventQueue(new E.ImmediateEvent({topic:t.REPORTING_QUEUE_DONE_EVENT,success:!1}))),this.reportingQueueActive=!1,void(this.reportingPrintBlocksQueue=[])
;if(s.title.id.includes("ERROR360_")||s.title.id.includes("ERROR361_"))return!0===this.reportingQueueActive&&(console.log("wfRunner: Stopped reporting queue because interface is not prepared for protocol (error 360/361)"),this.addToEventQueue(new E.ImmediateEvent({topic:t.REPORTING_QUEUE_DONE_EVENT,success:!1}))),this.reportingQueueActive=!1,void(this.reportingPrintBlocksQueue=[])}}_____________________MISC__________________(){}sleep(e){let t=Math.floor(e/1e3),s=e-1e3*t,a=0;for(let e=0;e<t;e++)for(this.heartbeat({message:"busy sleep for a second",value:this.heartbeatCount++}),a=Date.now()+1e3;Date.now()<a;);for(this.heartbeat({message:"busy sleep rest ms",value:this.heartbeatCount++}),a=Date.now()+s;Date.now()<a;);}preventAutoLogout(e){switch(e){case"justOnce":this.mqttHandler.publish(g.MqttTopics.HMI_EVENT,"auto_logout_timer_reset");break;case"enableConstantly":this.preventAutoLogout("justOnce"),this.preventAutoLogout("disableConstantly"),
this.preventAutoLogoutInterval=this.addInterval(3e4,t.PREVENT_AUTO_LOGOUT_INTERVAL_EVENT);break;case"disableConstantly":this.cancelInterval(this.preventAutoLogoutInterval),this.preventAutoLogoutInterval=void 0}}perform_InternalWebserviceRequest(e,t,s){return A.perform_InternalWebserviceRequest(e,t,s)}perform_WebserviceRequest(e,t,s,i,n,r,o,E,_,l,c){return a.__awaiter(this,void 0,void 0,function*(){return A.perform_WebserviceRequest(e,t,s,i,n,r,o,E,_,l,c)})}areEqual(e,t){if(Date.now()-this.lastHeartbeatTimestamp>1e3&&(this.heartbeat({message:"areEqual check",value:this.heartbeatCount++}),this.lastHeartbeatTimestamp=Date.now()),null==e||void 0===e)return null==t||void 0===t;if(null==t||void 0===t)return!1;if(typeof e!=typeof t)return!1;if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e===t;for(let s of Object.keys(e)){if(!t.hasOwnProperty(s))return!1;if(!this.areEqual(e[s],t[s]))return!1}return!0}_____________________QAPPBASE_STUFF__________________(){}
provideStartFsmStateAfterLotIdentifier(){return this.ENTRY_STATE}confIdentifierAspect(e,t=""){}addRemainingDataToPQ(){return[]}providePQInitTaskParams(){return[]}resumeAdvAspectIsForcedReinitModificationDetectedFn(){return!1}resumeAdvAspectIsReinitConditionDetectedFn(){return!0}calcResumeState(){return this.ENTRY_STATE}provideSpecificAdvFsmStates(){return this.STATES}doAddSampleDuringReinit2PQ(e){return!1}provideSamplePQParams(e){return[]}reinitWorkstate(){this.prepReinitializedWorkstate({identifiers:[],samples:[]})}initFromWorkstate(){}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(68),i=s(116),n=s(63),r=s(117),o=s(60),E=s(6),_=s(102),l=s(16),c=s(34),u=s(1),T=s(2),A=s(0),p=s(5),d="STATE_RECONFIG_DONE",I="STATE_LOT_IDENTIFIER_DONE";t.QAppAdvBase=class extends r.QAppWorkflowBase{constructor(e){super(e),this.advBaseStates={STATE_ASPECT_RESUME_ADV_REINIT_EXIT:{_onEnter:function(e){
e.addToEventQueue(new E.ImmediateEvent(i.STATE_ASPECT_RESUME_ADV_REINIT_EXIT))},_onExit:function(e){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,t){t.payload===i.STATE_ASPECT_RESUME_ADV_REINIT_EXIT&&(e.reinitialize(),this.transition(e,e.skipConfigParamAspect?d:a.STATE_ASPECT_CFG_PARAM_EDIT_ENTER))}},STATE_RECONFIG_DONE:{_onEnter:function(e){e.addToEventQueue(new E.ImmediateEvent(d))},_onExit:function(e){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,t){t.payload===d&&(e.confIdentifierAspect(!0),this.transition(e,e.skipLotInput?I:_.STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT))}},STATE_LOT_IDENTIFIER_DONE:{_onEnter:function(e){e.saveWorkstate(!0)},_onExit:function(e){},_transTo:{},_transFrom:{},QAPP_SYNC_CALL_DONE_EVENT:function(e,t){t.payload===E.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE&&this.transition(e,i.STATE_ASPECT_RESUME_ADV_CONT_EXIT)}},STATE_ASPECT_RESUME_ADV_CONT_EXIT:{_onEnter:function(e){const t=e.getTaskName();e.showLoadingScreen({
id:"_QAPP_LIB_LOADING_OVERLAY_TEXT_PREP_CONT_APP",args:[p.isString(t)?t:""]})},_onExit:function(e){},_transTo:{},_transFrom:{},MQTT_ADMIN_EVENT:function(e,t){e.checkForLoadingScreenEnableEvent(t)?(e.confIdentifierAspect(!0),e.aspects[_.IDENTIFIER_ASPECT].setLotIDs(e.workstate.measurementData.identifiers),e.restoreLastSelectedDisplayValueInfo(),e.initFromWorkstate(),e.addHeartbeatEvent("INIT_PRINTQUEUE_HEARTBEAT")):e.checkForCustomHeartbeatEvent(t,"INIT_PRINTQUEUE_HEARTBEAT")&&(console.log("QAppAdvBase: clearing printQueue."),e.reportingProxy.clearPrintQueue(),e.initPQ(!0)?(console.log("QAppAdvBase: init PQ fin"),this.transition(e,e.calcResumeState())):(console.log("QAppAdvBase: there are more samples to print - add trigger to queue"),e.addToEventQueue(new E.SimpleEvent("STATE_ASPECT_RESUME_ADV_CONT_EXIT_contInitPQ"))))},SIMPLE_EVENT:function(e,t){"STATE_ASPECT_RESUME_ADV_CONT_EXIT_contInitPQ"===t.payload&&(e.initPQ(!1)?(console.log("QAppAdvBase: init PQ fin"),
this.transition(e,e.calcResumeState())):(console.log("QAppAdvBase: there are more samples to print - add trigger to queue"),e.addToEventQueue(new E.SimpleEvent("STATE_ASPECT_RESUME_ADV_CONT_EXIT_contInitPQ"))))}}},this.skipConfigParamAspect=!1,this.skipLotInput=!1,this.workstate=void 0,this.isNewInitialized=!1,this.ignoreSaveWorkstate=!1,this.saveDisplayValueSelectionWithWorkstate=!1,this.initPQIdx=0,this.cfgParamAspect=new a.ConfigParamsAspect,this.registerAspect(this.cfgParamAspect),this.resAdvAspect=new i.ResumeAdvancedAspect,this.registerAspect(this.resAdvAspect),this.workflowTaskHandler=new n.TaskHandler}init(){console.log("QAppAdvBase::init"),super.init()}postInit(){console.log("QAppAdvBase: postInit"),super.postInit(),this.confParamConfigAspect(),this.confResumeAdvAspect()}confParamConfigAspect(){console.log("QAppAdvBase::confParamConfigAspect"),this.aspects[a.CFG_PARAMS_ASPECT].configure({isValidFn:()=>this.cfgParamAspectIsValidFn(),
updateTaskParameterFn:e=>this.cfgParamAspectUpdateTaskParameterFn(e),handleParamUpdateUserActionFn:(e,t)=>this.cfgParamAspectHandleParamUpdateUserActionFn(e,t),returnState:d,taskHandler:this.workflowTaskHandler})}confResumeAdvAspect(){console.log("QAppAdvBase::confResumeAdvAspect"),this.aspects[i.RESUME_ADV_ASPECT].configure({isForcedReinitModificationDetectedFn:()=>this.resumeAdvAspectIsForcedReinitModificationDetectedFn(),isReinitConditionDetectedFn:()=>this.resumeAdvAspectIsReinitConditionDetectedFn(),isContinueConditionDetectedFn:()=>this.resumeAdvAspectIsContinueConditionDetectedFn(),isPersitentWorkstatePresentFn:()=>{let e=void 0!==this.workstate;return console.log("QAppAdvBase::isPersitentWorkstatePresentFn: ",e),e}})}confIdentifierAspect(e,t=""){console.log("QAppAdvBase::confIdentifierAspect"),this.aspects[_.IDENTIFIER_ASPECT].configure({returnState:e?I:t,taskHandler:this.workflowTaskHandler,autoRememberSIDs:!1}),
e&&this.workstate&&this.workstate.measurementData&&this.aspects[_.IDENTIFIER_ASPECT].setLotIDs(this.workstate.measurementData.identifiers)}cfgParamAspectUpdateTaskParameterFn(e){console.log("QAppAdvBase::cfgParamAspectUpdateTaskParameterFn"),this.cfgParamAspectUpdateTaskHandlerAndPublish(e)}cfgParamAspectUpdateTaskHandlerAndPublish(e){return e.type===A.EnumParameterTypes.PARAM_QUANTITY&&l.QuantityParameter.roundToDecimalPlaces(e),!!this.workflowTaskHandler.updateParameter(e)&&(this.cfgParamAspect.publishParameter(e),!0)}cfgParamAspectHandleParamUpdateUserActionFn(e,t){return!0}cfgParamAspectIsValidFn(){return!0}resumeAdvAspectIsForcedReinitModificationDetectedFn(){let e=!1,t=this.taskHandler.getTask();return console.log("QAppAdvBase::resumeAdvAspectIsForcedReinitModificationDetectedFn"),this.workstate&&this.workstate.initialTaskHandlerData&&t?(e=!this.relevantParamsAreEqual(this.workstate.initialTaskHandlerData.params,t.params),
console.log("QAppAdvBase::resumeAdvAspectIsForcedReinitModificationDetectedFn - return ",e)):console.log("QAppAdvBase::resumeAdvAspectIsForcedReinitModificationDetectedFn: no workstate - return ",e),e}resumeAdvAspectIsContinueConditionDetectedFn(){return!1}adaptTaskHandler(){console.log("QAppAdvBase::adaptTaskHandler")}reinitialize(){console.log("QAppAdvBase::reinitialize"),this.reinitWorkstate()}prepReinitializedWorkstate(e){let t=this.taskHandler.getFilteredTask();t?(console.log("QAppAdvBase::prepReinitializedWorkstate - got filtered task parameter"),this.workstate={measurementData:e,initialTaskHandlerData:u.cloneJSON(this.taskHandler.getTask()),workflowTaskHandlerData:t},this.workflowTaskHandler.setTask(this.workstate.workflowTaskHandlerData)):this.exitError("QAppAdvBase::prepReinitializedWorkstate: No task parameters in taskHandler - unexpected.")}provideStartFsmState(){return i.STATE_ASPECT_RESUME_ADV_CHECK_STARTUP_ENTER}provideFsmStates(){
return Object.assign(this.advBaseStates,this.provideSpecificAdvFsmStates())}adaptFsmStates(e){console.log("QAppAdvBase::adaptFsmStates");for(let t in e){let s=e[t].MQTT_ADMIN_EVENT;void 0!==s&&(e[t].MQTT_ADMIN_EVENT_CHILD=s),e[t].MQTT_ADMIN_EVENT=function(s,a){let i=!1;try{i=a.payload.event===c.MQTT_ADMIN_EVENT_PACKET_SENT&&a.payload.packet.topic===T.MqttTopics.HMI_LOADING_MODAL_TEXT&&JSON.parse(a.payload.packet.payload.toString()).args[1]===E.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE}catch(e){}i&&(s.saveWorkstateIntern(),s.addToEventQueue(new E.QAppSyncCallDoneEvent(E.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE))),void 0!==e[t].MQTT_ADMIN_EVENT_CHILD&&e[t].MQTT_ADMIN_EVENT_CHILD.call(this,s,a)}}}onFsmTransition(e){if(e.fromState===o.STATE_UNINITIALIZED_INTERNAL){console.log("QAppAdvBase::onFsmTransition - try to load workstate");try{this.workstate=this.taskMngProxy.getWorkstate(this.taskId),
console.log("QAppAdvBase::onFsmTransition - got workstate from persistency")}catch(e){console.log("QAppAdvBase::onFsmTransition - no workstate found - error: "+e),this.workstate=void 0}this.workstate&&this.workflowTaskHandler.setTask(this.workstate.workflowTaskHandlerData)}}saveWorkstateIntern(){this.taskMngProxy.saveWorkstate(this.workstate,this.taskId)}saveWorkstate(e=!0){this.workstate&&!this.ignoreSaveWorkstate?(console.log("QAppAdvBase::saveWorkstate - save workstate: "),e?this.showLoadingScreen({id:"_QAPP_LIB_LOADING_OVERLAY_TEXT_SAVE_WORKSTATE",args:[this.getTaskName(),E.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE]}):(this.saveWorkstateIntern(),this.addToEventQueue(new E.QAppSyncCallDoneEvent(E.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE)))):this.addToEventQueue(new E.QAppSyncCallDoneEvent(E.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE))}deleteWorkstate(){this.workstate&&this.taskMngProxy.deleteWorkstate(this.taskId)}specificRestart(){
if(void 0!==this.workstate){try{this.taskMngProxy.deleteWorkstate(this.taskId)}catch(e){console.log("QAppAdvBase Restart: No workstate to delete")}this.workstate=void 0}}onSuspending(){void 0!==this.workstate&&this.saveDisplayValueSelectionWithWorkstate&&(console.log("save last display value info in workstate"),this.workstate.lastDisplayValDomain=this.lastDisplayValDomain,this.workstate.lastDisplayValAppId=this.weighingProxy.getSelectedDisplayValue().lastSelectedApplicationId,this.saveWorkstateIntern()),super.onSuspending()}restoreLastSelectedDisplayValueInfo(){void 0!==this.workstate&&this.saveDisplayValueSelectionWithWorkstate&&(console.log("restoreLastSelectedDisplayValueInfo"),void 0!==this.workstate.lastDisplayValDomain&&(this.lastDisplayValDomain=this.workstate.lastDisplayValDomain),void 0!==this.workstate.lastDisplayValAppId&&this.weighingProxy.restoreLastSelectedDisplayValue(this.workstate.lastDisplayValAppId))}initPQ(e,t=!1){
if(this.workstate&&this.workstate.measurementData&&this.workstate.measurementData.identifiers){e?(console.log("QAppAdvBase::initPQ: start initPQ"),this.addLotIds2PQ(this.workstate.measurementData.identifiers),this.addInitParams2PQ(this.providePQInitTaskParams()),this.initPQIdx=0):console.log("QAppAdvBase::initPQ: continue initPQ"),console.log("QAppAdvBase::initPQ start initPQIdx = "+this.initPQIdx);let s=0;for(;this.initPQIdx<this.workstate.measurementData.samples.length&&(s<10||t);){let e=this.workstate.measurementData.samples[this.initPQIdx];if(this.initPQIdx++,this.doAddSampleDuringReinit2PQ(e)){let t=this.addSample2PQ(e,!0,!1);e.valid||void 0===t||this.reportingProxy.setRedactionStatus(t.getPrintItemIdentifier(),!0,e.invalidationReason),this.sampleAdded(),s++}}return console.log("QAppAdvBase::initPQ end initPQIdx = "+this.initPQIdx),this.initPQIdx>=this.workstate.measurementData.samples.length}return!0}addSample2PQ(e,t,s){console.log("QAppAdvBase::addSample2PQ"),this.sampleAdded()
;let a=this.addSample2PQ_withIds(e.identifiers,this.provideSamplePQParams(e),t,s);return this.updateInvalidationAspectSampleConfig({sample:e}),a}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(6),n=s(22),r=s(10),o=s(11);t.RESUME_ADV_ASPECT="RESUME_ADV_ASPECT",t.STATE_ASPECT_RESUME_ADV_CHECK_STARTUP_ENTER="STATE_ASPECT_RESUME_ADV_CHECK_STARTUP_ENTER",t.STATE_ASPECT_RESUME_ADV_REINIT_EXIT="STATE_ASPECT_RESUME_ADV_REINIT_EXIT",t.STATE_ASPECT_RESUME_ADV_CONT_EXIT="STATE_ASPECT_RESUME_ADV_CONT_EXIT";const E="STATE_ASPECT_RESUME_ADV_FORCE_REINIT",_="STATE_ASPECT_RESUME_ADV_QUESTION_CONT",l="BTN_OK",c="BTN_REINIT",u="BTN_CONT";t.ResumeAdvancedAspect=class extends n.AbstractQAppAspect{constructor(){super(...arguments),this.states={STATE_ASPECT_RESUME_ADV_CHECK_STARTUP_ENTER:{_onEnter:function(e){
e.aspects[t.RESUME_ADV_ASPECT].cfg.isPersitentWorkstatePresentFn()?e.aspects[t.RESUME_ADV_ASPECT].cfg.isForcedReinitModificationDetectedFn()?e.addToEventQueue(new i.ImmediateEvent(E)):e.aspects[t.RESUME_ADV_ASPECT].cfg.isReinitConditionDetectedFn()?e.addToEventQueue(new i.ImmediateEvent(t.STATE_ASPECT_RESUME_ADV_REINIT_EXIT)):e.aspects[t.RESUME_ADV_ASPECT].cfg.isContinueConditionDetectedFn()?e.addToEventQueue(new i.ImmediateEvent(t.STATE_ASPECT_RESUME_ADV_CONT_EXIT)):e.addToEventQueue(new i.ImmediateEvent(_)):e.addToEventQueue(new i.ImmediateEvent(t.STATE_ASPECT_RESUME_ADV_REINIT_EXIT))},_onExit:function(){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,t){this.transition(e,t.payload)}},STATE_ASPECT_RESUME_ADV_FORCE_REINIT:{_onEnter:function(e){e.showMessageBox({type:r.EnumMessageboxType.INFO,title:{id:"_QAPP_LIB_MSG_BOX_INFO_REINIT_TASK_NECESSARY",args:[]},textList:[{id:"_QAPP_LIB_MSG_BOX_INFO_REINIT_TASK_NECESSARY_TEXT",args:[]}],buttons:[{id:l,label:{id:o.EnumFontLabels.OK,
args:[]},appearance:a.EnumAppearance.ENABLED_SECONDARY}]})},_onExit:function(e){e.hideMsgBox()},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(e,s){s.payload.buttonId===l&&this.transition(e,t.STATE_ASPECT_RESUME_ADV_REINIT_EXIT)}},STATE_ASPECT_RESUME_ADV_QUESTION_CONT:{_onEnter:function(e){e.showMessageBox({type:r.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MSG_BOX_QUESTION_RESUME_CONTINUE",args:[]},textList:[{id:"_QAPP_LIB_MSG_BOX_QUESTION_RESUME_CONTINUE_TEXT",args:[]}],buttons:[{id:c,label:{id:"_QAPP_LIB_MSG_BOX_QUESTION_RESUME_CONTINUE_BTN_REINIT",args:[]},appearance:a.EnumAppearance.ENABLED_SECONDARY},{id:u,label:{id:"_QAPP_LIB_MSG_BOX_QUESTION_RESUME_CONTINUE_BTN_CONTINUE",args:[]},appearance:a.EnumAppearance.ENABLED_PRIMARY}]})},_onExit:function(e){e.hideMsgBox()},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(e,s){
s.payload.buttonId===c?this.transition(e,t.STATE_ASPECT_RESUME_ADV_REINIT_EXIT):s.payload.buttonId===u&&this.transition(e,t.STATE_ASPECT_RESUME_ADV_CONT_EXIT)}}}}getId(){return t.RESUME_ADV_ASPECT}getAspectStates(){return this.states}init(e){this.client=e,this.client?console.log("ResumeAdvancedAspect::init"):console.log("ResumeAdvancedAspect::init - aspect not correctly initialized (no client set) - skip init")}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(15),i=s(102),n=s(18),r=s(64),o=s(3),E=s(23),_=s(26),l=s(6),c=s(118),u=s(119),T=s(48),A=s(27),p=s(1),d=s(2),I=s(0);t.QAppWorkflowBase=class extends a.QAppBase{constructor(e){super(e),this.takeoverBtnPending=!1,this.lastDisplayValDomain=T.ISelectedWeightDisplayValueDomains.SELECTED_DOMAIN_UNDEFINED,this.doRememberLastDisplayValDomain=!1,this.identifierAspect=new i.IdentifierAspect,this.registerAspect(this.identifierAspect),this.weighingProxy.selectedDisplayValue$.subscribe(e=>{
this.doRememberLastDisplayValDomain&&(this.lastDisplayValDomain=e.currentSelectedDomain)})}init(){console.log("QAppWorkflowBase::init"),super.init(),this.identifierAspect.resetSIDsPrevSample(),this.mqttHandler.subscribe(d.MqttTopics.HMI_PRINT_HEADER),this.lastDisplayValDomain=T.ISelectedWeightDisplayValueDomains.SELECTED_DOMAIN_UNDEFINED,this.doRememberLastDisplayValDomain=!1}postInit(){console.log("QAppWorkflowBase::postInit"),super.postInit(),this.confIdentifierAspect(!0,"")}processCLParameters(e){e.length>=5?(this.scriptPath=e[1],this.taskId=e[4],console.log("QAppWorkflowBase: got taskId: "+this.taskId)):(this.taskId=void 0,this.exitError("QAppWorkflowBase::processCLParameters - workflow-Script called without taskId parameter"))}initTaskHandler(){console.log("QAppWorkflowBase: initTaskHandler"),this.loadTask()}adaptTaskHandler(){console.log("QAppWorkflowBase: adaptTaskHandler")}handleDocuButton(){let e=this.addRemainingDataToPQ();e.length>0&&this.updateRemainingDataPQIDs(e),
this.showPrintQueue()}handleEvent(e){if(e instanceof _.MqttUpdateEvent&&e.payload.topic===d.MqttTopics.HMI_PRINT_HEADER)try{JSON.parse(e.payload.value.toString()).isPrintHeaderDisplayed||(this.updateTakeoverBtnToLastRequestedAppearance(),this.takeoverBtnPending=!1)}catch(e){}else{if(e instanceof l.QAppTimerEvent&&"TAKEOVER_BTN_TIMER"===e.payload.id)return this.updateTakeoverBtnToLastRequestedAppearance(),void(this.takeoverBtnPending=!1)
;e instanceof A.HmiButtonClickedEvent&&void 0!==this.buttons.takeoverBtn&&e.payload.buttonId===this.buttons.takeoverBtn.getButtonId()&&(this.buttons.takeoverBtn.getAppearance()!==I.EnumAppearance.ENABLED&&this.buttons.takeoverBtn.getAppearance()!==I.EnumAppearance.ENABLED_SECONDARY&&this.buttons.takeoverBtn.getAppearance()!==I.EnumAppearance.ENABLED_PRIMARY||this.lastRequestedTakeoverBtnAppearance!==I.EnumAppearance.ENABLED&&this.lastRequestedTakeoverBtnAppearance!==I.EnumAppearance.ENABLED_SECONDARY&&this.lastRequestedTakeoverBtnAppearance!==I.EnumAppearance.ENABLED_PRIMARY)||super.handleEvent(e)}}notifyTakeOver(e=!1){this.buttons.takeoverBtn&&(this.takeoverBtnPending=!0,this.lastRequestedTakeoverBtnAppearance!==I.EnumAppearance.HIDDEN&&this.buttons.takeoverBtn.setAppearance(I.EnumAppearance.DISABLED),e&&this.addTimer(1e3,{id:"TAKEOVER_BTN_TIMER"}))}updateRequestedTakeoverButtonAppearance(e){this.lastRequestedTakeoverBtnAppearance=e,
this.takeoverBtnPending||this.updateTakeoverBtnToLastRequestedAppearance()}updateTakeoverBtnToLastRequestedAppearance(){this.buttons.takeoverBtn&&this.buttons.takeoverBtn.setAppearance(this.lastRequestedTakeoverBtnAppearance)}rememberLastSelectedDisplayValueDomain(e){this.doRememberLastDisplayValDomain=e}getLastSelectedDisplayValueDomain(){return this.lastDisplayValDomain}selectLastSelectedDisplayValue(e){this.lastDisplayValDomain===T.ISelectedWeightDisplayValueDomains.SELECTED_DOMAIN_APP?""!==this.weighingProxy.getSelectedDisplayValue().lastSelectedApplicationId?(console.log("restore last selected display display value: "+this.weighingProxy.getSelectedDisplayValue().lastSelectedApplicationId),this.weighingProxy.selectWeightApplication(this.weighingProxy.getSelectedDisplayValue().lastSelectedApplicationId)):(console.log("restore last selected display value: no AppId stored -> select QApp default: "+e),
this.weighingProxy.selectWeightApplication(e)):this.lastDisplayValDomain===T.ISelectedWeightDisplayValueDomains.SELECTED_DOMAIN_UNDEFINED?(console.log("restore last selected display value: undefined domain -> select QApp default: "+e),this.weighingProxy.selectWeightApplication(e)):console.log("restore last selected display value: WEIGHING was selected - do nothing")}addInitParams2PQ(e){if(console.log("QAppWorkflowBase::addInitParams2PQ"),e.length>0)return this.reportingProxy.printParameters(e,r.REPORTING_CATEGORY_INIT,!1)}addLotIds2PQ(e){console.log("QAppWorkflowBase::addLotIds2PQ");let t=[],s=this.identifierAspect.getLotVisualParams().map(e=>p.cloneJSON(e.getValue()));return e.forEach((e,a)=>{i.IdentifierAspect.getLotState(a,this.taskHandler)!==E.EnumLotIdentifierOptions.OFF&&""!==e&&(s[a].value.string=e,s[a].appearance=I.EnumAppearance.ENABLED,t.push(s[a]))}),this.addInitParams2PQ(t)}addSample2PQ_withIds(e,t,s,a){console.log("QAppWorkflowBase::addSample2PQ_withIds")
;let i=[],o=n.remove(t,e=>e.id===u.PARAM_ID_SAMPLE_NO);i.push(...o),i.push(...this.prepSampleIdParams4PQ(e)),o=n.remove(t,e=>e.id===u.PARAM_ID_SAMPLE_DATE),i.push(...o),i.push(...t);let E=this.reportingProxy.printParameters(i,s?r.REPORTING_CATEGORY_COMPONENTS:r.REPORTING_CATEGORY_NONE,a);return this.updateLastSamplePQID(E.getPrintItemIdentifier()),this.updateRemainingDataPQIDs([]),console.log("QAppWorkflowBase::addSample2PQ_withIds: done"),E}prepSampleIdParams4PQ(e){console.log("QAppWorkflowBase::prepSampleIdParams4PQ");let t=[],s=this.identifierAspect.getSIDVisualParams().map(e=>p.cloneJSON(e.getValue()));return e.forEach((e,a)=>{i.IdentifierAspect.getSIDState(a,this.taskHandler)!==E.EnumSampleIdentifierOptions.OFF&&""!==e&&(s[a].value.string=e,s[a].appearance=I.EnumAppearance.ENABLED,t.push(s[a]))}),t}addStatistic2PQ(e,t){if(console.log("QAppWorkflowBase::addStatistic2PQ"),t&&t.getValues().currCalcValues.numSamples>0){let s=[],a=t.getValues().currStatPublishableParameters;if(e){
let t=o.createEmptyTextParameter();t.value.text.id=e,t.info.suppressTitle=!0,s.push(t)}if(a.n.getValue().appearance!==I.EnumAppearance.HIDDEN&&s.push(a.n.getValue()),a.avg.getValue().appearance!==I.EnumAppearance.HIDDEN&&s.push(a.avg.getValue()),a.dev.getValue().appearance!==I.EnumAppearance.HIDDEN&&s.push(a.dev.getValue()),a.variation.getValue().appearance!==I.EnumAppearance.HIDDEN&&s.push(a.variation.getValue()),a.sum.getValue().appearance!==I.EnumAppearance.HIDDEN&&s.push(a.sum.getValue()),a.min.getValue().appearance!==I.EnumAppearance.HIDDEN&&s.push(a.min.getValue()),a.max.getValue().appearance!==I.EnumAppearance.HIDDEN&&s.push(a.max.getValue()),a.diff.getValue().appearance!==I.EnumAppearance.HIDDEN&&s.push(a.diff.getValue()),s.length>0)return this.reportingProxy.printParameters(s,r.REPORTING_CATEGORY_STATISTIC,!1)}}sampleAdded(){console.log("QAppWorkflowBase::sampleAdded"),void 0!==this.buttons.docuButton&&this.buttons.docuButton.setAppearance(I.EnumAppearance.ENABLED_SECONDARY)}
updateRemainingDataPQIDs(e){console.log("QAppWorkflowBase::updateRemainingDataPQIDs ids: "+e),this.updateInvalidationAspectSampleConfig({dependentPrintItemIds:e})}updateLastSamplePQID(e){console.log("QAppWorkflowBase::updateLastSamplePQID id: "+e),this.updateInvalidationAspectSampleConfig({samplePrintItemId:e})}updateInvalidationAspectSampleConfig(e){console.log("QAppWorkflowBase::updateInvalidationAspectSampleConfig");for(let t in this.aspects)if(t===c.INVAL_SAMPLE_ASPECT)return void this.aspects[t].updateCfgSampleOnly(e)}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(6),n=s(22),r=s(10),o=s(99),E=s(3);t.INVAL_SAMPLE_ASPECT="INVAL_SAMPLE_ASPECT",t.STATE_ASPECT_INVAL_SAMPLE_ENTER="STATE_ASPECT_INVAL_SAMPLE_ENTER",t.STATE_ASPECT_INVAL_SAMPLE_REASON="STATE_ASPECT_INVAL_SAMPLE_REASON";const _="BTN_INVAL_YES",l="BTN_INVAL_DONT";t.PARAM_ID_RT_INVAL_REASON_INP="PARAM_ID_RT_INVAL_REASON_INP";class c extends n.AbstractQAppAspect{constructor(){
super(),this.states={STATE_ASPECT_INVAL_SAMPLE_ENTER:{_onEnter:function(e){let s=e.aspects[t.INVAL_SAMPLE_ASPECT];void 0!==s.cfg.sample&&s.cfg.sample.valid?e.showMessageBox({type:r.EnumMessageboxType.QUESTION,title:{id:"",args:[]},textList:[{id:"_QAPP_LIB_MSG_BOX_QUESTION_INVALIDATE_TEXT",args:[s.cfg.sample.sampleNo.toString()]}],buttons:[{id:_,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:a.EnumAppearance.ENABLED_SECONDARY},{id:l,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},appearance:a.EnumAppearance.ENABLED_SECONDARY}]}):e.addToEventQueue(new i.ImmediateEvent({from:t.STATE_ASPECT_INVAL_SAMPLE_ENTER,to:s.cfg.exitState}))},_onExit:function(e){e.hideMsgBox()},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(e,s){let a=e.aspects[t.INVAL_SAMPLE_ASPECT];s.payload.buttonId===l?this.transition(e,a.cfg.exitState):s.payload.buttonId===_&&(void 0!==a.cfg.sample&&(a.cfg.sample.valid=!1),this.transition(e,t.STATE_ASPECT_INVAL_SAMPLE_REASON))},IMMEDIATE_EVENT:function(e,s){
s.payload.from&&s.payload.from===t.STATE_ASPECT_INVAL_SAMPLE_ENTER&&this.transition(e,s.payload.to)}},STATE_ASPECT_INVAL_SAMPLE_REASON:{_onEnter:function(e){e.screens[o.KEYBOARD_SCREEN_ID].hide();let s=e.aspects[t.INVAL_SAMPLE_ASPECT];e.screens[o.KEYBOARD_SCREEN_ID].setParam(s.sP_4_InvalReason),e.screens[o.KEYBOARD_SCREEN_ID].show()},_onExit:function(e){e.screens[o.KEYBOARD_SCREEN_ID].hide()},_transTo:{},_transFrom:{},EV_HMI_PARAM_CHANGED:function(e,s){console.log("InvalidateSampleAspect - param change in STATE_ASPECT_INVAL_SAMPLE_REASON");let a=e.aspects[t.INVAL_SAMPLE_ASPECT];if(s.payload.parameter.id===t.PARAM_ID_RT_INVAL_REASON_INP){let t=a.cfg.sample;void 0!==t&&(t.invalidationReason=s.payload.parameter.value.string,void 0===a.cfg.samplePrintItemId||isNaN(a.cfg.samplePrintItemId)||e.reportingProxy.setRedactionStatus(a.cfg.samplePrintItemId,!0,t.invalidationReason),void 0!==a.cfg.dependentPrintItemIds&&a.cfg.dependentPrintItemIds.forEach(s=>{
e.reportingProxy.setRedactionStatus(s,!0,t.invalidationReason)})),this.transition(e,a.cfg.exitState)}}}},this.sP_4_InvalReason=c.createInvalidReasonParam(t.PARAM_ID_RT_INVAL_REASON_INP)}static createInvalidReasonParam(e){let t=E.createEmptyStringParameter();return t.id=e,t.title={id:"_QAPP_LIB_PARAM_TITLE_RT_INVAL_REASON",args:[]},t.header={id:"_QAPP_LIB_PARAM_HEADER_RT_INVAL_REASON",args:[]},t}updateCfgSampleOnly(e){this.cfg=Object.assign(this.cfg,e)}getId(){return t.INVAL_SAMPLE_ASPECT}getAspectStates(){return this.states}init(e){if(this.client=e,this.client){if(console.log("InvalidateSampleAspect::init"),!this.client.screens[o.KEYBOARD_SCREEN_ID]){let e=new o.KeyboardScreen(this.client.mqttHandler);this.client.registerScreen(e)}}else console.log("InvalidateSampleAspect::init - aspect not correctly initialized (no client set) - skip init")}}t.InvalidateSampleAspect=c},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(1),i=s(0)
;t.PARAM_ID_SAMPLE_NO="QAPP_LIB_SAMPLE_NO";const n={id:t.PARAM_ID_SAMPLE_NO,type:i.EnumParameterTypes.PARAM_STRING,value:{string:""},header:{id:"_QAPP_LIB_PARAM_HEADER_SAMPLE_NO",args:[]},title:{id:"_QAPP_LIB_PARAM_TITLE_SAMPLE_NO",args:[]},appearance:i.EnumAppearance.HIDDEN,info:{minimum:{length:0},maximum:{length:0}}};function r(){return a.cloneJSON(n)}t.getSampleNumberStringParameter=r,t.createSampleNumberStringParameter=function(e){let t=a.cloneJSON(r());return t.id=e,t},t.PARAM_ID_SAMPLE_DATE="QAPP_LIB_SAMPLE_DATE";const o={id:t.PARAM_ID_SAMPLE_DATE,type:i.EnumParameterTypes.PARAM_DATE_TIME,value:{timestamp:0},header:{id:"_QAPP_LIB_PARAM_HEADER_SAMPLE_DATETIME",args:[]},title:{id:"_QAPP_LIB_PARAM_TITLE_SAMPLE_DATETIME",args:[]},appearance:i.EnumAppearance.HIDDEN,info:{isTime:!0,isDate:!0}};function E(){return a.cloneJSON(o)}t.getSampleDateDTParameter=E,t.createSampleDateDTParameter=function(e){let t=a.cloneJSON(E());return t.id=e,t}},function(e,t,s){"use strict"
;Object.defineProperty(t,"__esModule",{value:!0});const a=s(13),i=s(0),n=s(98),r=s(38),o=s(2);t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID="SINGLETABBUTTONBARSCREEN";t.SingleTabButtonBarScreen=class extends r.AbstractOverlay{constructor(e,t,s){super(e),this.buttonList=[],this.tab=void 0,this.createBarButtons(t),this.publishBarButtons(),this.topLeftButton=new a.Button(this.mqttHandler,this,s),this.publishTopLeftButton()}getTab(){return this.tab}setFigureTab(e,s){let a=n.TabApi.createFigureTab(this.mqttHandler,t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,e,!0,s);return this.tab=a,a}setGraphTab(e,s){let a=n.TabApi.createGraphTab(this.mqttHandler,t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,e,!0,s);return this.tab=a,a}setParamListTab(e,s){let a=n.TabApi.createParamListTab(this.mqttHandler,t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,e,!0,s);return this.tab=a,a}setMenuTab(e,s){let a=n.TabApi.createMenuTab(this.mqttHandler,t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,e,!0,s);return this.tab=a,a}setTableTab(e,s){
let a=n.TabApi.createTableTab(this.mqttHandler,t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,e,!0,s);return this.tab=a,a}show(){if(void 0!==this.tab){this.topLeftButton.publish();for(let e of this.buttonList)e.publish();this.tab.show(),super.show()}}hide(){super.hide()}getId(){return t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID}getBarButtonId(){return o.MqttTopics.HMI_SINGLETABBUTTONBAR_SCREEN_BARBUTTONS}getTopLeftButtonId(){return o.MqttTopics.HMI_SINGLETABBUTTONBAR_SCREEN_TOPLEFTBUTTON}getButton(e){for(let t of this.buttonList)if(t.getButtonId()===e)return t;if(e===this.topLeftButton.getButtonId())return this.topLeftButton}createBarButtons(e){for(let t of e){let e=new a.Button(this.mqttHandler,this,t);this.buttonList.push(e),e.publish()}}publishBarButtons(){let e=[];for(let t of this.buttonList)e.push(o.MqttTopics.QAPP_NAMESPACE+"/"+t.getTopic());this.mqttHandler.publish(this.getBarButtonId(),JSON.stringify(e))}publishTopLeftButton(){
this.mqttHandler.publish(this.getTopLeftButtonId(),JSON.stringify(o.MqttTopics.QAPP_NAMESPACE+"/"+this.topLeftButton.getTopic()))}hideTopLeftButton(e=!0){this.topLeftButton.setAppearance(i.EnumAppearance.HIDDEN,e)}showTopLeftButton(e=!0){this.topLeftButton.setAppearance(i.EnumAppearance.ENABLED,e)}setTopLeftButton(e,t=!0){this.topLeftButton.setLabel(e.label,!1),this.topLeftButton.setIcon(e.icon,!1),e.nameId&&this.topLeftButton.setNameId(e.nameId,!1),e.labelCenter&&this.topLeftButton.setLabelCenter(e.labelCenter,!1),e.labelRight&&this.topLeftButton.setLabelRight(e.labelRight,!1),this.topLeftButton.setAppearance(e.appearance,!1),this.topLeftButton.setButtonId(e.buttonId,t)}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(52),i=s(98),n=s(2),r=s(9),o=s(13),E=s(36),_=s(65),l=s(0);t.WEIGHING_SPLIT_SCREEN_ID="WEIGHINGSPLIT";const c={buttonId:"BARBUTTON/CANCEL",label:{id:"",args:[]},appearance:l.EnumAppearance.HIDDEN}
;t.WeighingSplitScreen=class extends r.AbstractScreen{constructor(e,t){super(e),this.buttonList=[],this.text1={value:"",wildcards:[]},this.text2={value:"",wildcards:[]},this.param1="",this.param2="",this.title=void 0,this.createBarButtons(t),this.publishBarButtons(),this.checkBarGraph=new _.CheckBarGraph(e),this.cancelBarButton=new o.default(this.mqttHandler,this,c),this.tabApi=new i.TabApi(e,this.getId())}getId(){return t.WEIGHING_SPLIT_SCREEN_ID}getTabApi(){return this.tabApi}getBarButtonId(){return n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_BARBUTTONS}createBarButtons(e){e.sort(this.compareButtonBarButtons);for(let t of e){let e=new o.default(this.mqttHandler,this,t);this.buttonList.push(e),e.publish()}}publishBarButtons(){let e=[];for(let t of this.buttonList)e.push(n.MqttTopics.QAPP_NAMESPACE+"/"+t.getTopic());this.mqttHandler.publish(this.getBarButtonId(),JSON.stringify(e))}setText1(e,t){let s=!1;this.text1.value!==e&&(this.text1.value=e,s=!0),
t&&this.text1.wildcards.join()!==t.join()&&(this.text1.wildcards=t,s=!0),s&&this.publishText1()}compareButtonBarButtons(e,t){return E.getButtonPriority(e.buttonId)-E.getButtonPriority(t.buttonId)}publishText1(){this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_INSTRUCTION1,JSON.stringify(this.text1),{retain:!0})}publishText2(){this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_INSTRUCTION2,JSON.stringify(this.text2),{retain:!0})}setText2(e,t){let s=!1;this.text2.value!==e&&(this.text2.value=e,s=!0),t&&this.text2.wildcards.join()!==t.join()&&(this.text2.wildcards=t,s=!0),s&&this.publishText2()}publishTitle(){this.title?this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_TITLE,JSON.stringify(this.title),{retain:!0}):this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_TITLE,"",{retain:!0})}setTitle(e){let t=void 0;this.title&&(t=JSON.stringify(this.title)),this.title=e,this.title!==t&&this.publishTitle()}getText1(){return this.text1}
getText2(){return this.text2}publishParam1(){this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_PARAM1_TOPIC,JSON.stringify(this.param1),{retain:!0})}publishParam2(){this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_PARAM2_TOPIC,JSON.stringify(this.param2),{retain:!0})}setParam1(e){this.param1!==e&&(this.param1=e,this.publishParam1())}setParam2(e){this.param2!==e&&(this.param2=e,this.publishParam2())}getParam1(){return this.param1}getParam2(){return this.param2}getButton(e){if(e===a.CANCEL_BARBUTTON_ID)return this.cancelBarButton;for(let t of this.buttonList)if(t.getButtonId()===e)return t}show(){this.publishText1(),this.publishText2(),this.publishTitle(),this.publishParam1(),this.publishParam2();for(let e of this.buttonList)e.publish();super.show()}getCheckBarGraph(){return this.checkBarGraph}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(7),i=s(3),n=s(61),r=s(3),o=s(0),E=s(18),_=s(40),l=s(4);var c;!function(e){
e.EVENT_CREATED="Created",e.EVENT_CHANGED="Changed",e.EVENT_DELETED="Deleted",e.EVENT_LOGIN="Login",e.EVENT_LOGUT="Logout",e.EVENT_ISOCAL="isoCAL",e.EVENT_INTERNALADJUST="InternalAdjustment",e.EVENT_EXTERNALADJUST="ExternalAdjustment",e.EVENT_USERCAL="User Calibration",e.EVENT_MESSAGE="Message",e.EVENT_ELEC_SIGNATURE="Electronic Signature",e.EVENT_OP_START="Operation Start",e.EVENT_OP_END="Operation End",e.EVENT_LICENSED="Licensed"}(t.EnumAuditTrailEvent||(t.EnumAuditTrailEvent={})),function(e){e.WORKFLOWMANAGEMENT="WORKFLOWMANAGEMENT",e.USERMANAGEMENT="USERMANAGEMENT",e.ROLEMANAGEMENT="ROLEMANAGEMENT",e.CONFIGURATIONMANAGEMENT="CONFIGURATIONMANAGEMENT",e.AUDITTRAIL="AUDITTRAIL",e.ACCESSCONTROL="ACCESSCONTROL",e.DATAHANDLER="DATAHANDLER",e.DATABASEDRIVER="DATABASEDRIVER",e.ENCRYPTIONHELPER="ENCRYPTIONHELPER",e.RESULTMANAGEMENT="RESULTMANAGEMENT",e.EXTERNALCOMMUNICATION="EXTERNALCOMMUNICATION",e.IPPCLIENT="IPPCLIENT",e.LDAPCLIENT="LDAPCLIENT",e.NTPCLIENT="NTPCLIENT",
e.SMBCLIENT="SMBCLIENT",e.INTERNALCOMMUNICATION="INTERNALCOMMUNICATION",e.WORKFLOWAUTOMATIONHANDLER="WORKFLOWAUTOMATIONHANDLER",e.REPORTING="REPORTING",e.BACKUPRESTOREHANDLER="BACKUPRESTOREHANDLER",e.DEVICEDATA="DEVICEDATA",e.TIMERDAEMON="TIMERDAEMON",e.MODBUS="MODBUS",e.OSHELPER="OSHELPER",e.STATUSSERVICE="STATUSSERVICE",e.MESSAGEBROKER="MESSAGEBROKER",e.RESTCALLHANDLER="RESTCALLHANDLER",e.MENUHANDLER="MENUHANDLER",e.LOCALIZER="LOCALIZER",e.PARAMETER="PARAMETER",e.MESSAGEHANDLER="MESSAGEHANDLER",e.SELFMONITOR="SELFMONITOR",e.SENSORACTORHANDLER="SENSORACTORHANDLER",e.TASKMANAGEMENT="TASKMANAGEMENT",e.CALENDAR="CALENDAR",e.QAPP_FRAMEWORK="QAPP_FRAMEWORK",e.QAPPHANDLER="QAPPHANDLER",e.QAPPMANAGEMENT="QAPPMANAGEMENT",e.PROFILEMANAGEMENT="PROFILEMANAGEMENT",e.FIRMWARELOADER="FIRMWARELOADER",e.DEVICEMANAGER="DEVICEMANAGER",e.EXTERNALDEVICESERVICE="EXTERNALDEVICESERVICE",e.INTERFACEMANAGEMENT="INTERFACEMANAGEMENT",e.MOTIONSENSOR="MOTIONSENSOR",e.ALIBIMEMORY="ALIBIMEMORY",
e.CLOCKHANDLER="CLOCKHANDLER",e.WATCHDOG="WATCHDOG",e.CALIBRATIONADJUSTMENT="CALIBRATIONADJUSTMENT",e.CLIMATECONTROL="CLIMATECONTROL",e.DEVICEINFORMATION="DEVICEINFORMATION",e.DRAFTSHIELD="DRAFTSHIELD",e.IONIZER="IONIZER",e.LEVELING="LEVELING",e.WEIGHING="WEIGHING",e.COUNTING="COUNTING",e.PERCENTAGE="PERCENTAGE",e.CHECKWEIGHING="CHECKWEIGHING",e.CALCULATION="CALCULATION",e.PAPERWEIGHT="PAPERWEIGHT",e.LDAP="LDAP",e.MINUSP="MINUSP",e.QAPP="QAPP",e.CONNECTORMANAGEMENT="CONNECTORMANAGEMENT",e.IMPORTEXPORT="IMPORTEXPORT",e.TRANSFERMANAGEMENT="TRANSFERMANAGEMENT",e.__LAST__="__LAST__"}(c=t.EnumAuditTrailModule||(t.EnumAuditTrailModule={}));const u="QAPP_AUDITTRAIL_ENTRY_TASK_NAME";t.AuditTrailProxy=class extends a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="audit"}addEventWithParameters(e,t,s,a=""){let _=new n.LocalizerProxy,l=E.flatten(s.map(e=>{let t=[{id:e.title.id,args:e.title.args},{id:e.header.id,args:e.header.args}];return i.isTypeOfITextParameter(e)&&(t=[...t,{
id:e.value.text.id,args:e.value.text.args}]),t}));"object"==typeof t&&(l=[...l,{id:"GLP_TASK_NAME_TITLE",args:[]},{id:"GLP_TASK_NAME_HEADER",args:[]}]);let T=_.getTexts(l),A=0;for(let e of s)e.title.id=T[A++],e.title.args=[],e.header.id=T[A++],e.header.args=[],i.isTypeOfITextParameter(e)&&(e.value.text.id=T[A++],e.value.text.args=[]);if("object"==typeof t){let e=r.createEmptyTextParameter();e.appearance=o.EnumAppearance.ENABLED,e.id=u,e.title.id=T[A++],e.header.id=T[A++],e.value.text.id=t.getTaskName()||"---",s=[e,...s],t=c.QAPP}else if(t===c.QAPP)throw new Error("AuditTrailProxy::addEventWithParameters called with QAPP module enum but no QApp instance given.");let p=JSON.stringify(this.convertToEventParameters(s));return console.log(`AuditTrailProxy: send operation string: ' ${p}'`),this.addEventInternal(e,t,p,a)}addEvent(e,t,s,a=!1,i=""){let n;return a?(n=r.createEmptyStringParameter()).value.string=s:((n=r.createEmptyTextParameter()).value.text.id=s,n.info.suppressTitle=!0),n.id=u,
n.appearance=o.EnumAppearance.ENABLED,n.title.id="AUDITTRAIL_TITLE_NONE",n.header.id="AUDITTRAIL_HEADER_NONE",this.addEventWithParameters(e,t,[n],i)}addEventInternal(e,t,s,i=""){let n;this.body.method=l.RestMethodsAUDITTRAIL.addEventExt,this.body.params={auditTrailEvent:e,moduleName:t,operation:s,destination:i};try{return(n=new a.CubisRestResponse(this.syncRequest())).isSuccess()}catch(e){return console.log("Something went wrong when calling addEventExt"),console.log(e),!1}}convertToEventParameters(e){let t=new n.LocalizerProxy;return Array.from(e,e=>{let s=r.createEmptyTextParameter();switch(s.appearance=e.appearance,s.id=e.id,s.title=e.title,s.header=e.header,e.type){case o.EnumParameterTypes.PARAM_STRING:s.value.text.id=e.value.string;break;case o.EnumParameterTypes.PARAM_SELECTION:{const a=e.value.selection.id,i=e.info.options.find(e=>e.id===a),n=void 0!==i?t.getText(i.text.id,i.text.args):"---";s.value.text.id=n;break}case o.EnumParameterTypes.PARAM_MULTIPLE_SELECTION:{
const a=e.value.selections.map(t=>e.info.options.find(e=>e.id===t.id)).map(e=>void 0===e?{id:"---",args:[]}:{id:e.text.id,args:e.text.args}),i=t.getTexts(a);s.value.text.id=i.join(", ");break}case o.EnumParameterTypes.PARAM_QUANTITY:{const t=e.value;s.value.text.id=`${t.numbers[0]} ${t.unit}`;break}case o.EnumParameterTypes.PARAM_MEASURE:{const t=e.value;s.value.text.id=`${t.sign} ${t.number} ${t.unit}`;break}case o.EnumParameterTypes.PARAM_DATE_TIME:{const t=1e3*e.value.timestamp,{isDate:a,isTime:i}=e.info,n=_.getDateTimeConfiguration(),r=_.convertToDateTimeFormat(t,n);s.value.text.id=a&&!i?`${r.date}`:!a&&i?`${r.time}`:a&&i?`${r.date} ${r.time}`:"---";break}case o.EnumParameterTypes.PARAM_FORMULA:s.value.text.id=e.value[0].visual;break;case o.EnumParameterTypes.PARAM_TEXT:s.value=e.value;break;default:s.value.text.id="---"}return s})}getRecords(e){let t;if(this.body.method=l.RestMethodsAUDITTRAIL.getRecords,this.body.params=e,this.body.params.document="",
(t=new a.CubisRestResponse(this.syncRequest())).isSuccess()){let e=t.rawReturns.document;return JSON.parse(e).data}return console.log("AuditTrailProxy::getRecords: error returned: "+t.rawReturns),[]}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(18);!function(e){e.GREEN="#8CD31C",e.LIGHT_GREEN="#D8E4C0",e.YELLOW="#FADD37",e.WHITE="#FFFFFF",e.RED="#E60046",e.BLUE="#0069BE",e.LIGHT_RED="#E6B9B5",e.GREY="#C4C4C4"}(t.EnumColors||(t.EnumColors={}));t.BaseChart=class{constructor(){this.initialized=!1,this.canRemoveLastValue=!0,this.chartValues=[],this.chartConfiguration={}}removeLastValue(){if(!this.initialized)throw new Error("Chart object still not initialized.");this.canRemoveLastValue&&(this.chartValues.pop(),this.canRemoveLastValue=!1),this.recalculateChartData()}resetGraphTab(e){if(!this.initialized)throw new Error("Chart object still not initialized.");void 0!==e?(this.chartValues=e,this.canRemoveLastValue=!0):this.chartValues=[],
this.recalculateChartData()}getChartData(){if(this.initialized)return this.chartValues;throw new Error("Chart object still not initialized.")}sortByKeys(e){const t=[...Object.keys(e)].sort((e,t)=>parseFloat(e)-parseFloat(t));return a.map(t,t=>[t,e[t]])}getChartConfiguration(){if(this.initialized)return this.chartConfiguration;throw new Error("Chart object still not initialized.")}}}]);