/* COPYRIGHT by SARTORIUS (Sartorius Lab Instruments GmbH & Co. KG) */
!function(e){var t={};function s(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,s),a.l=!0,a.exports}s.m=e,s.c=t,s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},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=93)}([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.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}),t.cloneJSON=function(e){return JSON.parse(JSON.stringify(e))}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(2),a=s(10),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=i.cloneJSON(r);return a.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=i.cloneJSON(E);return a.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 i.cloneJSON(l)};const u={appearance:n.EnumAppearance.HIDDEN,id:"",text:o()};t.createEmptySelectionParameterOption=function(){return i.cloneJSON(u)};const c={id:"",type:n.EnumParameterTypes.PARAM_SELECTION,value:{selection:{id:""}},header:o(),title:o(),info:{options:[u]},appearance:n.EnumAppearance.HIDDEN};t.createEmptySelectionParameter=function(e){const t=i.cloneJSON(c);return a.isString(e)&&(t.id=e),t};const A={id:"",type:n.EnumParameterTypes.PARAM_MULTIPLE_SELECTION,value:{selections:[]},header:o(),title:o(),info:{options:[u]},appearance:n.EnumAppearance.HIDDEN};t.createEmptyMultipleSelectionParameter=function(e){const t=i.cloneJSON(A);return a.isString(e)&&(t.id=e),t},t.SAMPLE_DATE_TIME_ID="SAMPLE_DATE_TIME_ID";const T={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=i.cloneJSON(T);return a.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=i.cloneJSON(p);return a.isString(e)&&(t.id=e),t};const I={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=i.cloneJSON(I);return a.isString(e)&&(t.id=e),t};const d={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=i.cloneJSON(d);return a.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=i.cloneJSON(h);return a.isString(e)&&(t.id=e),t},t.createEmptyTextParameterValueOnly=function(){let e=i.cloneJSON(h);return e.info.suppressTitle=!0,e};const N={visual:"",eval:""};t.createEmptyFormulaParameterValue=function(){return i.cloneJSON(N)};const S={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=i.cloneJSON(S);return a.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 i.cloneJSON(m)};const R={id:"",type:n.EnumParameterTypes.PARAM_MEASURE,value:m,header:o(),title:o(),appearance:n.EnumAppearance.HIDDEN};t.createEmptyMeasureParameter=function(e){const t=i.cloneJSON(R);return a.isString(e)&&(t.id=e),t};const g={decimals:0,preferredDecimals:0,numbers:[],unit:""};t.createEmptyQuantityParameterValue=function(){return i.cloneJSON(g)},t.QUANTITY_PARAM_MIN_MAX_NAN="nan",t.QUANTITY_PARAM_NUMBERS_MAX=3;const P={id:"",type:n.EnumParameterTypes.PARAM_QUANTITY,value:g,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=i.cloneJSON(P);return a.isString(e)&&(t.id=e),t};const D={id:"",type:n.EnumParameterTypes.ALIBI_IDENTIFIER,value:{alibiIdentifier:NaN},header:o(),title:o(),appearance:n.EnumAppearance.ENABLED}
;t.createEmptyAlibiIdentifier=function(){return i.cloneJSON(D)}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(34),a="SUCCESS",n="FAILED";t.CubisRestResponse=class{constructor(e){if(this.restResponse=void 0,"boolean"==typeof e)this.result=e?a: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===a}};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 a=process.hrtime();let n=[s,"-H","Accept:application/json","-H","Content-Type:application/json","-H","Expect:","--data","@-"];e=i.spawnSync("curl",n,{input:t});const r=process.hrtime(a);return console.log(`${this.body.method} (hr): ${r[0]}s ${r[1]/1e6}ms`),e}}
},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 i=s(9),a=s(1);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 i.Subject,this.mqttHandler=e}show(){
console.log("AbstractScreen: show "+this.getId()+" @ "+a.MqttTopics.HMI_ACTIVE_QAPP_SCREEN),this.mqttHandler.publish(a.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 i=e?this.getMqttTopicBaseExtensible()+e:this.getMqttTopicBase();console.log("AbstractScreen: publishContent @ "+i),this.mqttHandler.publish(i,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.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,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(0),a=s(2);function n(e){return a.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=i.EnumAppearance.HIDDEN;return this.buttonJson.appearance&&"string"==typeof this.buttonJson.appearance&&Object.keys(i.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 i=s(2);function a(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=a,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
;a(s)||(s="id"),s=s;for(let i=0;i<e.length;i++)if(e[i].hasOwnProperty(s)&&a(e[i][s])&&e[i][s]===t)return e[i];return null},t.overwriteExistingAttributes=function(e,t){if(n(e)&&n(t)){let s=Object.keys(t);for(let a=0;a<s.length;a++)"function"!=typeof t[s[a]]&&e.hasOwnProperty(s[a])&&typeof t[s[a]]==typeof e[s[a]]&&(t[s[a]]=i.cloneJSON(e[s[a]]))}},t.setEnumSafely=function(e,t,s){const i=Object.keys(t);for(const s of i)if(t[s]===e)return t[s];return a(s)?s:i.length>0?t[i[0]]:void 0}},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}),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 i=s(15),a=s(30),n=s(10),r=s(2);var o,E
;function _(e,s,a){let n=t.unitsMap[E.NONE],r=t.unitsMap[E.NONE];if(null==e)return i.bignumber(NaN);if(!t.unitsMap.hasOwnProperty(s))return e;if(!t.unitsMap.hasOwnProperty(a))return e;if(n=t.unitsMap[s],r=t.unitsMap[a],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 a=_(n.isNumber(e)?i.bignumber(e):e,t,s);return null==a?NaN:a.toNumber()}function u(e,t){return d(e,t).toFixed(Math.max(0,t))}function c(e,s){let i=r.cloneJSON(e);i.alibi=void 0,i.alibiId=void 0;let n=t.unitsMap[e.unit],E=t.unitsMap[s];if(n.id===E.id)return i;if(n.unitConversionBase===o.UNDEFINED||E.unitConversionBase===o.UNDEFINED)return i;const _=[o.MASS,o.VOLUME];return n.unitConversionBase===E.unitConversionBase||_.includes(n.unitConversionBase)&&_.includes(E.unitConversionBase)?(i.value=l(i.value,e.unit,s),i.unit=s,i.decimals=i.decimals-a.getUnitShift(e.unit)+a.getUnitShift(s),i.decimals<0&&(i.decimals=0),delete i.alibiId,i):i}function A(e){return e?t.unitsMap.hasOwnProperty(e.toString())?t.unitsMap[e].mark:e.toString():""}function T(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 i=0;i<e.length;i++)n.isNumber(e[i])?t.push(e[i]):n.isObject(e[i])&&e[i].hasOwnProperty("value")&&n.isNumber(e[i].value)&&e[i].hasOwnProperty("unit")&&(s!==E.NONE?t.push(c(e[i],s).value):(t.push(e[i].value),s=e[i].unit));return t}function I(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 d(e,t){let s=i.bignumber(e),a=i.bignumber(10).pow(t);return s.times(a).round().dividedBy(a).toNumber()}function h(e){let t=p(e);return n.isObject(t)&&0!==t.length?i.sum(t):NaN}function N(e){let t=p(e);return n.isObject(e)&&0!==e.length?i.mean(t):NaN}function S(e,t){let s=[];for(let i=0;i<e.length;i++)n.isNumber(e[i].value)&&(s[i]=c(e[i],t));return{value:N(s),unit:t,decimals:I(s)}}function m(e,t){return n.isObject(e)?i.bignumber(e.value).dividedBy(t).toNumber():i.bignumber(e).dividedBy(t).toNumber()}function R(e){let t=p(e)
;return n.isObject(t)&&0!==t.length?i.std(t,"unbiased"):NaN}function g(e,t){let s=[];for(let i=0;i<e.length;i++)n.isNumber(e[i].value)&&(s[i]=c(e[i],t));return{value:R(s),unit:t,decimals:I(s)}}function P(e,t,s){if(e<2||!n.isNumber(t)||!n.isNumber(s))return NaN;const a=i.bignumber(1).dividedBy(i.bignumber(e).minus(1)),r=i.bignumber(s).minus(i.bignumber(t).pow(2).dividedBy(i.bignumber(e)));return a.isNaN()||r.isNaN()?NaN:i.sqrt(a.times(r.abs())).toNumber()}function D(e){let t=p(e);return n.isObject(t)&&0!==t.length?i.min(t):NaN}function O(e){let t=p(e);return n.isObject(t)&&0!==t.length?i.max(t):NaN}function M(e){let t=p(e);return n.isObject(t)&&0!==t.length?L(R(t),N(t)):NaN}function L(e,t){let s=0,a=0;return s=n.isObject(e)?e.value:e,a=n.isObject(t)?t.value:t,n.isObject(e)&&n.isObject(t)&&(s=c(e,t.unit).value),i.bignumber(s).dividedBy(a).times(100).toNumber()}function b(e,t,s){let a=NaN,r=NaN,o=NaN,_=E.NONE;return n.isObject(e)?(a=e.value,_=e.unit):a=e,
n.isObject(t)?_!==E.NONE?r=c(t,_).value:(r=t.value,_=t.unit):r=t,n.isObject(s)?_!==E.NONE?o=c(s,_).value:(o=s.value,_=s.unit):o=s,i.bignumber(o).minus(r).dividedBy(i.bignumber(a).times(6)).toNumber()}function f(e,t,s){return{value:b(e,t,s),unit:E.NONE,decimals:3}}function C(e,t,s,a){let r=NaN,o=NaN,_=NaN,l=NaN,u=E.NONE;return n.isObject(e)?(r=e.value,u=e.unit):r=e,n.isObject(t)?u!==E.NONE?o=c(t,u).value:(o=t.value,u=t.unit):o=t,n.isObject(s)?u!==E.NONE?_=c(s,u).value:(_=s.value,u=s.unit):_=s,n.isObject(a)?u!==E.NONE?l=c(a,u).value:(l=a.value,u=a.unit):l=a,i.min(i.bignumber(o).minus(_).dividedBy(i.bignumber(r).times(3)),i.bignumber(l).minus(o).dividedBy(i.bignumber(r).times(3))).toNumber()}function B(e,t,s,i){return{value:C(e,t,s,i),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 i={value:NaN,unit:E.NONE,decimals:0};if(n.isObject(e)){i=Object.assign(i,e);for(const e of Object.keys(i))["value","unit","decimals","auxiliaryDigits","alibiId","alibi","deviceserial","stable","timestamp","info"].includes(e)||delete i[e]
}else if(n.isObject(t))(t=t).value.numbers.length>0&&(i.value=parseFloat(t.value.numbers[0])),i.unit=T(t.value.unit),i.decimals=t.value.decimals;else if(n.isObject(s)){const e=(s=s).value;i.value=parseFloat(e.number),n.isNumber(i.value)||(i.info=e.number),n.isNumber(i.value)&&"-"===e.sign&&(i.value*=-1),i.decimals=e.decimals,i.unit=T(e.unit),i.stable=e.isStable,n.isNumber(e.auxiliaryDigits)&&e.auxiliaryDigits>0&&(i.auxiliaryDigits=e.auxiliaryDigits)}return i.unit=n.setEnumSafely(i.unit,E,E.NONE),i},t._formatQuantityParam_numberOnly=u,t.formatQuantityParam_numberOnly=function(e){return null!==e&&e.hasOwnProperty("value")&&e.hasOwnProperty("decimals")?n.isNumber(e.value)?u(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)?u(e.value,e.decimals)+" "+A(e.unit):"NaN":"N.A."},t.convertToTargetUnit=c,t.getUnitString=A,t.getUnitEnum=T,
t.math_getSimple_numberArray=p,t.math_count=function(e){return p(e).length},t.math_getMaximumDecimals=I,t.math_roundUp=function(e,t){let s=i.bignumber(e),a=s.minus(s.floor()),n=(a=a.times(i.bignumber(10).pow(t))).minus(a.floor());return i.larger(n,0)&&(a=a.minus(n).add(1)),a=a.dividedBy(i.bignumber(10).pow(t)),s.floor().add(a).toNumber()},t.math_roundAuto=d,t.math_detectLeastSignificantDigit=function(e){let t=0,s=1,a=i.bignumber(e).abs(),n=a.floor(),r=a.minus(n);for(;r.greaterThan(0);)t++,n=(r=r.times(10)).floor(),r=r.minus(n);return t>0&&(s=n.dividedBy(i.bignumber(10).pow(t)).toNumber()),s},t.math_sum=h,t.math_Sum=function(e,t){let s=[];for(let i=0;i<e.length;i++)n.isNumber(e[i].value)&&(s[i]=c(e[i],t));return{value:h(s),unit:t,decimals:I(s)}},t.math_mean=N,t.math_Mean=S,t.math_mean_longterm=m,t.math_Mean_Longterm=function(e,t,s){const i=c(e,s);return i.value=m(i,t),i},t.math_standard_deviation=R,t.math_Standard_Deviation=g,t.math_standard_deviation_longterm=P,
t.math_Standard_Deviation_Longterm=function(e,t,s,i){return c({value:P(e,(t=c(t,s.unit)).value,s.value),unit:s.unit,decimals:s.decimals},i)},t.math_minimum=D,t.math_Minimum=function(e,t){let s=[];for(let i=0;i<e.length;i++)n.isNumber(e[i].value)&&(s[i]=c(e[i],t));return{value:D(s),unit:t,decimals:I(s)}},t.math_maximum=O,t.math_Maximum=function(e,t){let s=[];for(let i=0;i<e.length;i++)n.isNumber(e[i].value)&&(s[i]=c(e[i],t));return{value:O(s),unit:t,decimals:I(s)}},t.math_variation_coefficient=M,t.math_Variation_Coefficient=function(e){let t=[];for(let s=0;s<e.length;s++)n.isNumber(e[s].value)&&(t[s]=c(e[s],E.GRAM));return{value:M(t),unit:E.PERCENT,decimals:2}},t.math_variation_coefficient_longterm=L,t.math_Variation_Coefficient_Longterm=function(e,t){return{value:L(c(e,t.unit),t),unit:E.PERCENT,decimals:2}},t.math_cp=function(e,t,s){let i=p(e);return n.isObject(e)&&0!==e.length?b(R(i),t,s):NaN},t.math_Cp=function(e,t,s){return f(g(e,t.unit),t,s)},t.math_cp_longterm=b,
t.math_Cp_Longterm=f,t.math_cpk=function(e,t,s){return C(R(e),N(e),t,s)},t.math_Cpk=function(e,t,s){return B(g(e,t.unit),S(e,t.unit),t,s)},t.math_cpk_longterm=C,t.math_Cpk_Longterm=B},function(e,t){e.exports=require("lodash")},function(e,t){e.exports=require("mathjs")},function(e,t){e.exports=require("fs")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(3),a=s(36),n=s(18),r=s(30),o=s(0);t.QUANTITY_PARAM_MAX_DIGITS_GENERAL=9;class E{static setValue(e,s,i=0,a=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return E.setValueValueWithDecimals(e.value,s,e.value.preferredDecimals,i,a)}static setValueValue(e,s,i=0,a=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return E.setValueValueWithDecimals(e,s,e.preferredDecimals,i,a)}static setValueWithDecimals(e,s,i,a=0,n=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return E.setValueValueWithDecimals(e.value,s,i,a,n)}static setValueValueWithDecimals(e,s,r,o=0,E=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL,_=!1){
let l="number"==typeof s?s:s.value,u=E-Math.floor(Math.abs(l)).toString().length,c=Math.min(u,r);c=Math.max(c,0),0===o&&e&&(e.decimals=c);let A=a.SartoMath.roundExactToDecimals(l,c).toFixed(c);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=i.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=i.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=i.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]=A}return A}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,i=!1){return e.numbers.forEach((t,a)=>{(0===a||i)&&-1!==e.preferredDecimals&&E.setValueValueWithDecimals(e,parseFloat(t),e.preferredDecimals,a,s,!0)}),e.numbers.map(e=>parseFloat(e))}static getValue(e,t=0){let s,i=(s=void 0!==e.value?e.value:e).numbers[t];return void 0!==i?parseFloat(i):Number.NaN}static getIntValue(e,t=0){let s,i=(s=void 0!==e.value?e.value:e).numbers[t];return void 0!==i?parseInt(i,10):Number.NaN}static changeUnit(e,s){let i;i=void 0!==e.value?e.value:e;const a=r.unitStringToLong(i.unit);i.numbers.forEach((e,n)=>{const o=r.convertWgtUnit(parseFloat(e),a,s);E.setValueValueWithDecimals(i,o,i.preferredDecimals,n,t.QUANTITY_PARAM_MAX_DIGITS_GENERAL,!0)}),i.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,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(47),a=s(29),n=s(2),r=s(4),o=s(10),E=s(0),_=s(34),l=s(55),u=s(35),c=s(5),A=s(13);function T(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),i=new RegExp(/[\/\?<>\\:\*\|"]/g),a=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(i,t)).replace(a,t)).replace(n,t)).replace(r,t)).replace(E,t)).length>255&&(e=e.substring(0,255)),e}function I(e){if(t.fs.existsSync(e))if(t.fs.lstatSync(e).isDirectory()){let i=t.fs.readdirSync(e,{encoding:"utf8",withFileTypes:!1});for(var s=0;s<i.length;s++)I(t.path.join(e,i[s]));t.fs.rmdirSync(e)}else t.fs.unlinkSync(e)}var d
;function h(e){let t={title:"",header:"",value:"",automaticManipulation:d.NONE};return o.isObject(e)&&(t=Object.assign(t,e)),t}function N(e,t,s){let i={method:t,params:s},a=JSON.stringify(i),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:a}),E=new r.CubisRestResponse(!1);try{E=new r.CubisRestResponse(o)}catch(e){E.rawReturns=e}return E}function S(e,t,s){return i.__awaiter(this,void 0,void 0,function*(){let i=u;return"https"===e&&(i=l),new Promise(function(e,a){let n=i.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){a(e)}})});n.on("error",function(e){a(e)}),n.on("timeout",function(){n.abort(),a("Request timeout")}),s&&n.write(s),n.end()})})}function m(e){let t={unit:A.EnumUnit.NONE,decimals:0,d:0,e:0,max:0,min:0,extended:{
d:A.createQuantity(),e:A.createQuantity(),max:A.createQuantity(),min:A.createQuantity()},ranges:{1:{d:A.createQuantity(),e:A.createQuantity(),max:A.createQuantity(),min:A.createQuantity()}},activeRangeIndex:"1"};return o.isObject(e)&&o.overwriteExistingAttributes(e,t),t}t.fs=s(16),t.path=s(37),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=[],i=[],a=[];for(let e=0;e<t.length;e++)o.isNumber(Number(t[e]))?s.push(t[e]):o.isString(t[e])?i.push(t[e]):a.push(t[e]);return i=i.sort(),a=a.sort(),(s=(s=s.sort(function(e,t){return Number(e)-Number(t)})).concat(i)).concat(a)},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=N("task/management",c.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 N("task/management",c.RestMethodsTASK_MANAGEMENT.saveWorkstate,{id:e,workstate:s})},t.loadTaskConfig_DATA_CONTAINER=function(e){let s=e.getGroup(T(54321));if(void 0===s)return;let i=[],a=T(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(a)){let t=parseInt(s.parameters[e].id.substring(a.length));o.isNumber(t)&&(i[t]=s.parameters[e].value.string)}try{return JSON.parse(i.join())}catch(e){return}},t.storeTaskConfig_DATA_CONTAINER=function(e,s,i){let a=e.getGroup(T(54321));if(i=!!o.isBoolean(i)&&i,void 0===a&&(e.addDynamicGroup({id:T(54321),type:E.EnumParameterTypes.PARAM_GROUP,appearance:E.EnumAppearance.HIDDEN,title:{id:"",args:[]},
parameters:[]}),a=e.getGroup(T(54321))),void 0===a)return new r.CubisRestResponse(!1);a.parameters=[];let n=JSON.stringify(s),_=0,l=0;for(;_<n.length;){(l=_+1e5)>n.length&&(l=n.length);let s={id:T(54321)+"/"+t.DYNAMIC_PARAMID_PREQUEL+"DATA_CONTAINER_"+a.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,a.parameters.push(s),e.updateParameter(s)}return!1===i?N("task/management",c.RestMethodsTASK_MANAGEMENT.updateTask,{task:JSON.stringify(e.getTask()),errorList:[]}):new r.CubisRestResponse(!0)},t.get_taskConfig_paramGroupID=T,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 i="",n=e.getTask(),r=e.getParameter("TASK/IDENTIFICATION/NAME"),o=t.fs.readdirSync(s,{encoding:"utf8",withFileTypes:!1}),E=new a.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 u=t.fs.readFileSync(t.path.join(s,o[l]),"utf8");(c=JSON.parse(u))&&c.taskname&&c.foldername&&!_.includes(c.taskname)&&(I(t.path.join(s,c.foldername)),I(t.path.join(s,o[l])))}else if(o[l].toString().startsWith("_TASK_"))try{E.readTask(o[l].toString().substring("_TASK_".length))}catch(e){I(t.path.join(s,o[l]))}if(null==n._id||""==n._id){let e=Date.now(),a={taskname:r.value.string,foldername:"_RENAME_TASK_ID_"+e};t.fs.writeFileSync(t.path.join(s,"_RENAME_TASK_ID_"+e+".json"),JSON.stringify(a)),i=t.path.join(s,"_RENAME_TASK_ID_"+e)}else for(i=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 c;u=t.fs.readFileSync(t.path.join(s,o[l]),"utf8"),(c=JSON.parse(u))&&c.taskname&&c.foldername&&c.taskname==r.value.string&&(t.fs.existsSync(t.path.join(s,c.foldername))?t.fs.existsSync(i)?(I(t.path.join(s,c.foldername)),I(t.path.join(s,o[l]))):(t.fs.renameSync(t.path.join(s,c.foldername),i),I(t.path.join(s,o[l]))):I(t.path.join(s,o[l])))}return t.fs.existsSync(i)||t.fs.mkdirSync(i),i},t.deleteFileFolderRecursive=I,t.createFolder=function(e){t.fs.existsSync(e)||t.fs.mkdirSync(e)},function(e){e.NONE="NONE",e.INCREMENT="INCREMENT",e.DECREMENT="DECREMENT"}(d=t.EnumIdentifierAutoManipulation||(t.EnumIdentifierAutoManipulation={})),t.EnumMapIdentifierAutoManipulation={[d.NONE]:"_QAPP_LIB_PARAM_SELECT_OPTION_SID_ON",[d.INCREMENT]:"_QAPP_LIB_PARAM_SELECT_OPTION_SID_ON_AUTO_INC",[d.DECREMENT]:"_QAPP_LIB_PARAM_SELECT_OPTION_SID_ON_AUTO_DEC"},t.getLotIDsParameterID=function(e){
o.isNumber(e)||(e=1),e=e;const s=T("_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=T("_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,i=0;const a=/\d*$/,r=t.value.match(a);switch(null!=r&&r.length>0&&o.isString(r[0])&&(i=r[0].length,s=parseInt(r[0])),t.automaticManipulation){case d.INCREMENT:""===t.value?t.value="001":""===t.value||o.isNumber(s)?""!==t.value&&o.isNumber(s)&&(s++,t.value=t.value.replace(a,s.toFixed(0).padStart(i,"0"))):t.value+="-2";break;case d.DECREMENT:""!==t.value&&o.isNumber(s)&&s>0&&(s--,t.value=t.value.replace(a,s.toFixed(0).padStart(i,"0")))}return t},t.perform_InternalWebserviceRequest=N,t.perform_WebserviceRequest=function(e,t,s,a,n,r,E,_,c,A,T){return i.__awaiter(this,void 0,void 0,function*(){o.isNumber(t)||(t="http"===s?80:443),o.isNumber(T)||(T=1e4);let i,p={hostname:e,port:t,path:n,method:a,followRedirects:!1,headers:r,timeout:T};c&&A&&(p.auth=c+":"+A),p.agent="https"===s?new l.Agent({host:e,keepAlive:!0,rejectUnauthorized:!1,port:t}):new u.Agent({keepAlive:!0}),
E&&void 0!==E&&(_=JSON.stringify(E)),_&&(p.headers["content-length"]=Buffer.byteLength(_));try{i=yield S(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 i})},t.httpRequest=S,t.getConfiguredPrintProfiles=function(){let e=[];const t=N("profilemanagement",c.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 i=o.getObjectByID(s.data[t].params,"PROFILE/IDENTIFICATION","id");if(o.isObject(i)&&o.isObject(i.parameters)){const a=o.getObjectByID(i.parameters,"PROFILE/IDENTIFICATION/NAME","id");o.isObject(a)&&o.isObject(a.value)&&e.push({id:s.data[t]._id,type:s.data[t].type,title:a.value.string})}}}
return e},t.createMetrology=m,t.getMetrology=function(e){let t=m(),s=N("weighing",c.RestMethodsWEIGHING.getParameter,{id:"WEIGHING/METROLOGY/RANGE",rObject:{}}),i="";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&&(i=e.value.numbers[0])}const a=N("weighing",c.RestMethodsWEIGHING.getRangeParameters,{parameters:{}});if(!(a.isSuccess()&&a.hasOwnProperty("rawReturns")&&a.rawReturns.hasOwnProperty("parameters")))return t;const n=JSON.parse(a.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 a="";const n=s.id.split("/")
;if(0===(a=n[n.length-1]).length)continue;const r={d:A.createQuantity(),e:A.createQuantity(),max:A.createQuantity(),min:A.createQuantity()};let E=o.getObjectByID(s.parameters,"WEIGHING/METROLOGY/RANGES/"+a+"/INTERVAL");E&&(r.d.value=parseFloat(E.value.numbers[0]),r.d.decimals=E.value.decimals,r.d.unit=A.getUnitEnum(E.value.unit.toString())),(E=o.getObjectByID(s.parameters,"WEIGHING/METROLOGY/RANGES/"+a+"/PRECISION"))&&(r.e.value=parseFloat(E.value.numbers[0]),r.e.decimals=E.value.decimals,r.e.unit=A.getUnitEnum(E.value.unit.toString())),(E=o.getObjectByID(s.parameters,"WEIGHING/METROLOGY/RANGES/"+a+"/MINIMUM"))&&(r.min.value=parseFloat(E.value.numbers[0]),r.min.decimals=E.value.decimals,r.min.unit=A.getUnitEnum(E.value.unit.toString())),(E=o.getObjectByID(s.parameters,"WEIGHING/METROLOGY/RANGES/"+a+"/MAXIMUM"))&&(r.max.value=parseFloat(E.value.numbers[0]),r.max.decimals=E.value.decimals,r.max.unit=A.getUnitEnum(E.value.unit.toString()),i===E.value.numbers[0]&&(t.activeRangeIndex=a)),
void 0===e&&(e=r.d.unit),r.d=A.convertToTargetUnit(r.d,e),r.e=A.convertToTargetUnit(r.e,e),r.e.decimals=r.d.decimals,r.min=A.convertToTargetUnit(r.min,e),r.min.decimals=r.d.decimals,r.max=A.convertToTargetUnit(r.max,e),r.max.decimals=r.d.decimals,t.ranges[a]=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=N("user",c.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=N("access",c.RestMethodsACCESS_MANAGEMENT.getCurrentUser,{user:""});try{let s=JSON.parse(t.rawReturns.user);e.id=s._id;let i=o.getObjectByID(s.params,"USER/SETTINGS");e.name=o.getObjectByID(i.parameters,"USER/SETTINGS/LOGINNAME").value.string,e.display_name=o.getObjectByID(i.parameters,"USER/SETTINGS/NAME").value.string,e.description=o.getObjectByID(i.parameters,"USER/SETTINGS/DESCRIPTION").value.string,e.role_id=o.getObjectByID(i.parameters,"USER/SETTINGS/ROLES").value.selection.id,e.role_name=o.getObjectByID(i.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});const i=s(3),a=s(2),n=s(1);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,i.isTypeOfIPasswordParameter(this.parameter)){let e=a.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})
;const i=s(58),a=s(59),n=s(60),r=s(48),o=s(62),E=s(12),_=s(22),l=s(63),u=s(23),c=s(66),A=s(49),T=s(29),p=s(41),I=s(51),d=s(70),h=s(71),N=s(52),S=s(11),m=s(44),R=s(3),g=s(73),P=s(6),D=s(26),O=s(74),M=s(37),L=s(16),b=s(14),f=s(18),C=s(75),B=s(27),v=s(43),y=s(76),U=s(2),G=s(7),H=s(77),F=s(78),x=s(79),Q=s(40),V=s(80),w=s(28),k=s(1),Y=s(0);s(81),t.HEARTBEAT_INTERVAL_MS=2e3;const W=100,q=500;t.STORAGE_LOCATION_BASE="/data/installedQApps/qapps/data";const j="STATE_SUSPENDING_INTERNAL",K="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",ie="BTN_RESTART_QUESTION_NO",ae="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 ## "+f.inspect(e).toString()):(console.log(" ## DEBUG ##"),console.log(f.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=Y.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 a=s(16);if(console.log("try reading debug config from file"),a.existsSync("/data/installedQApps/qapps/data/qapplog.conf"))try{console.log("...found config file")
;let e=JSON.parse(a.readFileSync("/data/installedQApps/qapps/data/qapplog.conf","utf8").toString());console.log("...got it"),Object.assign(this.debugCfg,e),console.log("...debug config (with defaults): "+f.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 Q.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 V.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 c.RestHandler,this.mqttHandler=new l.MqttHandler,this.taskMngProxy=new T.TaskProxy,this.localizerProxy=new A.LocalizerProxy,this.weighingProxy=new p.WeighingProxy,this.accessControlProxy=new d.AccessControlProxy,this.reportingProxy=new N.ReportingProxy,this.devicInformationProxy=new C.DeviceInformationProxy,this.messageHandlerProxy=new B.MessageHandlerProxy,this.messageHandlerHelper=new v.MessageHandlerHelper(this.messageHandlerProxy),this.taskHandler=new I.TaskHandler,this.heartbeatInterval$=i.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&&R.isTypeOfISelectionParameter(e)?e.value.selection.id:void 0}registerAspect(e){this.aspects[e.getId()]=e}init(){let e=new g.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===P.ScreenEventType.SHOW_SCREEN&&this.hideLoadingScreenOnShowScreens&&this.hideLoadingScreen(),e.type,P.ScreenEventType.SHOW_LOADINGSCREEN,e.type,P.ScreenEventType.SHOW_MESSAGEBOX})}catch(e){}}showScreen(e){if(!this.exitTimeOutPending)switch(e.getId()){case g.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 g.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()!==g.LOADING_OVERLAY_ID&&s.getId()!==x.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[g.LOADING_OVERLAY_ID];return void 0===e&&(e=new g.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===D.MQTT_ADMIN_EVENT_PACKET_SENT&&e.payload.packet.topic===k.MqttTopics.HMI_LOADING_MODAL_APPEARANCE&&JSON.parse(e.payload.packet.payload.toString()).appearance===Y.EnumAppearance.ENABLED}catch(e){return!1}}checkForLoadingScreenDisabledEvent(e){try{return e.payload.event===D.MQTT_ADMIN_EVENT_PACKET_SENT&&e.payload.packet.topic===k.MqttTopics.HMI_LOADING_MODAL_APPEARANCE&&JSON.parse(e.payload.packet.payload.toString()).appearance===Y.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(k.MqttTopics.REPORTING_PRINTQUEUE_DISPLAYED,JSON.stringify(e),{retain:!1})}}hidePrintQueue(){console.log("QAppBase::hidePrintQueue()");this.mqttHandler.publish(k.MqttTopics.REPORTING_PRINTQUEUE_DISPLAYED,JSON.stringify({enabled:!1}),{retain:!1})}clearPrintQueue(){void 0!==this.buttons.docuButton&&this.buttons.docuButton.setAppearance(Y.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(Y.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,i=5*t.HEARTBEAT_INTERVAL_MS,a=!1){let r=this.getCurrentState();console.log("QAppBase::enqueAsyncCall in state: "+r+" (timeout: "+i+"/fetchAfter: "+a+") with metadata: "+f.inspect(s));let E=this.generateAsyncCallidentifier();this.outstandingAsyncCalls.push(E);let _=new y.QAppAsyncCallTimeoutError(r,s),l=n.setTimeout(()=>{
console.log("QAppBase async call timeout - add timeout to event queue");let e=new o.InternalAsyncCallEvent({type:a?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)},i);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(f.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(a.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 k.MqttTopics.METROLOGY_MAX_DIGITS:case k.MqttTopics.METROLOGY_MAX_DIGITS_DEBUG:this.weighingProxy.updateWeighValueMaxDigits(parseInt(e.payload.value.toString(),10));break;case k.MqttTopics.METROLOGY_RANGES:this.weighingProxy.updateMetrologyRanges(JSON.parse(e.payload.value.toString()));break;case k.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(k.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")},W),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:S.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MBOX_LOGOUT_WARNING_TITLE",args:[]},buttons:[{id:ee,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:Y.EnumAppearance.ENABLED_SECONDARY},{id:te,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},appearance:Y.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:S.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MBOX_HOME_WARNING_TITLE",args:[]},buttons:[{id:Z,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:Y.EnumAppearance.ENABLED_SECONDARY},{id:z,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},appearance:Y.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(k.MqttTopics.QAPP_LOGOUT_REQUEST,JSON.stringify({request:ae}))}rememberLogout(){this.mqttHandler.publish(k.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(k.MqttTopics.QAPP_STOPPED,this.taskId?""+this.taskId:"",{retain:!1}),setTimeout(()=>{console.log("process.exit"),process.exit(0)},q),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:S.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MBOX_RESTART_QUESTION_TITLE",args:[]},buttons:[{id:se,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:Y.EnumAppearance.ENABLED_SECONDARY},{id:ie,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},
appearance:Y.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(Y.EnumAppearance.HIDDEN),e!==g.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(v.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(k.MqttTopics.QAPP_ERROR,(this.taskId?""+this.taskId:"")+"error: "+e,{retain:!1}),setTimeout(()=>{console.error("QAppBase: exit with error: "+e),process.exit(-1)},q),this.exitTimeOutPending=!0}heartbeat(e){this.isErrorStatePublished||(this.debugCfg.enableHeartbeatLog&&console.log("."),this.mqttHandler.publish(k.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===D.MQTT_ADMIN_EVENT_PACKET_SENT&&e.payload.packet.topic===k.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:S.EnumMessageboxType.INFO,title:{id:"_QAPP_LIB_MBOX_DEMO_INFO_TITLE",args:[]},buttons:[{id:$,label:{id:G.EnumFontLabels.OK,args:[]},appearance:Y.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,j):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,j);break;case o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_EXECFINALLY:this.transition(e,j)}},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,K):console.log("QAppBase: restart interrupted by QApp");break;case o.INTERNAL_RESTART_EVENT_TYPE.RESTART_EVENT_TYPE_EXECFINALLY:
this.transition(e,K)}});t[j]={_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[K]={_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===k.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 u.HmiButtonClickedEvent)if(e.payload.buttonId!==w.BTN_HOME_ID||this.suppressGlobalHomeBtnHandling)if(e.payload.buttonId!==w.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===ie)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===k.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(k.MqttTopics.METROLOGY_MAX_DIGITS),e.client.mqttHandler.subscribe(k.MqttTopics.METROLOGY_MAX_DIGITS_DEBUG),e.client.mqttHandler.subscribe(k.MqttTopics.METROLOGY_RANGES),e.client.mqttHandler.subscribe(k.MqttTopics.WEIGHING_SELECTED_DISPLAY_VALUE),e.client.mqttHandler.subscribe(k.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(v.MESSAGE_HANDLER_SECRET_TYPE.QAPP);s&&t.push({categoryAsString:B.MessageHandlerCategory.QAPP,secret:s});let i=e.client.messageHandlerHelper.buildSecret(v.MESSAGE_HANDLER_SECRET_TYPE.QAPP_DB_ERROR);i&&t.push({categoryAsString:B.MessageHandlerCategory.QAPP,secret:i})
;let a=e.client.messageHandlerHelper.buildSecret(v.MESSAGE_HANDLER_SECRET_TYPE.QAPP_RUNTIME_COMM_ERROR);a&&t.push({categoryAsString:B.MessageHandlerCategory.QAPP,secret:a});let n=e.client.messageHandlerHelper.buildSecret(v.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(v.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),i&&e.client.messageHandlerProxy.deleteMessageByCategory(B.MessageHandlerCategory.QAPP,i),
a&&e.client.messageHandlerProxy.deleteMessageByCategory(B.MessageHandlerCategory.QAPP,a),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(k.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:"---",T.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,i=this.taskHandler.getTask();switch(e){case O.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT:s=t.STORAGE_LOCATION_BASE;break;case O.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC:i&&(s=this.getStorageLocation(O.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT)+M.sep+i.qappOrderNumber);break;case O.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION:i&&(s=this.getStorageLocation(O.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC)+M.sep+i.qappVersion);break;case O.EnumPersistencyScope.PERSISTENCY_SCOPE_TASk_SPECIFIC:i&&this.taskId&&(s=this.getStorageLocation(O.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION)+M.sep+this.taskId)}return s}
createStorageLocation(e){let t=s(16),i=this.getStorageLocation(O.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT);if(void 0!==i){if(!t.existsSync(i))return!1;if(e!==O.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT){let s=this.getStorageLocation(O.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC);if(void 0!==s){if(t.existsSync(s)||t.mkdirSync(s),e!==O.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC){let s=this.getStorageLocation(O.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION);if(void 0!==s){if(t.existsSync(s)||t.mkdirSync(s),e!==O.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION){return void 0!==this.getStorageLocation(O.EnumPersistencyScope.PERSISTENCY_SCOPE_TASk_SPECIFIC)&&(t.existsSync(this.getStorageLocation(O.EnumPersistencyScope.PERSISTENCY_SCOPE_TASk_SPECIFIC))||t.mkdirSync(this.getStorageLocation(O.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,i=void 0,a="";this.scriptPath?a=M.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=a+"qapp.desc_"+e+".json",i=L.readFileSync(n)}catch(e){console.log("QAppConfigBase: - no "+n+" found - try DEFAULT");try{n=a+"qapp.desc_DEFAULT.json",i=L.readFileSync(n)}catch(e){t?this.exitError("QAppConfigBase::readQAppDescAsJSON - "+n+" (fallback) missing"):console.log("QAppConfigBase::readQAppDescAsJSON - "+n+" (fallback) missing")}}try{i&&(s=JSON.parse(i.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 i=U.cloneJSON(e),a=U.cloneJSON(s);return 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=[])})}),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=[])})}),b.isEqual(i,a)}deleteDBError(){let e=this.messageHandlerHelper.buildSecret(v.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}),t.EV_MQTT_UPDATE="EV_MQTT_UPDATE";class i{constructor(e){this.payload=e,this.type=t.EV_MQTT_UPDATE}}t.MqttUpdateEvent=i,t.EV_MQTT_UPDATE_DEBUG="EV_MQTT_UPDATE_DEBUG";t.MqttUpdateDebugEvent=class extends i{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 i=s(40);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 i.URL("http://127.0.0.1/"+e.payload.subUrl).searchParams}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(3),a=s(20),n=s(6);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=i.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 a.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 i=s(11),a=s(0),n=s(7);t.ParamUpdateUserActionSimpleAccept_OK_BUTTON_ID="BTN_OK",t.ParamUpdateUserActionSimpleAccept={type:i.EnumMessageboxType.ERROR,title:{id:"_QAPP_LIB_MSG_BOX_WARNING_UPDATE_TASK_PARAM",args:[]},textList:[],buttons:[{appearance:a.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 i=s(4),a=s(0),n=s(18),r=s(7),o=s(5);var E,_,l;function u(e,s,i){return{
appearance:a.EnumAppearance.ENABLED_SECONDARY,type:_.CALLBACK,name:s||r.EnumFontLabels.OK,effect:{method:"buttonClickEvent",module:"qappHandler",params:{buttonId:e||t.MESSAGEHANDLER_OK_BTN_ID},calltarget:i||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=u;t.MessageHandlerProxy=class extends i.BaseProxy{constructor(){super(...arguments),this.restEndpoint="messagehandler"}addMessage(e,t,s,a,r,E,_,l,c,A){return this.body.method=o.RestMethodsMESSAGE_HANDLER.addMessage,this.body.params={message:{errorCode:e,type:t,lifetime:a,title:r,reason:E,solution:_,buttons:c||[u()],category:s,categorysecret:l},showMessageInFutureMillis:A||0,uniqueMessageId:0},console.log("addMessageHandler: "+n.inspect(this.body.params.message)),new i.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 i.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 i.CubisRestResponse(this.syncRequest())}getAllMessagesByCategory(e){this.body.method=o.RestMethodsMESSAGE_HANDLER.getAllMessagesByCategory,this.body.params={categoryAsString:e,messages:{}};let t=new i.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 i.CubisRestResponse(this.syncRequest())}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(0),a=s(7),n=s(2),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:a.EnumFontLabels.RESULT,args:[]},appearance:i.EnumAppearance.HIDDEN};t.createEvalButtonData=function(){return n.cloneJSON(o)},t.BTN_NEXT_ID="BTN_NEXT";const E={buttonId:t.BTN_NEXT_ID,label:{id:a.EnumFontLabels.NEXT,args:[]},appearance:i.EnumAppearance.HIDDEN};t.createNextButtonData=function(){return n.cloneJSON(E)},t.BTN_PREV_ID="BTN_PREV";const _={buttonId:t.BTN_PREV_ID,label:{id:a.EnumFontLabels.PREV,args:[]},appearance:i.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:a.EnumFontLabels.BACK,args:[]},appearance:i.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 u={buttonId:t.BTN_DOCU_ID,label:{id:a.EnumFontLabels.DOCU,args:[]},appearance:i.EnumAppearance.HIDDEN};t.createDocuButtonData=function(){return n.cloneJSON(u)},t.BTN_SEND_ID="BTN_SEND";const c={buttonId:t.BTN_SEND_ID,label:{id:a.EnumFontLabels.DOCU,args:[]},appearance:i.EnumAppearance.HIDDEN};t.createSendButtonData=function(){return n.cloneJSON(c)},t.BTN_INVALIDATE_SAMPLE_ID="BTN_INVALIDATE_SAMPLE";const A={buttonId:t.BTN_INVALIDATE_SAMPLE_ID,label:{id:a.EnumFontLabels.INVALIDATE_SAMPLE,args:[]},appearance:i.EnumAppearance.HIDDEN};t.createInvalidateSampleButtonData=function(){return n.cloneJSON(A)},t.BTN_PRINT_LABEL_ID="BTN_PRINT_LABEL";const T={buttonId:t.BTN_PRINT_LABEL_ID,label:{id:"_QAPP_LIB_PRINT_LABEL_BTN_TITLE",args:[]},
appearance:i.EnumAppearance.HIDDEN};t.createPrintLabelButtonData=function(){return n.cloneJSON(T)},t.BTN_START_ID="BTN_START";const p={buttonId:t.BTN_START_ID,label:{id:a.EnumFontLabels.START,args:[]},appearance:i.EnumAppearance.HIDDEN};t.createStartButtonData=function(){return n.cloneJSON(p)},t.BTN_END_ID="BTN_END";const I={buttonId:t.BTN_END_ID,label:{id:a.EnumFontLabels.END,args:[]},appearance:i.EnumAppearance.HIDDEN};t.createEndButtonData=function(){return n.cloneJSON(I)},t.BTN_PRINTADD_ID="BTN_PRINTADD";const d={buttonId:t.BTN_PRINTADD_ID,label:{id:a.EnumFontLabels.PRINT_ADD,args:[]},appearance:i.EnumAppearance.HIDDEN};t.createPrintAddButtonData=function(){return n.cloneJSON(d)},t.BTN_CANCEL_ID="BTN_CANCEL";const h={buttonId:t.BTN_CANCEL_ID,label:{id:a.EnumFontLabels.CANCEL,args:[]},appearance:i.EnumAppearance.HIDDEN};t.createCancelButtonData=function(){return n.cloneJSON(h)},t.BTN_SEARCH_ID="BTN_SEARCH";const N={buttonId:t.BTN_SEARCH_ID,label:{id:a.EnumFontLabels.SEARCH,args:[]},
appearance:i.EnumAppearance.HIDDEN};t.createSearchButtonData=function(){return n.cloneJSON(N)},t.setNoSearchActive=function(e,t=!0){e.setLabel({id:a.EnumFontLabels.SEARCH,args:[]},t)},t.setSearchActive=function(e,t=!0){e.setLabel({id:a.EnumFontLabels.SEARCH_ACTIVE,args:[]},t)},t.BTN_FILTER_ID="BTN_FILTER";const S={buttonId:t.BTN_FILTER_ID,label:{id:a.EnumFontLabels.FILTER,args:[]},appearance:i.EnumAppearance.HIDDEN};t.createFilterButtonData=function(){return n.cloneJSON(S)},t.setNoFilterActive=function(e,t=!0){e.setLabel({id:a.EnumFontLabels.FILTER,args:[]},t)},t.setFilterActive=function(e,t=!0){e.setLabel({id:a.EnumFontLabels.FILTER_ACTIVE,args:[]},t)},t.BTN_ADD_ID="BTN_ADD";const m={buttonId:t.BTN_ADD_ID,label:{id:a.EnumFontLabels.ADD,args:[]},appearance:i.EnumAppearance.HIDDEN};t.createAddButtonData=function(){return n.cloneJSON(m)},t.BTN_DELETE_ID="BTN_DELETE";const R={buttonId:t.BTN_DELETE_ID,label:{id:a.EnumFontLabels.DELETE,args:[]},appearance:i.EnumAppearance.HIDDEN}
;t.createDeleteButtonData=function(){return n.cloneJSON(R)},t.BTN_HOME_ID="BTN_HOME",t.HOME_BUTTON_ICON="./02_menu";const g={buttonId:t.BTN_HOME_ID,label:{id:a.EnumFontLabels.CANCEL,args:[]},icon:t.HOME_BUTTON_ICON,appearance:i.EnumAppearance.HIDDEN};t.createHomeButtonData=function(){return n.cloneJSON(g)},t.BTN_LOGOUT_ID="BTN_LOGOUT";const P={buttonId:t.BTN_LOGOUT_ID,label:{id:a.EnumFontLabels.LOGOUT,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY};t.createLogoutButtonData=function(){return n.cloneJSON(P)},t.BTN_RELOAD_ID="BTN_RELOAD";const D={buttonId:t.BTN_RELOAD_ID,label:{id:a.EnumFontLabels.RELOAD,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY};t.createReloadButtonData=function(){return n.cloneJSON(D)},t.BTN_OPEN_WEIGHING_ID="BTN_OPEN_WEIGHING";const O={buttonId:t.BTN_OPEN_WEIGHING_ID,label:{id:a.EnumFontLabels.WEIGHING,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY};t.createOpenWeighingButtonData=function(){return n.cloneJSON(O)},t.BTN_OK_ID="BTN_OK"
;const M={buttonId:t.BTN_OK_ID,label:{id:a.EnumFontLabels.OK,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY};t.createOKButtonData=function(){return n.cloneJSON(M)}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(4),a=s(5);!function(e){e.EVENT_RESTART="restart"}(t.EnumTaskManagementEvent||(t.EnumTaskManagementEvent={}));class n extends i.CubisRestResponse{constructor(e){super(e)}getErrorList(){return JSON.parse(this.rawReturns.errorList)}}t.TaskValCreaUpdResponse=n;t.TaskProxy=class extends i.BaseProxy{constructor(){super(...arguments),this.restEndpoint="task/management"}getTaskTemplate(){let e,t;return this.body.method=a.RestMethodsTASK_MANAGEMENT.getTaskTemplate,this.body.params={taskTemplate:{}},e=new i.CubisRestResponse(this.syncRequest()),t=JSON.parse(e.rawReturns.taskTemplate)}readTask(e,t=!0){let s,n;if(this.body.method=a.RestMethodsTASK_MANAGEMENT.readTask,this.body.params={document:{},dbId:e,updateOptions:t},
!(s=new i.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=a.RestMethodsTASK_MANAGEMENT.createTask,this.body.params={task:JSON.stringify(e),errorList:[]},new n(this.syncRequest())}updateTask(e){return this.body.method=a.RestMethodsTASK_MANAGEMENT.updateTask,this.body.params={task:JSON.stringify(e),errorList:[]},new n(this.syncRequest())}validateTask(e){return this.body.method=a.RestMethodsTASK_MANAGEMENT.validate,this.body.params={task:JSON.stringify(e),errorList:[]},new n(this.syncRequest())}saveWorkstate(e,t){let s;if(this.body.method=a.RestMethodsTASK_MANAGEMENT.saveWorkstate,this.body.params={id:t,workstate:e},
!(s=new i.CubisRestResponse(this.syncRequest())).isSuccess())throw new Error("Error saving workstate with id '"+t+"'");return s}deleteWorkstate(e){let t;if(this.body.method=a.RestMethodsTASK_MANAGEMENT.deleteWorkstate,this.body.params={id:e},!(t=new i.CubisRestResponse(this.syncRequest())).isSuccess())throw new Error("Error deleting workstate with id '"+e+"'");return t}getWorkstate(e){let t,s;if(this.body.method=a.RestMethodsTASK_MANAGEMENT.getWorkstate,this.body.params={id:e,workstate:{}},!(t=new i.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=a.RestMethodsTASK_MANAGEMENT.getTaskNamesByOrderNumber,this.body.params={orderNumber:e,taskNames:[]},(t=new i.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=a.RestMethodsTASK_MANAGEMENT.setTaskEvent,this.body.params={taskId:e,event:t};try{return(s=new i.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 i=s(36),a=s(15);var n=s(15);t.bignumber=n.bignumber,t.abs=n.abs;const r=s(13);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 a.bignumber(s).times(i.SartoMath.decPowers(o(e))).times(i.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 i=[r.EnumUnit.GRAD_CELSIUS,r.EnumUnit.GRAD_FAHRENHEIT,E.C,E.F];return i.includes(t)&&i.includes(s)?r.convertValueToTargetUnit(e,t,s):e},
t.convertPressureUnit=function(e,t,s){const i=[r.EnumUnit.HECTOPASCAL,r.EnumUnit.KILOPASCAL,E.hPa,E.kPa];return i.includes(t)&&i.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 i=s(2);t.AbstractQAppAspect=class{configure(e){this.cfg=Object.assign(void 0!==this.cfg?this.cfg:{},e)}getConfig(){return i.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,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(0),a=s(6);t.AbstractOverlay=class extends a.AbstractScreen{show(){this.publishContent("",'{ "appearance":"'+i.EnumAppearance.ENABLED+'" }'),this.events$.next({type:a.ScreenEventType.SHOW_OVERLAY,id:this.getId()})}hide(){this.publishContent("",'{ "appearance":"'+i.EnumAppearance.HIDDEN+'" }'),this.events$.next({type:a.ScreenEventType.HIDE_OVERLAY,id:this.getId()})}}},function(e,t){e.exports=require("child_process")},function(e,t){e.exports=require("http")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(15);class a{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 i.bignumber(e).times(a.decPowers(t)).toNumber()}static countDecimals(e){return i.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=a},function(e,t){
e.exports=require("path")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(0),a=s(6),n=s(9),r=s(1);t.CANCEL_BUTTON_ID="BTN_CANCEL";class o{constructor(e){this.paramDetailsOverlayObject={appearance:i.EnumAppearance.HIDDEN,title:{id:"",args:[]},params:[]},this.events$=new n.Subject,this.mqttHandler=e}setAppearance(e){this.paramDetailsOverlayObject.appearance!==e&&(e!==i.EnumAppearance.HIDDEN&&e!==i.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!==i.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!==i.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===i.EnumAppearance.ENABLED&&(this.setAppearance(i.EnumAppearance.HIDDEN),this.events$.next({type:a.ScreenEventType.HIDE_OVERLAY,id:this.getId()}))}show(){this.paramDetailsOverlayObject.appearance===i.EnumAppearance.HIDDEN&&(this.setAppearance(i.EnumAppearance.ENABLED),this.events$.next({
type:a.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 i=s(3),a=s(17),n=s(25),r=s(2);t.checkGeneralParamRules=function(e){let t=void 0;if(i.isTypeOfIQuantityParameter(e)){let s=a.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(i.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(i.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){e.exports=require("url")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(14),a=s(42),n=s(4),r=s(17),o=s(27),E=s(43),_=s(21),l=s(69),u=s(5),c=s(13),A=s(50);var T,p=s(42);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"}(T=t.ISelectedWeightDisplayValueDomains||(t.ISelectedWeightDisplayValueDomains={}));const I="WEIGHING_ERROR_UNKNOWN_UNIT_ID";t.WeighingProxy=class extends n.BaseProxy{constructor(){super(...arguments),this.restEndpoint="weighing",this.weighValueMaxDigits=7,this.registeredApplications=[],this.weighingButtonAppearances={[A.WEIGHING_BUTTON_ID.UNIT]:"undefined",[A.WEIGHING_BUTTON_ID.DO_ZERO]:"undefined",[A.WEIGHING_BUTTON_ID.DO_TARE]:"undefined",
[A.WEIGHING_BUTTON_ID.DO_TARE1]:"undefined",[A.WEIGHING_BUTTON_ID.CLR_TARE1]:"undefined",[A.WEIGHING_BUTTON_ID.SET_TARE1]:"undefined",[A.WEIGHING_BUTTON_ID.SHOW_TARE1]:"undefined",[A.WEIGHING_BUTTON_ID.HIDE_TARE1]:"undefined",[A.WEIGHING_BUTTON_ID.DISPLAY]:"undefined"},this.metrologyMaximum$=new a.ReplaySubject(1),this.metrologyMinimum$=new a.ReplaySubject(1),this.highestRangeInterval$=new a.ReplaySubject(1),this.lowestRangeInterval$=new a.ReplaySubject(1),this.highestRangePrecision$=new a.ReplaySubject(1),this.lowestRangePrecision$=new a.ReplaySubject(1),this.metrologyRanges$=new a.ReplaySubject(1),this.selectedDisplayValue$=new a.ReplaySubject(1),this.lastSelectedDisplayValueInfo={currentSelectedDomain:T.SELECTED_DOMAIN_UNDEFINED,currentSelectedId:"",lastSelectedApplicationId:""}}createWeightApplication(e,t,s,i,a=!1){if(this.registeredApplications.find(t=>t===e))return this.enableWeightApplication(e,a);{this.body.method=u.RestMethodsWEIGHING.createWeightApplication,this.body.params={
id:e,title:t,header:s,isDynamic:i};let r=new n.CubisRestResponse(this.syncRequest());if(r.isSuccess()){try{this.enableWeightApplication(e,a)}catch(e){}this.registeredApplications.push(e)}return r}}enableWeightApplication(e,t){return this.body.method=u.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=u.RestMethodsWEIGHING.selectWeightApplication,this.body.params={id:e},new n.CubisRestResponse(this.syncRequest())}destroyWeightApplication(e){this.body.method=u.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=u.RestMethodsWEIGHING.setButton,this.body.params={name:e,appearance:t},new n.CubisRestResponse(this.syncRequest()))}triggerStableWeightBlock(){return this.body.method=u.RestMethodsWEIGHING.triggerStableWeightBlock,this.body.params={},new n.CubisRestResponse(this.syncRequest())}cancelStableWeightBlock(){return this.body.method=u.RestMethodsWEIGHING.cancelStableWeightBlock,this.body.params={},new n.CubisRestResponse(this.syncRequest())}doZero(e){return this.body.method=u.RestMethodsWEIGHING.doZero,this.body.params={behavior:e},new n.CubisRestResponse(this.syncRequest())}clearTare1(){return this.body.method=u.RestMethodsWEIGHING.clearTare1,this.body.params={},
new n.CubisRestResponse(this.syncRequest())}clearTare2(){return this.body.method=u.RestMethodsWEIGHING.clearTare2,this.body.params={},new n.CubisRestResponse(this.syncRequest())}clearTare1AndTare2(){return{clearTare1Response:this.clearTare1(),clearTare2Response:this.clearTare2()}}clearTareAll(){return this.body.method=u.RestMethodsWEIGHING.clearTareAll,this.body.params={},new n.CubisRestResponse(this.syncRequest())}doTare(e){return this.body.method=u.RestMethodsWEIGHING.doTare,this.body.params={behavior:e},new n.CubisRestResponse(this.syncRequest())}doTare1(e){return this.body.method=u.RestMethodsWEIGHING.doTare1,this.body.params={behavior:e},new n.CubisRestResponse(this.syncRequest())}doTareAuto(e){return this.body.method=u.RestMethodsWEIGHING.doTareAuto,this.body.params={behavior:e},new n.CubisRestResponse(this.syncRequest())}doZeroTareAuto(e){return this.body.method=u.RestMethodsWEIGHING.doZeroTareAuto,this.body.params={behavior:e},new n.CubisRestResponse(this.syncRequest())}
setTare1(e){return this.body.method=u.RestMethodsWEIGHING.setTare1,this.body.params={value:e},new n.CubisRestResponse(this.syncRequest())}cancelDoing(){return this.body.method=u.RestMethodsWEIGHING.cancelDoing,this.body.params={},new n.CubisRestResponse(this.syncRequest())}setTare2(e){return this.body.method=u.RestMethodsWEIGHING.setTare2,this.body.params={value:e},new n.CubisRestResponse(this.syncRequest())}setUnit(e,t=!0){this.body.method=u.RestMethodsWEIGHING.setUnit,this.body.params={unitId:e};let s=new n.CubisRestResponse(this.syncRequest());if(s.isSuccess())return!0;if(s.result===I){if(t){let t=new E.MessageHandlerHelper(new o.MessageHandlerProxy),s=new l.ProfileManagementProxy,i=_.QAppBase.clientSingleton.getWeighingProfileId();t.addMessage(E.EMsgHandlerMsgs.ERR_704_UNIT_UNAVAILABLE,[_.QAppBase.clientSingleton.getTaskName()||"",c.getUnitString(e),i?s.getWeighingProfileName(i):""],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=u.RestMethodsWEIGHING.getParameter,this.body.params={rObject:{},id:e},new n.CubisRestResponse(this.syncRequest())}getParameterIds(){return this.body.method=u.RestMethodsWEIGHING.getParameterIds,this.body.params={rIds:{}},new n.CubisRestResponse(this.syncRequest())}setMinUsp(e){return this.body.method=u.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=u.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=i.last(e.parameters),s=i.head(e.parameters)
;if(this.metrologyRanges$.next(e),void 0!==t){let e=t.parameters.find(e=>"MAXIMUM"===i.last(e.id.split("/"))),s=t.parameters.find(e=>"INTERVAL"===i.last(e.id.split("/"))),a=t.parameters.find(e=>"PRECISION"===i.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!==a&&this.highestRangePrecision$.next({precisionUnit:a.value.unit,precisionValue:r.QuantityParameter.getValue(a),precisionDecimals:a.value.decimals})}if(void 0!==s){let e=s.parameters.find(e=>"MINIMUM"===i.last(e.id.split("/"))),t=s.parameters.find(e=>"INTERVAL"===i.last(e.id.split("/"))),a=s.parameters.find(e=>"PRECISION"===i.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!==a&&this.lowestRangePrecision$.next({precisionUnit:a.value.unit,precisionValue:r.QuantityParameter.getValue(a),precisionDecimals:a.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===T.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=u.RestMethodsWEIGHING.insertWeightInvalidation,this.body.params={group:e,topic:t},new n.CubisRestResponse(this.syncRequest())}removeWeightInvalidation(e,t){return this.body.method=u.RestMethodsWEIGHING.removeWeightInvalidation,this.body.params={group:e,topic:t},new n.CubisRestResponse(this.syncRequest())}setAmbientCondition(e){return this.body.method=u.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 i=s(27),a=s(3),n=s(67),r=s(21),o=s(68),E="_QAPP_MSG_HANDLER_",_="_TITLE",l="_REASON",u="_SOLUTION";var c;function A(e){return e+"_"+i.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"}(c=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=A,t.isMessageHandlerOkButton=function(e){return e.endsWith(i.MESSAGEHANDLER_OK_BTN_ID)};const T={ERR_702:{errorCode:702,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.USER_CAL,
lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_EXPLICIT_DELETION,secretType:c.MANUAL},ERR_703:{errorCode:703,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.WARNING,category:i.MessageHandlerCategory.USER_CAL,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},INFO_USERCAL_CAL_OVERALL_PASSED:{errorCode:0,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.INFORMATION,category:i.MessageHandlerCategory.USER_CAL,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},INFO_USERCAL_ERROR_NO_INVALIDATION:{errorCode:0,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.USER_CAL,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_704:{errorCode:704,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.TASKID},
ERR_710:{errorCode:710,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.WARNING,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},INFO_STARLIMS_CAL_OVERALL_PASSED:{errorCode:0,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.INFORMATION,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_711:{errorCode:711,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_712:{errorCode:712,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_713:{errorCode:713,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,
lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_714:{errorCode:714,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_715:{errorCode:715,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_716:{errorCode:716,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_717:{errorCode:717,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_718:{errorCode:718,
type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_790:{errorCode:790,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_DB_ERROR,buttons:[i.createMessageHandlerButton(A(790))]},ERR_791:{errorCode:791,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_DB_ERROR,buttons:[i.createMessageHandlerButton(A(791))]},ERR_792:{errorCode:792,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_DB_ERROR,buttons:[i.createMessageHandlerButton(A(792))]},ERR_793:{
errorCode:793,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_DB_ERROR,buttons:[i.createMessageHandlerButton(A(793))]},ERR_794:{errorCode:794,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_DB_ERROR,buttons:[i.createMessageHandlerButton(A(794))]},ERR_795:{errorCode:795,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_DB_ERROR,buttons:[i.createMessageHandlerButton(A(795))]},ERR_796:{errorCode:796,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,
secretType:c.QAPP_DB_ERROR,buttons:[i.createMessageHandlerButton(A(796))]},ERR_797:{errorCode:797,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_DB_ERROR,buttons:[i.createMessageHandlerButton(A(797))]},ERR_798:{errorCode:798,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_RUNTIME_COMM_ERROR},ERR_799:{errorCode:799,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_RUNTIME_EXIT_ERROR}};t.MessageHandlerHelper=class{constructor(e){this.messageHandlerProxy=e}buildSecret(e){switch(e){case c.TASKID:return r.QAppBase.clientSingleton.getTaskId();case c.QAPP:
return r.QAppBase.clientSingleton.getQAppOrderNumber();case c.QAPP_DB_ERROR:return r.QAppBase.clientSingleton.getQAppOrderNumber()+c.QAPP_DB_ERROR;case c.QAPP_RUNTIME_COMM_ERROR:return r.QAppBase.clientSingleton.getQAppOrderNumber()+c.QAPP_RUNTIME_COMM_ERROR;case c.QAPP_RUNTIME_EXIT_ERROR:return r.QAppBase.clientSingleton.getQAppOrderNumber()+c.QAPP_RUNTIME_EXIT_ERROR;case c.MANUAL:default:return}}addMessage(e,t,s,i){console.log(`messageHandlerHelper::addMessage: ${e}`);let c=a.createEmptyTextStructure(),A=a.createEmptyTextStructure(),p=a.createEmptyTextStructure(),I=0;0===T[e].errorCode?(c.id=E+e+_,A.id=E+e+l,p.id=E+e+u):I=T[e].errorCode;let d=[];for(799!==T[e].errorCode&&798!==T[e].errorCode||d.push(r.QAppBase.clientSingleton.getQAppOrderNumber()),790!==T[e].errorCode&&791!==T[e].errorCode&&792!==T[e].errorCode&&793!==T[e].errorCode&&794!==T[e].errorCode&&795!==T[e].errorCode&&796!==T[e].errorCode&&797!==T[e].errorCode||(d.push(r.QAppBase.clientSingleton.getQAppOrderNumber()),
d.push(r.QAppBase.clientSingleton.getQAppVersion())),void 0!==t&&("string"==typeof t?(d.push("Error"),d.push(t)):n.isError(t)?o.isHttpRestError(t)?(d.push(`${t.name} (HTTP(s)/${t.statusCode})`),d.push(t.message)):(d.push(t.name),d.push(t.message)):d.push(...t));d.length<4;)d.push("");A.args=d;let h=this.buildSecret(T[e].secretType);return void 0!==h&&(s=h),console.log(`messageHandlerHelper::addMessage: add msg handler msg ${I} with secret ${s}`),this.messageHandlerProxy.addMessage(I,T[e].type,T[e].category,T[e].lifetime,c,A,p,s||"",i||(T[e].buttons?T[e].buttons:void 0),T[e].showMessageInFutureSeconds?T[e].showMessageInFutureSeconds:void 0)}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(8),a=s(53),n=s(0),r=s(6),o=s(28),E=s(1);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 a.CheckBarGraph(e),this.cancelBarButton=new i.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 i.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});const i=s(2),a=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:a.EnumAppearance.HIDDEN,type:n.TAB_FIGURE,containerTitle:{id:"",args:[]},topIcon:"",title:{id:"",args:[]},topbuttons:[],imgref:{}};t.createEmptyITabFigure=function(){return i.cloneJSON(r)};const o={id:"",appearance:a.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 i.cloneJSON(E)},t.createEmptyITabParamList=function(){return i.cloneJSON(o)};const _={id:"",appearance:a.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:a.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 i.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});const i=s(0),a=s(3),n=s(102);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===i.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:a.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:a.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(i.EnumAppearance.HIDDEN)}show(){this.setAppearance(i.EnumAppearance.ENABLED)}}},function(e,t){e.exports=require("tslib")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=s(61);t.STATE_UNINITIALIZED_INTERNAL="STATE_UNINITIALIZED_INTERNAL",t.createFsm=function(e){return new i.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 i;t.some(function(t){return i=t.nextState,t.guardFn(e,s)})&&i&&this.transition(e,i)}})}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(4),a=s(5);t.LocalizerProxy=class extends i.BaseProxy{constructor(){super(...arguments),this.restEndpoint="localizer"}getLanguage(){let e;return this.body.method=a.RestMethodsLOCALIZER.getLanguage,this.body.params={rLanguageId:""},(e=new i.CubisRestResponse(this.syncRequest())).isSuccess()?e.rawReturns.rLanguageId:""}getText(e,t=[]){let s
;return this.body.method=a.RestMethodsLOCALIZER.getText,this.body.params={id:e,rText:"",args:t},(s=new i.CubisRestResponse(this.syncRequest())).isSuccess()?s.rawReturns.rText:e}getTexts(e){let t;return this.body.method=a.RestMethodsLOCALIZER.getTexts,this.body.params={textObjects:e,rTexts:""},(t=new i.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 i=s(0),a=s(32),n=s(2),r=s(19);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,i)=>{if(s.id===t)return s.parameters.some((t,s)=>!(t.id!==e.id||!this.task)&&(this.task.params[i].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(i=>i.id===s&&(t=i.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(a.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],i=this.splitParamId(t)[0];if(s===i){let i=this.getGroup(s);if(void 0!==i){let s=i.parameters.findIndex(e=>e.id===t);if(-1!==s)return i.parameters.splice(s,0,e),!0}}return console.log("addDynamicParameterInFrontOf - groups of new and existing parameter do not match: "+s+" vs. "+i),!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===i.EnumAppearance.ENABLED||e.data.appearance===i.EnumAppearance.ENABLED_INVALID_CFG)<(t.data.appearance===i.EnumAppearance.ENABLED||t.data.appearance===i.EnumAppearance.ENABLED_INVALID_CFG))return 1;if((e.data.appearance===i.EnumAppearance.ENABLED||e.data.appearance===i.EnumAppearance.ENABLED_INVALID_CFG)>(t.data.appearance===i.EnumAppearance.ENABLED||t.data.appearance===i.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(a.TASK_DYNAMIC_ID_GROUPS_PREFIX)?e.parameters.forEach((e,t)=>{e.appearance=i.EnumAppearance.HIDDEN}):(e.parameters.forEach((e,t)=>{void 0!==e.fixed&&!0!==e.fixed||e.appearance===i.EnumAppearance.HIDDEN||(e.appearance=i.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 i=s(4),a=s(3),n=s(17),r=s(1),o=s(5);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 i.CubisRestResponse{
constructor(e){super(e)}getPrintItemIdentifier(){return this.rawReturns.printItemIdentifier}}t.ReportingPrintParamResponse=_;t.ReportingProxy=class extends i.BaseProxy{constructor(){super(...arguments),this.restEndpoint="reporting",this._isPrintQueueEmpty=!0}printParameters(e,t,s,i=-1){this.body.method=o.RestMethodsREPORTING.printParameters,this.body.params={parameters:JSON.stringify(e),category:t,redactable:s,printItemIdentifier:i};let a=new _(this.syncRequest());return a.isSuccess()&&(this._isPrintQueueEmpty=!1),a}printPrintQueue(){return this.body.method=o.RestMethodsREPORTING.printPrintQueueWithElectronicSignature,this.body.params={},new i.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 i.CubisRestResponse(this.syncRequest())}getPrintQueue(){return this.body.method=o.RestMethodsREPORTING.getPrintQueue,this.body.params={
printQueue:{}},new i.CubisRestResponse(this.syncRequest())}isPrintQueueEmpty(){let e;this.body.method=o.RestMethodsREPORTING.isPrintQueueEmpty,this.body.params={rResult:!1};try{return!!(e=new i.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 i.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 i.CubisRestResponse(this.syncRequest())}setRedactionStatus(e,t,s){return this.body.method=o.RestMethodsREPORTING.setRedactionStatus,this.body.params={printItemIdentifier:e,redacted:t,reason:s},
new i.CubisRestResponse(this.syncRequest())}getAlibiRecord(e){return this.body.method=o.RestMethodsREPORTING.getAlibiRecord,this.body.params={identifier:e,record:""},new i.CubisRestResponse(this.syncRequest())}getAlibiRecordList(e){return this.body.method=o.RestMethodsREPORTING.getAlibiRecordList,this.body.params={identifiers:e,records:[]},new i.CubisRestResponse(this.syncRequest())}getDateFromAlibi(e){let t;if(e instanceof i.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 i.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=[],a=[];if(e instanceof i.CubisRestResponse){if(!e.isSuccess())return E.getAlibiListFailed;a=JSON.parse(e.rawReturns.records)}else if(0!==(n=e).length&&"number"!=typeof n[0])a=e;else{let t=this.getAlibiRecordList(e);if(!t.isSuccess())return E.getAlibiListFailed;a=JSON.parse(t.rawReturns.records)}var n;return a.forEach(e=>{s=[...s,this.parseMeasureParameterFromAlibiResponse(e,t)]}),s}parseMeasureParameterFromAlibiResponse(e,t){let s=a.createEmptyParameterGroupOfGroups();if(null===e)return E.wrongAlibiId;{s.parameters[0].parameters=JSON.parse(e.weighingblock);let i=n.WeightBlockHelper.getMeasureParameter(s,t||r.MqttTopics.WEIGHING_VALUE_NET);return void 0===i?E.wrongTopic:i}}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(0),a=s(72),n=s(1),r=1;t.CheckBarGraph=class{constructor(e){this.barGraphStatusObject={appearance:i.EnumAppearance.HIDDEN,
areas:a.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!==i.EnumAppearance.ENABLED&&e!==i.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!==a.EnumAreaCount.FOUR_AREAS&&e!==a.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===a.EnumAreaCount.FOUR_AREAS?4:6)&&(this.barGraphValueObject=e,t&&this.publishValue())}calc4AreaPerc(e,t,s,i,a,n=!0){let r=1,o=0;return e>0&&(0<e&&e<t?(r=1,o=e/t*100):t<=e&&e<=a?(r=2,o=(e-t)/(a-t)*100):a<e&&e<=s?(r=3,o=(e-a)/(s-a)*100):s<e&&e<=i&&(r=4,o=(e-s)/(i-s)*100)),n&&this.setAreaPerc({area:r,perc:o}),{area:r,perc:o}}calc6AreaPerc(e,t,s,i,a,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<=i?(E=4,_=(e-r)/(i-r)*100):i<e&&e<=a?(E=5,_=(e-i)/(a-i)*100):a<e&&e<=n&&(E=6,_=(e-a)/(n-a)*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("https")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(0),a=s(57),n=s(38),r=s(25),o=s(12),E=s(31),_=s(38),l=s(20),u=s(39);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 c="STATE_ASPECT_CFG_PARAM_EDIT",A="STATE_ASPECT_CFG_PARAM_EDIT_USER_ACTION",T="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(c))},_onExit:function(e){},
_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,s){s.payload===c&&this.transition(e,c),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(c))},_onExit:function(e){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,s){s.payload===c&&this.transition(e,c),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[a.PARAM_LIST_SCREENID].getButton(a.FINISH_BUTTON_ID);if(void 0!==s){let a=e.aspects[t.CFG_PARAMS_ASPECT].cfg.isValidFn();s.setAppearance(a?i.EnumAppearance.ENABLED_PRIMARY:i.EnumAppearance.DISABLED)}},_onExit:function(e){},_transTo:{},_transFrom:{
STATE_ASPECT_CFG_PARAM_EDIT_ENTER:function(e,s){let n=e.screens[a.PARAM_LIST_SCREENID];n.readFromTaskhandler(e.aspects[t.CFG_PARAMS_ASPECT].cfg.taskHandler),n.setShowLastVisibleCategory(!1);let r=n.getButton(a.FINISH_BUTTON_ID);if(void 0!==r){let s=e.aspects[t.CFG_PARAMS_ASPECT].cfg.isValidFn();r.setAppearance(s?i.EnumAppearance.ENABLED_PRIMARY:i.EnumAppearance.DISABLED)}n.show()},STATE_ASPECT_CFG_PARAM_EDIT_REENTER:function(e,s){let n=e.screens[a.PARAM_LIST_SCREENID];n.readFromTaskhandler(e.aspects[t.CFG_PARAMS_ASPECT].cfg.taskHandler),n.setShowLastVisibleCategory(!0);let r=n.getButton(a.FINISH_BUTTON_ID);if(void 0!==r){let s=e.aspects[t.CFG_PARAMS_ASPECT].cfg.isValidFn();r.setAppearance(s?i.EnumAppearance.ENABLED_PRIMARY:i.EnumAppearance.DISABLED)}n.show()}},EV_HMI_BTN_CLICKED:function(e,s){s.payload.buttonId===a.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===a.CANCEL_BUTTON_ID&&e.suspend()},EV_HMI_PARAM_CHANGED:function(e,s){let i=e.aspects[t.CFG_PARAMS_ASPECT].updateTaskParameterGeneric(s.payload.parameter),a=[{guardFn:function(e,t){return void 0===i},nextState:""},{guardFn:function(e,t){return void 0!==i},nextState:A}];this.myHandler(e,a,s)},EV_HMI_PARAM_DETAIL:function(e,s){e.aspects[t.CFG_PARAMS_ASPECT].inspectTaskParameter(s.payload.parameter),this.transition(e,T)}},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,c)}},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===a.CANCEL_BUTTON_ID)e.suspend();else{let i=e.aspects[t.CFG_PARAMS_ASPECT].handleParamUpdateUserActionGeneric(s);"boolean"==typeof i&&i&&this.transition(e,c)}}}},
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 a.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[a.PARAM_LIST_SCREENID]&&this.client.screens[a.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=u.checkGeneralParamRules(e)),
void 0!==t?this.isLastUserActionGenericError=!0:(this.isLastUserActionGenericError=!1,t=this.cfg.updateTaskParameterFn(e)),this.setCurrentParamUpdateUserAction(t);let s=this.client.screens[a.PARAM_LIST_SCREENID].getButton(a.FINISH_BUTTON_ID);return void 0!==s&&s.setAppearance(this.cfg.isValidFn()?i.EnumAppearance.ENABLED_PRIMARY:i.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(i.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!==i.EnumAppearance.HIDDEN&&(t=!1);return t}}
},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(8),a=s(0),n=s(24);t.PARAM_LIST_SCREENID="PARAMLIST";var r=s(24);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=a.EnumAppearance.ENABLED_PRIMARY,s.buttonId=n.CANCEL_BUTTON_ID,this.cancelButton=new i.default(e,this,s),s.appearance=a.EnumAppearance.HIDDEN,s.label.id="_FINISH",s.buttonId=t.FINISH_BUTTON_ID,this.finishButton=new i.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 i=s(64),a=s(9),n=s(65),r=s(26),o=s(22),E=s(1);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 a.Subject,this.mqttAdminEvent$=new a.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=i.connect(this.mqttOptions),this.startListeningForUpdateEvent(),this.startListeningForAdminEvent(),this.listOfPublishedTopics=[],this.listOfSubscribedTopics=[]}startListeningForUpdateEvent(){this.listeningForUpdateEvent||(this.client.on("message",(e,t,s)=>{let i={topic:e,value:t,packet:s};i.topic.startsWith(E.MqttTopics.QAPP_DEBUG_TOPIC_PREAMBLE)?this.mqttUpdateEvent$.next(new o.MqttUpdateDebugEvent(i)):this.mqttUpdateEvent$.next(new o.MqttUpdateEvent(i))}),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,i){let a,r;"function"==typeof s?(r=s,
a=void 0):(a=s,r=i);let o={qos:n.EnumMqttQos.AtMostOnce,retain:!0,dup:!1};Object.assign(o,a),"/"!==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 i={qos:0};Object.assign(i,t),-1===this.listOfSubscribedTopics.indexOf(e)&&this.listOfSubscribedTopics.push(e),this.client.subscribe(e,i,(e,t)=>{s&&s(e,t)})}}unsubscribe(e,t){this.client.unsubscribe(e,e=>{t&&t(e)})}end(e,t){let s=!1,i=void 0;"function"==typeof e?(s=!1,i=e):"boolean"==typeof e&&(s=e,i=t),this.client.end(s,()=>{i&&i()})}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 i=s(35),a=s(9),n=s(23),r=s(18),o=s(1),E="/rest/qapp/paramDetail",_="/rest/qapp/paramChanged",l="/rest/qapp/buttonClick",u="/rest/qapp/extern",c=5e3;function A(e,t,s,i,a){e.statusCode=t,void 0!==s&&(e.statusMessage=s),
console.log(`RestHandler::finalizeResponse: send ${t} (${s}) response: ${r.inspect(i)}`),void 0===i?e.end():"object"==typeof i?(e.setHeader("Content-Type","application/json"),e.end(JSON.stringify(i,a))):(e.setHeader("Content-Type","plain/text"),e.end(i))}t.RestHandler=class{constructor(e){this.buttonClickEvent$=new a.Subject,this.paramChangedEvent$=new a.Subject,this.paramDetailEvent$=new a.Subject,this.restRequestEvent$=new a.Subject,this.restController=((e,t)=>{if(e.url)if(e.url.startsWith(u)){let s=e.url.replace(u,"");console.log(`RestHandler: rx extern REST request (${e.method})for URL ${s}`),this.handleRequest(e,i=>{console.log("RestHandler: rx all data for REST request - create and enqueue event"),t.setTimeout(c);let a={subUrl:s,request:e,body:i,response:t};this.restRequestEvent$.next(new n.RestRequestEvent(a))})}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)),A(t,200,"Event Accepted and Forwarded","ok"))}):A(t,405,"Method Not Allowed","failure");break;case _:"POST"===e.method?this.handleRequest(e,e=>{e&&(this.paramChangedEvent$.next(new n.HmiParamChangedEvent({parameter:e})),A(t,200,"Event Accepted and Forwarded","ok"))}):A(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})),A(t,200,"Event Accepted and Forwarded","ok"))}):A(t,405,"Method Not Allowed","failure");break;default:A(t,404,"Not Found","failure")}else A(t,404,"Not Found","failure")}),this.port=e||8081,this.server=i.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,i=[""];e.on("error",t=>{console.log("RestHandler::handleRequest: "+t),e.socket.end()}).on("data",e=>{console.log("RestHandler::handleRequest: data"),"string"!=typeof e?i.push(e.toString()):i.push(e)}).on("end",()=>{if(console.log("RestHandler::handleRequest: end"),s=i.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=A},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(3),a=s(7),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:[]}):i.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:a.EnumFontLabels.OK,args:[]},appearance:n.EnumAppearance.ENABLED_SECONDARY}]}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HttpRestErrorName="HttpRestError";class i extends Error{constructor(e,s,a,n){super(),this.statusCode=s,this.headers=a,this.body=n,this.name=t.HttpRestErrorName,Object.setPrototypeOf(this,i.prototype),this.message=e}}t.HttpRestError=i,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 i=s(4),a=s(0),n=s(5),r="WEIGHING/CONFIGURATION/PROFILE/ZERO_TARE",o=r+"/TARE1",E="ON",_="PROFILE/IDENTIFICATION",l="PROFILE/IDENTIFICATION/NAME"
;t.ProfileManagementProxy=class extends i.BaseProxy{constructor(){super(...arguments),this.restEndpoint="profilemanagement"}loadProfile(e){return this.body.method=n.RestMethodsPROFILE_MANAGEMENT.loadProfile,this.body.params={rProfile:"",id:e},new i.CubisRestResponse(this.syncRequest())}isPresetTareEnabled(e){let t;if(e instanceof i.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 i.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===a.EnumAppearance.ENABLED&&(t=[...t,e.id])}),0===t.length?void 0:t}}}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(4),a=s(3),n=s(5);t.AccessControlProxy=class extends i.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 i.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=a.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 i.CubisRestResponse(this.syncRequest())).rawReturns.permissionGranted}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(8),a=s(0),n=s(11),r=s(6),o=s(9),E=s(1);t.MESSAGEBOX_ID="MESSAGEBOX";class _{constructor(e){this.appearance=a.EnumAppearance.HIDDEN,this.lastPublishedTabContent={appearance:a.EnumAppearance.HIDDEN,
type:n.EnumMessageboxType.INFO,title:{id:"",args:[]},text:{id:"",args:[]},textsList:[],buttons:[]},this.messageBoxObject={appearance:a.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 i.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===a.EnumAppearance.ENABLED||this.lastPublishedTabContent.appearance===a.EnumAppearance.ENABLED&&this.messageBoxObject.appearance===a.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===a.EnumAppearance.ENABLED&&(this.setAppearance(a.EnumAppearance.HIDDEN),this.events$.next({type:r.ScreenEventType.HIDE_MESSAGEBOX,id:this.getId()}))}show(){
this.appearance===a.EnumAppearance.HIDDEN&&(this.setAppearance(a.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 i=s(0),a=s(33),n=s(6),r=s(1);t.LOADING_OVERLAY_ID="LOADING_MODAL";t.LoadingOverlay=class extends a.AbstractOverlay{setText(e){this.publishContent("TEXT",JSON.stringify(e))}show(){this.publishContent("APPEARANCE",'{ "appearance":"'+i.EnumAppearance.ENABLED+'" }'),this.events$.next({type:n.ScreenEventType.SHOW_LOADINGSCREEN,id:this.getId()})}hide(){this.publishContent("TEXT",""),this.publishContent("APPEARANCE",'{ "appearance":"'+i.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}),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 i=s(4),a=s(5);t.DeviceInformationProxy=class extends i.BaseProxy{constructor(){super(...arguments),this.restEndpoint="deviceinformation"}getSerialNo(){let e;return this.body.method=a.RestMethodsDEVICE_INFORMATION.getSerialNoBalance,this.body.params={rString:""},(e=new i.CubisRestResponse(this.syncRequest())).isSuccess()?e.rawReturns.rString:""}getModelName(){let e
;return this.body.method=a.RestMethodsDEVICE_INFORMATION.getModelName,this.body.params={rString:""},(e=new i.CubisRestResponse(this.syncRequest())).isSuccess()?e.rawReturns.rString:""}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QAppAsyncCallTimeoutErrorName="QAppAsyncCallTimeoutError";class i extends Error{constructor(e,s,a){super(),this.originalState=e,this.metadata=s,this.name=t.QAppAsyncCallTimeoutErrorName,a&&(this.stack=a),Object.setPrototypeOf(this,i.prototype),this.message="Async call timeout."+(s?` metadata: ${s}`:"")}}t.QAppAsyncCallTimeoutError=i},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 i=s(8),a=s(0),n=s(11),r=s(6),o=s(9),E=s(1);t.LOCKMESSAGEBOX_ID="LOCKMESSAGEBOX";class _{constructor(e){this.appearance=a.EnumAppearance.HIDDEN,this.lastPublishedTabContent={
appearance:a.EnumAppearance.HIDDEN,type:n.EnumMessageboxType.INFO,title:{id:"",args:[]},text:{id:"",args:[]},textsList:[],buttons:[]},this.messageBoxObject={appearance:a.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 i.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===a.EnumAppearance.ENABLED||this.lastPublishedTabContent.appearance===a.EnumAppearance.ENABLED&&this.messageBoxObject.appearance===a.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===a.EnumAppearance.ENABLED&&(this.setAppearance(a.EnumAppearance.HIDDEN),this.events$.next({type:r.ScreenEventType.HIDE_LOCKMESSAGEBOX,id:this.getId()}))}show(){this.appearance===a.EnumAppearance.HIDDEN&&(this.setAppearance(a.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 i=s(0),a=s(33),n=s(6),r=s(1);t.LOCK_LOADING_OVERLAY_ID="LOCK_LOADING_MODAL";t.LockLoadingOverlay=class extends a.AbstractOverlay{setText(e){this.publishContent("TEXT",JSON.stringify(e))}show(){this.publishContent("APPEARANCE",'{ "appearance":"'+i.EnumAppearance.ENABLED+'" }'),this.events$.next({type:n.ScreenEventType.SHOW_LOCKLOADINGSCREEN,id:this.getId()})}hide(){this.publishContent("TEXT",""),this.publishContent("APPEARANCE",'{ "appearance":"'+i.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 i=s(19),a=s(0),n=s(13),r=s(10);var o,E,_;t.QAPP_ID="QAPP515",t.MAXIMUM_LOT_IDS=5,t.MAXIMUM_SAMPLE_IDS=5,t.MAXIMUM_SAMPLES=1e4,t.MINIMUM_LOAD_DIGIT_SELECTION=[10,20,50,100,200,500,1e3],function(e){e.ENABLED="ENABLED",e.DISABLED="DISABLED"}(o=t.EnumBoolean||(t.EnumBoolean={})),t.EnumMapBooleanOnOff={[o.ENABLED]:"_QAPP515_PARAMVAL_ON",[o.DISABLED]:"_QAPP515_PARAMVAL_OFF"},t.EnumMapBooleanYesNo={[o.ENABLED]:"_QAPP515_PARAMVAL_YES",[o.DISABLED]:"_QAPP515_PARAMVAL_NO"},t.EnumMapBooleanRememberIDs={[o.ENABLED]:"_QAPP515_PARAMVAL_REMEMBER_ID_YES",[o.DISABLED]:"_QAPP515_PARAMVAL_REMEMBER_ID_NO"},function(e){e.ONE_AFTER_ANOTHER="ONE_AFTER_ANOTHER",e.SELECTABLE_OVERVIEW="SELECTABLE_OVERVIEW"}(E=t.EnumIdentifierInputMode||(t.EnumIdentifierInputMode={})),t.EnumMapIdentifierInputMode={[E.ONE_AFTER_ANOTHER]:"_QAPP515_PARAMVAL_INPUT_ONE_AFTER_ANOTHER",
[E.SELECTABLE_OVERVIEW]:"_QAPP515_PARAMVAL_INPUT_SELECTABLE_OVERVIEW"},function(e){e.OFF="OFF",e.ONLY_GROSS="ONLY_GROSS",e.DISPLAYED_VALUE="DISPLAYED_VALUE"}(_=t.EnumPrintZeroAllowed||(t.EnumPrintZeroAllowed={})),t.EnumMapPrintZeroAllowed={[_.OFF]:"_QAPP515_PARAMVAL_NO",[_.ONLY_GROSS]:"_QAPP515_PARAMVAL_PRINT_ZERO_GROSS",[_.DISPLAYED_VALUE]:"_QAPP515_PARAMVAL_PRINT_ZERO_DISPLAY"},t.getSelectionListIdentifierInputModes=function(){let e=[];for(let s of[E.ONE_AFTER_ANOTHER,E.SELECTABLE_OVERVIEW])e.push({id:s,text:{id:t.EnumMapIdentifierInputMode[s],args:[]},appearance:a.EnumAppearance.ENABLED});return e},t.getSelectionListSIDmanipulators=function(){let e=[];for(let t of[i.EnumIdentifierAutoManipulation.NONE,i.EnumIdentifierAutoManipulation.INCREMENT,i.EnumIdentifierAutoManipulation.DECREMENT])e.push({id:t,text:{id:i.EnumMapIdentifierAutoManipulation[t],args:[]},appearance:a.EnumAppearance.ENABLED});return e},t.getSelectionListBooleanOnOff=function(){let e=[]
;for(let s of[o.ENABLED,o.DISABLED])e.push({id:s,text:{id:t.EnumMapBooleanOnOff[s],args:[]},appearance:a.EnumAppearance.ENABLED});return e},t.getSelectionListBooleanYesNo=function(){let e=[];for(let s of[o.ENABLED,o.DISABLED])e.push({id:s,text:{id:t.EnumMapBooleanYesNo[s],args:[]},appearance:a.EnumAppearance.ENABLED});return e},t.getSelectionListBooleanRememberIDs=function(){let e=[];for(let s of[o.ENABLED,o.DISABLED])e.push({id:s,text:{id:t.EnumMapBooleanRememberIDs[s],args:[]},appearance:a.EnumAppearance.ENABLED});return e},t.getSelectionListMinimumLoadDigit=function(){let e=[];for(let s of t.MINIMUM_LOAD_DIGIT_SELECTION)e.push({id:s.toFixed(0),text:{id:n.formatQuantityParam({value:s,unit:n.EnumUnit.DIGIT,decimals:0}),args:[]},appearance:a.EnumAppearance.ENABLED});return e},t.getSelectionListPrintZeroAllowed=function(){let e=[];for(let s of[_.OFF,_.ONLY_GROSS,_.DISPLAYED_VALUE])e.push({id:s,text:{id:t.EnumMapPrintZeroAllowed[s],args:[]},appearance:a.EnumAppearance.ENABLED});return e
},t.taskConfig_GUI_paramGroupMain="main",t.taskConfig_GUI_paramGroupLIDSettings="lotid_settings",t.taskConfig_GUI_paramGroupSIDSettings="sampleid_settings",t.taskConfig_GUI_paramReferences={autoTare:i.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupMain)+"/"+i.DYNAMIC_PARAMID_PREQUEL+"autoTare",autoTakeover:i.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupMain)+"/"+i.DYNAMIC_PARAMID_PREQUEL+"autoTakeover",autoTakeoverMinload:i.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupMain)+"/"+i.DYNAMIC_PARAMID_PREQUEL+"autoTakeoverMinload",allowPrintZero:i.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupMain)+"/"+i.DYNAMIC_PARAMID_PREQUEL+"allowPrintZero",autoPrintZero:i.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupMain)+"/"+i.DYNAMIC_PARAMID_PREQUEL+"autoPrintZero",printBlankLines:i.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupMain)+"/"+i.DYNAMIC_PARAMID_PREQUEL+"printBlankLines",
printReportingHeaders:i.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupMain)+"/"+i.DYNAMIC_PARAMID_PREQUEL+"printReportingHeaders",useStatistics:i.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupMain)+"/"+i.DYNAMIC_PARAMID_PREQUEL+"useStatistics",rememberLIDs:i.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupLIDSettings)+"/"+i.DYNAMIC_PARAMID_PREQUEL+"rememberLIDs",printEmptyLIDs:i.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupLIDSettings)+"/"+i.DYNAMIC_PARAMID_PREQUEL+"printEmptyLIDs",minLengthLIDs:i.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupLIDSettings)+"/"+i.DYNAMIC_PARAMID_PREQUEL+"minLengthLIDs",maxLengthLIDs:i.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupLIDSettings)+"/"+i.DYNAMIC_PARAMID_PREQUEL+"maxLengthLIDs",rememberSIDs:i.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupSIDSettings)+"/"+i.DYNAMIC_PARAMID_PREQUEL+"rememberSIDs",
printEmptySIDs:i.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupSIDSettings)+"/"+i.DYNAMIC_PARAMID_PREQUEL+"printEmptySIDs",minLengthSIDs:i.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupSIDSettings)+"/"+i.DYNAMIC_PARAMID_PREQUEL+"minLengthSIDs",maxLengthSIDs:i.get_taskConfig_paramGroupID(t.taskConfig_GUI_paramGroupSIDSettings)+"/"+i.DYNAMIC_PARAMID_PREQUEL+"maxLengthSIDs"},t.createConfig=function(e){let t={autoTare:o.DISABLED,autoTakeover:o.DISABLED,autoTakeoverMinload:{value:100,unit:n.EnumUnit.DIGIT,decimals:0},allowPrintZero:_.ONLY_GROSS,autoPrintZero:o.DISABLED,useStatistics:o.DISABLED,printBlankLines:o.DISABLED,printReportingHeaders:o.ENABLED,lotIDs:[],rememberLIDs:o.ENABLED,printEmptyLIDs:o.DISABLED,minLengthLIDs:0,maxLengthLIDs:60,sampleIDs:[],rememberSIDs:o.ENABLED,printEmptySIDs:o.DISABLED,minLengthSIDs:0,maxLengthSIDs:60,alterable_for_task_execution:{autoTare:!0,autoTakeover:!0,autoTakeoverMinload:!0}};return r.isObject(e)&&r.overwriteExistingAttributes(e,t),
t},t.createProcess=function(e){let t={autoTare:o.DISABLED,autoTakeover:o.DISABLED,autoTakeoverMinload:{value:100,unit:n.EnumUnit.DIGIT,decimals:0},lotIDs:[],samples:[],currentSampleIDs:[],get nextSampleNumber(){return this.samples.length+1},set nextSampleNumber(e){},statistics:{count:0,sum:{value:0,unit:n.EnumUnit.NONE,decimals:0},mean:{value:0,unit:n.EnumUnit.NONE,decimals:0},stdDev:{value:NaN,unit:n.EnumUnit.NONE,decimals:0},varCoeff:{value:NaN,unit:n.EnumUnit.PERCENT,decimals:2},minimum:{value:NaN,unit:n.EnumUnit.NONE,decimals:0},maximum:{value:NaN,unit:n.EnumUnit.NONE,decimals:0},range:{value:0,unit:n.EnumUnit.NONE,decimals:0},diffLastTwo:{value:0,unit:n.EnumUnit.NONE,decimals:0}}};return r.isObject(e)&&r.overwriteExistingAttributes(e,t),t},t.getCustomLotIDsParameterID=function(e){r.isNumber(e)||(e=1),e=e;const t=i.get_taskConfig_paramGroupID("_RESERVED_LOT_ID_SETTINGS");return{paramGroupID:t,settingsLockedInfo:t+"/"+i.DYNAMIC_PARAMID_PREQUEL+"RESERVED_LOT_ID_settingsLocked",
mainCounter:t+"/"+i.DYNAMIC_PARAMID_PREQUEL+"RESERVED_LOT_ID_counter",header:t+"/"+i.DYNAMIC_PARAMID_PREQUEL+"RESERVED_LOT_ID_"+e.toFixed(0)+"_header",title:t+"/"+i.DYNAMIC_PARAMID_PREQUEL+"RESERVED_LOT_ID_"+e.toFixed(0)+"_title",inputMode:t+"/"+i.DYNAMIC_PARAMID_PREQUEL+"RESERVED_LOT_ID_"+e.toFixed(0)+"inputMode"}},t.getCustomSampleIDsParameterID=function(e){r.isNumber(e)||(e=1),e=e;const t=i.get_taskConfig_paramGroupID("_RESERVED_SAMPLE_ID_SETTINGS");return{paramGroupID:t,settingsLockedInfo:t+"/"+i.DYNAMIC_PARAMID_PREQUEL+"RESERVED_SAMPLE_ID_settingsLocked",mainCounter:t+"/"+i.DYNAMIC_PARAMID_PREQUEL+"RESERVED_SAMPLE_ID_counter",header:t+"/"+i.DYNAMIC_PARAMID_PREQUEL+"RESERVED_SAMPLE_ID_"+e.toFixed(0)+"_header",title:t+"/"+i.DYNAMIC_PARAMID_PREQUEL+"RESERVED_SAMPLE_ID_"+e.toFixed(0)+"_title",manipulator:t+"/"+i.DYNAMIC_PARAMID_PREQUEL+"RESERVED_SAMPLE_ID_"+e.toFixed(0)+"_manipulator",inputMode:t+"/"+i.DYNAMIC_PARAMID_PREQUEL+"RESERVED_SAMPLE_ID_"+e.toFixed(0)+"inputMode"}}
},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(0),a=s(3),n=s(14),r=s(6),o=s(9),E=s(1);t.KEYBOARD_SCREEN_ID="PARAMETER_INPUT";t.KeyboardScreen=class{constructor(e,t){this.keyboardObject={appearance:i.EnumAppearance.HIDDEN,param:{}},this.events$=new o.Subject,t?(this.keyboardParam=a.createEmptySelectionParameter(),this.keyboardParam.appearance=i.EnumAppearance.HIDDEN):(this.keyboardParam=a.createEmptyStringParameter(),this.keyboardParam.appearance=i.EnumAppearance.HIDDEN),this.keyboardObject.param=this.keyboardParam,this.mqttHandler=e}setAppearance(e){this.keyboardObject.appearance!==e&&(e!==i.EnumAppearance.HIDDEN&&e!==i.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===i.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===i.EnumAppearance.ENABLED&&(this.setAppearance(i.EnumAppearance.HIDDEN),this.events$.next({type:r.ScreenEventType.HIDE_OVERLAY,id:this.getId()}))}show(){this.keyboardObject.appearance===i.EnumAppearance.HIDDEN&&(this.setAppearance(i.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 i=s(101),a=s(103),n=s(104),r=s(28),o=s(105),E=s(106),_="SCREENS/",l="/TABLIST",u="/REQUESTEDTAB",c="/QAPP/";class A{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+u}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,a,n){return s.topbuttons=void 0!==n?A.sortTopButtons(n):s.topbuttons,new i.TabFigure(s,e,t,a)}addFigureTab(e,t,s){t.id=e;let i=A.createFigureTab(this.mqttHandler,this.screenId,t,!1,s);return this.tabScreenTablistObject.push(c+i.publishId()),this.tabList.push(i),i}static createGraphTab(e,t,s,i,n){return s.topbuttons=void 0!==n?A.sortTopButtons(n):s.topbuttons,new a.TabGraph(s,e,t,i)}addGraphTab(e,t,s){t.id=e;let i=A.createGraphTab(this.mqttHandler,this.screenId,t,!1,s)
;return this.tabScreenTablistObject.push(c+i.publishId()),this.tabList.push(i),i}static createParamListTab(e,t,s,i,a){return s.topbuttons=void 0!==a?A.sortTopButtons(a):s.topbuttons,new n.TabParamList(s,e,t,i)}addParamListTab(e,t,s){t.id=e;let i=A.createParamListTab(this.mqttHandler,this.screenId,t,!1,s);return this.tabScreenTablistObject.push(c+i.publishId()),this.tabList.push(i),i}static createMenuTab(e,t,s,i,a){return s.topbuttons=void 0!==a?A.sortTopButtons(a):s.topbuttons,new o.TabMenu(s,e,t,i)}static createTableTab(e,t,s,i,a){return s.topbuttons=void 0!==a?A.sortTopButtons(a):s.topbuttons,new E.TabTable(s,e,t,i)}addMenuTab(e,t,s){t.id=e;let i=A.createMenuTab(this.mqttHandler,this.screenId,t,!1,s);return this.tabScreenTablistObject.push(c+i.publishId()),this.tabList.push(i),i}addTableTab(e,t,s){t.id=e;let i=A.createTableTab(this.mqttHandler,this.screenId,t,!1,s);return this.tabScreenTablistObject.push(c+i.publishId()),this.tabList.push(i),i}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=A},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(107),a=s(14),n=s(87),r=s(10);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 u(e,t,s){let i="YYYY-MM-DD",a="HH:mm:ss";switch(console.log("parseDateTimeFormat: for format "+e),e){case o.DATE_FORMAT_CHARTS:i="YYYY-MM-DD",a="HH:mm:ss";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="yyyy-mm-dd",a="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:i="DD/MM/YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="dd-mm-yyyy"}break;case E.MM_DD_YYYY_SLASHSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:i="MM/DD/YYYY";break
;case o.DATE_FORMAT_DATEFORMAT_LIB:i="mm-dd-yyyy"}break;case E.DD_MM_YYYY_POINTSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:i="DD.MM.YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="dd.mm.yyyy"}break;case E.YYYY_MM_DD_MINUSSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:i="YYYY-MM-DD";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="yyyy-mm-dd"}break;case E.YYYY_MM_DD_DOUBLEPOINTSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:i="YYYY:MM:DD";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="yyyy:mm:dd"}break;case E.DD_MMM_YYYY_MINUSSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:i="DD-MMM-YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="dd-mmm-yyyy"}break;case E.MMM_DD_YYYY_MINUSSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:i="MMM-DD-YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="mmm.dd.yyyy"}break;default:i=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:a="HH.mm.ss";break
;case o.DATE_FORMAT_DATEFORMAT_LIB:a="HH.MM.ss"}break;case _.HH_MM_SS_DOUBLEPOINTSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:a="HH:mm:ss";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="HH:MM:ss"}break;case _.HH_MM_SS_AM_PM_DOUBLEPOINTSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:a="hh:mm:ss a";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="hh:MM:ss TT"}break;default:a=t}}let n=`${i} ${a}`;return console.log("parseDateTimeFormat: final format "+n),n}function c(e,t){let s=e.toFixed(0);for(;s.length<t;)s="0"+s;return s}function A(){let e=(new i.ClockHandlerProxy).getFormatConfigurationI18n();if(e.isSuccess()){let t,s,n=JSON.parse(e.rawReturns.configuration),r=a.find(n,e=>e.id===i.CLOCKHANDLER_DATEFORMAT_PARAM_ID),o=a.find(n,e=>e.id===i.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 T(e,t){let s,i,a=new Date(e);switch(t.dateConfiguration){case E.DD_MM_YYYY_SLASHSEPERATOR:s=c(a.getDate(),2)+"/"+c(a.getMonth()+1,2)+"/"+c(a.getFullYear(),4);break;case E.MM_DD_YYYY_SLASHSEPERATOR:s=c(a.getMonth()+1,2)+"/"+c(a.getDate(),2)+"/"+c(a.getFullYear(),4);break;case E.DD_MM_YYYY_POINTSEPERATOR:s=c(a.getDate(),2)+"."+c(a.getMonth()+1,2)+"."+c(a.getFullYear(),4);break;case E.YYYY_MM_DD_MINUSSEPERATOR:s=c(a.getFullYear(),4)+"-"+c(a.getMonth()+1,2)+"-"+c(a.getDate(),2);break;case E.YYYY_MM_DD_DOUBLEPOINTSEPERATOR:s=c(a.getFullYear(),4)+":"+c(a.getMonth()+1,2)+":"+c(a.getDate(),2);break;case E.YYYY_MM_DD_POINTSEPERATOR:s=c(a.getFullYear(),4)+"."+c(a.getMonth()+1,2)+"."+c(a.getDate(),2);break
;case E.DD_MMM_YYYY_MINUSSEPERATOR:s=c(a.getDate(),2)+"-"+l[a.getMonth()]+"-"+c(a.getFullYear(),4);break;case E.MMM_DD_YYYY_MINUSSEPERATOR:s=l[a.getMonth()]+"-"+c(a.getDate(),2)+"-"+c(a.getFullYear(),4);break;case E.YYYY_MM_DD_NO_SEPARATOR:s=c(a.getFullYear(),4)+c(a.getMonth()+1,2)+c(a.getDate(),2);break;default:s=c(a.getFullYear(),4)+"-"+c(a.getMonth()+1,2)+"-"+c(a.getDate(),2)}switch(t.timeConfiguration){case _.HH_MM_SS_MINUSSEPERATOR:i=c(a.getHours(),2)+"-"+c(a.getMinutes(),2)+"-"+c(a.getSeconds(),2);break;case _.HH_MM_SS_POINTSEPERATOR:i=c(a.getHours(),2)+"."+c(a.getMinutes(),2)+"."+c(a.getSeconds(),2);break;case _.HH_MM_SS_DOUBLEPOINTSEPERATOR:i=c(a.getHours(),2)+":"+c(a.getMinutes(),2)+":"+c(a.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}}(a.getHours());i=c(e.hours,2)+":"+c(a.getMinutes(),2)+":"+c(a.getSeconds(),2)+" "+e.ampm;break;case _.HH_MM_SS_NO_SEPARATOR:
i=c(a.getHours(),2)+c(a.getMinutes(),2)+c(a.getSeconds(),2);break;default:i=c(a.getHours(),2)+":"+c(a.getMinutes(),2)+":"+c(a.getSeconds(),2)}return{date:s,time:i}}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 i.ClockHandlerProxy).getFormatConfigurationI18n();if(s.isSuccess()){let n=JSON.parse(s.rawReturns.configuration);t=`${u(e,a.find(n,e=>e.id===i.CLOCKHANDLER_DATEFORMAT_PARAM_ID),a.find(n,e=>e.id===i.CLOCKHANDLER_TIMEFORMAT_PARAM_ID))}`}return t},t.parseDateTimeFormat=u,t.getDateTimeConfiguration=A,t.convertToDateTimeFormat=T,t.getDateTime=function(e,t,s,i,a=!0,o=!0){switch(void 0==s&&(s=Date.now()),r.isNumber(s)||r.isString(s)||(s=0),void 0==i&&(i=r.isString(s)?"iso":"ms"),void 0==e&&(e="ms"),i){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=A()),0===s&&(s=.1),t.hasOwnProperty("dateConfiguration")){let e=T(s,t),i=a?e.date:"";return i+=o&&""!==i?" ":"",i+=o?e.time:""}if("string"==typeof t.toLowerCase())return n(s,t);{let e=o?"HH:MM:ss":"";return e+=a&&""!==e?" ":"",n(s,e+=a?"dd.mm.yyyy":"")}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(31),a=s(83),n=s(20),r=s(0),o=s(12),E=s(32),_=s(7),l=s(11),u=s(54),c=s(14),A=s(25),T=s(39),p=s(2),I=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 d=t.STATE_ASPECT_IDENTIFIER_PREFIX+"_LOT_INPUT_DO",h=t.STATE_ASPECT_IDENTIFIER_PREFIX+"_SID_INPUT_DO";t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE=u.LID_SID_USER_INPUT_STRING_VALUES,t.IDENTIFIER_MAX_LENGTH_LID_SID_NUMBER_VALUE=15;const N=0,S="-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",R="PARAM_ID_RT_SID",g="PARAM_ID_RT_IDENTIFIER_INP";class P extends i.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:d}))):(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[a.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 i=e.aspects[t.IDENTIFIER_ASPECT];if(s.payload.parameter.id===g+i.inputIdx){let t=T.checkGeneralParamRules(s.payload.parameter),n=s.payload.parameter.value.string;void 0===t?(i.setLotID(i.inputIdx,n),i.inputIdx++,i.evalLotInput()||(console.log("IdentifierAspect - no (further) LIDs configured"),this.transition(e,i.cfg.returnState))):(e.showMessageBox(t.message),i.sPIn_4_identifier.value.string=n,
i.client.screens[a.KEYBOARD_SCREEN_ID].setParam(i.sPIn_4_identifier))}},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===A.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[a.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 i=e.aspects[t.IDENTIFIER_ASPECT];if(s.payload.parameter.id===g+i.inputIdx){let t=T.checkGeneralParamRules(s.payload.parameter),n=s.payload.parameter.value.string;if(void 0===t){i.setSID(i.inputIdx,n);let t=P.getSIDState(i.inputIdx,i.getTaskHandler());if(t===E.EnumSampleIdentifierOptions.ON_AUTO_INC||t===E.EnumSampleIdentifierOptions.ON_AUTO_DEC){let r=t===E.EnumSampleIdentifierOptions.ON_AUTO_INC,o=O(r,s.payload.parameter.value.string);o.success?this.transition(e,i.sIdInputDone()):(i.sPIn_4_identifier.value.string=n,i.client.screens[a.KEYBOARD_SCREEN_ID].setParam(i.sPIn_4_identifier),i.client.showMessageBox(M(r,o.result,!0)))}else this.transition(e,i.sIdInputDone())}else e.showMessageBox(t.message),i.sPIn_4_identifier.value.string=n,
i.client.screens[a.KEYBOARD_SCREEN_ID].setParam(i.sPIn_4_identifier)}},EV_HMI_BTN_CLICKED:function(e,s){let i=e.aspects[t.IDENTIFIER_ASPECT];s.payload.buttonId===t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_OK?(e.screens[a.KEYBOARD_SCREEN_ID].show(),e.hideMsgBox()):s.payload.buttonId===A.ParamUpdateUserActionSimpleAccept_OK_BUTTON_ID?e.hideMsgBox():s.payload.buttonId===t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_YES?(e.hideMsgBox(),this.transition(e,i.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=I.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,i){let a=[],o=P.getConfiguredLIDCount(i);console.log("IdentifierAspect::createLIDParams: create params for "+o+" LIDs");for(let _=1;_<=o;_++){let o=i.getParameter(E.createLIDParamId(_,E.TASK_DYNAMIC_ID_LID_X_PARAM_ID_SUFFIX_TITLE)),l=i.getParameter(E.createLIDParamId(_,E.TASK_DYNAMIC_ID_LID_X_PARAM_ID_SUFFIX_HEADER)),u=I.createEmptyStringParameter();u.id=m+_+(e?"_"+e:""),u.appearance=r.EnumAppearance.HIDDEN,u.title={id:o.value.string,args:[]},u.header={id:l.value.string,args:[]},u.info={minimum:{length:0},maximum:{length:t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE}},a.push(new n.default(s,u))}return a}static createSIDParams(e,s,i){let a=[],o=P.getConfiguredSIDCount(i);console.log("IdentifierAspect::createSIDParams: create params for "+o+" SIDs");for(let _=1;_<=o;_++){
let o=i.getParameter(E.createSIDParamId(_,E.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_TITLE)),l=i.getParameter(E.createSIDParamId(_,E.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_HEADER)),u=I.createEmptyStringParameter();u.id=R+_+(e?"_"+e:""),u.appearance=r.EnumAppearance.HIDDEN,u.title={id:o.value.string,args:[]},u.header={id:l.value.string,args:[]},u.info={minimum:{length:0},maximum:{length:t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE}},a.push(new n.default(s,u))}return a}init(e){if(this.client=e,this.client){if(console.log("IdentifierAspect::init"),!this.client.screens[a.KEYBOARD_SCREEN_ID]){let e=new a.KeyboardScreen(this.client.mqttHandler);this.client.registerScreen(e)}this.sPIn_4_identifier=I.createEmptyStringParameter(),this.sPIn_4_identifier.id=g,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),i=this.getTaskHandler().getGroup(E.TASK_DYNAMIC_ID_SID_GROUP_ID);console.log("IdentifierAspect::configure"),c.isEqual(this.cfgGroupCnt,t)&&c.isEqual(this.cfgGroupLID,s)&&c.isEqual(this.cfgGroupSID,i)?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(i),t&&s&&i&&(console.log("IdentifierAspect::configure - create LID params"),
this.sP_4_lotA=P.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=P.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[a.KEYBOARD_SCREEN_ID].hide(),this.sPIn_4_identifier.id=g+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[a.KEYBOARD_SCREEN_ID].setParam(this.sPIn_4_identifier),this.client.screens[a.KEYBOARD_SCREEN_ID].show()}prepSidInput(e,s,i){if(this.client.screens[a.KEYBOARD_SCREEN_ID].hide(),this.sPIn_4_identifier.id=g+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(P.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[a.KEYBOARD_SCREEN_ID].setParam(this.sPIn_4_identifier),i&&this.client.screens[a.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,P.setLotIDsStatic(this.lotIDs,this.sP_4_lotA)}setLotID(e,t){this.lotIDs[e]=t,P.updateAndPublishIDParamStatic(this.sP_4_lotA[e],this.lotIDs[e])}static setSIDsStatic(e,t){for(let s=0;s<t.length;s++)P.updateAndPublishIDParamStatic(t[s],e[s])}setSIDs(e,t){this.sIDs=e,this.cfg.autoRememberSIDs||(this.sIDsPrevSample=t),P.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,
P.updateAndPublishIDParamStatic(this.sP_4_sidA[e],this.sIDs[e])}static getLotState(e,t){let s=E.EnumLotIdentifierOptions.OFF,i=t.getParameter(E.TASK_DYNAMIC_ID_LID_CNT_PARAM_ID);return e>=0&&e<E.getConfiguredIds(i)&&(s=E.EnumLotIdentifierOptions.ON),console.log("IdentifierAspect::getLotState for idx:"+e+" -> "+s),s}static getSIDState(e,t){let s=e+1,i=E.EnumSampleIdentifierOptions.OFF,a=t.getParameter(E.TASK_DYNAMIC_ID_SID_CNT_PARAM_ID);return e>=0&&e<E.getConfiguredIds(a)&&(i=t.getParameter(E.createSIDParamId(s,E.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_MODE)).value.selection.id),i}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=P.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=O(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(M(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 D;function O(e,s,i=t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE){console.log("IdentifierAspect - AutoInc/Dec, not first sample > check for number");let a=s.match("^\\d*$");if(a&&void 0!==a[0]){let s;if(console.log("IdentifierAspect - AutoInc, not first sample > inc number"),""===a[0]){if(s=0,!e)return{success:!1,result:{id:D.NONUMBERFOUND,args:[]}}}else{
if(a[0].length>t.IDENTIFIER_MAX_LENGTH_LID_SID_NUMBER_VALUE)return{success:!1,result:{id:D.NUMBERTOOLARGE,args:[]}};s=parseInt(a[0],10)}if(e)s++;else{if(!(s>N))return{success:!1,result:{id:D.LOWERBOUNDARY,args:[]}};s--}let n=s.toFixed(0);return n.length>i?{success:!1,result:{id:D.SIDTOOLARGE,args:[i.toString()]}}:{success:!0,result:n}}{let a=s.match("(.*[\\-_.#\\s])(\\d*)$");if(a&&void 0!==a[2]){let s;if(console.log("IdentifierAspect - AutoInc/Dec, not first sample > inc/dec suffix"),""===a[2]){if(s=0,!e)return{success:!1,result:{id:D.NONUMBERFOUND,args:[]}}}else{if(a[2].length>t.IDENTIFIER_MAX_LENGTH_LID_SID_NUMBER_VALUE)return{success:!1,result:{id:D.NUMBERTOOLARGE,args:[]}};s=parseInt(a[2],10)}if(e)s++;else{if(!(s>N))return{success:!1,result:{id:D.LOWERBOUNDARY,args:[]}};s--}let n=a[1]+s.toFixed();return n.length>i?{success:!1,result:{id:D.SIDTOOLARGE,args:[i.toString()]}}:{success:!0,result:n}}if(console.log("IdentifierAspect - AutoInc, not first sample > add suffix"),e){let e=s+S
;return e.length>i?{success:!1,result:{id:D.SIDTOOLARGE,args:[i.toString()]}}:{success:!0,result:e}}return{success:!1,result:{id:D.NOSEPARATORFOUND,args:[]}}}}function M(e,s,i=!1){let a=[],n=[];return e?i?a.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_WARNING_FOR_NEXT_SID",args:[]}):a.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_WARNING",args:[]}):i?a.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING_FOR_NEXT_SID",args:[]}):a.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING",args:[]}),a.push(s),i&&a.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_DEC_WARNING_CONTINUE",args:[]}),n=i?[{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:a,buttons:n}}t.IdentifierAspect=P,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"}(D=t.IncreaseDecreaseFailEnum||(t.IncreaseDecreaseFailEnum={})),t.increaseDecreaseId=O,t.getWarningNoIdChange=M},function(e,t){e.exports=require("dateformat")},,,,,,function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const i=s(23),a=s(3),n=s(11),r=s(45),o=s(7),E=s(94),_=s(22),l=s(19),u=s(82),c=s(21),A=s(12),T=s(2),p=s(15),I=s(1),d=s(41),h=s(29),N=s(20),S=s(0),m=s(13),R=s(10),g=s(85),P="05_MassCal_PlaceWeight.png",D="05_MassCal_RemoveWeight.png",O="Zero",M="Z";var L,b;function f(e){const t=a.createEmptyTextParameter();return t.id=e,t}!function(e){e[e.idle=0]="idle",e[e.clearPan=1]="clearPan",e[e.placeSample=2]="placeSample",e[e.placeSampleEnterIDs=3]="placeSampleEnterIDs",e[e.placeSampleEnterIDsEntered=4]="placeSampleEnterIDsEntered",e[e.finishProcess=5]="finishProcess"}(L||(L={})),function(e){e[e.idle=0]="idle",e[e.wait_clear_pan=1]="wait_clear_pan",e[e.wait_clear_pan_stable=2]="wait_clear_pan_stable",e[e.wait_printable_zero=3]="wait_printable_zero",e[e.wait_acquisition_trigger=4]="wait_acquisition_trigger",e[e.wait_dsd=5]="wait_dsd",e[e.got_dsd=6]="got_dsd"}(b||(b={}));class C extends E.wfRunner{constructor(){super(!0),this.workflowState=L.idle,this.weighingState=b.idle,
this.weighingWaitingTimeout=0,this.samplesHeaderAlreadyPrinted=!1,this.statisticsAlreadyPrintedForCurrentSamples=!0,this.config=u.createConfig(),this.process=u.createProcess(),this.currentSample={counter:-1,weight:{value:NaN,unit:m.EnumUnit.NONE,decimals:0},sampleIDs:[]},this.statisticParams={count:new N.default(this.mqttHandler,f("stats_count")),mean:new N.default(this.mqttHandler,f("stats_mean")),stdDev:new N.default(this.mqttHandler,f("stats_stdDev")),varCoeff:new N.default(this.mqttHandler,f("stats_varCoeff")),sum:new N.default(this.mqttHandler,f("stats_sum")),minimum:new N.default(this.mqttHandler,f("stats_minimum")),maximum:new N.default(this.mqttHandler,f("stats_maximum")),range:new N.default(this.mqttHandler,f("stats_range")),diffLastTwo:new N.default(this.mqttHandler,f("stats_diffLastTwo"))},this.effectiveSampleIDorderOneAfterAnother=[],this.currentSIDindexForEffectiveOrder=0,this.effectiveLotIDorderOneAfterAnother=[],this.currentLIDindexForEffectiveOrder=0,
this.suppressGlobalHomeBtnHandling=!0,this.suppressGlobalLogoutBtnHandling=!0,this.suppressGlobalRestartBtnHandling=!0}GET_QAPP_META_DATA(){return{qappID:u.QAPP_ID,qappToken:u.QAPP_ID,stateScreenFunctions:[this.INITIALIZE_PROCESS.name,this.PROCESS_MENU.name,this.ENTER_LOT_IDS.name,this.ENTER_SAMPLE_IDS.name,this.ENTER_PRESET_SAMPLE_IDS.name,this.INITIALIZE_MEASUREMENT.name,this.PERFORM_MEASUREMENT.name],initialStateFunction:this.INITIALIZE_PROCESS.name}}postInit(){super.postInit(),this.mqttHandler.subscribe(I.MqttTopics.REPORTING_PRINTABLE_VALUE),this.mqttHandler.subscribe(I.MqttTopics.WEIGHING_VALUE_NET),this.mqttHandler.subscribe(I.MqttTopics.WEIGHING_VALUE_GROSS),this.mqttHandler.subscribe(I.MqttTopics.REPORTING_PRINT_PROCESS_RESULT),this.mqttHandler.subscribe(I.MqttTopics.WEIGHING_WAITING_FOR_STABILITY),this.mqttHandler.subscribe(I.MqttTopics.WEIGHING_STATUS_ERROR),this.config=u.createConfig(l.loadTaskConfig_DATA_CONTAINER(this.taskHandler)),
this.weighingSplitScreen.getTabApi().clearTabList(),this.weighingSplitScreen.getTabApi().addFigureTab(this.IDEXTEND_SCREEN+"INFO_IMAGE",{id:this.IDEXTEND_SCREEN+"INFO_IMAGE",appearance:S.EnumAppearance.ENABLED,type:r.EnumTabType.TAB_FIGURE,containerTitle:a.createEmptyTextStructure(),title:a.createEmptyTextStructure(),topbuttons:[],imgref:{id:D}}),this.config.useStatistics===u.EnumBoolean.ENABLED&&(this.statisticParams.count.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_NUMSAM"),"",this.process.statistics.count)),this.statisticParams.mean.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_AVG"),"",this.process.statistics.mean)),this.statisticParams.stdDev.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_DEV"),"",this.process.statistics.stdDev)),this.statisticParams.varCoeff.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_VAR"),"",this.process.statistics.varCoeff)),
this.statisticParams.sum.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_SUM"),"",this.process.statistics.sum)),this.statisticParams.minimum.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_HEADER_STAT_MIN"),"",this.process.statistics.minimum)),this.statisticParams.maximum.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_HEADER_STAT_MAX"),"",this.process.statistics.maximum)),this.statisticParams.range.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_DIFF"),"",this.process.statistics.range)),this.statisticParams.diffLastTwo.setValue(this.report_getQuantityParam("",E.l("_QAPP515_PARAM_TITLE_DIFF_LAST_TWO"),"",this.process.statistics.diffLastTwo)),this.weighingSplitScreen.getTabApi().addParamListTab(this.IDEXTEND_SCREEN+"STATISTICS",{id:this.IDEXTEND_SCREEN+"STATISTICS",appearance:S.EnumAppearance.ENABLED,type:r.EnumTabType.TAB_PARAMLIST,displayHeader:!0,topbuttons:[],containerTitle:a.createEmptyTextStructure(),
title:{id:E.l("_QAPP_LIB_REPORTING_CATERGORY_STATISTIC"),args:[]},paramType:r.TAB_PARAMLIST_TYPE_TOPIC,params:[this.statisticParams.count.getPublishedId(),this.statisticParams.mean.getPublishedId(),this.statisticParams.stdDev.getPublishedId(),this.statisticParams.varCoeff.getPublishedId(),this.statisticParams.sum.getPublishedId(),this.statisticParams.minimum.getPublishedId(),this.statisticParams.maximum.getPublishedId(),this.statisticParams.range.getPublishedId(),this.statisticParams.diffLastTwo.getPublishedId()]})),this.weighingSplitScreen.getTabApi().publishTabList()}_____________________SCREENS__________________(){}INITIALIZE_PROCESS(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.INITIALIZE_PROCESS.name;if(!e&&R.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([i.EV_HMI_BTN_CLICKED,A.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.INITIALIZE_PROCESS()+": Missing argument"),"";if(R.isString(t)&&"onEnter"===t){this.initializeTaskProcess()
;let e=this.config.alterable_for_task_execution.autoTakeoverMinload?S.EnumAppearance.ENABLED:S.EnumAppearance.DISABLED,t=this.process.autoTakeover===u.EnumBoolean.ENABLED?e:S.EnumAppearance.HIDDEN;if(!this.config.alterable_for_task_execution.autoTare&&!this.config.alterable_for_task_execution.autoTakeover&&t!==S.EnumAppearance.ENABLED)return this.addToEventQueue(new A.SimpleEvent("CONTINUE")),"";E.btn.param_autotare=this.createParameterButton(E.l("_QAPP515_PARAM_TITLE_AUTOTARE"),this.config.alterable_for_task_execution.autoTare?S.EnumAppearance.ENABLED:S.EnumAppearance.DISABLED),E.btn.param_autotakeover=this.createParameterButton(E.l("_QAPP515_PARAM_TITLE_AUTOTAKEOVER"),this.config.alterable_for_task_execution.autoTakeover?S.EnumAppearance.ENABLED:S.EnumAppearance.DISABLED),E.btn.param_autotakeover_minload=this.createParameterButton(E.l("_QAPP515_PARAM_TITLE_AUTOTAKEOVER_MINLOAD"),t),E.btn.param_autotare.setLabelRight({id:u.EnumMapBooleanOnOff[this.process.autoTare],args:[]}),
E.btn.param_autotakeover.setLabelRight({id:u.EnumMapBooleanOnOff[this.process.autoTakeover],args:[]}),E.btn.param_autotakeover_minload.setLabelRight({id:m.formatQuantityParam(this.process.autoTakeoverMinload),args:[]}),E.btn.continue=this.createMenuButton(o.EnumFontLabels.NEXT),E.btn.msg_wrongLIDlength=this.createMessageButton(o.EnumFontLabels.OK);let s={id:this.IDEXTEND_SCREEN+this.INITIALIZE_PROCESS.name,appearance:S.EnumAppearance.ENABLED,type:r.EnumTabType.TAB_MENU,containerTitle:{id:E.l("_QAPP515_SCREENTITLE_CONFIG_PARAMS1"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:r.TAB_MENU_TYPE_TOPIC,menubuttons:["/QAPP/"+E.btn.param_autotare.getTopic(),"/QAPP/"+E.btn.param_autotakeover.getTopic(),"/QAPP/"+E.btn.param_autotakeover_minload.getTopic()],scrollToTop:!1};this.mainScreen.setMenuTab(s,[E.btn.continue]),this.mainScreen.topLeftButton.setLabel({id:o.EnumFontLabels.CANCEL,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),this.hideLoadingScreen()
}else{if(R.isString(t)&&"onExit"===t)return this.showLoadingScreen(),this.mainScreen.hide(),this.hideMsgBox(),"";if(R.isObject(t)&&t.type&&t.type===A.SIMPLE_EVENT){if("CONTINUE"===t.payload)return this.process.lotIDs.length>0?(this.currentSIDindexForEffectiveOrder=0,this.addToEventQueue(new A.SimpleEvent("ENTER_NEXT_LOT_IDS")),""):(this.samplesHeaderAlreadyPrinted=!1,e.transition(this,this.INITIALIZE_MEASUREMENT()),"");if("ENTER_NEXT_LOT_IDS"===t.payload){if(this.currentLIDindexForEffectiveOrder<this.effectiveLotIDorderOneAfterAnother.length){const e=this.effectiveLotIDorderOneAfterAnother[this.currentLIDindexForEffectiveOrder];return this.openInputText("LOT_ID",this.process.lotIDs[e].header,this.process.lotIDs[e].value,this.config.minLengthLIDs,this.config.maxLengthLIDs),""}for(let t=0;t<this.process.lotIDs.length;t++)if(this.process.lotIDs[t].inputModes.includes(u.EnumIdentifierInputMode.SELECTABLE_OVERVIEW))return e.transition(this,this.ENTER_LOT_IDS()),""
;return this.confirmLotIDs(),e.transition(this,this.INITIALIZE_MEASUREMENT()),""}}else if(R.isObject(t)&&t.type&&t.type===i.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===E.btn.continue.getButtonId())return this.addToEventQueue(new A.SimpleEvent("CONTINUE")),"";if(t.payload.buttonId===E.btn.param_autotare.getButtonId())return this.openInputSelection(E.btn.param_autotare.getButtonId()+"_param",E.l("_QAPP515_PARAM_HEADER_AUTOTARE"),u.getSelectionListBooleanOnOff(),this.process.autoTare),"";if(t.payload.buttonId===E.btn.param_autotakeover.getButtonId())return this.openInputSelection(E.btn.param_autotakeover.getButtonId()+"_param",E.l("_QAPP515_PARAM_HEADER_AUTOTAKEOVER"),u.getSelectionListBooleanOnOff(),this.process.autoTakeover),""
;if(t.payload.buttonId===E.btn.param_autotakeover_minload.getButtonId())return this.openInputSelection(E.btn.param_autotakeover_minload.getButtonId()+"_param",E.l("_QAPP515_PARAM_HEADER_AUTOTAKEOVER_MINLOAD"),u.getSelectionListMinimumLoadDigit(),u.MINIMUM_LOAD_DIGIT_SELECTION[l.determineNearestNumberInArray(this.process.autoTakeoverMinload.value,u.MINIMUM_LOAD_DIGIT_SELECTION)].toFixed(0)),"";if(t.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID)this.suspend();else if(t.payload.buttonId===E.btn.msg_wrongLIDlength.getButtonId())return this.hideMsgBox(),"";this.HandleDefaultButtons(e,t)}}const s=this.parseParamInput(t);if(s.isHandled&&s.isValid){if(s.id===E.btn.param_autotare.getButtonId()+"_param")this.process.autoTare=s.rSelectionID,E.btn.param_autotare.setLabelRight({id:u.EnumMapBooleanOnOff[this.process.autoTare],args:[]},!0);else if(s.id===E.btn.param_autotakeover.getButtonId()+"_param"){this.process.autoTakeover=s.rSelectionID,E.btn.param_autotakeover.setLabelRight({
id:u.EnumMapBooleanOnOff[this.process.autoTakeover],args:[]},!0);let e=this.config.alterable_for_task_execution.autoTakeoverMinload?S.EnumAppearance.ENABLED:S.EnumAppearance.DISABLED,t=this.process.autoTakeover===u.EnumBoolean.ENABLED?e:S.EnumAppearance.HIDDEN;E.btn.param_autotakeover_minload.setAppearance(t)}else if(s.id===E.btn.param_autotakeover_minload.getButtonId()+"_param"){let e=parseInt(s.rSelectionID);this.process.autoTakeoverMinload.value=R.isNumber(e)?e:100,E.btn.param_autotakeover_minload.setLabelRight({id:m.formatQuantityParam(this.process.autoTakeoverMinload),args:[]},!0)}else if("LOT_ID"===s.id){const e=this.effectiveLotIDorderOneAfterAnother[this.currentLIDindexForEffectiveOrder];if(this.process.lotIDs[e].value=s.rString,
!(this.config.minLengthLIDs<=this.process.lotIDs[e].value.length&&this.process.lotIDs[e].value.length<=this.config.maxLengthLIDs))return this.showMessageBox(n.EnumMessageboxType.WARNING,E.l("_QAPP515_HEADER_ID_LENGTH_MISMATCH"),E.l("_QAPP515_MESSAGE_ID_LENGTH_MISMATCH",[this.config.minLengthLIDs.toFixed(0),this.config.maxLengthLIDs.toFixed(0)]),[E.btn.msg_wrongLIDlength]),"";this.currentLIDindexForEffectiveOrder++,this.addToEventQueue(new A.SimpleEvent("ENTER_NEXT_LOT_IDS"))}return this.hideInput(),""}return""}ENTER_LOT_IDS(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.ENTER_LOT_IDS.name;if(!e&&t&&R.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([i.EV_HMI_BTN_CLICKED,A.SIMPLE_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.ENTER_LOT_IDS()+": Missing argument"),"";if(R.isString(t)&&"onEnter"===t){let e=[]
;for(let t=0;t<this.process.lotIDs.length;t++)this.process.lotIDs[t].inputModes.includes(u.EnumIdentifierInputMode.SELECTABLE_OVERVIEW)&&(E.btn["param_lot_id_"+t.toFixed(0)]=this.createParameterButton(this.process.lotIDs[t].title),E.btn["param_lot_id_"+t.toFixed(0)].setLabelRight({id:this.process.lotIDs[t].value,args:[]}),e.push("/QAPP/"+E.btn["param_lot_id_"+t.toFixed(0)].getTopic()));E.btn.continue=this.createMenuButton(o.EnumFontLabels.NEXT);let t={id:this.IDEXTEND_SCREEN+this.ENTER_LOT_IDS.name,appearance:S.EnumAppearance.ENABLED,type:r.EnumTabType.TAB_MENU,containerTitle:{id:E.l("_QAPP_LIB_GROUP_TITLE_IDENTIFIER_LID"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:r.TAB_MENU_TYPE_TOPIC,menubuttons:e,scrollToTop:!1};this.mainScreen.setMenuTab(t,[E.btn.continue]),this.mainScreen.topLeftButton.setLabel({id:o.EnumFontLabels.CANCEL,args:[]}),this.mainScreen.showTopLeftButton(),this.addToEventQueue(new A.SimpleEvent("CHECK_INPUT")),this.showScreen(this.mainScreen),
this.hideLoadingScreen()}else{if(R.isString(t)&&"onExit"===t)return this.showLoadingScreen(),this.hideMsgBox(),"";if(R.isObject(t)&&t.type&&t.type===A.SIMPLE_EVENT){if("CHECK_INPUT"===t.payload){let e=!0;for(let t=0;t<this.process.lotIDs.length;t++)this.process.lotIDs[t].inputModes.includes(u.EnumIdentifierInputMode.SELECTABLE_OVERVIEW)&&(this.config.minLengthLIDs<=this.process.lotIDs[t].value.length&&this.process.lotIDs[t].value.length<=this.config.maxLengthLIDs?E.btn["param_lot_id_"+t.toFixed(0)].setAppearance(S.EnumAppearance.ENABLED):(e=!1,E.btn["param_lot_id_"+t.toFixed(0)].setAppearance(S.EnumAppearance.ENABLED_INVALID)));E.btn.continue.setAppearance(!0===e?S.EnumAppearance.ENABLED:S.EnumAppearance.DISABLED)}}else if(R.isObject(t)&&t.type&&t.type===i.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===E.btn.continue.getButtonId())return this.confirmLotIDs(),e.transition(this,this.INITIALIZE_MEASUREMENT()),"";t.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID&&this.suspend()
;for(let e=0;e<this.process.lotIDs.length;e++)if(t.payload.buttonId===E.btn["param_lot_id_"+e.toFixed(0)].getButtonId())return this.openInputText(E.btn["param_lot_id_"+e.toFixed(0)].getButtonId()+"_param",this.process.lotIDs[e].header,this.process.lotIDs[e].value,this.config.minLengthLIDs,this.config.maxLengthLIDs),"";this.HandleDefaultButtons(e,t)}}let s=this.parseParamInput(t);if(s.isHandled&&s.isValid){for(let e=0;e<this.process.lotIDs.length;e++)if(s.id===E.btn["param_lot_id_"+e.toFixed(0)].getButtonId()+"_param"){this.process.lotIDs[e].value=s.rString,E.btn["param_lot_id_"+e.toFixed(0)].setLabelRight({id:this.process.lotIDs[e].value,args:[]}),this.addToEventQueue(new A.SimpleEvent("CHECK_INPUT"));break}return this.hideInput(),""}return""}INITIALIZE_MEASUREMENT(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.INITIALIZE_MEASUREMENT.name
;if(!e&&t&&R.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([i.EV_HMI_BTN_CLICKED,_.EV_MQTT_UPDATE,A.SIMPLE_EVENT,A.QAPP_TIMER_EVENT]);if(!t||!e)return console.log(" ## DEBUG ## "+this.INITIALIZE_MEASUREMENT()+": Missing argument"),"";if(R.isString(t)&&"onEnter"===t)this.weighingState=b.idle,this.workflowState=L.clearPan,E.btn.procMenu=this.createWeighingSplitScreenButton(2,o.EnumFontLabels.RESULT,S.EnumAppearance.ENABLED),this.showScreen(this.weighingSplitScreen),this.process.samples.length>=u.MAXIMUM_SAMPLES?(this.weighingSplitScreen.setText1(E.l("_QAPP515_INFO_PROCESS_MAXIMUM_SAMPLES1",[u.MAXIMUM_SAMPLES.toFixed(0)])),this.weighingSplitScreen.setText2(E.l("_QAPP515_INFO_PROCESS_MAXIMUM_SAMPLES2"))):(this.weighingSplitScreen.setText1(E.l("_QAPP515_INFO_PROCESS_REMOVE_SAMPLE")),this.process.autoTare===u.EnumBoolean.ENABLED&&this.weighingProxy.doZeroTareAuto(d.WEIGHING_DOZEROTARE_BEHAVIOR.WEIGHING_DOZEROTARE_BEHAVIOR_AFTER_STABILITY),this.weighingState=b.wait_clear_pan),
this.addToEventQueue(new A.SimpleEvent("UPDATE_SPLITSCREEN")),this.hideLoadingScreen();else{if(R.isString(t)&&"onExit"===t)return this.weighingSplitScreen.setText1(""),this.weighingSplitScreen.setText2(""),this.hideBargraph(),this.hideMsgBox(),this.hideInput(),"";if(R.isObject(t)&&t.type&&t.type===i.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===E.btn.procMenu.getButtonId())return e.transition(this,this.PROCESS_MENU()),"";this.HandleDefaultButtons(e,t)}else if(R.isObject(t)&&t.type&&t.type===A.SIMPLE_EVENT){if("WAIT_FOR_ZERO_TIMEOUT"===t.payload)return this.weighingSplitScreen.setText1(E.l("_QAPP515_INFO_PROCESS_ZERO_PRINT_FAILED")),this.addTimer(1500,"WAIT_FOR_ZERO_TIMEOUT"),"";"UPDATE_SPLITSCREEN"===t.payload&&(this.weighingSplitScreen.getTabApi().getTab(this.IDEXTEND_SCREEN+"INFO_IMAGE").setTabImgRefId(D),
this.config.useStatistics===u.EnumBoolean.ENABLED&&(this.statisticParams.count.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_NUMSAM"),"",this.process.statistics.count)),this.statisticParams.mean.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_AVG"),"",this.process.statistics.mean)),this.statisticParams.stdDev.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_DEV"),"",this.process.statistics.stdDev)),this.statisticParams.varCoeff.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_VAR"),"",this.process.statistics.varCoeff)),this.statisticParams.sum.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_SUM"),"",this.process.statistics.sum)),this.statisticParams.minimum.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_HEADER_STAT_MIN"),"",this.process.statistics.minimum)),
this.statisticParams.maximum.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_HEADER_STAT_MAX"),"",this.process.statistics.maximum)),this.statisticParams.range.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_DIFF"),"",this.process.statistics.range)),this.statisticParams.diffLastTwo.setValue(this.report_getQuantityParam("",E.l("_QAPP515_PARAM_TITLE_DIFF_LAST_TWO"),"",this.process.statistics.diffLastTwo))))}else if(R.isObject(t)&&t.type&&t.type===A.QAPP_TIMER_EVENT){if("WAIT_FOR_ZERO_TIMEOUT"===t.payload)return e.transition(this,this.PERFORM_MEASUREMENT()),""}else if(R.isObject(t)&&t.type&&t.type===_.EV_MQTT_UPDATE){const s=t&&t.payload&&t.payload.topic===I.MqttTopics.WEIGHING_VALUE_GROSS,i=this.parse_MQTT_Weight(t,"anyNumber");let a=!1;if(i&&(a=0===i.value,this.config.allowPrintZero===u.EnumPrintZeroAllowed.ONLY_GROSS&&(a=a&&s)),this.weighingState===b.wait_clear_pan){if(i){let t=0
;if(this.process.autoTakeover===u.EnumBoolean.ENABLED?t=p.bignumber(this.Metrology.d).times(this.process.autoTakeoverMinload.value).dividedBy(2).toNumber():(this.process.samples.length>0&&(t=m.convertToTargetUnit(this.process.samples[this.process.samples.length-1].weight,this.Metrology.unit).value,t=p.bignumber(t).dividedBy(2).toNumber()),(0===this.process.samples.length||t<this.Metrology.d)&&(t=p.bignumber(this.Metrology.d).times(10).toNumber())),i.value<t)return this.config.autoPrintZero===u.EnumBoolean.ENABLED?(this.weighingWaitingTimeout=g.getDateTime("ms")+3e3,this.weighingSplitScreen.setText1(E.l("_QAPP515_INFO_PROCESS_WAITING_FOR_PRINTABLE_ZERO")),this.weighingState=b.wait_clear_pan_stable,""):(e.transition(this,this.PERFORM_MEASUREMENT()),"")}}else if(this.weighingState===b.wait_clear_pan_stable){if(g.getDateTime("ms")>this.weighingWaitingTimeout)return this.weighingState=b.idle,this.addToEventQueue(new A.SimpleEvent("WAIT_FOR_ZERO_TIMEOUT")),""
;if(i&&!0===i.stable)return this.weighingWaitingTimeout=g.getDateTime("ms")+3e3,this.weighingState=b.wait_printable_zero,""}else if(this.weighingState===b.wait_printable_zero){if(g.getDateTime("ms")>this.weighingWaitingTimeout)return this.weighingState=b.idle,this.addToEventQueue(new A.SimpleEvent("WAIT_FOR_ZERO_TIMEOUT")),"";if(i&&a){this.weighingState=b.idle,i.unit=this.Metrology.unit;const t=this.report_getMeasureParam("IRRELEVANT_ZERO",O,M,i);return this.report_enqueuePrintBlock("",[t],!0),e.transition(this,this.PERFORM_MEASUREMENT()),""}}}}return""}PERFORM_MEASUREMENT(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.PERFORM_MEASUREMENT.name;if(!e&&t&&R.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([i.EV_HMI_BTN_CLICKED,A.QAPP_TIMER_EVENT,_.EV_MQTT_UPDATE,A.SIMPLE_EVENT,i.EV_HMI_PARAM_CHANGED]);if(!t||!e)return console.log(" ## DEBUG ## "+this.PERFORM_MEASUREMENT()+": Missing argument"),"";if(R.isString(t)&&"onEnter"===t)this.workflowState=L.placeSample,
this.weighingState=b.idle,E.btn.takeover=this.createWeighingSplitScreenButton(4,o.EnumFontLabels.PRINT_ADD,this.process.autoTakeover===u.EnumBoolean.DISABLED?S.EnumAppearance.DISABLED:S.EnumAppearance.HIDDEN),E.btn.docu=this.createWeighingSplitScreenButton(3,o.EnumFontLabels.DOCU,S.EnumAppearance.ENABLED),E.btn.procMenu=this.createWeighingSplitScreenButton(2,o.EnumFontLabels.RESULT,S.EnumAppearance.ENABLED),E.btn.zero=this.createWeighingSplitScreenButton(1,E.l("_QAPP515_BUTTON_PRINT_ZERO"),this.config.allowPrintZero!==u.EnumPrintZeroAllowed.OFF?S.EnumAppearance.DISABLED:S.EnumAppearance.HIDDEN),E.btn.msg_wrongSIDlength=this.createMessageButton(o.EnumFontLabels.OK),this.showScreen(this.weighingSplitScreen),this.hideLoadingScreen(),this.addToEventQueue(new A.SimpleEvent("UPDATE_SPLITSCREEN")),this.addToEventQueue(new A.SimpleEvent("PREPARE_FOR_ACQUISITION"));else{if(R.isString(t)&&"onExit"===t)return this.weighingSplitScreen.setText1(""),this.weighingSplitScreen.setText2(""),
this.hideBargraph(),this.hideMsgBox(),this.hideInput(),"";if(R.isObject(t)&&t.type&&t.type===i.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===E.btn.zero.getButtonId())return this.weighingSplitScreen.setText1(E.l("_QAPP515_INFO_PROCESS_WAITING_FOR_PRINTABLE_ZERO")),this.weighingWaitingTimeout=g.getDateTime("ms")+3e3,this.weighingState=b.wait_printable_zero,"";if(t.payload.buttonId===E.btn.takeover.getButtonId())return this.addToEventQueue(new A.SimpleEvent("REQUEST_DSD_WEIGHT")),"";if(t.payload.buttonId===E.btn.procMenu.getButtonId())return e.transition(this,this.PROCESS_MENU()),"";if(t.payload.buttonId===E.btn.msg_wrongSIDlength.getButtonId())return this.hideMsgBox(),"";if(t.payload.buttonId===E.btn.docu.getButtonId())return this.printStatistics(),this.showPrintQueue(),"";this.HandleDefaultButtons(e,t)}else if(R.isObject(t)&&t.type&&t.type===A.SIMPLE_EVENT){
if("PREPARE_FOR_ACQUISITION"===t.payload)return this.process.autoTakeover===u.EnumBoolean.ENABLED?this.weighingSplitScreen.setText1(E.l("_QAPP515_INFO_PROCESS_PLACE_SAMPLE_AUTOTAKEOVER"),[(this.process.statistics.count+1).toFixed(0)]):this.weighingSplitScreen.setText1(E.l("_QAPP515_INFO_PROCESS_PLACE_SAMPLE"),[(this.process.statistics.count+1).toFixed(0),E.btn.takeover.getLabel().id]),this.weighingState=b.wait_acquisition_trigger,"";if("WAIT_FOR_ZERO_TIMEOUT"===t.payload)return this.weighingSplitScreen.setText1(E.l("_QAPP515_INFO_PROCESS_ZERO_PRINT_FAILED")),this.addTimer(1500,"WAIT_FOR_ZERO_TIMEOUT"),"";if("REQUEST_DSD_WEIGHT"===t.payload)this.weighingState=b.wait_dsd,this.reportingProxy.requestPrintableValue(this.getTaskName()+"; Sample #"+(this.process.samples.length+1).toFixed(0)),this.weighingWaitingTimeout=g.getDateTime("ms")+6e4;else if("UPDATE_SPLITSCREEN"===t.payload)this.weighingSplitScreen.getTabApi().getTab(this.IDEXTEND_SCREEN+"INFO_IMAGE").setTabImgRefId(P),
this.config.useStatistics===u.EnumBoolean.ENABLED&&(this.statisticParams.count.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_NUMSAM"),"",this.process.statistics.count)),this.statisticParams.mean.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_AVG"),"",this.process.statistics.mean)),this.statisticParams.stdDev.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_DEV"),"",this.process.statistics.stdDev)),this.statisticParams.varCoeff.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_VAR"),"",this.process.statistics.varCoeff)),this.statisticParams.sum.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_SUM"),"",this.process.statistics.sum)),this.statisticParams.minimum.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_HEADER_STAT_MIN"),"",this.process.statistics.minimum)),
this.statisticParams.maximum.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_HEADER_STAT_MAX"),"",this.process.statistics.maximum)),this.statisticParams.range.setValue(this.report_getQuantityParam("",E.l("_QAPP_LIB_PARAM_TITLE_STAT_DIFF"),"",this.process.statistics.range)),this.statisticParams.diffLastTwo.setValue(this.report_getQuantityParam("",E.l("_QAPP515_PARAM_TITLE_DIFF_LAST_TWO"),"",this.process.statistics.diffLastTwo)),this.statisticParams.mean.setParamAppearance(this.process.statistics.count>0?S.EnumAppearance.ENABLED:S.EnumAppearance.HIDDEN),this.statisticParams.stdDev.setParamAppearance(this.process.statistics.count>1?S.EnumAppearance.ENABLED:S.EnumAppearance.HIDDEN),this.statisticParams.varCoeff.setParamAppearance(this.process.statistics.count>1?S.EnumAppearance.ENABLED:S.EnumAppearance.HIDDEN),this.statisticParams.sum.setParamAppearance(this.process.statistics.count>0?S.EnumAppearance.ENABLED:S.EnumAppearance.HIDDEN),
this.statisticParams.minimum.setParamAppearance(this.process.statistics.count>0?S.EnumAppearance.ENABLED:S.EnumAppearance.HIDDEN),this.statisticParams.maximum.setParamAppearance(this.process.statistics.count>0?S.EnumAppearance.ENABLED:S.EnumAppearance.HIDDEN),this.statisticParams.range.setParamAppearance(this.process.statistics.count>1?S.EnumAppearance.ENABLED:S.EnumAppearance.HIDDEN),this.statisticParams.diffLastTwo.setParamAppearance(this.process.statistics.count>1?S.EnumAppearance.ENABLED:S.EnumAppearance.HIDDEN));else if("ENTER_NEXT_SAMPLE_IDS"===t.payload){if(this.currentSIDindexForEffectiveOrder<this.effectiveSampleIDorderOneAfterAnother.length){this.workflowState=L.placeSampleEnterIDs;const e=this.effectiveSampleIDorderOneAfterAnother[this.currentSIDindexForEffectiveOrder];return this.openInputText("SAMPLE_ID",this.currentSample.sampleIDs[e].header,this.currentSample.sampleIDs[e].value,this.config.minLengthSIDs,this.config.maxLengthSIDs),""}
for(let t=0;t<this.currentSample.sampleIDs.length;t++)if(this.currentSample.sampleIDs[t].inputModes.includes(u.EnumIdentifierInputMode.SELECTABLE_OVERVIEW))return this.workflowState=L.placeSampleEnterIDs,e.transition(this,this.ENTER_SAMPLE_IDS()),"";return this.workflowState=L.placeSampleEnterIDsEntered,this.confirmAndStoreCurrentSample(),e.transition(this,this.INITIALIZE_MEASUREMENT()),""}}else if(R.isObject(t)&&t.type&&t.type===A.QAPP_TIMER_EVENT){if("WAIT_FOR_ZERO_TIMEOUT"===t.payload)return this.addToEventQueue(new A.SimpleEvent("PREPARE_FOR_ACQUISITION")),""}else if(R.isObject(t)&&t.type&&t.type===_.EV_MQTT_UPDATE){const e=t&&t.payload&&t.payload.topic===I.MqttTopics.WEIGHING_VALUE_GROSS,s=this.parse_MQTT_Weight(t,"anyNumber");let i=!1;if(s){const a=[b.idle,b.wait_acquisition_trigger].includes(this.weighingState);i=0===s.value,this.config.allowPrintZero===u.EnumPrintZeroAllowed.ONLY_GROSS?(i=i&&e,
e&&E.btn.zero.setAppearance(a&&i?S.EnumAppearance.ENABLED:S.EnumAppearance.DISABLED)):this.config.allowPrintZero===u.EnumPrintZeroAllowed.DISPLAYED_VALUE&&(e||E.btn.zero.setAppearance(a&&i?S.EnumAppearance.ENABLED:S.EnumAppearance.DISABLED)),this.process.autoTakeover===u.EnumBoolean.DISABLED&&E.btn.takeover.setAppearance(a&&null!=this.parse_MQTT_Weight(t,"valid")?S.EnumAppearance.ENABLED_PRIMARY:S.EnumAppearance.DISABLED)}switch(this.weighingState){case b.wait_printable_zero:if(g.getDateTime("ms")>this.weighingWaitingTimeout)return this.weighingState=b.idle,this.addToEventQueue(new A.SimpleEvent("WAIT_FOR_ZERO_TIMEOUT")),"";if(s&&i){this.weighingState=b.idle,s.unit=this.Metrology.unit;const e=this.report_getMeasureParam("IRRELEVANT_ZERO",O,M,s);return this.report_enqueuePrintBlock("",[e],!0),this.addToEventQueue(new A.SimpleEvent("PREPARE_FOR_ACQUISITION")),""}break;case b.wait_acquisition_trigger:if(!e&&this.process.autoTakeover===u.EnumBoolean.ENABLED){
const e=this.parse_MQTT_Weight(t,"valid");if(e&&!0===e.stable&&p.bignumber(e.value).greaterThanOrEqualTo(p.bignumber(this.Metrology.d).times(this.process.autoTakeoverMinload.value)))return this.weighingState=b.idle,this.addToEventQueue(new A.SimpleEvent("REQUEST_DSD_WEIGHT")),""}break;case b.wait_dsd:{if(t&&t.payload&&t.payload.topic===I.MqttTopics.WEIGHING_WAITING_FOR_STABILITY){return!1===JSON.parse(t.payload.value.toString()).state&&(this.weighingWaitingTimeout=g.getDateTime("ms")+1500),""}if(g.getDateTime("ms")>this.weighingWaitingTimeout)return this.weighingState=b.wait_acquisition_trigger,"";const e=this.parse_MQTT_Weight(t,"alibi");if(e)return this.process.autoTakeover!==u.EnumBoolean.ENABLED||!0===e.stable&&p.bignumber(e.value).greaterThanOrEqualTo(p.bignumber(this.Metrology.d).times(this.process.autoTakeoverMinload.value))?(this.weighingState=b.got_dsd,this.currentSample={counter:this.process.samples.length+1,weight:e,sampleIDs:T.cloneJSON(this.process.currentSampleIDs)},
this.currentSIDindexForEffectiveOrder=0,this.addToEventQueue(new A.SimpleEvent("ENTER_NEXT_SAMPLE_IDS")),""):(this.weighingState=b.wait_acquisition_trigger,"");break}}}}let s=this.parseParamInput(t);if(s.isHandled){if(s.isValid&&"SAMPLE_ID"===s.id){const e=this.effectiveSampleIDorderOneAfterAnother[this.currentSIDindexForEffectiveOrder];if(this.currentSample.sampleIDs[e].value=s.rString,!(this.config.minLengthSIDs<=this.currentSample.sampleIDs[e].value.length&&this.currentSample.sampleIDs[e].value.length<=this.config.maxLengthSIDs))return this.showMessageBox(n.EnumMessageboxType.WARNING,E.l("_QAPP515_HEADER_ID_LENGTH_MISMATCH"),E.l("_QAPP515_MESSAGE_ID_LENGTH_MISMATCH",[this.config.minLengthSIDs.toFixed(0),this.config.maxLengthSIDs.toFixed(0)]),[E.btn.msg_wrongSIDlength]),"";this.currentSIDindexForEffectiveOrder++,this.addToEventQueue(new A.SimpleEvent("ENTER_NEXT_SAMPLE_IDS"))}this.hideInput()}return""}ENTER_SAMPLE_IDS(e,t){
if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.ENTER_SAMPLE_IDS.name;if(!e&&t&&R.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([i.EV_HMI_BTN_CLICKED,A.SIMPLE_EVENT,i.EV_HMI_PARAM_CHANGED]);if(!t||!e)return console.log(" ## DEBUG ## "+this.ENTER_SAMPLE_IDS()+": Missing argument"),"";if(R.isString(t)&&"onEnter"===t){let e=[];for(let t=0;t<this.currentSample.sampleIDs.length;t++)this.currentSample.sampleIDs[t].inputModes.includes(u.EnumIdentifierInputMode.SELECTABLE_OVERVIEW)&&(E.btn["param_sample_id_"+t.toFixed(0)]=this.createParameterButton(this.currentSample.sampleIDs[t].title),E.btn["param_sample_id_"+t.toFixed(0)].setLabelRight({id:this.currentSample.sampleIDs[t].value,args:[]}),e.push("/QAPP/"+E.btn["param_sample_id_"+t.toFixed(0)].getTopic()));E.btn.continue=this.createMenuButton(o.EnumFontLabels.OK);let t={id:this.IDEXTEND_SCREEN+this.ENTER_SAMPLE_IDS.name,appearance:S.EnumAppearance.ENABLED,type:r.EnumTabType.TAB_MENU,containerTitle:{
id:E.l("_QAPP_LIB_GROUP_TITLE_IDENTIFIER_SID"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:r.TAB_MENU_TYPE_TOPIC,menubuttons:e,scrollToTop:!1};this.mainScreen.setMenuTab(t,[E.btn.continue]),this.mainScreen.hideTopLeftButton(),this.addToEventQueue(new A.SimpleEvent("CHECK_INPUT")),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else{if(R.isString(t)&&"onExit"===t)return this.showLoadingScreen(),this.hideMsgBox(),"";if(R.isObject(t)&&t.type&&t.type===A.SIMPLE_EVENT){if("CHECK_INPUT"===t.payload){let e=!0;for(let t=0;t<this.currentSample.sampleIDs.length;t++)this.currentSample.sampleIDs[t].inputModes.includes(u.EnumIdentifierInputMode.SELECTABLE_OVERVIEW)&&(this.config.minLengthSIDs<=this.currentSample.sampleIDs[t].value.length&&this.currentSample.sampleIDs[t].value.length<=this.config.maxLengthSIDs?E.btn["param_sample_id_"+t.toFixed(0)].setAppearance(S.EnumAppearance.ENABLED):(e=!1,
E.btn["param_sample_id_"+t.toFixed(0)].setAppearance(S.EnumAppearance.ENABLED_INVALID)));E.btn.continue.setAppearance(!0===e?S.EnumAppearance.ENABLED:S.EnumAppearance.DISABLED)}}else if(R.isObject(t)&&t.type&&t.type===i.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===E.btn.continue.getButtonId())return this.workflowState=L.placeSampleEnterIDsEntered,this.confirmAndStoreCurrentSample(),e.transition(this,this.INITIALIZE_MEASUREMENT()),"";for(let e=0;e<this.currentSample.sampleIDs.length;e++)if(t.payload.buttonId===E.btn["param_sample_id_"+e.toFixed(0)].getButtonId())return this.openInputText(E.btn["param_sample_id_"+e.toFixed(0)].getButtonId()+"_param",this.currentSample.sampleIDs[e].header,this.currentSample.sampleIDs[e].value,this.config.minLengthSIDs,this.config.maxLengthSIDs),"";this.HandleDefaultButtons(e,t)}}let s=this.parseParamInput(t);if(s.isHandled&&s.isValid){
for(let e=0;e<this.currentSample.sampleIDs.length;e++)if(s.id===E.btn["param_sample_id_"+e.toFixed(0)].getButtonId()+"_param"){this.currentSample.sampleIDs[e].value=s.rString,E.btn["param_sample_id_"+e.toFixed(0)].setLabelRight({id:this.currentSample.sampleIDs[e].value,args:[]}),this.addToEventQueue(new A.SimpleEvent("CHECK_INPUT"));break}return this.hideInput(),""}return""}PROCESS_MENU(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.PROCESS_MENU.name;if(!e&&t&&R.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([i.EV_HMI_BTN_CLICKED,A.SIMPLE_EVENT,_.EV_MQTT_UPDATE]);if(!t||!e)return console.log(" ## DEBUG ## "+this.PROCESS_MENU()+": Missing argument"),"";if(R.isString(t)&&"onEnter"===t){E.btn.menu_sampleIDs=this.createMenuButton(E.l("_QAPP515_BUTTON_EDIT_SAMPLE_IDS"),this.config.sampleIDs.length>0?S.EnumAppearance.ENABLED:S.EnumAppearance.HIDDEN),E.btn.menu_reportDatetime=this.createMenuButton(E.l("_QAPP515_BUTTON_REPORT_DATETIME")),
E.btn.menu_reportStatistics=this.createMenuButton(E.l("_QAPP515_BUTTON_REPORT_STATISTICS"),this.config.useStatistics===u.EnumBoolean.ENABLED?S.EnumAppearance.ENABLED:S.EnumAppearance.HIDDEN),E.btn.menu_finishProcess=this.createMenuButton(E.l("_QAPP515_BUTTON_FINISH_PROCESS"));let e={id:this.IDEXTEND_SCREEN+this.PROCESS_MENU.name,appearance:S.EnumAppearance.ENABLED,type:r.EnumTabType.TAB_MENU,containerTitle:{id:E.l("_QAPP515_SCREENTITLE_PROCESS_MENU"),args:[]},title:a.createEmptyTextStructure(),topbuttons:[],menuType:r.TAB_MENU_TYPE_TOPIC,menubuttons:["/QAPP/"+E.btn.menu_sampleIDs.getTopic(),"/QAPP/"+E.btn.menu_reportDatetime.getTopic(),"/QAPP/"+E.btn.menu_reportStatistics.getTopic(),"/QAPP/"+E.btn.menu_finishProcess.getTopic()],scrollToTop:!1};this.mainScreen.topLeftButton.setLabel({id:o.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.mainScreen.setMenuTab(e,[]),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else{
if(R.isString(t)&&"onExit"===t)return this.showLoadingScreen(),this.hideMsgBox(),"";if(R.isObject(t)&&t.type&&t.type===A.IMMEDIATE_EVENT){if(R.isObject(t.payload)&&t.payload.topic===E.REPORTING_QUEUE_DONE_EVENT&&(this.hideLoadingScreen(),this.workflowState===L.finishProcess))return this.reportingProxy.printPrintQueue(),""}else if(R.isObject(t)&&t.type&&t.type===A.SIMPLE_EVENT){if("RETURN_TO_MEASUREMENT_SCREEN"===t.payload)return this.workflowState===L.clearPan?e.transition(this,this.INITIALIZE_MEASUREMENT()):this.workflowState===L.placeSample&&e.transition(this,this.PERFORM_MEASUREMENT()),""}else if(R.isObject(t)&&t.type&&t.type===i.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===E.btn.menu_sampleIDs.getButtonId())return e.transition(this,this.ENTER_PRESET_SAMPLE_IDS()),"";if(t.payload.buttonId===E.btn.menu_reportDatetime.getButtonId()){this.showLoadingScreen();const e=a.createEmptyDateTimeParameter();e.id="CUSTOM_DATETIME",e.appearance=S.EnumAppearance.ENABLED,
e.title.id=E.l("_QAPP_LIB_PARAM_TITLE_SAMPLE_DATETIME"),e.value.timestamp=g.getDateTime("s");let t=[e];return this.config.printBlankLines===u.EnumBoolean.ENABLED&&t.push(this.report_getTextParam("BLANK_LINE"," ")),this.report_enqueuePrintBlock("",t,!0),this.addToEventQueue(new A.SimpleEvent("RETURN_TO_MEASUREMENT_SCREEN")),""}if(t.payload.buttonId===E.btn.menu_reportStatistics.getButtonId())return this.showLoadingScreen(),this.printStatistics(!0),this.addToEventQueue(new A.SimpleEvent("RETURN_TO_MEASUREMENT_SCREEN")),"";if(t.payload.buttonId===E.btn.menu_finishProcess.getButtonId()){if(this.workflowState=L.finishProcess,!1===this.printStatistics())return this.reportingProxy.printPrintQueue(),""}else if(t.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID)return this.addToEventQueue(new A.SimpleEvent("RETURN_TO_MEASUREMENT_SCREEN")),"";this.HandleDefaultButtons(e,t)
}else if(R.isObject(t)&&t.type&&t.type===_.EV_MQTT_UPDATE&&t.payload&&t.payload.topic&&t.payload.topic===I.MqttTopics.REPORTING_PRINT_PROCESS_RESULT&&this.workflowState===L.finishProcess)return this.taskMngProxy.setTaskEvent(this.taskId?this.taskId:"---",h.EnumTaskManagementEvent.EVENT_RESTART),e.transition(this,this.INITIALIZE_PROCESS()),""}return""}ENTER_PRESET_SAMPLE_IDS(e,t){if(!e&&!t)return this.IDEXTEND_STATE_SCREEN+this.ENTER_PRESET_SAMPLE_IDS.name;if(!e&&t&&R.isString(t)&&"GET_EVENT_LISTENER"===t)return JSON.stringify([i.EV_HMI_BTN_CLICKED,A.SIMPLE_EVENT,i.EV_HMI_PARAM_CHANGED]);if(!t||!e)return console.log(" ## DEBUG ## "+this.ENTER_PRESET_SAMPLE_IDS()+": Missing argument"),"";if(R.isString(t)&&"onEnter"===t){let e=[];for(let t=0;t<this.process.currentSampleIDs.length;t++)E.btn["param_sample_id_"+t.toFixed(0)]=this.createParameterButton(this.process.currentSampleIDs[t].title),E.btn["param_sample_id_"+t.toFixed(0)].setLabelRight({id:this.process.currentSampleIDs[t].value,
args:[]}),e.push("/QAPP/"+E.btn["param_sample_id_"+t.toFixed(0)].getTopic());E.btn.docu=this.createMenuButton(o.EnumFontLabels.PRINT_ADD);let t={id:this.IDEXTEND_SCREEN+this.ENTER_PRESET_SAMPLE_IDS.name,appearance:S.EnumAppearance.ENABLED,type:r.EnumTabType.TAB_MENU,containerTitle:{id:E.l("_QAPP_LIB_GROUP_TITLE_IDENTIFIER_SID"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:r.TAB_MENU_TYPE_TOPIC,menubuttons:e,scrollToTop:!1};this.mainScreen.setMenuTab(t,[E.btn.docu]),this.mainScreen.topLeftButton.setLabel({id:o.EnumFontLabels.CANCEL,args:[]}),this.mainScreen.showTopLeftButton(),this.addToEventQueue(new A.SimpleEvent("CHECK_INPUT")),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else{if(R.isString(t)&&"onExit"===t)return this.showLoadingScreen(),this.hideMsgBox(),"";if(R.isObject(t)&&t.type&&t.type===A.SIMPLE_EVENT){if("CHECK_INPUT"===t.payload){let e=!0
;for(let t=0;t<this.process.currentSampleIDs.length;t++)this.config.minLengthSIDs<=this.process.currentSampleIDs[t].value.length&&this.process.currentSampleIDs[t].value.length<=this.config.maxLengthSIDs?E.btn["param_sample_id_"+t.toFixed(0)].setAppearance(S.EnumAppearance.ENABLED):(e=!1,E.btn["param_sample_id_"+t.toFixed(0)].setAppearance(S.EnumAppearance.ENABLED_INVALID));E.btn.docu.setAppearance(!0===e?S.EnumAppearance.ENABLED:S.EnumAppearance.DISABLED),this.mainScreen.topLeftButton.setAppearance(!0===e?S.EnumAppearance.ENABLED:S.EnumAppearance.DISABLED)}else if("RETURN_TO_MEASUREMENT_SCREEN"===t.payload)return this.workflowState===L.clearPan?e.transition(this,this.INITIALIZE_MEASUREMENT()):this.workflowState===L.placeSample&&e.transition(this,this.PERFORM_MEASUREMENT()),""}else if(R.isObject(t)&&t.type&&t.type===i.EV_HMI_BTN_CLICKED){if(t.payload.buttonId===E.btn.docu.getButtonId()){let e=[],t=0
;for(let s=0;s<this.process.currentSampleIDs.length;s++)this.config.rememberSIDs===u.EnumBoolean.ENABLED&&this.config.sampleIDs[s]&&(this.config.sampleIDs[s].value=this.process.currentSampleIDs[s].value),(this.config.printEmptySIDs===u.EnumBoolean.ENABLED||this.process.currentSampleIDs[s].value.length>0)&&(t++,e.push(this.report_getStringParam("SAMPLE_ID_"+s.toFixed(0),this.process.currentSampleIDs[s].title,this.process.currentSampleIDs[s].header,this.process.currentSampleIDs[s].value)));return t>0&&(this.config.printBlankLines===u.EnumBoolean.ENABLED&&e.push(this.report_getTextParam("BLANK_LINE"," ")),this.report_enqueuePrintBlock("",e,!0)),this.addToEventQueue(new A.SimpleEvent("RETURN_TO_MEASUREMENT_SCREEN")),""}if(t.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID&&this.mainScreen.topLeftButton.getAppearance()===S.EnumAppearance.ENABLED)return this.addToEventQueue(new A.SimpleEvent("RETURN_TO_MEASUREMENT_SCREEN")),""
;for(let e=0;e<this.process.currentSampleIDs.length;e++)if(t.payload.buttonId===E.btn["param_sample_id_"+e.toFixed(0)].getButtonId())return this.openInputText(E.btn["param_sample_id_"+e.toFixed(0)].getButtonId()+"_param",this.process.currentSampleIDs[e].header,this.process.currentSampleIDs[e].value,this.config.minLengthSIDs,this.config.maxLengthSIDs),"";this.HandleDefaultButtons(e,t)}}let s=this.parseParamInput(t);if(s.isHandled&&s.isValid){for(let e=0;e<this.process.currentSampleIDs.length;e++)if(s.id===E.btn["param_sample_id_"+e.toFixed(0)].getButtonId()+"_param"){this.process.currentSampleIDs[e].value=s.rString,E.btn["param_sample_id_"+e.toFixed(0)].setLabelRight({id:this.process.currentSampleIDs[e].value,args:[]}),this.addToEventQueue(new A.SimpleEvent("CHECK_INPUT"));break}return this.hideInput(),""}return""}_____________________METHODS__________________(){}HandleDefaultButtons(e,t){
return E.btn.msg_RESERVED_logout_yes.getButtonId()===E.PROXY_BUTTON_DEFAULT_ID&&(E.btn.msg_RESERVED_logout_yes=this.createMessageButton(E.l("_QAPP_LIB_MBOX_BTN_YES"))),E.btn.msg_RESERVERD_home_yes.getButtonId()===E.PROXY_BUTTON_DEFAULT_ID&&(E.btn.msg_RESERVERD_home_yes=this.createMessageButton(E.l("_QAPP_LIB_MBOX_BTN_YES"))),E.btn.msg_RESERVED_close_no.getButtonId()===E.PROXY_BUTTON_DEFAULT_ID&&(E.btn.msg_RESERVED_close_no=this.createMessageButton(E.l("_QAPP_LIB_MBOX_BTN_NO"))),E.btn.msg_RESERVED_restart_yes.getButtonId()===E.PROXY_BUTTON_DEFAULT_ID&&(E.btn.msg_RESERVED_restart_yes=this.createMessageButton(E.l("_QAPP_LIB_MBOX_BTN_YES"))),
t.payload.buttonId===c.FORCED_SUSPEND_HOME_BUTTON_ID?(this.showMessageBox(n.EnumMessageboxType.QUESTION,E.l("_QAPP_LIB_MBOX_HOME_WARNING_TITLE"),E.l("_QAPP_LIB_MBOX_HOME_WARNING_TEXT_top",!0)+"<br>"+E.l("_QAPP_LIB_MBOX_HOME_WARNING_TEXT_mid",[void 0!==this.getTaskName()?this.getTaskName():""])+"<br>"+E.l("_QAPP_LIB_MBOX_HOME_WARNING_TEXT_bottom"),[E.btn.msg_RESERVERD_home_yes,E.btn.msg_RESERVED_close_no]),!0):t.payload.buttonId===c.LOGOUT_BUTTON_ID?(this.showMessageBox(n.EnumMessageboxType.QUESTION,E.l("_QAPP_LIB_MBOX_LOGOUT_WARNING_TITLE"),E.l("_QAPP_LIB_MBOX_LOGOUT_WARNING_TEXT_top",!0)+"<br>"+E.l("_QAPP_LIB_MBOX_LOGOUT_WARNING_TEXT_mid",[void 0!==this.getTaskName()?this.getTaskName():""])+"<br>"+E.l("_QAPP_LIB_MBOX_LOGOUT_WARNING_TEXT_bottom"),[E.btn.msg_RESERVED_logout_yes,E.btn.msg_RESERVED_close_no]),!0):t.payload.buttonId===E.btn.msg_RESERVERD_home_yes.getButtonId()?(this.hideMsgBox(),this.suspend(),
!0):t.payload.buttonId===E.btn.msg_RESERVED_logout_yes.getButtonId()?(this.hideMsgBox(),this.rememberLogout(),this.suspend(),!0):t.payload.buttonId===E.btn.msg_RESERVED_close_no.getButtonId()?(this.hideMsgBox(),!0):t.payload.buttonId===c.PRINT_RESTART_BUTTON_ID?(this.showMessageBox(n.EnumMessageboxType.QUESTION,E.l("_QAPP_LIB_MBOX_RESTART_QUESTION_TITLE"),E.l("_QAPP_LIB_MBOX_RESTART_QUESTION_TEXT_top",[void 0!==this.getTaskName()?this.getTaskName():""])+"<br>"+E.l("_QAPP_LIB_MBOX_RESTART_QUESTION_TEXT_bottom"),[E.btn.msg_RESERVED_restart_yes,E.btn.msg_RESERVED_close_no]),!0):t.payload.buttonId===E.btn.msg_RESERVED_restart_yes.getButtonId()&&(this.taskMngProxy.setTaskEvent(this.taskId?this.taskId:"---",h.EnumTaskManagementEvent.EVENT_RESTART),e.transition(this,this.INITIALIZE_PROCESS()),!0)}initializeTaskProcess(){if(this.workflowState=L.idle,this.weighingState=b.idle,this.reportingProxy.clearPrintQueue(),
this.config.rememberLIDs===u.EnumBoolean.DISABLED)for(let e=0;e<this.config.lotIDs.length;e++)this.config.lotIDs[e].value="";if(this.config.rememberSIDs===u.EnumBoolean.DISABLED)for(let e=0;e<this.config.sampleIDs.length;e++)this.config.sampleIDs[e].value="";this.effectiveLotIDorderOneAfterAnother=[],this.currentLIDindexForEffectiveOrder=0;for(let e=0;e<this.config.lotIDs.length;e++)this.config.lotIDs[e].inputModes.includes(u.EnumIdentifierInputMode.ONE_AFTER_ANOTHER)&&this.effectiveLotIDorderOneAfterAnother.push(e);this.effectiveSampleIDorderOneAfterAnother=[],this.currentSIDindexForEffectiveOrder=0;for(let e=0;e<this.config.sampleIDs.length;e++)this.config.sampleIDs[e].inputModes.includes(u.EnumIdentifierInputMode.ONE_AFTER_ANOTHER)&&this.effectiveSampleIDorderOneAfterAnother.push(e);this.process=u.createProcess(),this.process.autoTare=this.config.autoTare,this.process.autoTakeover=this.config.autoTakeover,this.process.autoTakeoverMinload=T.cloneJSON(this.config.autoTakeoverMinload),
this.statisticsAlreadyPrintedForCurrentSamples=!0,this.process.lotIDs=T.cloneJSON(this.config.lotIDs),this.process.currentSampleIDs=T.cloneJSON(this.config.sampleIDs);for(let e=0;e<this.process.currentSampleIDs.length;e++)0===this.process.currentSampleIDs[e].value.length&&(this.process.currentSampleIDs[e]=Object.assign({inputModes:this.process.currentSampleIDs[e].inputModes},l.preManipulateIdentifier(this.process.currentSampleIDs[e])))}confirmLotIDs(){let e=[],t=0;for(let s=0;s<this.process.lotIDs.length;s++)this.config.rememberLIDs===u.EnumBoolean.ENABLED&&this.config.lotIDs[s]&&(this.config.lotIDs[s].value=this.process.lotIDs[s].value),(this.config.printEmptyLIDs===u.EnumBoolean.ENABLED||this.process.lotIDs[s].value.length>0)&&(t++,e.push(this.report_getStringParam("LOT_ID_"+s.toFixed(0),this.process.lotIDs[s].title,this.process.lotIDs[s].header,this.process.lotIDs[s].value)))
;t>0&&(this.config.printBlankLines===u.EnumBoolean.ENABLED&&e.push(this.report_getTextParam("BLANK_LINE"," ")),this.report_enqueuePrintBlock(this.config.printReportingHeaders===u.EnumBoolean.ENABLED?E.l("_QAPP_LIB_REPORTING_CATERGORY_INIT"):"",e,!0)),this.samplesHeaderAlreadyPrinted=!1}confirmAndStoreCurrentSample(){this.process.currentSampleIDs=[];for(let e=0;e<this.currentSample.sampleIDs.length;e++)this.process.currentSampleIDs[e]=Object.assign({inputModes:this.currentSample.sampleIDs[e].inputModes},l.preManipulateIdentifier(this.currentSample.sampleIDs[e])),this.config.rememberSIDs===u.EnumBoolean.DISABLED&&this.process.currentSampleIDs[e].automaticManipulation===l.EnumIdentifierAutoManipulation.NONE&&(this.process.currentSampleIDs[e].value=""),this.config.rememberSIDs===u.EnumBoolean.ENABLED&&this.config.sampleIDs[e]&&(this.config.sampleIDs[e].value=this.process.currentSampleIDs[e].value);this.process.samples.push(this.currentSample);const e=[]
;for(let t=0;t<this.process.samples.length;t++)e.push(this.process.samples[t].weight);if(this.process.statistics.count=e.length,this.process.statistics.sum=m.math_Sum(e,this.Metrology.unit),this.process.statistics.mean=m.math_Mean(e,this.Metrology.unit),this.process.statistics.mean.decimals+=1,this.process.statistics.stdDev=m.math_Standard_Deviation(e,this.Metrology.unit),this.process.statistics.stdDev.decimals+=1,this.process.statistics.varCoeff=m.math_Variation_Coefficient(e),this.process.statistics.minimum=m.math_Minimum(e,this.Metrology.unit),this.process.statistics.maximum=m.math_Maximum(e,this.Metrology.unit),this.process.statistics.range={value:p.bignumber(this.process.statistics.maximum.value).minus(this.process.statistics.minimum.value).toNumber(),unit:this.Metrology.unit,decimals:this.Metrology.decimals},this.process.samples.length>=2){
const e=m.convertToTargetUnit(this.process.samples[this.process.samples.length-1].weight,this.Metrology.unit),t=m.convertToTargetUnit(this.process.samples[this.process.samples.length-2].weight,this.Metrology.unit);this.process.statistics.diffLastTwo={value:p.bignumber(e.value).minus(t.value).abs().toNumber(),unit:this.Metrology.unit,decimals:this.Metrology.decimals}}this.statisticsAlreadyPrintedForCurrentSamples=!1;let t=[];for(let e=0;e<this.currentSample.sampleIDs.length;e++)(this.config.printEmptySIDs===u.EnumBoolean.ENABLED||this.currentSample.sampleIDs[e].value.length>0)&&t.push(this.report_getStringParam("SAMPLE_ID_"+e.toFixed(0),this.currentSample.sampleIDs[e].title,this.currentSample.sampleIDs[e].header,this.currentSample.sampleIDs[e].value));t.push(this.report_getDSD_IDParam("WEIGHT_SAMPLE_"+this.currentSample.counter.toFixed(0),this.currentSample.weight)),this.config.printBlankLines===u.EnumBoolean.ENABLED&&t.push(this.report_getTextParam("BLANK_LINE"," "));let s=""
;this.config.printReportingHeaders===u.EnumBoolean.ENABLED&&!1===this.samplesHeaderAlreadyPrinted&&(s=E.l("_QAPP_LIB_REPORTING_CATERGORY_COMPONENTS"),this.samplesHeaderAlreadyPrinted=!0),this.report_enqueuePrintBlock(s,t,this.config.useStatistics===u.EnumBoolean.DISABLED)}printStatistics(e){if(e=!!R.isBoolean(e)&&e,this.config.useStatistics===u.EnumBoolean.DISABLED)return!1;if(!1===this.statisticsAlreadyPrintedForCurrentSamples||!0===e){const e=[this.report_getQuantityParam("STATISTICS_COUNT",E.l("_QAPP_LIB_PARAM_TITLE_STAT_NUMSAM"),E.l("_QAPP_LIB_PARAM_HEADER_STAT_NUMSAM"),{value:this.process.statistics.count,unit:m.EnumUnit.NONE,decimals:0})];return this.process.statistics.count>0&&e.push(this.report_getQuantityParam("STATISTICS_MEAN",E.l("_QAPP_LIB_PARAM_TITLE_STAT_AVG"),E.l("_QAPP_LIB_PARAM_HEADER_STAT_AVG"),this.process.statistics.mean)),
this.process.statistics.count>1&&e.push(this.report_getQuantityParam("STATISTICS_STANDARD_DEVIATION",E.l("_QAPP_LIB_PARAM_TITLE_STAT_DEV"),E.l("_QAPP_LIB_PARAM_HEADER_STAT_DEV"),this.process.statistics.stdDev),this.report_getQuantityParam("STATISTICS_VARIATION_COEFFICIENT",E.l("_QAPP_LIB_PARAM_TITLE_STAT_VAR"),E.l("_QAPP_LIB_PARAM_HEADER_STAT_VAR"),this.process.statistics.varCoeff)),this.process.statistics.count>0&&e.push(this.report_getQuantityParam("STATISTICS_SUM",E.l("_QAPP_LIB_PARAM_TITLE_STAT_SUM"),E.l("_QAPP_LIB_PARAM_HEADER_STAT_SUM"),this.process.statistics.sum),this.report_getQuantityParam("STATISTICS_MINIMUM",E.l("_QAPP_LIB_PARAM_TITLE_STAT_MIN"),E.l("_QAPP_LIB_PARAM_HEADER_STAT_MIN"),this.process.statistics.minimum),this.report_getQuantityParam("STATISTICS_MAXIMUM",E.l("_QAPP_LIB_PARAM_TITLE_STAT_MAX"),E.l("_QAPP_LIB_PARAM_HEADER_STAT_MAX"),this.process.statistics.maximum)),
this.process.statistics.count>1&&e.push(this.report_getQuantityParam("STATISTICS_RANGE",E.l("_QAPP_LIB_PARAM_TITLE_STAT_DIFF"),E.l("_QAPP_LIB_PARAM_HEADER_STAT_DIFF"),this.process.statistics.range),this.report_getQuantityParam("STATISTICS_DIFF_LAST_TWO",E.l("_QAPP515_PARAM_TITLE_DIFF_LAST_TWO"),E.l("_QAPP515_PARAM_HEADER_DIFF_LAST_TWO"),this.process.statistics.diffLastTwo)),this.config.printBlankLines===u.EnumBoolean.ENABLED&&e.push(this.report_getTextParam("BLANK_LINE"," ")),this.report_enqueuePrintBlock(this.config.printReportingHeaders===u.EnumBoolean.ENABLED?E.l("_QAPP_LIB_REPORTING_CATERGORY_STATISTIC"):"",e,!0),this.statisticsAlreadyPrintedForCurrentSamples=!0,this.samplesHeaderAlreadyPrinted=!1,!0}return!1}onSuspending(){l.storeTaskConfig_DATA_CONTAINER(this.taskHandler,this.config),super.onSuspending()}}if(t.QAPP=C,__dirname.endsWith("workflow")){(new C).run()}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const i=s(47),a=s(95),n=s(3),r=s(23),o=s(22),E=s(12),_=s(26),l=s(8),u=s(100),c=s(20),A=s(45),T=s(19),p=s(85),I=s(108),d=s(83),h=s(44),N=s(109),S=s(7),m=s(4),R=s(110),g=s(2),P=s(1),D=s(0),O=s(5),M=s(13),L=s(10),b=s(30),f=s(50);let C,B=s(87);function v(e,t){return void 0!==C?C.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=v;let y={},U={get:function(e,s,i){return null!=s&&void 0!==s&&e.hasOwnProperty(s)&&null!=e[s]&&void 0!==e[s]?Reflect.get(e,s,i):void 0!==C?new l.Button(C.mqttHandler,C.mainScreen,{buttonId:t.PROXY_BUTTON_DEFAULT_ID,appearance:D.EnumAppearance.ENABLED,label:{id:"ERR_PXY_BTN",args:[]}}):void 0}};t.btn=new Proxy(y,U)
;t.wfRunner=class extends a.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 R.AuditTrailProxy,this.Metrology=T.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,C=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=T.get_device_user(),this.IS_SERVICE=this.USER.role_id===f.ACCESS_CONTROL_ROLE_DB_IDS.SERVICE_ROLE_ID,this.IS_ADMIN=this.USER.role_id===f.ACCESS_CONTROL_ROLE_DB_IDS.ADMIN_ROLE_ID||this.IS_SERVICE,this.IS_OPERATOR=this.USER.role_id===f.ACCESS_CONTROL_ROLE_DB_IDS.OPERATOR_ROLE_ID,this.IS_GUEST=this.USER.role_id===f.ACCESS_CONTROL_ROLE_DB_IDS.GUEST_ROLE_ID,this.DATETIME_CONFIGURATION=p.getDateTimeConfiguration(),this.mqttHandler.mqttUpdateEvent$.subscribe(e=>{
L.isObject(e)&&L.isObject(e.payload)&&L.isString(e.payload.topic)&&this.handleMqttEventsGlobally(e)});let s=this.perform_InternalWebserviceRequest("deviceinformation",O.RestMethodsDEVICE_INFORMATION.getParameter,{rObject:{},id:"DEVICEINFORMATION/SETUP"});try{let e=JSON.parse(s.rawReturns.rObject),t=L.getObjectByID(e.parameters,"DEVICEINFORMATION/SETUP/ID1");t&&(this.DEVICE_ID1=t.value.string),(t=L.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 I.SingleTabButtonBarScreen(this.mqttHandler,[],{buttonId:this.DEFAULT_CANCEL_BTN_ID,appearance:D.EnumAppearance.ENABLED,label:{id:S.EnumFontLabels.CANCEL,args:[]}}),this.registerScreen(this.mainScreen);let t={id:"",
appearance:D.EnumAppearance.ENABLED,containerTitle:{id:"",args:[]},title:{id:"",args:[]},topbuttons:[],type:A.EnumTabType.TAB_MENU,menuType:A.TAB_MENU_TYPE_TOPIC,menubuttons:[],scrollToTop:!1};this.mainScreen.setMenuTab(t),this.paramSelectionScreen=new d.KeyboardScreen(this.mqttHandler,!0),this.registerScreen(this.paramSelectionScreen),this.weighingScreen=new h.WeighingScreen(this.mqttHandler,[]),this.registerScreen(this.weighingScreen),this.mqttHandler.publish(P.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:D.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 N.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:D.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 u.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){}y={},t.btn=new Proxy(y,U);for(let e=0;e<s.weighingScreenButtons.length;e++)s.weighingScreenButtons[e].setAppearance(D.EnumAppearance.HIDDEN);for(let e=0;e<s.weighingSplitScreenButtons.length;e++)s.weighingSplitScreenButtons[e].setAppearance(D.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,i){s.includes(o.EV_MQTT_UPDATE)&&t[e](this,i)},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,i){s.includes(E.QAPP_TIMER_EVENT)&&t[e](this,i)},this.STATES[this[e]()].QAPP_INTERVAL_EVENT=function(t,i){s.includes(E.QAPP_INTERVAL_EVENT)&&t[e](this,i)}}catch(e){}})}adaptFsmStates(e){super.adaptFsmStates(e);for(let s of Object.keys(e)){
const i=e[s].EV_MQTT_UPDATE,a=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!==i&&i.call(this,e,t),t&&t.payload&&t.payload.topic===P.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!==a&&a.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),L.isObject(s)&&L.isString(s.payload)&&s.payload===t.PREVENT_AUTO_LOGOUT_INTERVAL_EVENT&&e.preventAutoLogout("justOnce")}}}postInit(){super.postInit(),
this.mqttHandler.subscribe(P.MqttTopics.WEIGHING_VALUE_NET),this.mqttHandler.subscribe(P.MqttTopics.REPORTING_PRINTABLE_VALUE),this.mqttHandler.subscribe(P.MqttTopics.MESSAGE_HANDLER_MESSAGE),this.mqttHandler.subscribe(P.MqttTopics.METROLOGY_APPROVED_FOR_VERIFICATION),this.mqttHandler.subscribe(P.MqttTopics.METROLOGY_RANGES)}handleMqttEventsGlobally(e){switch(e.payload.topic){case P.MqttTopics.METROLOGY_APPROVED_FOR_VERIFICATION:{const t=JSON.parse(e.payload.value.toString());return void(L.isBoolean(t.isApproved)&&(this.DEVICE_APPROVED=t.isApproved,console.log("wfRunner: Changed approval state")))}case P.MqttTopics.METROLOGY_RANGES:return void this.updateMetrology()}}updateMetrology(){return this.Metrology=T.getMetrology(),this.Metrology.unit!==M.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(P.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)),L.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 i=n.createEmptyTextStructure();return"string"==typeof t?i.id=t:i=t,i.id=void 0!==i.id?i.id:"",void 0===s&&(s=D.EnumAppearance.ENABLED),this.weighingScreenButtons[e].setAppearance(s),this.weighingScreenButtons[e].setLabel(i),this.weighingScreenButtons[e].publish(),this.weighingScreenButtons[e]}showBargraph(e,t,s,i,a){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&&(L.isNumber(e)?this.bargraphObject.target=e:this.bargraphObject.target=M.convertToTargetUnit(e,this.Metrology.unit).value,L.isNumber(t)?this.bargraphObject.min1=t:this.bargraphObject.min1=M.convertToTargetUnit(t,this.Metrology.unit).value,
L.isNumber(s)?this.bargraphObject.max1=s:this.bargraphObject.max1=M.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!==i&&void 0!==a&&(L.isNumber(i)?this.bargraphObject.min2=i:this.bargraphObject.min2=M.convertToTargetUnit(i,this.Metrology.unit).value,L.isNumber(a)?this.bargraphObject.max2=a:this.bargraphObject.max2=M.convertToTargetUnit(a,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(P.MqttTopics.HMI_CHECKBARGRAPH_STATUS,JSON.stringify({appearance:D.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(P.MqttTopics.HMI_CHECKBARGRAPH_STATUS,JSON.stringify({appearance:D.EnumAppearance.ENABLED,areas:this.bargraphObject.areaCount.toFixed(0)})),this.bargraphObject.updateTimestamp=0,
this.bargraphObject.active=!0)}hideBargraph(){this.bargraphObject.active=!1,this.mqttHandler.publish(P.MqttTopics.HMI_CHECKBARGRAPH_STATUS,JSON.stringify({appearance:D.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,i=0,a=t.value;if(L.isNumber(a)){switch(this.bargraphObject.areaCount){case 4:a<this.bargraphObject.min1?(e.area=1,s=this.bargraphObject.effectiveMinimum,i=this.bargraphObject.min1):a<this.bargraphObject.target?(e.area=2,s=this.bargraphObject.min1,i=this.bargraphObject.target):a<=this.bargraphObject.max1?(e.area=3,s=this.bargraphObject.target,i=this.bargraphObject.max1):(e.area=4,s=this.bargraphObject.max1,i=this.bargraphObject.effectiveMaximum);break;case 6:a<this.bargraphObject.min2?(e.area=1,s=this.bargraphObject.effectiveMinimum,
i=this.bargraphObject.min2):a<this.bargraphObject.min1?(e.area=2,s=this.bargraphObject.min2,i=this.bargraphObject.min1):a<this.bargraphObject.target?(e.area=3,s=this.bargraphObject.min1,i=this.bargraphObject.target):a<=this.bargraphObject.max1?(e.area=4,s=this.bargraphObject.target,i=this.bargraphObject.max1):a<=this.bargraphObject.max2?(e.area=5,s=this.bargraphObject.max1,i=this.bargraphObject.max2):(e.area=6,s=this.bargraphObject.max2,i=this.bargraphObject.effectiveMaximum)}e.perc=(a-s)/Math.abs(i-s)*100,e.perc=Math.max(e.perc,0),e.perc=Math.min(e.perc,100)}else t.info&&"HIGH"===t.info.toString().toUpperCase()?(a=this.bargraphObject.effectiveMaximum,e.area=this.bargraphObject.areaCount,e.perc=100):(a=this.bargraphObject.effectiveMinimum,e.area=1,e.perc=0);this.mqttHandler.publish(P.MqttTopics.HMI_CHECKBARGRAPH_VALUE,JSON.stringify(e))}this.bargraphObject.updateTimestamp=Date.now()}}createWeighingSplitScreenButton(e,t,s){let i=n.createEmptyTextStructure()
;return L.isString(t)?i.id=t:i=t,i.id=void 0!==i.id?i.id:"",void 0===s&&(s=D.EnumAppearance.ENABLED),this.weighingSplitScreenButtons[e].setAppearance(s),this.weighingSplitScreenButtons[e].setLabel(i),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,i,a){let r=n.createEmptyTextStructure();L.isString(s)?r.id=s:r=s,r.id=void 0!==r.id?r.id:"",void 0===i&&(i=D.EnumAppearance.ENABLED),L.isBoolean(a)||(a=!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:i,label:r});return!0===a&&E.publish(),E}showMessageBox(e,t,s,i,a,n){if(L.isObject(e))return void super.showMessageBox(e);if(e=e,void 0===t||void 0===s||!Array.isArray(i))return void console.log("wfRunner: showMessageBox: missing arguments");let r=[];for(let e=0;e<i.length;e++)r[e]={appearance:i[e].getAppearance(),label:i[e].getLabel(),id:i[e].getButtonId()};L.isString(t)&&(t={id:t,args:[]}),t=t;let o=[];if(Array.isArray(s))o=s;else{let e="";L.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:[]})}a=L.isString(a)&&7===a.length?a:"#FFFFFF",L.isNumber(n)||(n=1),n=n;let _={type:e,title:t,textList:o,buttons:r,backgroundColor:a};this.messageBoxesCache[n]=_,
n>=this.getMostPriorMessageBoxIndex()&&this.showMostPriorMessageBox(),console.log("wfRunner: Number of messages in cache: "+Object.keys(this.messageBoxesCache).length)}hideMsgBox(e){if(L.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=T.sortKeys(this.messageBoxesCache);return e.length>0?parseInt(e[e.length-1]):0}setWeighingScreenParams(e,t,s,i,a,n){return this._setWeighingScreenParams(this.weighingScreen,e,t,s,i,a,n)}
setWeighingSplitScreenParams(e,t,s,i,a,n){return this._setWeighingScreenParams(this.weighingSplitScreen,e,t,s,i,a,n)}_setWeighingScreenParams(e,t,s,i,a,r,o){let E=n.createEmptyTextStructure();L.isString(s)?E.id=s:E=s;let _=n.createEmptyTextStructure();L.isString(i)?_.id=i:_=i,L.isString(r)||(r=this.QAPP_TOKEN+"_WGHSCR_PARAM_"+t.toFixed()),L.isBoolean(o)||(o=!1);const l=new c.Param(this.mqttHandler,{id:r,header:E,title:_,type:D.EnumParameterTypes.PARAM_STRING,appearance:!0===o?D.EnumAppearance.ENABLED_EDITABLE:D.EnumAppearance.ENABLED,info:{minimum:{length:0},maximum:{length:1/0}},value:{string:a}});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:D.EnumAppearance.ENABLED,type:A.EnumTabType.TAB_PARAMLIST,containerTitle:n.createEmptyTextStructure(),title:n.createEmptyTextStructure(),topbuttons:[],displayHeader:!1,
params:[]};for(var s=0;s<e.length;s++){let i=new c.Param(this.mqttHandler,{id:this.IDEXTEND_PARAM+Math.floor(Math.random()*Math.floor(1e5)).toString(),type:D.EnumParameterTypes.PARAM_STRING,appearance:D.EnumAppearance.ENABLED,value:{string:e[s].value},title:{id:e[s].title,args:[]},header:{id:"",args:[]},info:{maximum:{length:NaN},minimum:{length:NaN}}});i.publish(),t.params.push(i.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(),i=this.weighingSplitScreen.getTabApi().getTab(s);i&&void 0!==i||(i=this.addSplitScreenTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+e.toString())),(i=i).setTabTitle({id:t,args:[]})}setSplitScreenTabParamList(e,t,s,i,a){if(L.isBoolean(a)||(a=!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();L.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=D.EnumAppearance.ENABLED,E.title={id:void 0!==i?i:"",args:[]};const _=new c.Param(this.mqttHandler,E);let l=o.getTabParams();l.includes(_.getPublishedId())||l.push(_.getPublishedId()),o.setTabParams(l),!0===a&&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 i=this.IDEXTEND_SCREEN+"SPLITSCREEN_"+e.toString(),a=this.weighingSplitScreen.getTabApi().getTab(i);a&&void 0!==a||(a=this.addSplitScreenTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+e.toString())),a=a;let n=new c.Param(this.mqttHandler,{id:this.IDEXTEND_PARAM+"SPLITSCREEN_"+e.toString()+"_TEXT",type:D.EnumParameterTypes.PARAM_STRING,appearance:D.EnumAppearance.ENABLED,value:{string:t},title:{id:"",args:[]},header:{id:"",args:[]},info:{maximum:{length:NaN},minimum:{length:NaN}}});n.publish();let r=a.getTabParams();r.includes(n.getPublishedId())||r.push(n.getPublishedId()),a.setTabParams(r),void 0!==s&&a.setTabTitle({id:s,args:[]}),a.publishTabParams()}addSplitScreenTab(e,t){let s={id:e,appearance:D.EnumAppearance.ENABLED,type:A.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(P.MqttTopics.ESIGNATURE_PERFORM,JSON.stringify({appearance:D.EnumAppearance.ENABLED})),!0}openInputText(e,t,s,i,a){let r=n.createEmptyStringParameter();r.id=e,r.appearance=D.EnumAppearance.ENABLED;let o=n.createEmptyTextStructure();return L.isString(t)?o.id=t:o=t,r.header=o,r.title=o,r.value.string=L.isString(s)?s:"",r.info={minimum:{length:L.isNumber(i)?i:0},maximum:{length:L.isNumber(a)?a:0}},this.mqttHandler.publish(P.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify({appearance:D.EnumAppearance.ENABLED,param:r})),!0}openInputDateTime(e,t,s,i,a){let r=n.createEmptyDateTimeParameter();r.id=e,r.appearance=D.EnumAppearance.ENABLED;let o=n.createEmptyTextStructure()
;return L.isString(t)?o.id=t:o=t,r.header=o,r.title=o,r.value.timestamp=L.isNumber(s)?s:p.getDateTime("s",void 0,s,"iso"),r.info={isDate:!L.isBoolean(i)||i,isTime:!L.isBoolean(a)||a},this.mqttHandler.publish(P.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify({appearance:D.EnumAppearance.ENABLED,param:r})),!0}openInputNumber(e,t,s,i,a,r){let o=n.createEmptyQuantityParameter();o.id=e,o.appearance=D.EnumAppearance.ENABLED;let E=n.createEmptyTextStructure();L.isString(t)?E.id=t:E=t,o.header=E,o.title=E;let _={value:0,unit:M.EnumUnit.NONE,decimals:0},l=[];if(L.isNumber(s)?l.push(s.toString()):L.isObject(s)&&(l.push(M.formatQuantityParam_numberOnly(s)),_=s),o.directInput=!0,L.isObject(r)&&r.length>0){r=r;for(let e=0;e<r.length;e++){let t="";L.isNumber(r[e])?t=r[e].toString():L.isObject(r[e])&&(t=M.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:M.getUnitString(_.unit)},(i=L.isNumber(i)?i:-1/0)>(a=L.isNumber(a)?a:1/0)&&(a=1/0),o.info={minimum:{value:i.toString()},maximum:{value:a.toString()}},this.mqttHandler.publish(P.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify({appearance:D.EnumAppearance.ENABLED,param:o})),!0}openInputSelection(e,t,s,i,a){let r,o={id:""},E=[];if(!0===(a=!!L.isBoolean(a)&&a)){r=n.createEmptyMultipleSelectionParameter(),void 0!=i&&L.isString(i)&&(i=[i]);for(let e=0;e<i.length;e++)E.push({id:i[e]})}else r=n.createEmptySelectionParameter(),void 0!=i&&(Array.isArray(i)&&i.length>0&&(i=i[0]),o.id=L.isString(i)?i:"");r.id=e,r.appearance=D.EnumAppearance.ENABLED;let _=n.createEmptyTextStructure();L.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();L.isString(s[e].text)?t.id=s[e].text:t=s[e].text,null==L.getObjectByID(l,s[e].id)&&l.push({id:s[e].id,text:t,
appearance:L.isString(s[e].appearance)?s[e].appearance:D.EnumAppearance.ENABLED})}return r.info={options:l},r.type===D.EnumParameterTypes.PARAM_SELECTION?r.value.selection=o:r.type===D.EnumParameterTypes.PARAM_MULTIPLE_SELECTION&&(r.value.selections=E),this.mqttHandler.publish(P.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify({appearance:D.EnumAppearance.ENABLED,param:r})),!0}parseParamInput(e){let t="";return L.isObject(e)&&L.isString(e.type)&&e.type===r.EV_HMI_PARAM_CHANGED&&L.isObject(e.payload)&&L.isObject(e.payload.parameter)?{id:t=e.payload.parameter.id,isHandled:!0,get isValid(){if(e.payload.parameter.type===D.EnumParameterTypes.PARAM_STRING){if(L.isObject(e.payload.parameter.value)&&L.isString(e.payload.parameter.value.string))return!0}else if(e.payload.parameter.type===D.EnumParameterTypes.PARAM_SELECTION){
if(L.isObject(e.payload.parameter.value)&&L.isObject(e.payload.parameter.value.selection)&&L.isString(e.payload.parameter.value.selection.id)&&L.isObject(e.payload.parameter.value.selection.text))return!0}else if(e.payload.parameter.type===D.EnumParameterTypes.PARAM_MULTIPLE_SELECTION){if(L.isObject(e.payload.parameter.value)&&L.isObject(e.payload.parameter.value.selections)&&Array.isArray(e.payload.parameter.value.selections))return!0}else if(e.payload.parameter.type===D.EnumParameterTypes.PARAM_QUANTITY){if(L.isObject(e.payload.parameter.value)&&L.isObject(e.payload.parameter.value.numbers)&&L.isString(e.payload.parameter.value.numbers[0])&&L.isNumber(parseFloat(e.payload.parameter.value.numbers[0])))return!0}else if(e.payload.parameter.type===D.EnumParameterTypes.PARAM_DATE_TIME&&L.isObject(e.payload.parameter.value)&&L.isNumber(e.payload.parameter.value.timestamp))return!0;return!1},get rString(){
return L.isObject(e.payload.parameter.value)&&L.isString(e.payload.parameter.value.string)?e.payload.parameter.value.string:""},get rInteger(){return L.isObject(e.payload.parameter.value)&&L.isObject(e.payload.parameter.value.numbers)&&L.isString(e.payload.parameter.value.numbers[0])&&L.isNumber(parseInt(e.payload.parameter.value.numbers[0]))?parseInt(e.payload.parameter.value.numbers[0]):NaN},get rFloat(){return L.isObject(e.payload.parameter.value)&&L.isObject(e.payload.parameter.value.numbers)&&L.isString(e.payload.parameter.value.numbers[0])&&L.isNumber(parseFloat(e.payload.parameter.value.numbers[0]))?parseFloat(e.payload.parameter.value.numbers[0]):NaN},get rSelectionID(){return L.isObject(e.payload.parameter.value)&&L.isObject(e.payload.parameter.value.selection)&&L.isString(e.payload.parameter.value.selection.id)?e.payload.parameter.value.selection.id:""},get rMultipleSelectionIDs(){
if(L.isObject(e.payload.parameter.value)&&L.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 L.isObject(e.payload.parameter.value)&&L.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 L.isObject(e.payload.parameter.value)&&L.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 L.isObject(e.payload.parameter.value)&&L.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(P.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify({appearance:D.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 i=!1,a=!1,n=!1,r={value:NaN,unit:M.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===P.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),
L.isNumber(r.value)||(r.info=s.weightBlock[0].value.number),L.isNumber(r.value)&&"-"===s.weightBlock[0].value.sign&&(r.value*=-1),r.decimals=s.weightBlock[0].value.decimals,r.unit=b.UnitEnum_Lib2Api(s.weightBlock[0].value.unit),r.stable=s.weightBlock[0].value.isStable,i=s.weightBlock[0].value.isSpecial,a=s.weightBlock[0].value.isInvalid,n=s.weightBlock[0].value.isWarning,L.isNumber(r.value))){if(r.alibi=M._formatQuantityParam_numberOnly(r.value,r.decimals),L.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+=" "+M.getUnitString(r.unit))}}else if(s&&s.id&&s.id==P.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==P.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),L.isNumber(r.value)||(r.info=s.parameters[o].parameters[0].value.number),L.isNumber(r.value)&&"-"===s.parameters[o].parameters[0].value.sign&&(r.value*=-1),r.decimals=s.parameters[o].parameters[0].value.decimals,r.unit=b.UnitEnum_Lib2Api(s.parameters[o].parameters[0].value.unit),r.stable=s.parameters[o].parameters[0].value.isStable,L.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),i=s.parameters[o].parameters[0].value.isSpecial,a=s.parameters[o].parameters[0].value.isInvalid,n=s.parameters[o].parameters[0].value.isWarning;break}
}else s&&s.id&&[P.MqttTopics.WEIGHING_VALUE_NET,P.MqttTopics.WEIGHING_VALUE_GROSS,P.MqttTopics.WEIGHING_VALUE_TARE,P.MqttTopics.WEIGHING_VALUE_TARE1,P.MqttTopics.WEIGHING_VALUE_TARE2].indexOf(s.id)>=0&&s.hasOwnProperty("value")&&(r.value=parseFloat(s.value.number),L.isNumber(r.value)||(r.info=s.value.number),L.isNumber(r.value)&&"-"===s.value.sign&&(r.value*=-1),r.decimals=s.value.decimals,r.unit=b.UnitEnum_Lib2Api(s.value.unit),r.stable=s.value.isStable,L.isNumber(s.value.auxiliaryDigits)&&s.value.auxiliaryDigits>0&&(r.auxiliaryDigits=s.value.auxiliaryDigits),i=s.value.isSpecial,a=s.value.isInvalid,n=s.value.isWarning);return i&&L.isNumber(r.value)&&(r.info=r.value.toString(),r.value=Number.NaN),"any"!==t&&!L.isNumber(r.value)||("valid"===t||"alibi"===t)&&(i||a)?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=L.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&&L.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(L.isObject(e)&&L.isString(e.type)&&e.type===o.EV_MQTT_UPDATE&&L.isObject(e)&&L.isObject(e.payload)&&e.payload.topic===P.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 i;return null!=s&&void 0!==s&&""!==s||(s=" "),null!=e&&void 0!==e&&""!==e||(e=" "),(i=L.isString(t)?this.report_getStringParam("",s,e,t):L.isObject(t)&&L.isNumber(t.value)&&L.isNumber(t.decimals)?this.report_getMeasureParam("",s,e,t):this.report_getStringParam("",s,e,"N.A.")).appearance=D.EnumAppearance.ENABLED,i}report_getStringParam(e,t,s,i){
let a=n.createEmptyStringParameter();return null!=t&&void 0!==t&&""!==t||(t=" "),null!=s&&void 0!==s&&""!==s||(s=" "),a.id=e,a.title.id=t,a.header.id=s,a.value.string=i,a.info={minimum:{length:0},maximum:{length:1e6}},a.appearance=D.EnumAppearance.ENABLED,a}report_getDateTimeParam(e,t,s){let i=n.createEmptyDateTimeParameter();return t=L.isString(t)?t.length>0?t:" ":v("_QAPP_LIB_PARAM_TITLE_SAMPLE_DATETIME"),i.id=e,i.title.id=t,i.value.timestamp=s,i.appearance=D.EnumAppearance.ENABLED,i}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=D.EnumAppearance.ENABLED,s}report_getDSDParam(e,t){let s=this.report_getTextParam(e,"WRONG DSD FORMAT"),i=-1;if(L.isNumber(t)?i=t:L.isObject(t)&&L.isNumber(t.value)&&(i=t.alibiId),L.isNumber(i)&&i>0){let t=this.reportingProxy.getAlibiRecord(i)
;s=t.isSuccess()?this.reportingProxy.getWeightFromAlibi(t):this.report_getTextParam(e,"MISSING DSD ENTRY ("+i.toFixed(0)+")")}return s.id=e,s.appearance=D.EnumAppearance.ENABLED,s}report_getDSD_IDParam(e,t){let s=this.report_getTextParam(e,"WRONG DSD FORMAT"),i=-1;return L.isNumber(t)?i=t:L.isObject(t)&&L.isNumber(t.value)&&(i=t.alibiId),L.isNumber(i)&&i>0&&(this.reportingProxy.getAlibiRecord(i).isSuccess()?(s=n.createEmptyAlibiIdentifier()).value.alibiIdentifier=i:s=this.report_getTextParam(e,"MISSING DSD ENTRY ("+i.toFixed(0)+")")),s.id=e,s.appearance=D.EnumAppearance.ENABLED,s}report_getQuantityParam(e,t,s,i){let a=n.createEmptyQuantityParameter();return null!=t&&void 0!==t&&""!==t||(t=" "),null!=s&&void 0!==s&&""!==s||(s=" "),a.id=e,a.title.id=t,a.header.id=s,L.isNumber(i)?(a.value.numbers[0]=i.toFixed(0),a.value.decimals=0,a.value.preferredDecimals=0,a.value.unit=" "):L.isObject(i)&&L.isNumber(i.value)&&(i=i,a.value.numbers[0]=M.formatQuantityParam_numberOnly(i),
a.value.decimals=i.decimals,a.value.preferredDecimals=i.decimals,a.value.unit=" "+M.getUnitString(i.unit)),a.appearance=D.EnumAppearance.ENABLED,a}report_getMeasureParam(e,t,s,i){let a=n.createEmptyMeasureParameter();return null!=t&&void 0!==t&&""!==t||(t=" "),null!=s&&void 0!==s&&""!==s||(s=" "),a.id=e,a.title.id=t,a.header.id=s,L.isNumber(i)?(i=i,a.value=n.createEmptyMeasureParameterValue(),a.value.mark=v(s,!0),a.value.sign=i<0?"-":"",a.value.number=i.toFixed(0),a.value.decimals=0,a.value.auxiliaryDigits=0,a.value.unit=" ",a.value.interval=1,a.value.isStable=!0,a.value.isSpecial=!1,a.value.isWarning=!1,a.value.isInvalid=!1):L.isObject(i)&&L.isNumber(i.value)&&(i=i,a.value=n.createEmptyMeasureParameterValue(),a.value.mark=v(s,!0),a.value.sign=i.value<0?"-":"",a.value.number=i.value.toFixed(i.decimals),a.value.decimals=i.decimals,a.value.auxiliaryDigits=void 0!==i.auxiliaryDigits?i.auxiliaryDigits:0,a.value.unit=" "+M.getUnitString(i.unit),a.value.interval=Math.pow(10,-1*i.decimals),
a.value.isStable=void 0!==i.stable&&i.stable,a.value.isSpecial=!1,a.value.isWarning=!1,a.value.isInvalid=!1),a.appearance=D.EnumAppearance.ENABLED,a}report_getCodeParam(e,t,s){let i=n.createEmptyBarcodeParameter();return s=void 0!==s?s:D.EnumBarcodeFormats.QR,i.id=e,i.title.id=" ",i.header.id=" ",i.value.string=t,i.value.format=s,i.appearance=D.EnumAppearance.ENABLED,i}report_enqueuePrintBlock(e,s,i,a,n,r){return L.isBoolean(i)||(i=!1),L.isBoolean(a)||(a=!1),L.isString(n)||(n=""),this.reportingPrintBlocksQueue.push({requestType:"ADD_PRINT_BLOCK",printItemIdentifierMapID:r,printItemIdentifierReference:-1,lines:s,blockHeader:e,redactable:i,timeoutTimestamp:-1,invalidationPreset:a,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,i){return L.isString(i)||(i=""),this.reportingPrintBlocksQueue.push({requestType:"SET_INVALIDATION",printItemIdentifierMapID:void 0,printItemIdentifierReference:s,lines:[],blockHeader:"",redactable:!0,timeoutTimestamp:-1,invalidationPreset:e,invalidationPresetComment:i}),!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",O.RestMethodsREPORTING.setPathAndFilenameForNextReport,{
path:t+T.getCompliantFilename(e)})}report_printQueue(e,t){return(L.isString(e)||L.isString(t))&&this.report_setupDestinationDirectory(e,t),this.perform_InternalWebserviceRequest("reporting",O.RestMethodsREPORTING.printPrintQueueWithElectronicSignature,{}).isSuccess()}report_handleQueuedPrintBlocks(e){if(L.isObject(e)&&L.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=g.cloneJSON(this.reportingPrintBlocksQueue[0]);this.reportingQueueActive=!0;let s=new m.CubisRestResponse(!1),i=!1;return"ADD_PRINT_BLOCK"===e.requestType?i=(s=this.reportingProxy.printParameters(e.lines,e.blockHeader,e.redactable)).isSuccess()&&s.rawReturns.printItemIdentifier>=0:"SET_INVALIDATION"===e.requestType&&(i=(s=this.report_setPrintBlockInvalidation(!0,e.printItemIdentifierReference,e.invalidationPresetComment)).isSuccess()),!1===i?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?(L.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 i=-1;return L.isString(t)&&this.reportingPrintItemIdentifierMap.hasOwnProperty(t)?i=this.reportingPrintItemIdentifierMap[t]:L.isNumber(t)&&(i=t),!L.isNumber(i)||i<0?(console.log("wfRunner: call for setRedactionStatus failed due to missing printItemIdentifier"),new m.CubisRestResponse(!1)):(L.isString(s)||(s=""),this.reportingProxy.setRedactionStatus(i,e,s))}report_handleReportingMessages(e){if(L.isObject(e)&&L.isString(e.payload.topic)&&e.payload.topic===P.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,i=0;for(let e=0;e<t;e++)for(this.heartbeat({message:"busy sleep for a second",value:this.heartbeatCount++}),i=Date.now()+1e3;Date.now()<i;);for(this.heartbeat({message:"busy sleep rest ms",
value:this.heartbeatCount++}),i=Date.now()+s;Date.now()<i;);}preventAutoLogout(e){switch(e){case"justOnce":this.mqttHandler.publish(P.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 T.perform_InternalWebserviceRequest(e,t,s)}perform_WebserviceRequest(e,t,s,a,n,r,o,E,_,l,u){return i.__awaiter(this,void 0,void 0,function*(){return T.perform_WebserviceRequest(e,t,s,a,n,r,o,E,_,l,u)})}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 i=s(56),a=s(96),n=s(51),r=s(97),o=s(48),E=s(12),_=s(86),l=s(17),u=s(26),c=s(2),A=s(1),T=s(0),p=s(10),I="STATE_RECONFIG_DONE",d="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(a.STATE_ASPECT_RESUME_ADV_REINIT_EXIT))},_onExit:function(e){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,t){t.payload===a.STATE_ASPECT_RESUME_ADV_REINIT_EXIT&&(e.reinitialize(),this.transition(e,e.skipConfigParamAspect?I:i.STATE_ASPECT_CFG_PARAM_EDIT_ENTER))}},STATE_RECONFIG_DONE:{_onEnter:function(e){e.addToEventQueue(new E.ImmediateEvent(I))},_onExit:function(e){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,t){t.payload===I&&(e.confIdentifierAspect(!0),this.transition(e,e.skipLotInput?d:_.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,a.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 i.ConfigParamsAspect,this.registerAspect(this.cfgParamAspect),this.resAdvAspect=new a.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[i.CFG_PARAMS_ASPECT].configure({isValidFn:()=>this.cfgParamAspectIsValidFn(),updateTaskParameterFn:e=>this.cfgParamAspectUpdateTaskParameterFn(e),handleParamUpdateUserActionFn:(e,t)=>this.cfgParamAspectHandleParamUpdateUserActionFn(e,t),returnState:I,taskHandler:this.workflowTaskHandler})}confResumeAdvAspect(){console.log("QAppAdvBase::confResumeAdvAspect"),this.aspects[a.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?d: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===T.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:c.cloneJSON(this.taskHandler.getTask()),workflowTaskHandlerData:t},
this.workflowTaskHandler.setTask(this.workstate.workflowTaskHandlerData)):this.exitError("QAppAdvBase::prepReinitializedWorkstate: No task parameters in taskHandler - unexpected.")}provideStartFsmState(){return a.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,i){let a=!1;try{a=i.payload.event===u.MQTT_ADMIN_EVENT_PACKET_SENT&&i.payload.packet.topic===A.MqttTopics.HMI_LOADING_MODAL_TEXT&&JSON.parse(i.payload.packet.payload.toString()).args[1]===E.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE}catch(e){}a&&(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,i)}}}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 i=this.addSample2PQ_withIds(e.identifiers,this.provideSamplePQParams(e),t,s);return this.updateInvalidationAspectSampleConfig({sample:e}),i}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(0),a=s(12),n=s(31),r=s(11),o=s(7);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",u="BTN_REINIT",c="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 a.ImmediateEvent(E)):e.aspects[t.RESUME_ADV_ASPECT].cfg.isReinitConditionDetectedFn()?e.addToEventQueue(new a.ImmediateEvent(t.STATE_ASPECT_RESUME_ADV_REINIT_EXIT)):e.aspects[t.RESUME_ADV_ASPECT].cfg.isContinueConditionDetectedFn()?e.addToEventQueue(new a.ImmediateEvent(t.STATE_ASPECT_RESUME_ADV_CONT_EXIT)):e.addToEventQueue(new a.ImmediateEvent(_)):e.addToEventQueue(new a.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:i.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:u,label:{id:"_QAPP_LIB_MSG_BOX_QUESTION_RESUME_CONTINUE_BTN_REINIT",args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY},{id:c,label:{id:"_QAPP_LIB_MSG_BOX_QUESTION_RESUME_CONTINUE_BTN_CONTINUE",
args:[]},appearance:i.EnumAppearance.ENABLED_PRIMARY}]})},_onExit:function(e){e.hideMsgBox()},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(e,s){s.payload.buttonId===u?this.transition(e,t.STATE_ASPECT_RESUME_ADV_REINIT_EXIT):s.payload.buttonId===c&&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 i=s(21),a=s(86),n=s(14),r=s(52),o=s(3),E=s(32),_=s(22),l=s(12),u=s(98),c=s(99),A=s(41),T=s(23),p=s(2),I=s(1),d=s(0);t.QAppWorkflowBase=class extends i.QAppBase{constructor(e){super(e),this.takeoverBtnPending=!1,this.lastDisplayValDomain=A.ISelectedWeightDisplayValueDomains.SELECTED_DOMAIN_UNDEFINED,this.doRememberLastDisplayValDomain=!1,
this.identifierAspect=new a.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(I.MqttTopics.HMI_PRINT_HEADER),this.lastDisplayValDomain=A.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===I.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 T.HmiButtonClickedEvent&&void 0!==this.buttons.takeoverBtn&&e.payload.buttonId===this.buttons.takeoverBtn.getButtonId()&&(this.buttons.takeoverBtn.getAppearance()!==d.EnumAppearance.ENABLED&&this.buttons.takeoverBtn.getAppearance()!==d.EnumAppearance.ENABLED_SECONDARY&&this.buttons.takeoverBtn.getAppearance()!==d.EnumAppearance.ENABLED_PRIMARY||this.lastRequestedTakeoverBtnAppearance!==d.EnumAppearance.ENABLED&&this.lastRequestedTakeoverBtnAppearance!==d.EnumAppearance.ENABLED_SECONDARY&&this.lastRequestedTakeoverBtnAppearance!==d.EnumAppearance.ENABLED_PRIMARY)||super.handleEvent(e)}}notifyTakeOver(e=!1){this.buttons.takeoverBtn&&(this.takeoverBtnPending=!0,this.lastRequestedTakeoverBtnAppearance!==d.EnumAppearance.HIDDEN&&this.buttons.takeoverBtn.setAppearance(d.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===A.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===A.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,i)=>{a.IdentifierAspect.getLotState(i,this.taskHandler)!==E.EnumLotIdentifierOptions.OFF&&""!==e&&(s[i].value.string=e,s[i].appearance=d.EnumAppearance.ENABLED,t.push(s[i]))}),this.addInitParams2PQ(t)}addSample2PQ_withIds(e,t,s,i){console.log("QAppWorkflowBase::addSample2PQ_withIds")
;let a=[],o=n.remove(t,e=>e.id===c.PARAM_ID_SAMPLE_NO);a.push(...o),a.push(...this.prepSampleIdParams4PQ(e)),o=n.remove(t,e=>e.id===c.PARAM_ID_SAMPLE_DATE),a.push(...o),a.push(...t);let E=this.reportingProxy.printParameters(a,s?r.REPORTING_CATEGORY_COMPONENTS:r.REPORTING_CATEGORY_NONE,i);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,i)=>{a.IdentifierAspect.getSIDState(i,this.taskHandler)!==E.EnumSampleIdentifierOptions.OFF&&""!==e&&(s[i].value.string=e,s[i].appearance=d.EnumAppearance.ENABLED,t.push(s[i]))}),t}addStatistic2PQ(e,t){if(console.log("QAppWorkflowBase::addStatistic2PQ"),t&&t.getValues().currCalcValues.numSamples>0){let s=[],i=t.getValues().currStatPublishableParameters;if(e){
let t=o.createEmptyTextParameter();t.value.text.id=e,t.info.suppressTitle=!0,s.push(t)}if(i.n.getValue().appearance!==d.EnumAppearance.HIDDEN&&s.push(i.n.getValue()),i.avg.getValue().appearance!==d.EnumAppearance.HIDDEN&&s.push(i.avg.getValue()),i.dev.getValue().appearance!==d.EnumAppearance.HIDDEN&&s.push(i.dev.getValue()),i.variation.getValue().appearance!==d.EnumAppearance.HIDDEN&&s.push(i.variation.getValue()),i.sum.getValue().appearance!==d.EnumAppearance.HIDDEN&&s.push(i.sum.getValue()),i.min.getValue().appearance!==d.EnumAppearance.HIDDEN&&s.push(i.min.getValue()),i.max.getValue().appearance!==d.EnumAppearance.HIDDEN&&s.push(i.max.getValue()),i.diff.getValue().appearance!==d.EnumAppearance.HIDDEN&&s.push(i.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(d.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===u.INVAL_SAMPLE_ASPECT)return void this.aspects[t].updateCfgSampleOnly(e)}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(0),a=s(12),n=s(31),r=s(11),o=s(83),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 u 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:i.EnumAppearance.ENABLED_SECONDARY},{id:l,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}]}):e.addToEventQueue(new a.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 i=e.aspects[t.INVAL_SAMPLE_ASPECT];s.payload.buttonId===l?this.transition(e,i.cfg.exitState):s.payload.buttonId===_&&(void 0!==i.cfg.sample&&(i.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 i=e.aspects[t.INVAL_SAMPLE_ASPECT];if(s.payload.parameter.id===t.PARAM_ID_RT_INVAL_REASON_INP){let t=i.cfg.sample;void 0!==t&&(t.invalidationReason=s.payload.parameter.value.string,void 0===i.cfg.samplePrintItemId||isNaN(i.cfg.samplePrintItemId)||e.reportingProxy.setRedactionStatus(i.cfg.samplePrintItemId,!0,t.invalidationReason),void 0!==i.cfg.dependentPrintItemIds&&i.cfg.dependentPrintItemIds.forEach(s=>{
e.reportingProxy.setRedactionStatus(s,!0,t.invalidationReason)})),this.transition(e,i.cfg.exitState)}}}},this.sP_4_InvalReason=u.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=u},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(2),a=s(0)
;t.PARAM_ID_SAMPLE_NO="QAPP_LIB_SAMPLE_NO";const n={id:t.PARAM_ID_SAMPLE_NO,type:a.EnumParameterTypes.PARAM_STRING,value:{string:""},header:{id:"_QAPP_LIB_PARAM_HEADER_SAMPLE_NO",args:[]},title:{id:"_QAPP_LIB_PARAM_TITLE_SAMPLE_NO",args:[]},appearance:a.EnumAppearance.HIDDEN,info:{minimum:{length:0},maximum:{length:0}}};function r(){return i.cloneJSON(n)}t.getSampleNumberStringParameter=r,t.createSampleNumberStringParameter=function(e){let t=i.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:a.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:a.EnumAppearance.HIDDEN,info:{isTime:!0,isDate:!0}};function E(){return i.cloneJSON(o)}t.getSampleDateDTParameter=E,t.createSampleDateDTParameter=function(e){let t=i.cloneJSON(E());return t.id=e,t}},function(e,t,s){"use strict"
;Object.defineProperty(t,"__esModule",{value:!0});const i=s(8),a=s(84),n=s(0),r=s(6),o=s(9),E=s(1);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 a.TabApi{constructor(e){super(e,t.TAB_SCREEN_ID),this.events$=new o.Subject,this.backButton=new i.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 i=s(46);t.TabFigure=class extends i.TabBase{constructor(e,t,s,i=!1){super(t,s,i),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 i=s(46),a=s(14);t.TabGraph=class extends i.TabBase{constructor(e,t,s,i=!1){super(t,s,i),this.setTabData(e)}setData(e,t=!0){a.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 i=s(46),a=s(45);t.TabParamList=class extends i.TabBase{constructor(e,t,s,i=!1){super(t,s,i),this.setTabData(e)}setTabParams(e){if(this.tabData)if(!a.isITabParamList(this.tabData)||"string"!=typeof e[0]&&0!==e.length){
if(!a.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(a.isITabParamList(this.tabData))return this.tabData.params;if(a.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 i=s(46),a=s(45),n=s(8);t.TabMenu=class extends i.TabBase{
constructor(e,t,s,i=!1){super(t,s,i),this.setTabData(e)}setTabMenuButtons(e,t=!0){if(this.tabData&&e.length>0)if(console.log("isMenu:"+a.isITabMenu(this.tabData)),console.log("isMenuBulk:"+a.isITabBulkMenu(this.tabData)),console.log("buttons:"+JSON.stringify(e)),a.isITabMenu(this.tabData)&&"string"==typeof e[0])this.tabData.menubuttons.join()!==e.join()&&(this.tabData.menubuttons=e,t&&this.publishIfEnabled());else{if(!a.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(a.isITabMenu(this.tabData))return this.tabData.menubuttons;if(a.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 i=s(46),a=s(45);t.TabTable=class extends i.TabBase{constructor(e,t,s,i=!1){super(t,s,i),this.setTabData(e)}setTabMenuButtons(e,t=!0){if(this.tabData&&e.length>0)if(console.log("isTable:"+a.isITabTable(this.tabData)),console.log("isMTableBulk:"+a.isITabBulkTable(this.tabData)),console.log("buttons:"+JSON.stringify(e)),a.isITabTable(this.tabData)&&"string"==typeof e[0])this.tabData.menubuttons.join()!==e.join()&&(this.tabData.menubuttons=e,t&&this.publishIfEnabled());else{if(!a.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(a.isITabTable(this.tabData))return this.tabData.menubuttons;if(a.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 i=s(4),a=s(5);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 i.BaseProxy{constructor(){super(...arguments),this.restEndpoint="clockHandler"}getFormatConfiguration(){return this.body.method=a.RestMethodsCLOCK_HANDLER.getFormatConfiguration,this.body.params={configuration:""},new i.CubisRestResponse(this.syncRequest())}getFormatConfigurationI18n(){return this.body.method=a.RestMethodsCLOCK_HANDLER.getFormatConfigurationI18n,this.body.params={
configuration:""},new i.CubisRestResponse(this.syncRequest())}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(8),a=s(0),n=s(84),r=s(33),o=s(1);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 i.Button(this.mqttHandler,this,s),this.publishTopLeftButton()}getTab(){return this.tab}setFigureTab(e,s){let i=n.TabApi.createFigureTab(this.mqttHandler,t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,e,!0,s);return this.tab=i,i}setGraphTab(e,s){let i=n.TabApi.createGraphTab(this.mqttHandler,t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,e,!0,s);return this.tab=i,i}setParamListTab(e,s){let i=n.TabApi.createParamListTab(this.mqttHandler,t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,e,!0,s);return this.tab=i,i}setMenuTab(e,s){
let i=n.TabApi.createMenuTab(this.mqttHandler,t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,e,!0,s);return this.tab=i,i}setTableTab(e,s){let i=n.TabApi.createTableTab(this.mqttHandler,t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,e,!0,s);return this.tab=i,i}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 i.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(a.EnumAppearance.HIDDEN,e)}showTopLeftButton(e=!0){this.topLeftButton.setAppearance(a.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 i=s(44),a=s(84),n=s(1),r=s(6),o=s(8),E=s(28),_=s(53),l=s(0);t.WEIGHING_SPLIT_SCREEN_ID="WEIGHINGSPLIT";const u={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,u),this.tabApi=new a.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===i.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 i=s(4),a=s(3),n=s(49),r=s(3),o=s(0),E=s(14),_=s(85),l=s(5);var u;!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__"}(u=t.EnumAuditTrailModule||(t.EnumAuditTrailModule={}));const c="QAPP_AUDITTRAIL_ENTRY_TASK_NAME";t.AuditTrailProxy=class extends i.BaseProxy{constructor(){super(...arguments),this.restEndpoint="audit"}addEventWithParameters(e,t,s,i=""){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 a.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 A=_.getTexts(l),T=0;for(let e of s)e.title.id=A[T++],e.title.args=[],e.header.id=A[T++],e.header.args=[],a.isTypeOfITextParameter(e)&&(e.value.text.id=A[T++],e.value.text.args=[]);if("object"==typeof t){let e=r.createEmptyTextParameter();e.appearance=o.EnumAppearance.ENABLED,e.id=c,e.title.id=A[T++],e.header.id=A[T++],e.value.text.id=t.getTaskName()||"---",s=[e,...s],t=u.QAPP}else if(t===u.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,i)}addEvent(e,t,s,i=!1,a=""){let n
;return i?(n=r.createEmptyStringParameter()).value.string=s:((n=r.createEmptyTextParameter()).value.text.id=s,n.info.suppressTitle=!0),n.id=c,n.appearance=o.EnumAppearance.ENABLED,n.title.id="AUDITTRAIL_TITLE_NONE",n.header.id="AUDITTRAIL_HEADER_NONE",this.addEventWithParameters(e,t,[n],a)}addEventInternal(e,t,s,a=""){let n;this.body.method=l.RestMethodsAUDITTRAIL.addEventExt,this.body.params={auditTrailEvent:e,moduleName:t,operation:s,destination:a};try{return(n=new i.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 i=e.value.selection.id,a=e.info.options.find(e=>e.id===i),n=void 0!==a?t.getText(a.text.id,a.text.args):"---";s.value.text.id=n;break}case o.EnumParameterTypes.PARAM_MULTIPLE_SELECTION:{const i=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}),a=t.getTexts(i);s.value.text.id=a.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:i,isTime:a}=e.info,n=_.getDateTimeConfiguration(),r=_.convertToDateTimeFormat(t,n);s.value.text.id=i&&!a?`${r.date}`:!i&&a?`${r.time}`:i&&a?`${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 i.CubisRestResponse(this.syncRequest())).isSuccess()){let e=t.rawReturns.document;return JSON.parse(e).data}return console.log("AuditTrailProxy::getRecords: error returned: "+t.rawReturns),[]}}}]);