/* COPYRIGHT by SARTORIUS (Sartorius Lab Instruments GmbH & Co. KG) */
!function(e){var t={};function s(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,s),i.l=!0,i.exports}s.m=e,s.c=t,s.d=function(e,t,a){s.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:a})},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=95)}([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){e.OFF="profileOff",e.SBI="REPORTING_SBI_PROFILE_NAME",e.YDP30="REPORTING_YDP30_PROFILE_NAME",e.PCDIRECT="REPORTING_HID_PROFILE_NAME",e.PDF="REPORTING_PDF_PROFILE_NAME",e.CSV="REPORTING_CSV_PROFILE_NAME",e.WEBSERVICE="REPORTING_LABOS_PROFILE_NAME",e.TEXTFILE="REPORTING_TEXT_FILE_PROFILE_NAME",e.DATAFILE="REPORTING_DATA_FILE_PROFILE_NAME"}(t.EnumReportingProfileType||(t.EnumReportingProfileType={}))},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.DEVICE_SERIAL_NUMBER="/DEVICEINFORMATION/IDENTIFICATION/SERIAL_NO_BALANCE",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="/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_BASE_EVENT="HMI/EVENT",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 a=s(2),i=s(13),n=s(0);t.isTypeOfIDateTimeParameter=function(e){
return e.type===n.EnumParameterTypes.PARAM_DATE_TIME},t.isTypeOfIMultipleSelectionParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_MULTIPLE_SELECTION},t.isTypeOfISelectionParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_SELECTION},t.isTypeOfIQuantityParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_QUANTITY},t.isTypeOfIMeasureParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_MEASURE},t.isTypeOfIStringParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_STRING},t.isTypeOfIAlibiIdentifierParameter=function(e){return e.type===n.EnumParameterTypes.ALIBI_IDENTIFIER},t.isTypeOfITextParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_TEXT},t.isTypeOfIFormulaParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_FORMULA},t.isTypeOfIPasswordParameter=function(e){return e.type===n.EnumParameterTypes.PARAM_PASSWORD},t.isITextStructure=function(e){
return"string"==typeof e.id&&"object"==typeof e.args&&e.args instanceof Array};const r={id:"",args:[]};function o(e){const t=a.cloneJSON(r);return i.isString(e)&&(t.id=e),t}t.createEmptyTextStructure=o;const E={id:"",type:n.EnumParameterTypes.PARAM_GROUP,title:o(),appearance:n.EnumAppearance.HIDDEN,parameters:[]};function _(e){const t=a.cloneJSON(E);return i.isString(e)&&(t.id=e),t}t.createEmptyParameterGroup=_;const l={id:"",type:n.EnumParameterTypes.PARAM_GROUP,title:o(),appearance:n.EnumAppearance.HIDDEN,parameters:[_()]};t.createEmptyParameterGroupOfGroups=function(){return a.cloneJSON(l)};const c={appearance:n.EnumAppearance.HIDDEN,id:"",text:o()};t.createEmptySelectionParameterOption=function(){return a.cloneJSON(c)};const A={id:"",type:n.EnumParameterTypes.PARAM_SELECTION,value:{selection:{id:""}},header:o(),title:o(),info:{options:[c]},appearance:n.EnumAppearance.HIDDEN};t.createEmptySelectionParameter=function(e){const t=a.cloneJSON(A);return i.isString(e)&&(t.id=e),t}
;const u={id:"",type:n.EnumParameterTypes.PARAM_MULTIPLE_SELECTION,value:{selections:[]},header:o(),title:o(),info:{options:[c]},appearance:n.EnumAppearance.HIDDEN};t.createEmptyMultipleSelectionParameter=function(e){const t=a.cloneJSON(u);return i.isString(e)&&(t.id=e),t},t.setValueOfSelectionParameter=function(e,t){if(e.type!==n.EnumParameterTypes.PARAM_SELECTION)return!1;if(i.isString(t)){const s=i.getObjectByID(e.info.options,t);if(i.isObject(s)&&i.isString(s.id)&&s.id===t)return e.value.selection=a.cloneJSON(s),!0}else if(e.info.options.length>0)return e.value.selection=a.cloneJSON(e.info.options[0]),!0;return!1},t.setValueOfMulitpleSelectionParameter=function(e,t){if(e.type!==n.EnumParameterTypes.PARAM_MULTIPLE_SELECTION)return!1;if(i.isObject(t)&&Array.isArray(t)){e.value.selections=[];for(let s=0;s<t.length;s++){const n=i.getObjectByID(e.info.options,t[s]);i.isObject(n)&&i.isString(n.id)&&n.id===t[s]&&e.value.selections.push(a.cloneJSON(n))}return!0}
return e.info.options.length>0&&(e.value.selections=a.cloneJSON(e.info.options),!0)},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=a.cloneJSON(T);return i.isString(e)&&(t.id=e),t};const d={id:"",type:n.EnumParameterTypes.PARAM_STRING,value:{string:""},header:o(),title:o(),info:{minimum:{length:0},maximum:{length:0}},appearance:n.EnumAppearance.HIDDEN};t.createEmptyStringParameter=function(e){const t=a.cloneJSON(d);return i.isString(e)&&(t.id=e),t};const S={id:"",type:n.EnumParameterTypes.PARAM_BARCODE,value:{string:"",format:n.EnumBarcodeFormats.CODE128,width:120},header:o(),title:o(),appearance:n.EnumAppearance.HIDDEN};t.createEmptyBarcodeParameter=function(e){
const t=a.cloneJSON(S);return i.isString(e)&&(t.id=e),t};const I={id:"",type:n.EnumParameterTypes.PARAM_PASSWORD,value:{string:""},header:o(),title:o(),info:{passwordLength:0,minimum:{length:0},maximum:{length:0}},appearance:n.EnumAppearance.HIDDEN};t.createEmptyPasswordParameter=function(e){const t=a.cloneJSON(I);return i.isString(e)&&(t.id=e),t};const p={id:"",type:n.EnumParameterTypes.PARAM_TEXT,value:{text:o()},header:o(),title:o(),appearance:n.EnumAppearance.HIDDEN,info:{suppressTitle:!1}};t.createEmptyTextParameter=function(e){const t=a.cloneJSON(p);return i.isString(e)&&(t.id=e),t},t.createEmptyTextParameterValueOnly=function(){let e=a.cloneJSON(p);return e.info.suppressTitle=!0,e};const N={visual:"",eval:""};t.createEmptyFormulaParameterValue=function(){return a.cloneJSON(N)};const h={id:"",type:n.EnumParameterTypes.PARAM_FORMULA,value:[],header:o(),title:o(),appearance:n.EnumAppearance.HIDDEN,info:{maximum:{length:0}}};t.createEmptyFormulaParameter=function(e){
const t=a.cloneJSON(h);return i.isString(e)&&(t.id=e),t};const R={mark:"",sign:"",number:"0",decimals:0,auxiliaryDigits:0,unit:"",interval:1,isStable:!1,isSpecial:!1,isWarning:!1,isInvalid:!0};t.createEmptyMeasureParameterValue=function(){return a.cloneJSON(R)};const m={id:"",type:n.EnumParameterTypes.PARAM_MEASURE,value:R,header:o(),title:o(),appearance:n.EnumAppearance.HIDDEN};t.createEmptyMeasureParameter=function(e){const t=a.cloneJSON(m);return i.isString(e)&&(t.id=e),t};const O={decimals:0,preferredDecimals:0,numbers:[],unit:""};t.createEmptyQuantityParameterValue=function(){return a.cloneJSON(O)},t.QUANTITY_PARAM_MIN_MAX_NAN="nan",t.QUANTITY_PARAM_NUMBERS_MAX=3;const g={id:"",type:n.EnumParameterTypes.PARAM_QUANTITY,value:O,header:o(),title:o(),info:{minimum:{value:t.QUANTITY_PARAM_MIN_MAX_NAN},maximum:{value:t.QUANTITY_PARAM_MIN_MAX_NAN}},appearance:n.EnumAppearance.HIDDEN};t.createEmptyQuantityParameter=function(e){const t=a.cloneJSON(g);return i.isString(e)&&(t.id=e),t}
;const P={id:"",type:n.EnumParameterTypes.ALIBI_IDENTIFIER,value:{alibiIdentifier:NaN},header:o(),title:o(),appearance:n.EnumAppearance.ENABLED};t.createEmptyAlibiIdentifier=function(){return a.cloneJSON(P)}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(40),i="SUCCESS",n="FAILED";t.CubisRestResponse=class{constructor(e){if(this.restResponse=void 0,"boolean"==typeof e)this.result=e?i:n,this.rawReturns={};else{let t;this.restResponse=e;try{t=JSON.parse(this.restResponse.stdout.toString())}catch(e){throw e.message+="\nreceived: "+this.restResponse.stdout.toString(),e}this.rawReturns=t.returns,this.result=t.result}}isSuccess(){return this.result===i}};t.BaseProxy=class{constructor(){this.body={method:"",params:{}}}syncRequest(){let e,t=JSON.stringify(this.body),s=`http://127.0.0.1:8080/rest/${this.restEndpoint}`;const i=process.hrtime();let n=[s,"-H","Accept:application/json","-H","Content-Type:application/json","-H","Expect:","--data","@-"]
;e=a.spawnSync("curl",n,{input:t});const r=process.hrtime(i);return console.log(`${this.body.method} (hr): ${r[0]}s ${r[1]/1e6}ms`),e}}},function(e,t,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.getTaskNames="getTaskNames",e.getTaskNamesByOrderNumber="getTaskNamesByOrderNumber",e.setTaskEvent="setTaskEvent"}(t.RestMethodsTASK_MANAGEMENT||(t.RestMethodsTASK_MANAGEMENT={})),function(e){e.getCurrentUser="getCurrentUser",e.checkRightsOfCurrentUser="checkRightsOfCurrentUser"}(t.RestMethodsACCESS_MANAGEMENT||(t.RestMethodsACCESS_MANAGEMENT={})),function(e){e.addEventExt="addEventExt",
e.getRecords="getRecords"}(t.RestMethodsAUDITTRAIL||(t.RestMethodsAUDITTRAIL={})),function(e){e.startInternCal="startInternCal",e.disableAutoIsoCal="disableAutoIsoCal"}(t.RestMethodsCALIBRATION||(t.RestMethodsCALIBRATION={})),function(e){e.getFormatConfiguration="getFormatConfiguration",e.getFormatConfigurationI18n="getFormatConfigurationI18n"}(t.RestMethodsCLOCK_HANDLER||(t.RestMethodsCLOCK_HANDLER={})),function(e){e.getConfigurations="getConfigurations",e.putFileAsync="putFileAsync",e.putFileAsyncWithoutMD5="putFileAsyncWithoutMD5",e.getFileAsyncWithoutMD5="getFileAsyncWithoutMD5",e.listDirectory="listDirectory"}(t.RestMethodsCONNECTOR_MANAGEMENT||(t.RestMethodsCONNECTOR_MANAGEMENT={})),function(e){e.getSerialNoBalance="getSerialNoBalance",e.getModelName="getModelName",e.getVersionBalance="getVersionBalance",e.getVersionPackage="getVersionPackage",e.getParameter="getParameter",e.sendUDPBroadcast="sendUDPBroadcast",e.cancelUDP="cancelUDP",e.listenUDP="listenUDP",
e.addRunningActivity="addRunningActivity",e.removeRunningActivity="removeRunningActivity",e.setActuatorsActive="setActuatorsActive",e.setDeviceCleaned="setDeviceCleaned"}(t.RestMethodsDEVICE_INFORMATION||(t.RestMethodsDEVICE_INFORMATION={})),function(e){e.getQappProtocolPortNumber="getQappProtocolPortNumber",e.getQappProtocolInterfaces="getQappProtocolInterfaces",e.isInterfaceActive="isInterfaceActive",e.setGPIOPorts="setGPIOPorts"}(t.RestMethodsINTERFACE_MANAGEMENT||(t.RestMethodsINTERFACE_MANAGEMENT={})),function(e){e.getLanguage="getLanguage",e.getText="getText",e.getTexts="getTexts"}(t.RestMethodsLOCALIZER||(t.RestMethodsLOCALIZER={})),function(e){e.addMessage="addMessage",e.deleteMessageByCategory="deleteMessageByCategory",e.getAllMessagesByCategory="getAllMessagesByCategory",e.deleteMessagesByCategory="deleteMessagesByCategory",e.removeMessage="removeMessage"}(t.RestMethodsMESSAGE_HANDLER||(t.RestMethodsMESSAGE_HANDLER={})),function(e){e.loadProfile="loadProfile",
e.getProfiles="getProfiles"}(t.RestMethodsPROFILE_MANAGEMENT||(t.RestMethodsPROFILE_MANAGEMENT={})),function(e){e.playEndOfActionSound="playEndOfActionSound",e.playMessageSound="playMessageSound"}(t.RestMethodsSOUND_MANAGEMENT||(t.RestMethodsSOUND_MANAGEMENT={})),function(e){e.isAutoLogout="isAutoLogout",e.getListRoles="getListRoles"}(t.RestMethodsUSER_MANAGEMENT||(t.RestMethodsUSER_MANAGEMENT={})),function(e){e.createWeightApplication="createWeightApplication",e.enableWeightApplication="enableWeightApplication",e.selectWeightApplication="selectWeightApplication",e.destroyWeightApplication="destroyWeightApplication",e.setButton="setButton",e.triggerStableWeightBlock="triggerStableWeightBlock",e.cancelStableWeightBlock="cancelStableWeightBlock",e.doZero="doZero",e.clearTare="clearTare",e.clearTare1="clearTare1",e.clearTare2="clearTare2",e.clearTareAll="clearTareAll",e.doTare="doTare",e.doTare1="doTare1",e.doTare2="doTare2",e.doTareAuto="doTareAuto",e.doZeroTare="doZeroTare",
e.doZeroTareAuto="doZeroTareAuto",e.setTare1="setTare1",e.cancelDoing="cancelDoing",e.setTare2="setTare2",e.setUnit="setUnit",e.getParameter="getParameter",e.getParameterIds="getParameterIds",e.getRangeParameters="getRangeParameters",e.setMinUsp="setMinUsp",e.setMinWeight="setMinWeight",e.insertWeightInvalidation="insertWeightInvalidation",e.removeWeightInvalidation="removeWeightInvalidation",e.setAmbientCondition="setAmbientCondition"}(t.RestMethodsWEIGHING||(t.RestMethodsWEIGHING={})),function(e){e.openLast="openLast",e.closeAll="closeAll",e.openLeft="openLeft",e.openRight="openRight",e.openTop="openTop"}(t.RestMethodsDRAFTSHIELD||(t.RestMethodsDRAFTSHIELD={})),function(e){e.setJobStatusAndReason="setJobStatusAndReason"}(t.RestMethodsJOB_MANAGEMENT||(t.RestMethodsJOB_MANAGEMENT={})),function(e){e.disableChecker="disableChecker",e.enableChecker="enableChecker"}(t.RestMethodsSELF_MONITOR||(t.RestMethodsSELF_MONITOR={})),function(e){e.start="start"
}(t.RestMethodsLEVELING||(t.RestMethodsLEVELING={})),function(e){e.getConfigData="getConfigData"}(t.RestMethodsMENU_HANDLER||(t.RestMethodsMENU_HANDLER={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(11),i=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 a.Subject,
this.mqttHandler=e}show(){console.log("AbstractScreen: show "+this.getId()+" @ "+i.MqttTopics.HMI_ACTIVE_QAPP_SCREEN),this.mqttHandler.publish(i.MqttTopics.HMI_ACTIVE_QAPP_SCREEN,'{ "screen":"'+this.getId()+'" }'),this.events$.next({type:n.SHOW_SCREEN,id:this.getId()})}hide(){}publishContent(e,t,s=!0){let a=e?this.getMqttTopicBaseExtensible()+e:this.getMqttTopicBase();console.log("AbstractScreen: publishContent @ "+a),this.mqttHandler.publish(a,t,{retain:s})}getMqttTopicBase(){return"SCREENS/"+this.getId()}getMqttTopicBaseExtensible(){return this.getMqttTopicBase()+"/"}getButton(e){}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.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.NEXT10="_FONT_ICON_NEXT_10",e.NEXT="_FONT_ICON_NEXT",e.PREV="_FONT_ICON_PREV",e.PREV10="_FONT_ICON_PREV_10",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",e.HELP="_FONT_ICON_HELP",e.LIST="FONT_ICON_LIST",e.SAMPLE="_FONT_ICON_SAMPLE",
e.SUBSAMPLE="_FONT_ICON_SUBSAMPLE",e.SUBSAMPLE_DONE="_FONT_ICON_SUBSAMPLE_DONE",e.REQUEST="_FONT_ICON_REQUEST",e.REQUEST_DONE="_FONT_ICON_REQUEST_DONE",e.TASK_SUBSAMPLE="_FONT_ICON_TASK_SUBSAMPLE",e.EXCHANGE="_FONT_ICON_TASK_CONTROLLED",e.OMNIS="_FONT_ICON_OMNIS"}(t.EnumFontLabels||(t.EnumFontLabels={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(2);function n(e){return i.cloneJSON({module:"qappHandler",method:"buttonClickEvent",params:{buttonId:e||""}})}function r(e){let t={nameId:"",appearance:"HIDDEN",type:"",label:{id:"",args:[]},effect:n()};return void 0!==e.nameId&&(t.nameId=e.nameId),void 0!==e.labelCenter&&(t.labelCenter=e.labelCenter),void 0!==e.labelRight&&(t.labelRight=e.labelRight),void 0!==e.icon&&(t.icon=e.icon),void 0!==e.lastSelected&&(t.lastSelected=e.lastSelected),t.label=e.label,t.appearance=e.appearance,t.effect.params.buttonId=e.buttonId,e.longPressButtonId&&(t.longPressEffect=n(),
t.longPressEffect.params.buttonId=e.longPressButtonId),void 0!==e.labelAlign&&(t.labelAlign=e.labelAlign),void 0!==e.labelCenterAlign&&(t.labelCenterAlign=e.labelCenterAlign),void 0!==e.labelRightAlign&&(t.labelRightAlign=e.labelRightAlign),t}t.createButtonEmptyEffect=n,t.IButtonParameterInterface2IButtonJsonInterface=r,t.IButtonJsonInterface2IButtonParameterInterface=function(e){let t={buttonId:e.effect.params.buttonId,appearance:e.appearance,label:e.label};return e.nameId&&(t.nameId=e.nameId),e.labelCenter&&(t.labelCenter=e.labelCenter),e.labelRight&&(t.labelRight=e.labelRight),e.longPressEffect&&(t.longPressButtonId=e.longPressEffect.params.buttonId),void 0!==e.icon&&(t.icon=e.icon),void 0!==e.lastSelected&&(t.lastSelected=e.lastSelected),void 0!==e.labelAlign&&(t.labelAlign=e.labelAlign),void 0!==e.labelCenterAlign&&(t.labelCenterAlign=e.labelCenterAlign),void 0!==e.labelRightAlign&&(t.labelRightAlign=e.labelRightAlign),t};class o{constructor(e,t,s){this.lastPublishedTabContent="",
this.mqttHandler=e,this.buttonTopic="SCREENS/"+t.getId()+"/"+s.buttonId,this.buttonJson=r(s)}setButtonId(e,t=!0){this.buttonJson.effect.params.buttonId=e,t&&this.publish()}setLongPressButtonId(e,t=!0){e?(this.buttonJson.longPressEffect||(this.buttonJson.longPressEffect=n()),this.buttonJson.longPressEffect.params.buttonId=e):delete this.buttonJson.longPressEffect,t&&this.publish()}setJson(e){this.buttonJson=JSON.parse(e),this.publish()}setNameId(e,t=!0){this.buttonJson.nameId=e,t&&this.publish()}getNameId(){return this.buttonJson.nameId}setAppearance(e,t=!0){this.buttonJson.appearance=e,t&&this.publish()}setType(e,t=!0){this.buttonJson.type=e,t&&this.publish()}getType(){return this.buttonJson.type}getLabel(){return this.buttonJson.label}setLabel(e,t=!0){this.buttonJson.label=e,t&&this.publish()}getIcon(){return this.buttonJson.icon}setIcon(e,t=!0){void 0!==e&&e.length>0?this.buttonJson.icon=e:delete this.buttonJson.icon,t&&this.publish()}getLabelCenter(){
return this.buttonJson.labelCenter}setLabelCenter(e,t=!0){this.buttonJson.labelCenter=e,t&&this.publish()}getLabelRight(){return this.buttonJson.labelRight}setLabelRight(e,t=!0){this.buttonJson.labelRight=e,t&&this.publish()}getAppearance(){let e=a.EnumAppearance.HIDDEN;return this.buttonJson.appearance&&"string"==typeof this.buttonJson.appearance&&Object.keys(a.EnumAppearance).indexOf(this.buttonJson.appearance)?this.buttonJson.appearance:e}getJson(){return this.buttonJson}getTopic(){return this.buttonTopic}getButtonId(){return this.buttonJson.effect.params.buttonId}getLongPressButtonId(){return this.buttonJson.longPressEffect?this.buttonJson.longPressEffect.params.buttonId:null}publish(){let e=JSON.stringify(this.buttonJson);e!==this.lastPublishedTabContent&&(this.mqttHandler.publish(this.buttonTopic,e),this.lastPublishedTabContent=e)}show(){this.publish()}}t.Button=o,t.default=o},function(e,t,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){e.exports=require("util")},function(e,t){e.exports=require("rxjs/Subject")},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});const a=s(2);function i(e){return null!=e&&null!==e&&void 0!=e&&void 0!==e&&("number"==typeof e&&!isNaN(e))}function n(e){return null!=e&&null!==e&&void 0!=e&&void 0!==e&&"string"==typeof e}function r(e){return null!=e&&null!==e&&void 0!=e&&void 0!==e&&"object"==typeof e}function o(e,t,s){if(r(e)){n(s)||(s="id"),s=s;for(let a=0;a<e.length;a++)if(e[a].hasOwnProperty(s)&&n(e[a][s])&&e[a][s]===t)return a}}t.isNumber=i,t.isString=n,t.isObject=r,t.isBoolean=function(e){
return null!=e&&null!==e&&void 0!=e&&void 0!==e&&"boolean"==typeof e},t.getObjectByID=function(e,t,s){let a=o(e,t,s);if(i(a))return e[a]},t.getIndexByID=o,t.overwriteExistingAttributes=function(e,t){if(r(e)&&r(t)){let s=Object.keys(t);for(let i=0;i<s.length;i++)"function"!=typeof t[s[i]]&&e.hasOwnProperty(s[i])&&typeof t[s[i]]==typeof e[s[i]]&&(t[s[i]]=a.cloneJSON(e[s[i]]))}},t.setEnumSafely=function(e,t,s){const a=Object.keys(t);for(const s of a)if(t[s]===e)return t[s];return n(s)?s:a.length>0?t[a[0]]:void 0}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(3),i=s(32),n=s(10),r=s(26),o=s(0);t.digitsLimit=9,t.QUANTITY_PARAM_MAX_DIGITS_GENERAL=t.digitsLimit;class E{static setValue(e,s,a=0,i=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return E.setValueValueWithDecimals(e.value,s,e.value.preferredDecimals,a,i)}static setValueValue(e,s,a=0,i=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return E.setValueValueWithDecimals(e,s,e.preferredDecimals,a,i)}
static setValueWithDecimals(e,s,a,i=0,n=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return E.setValueValueWithDecimals(e.value,s,a,i,n)}static setValueValueWithDecimals(e,s,r,o=0,E=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL,_=!1){let l="number"==typeof s?s:s.value,c=E-Math.floor(Math.abs(l)).toString().length,A=Math.min(c,r);A=Math.max(A,0),0===o&&e&&(e.decimals=A);let u=i.SartoMath.roundExactToDecimals(l,A).toFixed(A);if(e){if(_||0!==o)"number"!=typeof s&&(n.isArray(e.unit)?e.unit[0]=s.unit:e.unit=s.unit);else{for(let t=a.QUANTITY_PARAM_NUMBERS_MAX-2;t>=o;t--)void 0!==e.numbers[t]&&(e.numbers[t+1]=e.numbers[t]);if("number"==typeof s){if(n.isArray(e.unit))for(let t=a.QUANTITY_PARAM_NUMBERS_MAX-2;t>=o;t--)void 0!==e.unit[t]&&(e.unit[t+1]=e.unit[t])}else if(n.isArray(e.unit)){for(let t=a.QUANTITY_PARAM_NUMBERS_MAX-2;t>=o;t--)void 0!==e.unit[t]&&(e.unit[t+1]=e.unit[t]);e.unit[0]=s.unit}else e.unit=s.unit}e.numbers[o]=u}return u}static roundToDecimalPlaces(e,s=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL){
return E.roundToDecimalPlacesValue(e.value,s)}static roundToDecimalPlacesAllNumbers(e,s=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return E.roundToDecimalPlacesValue(e.value,s,!0)}static roundToDecimalPlacesValue(e,s=t.QUANTITY_PARAM_MAX_DIGITS_GENERAL,a=!1){return e.numbers.forEach((t,i)=>{(0===i||a)&&-1!==e.preferredDecimals&&E.setValueValueWithDecimals(e,parseFloat(t),e.preferredDecimals,i,s,!0)}),e.numbers.map(e=>parseFloat(e))}static getValue(e,t=0){let s,a=(s=void 0!==e.value?e.value:e).numbers[t];return void 0!==a?parseFloat(a):Number.NaN}static getIntValue(e,t=0){let s,a=(s=void 0!==e.value?e.value:e).numbers[t];return void 0!==a?parseInt(a,10):Number.NaN}static changeUnit(e,s){let a;a=void 0!==e.value?e.value:e;const i=r.unitStringToLong(a.unit);a.numbers.forEach((e,n)=>{const o=r.convertWgtUnit(parseFloat(e),i,s);E.setValueValueWithDecimals(a,o,a.preferredDecimals,n,t.QUANTITY_PARAM_MAX_DIGITS_GENERAL,!0)}),a.unit=r.unitStringToShort(s)}}t.QuantityParameter=E
;t.WeightBlockHelper=class{static getMeasureParameter(e,t){for(const s of e.parameters)for(const e of s.parameters)if(e.id===t&&e.type===o.EnumParameterTypes.PARAM_MEASURE)return e}}},function(e,t){e.exports=require("lodash")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(2);t.AbstractQAppAspect=class{configure(e){this.cfg=Object.assign(void 0!==this.cfg?this.cfg:{},e)}getConfig(){return a.cloneJSON(this.cfg)}}},function(e,t){e.exports=require("fs")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(3),i=s(21),n=s(6),r=s(1);t.CANCEL_BUTTON_ID="BTN_CANCEL",t.CANCEL_BUTTON_NAME="_CANCEL";class o extends n.AbstractScreen{constructor(e){super(e),this.paramList=[],this.parameterCategoryList=[],this.isLastCategoryVisible=!1,this.mqttHandler=e}setShowLastVisibleCategory(e,t=!0){this.isLastCategoryVisible=e,t&&this.createAndPublishParamsAndPage()}readFromTaskhandler(e){let t=e.getTaskGroupsAndParameters()
;this.readFromParameterGroupArray(t)}readFromParameterGroupArray(e){this.paramList.splice(0,this.paramList.length),this.parameterCategoryList.splice(0,this.parameterCategoryList.length);for(let t of e){let e={},s={},n=a.createEmptyTextStructure();n=t.title,s.title=n,e.category=s,e.category.id=t.id,e.params=[];for(let s of t.parameters){let t=new i.default(this.mqttHandler,s);this.paramList.push(t),e.params.push(t.getPublishedId())}this.parameterCategoryList.push(e)}}createAndPublishParamsAndPage(){let e={params:{}};e.params=this.parameterCategoryList,e.showLastVisibleCategory=this.isLastCategoryVisible;const t=r.MqttTopics.QAPP_NAMESPACE+"/SCREENS/"+this.getId()+"/PARAMSANDPAGE";console.log("ParamListBase: publishContent @ "+t),this.mqttHandler.publish(t,JSON.stringify(e),{retain:!0})}updateParameter(e){for(let t of this.paramList)if(t.getId()===e.id)return void t.setValue(e)}}t.ParamListBase=o,t.default=o},function(e,t){e.exports=require("mathjs")},function(e,t,s){"use strict"
;Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=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:i.EnumFontLabels.RESULT,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createEvalButtonData=function(){return n.cloneJSON(o)},t.BTN_NEXT_ID="BTN_NEXT";const E={buttonId:t.BTN_NEXT_ID,label:{id:i.EnumFontLabels.NEXT,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createNextButtonData=function(){return n.cloneJSON(E)},t.BTN_PREV_ID="BTN_PREV";const _={buttonId:t.BTN_PREV_ID,label:{id:i.EnumFontLabels.PREV,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createPrevButtonData=function(){return n.cloneJSON(_)},t.BTN_BACK_ID="BTN_BACK",t.BTN_LONG_BACK_ID="BTN_LONG_BACK";const l={buttonId:t.BTN_BACK_ID,label:{id:i.EnumFontLabels.BACK,args:[]},
appearance:a.EnumAppearance.HIDDEN};t.createBackButtonData=function(e=!1){let s=n.cloneJSON(l);return e&&(s.longPressButtonId=t.BTN_LONG_BACK_ID),s},t.BTN_DOCU_ID="BTN_DOCU";const c={buttonId:t.BTN_DOCU_ID,label:{id:i.EnumFontLabels.DOCU,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createDocuButtonData=function(){return n.cloneJSON(c)},t.BTN_SEND_ID="BTN_SEND";const A={buttonId:t.BTN_SEND_ID,label:{id:i.EnumFontLabels.DOCU,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createSendButtonData=function(){return n.cloneJSON(A)},t.BTN_INVALIDATE_SAMPLE_ID="BTN_INVALIDATE_SAMPLE";const u={buttonId:t.BTN_INVALIDATE_SAMPLE_ID,label:{id:i.EnumFontLabels.INVALIDATE_SAMPLE,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createInvalidateSampleButtonData=function(){return n.cloneJSON(u)},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:a.EnumAppearance.HIDDEN};t.createPrintLabelButtonData=function(){
return n.cloneJSON(T)},t.BTN_START_ID="BTN_START";const d={buttonId:t.BTN_START_ID,label:{id:i.EnumFontLabels.START,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createStartButtonData=function(){return n.cloneJSON(d)},t.BTN_END_ID="BTN_END";const S={buttonId:t.BTN_END_ID,label:{id:i.EnumFontLabels.END,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createEndButtonData=function(){return n.cloneJSON(S)},t.BTN_PRINTADD_ID="BTN_PRINTADD";const I={buttonId:t.BTN_PRINTADD_ID,label:{id:i.EnumFontLabels.PRINT_ADD,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createPrintAddButtonData=function(){return n.cloneJSON(I)},t.BTN_CANCEL_ID="BTN_CANCEL";const p={buttonId:t.BTN_CANCEL_ID,label:{id:i.EnumFontLabels.CANCEL,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createCancelButtonData=function(){return n.cloneJSON(p)},t.BTN_SEARCH_ID="BTN_SEARCH";const N={buttonId:t.BTN_SEARCH_ID,label:{id:i.EnumFontLabels.SEARCH,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createSearchButtonData=function(){
return n.cloneJSON(N)},t.setNoSearchActive=function(e,t=!0){e.setLabel({id:i.EnumFontLabels.SEARCH,args:[]},t)},t.setSearchActive=function(e,t=!0){e.setLabel({id:i.EnumFontLabels.SEARCH_ACTIVE,args:[]},t)},t.BTN_FILTER_ID="BTN_FILTER";const h={buttonId:t.BTN_FILTER_ID,label:{id:i.EnumFontLabels.FILTER,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createFilterButtonData=function(){return n.cloneJSON(h)},t.setNoFilterActive=function(e,t=!0){e.setLabel({id:i.EnumFontLabels.FILTER,args:[]},t)},t.setFilterActive=function(e,t=!0){e.setLabel({id:i.EnumFontLabels.FILTER_ACTIVE,args:[]},t)},t.BTN_ADD_ID="BTN_ADD";const R={buttonId:t.BTN_ADD_ID,label:{id:i.EnumFontLabels.ADD,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createAddButtonData=function(){return n.cloneJSON(R)},t.BTN_DELETE_ID="BTN_DELETE";const m={buttonId:t.BTN_DELETE_ID,label:{id:i.EnumFontLabels.DELETE,args:[]},appearance:a.EnumAppearance.HIDDEN};t.createDeleteButtonData=function(){return n.cloneJSON(m)},
t.BTN_HOME_ID="BTN_HOME",t.HOME_BUTTON_ICON="./02_menu";const O={buttonId:t.BTN_HOME_ID,label:{id:i.EnumFontLabels.CANCEL,args:[]},icon:t.HOME_BUTTON_ICON,appearance:a.EnumAppearance.HIDDEN};t.createHomeButtonData=function(){return n.cloneJSON(O)},t.BTN_LOGOUT_ID="BTN_LOGOUT";const g={buttonId:t.BTN_LOGOUT_ID,label:{id:i.EnumFontLabels.LOGOUT,args:[]},appearance:a.EnumAppearance.ENABLED_SECONDARY};t.createLogoutButtonData=function(){return n.cloneJSON(g)},t.BTN_RELOAD_ID="BTN_RELOAD";const P={buttonId:t.BTN_RELOAD_ID,label:{id:i.EnumFontLabels.RELOAD,args:[]},appearance:a.EnumAppearance.ENABLED_SECONDARY};t.createReloadButtonData=function(){return n.cloneJSON(P)},t.BTN_OPEN_WEIGHING_ID="BTN_OPEN_WEIGHING";const M={buttonId:t.BTN_OPEN_WEIGHING_ID,label:{id:i.EnumFontLabels.WEIGHING,args:[]},appearance:a.EnumAppearance.ENABLED_SECONDARY};t.createOpenWeighingButtonData=function(){return n.cloneJSON(M)},t.BTN_OK_ID="BTN_OK";const L={buttonId:t.BTN_OK_ID,label:{id:i.EnumFontLabels.OK,
args:[]},appearance:a.EnumAppearance.ENABLED_SECONDARY};t.createOKButtonData=function(){return n.cloneJSON(L)}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(3),i=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,a.isTypeOfIPasswordParameter(this.parameter)){let e=i.cloneJSON(this.parameter);e.info.passwordLength=e.value.string.length,e.value.string="",this.mqttHandler.publish(this.publishedId,JSON.stringify(e))}else this.mqttHandler.publish(this.publishedId,JSON.stringify(this.parameter))}}t.Param=r,t.default=r},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(12),i=s(0),n=s(7);t.ParamUpdateUserActionSimpleAccept_OK_BUTTON_ID="BTN_OK",t.ParamUpdateUserActionSimpleAccept={type:a.EnumMessageboxType.ERROR,title:{
id:"_QAPP_LIB_MSG_BOX_WARNING_UPDATE_TASK_PARAM",args:[]},textList:[],buttons:[{appearance:i.EnumAppearance.ENABLED_SECONDARY,label:{id:n.EnumFontLabels.OK,args:[]},id:t.ParamUpdateUserActionSimpleAccept_OK_BUTTON_ID}]}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(19),i=s(26),n=s(13),r=s(2);var o,E;function _(e,s,i){let n=t.unitsMap[E.NONE],r=t.unitsMap[E.NONE];if(null==e)return a.bignumber(NaN);if(!t.unitsMap.hasOwnProperty(s))return e;if(!t.unitsMap.hasOwnProperty(i))return e;if(n=t.unitsMap[s],r=t.unitsMap[i],n.id===r.id)return e;if(n.unitConversionBase===o.UNDEFINED||r.unitConversionBase===o.UNDEFINED||void 0==n.conversionFactor||void 0==r.conversionFactor)return e;const _=[o.MASS,o.VOLUME];if(!(n.unitConversionBase===r.unitConversionBase||_.includes(n.unitConversionBase)&&_.includes(r.unitConversionBase)))return e;switch(n.unitConversionBase){case o.MASS:case o.VOLUME:case o.PRESSURE:
return e.times(r.conversionFactor).dividedBy(n.conversionFactor);case o.TEMPERATURE:{let t=e;switch(n.id){case E.GRAD_CELSIUS:t=e.add(273.15);break;case E.GRAD_FAHRENHEIT:t=e.sub(32).dividedBy(n.conversionFactor).add(273.15)}switch(r.id){case E.GRAD_CELSIUS:return t.sub(273.15);case E.GRAD_FAHRENHEIT:return t.sub(273.15).times(r.conversionFactor).add(32);case E.KELVIN:return t}return e}default:return e}}function l(e,t,s){let i=_(n.isNumber(e)?a.bignumber(e):e,t,s);return null==i?NaN:i.toNumber()}function c(e,t){return I(e,t).toFixed(Math.max(0,t))}function A(e,s){let a=r.cloneJSON(e);a.alibi=void 0,a.alibiId=void 0;let n=t.unitsMap[e.unit],E=t.unitsMap[s];if(n.id===E.id)return a;if(n.unitConversionBase===o.UNDEFINED||E.unitConversionBase===o.UNDEFINED)return a;const _=[o.MASS,o.VOLUME];return n.unitConversionBase===E.unitConversionBase||_.includes(n.unitConversionBase)&&_.includes(E.unitConversionBase)?(a.value=l(a.value,e.unit,s),a.unit=s,
a.decimals=a.decimals-i.getUnitShift(e.unit)+i.getUnitShift(s),a.decimals<0&&(a.decimals=0),delete a.alibiId,a):a}function u(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 d(e){let t=[];if(null==e||void 0===e)return t;if(0==e.length)return t;let s=E.NONE;for(let a=0;a<e.length;a++)n.isNumber(e[a])?t.push(e[a]):n.isObject(e[a])&&e[a].hasOwnProperty("value")&&n.isNumber(e[a].value)&&e[a].hasOwnProperty("unit")&&(s!==E.NONE?t.push(A(e[a],s).value):(t.push(e[a].value),s=e[a].unit));return t}function S(e){let t=0;if(null==e||void 0===e)return t;if(0==e.length)return t;for(let s=0;s<e.length;s++)"object"==typeof e[s]&&e[s].hasOwnProperty("decimals")&&(t=e[s].decimals>t?e[s].decimals:t);return t}function I(e,t){let s=a.bignumber(e),i=a.bignumber(10).pow(t);return s.times(i).round().dividedBy(i).toNumber()}function p(e){let t=d(e)
;return n.isObject(t)&&0!==t.length?a.sum(t):NaN}function N(e){let t=d(e);return n.isObject(e)&&0!==e.length?a.mean(t):NaN}function h(e,t){let s=[];for(let a=0;a<e.length;a++)n.isNumber(e[a].value)&&(s[a]=A(e[a],t));return{value:N(s),unit:t,decimals:S(s)}}function R(e,t){return n.isObject(e)?a.bignumber(e.value).dividedBy(t).toNumber():a.bignumber(e).dividedBy(t).toNumber()}function m(e){let t=d(e);return n.isObject(t)&&0!==t.length?a.std(t,"unbiased"):NaN}function O(e,t){let s=[];for(let a=0;a<e.length;a++)n.isNumber(e[a].value)&&(s[a]=A(e[a],t));return{value:m(s),unit:t,decimals:S(s)}}function g(e,t,s){if(e<2||!n.isNumber(t)||!n.isNumber(s))return NaN;const i=a.bignumber(1).dividedBy(a.bignumber(e).minus(1)),r=a.bignumber(s).minus(a.bignumber(t).pow(2).dividedBy(a.bignumber(e)));return i.isNaN()||r.isNaN()?NaN:a.sqrt(i.times(r.abs())).toNumber()}function P(e){let t=d(e);return n.isObject(t)&&0!==t.length?a.min(t):NaN}function M(e){let t=d(e)
;return n.isObject(t)&&0!==t.length?a.max(t):NaN}function L(e){let t=d(e);return n.isObject(t)&&0!==t.length?D(m(t),N(t)):NaN}function D(e,t){let s=0,i=0;return s=n.isObject(e)?e.value:e,i=n.isObject(t)?t.value:t,n.isObject(e)&&n.isObject(t)&&(s=A(e,t.unit).value),a.bignumber(s).dividedBy(i).times(100).toNumber()}function C(e,t,s){let i=NaN,r=NaN,o=NaN,_=E.NONE;return n.isObject(e)?(i=e.value,_=e.unit):i=e,n.isObject(t)?_!==E.NONE?r=A(t,_).value:(r=t.value,_=t.unit):r=t,n.isObject(s)?_!==E.NONE?o=A(s,_).value:(o=s.value,_=s.unit):o=s,a.bignumber(o).minus(r).dividedBy(a.bignumber(i).times(6)).toNumber()}function b(e,t,s){return{value:C(e,t,s),unit:E.NONE,decimals:3}}function f(e,t,s,i){let r=NaN,o=NaN,_=NaN,l=NaN,c=E.NONE;return n.isObject(e)?(r=e.value,c=e.unit):r=e,n.isObject(t)?c!==E.NONE?o=A(t,c).value:(o=t.value,c=t.unit):o=t,n.isObject(s)?c!==E.NONE?_=A(s,c).value:(_=s.value,c=s.unit):_=s,n.isObject(i)?c!==E.NONE?l=A(i,c).value:(l=i.value,c=i.unit):l=i,
a.min(a.bignumber(o).minus(_).dividedBy(a.bignumber(r).times(3)),a.bignumber(l).minus(o).dividedBy(a.bignumber(r).times(3))).toNumber()}function y(e,t,s,a){return{value:f(e,t,s,a),unit:E.NONE,decimals:3}}!function(e){e.UNDEFINED="UNDEFINED",e.MASS="MASS",e.TEMPERATURE="TEMPERATURE",e.PRESSURE="PRESSURE",e.VOLUME="VOLUME"}(o=t.EnumUnitType||(t.EnumUnitType={})),function(e){e.NONE="NONE",e.DIGIT="DIGIT",e.UNIVERSAL="UNIVERSAL",e.MICROGRAM="MICROGRAM",e.MILLIGRAM="MILLIGRAM",e.GRAM="GRAM",e.KILOGRAM="KILOGRAM",e.TONNE="TONNE",e.MILLICARAT="MILLICARAT",e.CARAT="CARAT",e.KILOCARAT="KILOCARAT",e.KARAT="KARAT",e.POUND="POUND",e.OUNCE="OUNCE",e.POUND_OUNCE="POUND_OUNCE",e.TROYOUNCE="TROYOUNCE",e.PENNYWEIGHT="PENNYWEIGHT",e.GRAIN="GRAIN",e.PARTS_PER_POUND="PARTS_PER_POUND",e.TAEL_HONGKONG="TAEL_HONGKONG",e.TAEL_SINGAPORE="TAEL_SINGAPORE",e.TAEL_TAIWAN="TAEL_TAIWAN",e.TAEL_CHINA="TAEL_CHINA",e.MOMME="MOMME",e.TOLA="TOLA",e.BAHT="BAHT",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.DAY="DAY",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},BAHT:{id:E.BAHT,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},DAY:{id:E.DAY,mark:"d",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},TIME_AM:{id:E.TIME_AM,mark:"am",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},TIME_PM:{id:E.TIME_PM,mark:"pm",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},VOLT:{id:E.VOLT,mark:"V",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLIAMPER:{id:E.MILLIAMPER,mark:"mA",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},HECTOPASCAL:{id:E.HECTOPASCAL,mark:"hPa",unitConversionBase:o.PRESSURE,conversionFactor:.01,
conversionDecimalPlacesShift:2},KILOPASCAL:{id:E.KILOPASCAL,mark:"kPa",unitConversionBase:o.PRESSURE,conversionFactor:.001,conversionDecimalPlacesShift:3},GRAM_PER_MOL:{id:E.GRAM_PER_MOL,mark:"g/mol",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},INVALID:{id:E.INVALID,mark:"!invalid!",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},RPM:{id:E.RPM,mark:"rpm",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLIVOLT:{id:E.MILLIVOLT,mark:"mV",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLIVOLT_PER_PH:{id:E.MILLIVOLT_PER_PH,mark:"mV/pH",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MICROSIEMENS_PER_CENTIMETER:{id:E.MICROSIEMENS_PER_CENTIMETER,mark:"µS/cm",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},
GRAM_PER_SQUARE_CENTIMETER:{id:E.GRAM_PER_SQUARE_CENTIMETER,mark:"g/cm²",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},GRAM_PER_METER:{id:E.GRAM_PER_METER,mark:"g/m",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},CENTILITER:{id:E.CENTILITER,mark:"cl",unitConversionBase:o.VOLUME,conversionFactor:.1,conversionDecimalPlacesShift:1},DENSITY:{id:E.DENSITY,mark:"g/cm³",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},VOLUME:{id:E.VOLUME,mark:"cm³",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},KG_M3:{id:E.KG_M3,mark:"kg/m³",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MMHG:{id:E.MMHG,mark:"mmHg",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},KELVIN:{id:E.KELVIN,mark:"K",unitConversionBase:o.TEMPERATURE,conversionFactor:1,
conversionDecimalPlacesShift:0},PASCAL:{id:E.PASCAL,mark:"Pa",unitConversionBase:o.PRESSURE,conversionFactor:1,conversionDecimalPlacesShift:0}},t.convertValueToTargetUnitBigNumber=_,t.convertValueToTargetUnit=l,t.createQuantity=function(e,t,s){let a={value:NaN,unit:E.NONE,decimals:0};if(n.isObject(e)){a=Object.assign(a,e);for(const e of Object.keys(a))["value","unit","decimals","auxiliaryDigits","alibiId","alibi","deviceserial","stable","timestamp","info"].includes(e)||delete a[e]}else if(n.isObject(t))(t=t).value.numbers.length>0&&(a.value=parseFloat(t.value.numbers[0])),a.unit=T(t.value.unit),a.decimals=t.value.decimals;else if(n.isObject(s)){const e=(s=s).value;a.value=parseFloat(e.number),n.isNumber(a.value)||(a.info=e.number),n.isNumber(a.value)&&"-"===e.sign&&(a.value*=-1),a.decimals=e.decimals,a.unit=T(e.unit),a.stable=e.isStable,n.isNumber(e.auxiliaryDigits)&&e.auxiliaryDigits>0&&(a.auxiliaryDigits=e.auxiliaryDigits)}return"BATH"===a.unit&&(a.unit=E.BAHT),
a.unit=n.setEnumSafely(a.unit,E,E.NONE),a},t._formatQuantityParam_numberOnly=c,t.formatQuantityParam_numberOnly=function(e){return null!==e&&e.hasOwnProperty("value")&&e.hasOwnProperty("decimals")?n.isNumber(e.value)?c(e.value,e.decimals):"NaN":"N.A."},t.formatQuantityParam=function(e){return null!==e&&e.hasOwnProperty("value")&&e.hasOwnProperty("unit")&&e.hasOwnProperty("decimals")?n.isNumber(e.value)?c(e.value,e.decimals)+" "+u(e.unit):"NaN":"N.A."},t.convertToTargetUnit=A,t.getUnitString=u,t.getUnitEnum=T,t.math_getSimple_numberArray=d,t.math_count=function(e){return d(e).length},t.math_getMaximumDecimals=S,t.math_roundUp=function(e,t){let s=a.bignumber(e),i=s.minus(s.floor()),n=(i=i.times(a.bignumber(10).pow(t))).minus(i.floor());return a.larger(n,0)&&(i=i.minus(n).add(1)),i=i.dividedBy(a.bignumber(10).pow(t)),s.floor().add(i).toNumber()},t.math_roundAuto=I,t.math_detectLeastSignificantDigit=function(e){let t=0,s=1,i=a.bignumber(e).abs(),n=i.floor(),r=i.minus(n)
;for(;r.greaterThan(0);)t++,n=(r=r.times(10)).floor(),r=r.minus(n);return t>0&&(s=n.dividedBy(a.bignumber(10).pow(t)).toNumber()),s},t.math_sum=p,t.math_Sum=function(e,t){let s=[];for(let a=0;a<e.length;a++)n.isNumber(e[a].value)&&(s[a]=A(e[a],t));return{value:p(s),unit:t,decimals:S(s)}},t.math_mean=N,t.math_Mean=h,t.math_mean_longterm=R,t.math_Mean_Longterm=function(e,t,s){const a=A(e,s);return a.value=R(a,t),a},t.math_standard_deviation=m,t.math_Standard_Deviation=O,t.math_standard_deviation_longterm=g,t.math_Standard_Deviation_Longterm=function(e,t,s,a){return A({value:g(e,(t=A(t,s.unit)).value,s.value),unit:s.unit,decimals:s.decimals},a)},t.math_minimum=P,t.math_Minimum=function(e,t){let s=[];for(let a=0;a<e.length;a++)n.isNumber(e[a].value)&&(s[a]=A(e[a],t));return{value:P(s),unit:t,decimals:S(s)}},t.math_maximum=M,t.math_Maximum=function(e,t){let s=[];for(let a=0;a<e.length;a++)n.isNumber(e[a].value)&&(s[a]=A(e[a],t));return{value:M(s),unit:t,decimals:S(s)}},
t.math_variation_coefficient=L,t.math_Variation_Coefficient=function(e){let t=[];for(let s=0;s<e.length;s++)n.isNumber(e[s].value)&&(t[s]=A(e[s],E.GRAM));return{value:L(t),unit:E.PERCENT,decimals:2}},t.math_variation_coefficient_longterm=D,t.math_Variation_Coefficient_Longterm=function(e,t){return{value:D(A(e,t.unit),t),unit:E.PERCENT,decimals:2}},t.math_cp=function(e,t,s){let a=d(e);return n.isObject(e)&&0!==e.length?C(m(a),t,s):NaN},t.math_Cp=function(e,t,s){return b(O(e,t.unit),t,s)},t.math_cp_longterm=C,t.math_Cp_Longterm=b,t.math_cpk=function(e,t,s){return f(m(e),N(e),t,s)},t.math_Cpk=function(e,t,s){return y(O(e,t.unit),h(e,t.unit),t,s)},t.math_cpk_longterm=f,t.math_Cpk_Longterm=y},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const a=s(66),i=s(67),n=s(68),r=s(49),o=s(70),E=s(9),_=s(27),l=s(71),c=s(28),A=s(50),u=s(51),T=s(41),d=s(42),S=s(54),I=s(77),p=s(78),N=s(39),h=s(12),R=s(43),m=s(3),O=s(79),g=s(6),P=s(33),M=s(58),L=s(38),D=s(17),C=s(15),b=s(10),f=s(80),y=s(25),B=s(36),v=s(81),G=s(2),U=s(7),H=s(44),F=s(59),W=s(60),x=s(29),Q=s(61),k=s(20),w=s(1),V=s(0),Y=s(13);s(62),t.HEARTBEAT_INTERVAL_MS=2e3;const q=100,K=500;t.STORAGE_LOCATION_BASE="/data/installedQApps/qapps/data";const j="STATE_SUSPENDING_INTERNAL",X="STATE_RESTARTING_INTERNAL",J="_START_FSM_",$="_INTERNAL_DEVEL_VERSION_INFO_STATE_",z="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",ee="BTN_SUSPEND_QUESTION_NO",te="BTN_LOGOUT_QUESTION_YES",se="BTN_LOGOUT_QUESTION_NO",ae="BTN_RESTART_QUESTION_YES",ie="BTN_RESTART_QUESTION_NO",ne="CANCEL_LOGOUT",re="REMEMBER_LOGOUT"
;t.TASK_ERROR_STR_TASK_NAME_NOT_UNIQUE="_TASK_NAME_NOT_UNIQUE",t.TASK_ERROR_STR_TASK_NAME_EMPTY="_TASK_NAME_EMPTY";const oe="TASK/IDENTIFICATION",Ee="TASK/PROFILE";var _e,le;t.TASK_PROFILE_REPORTING_ID_PREFIX=Ee+"/REPORTING_PROFILES",t.TASK_PROFILE_WEIGHING_ID=Ee+"/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"}(_e=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"}(le=t.EnumSuspendReason||(t.EnumSuspendReason={})),t.dbg=function(e){null===e?console.log(" ## DEBUG ## null"):void 0===e?console.log(" ## DEBUG ## undefined"):"string"==typeof e||"number"==typeof e||"boolean"==typeof e?console.log(" ## DEBUG ## "+b.inspect(e).toString()):(console.log(" ## DEBUG ##"),
console.log(b.inspect(e,!1,20)),console.log(" ##########"))};class ce{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=V.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=le.SUSPEND_NO_SUSPEND,this.heartbeatCount=0,this.eventQueue=[],this.eventQueuePending=!1,this.subscriptions=[],this.outstandingAsyncCalls=[],this.debugCfg={doConsoleLog:!0,enableHeartbeatLog:!1,url:null},this.pendingMsgBox=void 0,this.currentMsgBox=void 0,this.isCurrentMsgPrio=!1,this.debugCfg.doConsoleLog=e,console.error=((...e)=>{console.log("ERR: ",e)});let i=s(17)
;if(console.log("try reading debug config from file"),i.existsSync("/data/installedQApps/qapps/data/qapplog.conf"))try{console.log("...found config file");let e=JSON.parse(i.readFileSync("/data/installedQApps/qapps/data/qapplog.conf","utf8").toString());console.log("...got it"),Object.assign(this.debugCfg,e),console.log("...debug config (with defaults): "+b.inspect(this.debugCfg))}catch(e){console.log("...invalid JSON content in qapplog.conf: "+e),console.log("...disable logging at all"),console.log=((...e)=>{})}else console.log("No qapplog file found.");let n=console.log;console.log("...saved original stdout");let r=null;if(null!==this.debugCfg.url){console.log("...there seems to be an url for remote logging configured");try{r=new x.URL(this.debugCfg.url),console.log("...valid url for remote logging")}catch(e){r=null,console.log('...invalid URL like "ws://hostname.port" in qapplog.conf')}}if(this.debugCfg.doConsoleLog||(console.log("...disable local output"),console.log=((...e)=>{})),
null!==r){console.log("...valid url for remote logging");let e=new Q.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"),ce.clientSingleton=this,this.restHandler=new A.RestHandler,this.mqttHandler=new l.MqttHandler,this.taskMngProxy=new T.TaskProxy,this.localizerProxy=new u.LocalizerProxy,this.weighingProxy=new d.WeighingProxy,this.accessControlProxy=new I.AccessControlProxy,this.reportingProxy=new N.ReportingProxy,this.devicInformationProxy=new f.DeviceInformationProxy,this.messageHandlerProxy=new y.MessageHandlerProxy,
this.messageHandlerHelper=new B.MessageHandlerHelper(this.messageHandlerProxy),this.taskHandler=new S.TaskHandler,this.heartbeatInterval$=a.interval(t.HEARTBEAT_INTERVAL_MS)}getQAppOrderNumber(){return this.qAppOrderNumber}getQAppVersion(){return this.qAppVersion}getTaskId(){return this.taskId}getSerialNumber(){return this.devicInformationProxy.getSerialNo()}getWeighingProfileId(){let e=this.taskHandler.getParameter(t.TASK_PROFILE_WEIGHING_ID);return void 0!==e&&m.isTypeOfISelectionParameter(e)?e.value.selection.id:void 0}registerAspect(e){this.aspects[e.getId()]=e}init(){let e=new O.LoadingOverlay(this.mqttHandler);this.registerScreen(e)}postInit(){}loadTask(){if(this.taskId){console.log("QAppBase: read task for: ",this.taskId);try{this.taskHandler.setTask(this.taskMngProxy.readTask(this.taskId)),console.log("QAppBase: read task ...done");let e=this.taskHandler.getTask();e&&(this.qAppOrderNumber=e.qappOrderNumber,this.qAppVersion=e.qappVersion),
console.log("QAppBase: got qAppOrderNumber from Task-Info: "+this.qAppOrderNumber+"@"+this.qAppVersion)}catch(e){this.exitError("QAppBase::loadTask - error reading: "+(e?e.toString():""))}}else this.exitError("QAppBase::loadTask - Workflow script called without taskId")}getTaskName(){let e=void 0;if(void 0!==this.taskHandler){let t=this.taskHandler.getParameter("TASK/IDENTIFICATION/NAME");void 0!==t&&(e=t.value.string)}return e}registerScreen(e){console.log("QAppBase: register screen with id: "+e.getId()),this.screens[e.getId()]=e;try{e.events$.subscribe(e=>{e.type===g.ScreenEventType.SHOW_SCREEN&&this.hideLoadingScreenOnShowScreens&&this.hideLoadingScreen(),e.type,g.ScreenEventType.SHOW_LOADINGSCREEN,e.type,g.ScreenEventType.SHOW_MESSAGEBOX})}catch(e){}}showScreen(e){if(!this.exitTimeOutPending)switch(e.getId()){case O.LOADING_OVERLAY_ID:case p.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 O.LOADING_OVERLAY_ID:case p.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()!==O.LOADING_OVERLAY_ID&&s.getId()!==W.LOCK_LOADING_OVERLAY_ID&&s.getId()!==F.LOCKMESSAGEBOX_ID&&(s.getId()===p.MESSAGEBOX_ID?this.hideMsgBox():s.hide())}this.hidePrintQueue()}}getLoadingScreen(){let e=this.screens[O.LOADING_OVERLAY_ID];return void 0===e&&(e=new O.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===P.MQTT_ADMIN_EVENT_PACKET_SENT&&e.payload.packet.topic===w.MqttTopics.HMI_LOADING_MODAL_APPEARANCE&&JSON.parse(e.payload.packet.payload.toString()).appearance===V.EnumAppearance.ENABLED}catch(e){return!1}}checkForLoadingScreenDisabledEvent(e){try{return e.payload.event===P.MQTT_ADMIN_EVENT_PACKET_SENT&&e.payload.packet.topic===w.MqttTopics.HMI_LOADING_MODAL_APPEARANCE&&JSON.parse(e.payload.packet.payload.toString()).appearance===V.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[p.MESSAGEBOX_ID];return void 0===e&&(e=new p.MessageBox(this.mqttHandler),this.registerScreen(e)),e}prepAndShowMsgBox(e){if(!this.exitTimeOutPending){let t=this.getMsgbox();t.setMessageBoxData(e),console.log("QAppBase::prepAndShowMsgBox(): show"),t.show(),console.log("QAppBase::prepAndShowMsgBox(): done")}}hideMsgBoxInternal(){console.log("QAppBase::hideMsgBoxInternal()"),this.getMsgbox().hide()}showPrintQueue(){if(!this.exitTimeOutPending){console.log("QAppBase::showPrintQueue()");let e={enabled:!0};this.mqttHandler.publish(w.MqttTopics.REPORTING_PRINTQUEUE_DISPLAYED,JSON.stringify(e),{retain:!1})}}hidePrintQueue(){console.log("QAppBase::hidePrintQueue()");this.mqttHandler.publish(w.MqttTopics.REPORTING_PRINTQUEUE_DISPLAYED,JSON.stringify({enabled:!1}),{retain:!1})}clearPrintQueue(){void 0!==this.buttons.docuButton&&this.buttons.docuButton.setAppearance(V.EnumAppearance.DISABLED),this.reportingProxy.clearPrintQueue()}registerButton(e,t){switch(e){
case _e.FUNC_BTN_TAKEOVER:this.buttons.takeoverBtn=t,this.lastRequestedTakeoverBtnAppearance=t.getAppearance();break;case _e.FUNC_BTN_DOCU:this.buttons.docuButton=t,this.buttons.docuButton.setAppearance(V.EnumAppearance.DISABLED);break;default:this.buttons.others.push(t)}}addTimer(e,t){const s=n.setTimeout(()=>{this.addToEventQueue(new E.QAppTimerEvent(t))},e);return s.unref(),s}cancelTimer(e){void 0!==e&&n.clearTimeout(e)}addInterval(e,t){return n.setInterval(()=>{this.addToEventQueue(new E.QAppIntervalEvent(t))},e)}cancelInterval(e){void 0!==e&&n.clearInterval(e)}generateAsyncCallidentifier(){let e=Math.random();for(;this.outstandingAsyncCalls.find(t=>t===e);)e=Math.random();return e}enqueAsyncCall(e,s,a=5*t.HEARTBEAT_INTERVAL_MS,i=!1){let r=this.getCurrentState();console.log("QAppBase::enqueAsyncCall in state: "+r+" (timeout: "+a+"/fetchAfter: "+i+") with metadata: "+b.inspect(s));let E=this.generateAsyncCallidentifier();this.outstandingAsyncCalls.push(E)
;let _=new v.QAppAsyncCallTimeoutError(r,s),l=n.setTimeout(()=>{console.log("QAppBase async call timeout - add timeout to event queue");let e=new o.InternalAsyncCallEvent({type:i?o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT_WITH_FETCHING_RESP:o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT,data:{sourceState:r,reason:_,metadata:s},id:E});this.addToEventQueue(e)},a);e.then(e=>{console.log("QAppBase async call passed - add result to event queue");let t=new o.InternalAsyncCallEvent({type:o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_SUCCESS,data:{sourceState:r,result:e,metadata:s},id:E,timerId:l});this.addToEventQueue(t)}).catch(e=>{console.log("QAppBase async call failed - add reason to event queue"),console.log(b.inspect(e));let t=new o.InternalAsyncCallEvent({type:o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_FAIL,data:{sourceState:r,reason:e,metadata:s},id:E,timerId:l});this.addToEventQueue(t)}),
console.log("QAppBase::enqueAsyncCall done...")}addToEventQueue(e){e.type===E.IMMEDIATE_EVENT||e.type===o.INTERNAL_SUSPEND_EVENT||e.type===o.INTERNAL_RESTART_EVENT||e.type===o.HEARTBEAT_EVENT?this.eventQueue.push(e):this.eventQueue.unshift(e),this.eventQueuePending||(setImmediate(()=>{this.processEventQueue(this)}),this.eventQueuePending=!0)}processEventQueue(e){if(this.exitTimeOutPending)return;e.eventQueuePending=!1;let t=e.eventQueue.length,s=e.eventQueue.pop();for(;s&&t>0&&!this.exitTimeOutPending;)t--,e.handleEvent(s),t>0&&(s=e.eventQueue.pop())}run(){if(!this.isErrorStatePublished){console.log("QAppBase: run"),this.processCLParameters(process.argv),this.heartbeat({message:":-)",value:this.heartbeatCount++});let e=this.provideStartFsmState();this.qappStates=this.prepareAndExtendFsmStates(e),console.log("QAppBase: register internal event handler"),
this.subscriptions.push(i.merge(this.mqttHandler.mqttUpdateEvent$,this.mqttHandler.mqttAdminEvent$,this.restHandler.buttonClickEvent$,this.restHandler.paramChangedEvent$,this.restHandler.paramDetailEvent$,this.restHandler.restRequestEvent$).subscribe(e=>{this.addToEventQueue(e)})),this.subscriptions.push(this.mqttHandler.mqttUpdateEvent$.subscribe(e=>{try{switch(e.payload.topic){case w.MqttTopics.METROLOGY_MAX_DIGITS:case w.MqttTopics.METROLOGY_MAX_DIGITS_DEBUG:this.weighingProxy.updateWeighValueMaxDigits(parseInt(e.payload.value.toString(),10));break;case w.MqttTopics.METROLOGY_RANGES:this.weighingProxy.updateMetrologyRanges(JSON.parse(e.payload.value.toString()));break;case w.MqttTopics.WEIGHING_SELECTED_DISPLAY_VALUE:this.weighingProxy.updateLastSelectedDisplayValue(JSON.parse(e.payload.value.toString()))}}catch(t){this.exitError("unexpected value content for incoming MQTT event: "+e.payload.topic)}})),console.log("QAppBase: create the FSM with all custom states"),
this.qappFsm=r.createFsm(this.qappStates),delete this.__machina__,this.eventQueue.splice(0),this.qappFsm.on("transition",this.onFsmTransitionInternal),this.mqttHandler.subscribe(w.MqttTopics.QAPP_DEBUG_TOPIC_PREAMBLE+"/#"),this.onRunning(),console.log("QAppBase: schedule transition to custom start state"),setTimeout(()=>{console.log("QAppBase: start heartbeating"),this.heartbeatIntervalSubscription=this.heartbeatInterval$.subscribe(()=>{this.addHeartbeatEvent(":-)")}),console.log("QAppBase: initiate transition to custom start state"),this.qappFsm.handle(this,J,this.isDevelVersion?$:e),console.log("QAppBase: initiated transition to custom start state")},q),console.log("QAppBase: run finished")}}canSuspend(){if(console.log("QAppBase: Can suspend?"),this.suspendReason===le.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===le.SUSPEND_LOGOUT)this.showPriorMsgBox({type:h.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MBOX_LOGOUT_WARNING_TITLE",args:[]},buttons:[{id:te,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:V.EnumAppearance.ENABLED_SECONDARY},{id:se,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},appearance:V.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!==le.SUSPEND_HOME)return!1;this.showPriorMsgBox({type:h.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MBOX_HOME_WARNING_TITLE",args:[]},buttons:[{id:Z,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:V.EnumAppearance.ENABLED_SECONDARY},{id:ee,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},appearance:V.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!==le.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=le.SUSPEND_NO_SUSPEND}cancelLogout(){console.log("QAppBase: Cancel last logout request"),this.cancelSuspend(),this.forgetLogout()}rememberLogout(){this.mqttHandler.publish(w.MqttTopics.QAPP_LOGOUT_REQUEST,JSON.stringify({request:re}))}forgetLogout(){this.mqttHandler.publish(w.MqttTopics.QAPP_LOGOUT_REQUEST,JSON.stringify({request:ne}))}suspend(){
console.log("QAppBase: QApp suspend request"),this.suspendReason=le.SUSPEND_APP,this.handleEvent(new o.InternalSuspendEvent(o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_EXECFINALLY))}doSuspend(){this.isErrorStatePublished||(console.log("QAppBase: suspend"),this.onSuspending(),this.doCloseAllOverlays(),console.log("QAppBase: publish STOPPED event of qapp"),this.mqttHandler.publish(w.MqttTopics.QAPP_STOPPED,this.taskId?""+this.taskId:"",{retain:!1}),setTimeout(()=>{console.log("process.exit"),process.exit(0)},K),this.exitTimeOutPending=!0)}canRestart(){return console.log("QAppBase: can restart? - check printQueue"),this.reportingProxy.isPrintQueueEmpty()?(console.log("QAppBase: printQueue is empty, restart the QApp."),!0):(this.showPriorMsgBox({type:h.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MBOX_RESTART_QUESTION_TITLE",args:[]},buttons:[{id:ae,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:V.EnumAppearance.ENABLED_SECONDARY},{id:ie,label:{id:"_QAPP_LIB_MBOX_BTN_NO",
args:[]},appearance:V.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(R.CANCEL_BARBUTTON_ID);if(t&&t.setAppearance(V.EnumAppearance.HIDDEN),e!==O.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(B.EMsgHandlerMsgs.ERR_799_GENERIC_INTERNAL_ERROR,e,void 0,[y.createMessageHandlerButton(void 0,void 0,y.MessageHandlerCallTarget.REMOVE_MESSAGE)]),this.onErrorExiting(e),this.mqttHandler.publish(w.MqttTopics.QAPP_ERROR,(this.taskId?""+this.taskId:"")+"error: "+e,{retain:!1}),setTimeout(()=>{console.error("QAppBase: exit with error: "+e),process.exit(-1)},K),this.exitTimeOutPending=!0}heartbeat(e){this.isErrorStatePublished||(this.debugCfg.enableHeartbeatLog&&console.log("."),this.mqttHandler.publish(w.MqttTopics.QAPP_HEARTBEAT,JSON.stringify(e),{retain:!1}))}addHeartbeatEvent(e){this.addToEventQueue(new o.HeartbeatEvent({message:e,value:this.heartbeatCount++}))}checkForCustomHeartbeatEvent(e,t){try{return e.payload.event===P.MQTT_ADMIN_EVENT_PACKET_SENT&&e.payload.packet.topic===w.MqttTopics.QAPP_HEARTBEAT&&JSON.parse(e.payload.packet.payload.toString()).message===t}catch(e){return!1}}adaptFsmStates(e){}prepareAndExtendFsmStates(e){let t
;if(console.log("QAppBase::prepareAndExtendFsmStates: create state machine with QApp specific states"),void 0===this.qappStates){t=this.provideFsmStates();for(let e in this.aspects)Object.assign(t,this.aspects[e].getAspectStates());t[$]={_onEnter:function(e){e.showMessageBox({type:h.EnumMessageboxType.INFO,title:{id:"_QAPP_LIB_MBOX_DEMO_INFO_TITLE",args:[]},buttons:[{id:z,label:{id:U.EnumFontLabels.OK,args:[]},appearance:V.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===z&&(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=le.SUSPEND_HOME:e.suspendReason=le.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=le.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,X):console.log("QAppBase: restart interrupted by QApp");break;case o.INTERNAL_RESTART_EVENT_TYPE.RESTART_EVENT_TYPE_EXECFINALLY:
this.transition(e,X)}});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[X]={_onEnter:function(e){e.showLoadingScreen({id:"_QAPP_LIB_LOADING_OVERLAY_TEXT_RESTARTING_APP",args:[e.getTaskName()]})},_onExit:function(e){},MQTT_ADMIN_EVENT:function(e,t){e.checkForLoadingScreenEnableEvent(t)&&(e.clearPrintQueue(),this.transition(e,r.STATE_UNINITIALIZED_INTERNAL),e.restart(),e.run())},_FSM_HEARTBEAT_EVENT_:s}}else t=this.qappStates;return t}handleEvent(e){if(this.qappFsm){if(e instanceof _.MqttUpdateDebugEvent&&e.payload.topic===w.MqttTopics.QAPP_DEBUG_STOP_HEARTBEAT&&(console.log("DEBUG: stop heartbeat received"),this.heartbeatIntervalSubscription&&(console.log("DEBUG: stop heartbeat > unsubscribe on heartbeatInterval"),this.heartbeatIntervalSubscription.unsubscribe())),
e instanceof c.HmiButtonClickedEvent)if(e.payload.buttonId!==k.BTN_HOME_ID||this.suppressGlobalHomeBtnHandling)if(e.payload.buttonId!==k.BTN_LOGOUT_ID||this.suppressGlobalLogoutBtnHandling){if(e.payload.buttonId===Z)return void this.continueSuspend();if(e.payload.buttonId===te)return void this.continueSuspend();if(e.payload.buttonId===ee)return this.cancelSuspend(),this.hidePriorMsgBox(),void this.hideLoadingScreen();if(e.payload.buttonId===se)return this.cancelLogout(),this.hidePriorMsgBox(),void this.hideLoadingScreen();if(e.payload.buttonId!==t.PRINT_RESTART_BUTTON_ID||this.suppressGlobalRestartBtnHandling){if(e.payload.buttonId===ae)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===w.MqttTopics.USERMANAGEMENT_AUTO_LOGOUT_EVENT)try{JSON.parse(e.payload.value.toString()).logOff&&(e=new o.InternalSuspendEvent(o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_FORCED_AUTO_LOGOUT))}catch(e){}if(e instanceof o.InternalAsyncCallEvent){let t=this.outstandingAsyncCalls.findIndex(t=>t===e.payload.id);if(-1===t)return void console.log(`QAppBase::handleEvent: async event already handled - discard result (${e.payload.type}) for metadata: ${JSON.stringify(e.payload.data.metadata)}`);switch(e.payload.type){case o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_SUCCESS:e.payload.timerId&&n.clearTimeout(e.payload.timerId),this.outstandingAsyncCalls.splice(t,1),e=new E.QAppAsyncCallDoneEvent(e.payload.data);break
;case o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_FAIL:e.payload.timerId&&n.clearTimeout(e.payload.timerId),this.outstandingAsyncCalls.splice(t,1),e=new E.QAppAsyncCallFailEvent(e.payload.data);break;case o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT:this.outstandingAsyncCalls.splice(t,1),e=new E.QAppAsyncCallFailEvent(e.payload.data);break;case o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT_WITH_FETCHING_RESP:e=new E.QAppAsyncCallFailEvent(e.payload.data)}}this.qappFsm.handle(this,e.type,e)}else this.exitError("QAppBase::handleEvent - no fsm instance set, unexpectedly")}onFsmTransitionInternal(e){if(console.log("QAppBase: transition from <",e.fromState,"> to <",e.toState,"> (machina ev: <",e.action,">)"),e.fromState){let t=e.client.qappFsm.states[e.fromState]._transTo;if(t){let s=t[e.toState];s?s(e.client,e):(s=t["~"])&&s(e.client,e),(s=t["*"])&&s(e.client,e)}if(e.fromState===r.STATE_UNINITIALIZED_INTERNAL){
e.client.mqttHandler.subscribe(w.MqttTopics.METROLOGY_MAX_DIGITS),e.client.mqttHandler.subscribe(w.MqttTopics.METROLOGY_MAX_DIGITS_DEBUG),e.client.mqttHandler.subscribe(w.MqttTopics.METROLOGY_RANGES),e.client.mqttHandler.subscribe(w.MqttTopics.WEIGHING_SELECTED_DISPLAY_VALUE),e.client.mqttHandler.subscribe(w.MqttTopics.USERMANAGEMENT_AUTO_LOGOUT_EVENT),console.log("QAppBase: handle transition to custom initial state: initTaskHandler"),e.client.initTaskHandler(),console.log("QAppBase: handle transition to custom initial state: adaptTaskHandler"),e.client.adaptTaskHandler(),console.log("QAppBase: clear all task and QApp errors from messageHandler");let t=[],s=e.client.messageHandlerHelper.buildSecret(B.MESSAGE_HANDLER_SECRET_TYPE.QAPP);s&&t.push({categoryAsString:y.MessageHandlerCategory.QAPP,secret:s});let a=e.client.messageHandlerHelper.buildSecret(B.MESSAGE_HANDLER_SECRET_TYPE.QAPP_DB_ERROR);a&&t.push({categoryAsString:y.MessageHandlerCategory.QAPP,secret:a})
;let i=e.client.messageHandlerHelper.buildSecret(B.MESSAGE_HANDLER_SECRET_TYPE.QAPP_RUNTIME_COMM_ERROR);i&&t.push({categoryAsString:y.MessageHandlerCategory.QAPP,secret:i});let n=e.client.messageHandlerHelper.buildSecret(B.MESSAGE_HANDLER_SECRET_TYPE.QAPP_RUNTIME_EXIT_ERROR);n&&t.push({categoryAsString:y.MessageHandlerCategory.QAPP,secret:n});let r=void 0;void 0!==e.client.taskId&&(r=e.client.messageHandlerHelper.buildSecret(B.MESSAGE_HANDLER_SECRET_TYPE.TASKID))&&t.push({categoryAsString:y.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(y.MessageHandlerCategory.QAPP,s),a&&e.client.messageHandlerProxy.deleteMessageByCategory(y.MessageHandlerCategory.QAPP,a),
i&&e.client.messageHandlerProxy.deleteMessageByCategory(y.MessageHandlerCategory.QAPP,i),n&&e.client.messageHandlerProxy.deleteMessageByCategory(y.MessageHandlerCategory.QAPP,n),r&&e.client.messageHandlerProxy.deleteMessageByCategory(y.MessageHandlerCategory.QAPP,r)),console.log("QAppBase: handle transition to custom initial state: init"),e.client.init(),console.log("QAppBase: handle transition to custom initial state: init all aspects");for(let t in e.client.aspects)console.log("init aspect: ",t),e.client.aspects[t].init(e.client);console.log("QAppBase: handle transition to custom initial state: postInit"),e.client.postInit(),console.log("QAppBase: handle transition to custom initial state: ...done")}}if(e.client.onFsmTransition(e),e.fromState===r.STATE_UNINITIALIZED_INTERNAL&&(console.log("QAppBase: publish running state of qapp"),e.client.mqttHandler.publish(w.MqttTopics.QAPP_STARTED,e.client.taskId?""+e.client.taskId:"create Task",{retain:!1})),e.toState){
let t=e.client.qappFsm.states[e.toState]._transFrom;if(t){let s=t[e.fromState];s?s(e.client,e):(s=t["~"])&&s(e.client,e),(s=t["*"])&&s(e.client,e)}}}getCurrentState(){let e=this.__machina__._qappStm_.state;return console.log("QAppBase::getCurrentState: ",e),e}onRunning(){console.log("QAppBase: default callback after QApp published RUNNING event")}restart(){this.announceRestart(),this.specificRestart(),this.onSuspending(),this.doCloseAllOverlays();for(let e of this.subscriptions)e.unsubscribe();this.heartbeatIntervalSubscription&&this.heartbeatIntervalSubscription.unsubscribe(),this.mqttHandler.unsubscribeTopics(),this.weighingProxy.clearTare1AndTare2()}announceRestart(){console.log("QAppBase: announce restart to system"),this.taskMngProxy.setTaskEvent(this.taskId?this.taskId:"---",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,a=this.taskHandler.getTask();switch(e){case M.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT:s=t.STORAGE_LOCATION_BASE;break;case M.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC:a&&(s=this.getStorageLocation(M.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT)+L.sep+a.qappOrderNumber);break;case M.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION:a&&(s=this.getStorageLocation(M.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC)+L.sep+a.qappVersion);break;case M.EnumPersistencyScope.PERSISTENCY_SCOPE_TASk_SPECIFIC:a&&this.taskId&&(s=this.getStorageLocation(M.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION)+L.sep+this.taskId)}return s}
createStorageLocation(e){let t=s(17),a=this.getStorageLocation(M.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT);if(void 0!==a){if(!t.existsSync(a))return!1;if(e!==M.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT){let s=this.getStorageLocation(M.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC);if(void 0!==s){if(t.existsSync(s)||t.mkdirSync(s),e!==M.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC){let s=this.getStorageLocation(M.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION);if(void 0!==s){if(t.existsSync(s)||t.mkdirSync(s),e!==M.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION){return void 0!==this.getStorageLocation(M.EnumPersistencyScope.PERSISTENCY_SCOPE_TASk_SPECIFIC)&&(t.existsSync(this.getStorageLocation(M.EnumPersistencyScope.PERSISTENCY_SCOPE_TASk_SPECIFIC))||t.mkdirSync(this.getStorageLocation(M.EnumPersistencyScope.PERSISTENCY_SCOPE_TASk_SPECIFIC)),!0)}return!0}return!1}return!0}return!1}return!0}return!1}
readQAppDescQTFAsJSON(e,t){let s=void 0,a=void 0,i="";if(Y.isString(t)&&t.length>0)i=t;else{if(!this.scriptPath)return void console.log("QAppConfigBase::readQAppDescAsJSON - internal error - no scriptPath is set.");i=L.dirname(this.scriptPath)+"/../"}let n="";try{n=i+"qapp.desc_"+e+".json",a=D.readFileSync(n)}catch(e){console.log("QAppConfigBase: - no "+n+" found - try DEFAULT");try{n=i+"qapp.desc_DEFAULT.json",a=D.readFileSync(n)}catch(e){return void console.log("QAppConfigBase::readQAppDescAsJSON - "+n+" (fallback) missing")}}try{a&&(s=JSON.parse(a.toString("utf-8")))}catch(e){return void console.log("QAppConfigBase::readQAppDescAsJSON - "+n+" not valid JSON")}return s.name=s.hasOwnProperty("name")?s.name:"ERROR",s.shortDescription=s.hasOwnProperty("shortDescription")?s.shortDescription:"ERROR",s.longDescription=s.hasOwnProperty("longDescription")?s.longDescription:"ERROR",s}relevantParamsAreEqual(e,s){let a=G.cloneJSON(e),i=G.cloneJSON(s);return a.forEach((e,s)=>{
e.id===oe?delete a[s]:e.id===Ee&&e.parameters.forEach((e,i)=>{e.id.startsWith(t.TASK_PROFILE_REPORTING_ID_PREFIX)?delete a[s].parameters[i]:e.id===t.TASK_PROFILE_WEIGHING_ID&&(e.info.options=[])})}),i.forEach((e,s)=>{e.id===oe?delete i[s]:e.id===Ee&&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=[])})}),C.isEqual(a,i)}deleteDBError(){let e=this.messageHandlerHelper.buildSecret(B.MESSAGE_HANDLER_SECRET_TYPE.QAPP_DB_ERROR);e&&this.messageHandlerProxy.deleteMessageByCategory(y.MessageHandlerCategory.QAPP,e)}}t.QAppBase=ce},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(4),i=s(0),n=s(10),r=s(7),o=s(5);var E,_,l;function c(e,s,a){return{appearance:i.EnumAppearance.ENABLED_SECONDARY,type:_.CALLBACK,name:s||r.EnumFontLabels.OK,effect:{method:"buttonClickEvent",module:"qappHandler",params:{buttonId:e||t.MESSAGEHANDLER_OK_BTN_ID},
calltarget:a||l.ReST}}}!function(e){e.FATAL="FATAL",e.ERROR="ERROR",e.WARNING="WARNING",e.INFORMATION="INFORMATION"}(E=t.MESSAGE_HANDLER_MESSAGE_TYPE||(t.MESSAGE_HANDLER_MESSAGE_TYPE={})),function(e){e.UNTIL_EXPLICIT_DELETION="UNTIL_EXPLICIT_DELETION",e.UNTIL_EXPLICIT_DELETION_OR_REBOOT="UNTIL_EXPLICIT_DELETION_OR_REBOOT",e.UNTIL_USER_ACKNOWLEDGE_WITH_REBOOT_PERSISTENCE="UNTIL_USER_ACKNOWLEDGE_WITH_REBOOT_PERSISTENCE",e.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE="UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE"}(t.MESSAGE_HANDLER_LIFETIME||(t.MESSAGE_HANDLER_LIFETIME={})),function(e){e.NAVIGATETO="NavigateTo",e.CALLBACK="Callback"}(_=t.MESSAGE_HANDLER_BUTTON_TYPE||(t.MESSAGE_HANDLER_BUTTON_TYPE={})),function(e){e.MQTT="MQTT",e.ReST="ReST",e.REMOVE_MESSAGE="REMOVE_MESSAGE"}(l=t.MessageHandlerCallTarget||(t.MessageHandlerCallTarget={})),function(e){e.NONE="NONE",e.USER_CAL="USER_CAL",e.QAPP="QAPP"}(t.MessageHandlerCategory||(t.MessageHandlerCategory={})),
t.MESSAGEHANDLER_OK_BTN_ID="BTN_OK_MESSAGEHANDLER",t.MESSAGEHANDLER_CLOSE_QAPP_BTN_I18N="_QAPP_LIB_CONNECTION_ERROR_CLOSE_QAPP_BTN",t.createMessageHandlerButton=c;t.MessageHandlerProxy=class extends a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="messagehandler"}addMessage(e,t,s,i,r,E,_,l,A,u){return this.body.method=o.RestMethodsMESSAGE_HANDLER.addMessage,this.body.params={message:{errorCode:e,type:t,lifetime:i,title:r,reason:E,solution:_,buttons:A||[c()],category:s,categorysecret:l},showMessageInFutureMillis:u||0,uniqueMessageId:0},console.log("addMessageHandler: "+n.inspect(this.body.params.message)),new a.CubisRestResponse(this.syncRequest()).rawReturns.uniqueMessageId}deleteMessageByCategory(e,t){return this.body.method=o.RestMethodsMESSAGE_HANDLER.deleteMessageByCategory,this.body.params={categoryAsString:e,secret:t},console.log("deleteMessageByCategory: "+n.inspect(this.body.params)),new a.CubisRestResponse(this.syncRequest())}deleteMessagesByCategory(e){
return this.body.method=o.RestMethodsMESSAGE_HANDLER.deleteMessagesByCategory,this.body.params={categorySecretArray:JSON.stringify({arraySize:e.length,data:e})},console.log("deleteMessagesByCategory: "+n.inspect(this.body.params)),new a.CubisRestResponse(this.syncRequest())}getAllMessagesByCategory(e){this.body.method=o.RestMethodsMESSAGE_HANDLER.getAllMessagesByCategory,this.body.params={categoryAsString:e,messages:{}};let t=new a.CubisRestResponse(this.syncRequest());return JSON.parse(t.rawReturns.messages).data}getAllErrorMessagesByCategory(e){let t=this.getAllMessagesByCategory(e),s=[];for(let e of t)e.type===E.ERROR&&s.push(e);return s}removeMessage(e){return this.body.method=o.RestMethodsMESSAGE_HANDLER.removeMessage,this.body.params={uniqueMessageId:e},new a.CubisRestResponse(this.syncRequest())}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(32),i=s(19);var n=s(19);t.bignumber=n.bignumber,t.abs=n.abs;const r=s(23);function o(e){
let t=void 0;return r.unitsMap.hasOwnProperty(e)&&(t=r.unitsMap[e].conversionDecimalPlacesShift),void 0===t&&(t=1),t}var E;t.calcInterval=function(e,t,s){return i.bignumber(s).times(a.SartoMath.decPowers(o(e))).times(a.SartoMath.decPowers(-1*o(t))).toNumber()},t.calcDecimals=function(e){return e>=1?0:Math.ceil(-1*Math.log10(e))},t.unitStringToShort=function(e){return r.unitsMap.hasOwnProperty(e)?r.unitsMap[e].mark:r.unitsMap[r.EnumUnit.INVALID].mark},t.getUnitFactor=function(e){let t=void 0;return r.unitsMap.hasOwnProperty(e)&&(t=r.unitsMap[e].conversionFactor),void 0===t&&(t=1),t},t.getUnitShift=o,function(e){e.none="NONE",e.o="UNIVERSAL",e["µg"]="MICROGRAM",e.mg="MILLIGRAM",e.g="GRAM",e.kg="KILOGRAM",e.t="TONNE",e.mct="MILLICARAT",e.ct="CARAT",e.kct="KILOCARAT",e.K="KARAT",e.lb="POUND",e.oz="OUNCE",e.lb_oz="POUND_OUNCE",e.ozt="TROYOUNCE",e.dwt="PENNYWEIGHT",e.GN="GRAIN",e.per_lb="PARTS_PER_POUND",e.tlh="TAEL_HONGKONG",e.tls="TAEL_SINGAPORE",e.tlt="TAEL_TAIWAN",e.tlc="TAEL_CHINA",
e.mom="MOMME",e.tol="TOLA",e.bat="BAHT",e.MS="MESGHAL",e.N="NEWTON",e.war="WARNING",e.pcs="PIECES",e.per="PERCENT",e.mm="MILLIMETER",e.cm="CENTIMETER",e.m="METER",e.km="KILOMETER",e.g_ml="GRAM_PER_MILLILITER",e.Mcls_ml="MILLION_CELLS_PER_MILLILITER",e["µg_ml"]="MICROGRAM_PER_MILLILITER",e["µg_l"]="MICROGRAM_PER_LITER",e.mg_ml="MILLIGRAM_PER_MILLILITER",e.mg_l="MILLIGRAM_PER_LITER",e.mmol_ml="MILLIMOL_PER_MILLILITER",e.g_cm3="DENSITY",e.cm3="VOLUME",e.cm2="SQUARECENTIMETRE",e.m2="SQUAREMETRE",e.g_cm2="GRAM_PER_SQUARE_CENTIMETER",e.g_m2="GRAMMAGE",e.g_m="GRAM_PER_METER",e["µl"]="MICROLITER",e.ml="MILLILITER",e.cl="CENTILITER",e.l="LITER",e.mmol="MILLIMOL",e.C="GRAD_CELSIUS",e.F="GRAD_FAHRENHEIT",e.sec="SECOND",e.min="MINUTE",e.h="HOUR",e.am="TIME_AM",e.pm="TIME_PM",e.V="VOLT",e.mA="MILLIAMPER",e.hPa="HECTOPASCAL",e.kPa="KILOPASCAL",e.g_mol="GRAM_PER_MOL",e.kg_m3="KG_M3",e.mmHg="MMHG",e.invalid="!invalid!",e.rpm="RPM"}(E=t.EnumUnitStrings||(t.EnumUnitStrings={}));const _={[E.none]:"none",
[E.o]:"o",[E.µg]:"µg",[E.mg]:"mg",[E.g]:"g",[E.kg]:"kg",[E.t]:"t",[E.mct]:"mct",[E.ct]:"ct",[E.kct]:"kct",[E.K]:"K",[E.lb]:"lb",[E.oz]:"oz",[E.lb_oz]:"lb_oz",[E.ozt]:"ozt",[E.dwt]:"dwt",[E.GN]:"GN",[E.per_lb]:"per_lb",[E.tlh]:"tlh",[E.tls]:"tls",[E.tlt]:"tlt",[E.tlc]:"tlc",[E.mom]:"mom",[E.tol]:"tol",[E.bat]:"bat",[E.MS]:"MS",[E.N]:"N",[E.war]:"war",[E.pcs]:"pcs",[E.per]:"per",[E.mm]:"mm",[E.cm]:"cm",[E.m]:"m",[E.km]:"km",[E.g_ml]:"g_ml",[E.Mcls_ml]:"Mcls_ml",[E.µg_ml]:"µg_ml",[E.µg_l]:"µg_l",[E.mg_ml]:"mg_ml",[E.mg_l]:"mg_l",[E.mmol_ml]:"mmol_ml",[E.g_cm3]:"g_cm3",[E.cm3]:"cm3",[E.cm2]:"cm2",[E.m2]:"m2",[E.g_cm2]:"g_cm2",[E.g_m2]:"g_m2",[E.g_m]:"g_m",[E.µl]:"µl",[E.ml]:"ml",[E.cl]:"cl",[E.l]:"l",[E.mmol]:"mmol",[E.C]:"C",[E.F]:"F",[E.sec]:"sec",[E.min]:"min",[E.h]:"h",[E.am]:"am",[E.pm]:"pm",[E.V]:"V",[E.mA]:"mA",[E.hPa]:"hPa",[E.kPa]:"kPa",[E.g_mol]:"g_mol",[E.kg_m3]:"kg_m3",[E.mmHg]:"mmHg",[E.invalid]:"invalid",[E.rpm]:"rpm"};t.unitStringToLong=function(e){
const t=Array.isArray(e)?e[0]:e;if(0===t.length)return E.none;for(const[e,s]of Object.entries(_))if(s===t)return e;return E.invalid},t.convertWgtUnit=function(e,t,s){return r.convertValueToTargetUnit(e,t,s)},t.convertWgtUnitBigNumber=function(e,t,s){return r.convertValueToTargetUnitBigNumber(e,t,s)},t.convertTempUnit=function(e,t,s){const a=[r.EnumUnit.GRAD_CELSIUS,r.EnumUnit.GRAD_FAHRENHEIT,E.C,E.F];return a.includes(t)&&a.includes(s)?r.convertValueToTargetUnit(e,t,s):e},t.convertPressureUnit=function(e,t,s){const a=[r.EnumUnit.HECTOPASCAL,r.EnumUnit.KILOPASCAL,E.hPa,E.kPa];return a.includes(t)&&a.includes(s)?r.convertValueToTargetUnit(e,t,s):e},t.UnitEnum_Api2Lib=function(e){let t=E;for(let s in t)if(t[s].toString()===e.toString())return s;return null},t.UnitEnum_Lib2Api=function(e){return r.getUnitEnum(e)}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EV_MQTT_UPDATE="EV_MQTT_UPDATE";class a{constructor(e){this.payload=e,this.type=t.EV_MQTT_UPDATE}}
t.MqttUpdateEvent=a,t.EV_MQTT_UPDATE_DEBUG="EV_MQTT_UPDATE_DEBUG";t.MqttUpdateDebugEvent=class extends a{constructor(){super(...arguments),this.type=t.EV_MQTT_UPDATE_DEBUG}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EV_HMI_BTN_CLICKED="EV_HMI_BTN_CLICKED",t.EV_HMI_PARAM_CHANGED="EV_HMI_PARAM_CHANGED",t.EV_HMI_PARAM_DETAIL="EV_HMI_PARAM_DETAIL",t.EV_REST_REQUEST="EV_REST_REQUEST";const a=s(29);t.HmiButtonClickedEvent=class{constructor(e){this.payload=e,this.type=t.EV_HMI_BTN_CLICKED}};t.HmiParamChangedEvent=class{constructor(e){this.payload=e,this.type=t.EV_HMI_PARAM_CHANGED}};t.HmiParamDetailEvent=class{constructor(e){this.payload=e,this.type=t.EV_HMI_PARAM_DETAIL}};t.RestRequestEvent=class{constructor(e){this.payload=e,this.type=t.EV_REST_REQUEST}},t.getParamsForRestRequestEvent=function(e){return new a.URL("http://127.0.0.1/"+e.payload.subUrl).searchParams}},function(e,t){e.exports=require("url")},function(e,t,s){"use strict"
;Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(6);t.AbstractOverlay=class extends i.AbstractScreen{show(){this.publishContent("",'{ "appearance":"'+a.EnumAppearance.ENABLED+'" }'),this.events$.next({type:i.ScreenEventType.SHOW_OVERLAY,id:this.getId()})}hide(){this.publishContent("",'{ "appearance":"'+a.EnumAppearance.HIDDEN+'" }'),this.events$.next({type:i.ScreenEventType.HIDE_OVERLAY,id:this.getId()})}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(3),i=s(14),n=s(22),r=s(2);t.checkGeneralParamRules=function(e){let t=void 0;if(a.isTypeOfIQuantityParameter(e)){let s=i.QuantityParameter.getValue(e);if(Number.isNaN(s)){if(!0!==e.info.isNoValueAllowed){let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);void 0!==e.info.noValueErrorMsg?"string"==typeof e.info.noValueErrorMsg?s.textList=[{id:e.info.noValueErrorMsg,args:[]}]:s.textList=[e.info.noValueErrorMsg]:s.textList=[{
id:"_QAPP_LIB_MSG_BOX_ERROR_CFG_QUANT_PARAM_EMPTY_NOT_ALLOWED",args:[]}],t={updatedParameter:e,message:s}}}else try{if(s<parseFloat(e.info.minimum.value)){let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);s.textList=[{id:e.info.minimum.errorMsg?e.info.minimum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_QUANT_PARAM_EXCEED_MIN",args:[]}],t={updatedParameter:e,message:s}}else if(s>parseFloat(e.info.maximum.value)){let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);s.textList=[{id:e.info.maximum.errorMsg?e.info.maximum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_QUANT_PARAM_EXCEED_MAX",args:[]}],t={updatedParameter:e,message:s}}}catch(e){}}else if(a.isTypeOfIStringParameter(e)){let s=e.value.string;try{if(void 0===s){if(0!==e.info.minimum.length&&!0!==e.info.isNoValueAllowed){let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);void 0!==e.info.noValueErrorMsg?"string"==typeof e.info.noValueErrorMsg?s.textList=[{id:e.info.noValueErrorMsg,args:[]
}]:s.textList=[e.info.noValueErrorMsg]:s.textList=[{id:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_MANDATORY",args:[]}],t={updatedParameter:e,message:s}}}else if(s.length<e.info.minimum.length)if(0===s.length){if(console.log("StringParam: empty"),!0!==e.info.isNoValueAllowed){let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);void 0!==e.info.noValueErrorMsg?"string"==typeof e.info.noValueErrorMsg?s.textList=[{id:e.info.noValueErrorMsg,args:[]}]:s.textList=[e.info.noValueErrorMsg]:s.textList=[{id:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_MANDATORY",args:[]}],t={updatedParameter:e,message:s}}}else{console.log("StringParam: min exceed");let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);s.textList=[{id:e.info.minimum.errorMsg?e.info.minimum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_TOO_SHORT",args:[]}],t={updatedParameter:e,message:s}}else if(s.length>e.info.maximum.length)if(console.log("StringParam: max exceed"),
!0===e.info.maximum.autoCut)console.log("StringParam: autocut"),e.value.string=s.substr(0,e.info.maximum.length);else{let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);s.textList=[{id:e.info.maximum.errorMsg?e.info.maximum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_TOO_LONG",args:[]}],t={updatedParameter:e,message:s}}}catch(e){}}else if(a.isTypeOfIPasswordParameter(e)){let s=e.value.string;try{if(void 0===s){if(0!==e.info.minimum.length&&!0!==e.info.isNoValueAllowed){let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);void 0!==e.info.noValueErrorMsg?"string"==typeof e.info.noValueErrorMsg?s.textList=[{id:e.info.noValueErrorMsg,args:[]}]:s.textList=[e.info.noValueErrorMsg]:s.textList=[{id:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_MANDATORY",args:[]}],t={updatedParameter:e,message:s}}}else if(s.length<e.info.minimum.length)if(0===s.length){if(console.log("PasswordParam: empty"),!0!==e.info.isNoValueAllowed){let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept)
;void 0!==e.info.noValueErrorMsg?"string"==typeof e.info.noValueErrorMsg?s.textList=[{id:e.info.noValueErrorMsg,args:[]}]:s.textList=[e.info.noValueErrorMsg]:s.textList=[{id:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_MANDATORY",args:[]}],t={updatedParameter:e,message:s}}}else{console.log("PasswordParam: min exceed");let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);s.textList=[{id:e.info.minimum.errorMsg?e.info.minimum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_TOO_SHORT",args:[]}],t={updatedParameter:e,message:s}}else if(s.length>e.info.maximum.length){console.log("PasswordParam: max exceed");let s=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);s.textList=[{id:e.info.maximum.errorMsg?e.info.maximum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_TOO_LONG",args:[]}],t={updatedParameter:e,message:s}}}catch(e){}}return t}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(19);class i{static roundExactToDecimals(e,t){
return this.nTimesTen(this.roundExact(this.nTimesTen(e,t)),-1*t)}static roundExact(e){return e=e>=0?Math.floor(e+.5+Number.EPSILON):Math.ceil(e-.5-Number.EPSILON)}static nTimesTen(e,t){return a.bignumber(e).times(i.decPowers(t)).toNumber()}static countDecimals(e){return a.bignumber(e).decimalPlaces()}static decPowers(e){switch(e){case-15:return 1e-15;case-14:return 1e-14;case-13:return 1e-13;case-12:return 1e-12;case-11:return 1e-11;case-10:return 1e-10;case-9:return 1e-9;case-8:return 1e-8;case-7:return 1e-7;case-6:return 1e-6;case-5:return 1e-5;case-4:return 1e-4;case-3:return.001;case-2:return.01;case-1:return.1;case 0:return 1;case 1:return 10;case 2:return 100;case 3:return 1e3;case 4:return 1e4;case 5:return 1e5;case 6:return 1e6;case 7:return 1e7;case 8:return 1e8;case 9:return 1e9;case 10:return 1e10;case 11:return 1e11;case 12:return 1e12;case 13:return 1e13;case 14:return 1e14;case 15:return 1e15;default:return Math.pow(10,e)}}}t.SartoMath=i},function(e,t,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){e.exports=require("http")},function(e,t){e.exports=require("rxjs")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(25),i=s(3),n=s(73),r=s(24),o=s(52),E="_QAPP_MSG_HANDLER_",_="_TITLE",l="_REASON",c="_SOLUTION";var A;function u(e){return e+"_"+a.MESSAGEHANDLER_OK_BTN_ID}!function(e){e.TASKID="TASKID",e.QAPP="QAPP",e.QAPP_DB_ERROR="QAPP_DB_ERROR",e.QAPP_RUNTIME_COMM_ERROR="QAPP_RUNTIME_COMM_ERROR",e.QAPP_RUNTIME_EXIT_ERROR="QAPP_RUNTIME_EXIT_ERROR",e.MANUAL="MANUAL"}(A=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=u,t.isMessageHandlerOkButton=function(e){return e.endsWith(a.MESSAGEHANDLER_OK_BTN_ID)};const T={ERR_702:{errorCode:702,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.USER_CAL,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_EXPLICIT_DELETION,secretType:A.MANUAL},ERR_703:{errorCode:703,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.WARNING,category:a.MessageHandlerCategory.USER_CAL,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.MANUAL},INFO_USERCAL_CAL_OVERALL_PASSED:{errorCode:0,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.INFORMATION,category:a.MessageHandlerCategory.USER_CAL,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.MANUAL},INFO_USERCAL_ERROR_NO_INVALIDATION:{errorCode:0,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.USER_CAL,
lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.MANUAL},ERR_704:{errorCode:704,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.TASKID},ERR_710:{errorCode:710,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.WARNING,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.MANUAL},INFO_STARLIMS_CAL_OVERALL_PASSED:{errorCode:0,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.INFORMATION,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.MANUAL},ERR_711:{errorCode:711,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.MANUAL},ERR_712:{
errorCode:712,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.MANUAL},ERR_713:{errorCode:713,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.MANUAL},ERR_714:{errorCode:714,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.MANUAL},ERR_715:{errorCode:715,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.MANUAL},ERR_716:{errorCode:716,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,
lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.MANUAL},ERR_717:{errorCode:717,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.MANUAL},ERR_718:{errorCode:718,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.MANUAL},ERR_790:{errorCode:790,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.QAPP_DB_ERROR,buttons:[a.createMessageHandlerButton(u(790))]},ERR_791:{errorCode:791,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,
secretType:A.QAPP_DB_ERROR,buttons:[a.createMessageHandlerButton(u(791))]},ERR_792:{errorCode:792,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.QAPP_DB_ERROR,buttons:[a.createMessageHandlerButton(u(792))]},ERR_793:{errorCode:793,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.QAPP_DB_ERROR,buttons:[a.createMessageHandlerButton(u(793))]},ERR_794:{errorCode:794,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.QAPP_DB_ERROR,buttons:[a.createMessageHandlerButton(u(794))]},ERR_795:{errorCode:795,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,
lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.QAPP_DB_ERROR,buttons:[a.createMessageHandlerButton(u(795))]},ERR_796:{errorCode:796,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.QAPP_DB_ERROR,buttons:[a.createMessageHandlerButton(u(796))]},ERR_797:{errorCode:797,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.QAPP_DB_ERROR,buttons:[a.createMessageHandlerButton(u(797))]},ERR_798:{errorCode:798,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.QAPP_RUNTIME_COMM_ERROR},ERR_799:{errorCode:799,type:a.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,
category:a.MessageHandlerCategory.QAPP,lifetime:a.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:A.QAPP_RUNTIME_EXIT_ERROR}};t.MessageHandlerHelper=class{constructor(e){this.messageHandlerProxy=e}buildSecret(e){switch(e){case A.TASKID:return r.QAppBase.clientSingleton.getTaskId();case A.QAPP:return r.QAppBase.clientSingleton.getQAppOrderNumber();case A.QAPP_DB_ERROR:return r.QAppBase.clientSingleton.getQAppOrderNumber()+A.QAPP_DB_ERROR;case A.QAPP_RUNTIME_COMM_ERROR:return r.QAppBase.clientSingleton.getQAppOrderNumber()+A.QAPP_RUNTIME_COMM_ERROR;case A.QAPP_RUNTIME_EXIT_ERROR:return r.QAppBase.clientSingleton.getQAppOrderNumber()+A.QAPP_RUNTIME_EXIT_ERROR;case A.MANUAL:default:return}}addMessage(e,t,s,a){console.log(`messageHandlerHelper::addMessage: ${e}`);let A=i.createEmptyTextStructure(),u=i.createEmptyTextStructure(),d=i.createEmptyTextStructure(),S=0;0===T[e].errorCode?(A.id=E+e+_,u.id=E+e+l,d.id=E+e+c):S=T[e].errorCode;let I=[]
;for(799!==T[e].errorCode&&798!==T[e].errorCode||I.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||(I.push(r.QAppBase.clientSingleton.getQAppOrderNumber()),I.push(r.QAppBase.clientSingleton.getQAppVersion())),void 0!==t&&("string"==typeof t?(I.push("Error"),I.push(t)):n.isError(t)?o.isHttpRestError(t)?(I.push(`${t.name} (HTTP(s)/${t.statusCode})`),I.push(t.message)):(I.push(t.name),I.push(t.message)):I.push(...t));I.length<4;)I.push("");u.args=I;let p=this.buildSecret(T[e].secretType);return void 0!==p&&(s=p),console.log(`messageHandlerHelper::addMessage: add msg handler msg ${S} with secret ${s}`),this.messageHandlerProxy.addMessage(S,T[e].type,T[e].category,T[e].lifetime,A,u,d,s||"",a||(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}),t.TASK_DYNAMIC_ID_GROUPS_PREFIX="TASK/DYNAMIC_ID",t.TASK_DYNAMIC_ID_CNT_GROUP_ID=t.TASK_DYNAMIC_ID_GROUPS_PREFIX+"_CNT",t.TASK_DYNAMIC_ID_LID_GROUP_ID=t.TASK_DYNAMIC_ID_GROUPS_PREFIX+"_LID",t.TASK_DYNAMIC_ID_SID_GROUP_ID=t.TASK_DYNAMIC_ID_GROUPS_PREFIX+"_SID",t.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID=t.TASK_DYNAMIC_ID_GROUPS_PREFIX+"_DB_CONN_CONFIG",t.TASK_DYNAMIC_ID_LID_CNT_PARAM_ID=t.TASK_DYNAMIC_ID_CNT_GROUP_ID+"/LID_CNT",t.TASK_DYNAMIC_ID_LID_X_PARAM_ID_PREFIX=t.TASK_DYNAMIC_ID_LID_GROUP_ID+"/LID_",t.TASK_DYNAMIC_ID_LID_X_PARAM_ID_SUFFIX_HEADER="H_",t.TASK_DYNAMIC_ID_LID_X_PARAM_ID_SUFFIX_TITLE="T_",t.TASK_DYNAMIC_ID_LID_CNT_MIN=0,t.TASK_DYNAMIC_ID_LID_CNT_MAX=5,t.TASK_DYNAMIC_ID_SID_CNT_PARAM_ID=t.TASK_DYNAMIC_ID_CNT_GROUP_ID+"/SID_CNT",t.TASK_DYNAMIC_ID_SID_X_PARAM_ID_PREFIX=t.TASK_DYNAMIC_ID_SID_GROUP_ID+"/SID_",t.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_HEADER="H_",
t.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_TITLE="T_",t.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_MODE="M_",t.TASK_DYNAMIC_ID_SID_CNT_MIN=0,t.TASK_DYNAMIC_ID_SID_CNT_MAX=5,t.TASK_DYNAMIC_ID_DB_TYPES_PARAM_ID=t.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/TYPES",t.TASK_DYNAMIC_ID_DB_USERNAME_PARAM_ID=t.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/USERNAME",t.TASK_DYNAMIC_ID_DB_PASSWORD_PARAM_ID=t.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/PASSWORD",t.TASK_DYNAMIC_ID_DB_DATABASE_PARAM_ID=t.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/DATABASE",t.TASK_DYNAMIC_ID_DB_SCHEMA_PARAM_ID=t.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/SCHEMA",t.TASK_DYNAMIC_ID_DB_IP_PARAM_ID=t.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/IP",t.TASK_DYNAMIC_ID_DB_PORT_PARAM_ID=t.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/PORT",t.TASK_DYNAMIC_ID_CNT_OPTION_PREFIX="CNT_",function(e){e.POSTGRES="postgres",e.MYSQL="mysql",e.MSSQL="mssql",e.SQLITE="sqlite"}(t.EnumDatabaseTypesOptions||(t.EnumDatabaseTypesOptions={})),function(e){e.OFF="OFF",
e.ON="ON"}(t.EnumLotIdentifierOptions||(t.EnumLotIdentifierOptions={})),function(e){e.OFF="OFF",e.ON="ON",e.ON_AUTO_INC="ON_AUTO_INC",e.ON_AUTO_DEC="ON_AUTO_DEC"}(t.EnumSampleIdentifierOptions||(t.EnumSampleIdentifierOptions={})),t.createIDCntOption=function(e){return t.TASK_DYNAMIC_ID_CNT_OPTION_PREFIX+e.toFixed(0)},t.getConfiguredIds=function(e){return parseInt(e.value.selection.id.replace(t.TASK_DYNAMIC_ID_CNT_OPTION_PREFIX,""),10)},t.createLIDParamId=function(e,s){return t.TASK_DYNAMIC_ID_LID_X_PARAM_ID_PREFIX+s+e.toFixed(0)},t.createSIDParamId=function(e,s){return t.TASK_DYNAMIC_ID_SID_X_PARAM_ID_PREFIX+s+e.toFixed(0)}},function(e,t){e.exports=require("path")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(4),i=s(3),n=s(14),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 a.CubisRestResponse{constructor(e){super(e)}getPrintItemIdentifier(){return this.rawReturns.printItemIdentifier}}t.ReportingPrintParamResponse=_;t.ReportingProxy=class extends a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="reporting",this._isPrintQueueEmpty=!0}printParameters(e,t,s,a=-1){
this.body.method=o.RestMethodsREPORTING.printParameters,this.body.params={parameters:JSON.stringify(e),category:t,redactable:s,printItemIdentifier:a};let i=new _(this.syncRequest());return i.isSuccess()&&(this._isPrintQueueEmpty=!1),i}printPrintQueue(){return this.body.method=o.RestMethodsREPORTING.printPrintQueueWithElectronicSignature,this.body.params={},new a.CubisRestResponse(this.syncRequest())}printParametersDirect(e,t,s){return this.body.method=o.RestMethodsREPORTING.printParametersDirect,this.body.params={parameters:JSON.stringify(e),category:t,silent:s},new a.CubisRestResponse(this.syncRequest())}getPrintQueue(){return this.body.method=o.RestMethodsREPORTING.getPrintQueue,this.body.params={printQueue:{}},new a.CubisRestResponse(this.syncRequest())}isPrintQueueEmpty(){let e;this.body.method=o.RestMethodsREPORTING.isPrintQueueEmpty,this.body.params={rResult:!1};try{return!!(e=new a.CubisRestResponse(this.syncRequest())).isSuccess()&&e.rawReturns.rResult}catch(e){
return console.log("Something went wrong when calling isPrintQueueEmpty"),console.log(e),this._isPrintQueueEmpty}}clearPrintQueue(){this.body.method=o.RestMethodsREPORTING.clearPrintQueue,this.body.params={};let e=new a.CubisRestResponse(this.syncRequest());return e.isSuccess()&&(this._isPrintQueueEmpty=!0),console.log("clearPrintQueue() result: "+e.isSuccess()),e}requestPrintableValue(e){return this.body.method=o.RestMethodsREPORTING.requestPrintableValueComment,this.body.params={comment:e},new a.CubisRestResponse(this.syncRequest())}setRedactionStatus(e,t,s){return this.body.method=o.RestMethodsREPORTING.setRedactionStatus,this.body.params={printItemIdentifier:e,redacted:t,reason:s},new a.CubisRestResponse(this.syncRequest())}getAlibiRecord(e){return this.body.method=o.RestMethodsREPORTING.getAlibiRecord,this.body.params={identifier:e,record:""},new a.CubisRestResponse(this.syncRequest())}getAlibiRecordList(e){return this.body.method=o.RestMethodsREPORTING.getAlibiRecordList,
this.body.params={identifiers:e,records:[]},new a.CubisRestResponse(this.syncRequest())}getDateFromAlibi(e){let t;if(e instanceof a.CubisRestResponse){if(!e.isSuccess())return E.getAlibiListFailed;t=JSON.parse(e.rawReturns.record)}else{if("number"==typeof e){let t=this.getAlibiRecord(e);return t.isSuccess()?JSON.parse(t.rawReturns.record).timestamp:E.wrongAlibiId}t=e}return t.timestamp}getWeightFromAlibi(e,t){let s;if(e instanceof a.CubisRestResponse){if(!e.isSuccess())return E.getAlibiListFailed;s=JSON.parse(e.rawReturns.record)}else if("number"==typeof e){let t=this.getAlibiRecord(e);if(!t.isSuccess())return E.wrongAlibiId;s=JSON.parse(t.rawReturns.record)}else s=e;return this.parseMeasureParameterFromAlibiResponse(s,t)}getWeightFromAlibiList(e,t){let s=[],i=[];if(e instanceof a.CubisRestResponse){if(!e.isSuccess())return E.getAlibiListFailed;i=JSON.parse(e.rawReturns.records)}else if(0!==(n=e).length&&"number"!=typeof n[0])i=e;else{let t=this.getAlibiRecordList(e)
;if(!t.isSuccess())return E.getAlibiListFailed;i=JSON.parse(t.rawReturns.records)}var n;return i.forEach(e=>{s=[...s,this.parseMeasureParameterFromAlibiResponse(e,t)]}),s}parseMeasureParameterFromAlibiResponse(e,t){let s=i.createEmptyParameterGroupOfGroups();if(null===e)return E.wrongAlibiId;{s.parameters[0].parameters=JSON.parse(e.weighingblock);let a=n.WeightBlockHelper.getMeasureParameter(s,t||r.MqttTopics.WEIGHING_VALUE_NET);return void 0===a?E.wrongTopic:a}}}},function(e,t){e.exports=require("child_process")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(4),i=s(5);!function(e){e.EVENT_RESTART="restart"}(t.EnumTaskManagementEvent||(t.EnumTaskManagementEvent={}));class n extends a.CubisRestResponse{constructor(e){super(e)}getErrorList(){return JSON.parse(this.rawReturns.errorList)}getStoredTask(){return JSON.parse(this.rawReturns.task)}}t.TaskValCreaUpdResponse=n;t.TaskProxy=class extends a.BaseProxy{constructor(){super(...arguments),
this.restEndpoint="task/management"}getTaskTemplate(){let e,t;return this.body.method=i.RestMethodsTASK_MANAGEMENT.getTaskTemplate,this.body.params={taskTemplate:{}},e=new a.CubisRestResponse(this.syncRequest()),t=JSON.parse(e.rawReturns.taskTemplate)}readTask(e,t=!0){let s,n;if(this.body.method=i.RestMethodsTASK_MANAGEMENT.readTask,this.body.params={document:{},dbId:e,updateOptions:t},!(s=new a.CubisRestResponse(this.syncRequest())).isSuccess())throw new Error("Error reading task with id '"+e+"'");return n=JSON.parse(s.rawReturns.document)}getTaskName(e){try{let t=this.readTask(e).params.find(e=>"TASK/IDENTIFICATION"===e.id);if(void 0!==t){let e=t.parameters.find(e=>"TASK/IDENTIFICATION/NAME"===e.id);if(void 0!==e)return e.value.string}return}catch(e){return}}createTask(e){return this.body.method=i.RestMethodsTASK_MANAGEMENT.createTask,this.body.params={task:JSON.stringify(e),errorList:[]},new n(this.syncRequest())}updateTask(e){
return this.body.method=i.RestMethodsTASK_MANAGEMENT.updateTask,this.body.params={task:JSON.stringify(e),errorList:[]},new n(this.syncRequest())}validateTask(e){return this.body.method=i.RestMethodsTASK_MANAGEMENT.validate,this.body.params={task:JSON.stringify(e),errorList:[]},new n(this.syncRequest())}saveWorkstate(e,t){let s;if(this.body.method=i.RestMethodsTASK_MANAGEMENT.saveWorkstate,this.body.params={id:t,workstate:e},!(s=new a.CubisRestResponse(this.syncRequest())).isSuccess())throw new Error("Error saving workstate with id '"+t+"'");return s}deleteWorkstate(e){let t;if(this.body.method=i.RestMethodsTASK_MANAGEMENT.deleteWorkstate,this.body.params={id:e},!(t=new a.CubisRestResponse(this.syncRequest())).isSuccess())throw new Error("Error deleting workstate with id '"+e+"'");return t}getWorkstate(e){let t,s;if(this.body.method=i.RestMethodsTASK_MANAGEMENT.getWorkstate,this.body.params={id:e,workstate:{}},
!(t=new a.CubisRestResponse(this.syncRequest())).isSuccess())throw new Error("Error reading task with id '"+e+"'");return s=JSON.parse(t.rawReturns.workstate).workstate}getTaskNamesByOrderNumber(e){let t;if(this.body.method=i.RestMethodsTASK_MANAGEMENT.getTaskNamesByOrderNumber,this.body.params={orderNumber:e,taskNames:[]},(t=new a.CubisRestResponse(this.syncRequest())).isSuccess())return JSON.parse(t.rawReturns.taskNames);throw new Error("Error getting used taskNames for '"+e+"'")}setTaskEvent(e,t){let s;console.log(`TaskManagementProxy: send event: '${t}'`),this.body.method=i.RestMethodsTASK_MANAGEMENT.setTaskEvent,this.body.params={taskId:e,event:t};try{return(s=new a.CubisRestResponse(this.syncRequest())).isSuccess()}catch(e){return console.log("Something went wrong when calling sendTaskEvent"),console.log(e),!1}}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const a=s(15),i=s(35),n=s(4),r=s(14),o=s(25),E=s(36),_=s(24),l=s(53),c=s(5),A=s(23),u=s(74);var T,d=s(35);t.Subscription=d.Subscription,t.Observable=d.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 S="WEIGHING_ERROR_UNKNOWN_UNIT_ID";t.WeighingProxy=class extends n.BaseProxy{constructor(){super(...arguments),this.restEndpoint="weighing",this.weighValueMaxDigits=7,this.registeredApplications=[],this.weighingButtonAppearances={[u.WEIGHING_BUTTON_ID.UNIT]:"undefined",[u.WEIGHING_BUTTON_ID.DO_ZERO]:"undefined",[u.WEIGHING_BUTTON_ID.DO_TARE]:"undefined",[u.WEIGHING_BUTTON_ID.DO_TARE1]:"undefined",[u.WEIGHING_BUTTON_ID.CLR_TARE1]:"undefined",[u.WEIGHING_BUTTON_ID.SET_TARE1]:"undefined",[u.WEIGHING_BUTTON_ID.SHOW_TARE1]:"undefined",[u.WEIGHING_BUTTON_ID.HIDE_TARE1]:"undefined",[u.WEIGHING_BUTTON_ID.DISPLAY]:"undefined"},this.metrologyMaximum$=new i.ReplaySubject(1),this.metrologyMinimum$=new i.ReplaySubject(1),this.highestRangeInterval$=new i.ReplaySubject(1),this.lowestRangeInterval$=new i.ReplaySubject(1),this.highestRangePrecision$=new i.ReplaySubject(1),this.lowestRangePrecision$=new i.ReplaySubject(1),this.metrologyRanges$=new i.ReplaySubject(1),
this.selectedDisplayValue$=new i.ReplaySubject(1),this.lastSelectedDisplayValueInfo={currentSelectedDomain:T.SELECTED_DOMAIN_UNDEFINED,currentSelectedId:"",lastSelectedApplicationId:""}}createWeightApplication(e,t,s,a,i=!1){if(this.registeredApplications.find(t=>t===e))return this.enableWeightApplication(e,i);{this.body.method=c.RestMethodsWEIGHING.createWeightApplication,this.body.params={id:e,title:t,header:s,isDynamic:a};let r=new n.CubisRestResponse(this.syncRequest());if(r.isSuccess()){try{this.enableWeightApplication(e,i)}catch(e){}this.registeredApplications.push(e)}return r}}enableWeightApplication(e,t){return this.body.method=c.RestMethodsWEIGHING.enableWeightApplication,this.body.params={id:e,isEnabled:t},new n.CubisRestResponse(this.syncRequest())}enableWeightApplicationBulk(e,t){if(!t){let t=this.getSelectedDisplayValue();if(t){let s=t.lastSelectedApplicationId;if(s){let t=!1;return e.forEach(e=>{e!==s?this.enableWeightApplication(e,!1):t=!0}),
void(t&&this.enableWeightApplication(s,!1))}}}e.forEach(e=>{this.enableWeightApplication(e,t)})}selectWeightApplication(e){return this.body.method=c.RestMethodsWEIGHING.selectWeightApplication,this.body.params={id:e},new n.CubisRestResponse(this.syncRequest())}destroyWeightApplication(e){this.body.method=c.RestMethodsWEIGHING.destroyWeightApplication,this.body.params={id:e};let t=new n.CubisRestResponse(this.syncRequest());if(t.isSuccess()){let t=this.registeredApplications.findIndex(t=>t===e);t>=0&&this.registeredApplications.splice(t,1)}return t}setButton(e,t){return this.weighingButtonAppearances[e]===t?new n.CubisRestResponse(!0):(this.weighingButtonAppearances[e]=t,this.body.method=c.RestMethodsWEIGHING.setButton,this.body.params={name:e,appearance:t},new n.CubisRestResponse(this.syncRequest()))}triggerStableWeightBlock(){return this.body.method=c.RestMethodsWEIGHING.triggerStableWeightBlock,this.body.params={},new n.CubisRestResponse(this.syncRequest())}cancelStableWeightBlock(){
return this.body.method=c.RestMethodsWEIGHING.cancelStableWeightBlock,this.body.params={},new n.CubisRestResponse(this.syncRequest())}doZero(e){return this.body.method=c.RestMethodsWEIGHING.doZero,this.body.params={behavior:e},new n.CubisRestResponse(this.syncRequest())}clearTare1(){return this.body.method=c.RestMethodsWEIGHING.clearTare1,this.body.params={},new n.CubisRestResponse(this.syncRequest())}clearTare2(){return this.body.method=c.RestMethodsWEIGHING.clearTare2,this.body.params={},new n.CubisRestResponse(this.syncRequest())}clearTare1AndTare2(){return{clearTare1Response:this.clearTare1(),clearTare2Response:this.clearTare2()}}clearTareAll(){return this.body.method=c.RestMethodsWEIGHING.clearTareAll,this.body.params={},new n.CubisRestResponse(this.syncRequest())}doTare(e){return this.body.method=c.RestMethodsWEIGHING.doTare,this.body.params={behavior:e},new n.CubisRestResponse(this.syncRequest())}doTare1(e){return this.body.method=c.RestMethodsWEIGHING.doTare1,this.body.params={
behavior:e},new n.CubisRestResponse(this.syncRequest())}doTareAuto(e){return this.body.method=c.RestMethodsWEIGHING.doTareAuto,this.body.params={behavior:e},new n.CubisRestResponse(this.syncRequest())}doZeroTareAuto(e){return this.body.method=c.RestMethodsWEIGHING.doZeroTareAuto,this.body.params={behavior:e},new n.CubisRestResponse(this.syncRequest())}setTare1(e){return this.body.method=c.RestMethodsWEIGHING.setTare1,this.body.params={value:e},new n.CubisRestResponse(this.syncRequest())}cancelDoing(){return this.body.method=c.RestMethodsWEIGHING.cancelDoing,this.body.params={},new n.CubisRestResponse(this.syncRequest())}setTare2(e){return this.body.method=c.RestMethodsWEIGHING.setTare2,this.body.params={value:e},new n.CubisRestResponse(this.syncRequest())}setUnit(e,t=!0){this.body.method=c.RestMethodsWEIGHING.setUnit,this.body.params={unitId:e};let s=new n.CubisRestResponse(this.syncRequest());if(s.isSuccess())return!0;if(s.result===S){if(t){
let t=new E.MessageHandlerHelper(new o.MessageHandlerProxy),s=new l.ProfileManagementProxy,a=_.QAppBase.clientSingleton.getWeighingProfileId();t.addMessage(E.EMsgHandlerMsgs.ERR_704_UNIT_UNAVAILABLE,[_.QAppBase.clientSingleton.getTaskName()||"",A.getUnitString(e),a?s.getWeighingProfileName(a):""],void 0,[o.createMessageHandlerButton(void 0,void 0,o.MessageHandlerCallTarget.REMOVE_MESSAGE)]),_.QAppBase.clientSingleton.doSuspend()}return!1}return!1}getParameter(e){return this.body.method=c.RestMethodsWEIGHING.getParameter,this.body.params={rObject:{},id:e},new n.CubisRestResponse(this.syncRequest())}getParameterIds(){return this.body.method=c.RestMethodsWEIGHING.getParameterIds,this.body.params={rIds:{}},new n.CubisRestResponse(this.syncRequest())}setMinUsp(e){return this.body.method=c.RestMethodsWEIGHING.setMinUsp,this.body.params={isEnabled:!0,value:r.QuantityParameter.getValue(e),unit:e.unit},new n.CubisRestResponse(this.syncRequest())}setMinWeight(e){
return this.body.method=c.RestMethodsWEIGHING.setMinWeight,this.body.params=Object.assign({},e),new n.CubisRestResponse(this.syncRequest())}getWeighValueMaxDigits(){return this.weighValueMaxDigits}updateWeighValueMaxDigits(e){console.log("Weighing proxy: set new max weight value digit count: "+e),this.weighValueMaxDigits=e}updateMetrologyRanges(e){let t=a.last(e.parameters),s=a.head(e.parameters);if(this.metrologyRanges$.next(e),void 0!==t){let e=t.parameters.find(e=>"MAXIMUM"===a.last(e.id.split("/"))),s=t.parameters.find(e=>"INTERVAL"===a.last(e.id.split("/"))),i=t.parameters.find(e=>"PRECISION"===a.last(e.id.split("/")));void 0!==e&&this.metrologyMaximum$.next({maxUnit:e.value.unit,maxValue:r.QuantityParameter.getValue(e),maxDecimals:e.value.decimals}),void 0!==s&&this.highestRangeInterval$.next({intervalUnit:s.value.unit,intervalValue:r.QuantityParameter.getValue(s),intervalDecimals:s.value.decimals}),void 0!==i&&this.highestRangePrecision$.next({precisionUnit:i.value.unit,
precisionValue:r.QuantityParameter.getValue(i),precisionDecimals:i.value.decimals})}if(void 0!==s){let e=s.parameters.find(e=>"MINIMUM"===a.last(e.id.split("/"))),t=s.parameters.find(e=>"INTERVAL"===a.last(e.id.split("/"))),i=s.parameters.find(e=>"PRECISION"===a.last(e.id.split("/")));void 0!==e&&this.metrologyMinimum$.next({minUnit:e.value.unit,minValue:r.QuantityParameter.getValue(e),minDecimals:e.value.decimals}),void 0!==t&&this.lowestRangeInterval$.next({intervalUnit:t.value.unit,intervalValue:r.QuantityParameter.getValue(t),intervalDecimals:t.value.decimals}),void 0!==i&&this.lowestRangePrecision$.next({precisionUnit:i.value.unit,precisionValue:r.QuantityParameter.getValue(i),precisionDecimals:i.value.decimals})}}getSelectedDisplayValue(){return this.lastSelectedDisplayValueInfo}restoreLastSelectedDisplayValue(e){void 0!==this.lastSelectedDisplayValueInfo&&(this.lastSelectedDisplayValueInfo.lastSelectedApplicationId=e,
this.selectedDisplayValue$.next(this.lastSelectedDisplayValueInfo))}updateLastSelectedDisplayValue(e){try{console.log("WeighingProxy::updateLastSelectedDisplayValue: "+JSON.stringify(e));let t={currentSelectedDomain:e.show,currentSelectedId:e.id,lastSelectedApplicationId:""};t.currentSelectedDomain===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=c.RestMethodsWEIGHING.insertWeightInvalidation,this.body.params={group:e,topic:t},new n.CubisRestResponse(this.syncRequest())}removeWeightInvalidation(e,t){
return this.body.method=c.RestMethodsWEIGHING.removeWeightInvalidation,this.body.params={group:e,topic:t},new n.CubisRestResponse(this.syncRequest())}setAmbientCondition(e){return this.body.method=c.RestMethodsWEIGHING.setAmbientCondition,this.body.params={ambientConditionId:e},new n.CubisRestResponse(this.syncRequest())}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(8),i=s(56),n=s(0),r=s(6),o=s(20),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 i.CheckBarGraph(e),this.cancelBarButton=new a.default(this.mqttHandler,this,_)}getId(){
return t.WEIGHING_SCREEN_ID}getBarButtonId(){return E.MqttTopics.HMI_WEIGHING_SCREEN_BARBUTTONS}createBarButtons(e){e.sort(this.compareButtonBarButtons);for(let t of e){let e=new a.default(this.mqttHandler,this,t);this.buttonList.push(e),e.publish()}}publishBarButtons(){let e=[];for(let t of this.buttonList)e.push(E.MqttTopics.QAPP_NAMESPACE+"/"+t.getTopic());this.mqttHandler.publish(this.getBarButtonId(),JSON.stringify(e))}setText1(e,t,s){let a=!1;this.text1.value!==e&&(this.text1.value=e,a=!0),t&&this.text1.wildcards.join()!==t.join()&&(this.text1.wildcards=t,a=!0),s?this.text1.color!==s&&(this.text1.color=s,a=!0):this.text1.color&&(this.text1.color=void 0,a=!0),a&&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,s){let a=!1;this.text2.value!==e&&(this.text2.value=e,a=!0),t&&this.text2.wildcards.join()!==t.join()&&(this.text2.wildcards=t,a=!0),s?this.text2.color!==s&&(this.text2.color=s,a=!0):this.text2.color&&(this.text2.color=void 0,a=!0),a&&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}),t.LOCKING_ASPECT="LOCKING_ASPECT"},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TASK_DYNAMIC_OMNIS_GROUP_ID="TASK/DYNAMIC_OMNIS",t.TASK_DYNAMIC_OMNIS_AUTO_NEXT_SUBSAMPLE_PARAM_ID=t.TASK_DYNAMIC_OMNIS_GROUP_ID+"/AUTO_NEXT_SUBSAMPLE",
t.TASK_DYNAMIC_OMNIS_AUTO_NEXT_REQUEST_PARAM_ID=t.TASK_DYNAMIC_OMNIS_GROUP_ID+"/AUTO_NEXT_REQUEST",t.TASK_DYNAMIC_OMNIS_OMNIS_DISCOV_UDP_PORT_PARAM_ID=t.TASK_DYNAMIC_OMNIS_GROUP_ID+"/OMNIS_DISC_PORT",t.TASK_DYNAMIC_OMNIS_COMMECTION_TIMEOUT_PARAM_ID=t.TASK_DYNAMIC_OMNIS_GROUP_ID+"/COMMECTION_TIMEOUT",t.TASK_DYNAMIC_OMNIS_ALLOW_STORE_CREDENTIALS_PARAM_ID=t.TASK_DYNAMIC_OMNIS_GROUP_ID+"/ALLOW_STORE_CREDENTIALS",t.OMNIS_DISCOVERY_UDP_RX_PORT=9115,function(e){e.ON="ON",e.OFF="OFF"}(t.AutonextSubSampleSelectionOption||(t.AutonextSubSampleSelectionOption={})),function(e){e.ON="ON",e.OFF="OFF"}(t.AutonextRequestSelectionOption||(t.AutonextRequestSelectionOption={})),function(e){e.YES="YES",e.NO="NO"}(t.YesNoSelectionOption||(t.YesNoSelectionOption={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(3),n=s(98);t.TAB_MQTT_SCREENS_STRING="SCREENS/",t.TAB_MQTT_TABS_STRING="/TABS/",t.TAB_MQTT_TAB_STRING="/TAB";t.TabBase=class{constructor(e,t,s=!1){
this.tabData=void 0,this.screenId="",this.publishPending=!1,this.lastPublishedTabContent="",this.mqttHandler=e,this.screenId=t,this.singleTab=s}setTabData(e,t=!0){this.tabData=e,t&&this.publishIfEnabled()}publishIfEnabled(){this.publishPending=!1,void 0!==this.tabData&&this.tabData.appearance===a.EnumAppearance.ENABLED&&this.publish()}getTabId(){return void 0!==this.tabData?this.tabData.id:""}setTabContainerTitle(e,t=!0){void 0!==this.tabData&&(this.tabData.containerTitle=e,t&&this.publishIfEnabled())}getTabContainerTitle(){return void 0!==this.tabData?this.tabData.containerTitle:i.createEmptyTextStructure()}setTabTitle(e,t=!0){void 0!==this.tabData&&(this.tabData.title=e,t&&this.publishIfEnabled())}getTabContainerIcon(){return void 0!==this.tabData&&this.tabData.topIcon||""}setTabContainerIcon(e,t=!0){void 0!==this.tabData&&(this.tabData.topIcon=e,t&&this.publishIfEnabled())}getTabTitle(){return void 0!==this.tabData?this.tabData.title:i.createEmptyTextStructure()}
clearTabTopButtons(e=!0){void 0!==this.tabData&&(this.tabData.topbuttons.splice(0,this.tabData.topbuttons.length),e&&this.publishIfEnabled())}getButton(e){}getTabTopButtons(){return void 0!==this.tabData?this.tabData.topbuttons:[]}publishId(){return this.singleTab?t.TAB_MQTT_SCREENS_STRING+this.screenId+t.TAB_MQTT_TAB_STRING:void 0!==this.tabData?t.TAB_MQTT_SCREENS_STRING+this.screenId+t.TAB_MQTT_TABS_STRING+this.tabData.id:""}publish(){if(void 0!==this.tabData){let e=JSON.stringify(this.tabData,n.functionReplacer);e!==this.lastPublishedTabContent&&(this.lastPublishedTabContent=e,this.mqttHandler.publish(this.publishId(),this.lastPublishedTabContent))}}setAppearance(e,t=!0){void 0!==this.tabData&&(this.tabData.appearance=e,t&&this.publish())}getId(){return this.screenId}hide(){this.setAppearance(a.EnumAppearance.HIDDEN)}show(){this.setAppearance(a.EnumAppearance.ENABLED)}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(8),i=s(0),n=s(18)
;t.PARAM_LIST_SCREENID="PARAMLIST",t.FINISH_BUTTON_ID="BTN_FIN";t.ParameterListScreen=class extends n.ParamListBase{constructor(e){super(e);let s={};s.label={id:n.CANCEL_BUTTON_NAME,args:[]},s.appearance=i.EnumAppearance.ENABLED_PRIMARY,s.buttonId=n.CANCEL_BUTTON_ID,this.cancelButton=new a.default(e,this,s),s.appearance=i.EnumAppearance.HIDDEN,s.label.id="_FINISH",s.buttonId=t.FINISH_BUTTON_ID,this.finishButton=new a.default(e,this,s)}getId(){return"PARAMLIST"}getButton(e){let s;return s=e===n.CANCEL_BUTTON_ID?this.cancelButton:e===t.FINISH_BUTTON_ID?this.finishButton:void 0}setFinishButtonLabel(e){this.finishButton.setLabel(e,!1)}show(){this.finishButton.publish(),this.createAndPublishParamsAndPage(),super.show()}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(6),n=s(11),r=s(1);class o{constructor(e){this.paramDetailsOverlayObject={appearance:a.EnumAppearance.HIDDEN,title:{id:"",args:[]},params:[]},this.events$=new n.Subject,
this.mqttHandler=e}setAppearance(e){this.paramDetailsOverlayObject.appearance!==e&&(e!==a.EnumAppearance.HIDDEN&&e!==a.EnumAppearance.ENABLED||(this.paramDetailsOverlayObject.appearance=e,this.mqttHandler.publish(r.MqttTopics.HMI_PARAMDETAILSOVERLAY,JSON.stringify(this.paramDetailsOverlayObject))))}getAppearance(){return this.paramDetailsOverlayObject.appearance}setTitle(e,t){this.paramDetailsOverlayObject.title.id===e&&this.paramDetailsOverlayObject.title.args.join("")===t.join("")||(this.paramDetailsOverlayObject.title.id=e,this.paramDetailsOverlayObject.title.args=t,this.paramDetailsOverlayObject.appearance!==a.EnumAppearance.HIDDEN&&this.mqttHandler.publish(r.MqttTopics.HMI_PARAMDETAILSOVERLAY,JSON.stringify(this.paramDetailsOverlayObject)))}getTitle(){return this.paramDetailsOverlayObject.title}setParams(e){this.paramDetailsOverlayObject.params.join("")!==e.join("")&&(this.paramDetailsOverlayObject.params=e,
this.paramDetailsOverlayObject.appearance!==a.EnumAppearance.HIDDEN&&this.mqttHandler.publish(r.MqttTopics.HMI_PARAMDETAILSOVERLAY,JSON.stringify(this.paramDetailsOverlayObject)))}getParams(){return this.paramDetailsOverlayObject.params}getId(){return"PARAMDETAILSOVERLAY"}getButton(e){}hide(){this.paramDetailsOverlayObject.appearance===a.EnumAppearance.ENABLED&&(this.setAppearance(a.EnumAppearance.HIDDEN),this.events$.next({type:i.ScreenEventType.HIDE_OVERLAY,id:this.getId()}))}show(){this.paramDetailsOverlayObject.appearance===a.EnumAppearance.HIDDEN&&(this.setAppearance(a.EnumAppearance.ENABLED),this.events$.next({type:i.ScreenEventType.SHOW_OVERLAY,id:this.getId()}))}}t.ParamDetailsOverlay=o,t.default=o},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=s(69);t.STATE_UNINITIALIZED_INTERNAL="STATE_UNINITIALIZED_INTERNAL",t.createFsm=function(e){return new a.BehavioralFsm({namespace:"_qappStm_",states:{STATE_UNINITIALIZED_INTERNAL:{
_onEnter:function(e){console.log("FSM: enter STATE_UNINITIALIZED_INTERNAL state")},_onExit:function(e){console.log("FSM: exit STATE_UNINITIALIZED_INTERNAL state")},_transTo:{},_transFom:{},_START_FSM_:function(e,t){this.transition(e,t)},"*":function(e){this.deferUntilTransition(e)}}},initialize:function(t){Object.assign(t.states,t.states,e)},initialState:t.STATE_UNINITIALIZED_INTERNAL,myHandler:function(e,t,s){let a;t.some(function(t){return a=t.nextState,t.guardFn(e,s)})&&a&&this.transition(e,a)}})}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(34),i=s(11),n=s(28),r=s(10),o=s(1),E="/rest/qapp/paramDetail",_="/rest/qapp/paramChanged",l="/rest/qapp/buttonClick",c="/rest/qapp/extern",A=5e3;function u(e,t,s,a,i,n=!0){e.statusCode=t,void 0!==s&&(e.statusMessage=s),n&&console.log(`RestHandler::finalizeResponse: send ${t} (${s}) response: ${r.inspect(a)}`),void 0===a?e.end():"object"==typeof a?(e.setHeader("Content-Type","application/json"),
e.end(JSON.stringify(a,i))):(e.setHeader("Content-Type","plain/text"),e.end(a))}t.RestHandler=class{constructor(e){this.buttonClickEvent$=new i.Subject,this.paramChangedEvent$=new i.Subject,this.paramDetailEvent$=new i.Subject,this.restRequestEvent$=new i.Subject,this.restController=((e,t)=>{if(e.url)if(e.url.startsWith(c)){let s=e.url.replace(c,"");console.log(`RestHandler: rx extern REST request (${e.method})for URL ${s}`),this.handleRequest(e,a=>{console.log("RestHandler: rx all data for REST request - create and enqueue event"),t.setTimeout(A);let i={subUrl:s,request:e,body:a,response:t};this.restRequestEvent$.next(new n.RestRequestEvent(i))})}else switch(console.log(`RestHandler: rx internal REST request: ${e.url}`),e.url){case l:"POST"===e.method?this.handleRequest(e,e=>{e.buttonId&&(console.log(`RestHandler::restController received buttonID: ${e.buttonId}`),this.buttonClickEvent$.next(new n.HmiButtonClickedEvent(e)),u(t,200,"Event Accepted and Forwarded","ok"))
}):u(t,405,"Method Not Allowed","failure");break;case _:"POST"===e.method?this.handleRequest(e,e=>{e&&(this.paramChangedEvent$.next(new n.HmiParamChangedEvent({parameter:e})),u(t,200,"Event Accepted and Forwarded","ok"))}):u(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})),u(t,200,"Event Accepted and Forwarded","ok"))}):u(t,405,"Method Not Allowed","failure");break;default:u(t,404,"Not Found","failure")}else u(t,404,"Not Found","failure")}),this.port=e||8081,this.server=a.createServer(this.restController),this.server.listen(this.port,e=>{e&&console.log(e),console.log(`listening on port ${this.port}`)}),this.server.on("clientError",(e,t)=>{console.log("clientError"),console.log(e),console.log(e.stack),t.end("HTTP/1.1 400 Bad Request\r\n\r\n")})}stopServer(){this.server.close(()=>{console.log("HttpServer closed")})}handleRequest(e,t){let s,a=[""];e.on("error",t=>{
console.log("RestHandler::handleRequest: "+t),e.socket.end()}).on("data",e=>{console.log("RestHandler::handleRequest: data"),"string"!=typeof e?a.push(e.toString()):a.push(e)}).on("end",()=>{if(console.log("RestHandler::handleRequest: end"),s=a.reduce((e,t)=>e+t),"application/json"===e.headers["content-type"])try{t(JSON.parse(s))}catch(e){t(s)}else t(s)})}registerRestEndpoints(e,t){e.publish(o.MqttTopics.CUSTOMIZED_REST_HANDLER_CONFIGURATION,JSON.stringify(t))}},t.finalizeResponse=u},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(4),i=s(5);t.LocalizerProxy=class extends a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="localizer"}getLanguage(){let e;return this.body.method=i.RestMethodsLOCALIZER.getLanguage,this.body.params={rLanguageId:""},(e=new a.CubisRestResponse(this.syncRequest())).isSuccess()?e.rawReturns.rLanguageId:""}getText(e,t=[]){let s;return this.body.method=i.RestMethodsLOCALIZER.getText,this.body.params={id:e,
rText:"",args:t},(s=new a.CubisRestResponse(this.syncRequest())).isSuccess()?s.rawReturns.rText:e}getTexts(e){let t;return this.body.method=i.RestMethodsLOCALIZER.getTexts,this.body.params={textObjects:e,rTexts:""},(t=new a.CubisRestResponse(this.syncRequest())).isSuccess()?JSON.parse(t.rawReturns.rTexts):[]}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HttpRestErrorName="HttpRestError";class a extends Error{constructor(e,s,i,n){super(),this.statusCode=s,this.headers=i,this.body=n,this.name=t.HttpRestErrorName,Object.setPrototypeOf(this,a.prototype),this.message=e}}t.HttpRestError=a,t.isHttpRestError=function(e){return"object"==typeof e&&e.hasOwnProperty("statusCode")&&e.hasOwnProperty("headers")&&e.hasOwnProperty("body")}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(4),i=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 a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="profilemanagement"}loadProfile(e){return this.body.method=n.RestMethodsPROFILE_MANAGEMENT.loadProfile,this.body.params={rProfile:"",id:e},new a.CubisRestResponse(this.syncRequest())}isPresetTareEnabled(e){let t;if(e instanceof a.CubisRestResponse)t=JSON.parse(e.rawReturns.rProfile).params;else if("string"==typeof e){let s=this.loadProfile(e);t=JSON.parse(s.rawReturns.rProfile).params}else t=e.params;for(let e of t)if(e.id===r)for(let t of e.parameters)if(t.id===o)return t.value.selection.id===E;return!1}getWeighingProfileName(e){let t;if(e instanceof a.CubisRestResponse)t=JSON.parse(e.rawReturns.rProfile).params;else if("string"==typeof e){let s=this.loadProfile(e);t=JSON.parse(s.rawReturns.rProfile).params}else t=e.params;for(let e of t)if(e.id===_)for(let t of e.parameters)if(t.id===l)return t.value.string;return""}getAvailableWeighingUnitsInWeighingProfile(e){
let t=e.params.find(e=>"WEIGHING/CONFIGURATION/PROFILE/UNITS_ACCURACY"===e.id);if(void 0!==t){let e=t.parameters.find(e=>"WEIGHING/CONFIGURATION/PROFILE/UNITS_ACCURACY/UNITS"===e.id);return void 0===e?void 0:e.value.selections.map(e=>e.id)}}getUnitsAvailableOnBalance(e){let t=e.params.find(e=>"WEIGHING/CONFIGURATION/PROFILE/UNITS_ACCURACY"===e.id);if(void 0!==t){let e=t.parameters.find(e=>"WEIGHING/CONFIGURATION/PROFILE/UNITS_ACCURACY/UNITS"===e.id);if(void 0===e)return;{let t=[];return e.info.options.forEach(e=>{e.appearance===i.EnumAppearance.ENABLED&&(t=[...t,e.id])}),0===t.length?void 0:t}}}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(37),n=s(2),r=s(75);class o{constructor(e){this.task=e||void 0}splitParamId(e){let t=e.split("/");return t.length>1&&(t[0]=`${t[0]}/${t[1]}`,t.splice(1,1)),t}setTask(e){this.task=e}getTaskGroupsAndParameters(){return this.task?this.task.params:[]}getTask(){return this.task}updateGroup(e){
if(!this.task)return!1;return!!this.task.params.some((t,s)=>!!this.task&&(t.id===e.id&&(this.task.params[s]=e,!0)))&&(console.log(`Group ${e.id} updated!`),!0)}updateParameter(e){let t=this.splitParamId(e.id)[0];return!!this.task&&(!!this.task.params.some((s,a)=>{if(s.id===t)return s.parameters.some((t,s)=>!(t.id!==e.id||!this.task)&&(this.task.params[a].parameters[s]=e,!0))})&&(console.log(`Parameter ${e.id} updated!`),!0))}getGroup(e){let t;if(this.task)return(t=this.task.params.find(t=>t.id===e))||void console.log(`Group ${e} not found!`)}getParameter(e){let t,s=this.splitParamId(e)[0];if(this.task)return this.task.params.find(a=>a.id===s&&(t=a.parameters.find(t=>t.id===e),!0)),t||void console.log(`Parameter ${e} not found!`)}addDynamicGroup(e){if(!this.task)return!1;if(!e.id.startsWith(r.DYNAMIC_PARAMID_PREQUEL))return console.log(`GroupId does not start with '${r.DYNAMIC_PARAMID_PREQUEL}'`),!1
;if(e.id.includes("/",r.DYNAMIC_PARAMID_PREQUEL.length))return console.log('No additional "/" allowed in the name of a dynamic group!',e.id),!1;if(this.task.params.some(t=>t.id===e.id))return console.log("The DynamicGroup already exists!",e.id),!1;e.parameters.forEach(t=>{t.id.startsWith(e.id)||(console.log(`parameterId starts with parameterName only. Extend parameterId with own groupId '${e.id}'.`),t.id=e.id+"/"+t.id)});let t=!1;for(let s=0;s<this.task.params.length;s++)if(this.task.params[s].id.startsWith(i.TASK_DYNAMIC_ID_GROUPS_PREFIX)||!this.task.params[s].id.startsWith(r.DYNAMIC_PARAMID_PREQUEL)){this.task.params.splice(s,0,e),t=!0;break}return t||this.task.params.push(e),!0}addDynamicParameter(e){let t="";if(this.getParameter(e.id))return this.updateParameter(e),!0;{t=this.splitParamId(e.id)[0];let s=this.getGroup(t);if(s)return s.parameters.push(e),!0}return!1}addDynamicParameterToFront(e){let t="";if(this.getParameter(e.id))return this.updateParameter(e),!0;{
t=this.splitParamId(e.id)[0];let s=this.getGroup(t);if(s)return s.parameters.unshift(e),!0}return!1}addDynamicParameterInFrontOf(e,t){let s=this.splitParamId(e.id)[0],a=this.splitParamId(t)[0];if(s===a){let a=this.getGroup(s);if(void 0!==a){let s=a.parameters.findIndex(e=>e.id===t);if(-1!==s)return a.parameters.splice(s,0,e),!0}}return console.log("addDynamicParameterInFrontOf - groups of new and existing parameter do not match: "+s+" vs. "+a),!1}static sortGroup(e){let t=e.parameters.map(function(e,t){return{idx:t,data:e}});t.sort((e,t)=>{if((void 0===e.data.fixed||!0===e.data.fixed)>(void 0===t.data.fixed||!0===t.data.fixed))return 1;if((void 0===e.data.fixed||!0===e.data.fixed)<(void 0===t.data.fixed||!0===t.data.fixed))return-1;if(!(void 0!==e.data.fixed&&!0!==e.data.fixed||void 0!==t.data.fixed&&!0!==t.data.fixed)){
if((e.data.appearance===a.EnumAppearance.ENABLED||e.data.appearance===a.EnumAppearance.ENABLED_INVALID_CFG)<(t.data.appearance===a.EnumAppearance.ENABLED||t.data.appearance===a.EnumAppearance.ENABLED_INVALID_CFG))return 1;if((e.data.appearance===a.EnumAppearance.ENABLED||e.data.appearance===a.EnumAppearance.ENABLED_INVALID_CFG)>(t.data.appearance===a.EnumAppearance.ENABLED||t.data.appearance===a.EnumAppearance.ENABLED_INVALID_CFG))return-1}return e.idx-t.idx}),e.parameters=t.map(function(e){return e.data})}getFilteredTask(){let e,t;return this.task&&((t=(e=n.cloneJSON(this.task)).params.filter(e=>e.id.startsWith(r.DYNAMIC_PARAMID_PREQUEL))).forEach(e=>{e.id.startsWith(i.TASK_DYNAMIC_ID_GROUPS_PREFIX)?e.parameters.forEach((e,t)=>{e.appearance=a.EnumAppearance.HIDDEN}):(e.parameters.forEach((e,t)=>{void 0!==e.fixed&&!0!==e.fixed||e.appearance===a.EnumAppearance.HIDDEN||(e.appearance=a.EnumAppearance.DISABLED)}),o.sortGroup(e),e.parameters.forEach((e,t)=>{void 0!==e.fixed&&delete e.fixed
}))}),e.params=t),e}}t.TaskHandler=o},function(e,t){e.exports=require("https")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(57),n=s(1),r=1;t.CheckBarGraph=class{constructor(e){this.barGraphStatusObject={appearance:a.EnumAppearance.HIDDEN,areas:i.EnumAreaCount.FOUR_AREAS},this.barGraphValueObject={area:1,perc:0},this.mqttHandler=e}publishValue(){this.mqttHandler.publish(n.MqttTopics.HMI_CHECKBARGRAPH_VALUE,JSON.stringify(this.barGraphValueObject))}publishStatus(){this.mqttHandler.publish(n.MqttTopics.HMI_CHECKBARGRAPH_STATUS,JSON.stringify(this.barGraphStatusObject))}setAppearance(e,t=!0){this.barGraphStatusObject.appearance!==e&&(e!==a.EnumAppearance.ENABLED&&e!==a.EnumAppearance.HIDDEN||(this.barGraphStatusObject.appearance=e,t&&(this.publishStatus(),this.publishValue())))}getAppearance(){return this.barGraphStatusObject.appearance}setAreas(e,t=!0){
this.barGraphStatusObject.areas!==e&&(e!==i.EnumAreaCount.FOUR_AREAS&&e!==i.EnumAreaCount.SIX_AREAS||(this.barGraphStatusObject.areas=e,t&&this.publishStatus()))}getAreas(){return this.barGraphStatusObject.areas}setAreaPerc(e,t=!0){this.barGraphValueObject.area===e.area&&this.barGraphValueObject.perc===e.perc||e.area>=r&&e.area<=(this.barGraphStatusObject.areas===i.EnumAreaCount.FOUR_AREAS?4:6)&&(this.barGraphValueObject=e,t&&this.publishValue())}calc4AreaPerc(e,t,s,a,i,n=!0){let r=1,o=0;return e>0&&(0<e&&e<t?(r=1,o=e/t*100):t<=e&&e<=i?(r=2,o=(e-t)/(i-t)*100):i<e&&e<=s?(r=3,o=(e-i)/(s-i)*100):s<e&&e<=a&&(r=4,o=(e-s)/(a-s)*100)),n&&this.setAreaPerc({area:r,perc:o}),{area:r,perc:o}}calc6AreaPerc(e,t,s,a,i,n,r,o=!0){let E=1,_=0;return e>0&&(0<e&&e<t?(E=1,_=e/t*100):t<=e&&e<s?(E=2,_=(e-t)/(s-t)*100):s<=e&&e<=r?(E=3,_=(e-s)/(r-s)*100):r<e&&e<=a?(E=4,_=(e-r)/(a-r)*100):a<e&&e<=i?(E=5,_=(e-a)/(i-a)*100):i<e&&e<=n&&(E=6,_=(e-i)/(n-i)*100)),this.setAreaPerc({area:E,perc:_},o),{area:E,perc:_}}}
},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),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}),function(e){e.PERSISTENCY_SCOPE_QAPP_INDEPENDENT="PERSISTENCY_SCOPE_QAPP_INDEPENDENT",e.PERSISTENCY_SCOPE_QAPP_SPECIFIC="PERSISTENCY_SCOPE_QAPP_SPECIFIC",e.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION="PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION",e.PERSISTENCY_SCOPE_TASk_SPECIFIC="PERSISTENCY_SCOPE_TASk_SPECIFIC"}(t.EnumPersistencyScope||(t.EnumPersistencyScope={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(8),i=s(0),n=s(12),r=s(6),o=s(11),E=s(1);t.LOCKMESSAGEBOX_ID="LOCKMESSAGEBOX";class _{constructor(e){this.appearance=i.EnumAppearance.HIDDEN,this.lastPublishedTabContent={appearance:i.EnumAppearance.HIDDEN,type:n.EnumMessageboxType.INFO,title:{id:"",args:[]},text:{id:"",args:[]},textsList:[],buttons:[]},
this.messageBoxObject={appearance:i.EnumAppearance.HIDDEN,type:n.EnumMessageboxType.INFO,title:{id:"",args:[]},text:{id:"",args:[]},textsList:[],buttons:[]},this.events$=new o.Subject,this.mqttHandler=e,this.buttonList=[]}setMessageBoxData(e,t=!0){this.setBackgroundColor(e.backgroundColor,!1),this.setIconColor(e.iconColor,!1),this.setType(e.type,!1),this.setTitle(e.title,!1),this.setTextsList(e.textList,!1),this.createButtons(e.buttons.map(e=>({buttonId:e.id,label:e.label,appearance:e.appearance}))),this.publish(t)}createButtons(e){this.buttonList.splice(0,this.buttonList.length),this.messageBoxObject.buttons.splice(0,this.messageBoxObject.buttons.length),console.log("LockMessageBox: createButtons buttonlist cleared: "+this.buttonList.length),console.log("LockMessageBox: createButtons buttonlist json cleared: "+this.messageBoxObject.buttons.length);for(let t of e)if(void 0===this.getButton(t.buttonId)){let e=new a.default(this.mqttHandler,this,t);this.buttonList.push(e),
this.messageBoxObject.buttons.push(e.getJson())}else console.error("LockMessageBox: Duplicate Button: "+t.buttonId);console.log("LockMessageBox: createButtons number of buttons: "+this.buttonList.length),console.log("LockMessageBox: createButtons json result: "+JSON.stringify(this.messageBoxObject))}removeButtons(e){console.log("LockMessageBox: removeButtons ");for(let t of e){for(let e=0;e<this.buttonList.length;e++)this.buttonList[e].getButtonId()===t&&(console.log("LockMessageBox: splice for index: "+e),this.buttonList.splice(e,1),console.log("LockMessageBox: Buttonlist buttons left: "+this.buttonList.length),e=0);console.log("LockMessageBox: Clearing json buttons");for(let e=0;e<this.messageBoxObject.buttons.length;e++){let s=this.messageBoxObject.buttons[e];if(console.log("LockMessageBox: buttonId "+s.effect.params.buttonId),s.effect.params.buttonId===t){let t=this.messageBoxObject.buttons.splice(e,1);console.log("LockMessageBox: Removed JSON Button: "+t[0]),
console.log("LockMessageBox: ButtonJSON buttons left: "+this.messageBoxObject.buttons.length),e=0}}}}publish(e=!0){let t=JSON.stringify(this.messageBoxObject),s=JSON.stringify(this.lastPublishedTabContent);e&&(t!==s&&this.messageBoxObject.appearance===i.EnumAppearance.ENABLED||this.lastPublishedTabContent.appearance===i.EnumAppearance.ENABLED&&this.messageBoxObject.appearance===i.EnumAppearance.HIDDEN)&&(this.mqttHandler.publish(E.MqttTopics.HMI_LOCK_MESSAGEBOX,t),this.lastPublishedTabContent=JSON.parse(t))}getButtonByTopic(e){for(let t of this.buttonList){if(t.getTopic().substring(t.getTopic().lastIndexOf("/")+1)===e)return t}}getButton(e){for(let t of this.buttonList)if(t.getButtonId()===e)return t}setAppearance(e,t=!0){"HIDDEN"!==e&&"ENABLED"!==e||(this.appearance=e,this.messageBoxObject.appearance=e,this.publish(t))}getAppearance(){return this.appearance}setBackgroundColor(e,t=!0){this.messageBoxObject.backgroundColor=e,this.publish(t)}getBackgroundColor(){
return this.messageBoxObject.backgroundColor}setIconColor(e,t=!0){this.messageBoxObject.iconColor=e,this.publish(t)}getIconColor(){return this.messageBoxObject.iconColor}setType(e,t=!0){this.messageBoxObject.type=e,this.publish(t)}getType(){return this.messageBoxObject.type}setTitle(e,t=!0){this.messageBoxObject.title=e,this.publish(t)}getTitle(){return this.messageBoxObject.title}setTextsList(e,t=!0){this.messageBoxObject.textsList=e,this.publish(t)}getTextsList(){return this.messageBoxObject.textsList}getText(){return this.messageBoxObject.textsList[0]}getId(){return t.LOCKMESSAGEBOX_ID}hide(){this.appearance===i.EnumAppearance.ENABLED&&(this.setAppearance(i.EnumAppearance.HIDDEN),this.events$.next({type:r.ScreenEventType.HIDE_LOCKMESSAGEBOX,id:this.getId()}))}show(){this.appearance===i.EnumAppearance.HIDDEN&&(this.setAppearance(i.EnumAppearance.ENABLED),this.events$.next({type:r.ScreenEventType.SHOW_LOCKMESSAGEBOX,id:this.getId()}))}}t.LockMessageBox=_,t.default=_},function(e,t,s){
"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(30),n=s(6),r=s(1);t.LOCK_LOADING_OVERLAY_ID="LOCK_LOADING_MODAL";t.LockLoadingOverlay=class extends i.AbstractOverlay{setText(e){this.publishContent("TEXT",JSON.stringify(e))}show(){this.publishContent("APPEARANCE",'{ "appearance":"'+a.EnumAppearance.ENABLED+'" }'),this.events$.next({type:n.ScreenEventType.SHOW_LOCKLOADINGSCREEN,id:this.getId()})}hide(){this.publishContent("TEXT",""),this.publishContent("APPEARANCE",'{ "appearance":"'+a.EnumAppearance.HIDDEN+'" }'),this.events$.next({type:n.ScreenEventType.HIDE_LOCKLOADINGSCREEN,id:this.getId()})}getMqttTopicBase(){return r.MqttTopics.HMI_LOCK_LOADING_MODAL}getId(){return t.LOCK_LOADING_OVERLAY_ID}}},function(e,t){e.exports=require("net")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTime=function(){return Math.trunc(Date.now()/1e3)}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const a=s(2),i=s(0);var n;!function(e){e.TAB_PARAMLIST="PARAMLIST",e.TAB_FIGURE="FIGURE",e.TAB_GRAPH="GRAPH",e.TAB_MENU="MENU",e.TAB_TABLE="TABLE",e.TAB_BASE=""}(n=t.EnumTabType||(t.EnumTabType={})),t.TAB_PARAMLIST_TYPE_TOPIC="topics",t.TAB_PARAMLIST_TYPE_BULK="bulk",t.isITabParamList=function(e){return e.paramType===t.TAB_PARAMLIST_TYPE_TOPIC||void 0===e.paramType},t.isITabBulkParamList=function(e){return e.paramType===t.TAB_PARAMLIST_TYPE_BULK};const r={id:"",appearance:i.EnumAppearance.HIDDEN,type:n.TAB_FIGURE,containerTitle:{id:"",args:[]},topIcon:"",title:{id:"",args:[]},topbuttons:[],imgref:{}};t.createEmptyITabFigure=function(){return a.cloneJSON(r)};const o={id:"",appearance:i.EnumAppearance.HIDDEN,type:n.TAB_PARAMLIST,displayHeader:!0,containerTitle:{id:"",args:[]},topIcon:"",title:{id:"",args:[]},topbuttons:[],params:[],paramType:t.TAB_PARAMLIST_TYPE_TOPIC};t.createEmptyITabGraph=function(){return _};const E={};t.createEmptyIGraphInterface=function(){return a.cloneJSON(E)},
t.createEmptyITabParamList=function(){return a.cloneJSON(o)};const _={id:"",appearance:i.EnumAppearance.HIDDEN,type:n.TAB_GRAPH,containerTitle:{id:"",args:[]},topIcon:"",title:{id:"",args:[]},topbuttons:[],data:{}};t.TAB_MENU_TYPE_TOPIC="topics",t.TAB_MENU_TYPE_BULK="bulk",t.isITabMenu=function(e){return e.menuType===t.TAB_MENU_TYPE_TOPIC},t.isITabBulkMenu=function(e){return e.menuType===t.TAB_MENU_TYPE_BULK};const l={id:"",appearance:i.EnumAppearance.HIDDEN,type:n.TAB_MENU,containerTitle:{id:"",args:[]},topIcon:"",title:{id:"",args:[]},topbuttons:[],menuType:t.TAB_MENU_TYPE_TOPIC,menubuttons:[],scrollToTop:!1};t.createEmptyITabMenu=function(){return a.cloneJSON(l)},t.isITabTable=function(e){return e.tableType===t.TAB_MENU_TYPE_TOPIC},t.isITabBulkTable=function(e){return e.tableType===t.TAB_MENU_TYPE_BULK}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(47),n=s(22),r=s(9),o=s(16),E=s(48),_=s(21),l=s(31),c=s(13),A=s(18)
;t.CFG_PARAMS_ASPECT="CFG_PARAMS_ASPECT",t.STATE_ASPECT_CFG_PARAM_EDIT_ENTER="STATE_ASPECT_CFG_PARAM_EDIT_ENTER",t.STATE_ASPECT_CFG_PARAM_EDIT_REENTER="STATE_ASPECT_CFG_PARAM_EDIT_REENTER";const u="STATE_ASPECT_CFG_PARAM_EDIT",T="STATE_ASPECT_CFG_PARAM_EDIT_USER_ACTION",d="STATE_ASPECT_CFG_PARAM_INSPECT",S="TASK_HANDLER_NO_PARAMETERS";t.ConfigParamsAspect=class extends o.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 r.ImmediateEvent(S)):e.addToEventQueue(new r.ImmediateEvent(u))},_onExit:function(e){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,s){s.payload===u&&this.transition(e,u),s.payload===S&&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 r.ImmediateEvent(S)):e.addToEventQueue(new r.ImmediateEvent(u))},_onExit:function(e){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,s){s.payload===u&&this.transition(e,u),s.payload===S&&this.transition(e,e.aspects[t.CFG_PARAMS_ASPECT].cfg.returnState)},"*":function(e){this.deferUntilTransition(e)}},STATE_ASPECT_CFG_PARAM_EDIT:{_onEnter:function(e){let s=e.screens[i.PARAM_LIST_SCREENID].getButton(i.FINISH_BUTTON_ID);if(void 0!==s){let i=e.aspects[t.CFG_PARAMS_ASPECT].cfg.isValidFn();s.setAppearance(i?a.EnumAppearance.ENABLED_PRIMARY:a.EnumAppearance.DISABLED)}},_onExit:function(e){},_transTo:{},_transFrom:{STATE_ASPECT_CFG_PARAM_EDIT_ENTER:function(e,s){let n=e.screens[i.PARAM_LIST_SCREENID];n.readFromTaskhandler(e.aspects[t.CFG_PARAMS_ASPECT].cfg.taskHandler),n.setShowLastVisibleCategory(!1);let r=n.getButton(i.FINISH_BUTTON_ID);if(void 0!==r){let s=e.aspects[t.CFG_PARAMS_ASPECT].cfg.isValidFn()
;r.setAppearance(s?a.EnumAppearance.ENABLED_PRIMARY:a.EnumAppearance.DISABLED)}n.show()},STATE_ASPECT_CFG_PARAM_EDIT_REENTER:function(e,s){let n=e.screens[i.PARAM_LIST_SCREENID];n.readFromTaskhandler(e.aspects[t.CFG_PARAMS_ASPECT].cfg.taskHandler),n.setShowLastVisibleCategory(!0);let r=n.getButton(i.FINISH_BUTTON_ID);if(void 0!==r){let s=e.aspects[t.CFG_PARAMS_ASPECT].cfg.isValidFn();r.setAppearance(s?a.EnumAppearance.ENABLED_PRIMARY:a.EnumAppearance.DISABLED)}n.show()}},EV_HMI_BTN_CLICKED:function(e,s){if(s.payload.buttonId===i.FINISH_BUTTON_ID&&e.aspects[t.CFG_PARAMS_ASPECT].cfg.isValidFn()&&this.transition(e,e.aspects[t.CFG_PARAMS_ASPECT].cfg.returnState),s.payload.buttonId===A.CANCEL_BUTTON_ID){const s=e.aspects[t.CFG_PARAMS_ASPECT].cfg.cancelState;c.isString(s)?this.transition(e,s):e.suspend()}},EV_HMI_PARAM_CHANGED:function(e,s){let a=e.aspects[t.CFG_PARAMS_ASPECT].updateTaskParameterGeneric(s.payload.parameter),i=[{guardFn:function(e,t){return void 0===a},nextState:""},{
guardFn:function(e,t){return void 0!==a},nextState:T}];this.myHandler(e,i,s)},EV_HMI_PARAM_DETAIL:function(e,s){e.aspects[t.CFG_PARAMS_ASPECT].inspectTaskParameter(s.payload.parameter),this.transition(e,d)}},STATE_ASPECT_CFG_PARAM_INSPECT:{_onEnter:function(e){},_onExit:function(e){},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===A.CANCEL_BUTTON_ID&&this.transition(e,u)}},STATE_ASPECT_CFG_PARAM_EDIT_USER_ACTION:{_onEnter:function(e){},_onExit:function(e){},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(e,s){if(s.payload.buttonId===A.CANCEL_BUTTON_ID)e.suspend();else{let a=e.aspects[t.CFG_PARAMS_ASPECT].handleParamUpdateUserActionGeneric(s);"boolean"==typeof a&&a&&this.transition(e,u)}}}},this.currentParamUpdateUserAction=void 0,this.isLastUserActionGenericError=!1}getId(){return t.CFG_PARAMS_ASPECT}getAspectStates(){return this.states}init(e){if(this.client=e,this.client){console.log("ConfigParamAspect::init")
;let e=new i.ParameterListScreen(this.client.mqttHandler);this.client.registerScreen(e)}else console.log("ConfigParamAspect::init - aspect not correctly initialized (no client set) - skip init")}publishParameter(e){void 0!==this.client&&this.client.screens[i.PARAM_LIST_SCREENID]&&this.client.screens[i.PARAM_LIST_SCREENID].updateParameter(e)}setCurrentParamUpdateUserAction(e){e?this.updateMessageBoxFromActionMessageAndShow(e.message):this.currentParamUpdateUserAction&&this.client.hideMsgBox(),this.currentParamUpdateUserAction=e}getCurrentParamUpdateUserAction(){return this.currentParamUpdateUserAction}updateTaskParameterGeneric(e){console.log("ConfigParamAspect: updateTaskParameterGeneric");let t=void 0;!0!==e.suppressLibRuleChecks&&(t=l.checkGeneralParamRules(e)),void 0!==t?this.isLastUserActionGenericError=!0:(this.isLastUserActionGenericError=!1,t=this.cfg.updateTaskParameterFn(e)),this.setCurrentParamUpdateUserAction(t)
;let s=this.client.screens[i.PARAM_LIST_SCREENID].getButton(i.FINISH_BUTTON_ID);return void 0!==s&&s.setAppearance(this.cfg.isValidFn()?a.EnumAppearance.ENABLED_PRIMARY:a.EnumAppearance.DISABLED),t}handleParamUpdateUserActionGeneric(e){console.log("ConfigParamsAspect: handleParamUpdateUserActionGeneric");let t=!1,s=this.getCurrentParamUpdateUserAction();return s?(this.isLastUserActionGenericError&&e.payload.buttonId===n.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 E.default(this.client.mqttHandler);t.setTitle(e.title.id,e.title.args),t.setAppearance(a.EnumAppearance.HIDDEN);let s=[];for(const t of e.params){let e=new _.default(this.client.mqttHandler,t);e.publish(),s.push(e.getPublishedId())}t.setParams(s),t.show()}parametersEmpty(){let e=this.cfg.taskHandler.getTaskGroupsAndParameters(),t=!0;for(let s of e)for(let e of s.parameters)e.appearance!==a.EnumAppearance.HIDDEN&&(t=!1);return t}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(8),i=s(0),n=s(18),r=s(2);t.PARAM_OVER_SCREENID="PARAMOVERVIEW",t.EDIT_BUTTON_ID="BTN_EDIT",t.DELETE_BUTTON_ID="BTN_DELETE",t.SAVE_BUTTON_ID="BTN_SAVE",
t.BACK_BUTTON_ID="BTN_BACK";class o extends n.ParamListBase{constructor(e){super(e),this.buttonList=[],this.title1=Object.assign({},{id:"",args:[]}),this.title2=Object.assign({},{id:"",args:[]});let s=[],a={nameId:"",label:{id:"",args:[]},appearance:i.EnumAppearance.HIDDEN,buttonId:""},o=r.cloneJSON(a);o.label.id=n.CANCEL_BUTTON_NAME,o.appearance=i.EnumAppearance.ENABLED_PRIMARY,o.buttonId=n.CANCEL_BUTTON_ID,s.push(o);let E=r.cloneJSON(a);E.label.id="_SAVE",E.buttonId=t.SAVE_BUTTON_ID,E.appearance=i.EnumAppearance.HIDDEN,s.push(E);let _=r.cloneJSON(a);_.label.id="_PREVIOUS",_.buttonId=t.BACK_BUTTON_ID,_.appearance=i.EnumAppearance.HIDDEN,s.push(_),this.createButtons(s)}createButtons(e){for(let t of e){let e=new a.Button(this.mqttHandler,this,t);this.buttonList.push(e)}}getButton(e){for(let t of this.buttonList){if(t.getButtonId()===e)return t}}setTitle1(e,t){this.title1.id===e&&this.title1.args.join()===t.join()||(this.title1.id=e,this.title1.args=t,this.publishTitle1())}
setTitle2(e,t){this.title2.id===e&&this.title2.args.join()===t.join()||(this.title2.id=e,this.title2.args=t,this.publishTitle2())}publishTitle1(){this.publishContent("TITLE1",JSON.stringify(this.title1))}publishTitle2(){this.publishContent("TITLE2",JSON.stringify(this.title2))}getTitle1(){return this.title1}getTitle2(){return this.title2}getId(){return t.PARAM_OVER_SCREENID}show(){this.createAndPublishParamsAndPage();for(let e of this.buttonList)e.getButtonId()!==n.CANCEL_BUTTON_ID&&e.show();""!==this.title1.id&&this.publishTitle1(),""!==this.title2.id&&this.publishTitle2(),super.show()}}t.ParameterOverviewScreen=o,t.default=o},function(e,t){e.exports=require("rxjs/observable/interval")},function(e,t){e.exports=require("rxjs/observable/merge")},function(e,t){e.exports=require("timers")},function(e,t){e.exports=require("machina")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.INTERNAL_SUSPEND_EVENT="_INTERNAL_SUSPEND_EVENT_",function(e){
e.SUSPEND_EVENT_TYPE_FORCED_HOME="SUSPEND_EVENT_TYPE_FORCED_HOME",e.SUSPEND_EVENT_TYPE_FORCED_LOGOUT="SUSPEND_EVENT_TYPE_FORCED_LOGOUT",e.SUSPEND_EVENT_TYPE_FORCED_AUTO_LOGOUT="SUSPEND_EVENT_TYPE_FORCED_AUTO_LOGOUT",e.SUSPEND_EVENT_TYPE_EXECFINALLY="SUSPEND_EVENT_TYPE_EXECFINALLY"}(t.INTERNAL_SUSPEND_EVENT_TYPE||(t.INTERNAL_SUSPEND_EVENT_TYPE={}));t.InternalSuspendEvent=class{constructor(e){this.payload=e,this.type=t.INTERNAL_SUSPEND_EVENT}},t.INTERNAL_RESTART_EVENT="_INTERNAL_RESTART_EVENT_",function(e){e.RESTART_EVENT_TYPE_REQUEST="RESTART_EVENT_TYPE_REQUEST",e.RESTART_EVENT_TYPE_EXECFINALLY="RESTART_EVENT_TYPE_EXECFINALLY"}(t.INTERNAL_RESTART_EVENT_TYPE||(t.INTERNAL_RESTART_EVENT_TYPE={}));t.InternalRestartEvent=class{constructor(e){this.payload=e,this.type=t.INTERNAL_RESTART_EVENT}},t.HEARTBEAT_EVENT="_FSM_HEARTBEAT_EVENT_";t.HeartbeatEvent=class{constructor(e){this.payload=e,this.type=t.HEARTBEAT_EVENT}},function(e){e.INTERNAL_ASYNC_CALL_EVENT_TYPE_SUCCESS="SUCCESS",
e.INTERNAL_ASYNC_CALL_EVENT_TYPE_FAIL="FAIL",e.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT="TIMEOUT",e.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT_WITH_FETCHING_RESP="TIMEOUT_FETCH_RESP"}(t.INTERNAL_ASYNC_CALL_EVENT_TYPE||(t.INTERNAL_ASYNC_CALL_EVENT_TYPE={})),t.INTERNAL_ASYNC_CALL_EVENT="_INTERNAL_ASYNC_CALL_EVENT_";t.InternalAsyncCallEvent=class{constructor(e){this.payload=e,this.type=t.INTERNAL_ASYNC_CALL_EVENT}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(72),i=s(11),n=s(33),r=s(27),o=s(1);var E;!function(e){e[e.AtMostOnce=0]="AtMostOnce",e[e.AtLeastOnce=1]="AtLeastOnce",e[e.ExactlyOnce=2]="ExactlyOnce"}(E=t.EnumMqttQos||(t.EnumMqttQos={}));t.MqttHandler=class{constructor(){this.mqttOptions={host:"127.0.0.1",port:1883,clientId:`qapp_${Math.random().toString(16).substring(2,8)}`,will:{topic:o.MqttTopics.QAPP_CLEANUP,payload:"",qos:1,retain:0}},this.listeningForUpdateEvent=!1,this.listeningForAdminEvent=!1,this.mqttUpdateEvent$=new i.Subject,
this.mqttAdminEvent$=new i.Subject,this.weighingNet={str:o.MqttTopics.WEIGHING_VALUE_NET,subscribe:()=>this.subscribe(o.MqttTopics.WEIGHING_VALUE_NET),unsubscribe:()=>this.unsubscribe(o.MqttTopics.WEIGHING_VALUE_NET)},this.client=a.connect(this.mqttOptions),this.startListeningForUpdateEvent(),this.startListeningForAdminEvent(),this.listOfPublishedTopics=[],this.listOfSubscribedTopics=[]}startListeningForUpdateEvent(){this.listeningForUpdateEvent||(this.client.on("message",(e,t,s)=>{let a={topic:e,value:t,packet:s};a.topic.startsWith(o.MqttTopics.QAPP_DEBUG_TOPIC_PREAMBLE)?this.mqttUpdateEvent$.next(new r.MqttUpdateDebugEvent(a)):this.mqttUpdateEvent$.next(new r.MqttUpdateEvent(a))}),this.listeningForUpdateEvent=!0)}startListeningForAdminEvent(){this.listeningForAdminEvent||(this.client.on("offline",()=>{this.mqttAdminEvent$.next(new n.MqttAdminEvent({event:"offline",message:"client is offline!"}))}),this.client.on("close",()=>{this.mqttAdminEvent$.next(new n.MqttAdminEvent({
event:"close",message:"client has disconnected!"}))}),this.client.on("reconnect",()=>{this.mqttAdminEvent$.next(new n.MqttAdminEvent({event:"reconnect",message:"client is reconnecting!"}))}),this.client.on("error",e=>{this.mqttAdminEvent$.next(new n.MqttAdminEvent({event:"error",message:"client cannot connect or a parsing error occured!",error:e}))}),this.client.on("packetsend",e=>{this.mqttAdminEvent$.next(new n.MqttAdminEvent({event:"packetsend",message:"client send packet!",packet:e}))}),this.client.on("packetreceive",e=>{this.mqttAdminEvent$.next(new n.MqttAdminEvent({event:"packetreceive",message:"client recieved packet!",packet:e}))}),this.client.on("connect",e=>{this.mqttAdminEvent$.next(new n.MqttAdminEvent({event:"connect",message:"client has successfully connected!",connack:e}))}),this.listeningForAdminEvent=!0)}publish(e,t,s,a){let i,n;"function"==typeof s?(n=s,i=void 0):(i=s,n=a);let r={qos:E.AtMostOnce,retain:!0,dup:!1};Object.assign(r,i),
"/"===e.substring(0,1)||Object.values(o.MqttTopics).includes(e)||(e="~"===e.substring(0,1)?e.substring(1):`${o.MqttTopics.QAPP_NAMESPACE}/${e}`),e.startsWith(o.MqttTopics.QAPP_NAMESPACE)&&!this.listOfPublishedTopics.includes(e)&&this.listOfPublishedTopics.push(e),this.client.publish(e,t,r,e=>{n&&n(e)})}subscribe(e,t,s){if("object"==typeof e)this.subscribe(e,(e,t)=>{s&&s(e,t)});else{"function"==typeof t&&(s=t,t=void 0);let a={qos:0};Object.assign(a,t),this.listOfSubscribedTopics.includes(e)||this.listOfSubscribedTopics.push(e),this.client.subscribe(e,a,(e,t)=>{s&&s(e,t)})}}unsubscribe(e,t){this.client.unsubscribe(e,e=>{t&&t(e)})}end(e,t){let s=!1,a=void 0;"function"==typeof e?(s=!1,a=e):"boolean"==typeof e&&(s=e,a=t),this.client.end(s,()=>{a&&a()})}removeOutgoingMessage(e){this.client.removeOutgoingMessage(e)}reconnect(e){this.client.reconnect(e)}getLastMessageId(){return this.client.getLastMessageId()}handleMessage(e,t){this.client.handleMessage(e,(e,s)=>{t(e,s)})}reconnecting(){
return this.client.reconnecting}connected(){return this.client.connected}clearPublishedTopics(){this.publish(o.MqttTopics.QAPP_CLEANUP,"");for(let e of this.listOfPublishedTopics)this.publish(e,"");this.publish(o.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});const a=s(3),i=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:[]}):a.isITextStructure(o)?l.push(o):l.push({id:o.error.name+":"+o.error.message,args:o.msgargs}),void 0!==E&&l.push(E),{type:e,title:s,textList:l,buttons:[{id:_||t.ERRORMSGBOX_OK_BTN_ID,label:{id:i.EnumFontLabels.OK,args:[]},appearance:n.EnumAppearance.ENABLED_SECONDARY}]}}},function(e,t,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.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){e.MANAGE_PROFILES="ACCESS_MANAGE_PROFILES",e.MANAGE_DEVICE_SETTINGS="ACCESS_MANAGE_DEVICE_SETTINGS",
e.MANAGE_ROLES="ACCESS_MANAGE_ROLES",e.MANAGE_ACCESS_MANAGEMENT="ACCESS_MANAGE_ACCESS_MANAGEMENT",e.MANAGE_LDAP_SETTINGS="ACCESS_MANAGE_LDAP_SETTINGS",e.MANAGE_TIMER_CONTROLLED_ACTIONS="ACCESS_MANAGE_TIMER_CONTROLLED_ACTIONS",e.MANAGE_CONNECTIONS="ACCESS_MANAGE_CONNECTIONS",e.REDIRECT_FAILED_TRANSFERS="ACCESS_REDIRECT_FAILED_TRANSFERS",e.DELETE_FAILED_TRANSFERS="ACCESS_DELETE_FAILED_TRANSFERS",e.MAINTENANCE_FIRMWARE_UPDATE="ACCESS_MAINTENANCE_FIRMWARE_UPDATE",e.MAINTENANCE_MANAGE_QAPPS="ACCESS_MAINTENANCE_MANAGE_QAPPS",e.MAINTENANCE_BACKUP_RESTORE="ACCESS_MAINTENANCE_BACKUP_RESTORE",e.MAINTENANCE_EXPORT_IMPORT="ACCESS_MAINTENANCE_EXPORT_IMPORT",e.MAINTENANCE_FACTORY_RESET="ACCESS_MAINTENANCE_FACTORY_RESET",e.UNLOCK_DEVICE="ACCESS_UNLOCK_DEVICE",e.REMOTE_VIEW="ACCESS_REMOTE_VIEW",e.REMOTE_CONTROL="ACCESS_REMOTE_CONTROL",e.MANAGE_JOBS="ACCESS_MANAGE_JOBS",e.ACCESS_AUDIT_TRAIL="ACCESS_AUDIT_TRAIL",e.ACCESS_ALIBI="ACCESS_ALIBI",e.EXECUTE_TASKS="EXECUTE_TASKS",
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",e.CREATE_UPDATE_DELETE_USER="CREATE_UPDATE_DELETE_USER",e.CREATE_UPDATE_DELETE_TASK="CREATE_UPDATE_DELETE_TASK",e.ACCESS_QAPP_CENTER="ACCESS_QAPP_CENTER",e.SETUP_MENU_ACCESS="SETUP_MENU_ACCESS"}(t.EnumUserRights||(t.EnumUserRights={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(76),i=s(41),n=s(2),r=s(4),o=s(13),E=s(0),_=s(40),l=s(55),c=s(34),A=s(5),u=s(23);function T(e){return o.isNumber(e)&&(e=e.toFixed(0)),t.DYNAMIC_PARAMID_PREQUEL+"CONFIG_SCREEN"+e}function d(e,t){o.isString(t)||(t="_"),t=t,!1!==o.isString(e)&&0!==e.length||(e=t)
;let s=new RegExp(/[^0-9A-Za-z._-]+/g),a=new RegExp(/[\/\?<>\\:\*\|"]/g),i=new RegExp(/[\x00-\x1f\x80-\x9f]/g),n=new RegExp(/^\.+$/),r=new RegExp(/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i),E=new RegExp(/[\. ]+$/);return(e=(e=(e=(e=(e=(e=e.replace(s,t)).replace(a,t)).replace(i,t)).replace(n,t)).replace(r,t)).replace(E,t)).length>255&&(e=e.substring(0,255)),e}function S(e){if(t.fs.existsSync(e))if(t.fs.lstatSync(e).isDirectory()){let a=t.fs.readdirSync(e,{encoding:"utf8",withFileTypes:!1});for(var s=0;s<a.length;s++)S(t.path.join(e,a[s]));t.fs.rmdirSync(e)}else t.fs.unlinkSync(e)}var I;function p(e){let t={title:"",header:"",value:"",automaticManipulation:I.NONE};return o.isObject(e)&&(t=Object.assign(t,e)),t}function N(e,t,s){let a={method:t,params:s},i=JSON.stringify(a),n=["http://127.0.0.1:8080/rest/"+e,"-H","Accept:application/json","-H","Content-Type:application/json","-H","Expect:","--data","@-"],o=_.spawnSync("curl",n,{input:i}),E=new r.CubisRestResponse(!1);try{
E=new r.CubisRestResponse(o)}catch(e){E.rawReturns=e}return E}function h(e,t,s){return a.__awaiter(this,void 0,void 0,function*(){let a=c;return"https"===e&&(a=l),new Promise(function(e,i){let n=a.request(t,function(t){let s=[];t.on("data",function(e){s.push(e)}),t.on("end",function(){try{e({headers:t.headers,url:t.url,statusCode:t.statusCode,body:Buffer.concat(s)})}catch(e){i(e)}})});n.on("error",function(e){i(e)}),n.on("timeout",function(){n.abort(),i("Request timeout")}),s&&n.write(s),n.end()})})}function R(e){let t={unit:u.EnumUnit.NONE,decimals:0,d:0,e:0,max:0,min:0,extended:{d:u.createQuantity(),e:u.createQuantity(),max:u.createQuantity(),min:u.createQuantity()},ranges:{1:{d:u.createQuantity(),e:u.createQuantity(),max:u.createQuantity(),min:u.createQuantity()}},activeRangeIndex:"1"};return o.isObject(e)&&o.overwriteExistingAttributes(e,t),t}t.fs=s(17),t.path=s(38),t.DYNAMIC_PARAMID_PREQUEL="TASK/DYNAMIC_",t.sortKeys=function(e){if(!1===o.isObject(e))return[];let t=[]
;t=Array.isArray(e)?e:Object.keys(e);let s=[],a=[],i=[];for(let e=0;e<t.length;e++)o.isNumber(Number(t[e]))?s.push(t[e]):o.isString(t[e])?a.push(t[e]):i.push(t[e]);return a=a.sort(),i=i.sort(),(s=(s=s.sort(function(e,t){return Number(e)-Number(t)})).concat(a)).concat(i)},t.determineNearestNumberInArray=function(e,t){for(let s=0;s<t.length;s++)if(e<t[s])return s<=0?s:e<=t[s]-(t[s]-t[s-1])/2?s-1:s;return t.length-1},t.loadWorkstate_DATA_CONTAINER=function(e){let t=void 0;if(!o.isString(e))return t;let s=N("task/management",A.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",A.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 a=[],i=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(i)){let t=parseInt(s.parameters[e].id.substring(i.length));o.isNumber(t)&&(a[t]=s.parameters[e].value.string)}try{return JSON.parse(a.join())}catch(e){return}},t.storeTaskConfig_DATA_CONTAINER=function(e,s,a){let i=e.getGroup(T(54321));if(a=!!o.isBoolean(a)&&a,void 0===i&&(e.addDynamicGroup({id:T(54321),type:E.EnumParameterTypes.PARAM_GROUP,appearance:E.EnumAppearance.HIDDEN,title:{id:"",args:[]},parameters:[]}),i=e.getGroup(T(54321))),void 0===i)return new r.CubisRestResponse(!1);i.parameters=[];let n=JSON.stringify(s),_=0,l=0;for(;_<n.length;){(l=_+1e5)>n.length&&(l=n.length);let s={id:T(54321)+"/"+t.DYNAMIC_PARAMID_PREQUEL+"DATA_CONTAINER_"+i.parameters.length.toFixed(0),type:E.EnumParameterTypes.PARAM_STRING,appearance:E.EnumAppearance.HIDDEN,title:{id:"",args:[]},header:{id:"",args:[]},
value:{string:n.substring(_,l)},info:{minimum:{length:0},maximum:{length:1e5}}};_=l,i.parameters.push(s),e.updateParameter(s)}return!1===a?N("task/management",A.RestMethodsTASK_MANAGEMENT.updateTask,{task:JSON.stringify(e.getTask()),errorList:[]}):new r.CubisRestResponse(!0)},t.get_taskConfig_paramGroupID=T,t.getCompliantFilename=d,t.checkFileNameCompliancy=function(e,t){if(d(e)!==e)return!1;t=void 0!==t?t:[];for(let s=0;s<t.length;s++)if(e.includes(t[s]))return!1;return!0},t.getCreateTaskSpecificFolder=function(e,s){let a="",n=e.getTask(),r=e.getParameter("TASK/IDENTIFICATION/NAME"),o=t.fs.readdirSync(s,{encoding:"utf8",withFileTypes:!1}),E=new i.TaskProxy,_=[];try{_=E.getTaskNamesByOrderNumber(n.qappOrderNumber)}catch(e){}for(var l=0;l<o.length;l++)if(o[l].toString().startsWith("_RENAME_TASK_ID_")&&o[l].toString().endsWith(".json")){var c=t.fs.readFileSync(t.path.join(s,o[l]),"utf8")
;(A=JSON.parse(c))&&A.taskname&&A.foldername&&!_.includes(A.taskname)&&(S(t.path.join(s,A.foldername)),S(t.path.join(s,o[l])))}else if(o[l].toString().startsWith("_TASK_"))try{E.readTask(o[l].toString().substring("_TASK_".length))}catch(e){S(t.path.join(s,o[l]))}if(null==n._id||""==n._id){let e=Date.now(),i={taskname:r.value.string,foldername:"_RENAME_TASK_ID_"+e};t.fs.writeFileSync(t.path.join(s,"_RENAME_TASK_ID_"+e+".json"),JSON.stringify(i)),a=t.path.join(s,"_RENAME_TASK_ID_"+e)}else for(a=t.path.join(s,"_TASK_"+n._id),l=0;l<o.length;l++)if(o[l].toString().startsWith("_RENAME_TASK_ID_")&&o[l].toString().endsWith(".json")){var A;c=t.fs.readFileSync(t.path.join(s,o[l]),"utf8"),(A=JSON.parse(c))&&A.taskname&&A.foldername&&A.taskname==r.value.string&&(t.fs.existsSync(t.path.join(s,A.foldername))?t.fs.existsSync(a)?(S(t.path.join(s,A.foldername)),S(t.path.join(s,o[l]))):(t.fs.renameSync(t.path.join(s,A.foldername),a),S(t.path.join(s,o[l]))):S(t.path.join(s,o[l])))}
return t.fs.existsSync(a)||t.fs.mkdirSync(a),a},t.deleteFileFolderRecursive=S,t.createFolder=function(e){t.fs.existsSync(e)||t.fs.mkdirSync(e)},function(e){e.NONE="NONE",e.INCREMENT="INCREMENT",e.DECREMENT="DECREMENT"}(I=t.EnumIdentifierAutoManipulation||(t.EnumIdentifierAutoManipulation={})),t.EnumMapIdentifierAutoManipulation={[I.NONE]:"_QAPP_LIB_PARAM_SELECT_OPTION_SID_ON",[I.INCREMENT]:"_QAPP_LIB_PARAM_SELECT_OPTION_SID_ON_AUTO_INC",[I.DECREMENT]:"_QAPP_LIB_PARAM_SELECT_OPTION_SID_ON_AUTO_DEC"},t.getLotIDsParameterID=function(e){o.isNumber(e)||(e=1),e=e;const s=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=p,t.preManipulateIdentifier=function(e){let t=p();void 0!==e&&(t=n.cloneJSON(e));let s=void 0,a=0;const i=/\d*$/,r=t.value.match(i);switch(null!=r&&r.length>0&&o.isString(r[0])&&(a=r[0].length,s=parseInt(r[0])),t.automaticManipulation){case I.INCREMENT:""===t.value?t.value="001":""===t.value||o.isNumber(s)?""!==t.value&&o.isNumber(s)&&(s++,t.value=t.value.replace(i,s.toFixed(0).padStart(a,"0"))):t.value+="-2";break;case I.DECREMENT:""!==t.value&&o.isNumber(s)&&s>0&&(s--,
t.value=t.value.replace(i,s.toFixed(0).padStart(a,"0")))}return t},t.perform_InternalWebserviceRequest=N,t.perform_WebserviceRequest=function(e,t,s,i,n,r,E,_,A,u,T){return a.__awaiter(this,void 0,void 0,function*(){o.isNumber(t)||(t="http"===s?80:443),o.isNumber(T)||(T=1e4);let a,d={hostname:e,port:t,path:n,method:i,followRedirects:!1,headers:r,timeout:T};A&&u&&(d.auth=A+":"+u),d.agent="https"===s?new l.Agent({host:e,keepAlive:!0,rejectUnauthorized:!1,port:t}):new c.Agent({keepAlive:!0}),E&&void 0!==E&&(_=JSON.stringify(E)),_&&(d.headers["content-length"]=Buffer.byteLength(_));try{a=yield h(s,d,_).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:d.hostname+d.path,metadata:n}}return a})},t.httpRequest=h,t.getConfiguredPrintProfiles=function(){let e=[];const t=N("profilemanagement",A.RestMethodsPROFILE_MANAGEMENT.getProfiles,{
filter:'[{"type":{"ne":"WEIGHING_PROFILE_NAME"}}]',rProfiles:{}});if(t.isSuccess()&&o.isString(t.rawReturns.rProfiles)){const s=JSON.parse(t.rawReturns.rProfiles.toString());for(let t=0;t<s.data.length;t++){const a=o.getObjectByID(s.data[t].params,"PROFILE/IDENTIFICATION","id");if(o.isObject(a)&&o.isObject(a.parameters)){const i=o.getObjectByID(a.parameters,"PROFILE/IDENTIFICATION/NAME","id");o.isObject(i)&&o.isObject(i.value)&&e.push({id:s.data[t]._id,type:s.data[t].type,title:i.value.string})}}}return e},t.createMetrology=R,t.getMetrology=function(e){let t=R(),s=N("weighing",A.RestMethodsWEIGHING.getParameter,{id:"WEIGHING/METROLOGY/RANGE",rObject:{}}),a="";if(s.isSuccess()&&s.hasOwnProperty("rawReturns")&&s.rawReturns.hasOwnProperty("rObject")&&(s=JSON.parse(s.rawReturns.rObject))&&s.hasOwnProperty("id")&&s.hasOwnProperty("parameters")){let e=o.getObjectByID(s.parameters,"WEIGHING/METROLOGY/RANGE/MAXIMUM");e&&(a=e.value.numbers[0])}
const i=N("weighing",A.RestMethodsWEIGHING.getRangeParameters,{parameters:{}});if(!(i.isSuccess()&&i.hasOwnProperty("rawReturns")&&i.rawReturns.hasOwnProperty("parameters")))return t;const n=JSON.parse(i.rawReturns.parameters);if(!(n.hasOwnProperty("list")&&Array.isArray(n.list)&&n.list.length>0))return t;const r=o.getObjectByID(n.list,"WEIGHING/METROLOGY/RANGES");if(!o.isObject(r))return t;t.ranges={};for(let s of Object.values(r.parameters)){if(!o.isString(s.id)||!o.isObject(s.parameters))continue;let i="";const n=s.id.split("/");if(0===(i=n[n.length-1]).length)continue;const r={d:u.createQuantity(),e:u.createQuantity(),max:u.createQuantity(),min:u.createQuantity()};let E=o.getObjectByID(s.parameters,"WEIGHING/METROLOGY/RANGES/"+i+"/INTERVAL");E&&(r.d.value=parseFloat(E.value.numbers[0]),r.d.decimals=E.value.decimals,r.d.unit=u.getUnitEnum(E.value.unit.toString())),
(E=o.getObjectByID(s.parameters,"WEIGHING/METROLOGY/RANGES/"+i+"/PRECISION"))&&(r.e.value=parseFloat(E.value.numbers[0]),r.e.decimals=E.value.decimals,r.e.unit=u.getUnitEnum(E.value.unit.toString())),(E=o.getObjectByID(s.parameters,"WEIGHING/METROLOGY/RANGES/"+i+"/MINIMUM"))&&(r.min.value=parseFloat(E.value.numbers[0]),r.min.decimals=E.value.decimals,r.min.unit=u.getUnitEnum(E.value.unit.toString())),(E=o.getObjectByID(s.parameters,"WEIGHING/METROLOGY/RANGES/"+i+"/MAXIMUM"))&&(r.max.value=parseFloat(E.value.numbers[0]),r.max.decimals=E.value.decimals,r.max.unit=u.getUnitEnum(E.value.unit.toString()),a===E.value.numbers[0]&&(t.activeRangeIndex=i)),void 0===e&&(e=r.d.unit),r.d=u.convertToTargetUnit(r.d,e),r.e=u.convertToTargetUnit(r.e,e),r.e.decimals=r.d.decimals,r.min=u.convertToTargetUnit(r.min,e),r.min.decimals=r.d.decimals,r.max=u.convertToTargetUnit(r.max,e),r.max.decimals=r.d.decimals,t.ranges[i]=r}t.extended.d.value=1/0,t.extended.e.value=1/0,t.extended.min.value=1/0,
t.extended.max.value=-1/0;for(let e of Object.values(t.ranges))e.d.value<t.extended.d.value&&(t.extended.d=e.d),e.e.value<t.extended.e.value&&(t.extended.e=e.e),e.min.value<t.extended.min.value&&(t.extended.min=e.min),e.max.value>t.extended.max.value&&(t.extended.max=e.max);return t.unit=t.extended.d.unit,t.decimals=t.extended.d.decimals,t.d=t.extended.d.value,t.e=t.extended.e.value,t.min=t.extended.min.value,t.max=t.extended.max.value,t},t.get_device_roles=function(){let e=N("user",A.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",A.RestMethodsACCESS_MANAGEMENT.getCurrentUser,{user:""});try{let s=JSON.parse(t.rawReturns.user)
;e.id=s._id;let a=o.getObjectByID(s.params,"USER/SETTINGS");e.name=o.getObjectByID(a.parameters,"USER/SETTINGS/LOGINNAME").value.string,e.display_name=o.getObjectByID(a.parameters,"USER/SETTINGS/NAME").value.string,e.description=o.getObjectByID(a.parameters,"USER/SETTINGS/DESCRIPTION").value.string,e.role_id=o.getObjectByID(a.parameters,"USER/SETTINGS/ROLES").value.selection.id,e.role_name=o.getObjectByID(a.parameters,"USER/SETTINGS/ROLES").value.selection.text.id}catch(e){}return e},t.EnumMapUnit=null,t.harmonizeWeightParam=function(e){},t.tryAssign_taskParameter_to_IQuantity=function(e,t,s){},t.tryAssign_IQuantity_to_taskParameter=function(e,t,s){}},function(e,t){e.exports=require("tslib")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(4),i=s(3),n=s(5);t.AccessControlProxy=class extends a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="access"}getCurrentUser(){let e,t
;return this.body.method=n.RestMethodsACCESS_MANAGEMENT.getCurrentUser,this.body.params={user:""},e=new a.CubisRestResponse(this.syncRequest()),t=JSON.parse(e.rawReturns.user)}getCurrentUserName(e){let t,s="";return(t=void 0!==e?e:this.getCurrentUser()).params.find(e=>"USER/SETTINGS"===e.id&&e.parameters.find(e=>"USER/SETTINGS/NAME"===e.id&&(s=e.value.string,!0))),s}getCurrentUserRoles(e){let t;t=void 0!==e?e:this.getCurrentUser();let s=i.createEmptySelectionParameter();return t.params.find(e=>"USER/SETTINGS"===e.id&&e.parameters.find(e=>"USER/SETTINGS/ROLES"===e.id&&(s=e,!0))),s}checkRightsOfCurrentUser(e){let t;return this.body.method=n.RestMethodsACCESS_MANAGEMENT.checkRightsOfCurrentUser,this.body.params={permissionGranted:!1,arrayOfRightsToCheck:e},(t=new a.CubisRestResponse(this.syncRequest())).rawReturns.permissionGranted}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(8),i=s(0),n=s(12),r=s(6),o=s(11),E=s(1);t.MESSAGEBOX_ID="MESSAGEBOX"
;class _{constructor(e){this.appearance=i.EnumAppearance.HIDDEN,this.lastPublishedTabContent={appearance:i.EnumAppearance.HIDDEN,type:n.EnumMessageboxType.INFO,title:{id:"",args:[]},text:{id:"",args:[]},textsList:[],buttons:[]},this.messageBoxObject={appearance:i.EnumAppearance.HIDDEN,type:n.EnumMessageboxType.INFO,title:{id:"",args:[]},text:{id:"",args:[]},textsList:[],buttons:[]},this.events$=new o.Subject,this.mqttHandler=e,this.buttonList=[]}setMessageBoxData(e,t=!0){this.setBackgroundColor(e.backgroundColor,!1),this.setIconColor(e.iconColor,!1),this.setType(e.type,!1),this.setTitle(e.title,!1),this.setTextsList(e.textList,!1),this.createButtons(e.buttons.map(e=>({buttonId:e.id,label:e.label,appearance:e.appearance}))),this.publish(t)}createButtons(e){this.buttonList.splice(0,this.buttonList.length),this.messageBoxObject.buttons.splice(0,this.messageBoxObject.buttons.length),console.log("MessageBox: createButtons buttonlist cleared: "+this.buttonList.length),
console.log("MessageBox: createButtons buttonlist json cleared: "+this.messageBoxObject.buttons.length);for(let t of e)if(void 0===this.getButton(t.buttonId)){let e=new a.default(this.mqttHandler,this,t);this.buttonList.push(e),this.messageBoxObject.buttons.push(e.getJson())}else console.error("MessageBox: Duplicate Button: "+t.buttonId);console.log("MessageBox: createButtons number of buttons: "+this.buttonList.length),console.log("MessageBox: createButtons json result: "+JSON.stringify(this.messageBoxObject))}removeButtons(e){console.log("MessageBox: removeButtons ");for(let t of e){for(let e=0;e<this.buttonList.length;e++)this.buttonList[e].getButtonId()===t&&(console.log("MessageBox: splice for index: "+e),this.buttonList.splice(e,1),console.log("MessageBox: Buttonlist buttons left: "+this.buttonList.length),e=0);console.log("MessageBox: Clearing json buttons");for(let e=0;e<this.messageBoxObject.buttons.length;e++){let s=this.messageBoxObject.buttons[e]
;if(console.log("MessageBox: buttonId "+s.effect.params.buttonId),s.effect.params.buttonId===t){let t=this.messageBoxObject.buttons.splice(e,1);console.log("MessageBox: Removed JSON Button: "+t[0]),console.log("MessageBox: ButtonJSON buttons left: "+this.messageBoxObject.buttons.length),e=0}}}console.log("MessageBox: Messagebox json: "+JSON.stringify(this.messageBoxObject))}publish(e=!0){let t=JSON.stringify(this.messageBoxObject),s=JSON.stringify(this.lastPublishedTabContent);e&&(t!==s&&this.messageBoxObject.appearance===i.EnumAppearance.ENABLED||this.lastPublishedTabContent.appearance===i.EnumAppearance.ENABLED&&this.messageBoxObject.appearance===i.EnumAppearance.HIDDEN)&&(this.mqttHandler.publish(E.MqttTopics.HMI_MESSAGEBOX,t),this.lastPublishedTabContent=JSON.parse(t))}getButtonByTopic(e){for(let t of this.buttonList){if(t.getTopic().substring(t.getTopic().lastIndexOf("/")+1)===e)return t}}getButton(e){for(let t of this.buttonList)if(t.getButtonId()===e)return t}
setAppearance(e,t=!0){"HIDDEN"!==e&&"ENABLED"!==e||(this.appearance=e,this.messageBoxObject.appearance=e,this.publish(t))}getAppearance(){return this.appearance}setBackgroundColor(e,t=!0){this.messageBoxObject.backgroundColor=e,this.publish(t)}getBackgroundColor(){return this.messageBoxObject.backgroundColor}setIconColor(e,t=!0){this.messageBoxObject.iconColor=e,this.publish(t)}getIconColor(){return this.messageBoxObject.iconColor}setType(e,t=!0){this.messageBoxObject.type=e,this.publish(t)}getType(){return this.messageBoxObject.type}setTitle(e,t=!0){this.messageBoxObject.title=e,this.publish(t)}getTitle(){return this.messageBoxObject.title}setTextsList(e,t=!0){this.messageBoxObject.textsList=e,this.publish(t)}getTextsList(){return this.messageBoxObject.textsList}getText(){return this.messageBoxObject.textsList[0]}getId(){return t.MESSAGEBOX_ID}hide(){this.appearance===i.EnumAppearance.ENABLED&&(this.setAppearance(i.EnumAppearance.HIDDEN),this.events$.next({
type:r.ScreenEventType.HIDE_MESSAGEBOX,id:this.getId()}))}show(){this.appearance===i.EnumAppearance.HIDDEN&&(this.setAppearance(i.EnumAppearance.ENABLED),this.events$.next({type:r.ScreenEventType.SHOW_MESSAGEBOX,id:this.getId()}))}}t.MessageBox=_,t.default=_},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(30),n=s(6),r=s(1);t.LOADING_OVERLAY_ID="LOADING_MODAL";t.LoadingOverlay=class extends i.AbstractOverlay{setText(e){this.publishContent("TEXT",JSON.stringify(e))}show(){this.publishContent("APPEARANCE",'{ "appearance":"'+a.EnumAppearance.ENABLED+'" }'),this.events$.next({type:n.ScreenEventType.SHOW_LOADINGSCREEN,id:this.getId()})}hide(){this.publishContent("TEXT",""),this.publishContent("APPEARANCE",'{ "appearance":"'+a.EnumAppearance.HIDDEN+'" }'),this.events$.next({type:n.ScreenEventType.HIDE_LOADINGSCREEN,id:this.getId()})}getMqttTopicBase(){return"~"+r.MqttTopics.HMI_LOADING_MODAL}getId(){return t.LOADING_OVERLAY_ID}}
},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(4),i=s(5);t.DeviceInformationProxy=class extends a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="deviceinformation"}getSerialNo(){let e;return this.body.method=i.RestMethodsDEVICE_INFORMATION.getSerialNoBalance,this.body.params={rString:""},(e=new a.CubisRestResponse(this.syncRequest())).isSuccess()?e.rawReturns.rString:""}getModelName(){let e;return this.body.method=i.RestMethodsDEVICE_INFORMATION.getModelName,this.body.params={rString:""},(e=new a.CubisRestResponse(this.syncRequest())).isSuccess()?e.rawReturns.rString:""}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QAppAsyncCallTimeoutErrorName="QAppAsyncCallTimeoutError";class a extends Error{constructor(e,s,i){super(),this.originalState=e,this.metadata=s,this.name=t.QAppAsyncCallTimeoutErrorName,i&&(this.stack=i),Object.setPrototypeOf(this,a.prototype),
this.message="Async call timeout."+(s?` metadata: ${s}`:"")}}t.QAppAsyncCallTimeoutError=a},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),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.MAXIMUM_LENGTH_TASK_NAME=50,t.MAXIMUM_LENGTH_TASK_DESCRIPTION=60,t.USER_INPUT_STRING_NAMES=50,t.LID_SID_USER_INPUT_STRING_VALUES=60},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(3),n=s(15),r=s(6),o=s(11),E=s(1);t.KEYBOARD_SCREEN_ID="PARAMETER_INPUT";t.KeyboardScreen=class{constructor(e,t){this.keyboardObject={appearance:a.EnumAppearance.HIDDEN,param:{}},this.events$=new o.Subject,t?(this.keyboardParam=i.createEmptySelectionParameter(),this.keyboardParam.appearance=a.EnumAppearance.HIDDEN):(this.keyboardParam=i.createEmptyStringParameter(),
this.keyboardParam.appearance=a.EnumAppearance.HIDDEN),this.keyboardObject.param=this.keyboardParam,this.mqttHandler=e}setAppearance(e){this.keyboardObject.appearance!==e&&(e!==a.EnumAppearance.HIDDEN&&e!==a.EnumAppearance.ENABLED||(this.keyboardObject.appearance=e,this.mqttHandler.publish(E.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify(this.keyboardObject))))}getAppearance(){return this.keyboardObject.appearance}publishIfEnabled(){this.keyboardObject.appearance===a.EnumAppearance.ENABLED&&this.mqttHandler.publish(E.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify(this.keyboardObject))}setParamId(e){this.keyboardObject.param.id!==e&&(this.keyboardObject.param.id=e,this.publishIfEnabled())}getParamId(){return this.keyboardObject.param.id}setParamType(e){this.keyboardObject.param.type!==e&&(this.keyboardObject.param.type=e,this.publishIfEnabled())}getParamType(){return this.keyboardObject.param.type}setParamAppearance(e){this.keyboardObject.param.appearance=e,
this.publishIfEnabled()}getParamAppearance(){return this.keyboardObject.param.appearance}checkTextStructEqual(e,t){let s=!0;return e.id!==t.id&&(s=!1),e.args.join()!==t.args.join()&&(s=!1),s}setParamTitle(e){this.checkTextStructEqual(e,this.keyboardObject.param.title)||(this.keyboardObject.param.title=e,this.publishIfEnabled())}getParamTitle(){return this.keyboardObject.param.title}setParamHeader(e){this.checkTextStructEqual(e,this.keyboardObject.param.header)||(this.keyboardObject.param.header=e,this.publishIfEnabled())}getParamHeader(){return this.keyboardObject.param.header}setParam(e){n.isEqual(this.keyboardObject.param,e)||(this.keyboardObject.param=e,this.publishIfEnabled())}getParam(){return this.keyboardObject.param}getId(){return t.KEYBOARD_SCREEN_ID}getButton(e){}hide(){this.keyboardObject.appearance===a.EnumAppearance.ENABLED&&(this.setAppearance(a.EnumAppearance.HIDDEN),this.events$.next({type:r.ScreenEventType.HIDE_OVERLAY,id:this.getId()}))}show(){
this.keyboardObject.appearance===a.EnumAppearance.HIDDEN&&(this.setAppearance(a.EnumAppearance.ENABLED),this.events$.next({type:r.ScreenEventType.SHOW_OVERLAY,id:this.getId()}))}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(52),i=s(115),n=s(87),r=s(29),o=s(10),E=s(55),_=s(34);var l;function c(e){switch(e){case 1:return l.LOGIN_NO_AUTH;case 2:return l.LOGIN_USERNAME;case 3:return l.LOGIN_USERNAME_PASSWORD;case 4:return l.LOGIN_USB_DONGLE;default:return l.LOGIN_UNKNOWN}}!function(e){e[e.LOGIN_UNKNOWN=0]="LOGIN_UNKNOWN",e[e.LOGIN_NO_AUTH=1]="LOGIN_NO_AUTH",e[e.LOGIN_USERNAME=2]="LOGIN_USERNAME",e[e.LOGIN_USERNAME_PASSWORD=3]="LOGIN_USERNAME_PASSWORD",e[e.LOGIN_USB_DONGLE=4]="LOGIN_USB_DONGLE"}(l=t.ELoginMethods||(t.ELoginMethods={})),t.resolveLoginMethod=c,t.OMNIS_ERR_CODE_LOGIN_UNAUTHORIZED=401,t.OMNIS_ERR_CODE_LOGIN_FORBIDDEN=403,t.OMNIS_ERR_CODE_LOGIN_NOT_FOUND=404,t.OMNIS_ERR_CODE_UNAUTHORIZED_REASON_INVAL_TOKEN=1,
t.OMNIS_ERR_CODE_UNAUTHORIZED_REASON_WRONG_UN=2,t.OMNIS_ERR_CODE_UNAUTHORIZED_REASON_USER_INACTIVE=3,t.OMNIS_ERR_CODE_UNAUTHORIZED_REASON_NEW_PWD=4,t.OMNIS_ERR_CODE_UNAUTHORIZED_REASON_MISS_RIGHTS=5,t.OMNIS_ERR_CODE_UNAUTHORIZED_REASON_BLOCKED=6,t.OMNIS_ERR_CODE_LOGOUT_UNAUTHORIZED=401,t.OMNIS_ERR_CODE_AUTHENTICATE_UNAUTHORIZED=401,t.OMNIS_ERR_CODE_AUTHENTICATE_FORBIDDEN=403,t.OMNIS_ERR_CODE_GET_SAMPLE_LISTS_UNAUTHORIZED=401,t.OMNIS_ERR_CODE_GET_SAMPLES_UNAUTHORIZED=401,t.OMNIS_ERR_CODE_GET_SAMPLES_NOT_FOUND=404,t.OMNIS_ERR_CODE_GET_SUBSAMPLES_UNAUTHORIZED=401,t.OMNIS_ERR_CODE_GET_SUBSAMPLES_NOT_FOUND=404,t.OMNIS_ERR_CODE_SEND_SUBSAMPLE_WEIGHT_BAD_REQUEST=400,t.OMNIS_ERR_CODE_SEND_SUBSAMPLE_WEIGHT_UNAUTHORIZED=401,t.OMNIS_ERR_CODE_SEND_SUBSAMPLE_WEIGHT_NOT_FOUND=404,t.OMNIS_ERR_CODE_SEND_SUBSAMPLE_WEIGHT_CONFLICT=409,t.OMNIS_ERR_CODE_SEND_SUBSAMPLE_RACKINFO_BAD_REQUEST=400,t.OMNIS_ERR_CODE_SEND_SUBSAMPLE_RACKINFO_UNAUTHORIZED=401,t.OMNIS_ERR_CODE_SEND_SUBSAMPLE_RACKINFO_NOT_FOUND=404,
t.OMNIS_ERR_CODE_SEND_SUBSAMPLE_RACKINFO_CONFLICT=409,t.OMNIS_ERR_CODE_GET_REQUESTS_UNAUTHORIZED=401,t.OMNIS_ERR_CODE_SEND_REQUEST_WEIGHT_BAD_REQUEST=400,t.OMNIS_ERR_CODE_SEND_REQUEST_UNAUTHORIZED=401,t.OMNIS_ERR_CODE_SEND_REQUEST_REQUEST_NOT_FOUND=404;function A(e){console.log("OmnisProxy:createError: try to detect OMNIS specific error data in HTTP response");try{let t=JSON.parse(e.body.toString());if(console.log("OmnisProxy:createError: JSON parsed... check content"),u(t))return console.log("OmnisProxy:createError: detected..."),console.log("OmnisProxy:createError: "+o.inspect(t)),new n.OmnisResponseError(t);console.log("OmnisProxy:createError: not detected..."),console.log("OmnisProxy:createError: body as JSON: "+o.inspect(t))}catch(t){console.log("OmnisProxy:createError: not detected..."),console.log("OmnisProxy:createError: body: "+e.body.toString())}console.log("OmnisProxy:createError: create generic HttpRestError");let t=e.body.toString()
;return new a.HttpRestError(`Server responded with status code ${e.statusCode}: ${t}\n`,e.statusCode,e.headers,e.body)}function u(e){try{return"object"==typeof e&&e.hasOwnProperty("error")&&e.error.hasOwnProperty("status")}catch(e){}return!1}t.OmnisProxy=class{constructor(){this.agents=new Map}getAgent(e){let t=new r.URL(e),s=`${t.protocol}__${t.hostname}__${t.port}`,a=this.agents.get(s);if(void 0===a){if("https"===t.protocol||"https:"===t.protocol){console.log("StarlimsProxy::create new https agent for: "+t.hostname);let e={host:t.hostname,keepAlive:!0,rejectUnauthorized:!1};t.port&&(e.port=parseInt(t.port,10)),a=new E.Agent(e)}else{console.log("StarlimsProxy::create new http agent for: "+t.hostname);let e={host:t.hostname,keepAlive:!0};t.port&&(e.port=parseInt(t.port,10)),a=new _.Agent(e)}this.agents.set(s,a)}return a}asyncRequest(e,t,s,a,n){let r=this.getAgent(t);return i.default(e,t,{json:a,headers:s,agent:r}).then(e=>{let t=e.body.toString("utf8");if(200!==e.statusCode)throw A(e)
;try{console.log("OmnisProxy: try JSON parsing response: "+t);let e=JSON.parse(t,n);return console.log("OmnisProxy: parsed: "+o.inspect(e)),e}catch(e){return console.log("OmnisProxy: failed - return raw body: "+t),t}})}login(e,t,s="",n=""){console.log(`OmnisProxy::login(): ${e.systemName}`);let r={systemId:e.systemId,serialNumber:t};switch(e.loginMode){case l.LOGIN_NO_AUTH:case l.LOGIN_USB_DONGLE:break;case l.LOGIN_USERNAME:r.userName=s;break;case l.LOGIN_USERNAME_PASSWORD:r.userName=s,r.password=n}let E=`${e.baseURL}/system/login`,_=this.getAgent(E);return i.default("POST",E,{json:r,headers:{Accept:"application/json","Content-Type":"application/json"},agent:_}).then(e=>{if(200!==e.statusCode)throw A(e);let t;try{console.log("OmnisProxy::login: try extract accesstoken"),t=JSON.parse(e.body.toString())}catch(t){throw new a.HttpRestError("Server responded with non JSON response\n",e.statusCode,e.headers,e.body)}
if(void 0===t.authResponse.omnisAccessToken||0===t.authResponse.omnisAccessToken.length)throw new a.HttpRestError("Server responded without access token\n",e.statusCode,e.headers,e.body);return console.log("OmnisProxy::login got response: "+o.inspect(t)),t})}logout(e){return console.log(`OmnisProxy::logout(): ${e.systemName}`),this.asyncRequest("POST",`${e.baseURL}/system/logout`,{Accept:"application/json",accesstoken:e.accessToken},{})}authenticate(e,t){return console.log(`OmnisProxy::authenticate(): ${e.systemName}`),this.asyncRequest("POST",`${e.baseURL}/system/authenticate`,{Accept:"application/json",accesstoken:e.accessToken},t)}getSystemStatus(e){return console.log(`OmnisProxy::getSystemStatus(): ${e.systemName}`),this.asyncRequest("GET",`${e.baseURL}/system/status`,{Accept:"application/json"},{},(e,t)=>{let s;return s="loginMode"===e?c(t):t,console.log("rivive: "+e+": "+t+" -> "+s),s})}getSampleLists(e){return console.log(`OmnisProxy::getSampleLists(): ${e.systemName}`),
this.asyncRequest("GET",`${e.baseURL}/samplelists`,{Accept:"application/json",accesstoken:e.accessToken},{},(e,t)=>"modificationDate"===e?new Date(t):t)}getSamples(e,t){return console.log(`OmnisProxy::getSamples(): ${e.systemName}`),this.asyncRequest("GET",`${e.baseURL}/samplelists/${t.id}/samples`,{Accept:"application/json",accesstoken:e.accessToken},{})}getSubSamples(e,t,s){return console.log(`OmnisProxy::getSubSamples(): ${e.systemName}`),this.asyncRequest("GET",`${e.baseURL}/samplelists/${t.id}/samples/${s.id}/subsamples`,{Accept:"application/json",accesstoken:e.accessToken},{})}sendSubSampleWeight(e,t,s){return console.log(`OmnisProxy::sendSubSampleWeight(): ${e.systemName}`),this.asyncRequest("POST",`${e.baseURL}/subsamples/${t}/weight`,{"Content-Type":"application/json",accesstoken:e.accessToken},s)}sendSubSampleRackInfo(e,t,s){return console.log(`OmnisProxy::sendSubSampleRackInfo(): ${e.systemName}`),this.asyncRequest("POST",`${e.baseURL}/subsamples/${t}/rack`,{
"Content-Type":"application/json",accesstoken:e.accessToken},s)}getRequests(e){return console.log(`OmnisProxy::getRequests(): ${e.systemName}`),this.asyncRequest("GET",`${e.baseURL}/requests`,{"Content-Type":"application/json",accesstoken:e.accessToken},{})}sendRequest(e,t,s){return console.log(`OmnisProxy::sendRequest(): ${e.systemName}`),this.asyncRequest("POST",`${e.baseURL}/requests/${t}/weight`,{"Content-Type":"application/json",accesstoken:e.accessToken},s)}},t.createError=A,t.isOmnisHttpRestErrorDetails=u},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(97),i=s(99),n=s(100),r=s(20),o=s(101),E=s(102),_="SCREENS/",l="/TABLIST",c="/REQUESTEDTAB",A="/QAPP/";class u{constructor(e,t){this.tabScreenTablistObject=[],this.tabScreenRequestedObject="",this.tabList=[],this.mqttHandler=e,this.screenId=t,this.tabScreenTopic=_+this.screenId,this.tabScreenTablistTopic=this.tabScreenTopic+l,this.tabScreenRequestedTopic=this.tabScreenTopic+c}
publishTabList(){this.mqttHandler.publish(this.tabScreenTablistTopic,JSON.stringify(this.tabScreenTablistObject))}publishRequestedTab(){this.mqttHandler.publish(this.tabScreenRequestedTopic,JSON.stringify(this.tabScreenRequestedObject))}static createFigureTab(e,t,s,i,n){return s.topbuttons=void 0!==n?u.sortTopButtons(n):s.topbuttons,new a.TabFigure(s,e,t,i)}addFigureTab(e,t,s){t.id=e;let a=u.createFigureTab(this.mqttHandler,this.screenId,t,!1,s);return this.tabScreenTablistObject.push(A+a.publishId()),this.tabList.push(a),a}static createGraphTab(e,t,s,a,n){return s.topbuttons=void 0!==n?u.sortTopButtons(n):s.topbuttons,new i.TabGraph(s,e,t,a)}addGraphTab(e,t,s){t.id=e;let a=u.createGraphTab(this.mqttHandler,this.screenId,t,!1,s);return this.tabScreenTablistObject.push(A+a.publishId()),this.tabList.push(a),a}static createParamListTab(e,t,s,a,i){return s.topbuttons=void 0!==i?u.sortTopButtons(i):s.topbuttons,new n.TabParamList(s,e,t,a)}addParamListTab(e,t,s){t.id=e
;let a=u.createParamListTab(this.mqttHandler,this.screenId,t,!1,s);return this.tabScreenTablistObject.push(A+a.publishId()),this.tabList.push(a),a}static createMenuTab(e,t,s,a,i){return s.topbuttons=void 0!==i?u.sortTopButtons(i):s.topbuttons,new o.TabMenu(s,e,t,a)}static createTableTab(e,t,s,a,i){return s.topbuttons=void 0!==i?u.sortTopButtons(i):s.topbuttons,new E.TabTable(s,e,t,a)}addMenuTab(e,t,s){t.id=e;let a=u.createMenuTab(this.mqttHandler,this.screenId,t,!1,s);return this.tabScreenTablistObject.push(A+a.publishId()),this.tabList.push(a),a}addTableTab(e,t,s){t.id=e;let a=u.createTableTab(this.mqttHandler,this.screenId,t,!1,s);return this.tabScreenTablistObject.push(A+a.publishId()),this.tabList.push(a),a}getTab(e){let t=void 0;for(let s of this.tabList)s.getTabId()===e&&(t=s);return t}getTabList(){return this.tabList}clearTabList(){this.tabList.splice(0,this.tabList.length),this.tabScreenTablistObject.splice(0,this.tabScreenTablistObject.length)}requestTab(e){
void 0!==this.getTab(e)&&(this.tabScreenRequestedObject=e,this.publishRequestedTab())}static sortTopButtons(e){return e.sort((e,t)=>r.getButtonPriority(e.getButtonId())-r.getButtonPriority(t.getButtonId())).map(e=>`/QAPP/${e.getTopic()}`)}}t.TabApi=u},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(16),i=s(83),n=s(21),r=s(0),o=s(9),E=s(37),_=s(7),l=s(12),c=s(82),A=s(15),u=s(22),T=s(31),d=s(2),S=s(3);t.IDENTIFIER_ASPECT="IDENTIFIER_ASPECT",t.STATE_ASPECT_IDENTIFIER_PREFIX="STATE_ASPECT_IDENTIFIER",t.STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT=t.STATE_ASPECT_IDENTIFIER_PREFIX+"_ENTER_LOT_INPUT",t.STATE_ASPECT_IDENTIFIER_ENTER_SID_INPUT=t.STATE_ASPECT_IDENTIFIER_PREFIX+"_ENTER_SID_INPUT";const I=t.STATE_ASPECT_IDENTIFIER_PREFIX+"_LOT_INPUT_DO",p=t.STATE_ASPECT_IDENTIFIER_PREFIX+"_SID_INPUT_DO";t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE=c.LID_SID_USER_INPUT_STRING_VALUES,t.IDENTIFIER_MAX_LENGTH_LID_SID_NUMBER_VALUE=15;const N=0,h="-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 R="PARAM_ID_RT_LOT",m="PARAM_ID_RT_SID",O="PARAM_ID_RT_IDENTIFIER_INP";class g extends a.AbstractQAppAspect{constructor(){super(),this.states={STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT:{_onEnter:function(e){let s=e.aspects[t.IDENTIFIER_ASPECT];s.inputIdx=0,s.evalLotInput()?(console.log("IdentifierAspect - at least one (more) LID configured"),e.addToEventQueue(new o.ImmediateEvent({from:t.STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT,to:I}))):(console.log("IdentifierAspect - no (further) LIDs configured"),e.addToEventQueue(new o.ImmediateEvent({from:t.STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT,to:s.cfg.returnState})))},_onExit:function(e){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,s){
s.payload.from===t.STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT&&this.transition(e,s.payload.to)}},STATE_ASPECT_IDENTIFIER_LOT_INPUT_DO:{_onEnter:function(e){},_onExit:function(e){e.screens[i.KEYBOARD_SCREEN_ID].hide()},_transTo:{},_transFrom:{},EV_HMI_PARAM_CHANGED:function(e,s){console.log("IdentifierAspect - param change in STATE_ASPECT_IDENTIFIER_LOT_INPUT_DO");let a=e.aspects[t.IDENTIFIER_ASPECT];if(s.payload.parameter.id===O+a.inputIdx){let t=T.checkGeneralParamRules(s.payload.parameter),n=s.payload.parameter.value.string;void 0===t?(a.setLotID(a.inputIdx,n),a.inputIdx++,a.evalLotInput()||(console.log("IdentifierAspect - no (further) LIDs configured"),this.transition(e,a.cfg.returnState))):(e.showMessageBox(t.message),a.sPIn_4_identifier.value.string=n,a.client.screens[i.KEYBOARD_SCREEN_ID].setParam(a.sPIn_4_identifier))}},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===u.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:p}))):(console.log("IdentifierAspect - no (further) SIDs configured"),e.addToEventQueue(new o.ImmediateEvent({from:t.STATE_ASPECT_IDENTIFIER_ENTER_SID_INPUT,to:s.cfg.returnState})))},_onExit:function(e){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,s){s.payload.from===t.STATE_ASPECT_IDENTIFIER_ENTER_SID_INPUT&&this.transition(e,s.payload.to)}},STATE_ASPECT_IDENTIFIER_SID_INPUT_DO:{_onEnter:function(e){},_onExit:function(e){e.screens[i.KEYBOARD_SCREEN_ID].hide();let s=e.aspects[t.IDENTIFIER_ASPECT];s.cfg.autoRememberSIDs&&(s.sIDsPrevSample=s.sIDs)},_transTo:{},_transFrom:{},EV_HMI_PARAM_CHANGED:function(e,s){console.log("IdentifierAspect - param change in STATE_ASPECT_IDENTIFIER_SID_INPUT_DO");let a=e.aspects[t.IDENTIFIER_ASPECT]
;if(s.payload.parameter.id===O+a.inputIdx){let t=T.checkGeneralParamRules(s.payload.parameter),n=s.payload.parameter.value.string;if(void 0===t){a.setSID(a.inputIdx,n);let t=g.getSIDState(a.inputIdx,a.getTaskHandler());if(t===E.EnumSampleIdentifierOptions.ON_AUTO_INC||t===E.EnumSampleIdentifierOptions.ON_AUTO_DEC){let r=t===E.EnumSampleIdentifierOptions.ON_AUTO_INC,o=M(r,s.payload.parameter.value.string);o.success?this.transition(e,a.sIdInputDone()):(a.sPIn_4_identifier.value.string=n,a.client.screens[i.KEYBOARD_SCREEN_ID].setParam(a.sPIn_4_identifier),a.client.showMessageBox(L(r,o.result,!0)))}else this.transition(e,a.sIdInputDone())}else e.showMessageBox(t.message),a.sPIn_4_identifier.value.string=n,a.client.screens[i.KEYBOARD_SCREEN_ID].setParam(a.sPIn_4_identifier)}},EV_HMI_BTN_CLICKED:function(e,s){let a=e.aspects[t.IDENTIFIER_ASPECT];s.payload.buttonId===t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_OK?(e.screens[i.KEYBOARD_SCREEN_ID].show(),
e.hideMsgBox()):s.payload.buttonId===u.ParamUpdateUserActionSimpleAccept_OK_BUTTON_ID?e.hideMsgBox():s.payload.buttonId===t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_YES?(e.hideMsgBox(),this.transition(e,a.sIdInputDone())):s.payload.buttonId===t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_NO&&e.hideMsgBox()}}},this.sP_4_lotA=[],this.sP_4_sidA=[],this.lotIDs=[],this.sIDs=[],this.sIDsPrevSample=void 0,this.inputIdx=0,this.cfgGroupCnt=void 0,this.cfgGroupLID=void 0,this.cfgGroupSID=void 0,this.sPIn_4_identifier=S.createEmptyStringParameter()}getId(){return t.IDENTIFIER_ASPECT}getAspectStates(){return this.states}static getConfiguredLIDCount(e){let t=e.getParameter(E.TASK_DYNAMIC_ID_LID_CNT_PARAM_ID);return void 0!==t?E.getConfiguredIds(t):0}static getConfiguredSIDCount(e){let t=e.getParameter(E.TASK_DYNAMIC_ID_SID_CNT_PARAM_ID);return void 0!==t?E.getConfiguredIds(t):0}static createLIDParams(e,s,a){let i=[],o=g.getConfiguredLIDCount(a)
;console.log("IdentifierAspect::createLIDParams: create params for "+o+" LIDs");for(let _=1;_<=o;_++){let o=a.getParameter(E.createLIDParamId(_,E.TASK_DYNAMIC_ID_LID_X_PARAM_ID_SUFFIX_TITLE)),l=a.getParameter(E.createLIDParamId(_,E.TASK_DYNAMIC_ID_LID_X_PARAM_ID_SUFFIX_HEADER)),c=S.createEmptyStringParameter();c.id=R+_+(e?"_"+e:""),c.appearance=r.EnumAppearance.HIDDEN,c.title={id:o.value.string,args:[]},c.header={id:l.value.string,args:[]},c.info={minimum:{length:0},maximum:{length:t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE}},i.push(new n.default(s,c))}return i}static createSIDParams(e,s,a){let i=[],o=g.getConfiguredSIDCount(a);console.log("IdentifierAspect::createSIDParams: create params for "+o+" SIDs");for(let _=1;_<=o;_++){let o=a.getParameter(E.createSIDParamId(_,E.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_TITLE)),l=a.getParameter(E.createSIDParamId(_,E.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_HEADER)),c=S.createEmptyStringParameter();c.id=m+_+(e?"_"+e:""),
c.appearance=r.EnumAppearance.HIDDEN,c.title={id:o.value.string,args:[]},c.header={id:l.value.string,args:[]},c.info={minimum:{length:0},maximum:{length:t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE}},i.push(new n.default(s,c))}return i}init(e){if(this.client=e,this.client){if(console.log("IdentifierAspect::init"),!this.client.screens[i.KEYBOARD_SCREEN_ID]){let e=new i.KeyboardScreen(this.client.mqttHandler);this.client.registerScreen(e)}this.sPIn_4_identifier=S.createEmptyStringParameter(),this.sPIn_4_identifier.id=O,this.sPIn_4_identifier.appearance=r.EnumAppearance.ENABLED,this.sPIn_4_identifier.title={id:"",args:[]},this.sPIn_4_identifier.header={id:"",args:[]},this.sPIn_4_identifier.info={isNoValueAllowed:!0,minimum:{length:0},maximum:{autoCut:!1,length:t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE}}}else console.log("IdentifierAspect::init - aspect not correctly initialized (no client set) - skip init")}configure(e){super.configure(e),
void 0===this.cfg.showPreviouslySetLIDs&&(this.cfg.showPreviouslySetLIDs=!1);let t=this.getTaskHandler().getGroup(E.TASK_DYNAMIC_ID_CNT_GROUP_ID),s=this.getTaskHandler().getGroup(E.TASK_DYNAMIC_ID_LID_GROUP_ID),a=this.getTaskHandler().getGroup(E.TASK_DYNAMIC_ID_SID_GROUP_ID);console.log("IdentifierAspect::configure"),A.isEqual(this.cfgGroupCnt,t)&&A.isEqual(this.cfgGroupLID,s)&&A.isEqual(this.cfgGroupSID,a)?console.log("IdentifierAspect::configure: no content update of taskHandler - keep params for IDs"):(console.log("IdentifierAspect::configure: update of taskHandler - create params for IDs"),this.cfgGroupCnt=d.cloneJSON(t),this.cfgGroupLID=d.cloneJSON(s),this.cfgGroupSID=d.cloneJSON(a),t&&s&&a&&(console.log("IdentifierAspect::configure - create LID params"),this.sP_4_lotA=g.createLIDParams("",this.client.mqttHandler,this.getTaskHandler()),this.sP_4_lotA.forEach(e=>{e.publish()}),console.log("IdentifierAspect::configure - create SID params"),
this.sP_4_sidA=g.createSIDParams("",this.client.mqttHandler,this.getTaskHandler()),this.sP_4_sidA.forEach(e=>{e.publish()})))}getTaskHandler(){return this.cfg.taskHandler}getLotVisualParams(){return this.sP_4_lotA}getSIDVisualParams(){return this.sP_4_sidA}prepLotInput(e){this.client.screens[i.KEYBOARD_SCREEN_ID].hide(),this.sPIn_4_identifier.id=O+e,this.sPIn_4_identifier.title=this.sP_4_lotA[this.inputIdx].getValue().title,this.sPIn_4_identifier.header=this.sP_4_lotA[this.inputIdx].getValue().header,this.sPIn_4_identifier.info.maximum.length=t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE,this.cfg.showPreviouslySetLIDs?this.sPIn_4_identifier.value.string=void 0!==this.lotIDs[e]?this.lotIDs[e]:"":this.sPIn_4_identifier.value.string="",console.log("IdentifierAspect::prepLotInput - prepare input of: "+JSON.stringify(this.sPIn_4_identifier.header)),this.client.screens[i.KEYBOARD_SCREEN_ID].setParam(this.sPIn_4_identifier),this.client.screens[i.KEYBOARD_SCREEN_ID].show()}prepSidInput(e,s,a){
if(this.client.screens[i.KEYBOARD_SCREEN_ID].hide(),this.sPIn_4_identifier.id=O+e,this.sPIn_4_identifier.title=this.sP_4_sidA[e].getValue().title,this.sPIn_4_identifier.header=this.sP_4_sidA[e].getValue().header,this.sPIn_4_identifier.info.maximum.length=t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE,!s.length||0===s.length)switch(g.getSIDState(e,this.getTaskHandler())){case E.EnumSampleIdentifierOptions.ON_AUTO_INC:case E.EnumSampleIdentifierOptions.ON_AUTO_DEC:this.sPIn_4_identifier.info.maximum.length=t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE}this.sPIn_4_identifier.value.string=s,console.log("IdentifierAspect::prepSidInput - prepare input of: "+JSON.stringify(this.sPIn_4_identifier.header)),this.client.screens[i.KEYBOARD_SCREEN_ID].setParam(this.sPIn_4_identifier),a&&this.client.screens[i.KEYBOARD_SCREEN_ID].show()}static updateAndPublishIDParamStatic(e,t){t&&t.length>0?(e.getValue().value.string=t,e.getValue().appearance=r.EnumAppearance.ENABLED):(e.getValue().value.string="",
e.getValue().appearance=r.EnumAppearance.HIDDEN),e.publish()}static setLotIDsStatic(e,t){for(let s=0;s<t.length;s++)this.updateAndPublishIDParamStatic(t[s],e[s])}setLotIDs(e){this.lotIDs=e,g.setLotIDsStatic(this.lotIDs,this.sP_4_lotA)}setLotID(e,t){this.lotIDs[e]=t,g.updateAndPublishIDParamStatic(this.sP_4_lotA[e],this.lotIDs[e])}static setSIDsStatic(e,t){for(let s=0;s<t.length;s++)g.updateAndPublishIDParamStatic(t[s],e[s])}setSIDs(e,t){this.sIDs=e,this.cfg.autoRememberSIDs||(this.sIDsPrevSample=t),g.setSIDsStatic(this.sIDs,this.sP_4_sidA)}isPreviouSampleIdsPresent(){return void 0!==this.sIDsPrevSample&&void 0!==this.sIDsPrevSample[this.inputIdx]}setSID(e,t){this.sIDs[e]=t,g.updateAndPublishIDParamStatic(this.sP_4_sidA[e],this.sIDs[e])}static getLotState(e,t){let s=E.EnumLotIdentifierOptions.OFF,a=t.getParameter(E.TASK_DYNAMIC_ID_LID_CNT_PARAM_ID);return e>=0&&e<E.getConfiguredIds(a)&&(s=E.EnumLotIdentifierOptions.ON),console.log("IdentifierAspect::getLotState for idx:"+e+" -> "+s),s}
static getSIDState(e,t){let s=e+1,a=E.EnumSampleIdentifierOptions.OFF,i=t.getParameter(E.TASK_DYNAMIC_ID_SID_CNT_PARAM_ID);return e>=0&&e<E.getConfiguredIds(i)&&(a=t.getParameter(E.createSIDParamId(s,E.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_MODE)).value.selection.id),a}static getIdxFirstEnabledSID(e){let t=e.getParameter(E.TASK_DYNAMIC_ID_SID_CNT_PARAM_ID);return E.getConfiguredIds(t)>0?0:NaN}evalLotInput(){let e=this.getTaskHandler().getParameter(E.TASK_DYNAMIC_ID_LID_CNT_PARAM_ID);for(let t=this.inputIdx;t<E.getConfiguredIds(e);t++)return this.inputIdx=t,this.prepLotInput(this.inputIdx),!0;return!1}evalSidInput(){console.log("IdentifierAspect - evalSidInput");let e=this.getTaskHandler().getParameter(E.TASK_DYNAMIC_ID_SID_CNT_PARAM_ID);for(let t=this.inputIdx;t<E.getConfiguredIds(e);t++){console.log("IdentifierAspect - evalSidInput: loop:"+t);let e=g.getSIDState(t,this.getTaskHandler())
;if(e===E.EnumSampleIdentifierOptions.ON)return console.log("IdentifierAspect - request input for SID idx:"+t),this.inputIdx=t,this.prepSidInput(this.inputIdx,this.sIDsPrevSample&&this.sIDsPrevSample[this.inputIdx]?this.sIDsPrevSample[this.inputIdx]:"",!0),!0;if(e===E.EnumSampleIdentifierOptions.ON_AUTO_INC||e===E.EnumSampleIdentifierOptions.ON_AUTO_DEC){this.inputIdx=t;let s=e===E.EnumSampleIdentifierOptions.ON_AUTO_INC;if(this.sIDsPrevSample&&void 0!==this.sIDsPrevSample[this.inputIdx]){console.log("IdentifierAspect - AutoInc/Dec for SID idx:"+this.inputIdx);let e=M(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(L(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 P;function M(e,s,a=t.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE){console.log("IdentifierAspect - AutoInc/Dec, not first sample > check for number");let i=s.match("^\\d*$");if(i&&void 0!==i[0]){let s;if(console.log("IdentifierAspect - AutoInc, not first sample > inc number"),""===i[0]){if(s=0,!e)return{success:!1,result:{id:P.NONUMBERFOUND,args:[]}}}else{if(i[0].length>t.IDENTIFIER_MAX_LENGTH_LID_SID_NUMBER_VALUE)return{success:!1,result:{id:P.NUMBERTOOLARGE,args:[]}};s=parseInt(i[0],10)}if(e)s++;else{
if(!(s>N))return{success:!1,result:{id:P.LOWERBOUNDARY,args:[]}};s--}let n=s.toFixed(0);return n.length>a?{success:!1,result:{id:P.SIDTOOLARGE,args:[a.toString()]}}:{success:!0,result:n}}{let i=s.match("(.*[\\-_.#\\s])(\\d*)$");if(i&&void 0!==i[2]){let s;if(console.log("IdentifierAspect - AutoInc/Dec, not first sample > inc/dec suffix"),""===i[2]){if(s=0,!e)return{success:!1,result:{id:P.NONUMBERFOUND,args:[]}}}else{if(i[2].length>t.IDENTIFIER_MAX_LENGTH_LID_SID_NUMBER_VALUE)return{success:!1,result:{id:P.NUMBERTOOLARGE,args:[]}};s=parseInt(i[2],10)}if(e)s++;else{if(!(s>N))return{success:!1,result:{id:P.LOWERBOUNDARY,args:[]}};s--}let n=i[1]+s.toFixed();return n.length>a?{success:!1,result:{id:P.SIDTOOLARGE,args:[a.toString()]}}:{success:!0,result:n}}if(console.log("IdentifierAspect - AutoInc, not first sample > add suffix"),e){let e=s+h;return e.length>a?{success:!1,result:{id:P.SIDTOOLARGE,args:[a.toString()]}}:{success:!0,result:e}}return{success:!1,result:{id:P.NOSEPARATORFOUND,
args:[]}}}}function L(e,s,a=!1){let i=[],n=[];return e?a?i.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_WARNING_FOR_NEXT_SID",args:[]}):i.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_WARNING",args:[]}):a?i.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING_FOR_NEXT_SID",args:[]}):i.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING",args:[]}),i.push(s),a&&i.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_DEC_WARNING_CONTINUE",args:[]}),n=a?[{id:t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_YES,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:r.EnumAppearance.ENABLED_SECONDARY},{id:t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_NO,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},appearance:r.EnumAppearance.ENABLED_SECONDARY}]:[{id:t.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_OK,label:{id:_.EnumFontLabels.OK,args:[]},appearance:r.EnumAppearance.ENABLED_SECONDARY}],{type:l.EnumMessageboxType.WARNING,title:{
id:"_QAPP_LIB_MBOX_TITLE_IDENTIFIER_AUTO_INC_DEC_WARNING",args:[]},textList:i,buttons:n}}t.IdentifierAspect=g,function(e){e.NUMBERTOOLARGE="_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_DEC_WARNING_NO_TOO_LARGE",e.LOWERBOUNDARY="_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING_LOWER_BOUNDARY",e.SIDTOOLARGE="_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_DEC_WARNING_SID_TOO_LARGE",e.NOSEPARATORFOUND="_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING_NO_SEPARATOR_FOUND",e.NONUMBERFOUND="_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING_NO_NUMBER_FOUND"}(P=t.IncreaseDecreaseFailEnum||(t.IncreaseDecreaseFailEnum={})),t.increaseDecreaseId=M,t.getWarningNoIdChange=L},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OmnisResponseErrorName="OmnisResponseError";class a extends Error{constructor(e){super(),this.details=e,this.name=t.OmnisResponseErrorName,Object.setPrototypeOf(this,a.prototype),this.message=this.getI18NMessage(void 0)}getI18NMessage(e){
let t=`${this.details.error.status}`;return void 0!==this.getReason()&&(t+=` (reason: ${this.getReason()})`),t+=": ",this.details.error.hasOwnProperty("details")?t+=this.details.error.details:t+="Error during processing the request. No further information.",t}getStatus(){return this.details.error.status}getReason(){return this.details.error.reason}getDetailsRaw(){return this.details}}t.OmnisResponseError=a,t.isOmnisResponseError=function(e){return"object"==typeof e&&e.name===t.OmnisResponseErrorName}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(117),i=s(15),n=s(89),r=s(13);var o,E,_;!function(e){e.DATE_FORMAT_CHARTS="DATE_FORMAT_CHARTS",e.DATE_FORMAT_DATEFORMAT_LIB="DATE_FORMAT_DATEFORMAT_LIB"}(o=t.EDateFormats||(t.EDateFormats={})),function(e){e.DD_MM_YYYY_SLASHSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_DD_MM_YYYY_SLASHSEPERATOR",
e.MM_DD_YYYY_SLASHSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_MM_DD_YYYY_SLASHSEPERATOR",e.DD_MM_YYYY_POINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_DD_MM_YYYY_POINTSEPERATOR",e.YYYY_MM_DD_MINUSSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_YYYY_MM_DD_MINUSSEPERATOR",e.YYYY_MM_DD_DOUBLEPOINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_YYYY_MM_DD_DOUBLEPOINTSEPERATOR",e.YYYY_MM_DD_POINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_YYYY_MM_DD_POINTSEPERATOR",e.DD_MMM_YYYY_MINUSSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_DD_MMM_YYYY_MINUSSEPERATOR",e.MMM_DD_YYYY_MINUSSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_MMM_DD_YYYY_MINUSSEPERATOR",e.YYYY_MM_DD_NO_SEPARATOR="CUSTOM_YYYY_MM_DD_NO_SEPARATOR"}(E=t.EDateConfiguration||(t.EDateConfiguration={})),function(e){e.HH_MM_SS_MINUSSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_TIMEFORMAT_TEXT_HH_MM_SS_MINUSSEPERATOR",
e.HH_MM_SS_POINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_TIMEFORMAT_TEXT_HH_MM_SS_POINTSEPERATOR",e.HH_MM_SS_DOUBLEPOINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_TIMEFORMAT_TEXT_HH_MM_SS_DOUBLEPOINTSEPERATOR",e.HH_MM_SS_AM_PM_DOUBLEPOINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_TIMEFORMAT_TEXT_HH_MM_SS_AM_PM_DOUBLEPOINTSEPERATOR",e.HH_MM_SS_NO_SEPARATOR="CUSTOM_HH_MM_SS_NO_SEPARATOR"}(_=t.ETimeConfiguration||(t.ETimeConfiguration={}));const l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function c(e,t,s){let a="YYYY-MM-DD",i="HH:mm:ss";switch(console.log("parseDateTimeFormat: for format "+e),e){case o.DATE_FORMAT_CHARTS:a="YYYY-MM-DD",i="HH:mm:ss";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="yyyy-mm-dd",i="HH:MM:ss"}if(void 0!==t){let s=t.value.selection.text.id;switch(console.log("parseDateTimeFormat: date "+s),s){case E.DD_MM_YYYY_SLASHSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:a="DD/MM/YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="dd-mm-yyyy"}
break;case E.MM_DD_YYYY_SLASHSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:a="MM/DD/YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="mm-dd-yyyy"}break;case E.DD_MM_YYYY_POINTSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:a="DD.MM.YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="dd.mm.yyyy"}break;case E.YYYY_MM_DD_MINUSSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:a="YYYY-MM-DD";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="yyyy-mm-dd"}break;case E.YYYY_MM_DD_DOUBLEPOINTSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:a="YYYY:MM:DD";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="yyyy:mm:dd"}break;case E.DD_MMM_YYYY_MINUSSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:a="DD-MMM-YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="dd-mmm-yyyy"}break;case E.MMM_DD_YYYY_MINUSSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:a="MMM-DD-YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:a="mmm.dd.yyyy"}break;default:a=s}}if(void 0!==s){let t=s.value.selection.text.id;switch(console.log("parseDateTimeFormat: time "+t),
t){case _.HH_MM_SS_POINTSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:i="HH.mm.ss";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="HH.MM.ss"}break;case _.HH_MM_SS_DOUBLEPOINTSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:i="HH:mm:ss";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="HH:MM:ss"}break;case _.HH_MM_SS_AM_PM_DOUBLEPOINTSEPERATOR:switch(e){case o.DATE_FORMAT_CHARTS:i="hh:mm:ss a";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="hh:MM:ss TT"}break;default:i=t}}let n=`${a} ${i}`;return console.log("parseDateTimeFormat: final format "+n),n}function A(e,t){let s=e.toFixed(0);for(;s.length<t;)s="0"+s;return s}function u(){let e=(new a.ClockHandlerProxy).getFormatConfigurationI18n();if(e.isSuccess()){let t,s,n=JSON.parse(e.rawReturns.configuration),r=i.find(n,e=>e.id===a.CLOCKHANDLER_DATEFORMAT_PARAM_ID),o=i.find(n,e=>e.id===a.CLOCKHANDLER_TIMEFORMAT_PARAM_ID);if(void 0!==r){let e=r.value.selection.text.id;t=Object.values(E).includes(e)?e:E.YYYY_MM_DD_MINUSSEPERATOR
}else t=E.YYYY_MM_DD_MINUSSEPERATOR;if(void 0!==o){let e=o.value.selection.text.id;s=Object.values(_).includes(e)?e:_.HH_MM_SS_DOUBLEPOINTSEPERATOR}else s=_.HH_MM_SS_DOUBLEPOINTSEPERATOR;return{dateConfiguration:t,timeConfiguration:s}}return{dateConfiguration:E.YYYY_MM_DD_MINUSSEPERATOR,timeConfiguration:_.HH_MM_SS_DOUBLEPOINTSEPERATOR}}function T(e,t){let s,a,i=new Date(e);switch(t.dateConfiguration){case E.DD_MM_YYYY_SLASHSEPERATOR:s=A(i.getDate(),2)+"/"+A(i.getMonth()+1,2)+"/"+A(i.getFullYear(),4);break;case E.MM_DD_YYYY_SLASHSEPERATOR:s=A(i.getMonth()+1,2)+"/"+A(i.getDate(),2)+"/"+A(i.getFullYear(),4);break;case E.DD_MM_YYYY_POINTSEPERATOR:s=A(i.getDate(),2)+"."+A(i.getMonth()+1,2)+"."+A(i.getFullYear(),4);break;case E.YYYY_MM_DD_MINUSSEPERATOR:s=A(i.getFullYear(),4)+"-"+A(i.getMonth()+1,2)+"-"+A(i.getDate(),2);break;case E.YYYY_MM_DD_DOUBLEPOINTSEPERATOR:s=A(i.getFullYear(),4)+":"+A(i.getMonth()+1,2)+":"+A(i.getDate(),2);break;case E.YYYY_MM_DD_POINTSEPERATOR:
s=A(i.getFullYear(),4)+"."+A(i.getMonth()+1,2)+"."+A(i.getDate(),2);break;case E.DD_MMM_YYYY_MINUSSEPERATOR:s=A(i.getDate(),2)+"-"+l[i.getMonth()]+"-"+A(i.getFullYear(),4);break;case E.MMM_DD_YYYY_MINUSSEPERATOR:s=l[i.getMonth()]+"-"+A(i.getDate(),2)+"-"+A(i.getFullYear(),4);break;case E.YYYY_MM_DD_NO_SEPARATOR:s=A(i.getFullYear(),4)+A(i.getMonth()+1,2)+A(i.getDate(),2);break;default:s=A(i.getFullYear(),4)+"-"+A(i.getMonth()+1,2)+"-"+A(i.getDate(),2)}switch(t.timeConfiguration){case _.HH_MM_SS_MINUSSEPERATOR:a=A(i.getHours(),2)+"-"+A(i.getMinutes(),2)+"-"+A(i.getSeconds(),2);break;case _.HH_MM_SS_POINTSEPERATOR:a=A(i.getHours(),2)+"."+A(i.getMinutes(),2)+"."+A(i.getSeconds(),2);break;case _.HH_MM_SS_DOUBLEPOINTSEPERATOR:a=A(i.getHours(),2)+":"+A(i.getMinutes(),2)+":"+A(i.getSeconds(),2);break;case _.HH_MM_SS_AM_PM_DOUBLEPOINTSEPERATOR:let e=function(e){let t=e>=12?"pm":"am";return{hours:e=0!=(e%=12)?e:12,ampm:t}}(i.getHours())
;a=A(e.hours,2)+":"+A(i.getMinutes(),2)+":"+A(i.getSeconds(),2)+" "+e.ampm;break;case _.HH_MM_SS_NO_SEPARATOR:a=A(i.getHours(),2)+A(i.getMinutes(),2)+A(i.getSeconds(),2);break;default:a=A(i.getHours(),2)+":"+A(i.getMinutes(),2)+":"+A(i.getSeconds(),2)}return{date:s,time:a}}t.getDateTimeFormat=function(e){let t="";switch(e){case o.DATE_FORMAT_CHARTS:t="YYYY-MM-DD HH:mm:ss";break;case o.DATE_FORMAT_DATEFORMAT_LIB:t="yyyy-mm-dd HH:MM:ss"}let s=(new a.ClockHandlerProxy).getFormatConfigurationI18n();if(s.isSuccess()){let n=JSON.parse(s.rawReturns.configuration);t=`${c(e,i.find(n,e=>e.id===a.CLOCKHANDLER_DATEFORMAT_PARAM_ID),i.find(n,e=>e.id===a.CLOCKHANDLER_TIMEFORMAT_PARAM_ID))}`}return t},t.parseDateTimeFormat=c,t.getDateTimeConfiguration=u,t.convertToDateTimeFormat=T,t.getDateTime=function(e,t,s,a,i=!0,o=!0){switch(void 0==s&&(s=Date.now()),r.isNumber(s)||r.isString(s)||(s=0),void 0==a&&(a=r.isString(s)?"iso":"ms"),void 0==e&&(e="ms"),a){case"ms":s=r.isNumber(s)?s:0;break;case"s":
s=r.isNumber(s)?1e3*s:0;break;case"iso":case"isoTimezone":s=r.isString(s)?new Date(s).valueOf():0,s=r.isNumber(s)?s:0}if("ms"===e)return s;if("s"===e)return Math.trunc(s/1e3);if("iso"===e)return new Date(s).toISOString();if("isoTimezone"===e&&(e="frmt",t="yyyy-mm-dd HH:MM:sso"),void 0==t&&(t=u()),0===s&&(s=.1),t.hasOwnProperty("dateConfiguration")){let e=T(s,t),a=i?e.date:"";return a+=o&&""!==a?" ":"",a+=o?e.time:""}if("string"==typeof t.toLowerCase())return n(s,t);{let e=o?"HH:MM:ss":"";return e+=i&&""!==e?" ":"",n(s,e+=i?"dd.mm.yyyy":"")}}},function(e,t){e.exports=require("dateformat")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(3),i=s(2),n=s(1);function r(){return i.cloneJSON({showUsername:"HIDDEN",showPassword:!1,showUserDropdown:!1,listOfLastUsers:[],showLogoutButton:!1,title:a.createEmptyTextStructure(),text1:a.createEmptyTextStructure(),text2:a.createEmptyTextStructure(),loginText:a.createEmptyTextStructure(),
passwordText:a.createEmptyTextStructure()})}function o(){return i.cloneJSON(Object.assign({},r(),{timeoutSec:0}))}t.LOCK_DATA_PARAM_ID="LOCK_DATA",t.LOCK_DATA_PASS_PARAM_ID="LOCK_DATA_PASS",t.LOCK_DATA_USER_PARAM_ID="LOCK_DATA_USER",t.BTN_ID_LOCK_SCREEN_LOGOUT="LOCK_SCREEN_LOGOUT",t.getDefaultLockScreenContentJson=r,t.getDefaultLockScreenJson=o;t.LockScreenProvider=class{constructor(e){this.mqttHandler=e,this.screenHmiObject=o(),this.lastPublishedTabContent=""}setContent(e){this.screenHmiObject=e,this.publish()}publish(){let e=JSON.stringify(this.screenHmiObject);return e!==this.lastPublishedTabContent&&(this.mqttHandler.publish(n.MqttTopics.HMI_LOCK_SCREEN,e),this.lastPublishedTabContent=e,!0)}}},,,,,function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const a=s(3),i=s(0),n=s(96),r=s(8),o=s(103),E=s(20),_=s(20),l=s(24),c=s(104),A=s(109),u=s(28),T=s(63),d=s(45),S=s(110),I=s(83),p=s(21),N=s(111),h=s(9),R=s(42),m=s(14),O=s(26),g=s(12),P=s(7),M=s(113),L=s(61),D=s(114),C=s(27),b=s(35),f=s(57),y=s(10),B=s(84),v=s(84),G=s(116),U=s(2),H=s(36),F=s(25),W=s(43),x=s(29),Q=s(50),k=s(87),w=s(53),V=s(88),Y=s(118),q=s(39),K=s(119),j=s(121),X=s(122),J=s(124),$=s(44),z=s(90),Z=s(125),ee=s(126),te=s(127),se=s(45),ae=s(1),ie=s(23),ne=s(128),re=s(58);let oe=s(89)
;const Ee="STATE_WAIT_DEVICE_INFORMATION",_e="STATE_DISCOVER_SYSTEMS",le="STATE_SELECT_SYSTEM",ce="STATE_SYSTEM_STATUS",Ae="STATE_SYSTEM_LOGIN",ue="STATE_SYSTEM_LOGGING_IN",Te="STATE_SYSTEM_LOGGING_OUT",de="STATE_INVALID_SESSION_ERROR",Se="STATE_COMMUNICATION_ERROR",Ie="STATE_SELECT_ACTION",pe="STATE_WIN_SAMPLES",Ne="STATE_WIN_SUBSAMPLE",he="STATE_WIN_SUBSAMPLE_RACK_EDIT_PROCESSING",Re="STATE_WIN_WEIGHING",me="STATE_WIN_WEIGHING_WEIGHT_TAKEN",Oe="STATE_WIN_WEIGHING_WEIGHT_TAKEN_CONFIRM",ge="STATE_WBACK_REQUEST_LIST",Pe="STATE_WBACK_WEIGHING",Me="STATE_WBACK_WEIGHING_WEIGHT_TAKEN",Le="STATE_REMOTE_CONTROL_IF_CHECK",De="STATE_REMOTE_CONTROL",Ce="STATE_REMOTE_CONTROL_WEIGHT_RESULT",be="STATE_REMOTE_CONTROL_WEIGHT_CANCEL",fe="STATE_REMOTE_CONTROL_WEIGHT_TAKEN",ye="STATE_REMOTE_CONTROL_WEIGHT_ERROR",Be="STATE_REMOTE_CONTROL_TARE_RESULT",ve="STATE_REMOTE_CONTROL_TARE_NO_TARE",Ge="STATE_REMOTE_CONTROL_TARE_SUCCESS",Ue="S_EV_CONT_COLL_DEV_DATA",He="SELECT_SYSTEM_TAB_ID",Fe="SELECT_ACTION_TAB_ID",We="SELECT_SAMPLELIST_TAB_ID",xe="SELECT_SAMPLE_TAB_ID",Qe="SELECT_SUBSAMPLE_TAB_ID",ke="WIN_WGSPLIT_PARAMLIST_TAB_ID",we="SELECT_REQUEST_TAB_ID",Ve="WBACK_WGSPLIT_PARAMLIST_TAB_ID",Ye="BTN_CONNECTION_INFO",qe="BTN_CONNECTION_INFO_OK",Ke="BTN_ID_DISCOVERY_SYSTEMS_NO_FOUND_OK",je="BTN_ID_SEL_SYSTEM_",Xe="BTN_ID_SELECT_SYSTEM_LIST_NO_ITEMS",Je="BTN_ID_ACTION_WEIGHING_IN",$e="BTN_ID_ACTION_WEIGHING_BACK",ze="BTN_ID_ACTION_WEIGHING_REMOTE",Ze="BTN_ID_SELECT_SAMPLELIST_PREFIX_",et="BTN_ID_SELECT_SAMPLE_PREFIX_",tt="BTN_ID_SELECT_SUBSAMPLE_PREFIX_",st="BTN_ID_EDIT_RACK_SUBSAMPLE_PREFIX_",at="BTN_ID_SELECT_REQUEST_PREFIX_",it="BTN_ID_CANCEL_HOME_LOGOUT",nt="BTN_ID_DO_SUSPEND",rt="BTN_ID_DO_SYSTEM_LOGOUT",ot="BTN_ID_DO_OMNIS_LOGOUT",Et="BTN_ID_DO_OMNIS_ACTION_MENU",_t="BTN_ID_OK",lt="BTN_ID_WAIT_DEV_INFO_TO_OK",ct="BTN_ID_ERROR_MSGBOX_OK_LOGIN_ERROR",At="BTN_ID_ERROR_MSGBOX_OK_GET_STATUS_MISMATCH_SYSID",ut="BTN_ID_ERROR_MSGBOX_OK_LOGIN_RETRY",Tt="BTN_ID_ERROR_MSGBOX_OK_LOGIN_ABORT",dt="BTN_ID_WARNING_MSGBOX_OK_LOGIN_AUTOLOG_CONFLICT",St="BTN_ID_ERROR_MSGBOX_OK_UNLOCK_RETRY",It="BTN_ID_ERROR_MSGBOX_OK_UNLOCK_ABORT",pt="BTN_ID_ERROR_MSGBOX_OK_LOAD_SAMPLES_NOT_FOUND",Nt="BTN_ID_ERROR_MSGBOX_OK_LOAD_SUBSAMPLES_NOT_FOUND",ht="BTN_ID_ERROR_MSGBOX_OK_SEND_SUBSAMPLE_REJECTED_NOT_FOUND",Rt="BTN_ID_ERROR_MSGBOX_OK_SEND_SUBSAMPLE_REJECTED_BAD_REQUEST",mt="BTN_ID_ERROR_MSGBOX_OK_SEND_SUBSAMPLE_REJECTED_CONFLICT",Ot="BTN_ID_ERROR_MSGBOX_OK_SEND_SUBSAMPLE_RACK_REJECTED_NOT_FOUND",gt="BTN_ID_ERROR_MSGBOX_OK_SEND_SUBSAMPLE_RACK_REJECTED_BAD_REQUEST",Pt="BTN_ID_ERROR_MSGBOX_OK_SEND_SUBSAMPLE_RACK_REJECTED_CONFLICT",Mt="BTN_ID_ERROR_MSGBOX_OK_SEND_REQ_REJECTED_NOT_FOUND",Lt="BTN_ID_ERROR_MSGBOX_OK_SEND_REQ_REJECTED_BAD_REQUEST",Dt="BTN_ID_ERROR_MSGBOX_OK_UNIT_NOT_SUPPORTED",Ct="BTN_ID_WARNING_MSGBOX_OK_REMOTE_IF_ENABLED",bt="SUBSAMPLE_WIN_SAMPLE_NAME_PARAM_ID",ft="SUBSAMPLE_WIN_NAME_PARAM_ID",yt="SUBSAMPLE_WIN_LIST_POS_PARAM_ID",Bt="SUBSAMPLE_WIN_SIZE_PARAM_ID",vt="SUBSAMPLE_WIN_RACK_PARAM_ID",Gt="REQUEST_SAMPLE_NAME_PARAM_ID",Ut="REQUEST_SUBSAMPLE_NAME_PARAM_ID",Ht="REQUEST_NAME_PARAM_ID",Ft="REQUEST_SAMPLE_SIZE_PARAM_ID",Wt="REQUEST_METHOD_PARAM_ID",xt="REQUEST_OP_PROC_PARAM_ID",Qt="SAMPLE_MAX_PARAM_ID",kt="SAMPLE_MIN_PARAM_ID",wt="EDIT_RACK_NAME_PARAM_ID",Vt="EDIT_RACK_POSITION_PARAM_ID",Yt="SEARCH_PARAM_ID",qt="LoginBackground.png",Kt="LoginBackground.png",jt="–",Xt=1e3,Jt=2e3,$t="STATE_WAIT_DEVICE_INFORMATION_TIMEOUT",zt="/DEVICEINFORMATION/IDENTIFICATION/SERIAL_NO_BALANCE"
;var Zt,es;!function(e){e.OMNIS_REQ_LOGIN="OMNIS_REQ_LOGIN",e.OMNIS_REQ_LOGOUT="OMNIS_REQ_LOGOUT",e.OMNIS_REQ_AUTH="OMNIS_REQ_AUTH",e.OMNIS_REQ_STATUS="OMNIS_REQ_STATUS",e.OMNIS_REQ_GET_SAMPLE_LISTS_REQ="OMNIS_REQ_GET_SAMPLE_LISTS_REQ",e.OMNIS_REQ_GET_SAMPLES_REQ="OMNIS_REQ_GET_SAMPLE_LISTS_REQ",e.OMNIS_REQ_GET_SUBSAMPLES_REQ="OMNIS_REQ_GET_SAMPLE_LISTS_REQ",e.OMNIS_REQ_SEND_SUBSAMPLE_WIN_REQ="OMNIS_REQ_SEND_SUBSAMPLE_WIN_REQ",e.OMNIS_REQ_SEND_SUBSAMPLE_RACK_INFO_REQ="OMNIS_REQ_SEND_SUBSAMPLE_RACK_INFO_REQ",e.OMNIS_REQ_GET_ALL_REQ="OMNIS_REQ_GET_ALL_REQ",e.OMNIS_REQ_SEND_REQ="OMNIS_REQ_SEND_REQ",e.OMNIS_REQ_DISCOVER_SYSTEMS="OMNIS_REQ_DISCOVER_SYSTEMS"}(Zt||(Zt={})),function(e){e.AFTER_LOGOUT_SEL_SYS="AFTER_LOGOUT_SEL_SYS",e.AFTER_LOGOUT_LOGOUT="AFTER_LOGOUT_LOGOUT",e.AFTER_LOGOUT_SUSPEND="AFTER_LOGOUT_SUSPEND"}(es||(es={}));const ts=5e3,ss="CHECK_LOCK_TIMER_INTERVAL";let as={STATE_WAIT_DEVICE_INFORMATION:{_onEnter:function(e){e.initSTATE_WAIT_DEVICE_INFORMATION()},_onExit:function(e){
e.deInitSTATE_WAIT_DEVICE_INFORMATION()},EV_MQTT_UPDATE:function(e,t){t.payload.topic!==ae.MqttTopics.NETWORK_MAC_ADDRESS&&t.payload.topic!==ae.MqttTopics.NETWORK_HOSTNAME&&t.payload.topic!==zt||e.handleMqttDeviceInformation(JSON.parse(t.payload.value.toString()))},IMMEDIATE_EVENT:function(e,t){t.payload.from===Ee&&this.transition(e,t.payload.to)},QAPP_TIMER_EVENT:function(e,t){t.payload===$t&&this.transition(e,"STATE_WAIT_DEVICE_INFORMATION_TIMEOUT")}},STATE_WAIT_DEVICE_INFORMATION_TIMEOUT:{_onEnter:function(e){e.initSTATE_WAIT_DEVICE_INFORMATION_TIMEOUT()},_onExit:function(e){},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===lt&&(e.hideMsgBox(),e.suspend())}},STATE_DISCOVER_SYSTEMS:{_onEnter:function(e){e.initSTATE_DISCOVER_SYSTEMS()},_onExit:function(e){e.deinitSTATE_DISCOVER_SYSTEMS()},EV_MQTT_UPDATE:function(e,t){t.payload.topic===K.MQTT_TOPIC_OMNIS_DISCOVERY_RESPONSE&&e.handleSystemRx(JSON.parse(t.payload.value.toString()))},EV_HMI_BTN_CLICKED:function(e,t){
t.payload.buttonId===Ke&&e.addToEventQueue(new h.ImmediateEvent({from:_e,to:le}))},QAPP_TIMER_EVENT:function(e,t){if(t.payload===_e)e.handleSystemDiscoveryTimer();else if("doLocalSystemDemo"===t.payload){let t=new x.URL("https://localhost:5001"),s={name:"Local redirected Omnis (port 5001) (C1909197-C20212VL-000206A7-5B265CD2)",versions:[1,0],port:t.port,systemId:"C1909197-C20212VL-000206A7-5B265CD2"},a=Buffer.from(JSON.stringify(s)),i=Buffer.concat([Buffer.from([10,10,0,a.length>>8&255,255&a.length]),a]),n={ip:t.hostname,sourcePort:0,data:i.toString("base64")},r=new C.MqttUpdateEvent({topic:K.MQTT_TOPIC_OMNIS_DISCOVERY_RESPONSE,value:Buffer.from(JSON.stringify(n))});e.addToEventQueue(r)}},IMMEDIATE_EVENT:function(e,t){t.payload.from===_e&&this.transition(e,t.payload.to)},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){t.payload.sourceState===_e&&t.payload.metadata===Zt.OMNIS_REQ_DISCOVER_SYSTEMS&&e.handleDiscoveryUdpSuccess(t.payload.result)},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){
t.payload.sourceState===_e&&t.payload.metadata===Zt.OMNIS_REQ_DISCOVER_SYSTEMS&&e.handleDiscoveryUdpError(t.payload.reason)}},STATE_SELECT_SYSTEM:{_onEnter:function(e){e.initSTATE_SELECT_SYSTEM()},_onExit:function(e){},EV_MQTT_UPDATE_DEBUG:function(e,t){"/QAPP/DEBUG/doLocalSystemDemo"===t.payload.topic&&("true"===t.payload.value.toString()?(console.log("DEBUG: enable local redirected system"),e.doLocalSystemDemo=!0):(console.log("DEBUG: disable local redirected system"),e.doLocalSystemDemo=!1))},STATE_DISCOVER_SYSTEMS:function(e){e.initSTATE_SELECT_SYSTEMFromLeft()},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===E.BTN_HOME_ID||t.payload.buttonId===nt?e.suspend():t.payload.buttonId===rt?(e.rememberLogout(),
e.suspend()):t.payload.buttonId.startsWith(je)?this.transition(e,e.handleSystemSelection(parseInt(t.payload.buttonId.substr(je.length),10))):t.payload.buttonId===E.BTN_RELOAD_ID?this.transition(e,e.handleSystemListReload()):t.payload.buttonId===Ye?e.handleConnectionInfo():t.payload.buttonId===qe&&e.hideMsgBox()}},STATE_SYSTEM_STATUS:{_onEnter:function(e){e.initSTATE_SYSTEM_STATUS()},_onExit:function(e){},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===At&&(e.showLoadingScreen(),e.hideMsgBox(),this.transition(e,_e))},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){t.payload.sourceState===ce&&t.payload.metadata.request===Zt.OMNIS_REQ_STATUS&&this.transition(e,e.handleGetStatusSuccess(t.payload.result))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){t.payload.sourceState===ce&&t.payload.metadata.request===Zt.OMNIS_REQ_STATUS&&this.transition(e,e.handleGetStatusError(t.payload.reason))}},STATE_SYSTEM_LOGIN:{_onEnter:function(e){e.initSTATE_SYSTEM_LOGIN()},_onExit:function(e){
e.deinitSTATE_SYSTEM_LOGIN()},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===D.BACK_BUTTON_ID&&this.transition(e,le)},EV_HMI_PARAM_CHANGED:function(e,t){t.payload.parameter.id===D.LOGIN_DATA_PARAM_ID&&this.transition(e,e.handleHmiLoginDataRx(t.payload.parameter))},IMMEDIATE_EVENT:function(e,t){t.payload.from===Ae&&this.transition(e,t.payload.to)}},STATE_SYSTEM_LOGGING_IN:{_onEnter:function(e){e.initSTATE_SYSTEM_LOGGING_IN()},_onExit:function(e){},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===ut?this.transition(e,ce):t.payload.buttonId===Tt?(e.showLoadingScreen(),e.hideMsgBox(),this.transition(e,_e)):t.payload.buttonId===dt&&this.transition(e,e.handleAutoLogoutConflictOKButton())},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){t.payload.sourceState===Ae&&t.payload.metadata.request===Zt.OMNIS_REQ_LOGIN&&this.transition(e,e.handleLoginSuccess(t.payload.result))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){
t.payload.sourceState===Ae&&t.payload.metadata.request===Zt.OMNIS_REQ_LOGIN&&this.transition(e,e.handleLoginError(t.payload.reason))}},STATE_SYSTEM_LOGGING_OUT:{_onEnter:function(e){e.initSTATE_SYSTEM_LOGGING_OUT()},_onExit:function(e){},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){t.payload.sourceState===Te&&t.payload.metadata.request===Zt.OMNIS_REQ_LOGOUT&&e.handleLogout(void 0)},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){t.payload.sourceState===Te&&t.payload.metadata.request===Zt.OMNIS_REQ_LOGOUT&&e.handleLogout(t.payload.reason)},IMMEDIATE_EVENT:function(e,t){t.payload.from===Te&&this.transition(e,t.payload.to)}},STATE_INVALID_SESSION_ERROR:{_onEnter:function(e){e.initSTATE_INVALID_SESSION_ERROR()},_onExit:function(e){},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===ct&&(e.showLoadingScreen(),e.hideMsgBox(),this.transition(e,_e))}},STATE_COMMUNICATION_ERROR:{_onEnter:function(e){e.initSTATE_COMMUNICATION_ERROR()},_onExit:function(e){},EV_HMI_BTN_CLICKED:function(e,t){
t.payload.buttonId===F.MESSAGEHANDLER_OK_BTN_ID&&(e.showLoadingScreen(),e.hideMsgBox(),this.transition(e,e.handleMessageHandlerOKButton()))}},STATE_SELECT_ACTION:{_onEnter:function(e){e.initSTATE_SELECT_ACTION()},_onExit:function(e){},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===E.BTN_HOME_ID?e.handleHomeBtn():t.payload.buttonId===it?e.hideMsgBox():t.payload.buttonId===nt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SUSPEND)):t.payload.buttonId===E.BTN_LOGOUT_ID?e.handleLogoutBtn():t.payload.buttonId===rt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_LOGOUT)):t.payload.buttonId===ot?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SEL_SYS)):t.payload.buttonId===F.MESSAGEHANDLER_OK_BTN_ID?this.transition(e,e.handleMessageHandlerOKButton()):t.payload.buttonId===Je?this.transition(e,"STATE_WIN_SAMPLE_LIST"):t.payload.buttonId===$e?this.transition(e,ge):t.payload.buttonId===ze&&this.transition(e,Le)}},STATE_WIN_SAMPLE_LIST:{_onEnter:function(e){e.initSTATE_WIN_SAMPLE_LIST()},
_onExit:function(e){},_transFrom:{STATE_SELECT_ACTION:function(e){e.initSTATE_WIN_SAMPLE_LISTFromLeft()}},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===E.BTN_BACK_ID?this.transition(e,Ie):t.payload.buttonId===E.BTN_LONG_BACK_ID?e.handleActionHomeBtn():t.payload.buttonId===it?e.hideMsgBox():t.payload.buttonId===nt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SUSPEND)):t.payload.buttonId===Et?this.transition(e,Ie):t.payload.buttonId===E.BTN_LOGOUT_ID?e.handleLogoutBtn():t.payload.buttonId===rt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_LOGOUT)):t.payload.buttonId===ot?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SEL_SYS)):t.payload.buttonId.startsWith(Ze)?this.transition(e,e.handleSampleListSelection(parseInt(t.payload.buttonId.substr(Ze.length),10))):t.payload.buttonId===E.BTN_RELOAD_ID?e.handleSampleListsReload():t.payload.buttonId===E.BTN_SEARCH_ID&&e.handleSearchButtonClick()},EV_HMI_PARAM_CHANGED:function(e,t){
t.payload.parameter.id===Yt&&e.handleSampleListsSearch(t.payload.parameter.value.string)},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){"STATE_WIN_SAMPLE_LIST"===t.payload.sourceState&&t.payload.metadata.request===Zt.OMNIS_REQ_GET_SAMPLE_LISTS_REQ&&(console.log("getSampleLists done"),e.handleSampleListsRx(t.payload.result))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){"STATE_WIN_SAMPLE_LIST"===t.payload.sourceState&&t.payload.metadata.request===Zt.OMNIS_REQ_GET_SAMPLE_LISTS_REQ&&(console.log("getSampleLists failed"),this.transition(e,e.handleSampleListsRxFail(t.payload.reason)))}},STATE_WIN_SAMPLES:{_onEnter:function(e){e.initSTATE_WIN_SAMPLES()},_onExit:function(e){},_transFrom:{STATE_WIN_SAMPLE_LIST:function(e){e.initSTATE_WIN_SAMPLESFromLeft()}},EV_HMI_BTN_CLICKED:function(e,t){
t.payload.buttonId===E.BTN_BACK_ID?this.transition(e,"STATE_WIN_SAMPLE_LIST"):t.payload.buttonId===E.BTN_LONG_BACK_ID?e.handleActionHomeBtn():t.payload.buttonId===it?e.hideMsgBox():t.payload.buttonId===nt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SUSPEND)):t.payload.buttonId===Et?this.transition(e,Ie):t.payload.buttonId===E.BTN_LOGOUT_ID?e.handleLogoutBtn():t.payload.buttonId===rt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_LOGOUT)):t.payload.buttonId===ot?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SEL_SYS)):t.payload.buttonId===pt?this.transition(e,"STATE_WIN_SAMPLE_LIST"):t.payload.buttonId.startsWith(et)?this.transition(e,e.handleSamplesSelection(parseInt(t.payload.buttonId.substr(et.length),10))):t.payload.buttonId===E.BTN_RELOAD_ID?e.handleSamplesReload():t.payload.buttonId===E.BTN_SEARCH_ID&&e.handleSearchButtonClick()},EV_HMI_PARAM_CHANGED:function(e,t){t.payload.parameter.id===Yt&&e.handleSamplesSearch(t.payload.parameter.value.string)},
QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){t.payload.sourceState===pe&&t.payload.metadata.request===Zt.OMNIS_REQ_GET_SAMPLES_REQ&&(console.log("getAllSamples done"),e.handleSamplesRx(t.payload.result))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){t.payload.sourceState===pe&&t.payload.metadata.request===Zt.OMNIS_REQ_GET_SAMPLES_REQ&&(console.log("getAllSamples failed"),this.transition(e,e.handleSamplesRxFail(t.payload.reason)))}},STATE_WIN_SUBSAMPLE:{_onEnter:function(e){e.initSTATE_WIN_SUBSAMPLE()},_onExit:function(e){},_transFrom:{STATE_WIN_SAMPLES:function(e){e.initSTATE_WIN_SUBSAMPLEFromLeft()}},EV_HMI_BTN_CLICKED:function(e,t){
t.payload.buttonId===E.BTN_BACK_ID?this.transition(e,pe):t.payload.buttonId===E.BTN_LONG_BACK_ID?e.handleActionHomeBtn():t.payload.buttonId===it?e.hideMsgBox():t.payload.buttonId===nt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SUSPEND)):t.payload.buttonId===Et?this.transition(e,Ie):t.payload.buttonId===E.BTN_LOGOUT_ID?e.handleLogoutBtn():t.payload.buttonId===rt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_LOGOUT)):t.payload.buttonId===ot?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SEL_SYS)):t.payload.buttonId===Nt?this.transition(e,"STATE_WIN_SAMPLE_LIST"):t.payload.buttonId.startsWith(tt)?this.transition(e,e.handleSubSampleSelection(parseInt(t.payload.buttonId.substr(tt.length),10))):t.payload.buttonId===E.BTN_RELOAD_ID?e.handleSubSamplesReload():t.payload.buttonId===E.BTN_SEARCH_ID?e.handleSearchButtonClick():t.payload.buttonId.startsWith(st)&&this.transition(e,e.handleRackEditBtn(parseInt(t.payload.buttonId.substr(st.length),10)))},EV_HMI_PARAM_CHANGED:function(e,t){
t.payload.parameter.id===Yt&&e.handleSubSamplesSearch(t.payload.parameter.value.string)},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){t.payload.sourceState===Ne&&t.payload.metadata.request===Zt.OMNIS_REQ_GET_SUBSAMPLES_REQ&&(console.log("getAllSubSamples done"),e.handleSubSampleRx(t.payload.result))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){t.payload.sourceState===Ne&&t.payload.metadata.request===Zt.OMNIS_REQ_GET_SUBSAMPLES_REQ&&(console.log("getAllSubSamples failed"),this.transition(e,e.handleSubSampleRxFail(t.payload.reason)))}},STATE_WIN_SUBSAMPLE_RACK_EDIT_PROCESSING:{_onEnter:function(e){e.initSTATE_WIN_SUBSAMPLE_RACK_EDIT_PROCESSING()},_onExit:function(e){},_transFrom:{},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===gt?this.transition(e,ee.STATE_ASPECT_EDIT_PARAMS_EDIT_ENTER):t.payload.buttonId===Ot?this.transition(e,"STATE_WIN_SAMPLE_LIST"):t.payload.buttonId===Pt&&this.transition(e,Ne)},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){
t.payload.sourceState===he&&t.payload.metadata.request===Zt.OMNIS_REQ_SEND_SUBSAMPLE_RACK_INFO_REQ&&(console.log("sendRackInfo done"),this.transition(e,e.handleSendSubSampleRackInfoSuccess(t)))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){t.payload.sourceState===he&&t.payload.metadata.request===Zt.OMNIS_REQ_SEND_SUBSAMPLE_RACK_INFO_REQ&&(console.log("sendRackInfo fail"),this.transition(e,e.handleSendSubSampleRackInfoFail(t)))}},STATE_WIN_WEIGHING:{_onEnter:function(e){e.initSTATE_WIN_WEIGHING()},_onExit:function(e){},EV_HMI_BTN_CLICKED:function(e,t){
t.payload.buttonId===E.BTN_BACK_ID?this.transition(e,Ne):t.payload.buttonId===E.BTN_HOME_ID?e.handleActionHomeBtn():t.payload.buttonId===it?e.hideMsgBox():t.payload.buttonId===nt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SUSPEND)):t.payload.buttonId===Et?this.transition(e,Ie):t.payload.buttonId===E.BTN_LOGOUT_ID?e.handleLogoutBtn():t.payload.buttonId===rt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_LOGOUT)):t.payload.buttonId===ot?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SEL_SYS)):t.payload.buttonId===E.BTN_PRINTADD_ID?this.transition(e,e.handleTakeoverSTATE_WIN_WEIGHING()):t.payload.buttonId===Dt&&this.transition(e,Ne)},EV_MQTT_UPDATE:function(e,t){t.payload.topic===ae.MqttTopics.WEIGHING_VALUE_NET&&e.handleWeighValueSTATE_WIN_WEIGHING(JSON.parse(t.payload.value.toString()))}},STATE_WIN_WEIGHING_WEIGHT_TAKEN:{_onEnter:function(e){e.initSTATE_WIN_WEIGHING_WEIGHT_TAKEN()},_onExit:function(e){},EV_HMI_BTN_CLICKED:function(e,t){
t.payload.buttonId===ht?this.transition(e,"STATE_WIN_SAMPLE_LIST"):t.payload.buttonId===Rt?this.transition(e,Re):t.payload.buttonId===mt&&this.transition(e,Ne)},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){t.payload.sourceState===me&&t.payload.metadata.request===Zt.OMNIS_REQ_SEND_SUBSAMPLE_WIN_REQ&&(console.log("sendSubSampleWeight done"),this.transition(e,e.handleSendSubSampleWeightSuccess(t)))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){t.payload.sourceState===me&&t.payload.metadata.request===Zt.OMNIS_REQ_SEND_SUBSAMPLE_WIN_REQ&&(console.log("sendSubSampleWeight failed"),this.transition(e,e.handleSendSubSampleWeightFail(t)))}},STATE_WIN_WEIGHING_WEIGHT_TAKEN_CONFIRM:{_onEnter:function(e){e.initSTATE_WIN_WEIGHING_WEIGHT_TAKEN_CONFIRM()},_onExit:function(e){},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===_t&&this.transition(e,e.handleTransmissionConfirmedSTATE_WIN_WEIGHING_WEIGHT_TAKEN_CONFIRM())},EV_MQTT_UPDATE:function(e,t){
t.payload.topic===ae.MqttTopics.WEIGHING_VALUE_NET&&this.transition(e,e.handleWeighValueSTATE_WIN_WEIGHING_WEIGHT_TAKEN_CONFIRM(JSON.parse(t.payload.value.toString())))}},STATE_WBACK_REQUEST_LIST:{_onEnter:function(e){e.initSTATE_WBACK_REQUEST_LIST()},_onExit:function(e){},_transFrom:{STATE_SELECT_ACTION:function(e){e.initSTATE_WBACK_REQUEST_LISTFromLeft()}},EV_HMI_BTN_CLICKED:function(e,t){
t.payload.buttonId===E.BTN_BACK_ID?this.transition(e,Ie):t.payload.buttonId===E.BTN_LONG_BACK_ID?e.handleActionHomeBtn():t.payload.buttonId===it?e.hideMsgBox():t.payload.buttonId===nt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SUSPEND)):t.payload.buttonId===Et?this.transition(e,Ie):t.payload.buttonId===E.BTN_LOGOUT_ID?e.handleLogoutBtn():t.payload.buttonId===rt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_LOGOUT)):t.payload.buttonId===ot?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SEL_SYS)):t.payload.buttonId.startsWith(at)?this.transition(e,e.handleRequestSelection(parseInt(t.payload.buttonId.substr(at.length),10))):t.payload.buttonId===E.BTN_RELOAD_ID?e.handleRequestListReload():t.payload.buttonId===E.BTN_SEARCH_ID?e.handleSearchButtonClick():t.payload.buttonId===E.BTN_OPEN_WEIGHING_ID&&this.transition(e,"STATE_WBACK_PRE_WEIGHING")},EV_HMI_PARAM_CHANGED:function(e,t){t.payload.parameter.id===Yt&&e.handleRequestSearch(t.payload.parameter.value.string)},
QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){t.payload.sourceState===ge&&t.payload.metadata.request===Zt.OMNIS_REQ_GET_ALL_REQ&&(console.log("getAllRequests done"),e.handleRequestsRx(t.payload.result))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){t.payload.sourceState===ge&&t.payload.metadata.request===Zt.OMNIS_REQ_GET_ALL_REQ&&(console.log("getAllRequests failed"),this.transition(e,e.handleRequestsRxFail(t.payload.reason)))}},STATE_WBACK_PRE_WEIGHING:{_onEnter:function(e){e.initSTATE_WBACK_PRE_WEIGHING()},_onExit:function(e){},_transFrom:{STATE_SELECT_ACTION:function(e){e.initSTATE_WBACK_REQUEST_LISTFromLeft()}},EV_HMI_BTN_CLICKED:function(e,t){
t.payload.buttonId===E.BTN_BACK_ID?this.transition(e,ge):t.payload.buttonId===E.BTN_HOME_ID?e.handleActionHomeBtn():t.payload.buttonId===it?e.hideMsgBox():t.payload.buttonId===nt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SUSPEND)):t.payload.buttonId===Et?this.transition(e,Ie):t.payload.buttonId===E.BTN_LOGOUT_ID?e.handleLogoutBtn():t.payload.buttonId===rt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_LOGOUT)):t.payload.buttonId===ot&&this.transition(e,e.doLogout(es.AFTER_LOGOUT_SEL_SYS))}},STATE_WBACK_WEIGHING:{_onEnter:function(e){e.initSTATE_WBACK_WEIGHING()},_onExit:function(e){},EV_HMI_BTN_CLICKED:function(e,t){
t.payload.buttonId===E.BTN_BACK_ID?this.transition(e,ge):t.payload.buttonId===E.BTN_HOME_ID?e.handleActionHomeBtn():t.payload.buttonId===it?e.hideMsgBox():t.payload.buttonId===nt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SUSPEND)):t.payload.buttonId===Et?this.transition(e,Ie):t.payload.buttonId===E.BTN_LOGOUT_ID?e.handleLogoutBtn():t.payload.buttonId===rt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_LOGOUT)):t.payload.buttonId===ot?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SEL_SYS)):t.payload.buttonId===E.BTN_PRINTADD_ID?this.transition(e,e.handleTakeoverSTATE_WBACK_WEIGHING()):t.payload.buttonId===Dt&&this.transition(e,ge)},EV_MQTT_UPDATE:function(e,t){t.payload.topic===ae.MqttTopics.WEIGHING_VALUE_NET&&e.handleWeighValueSTATE_WBACK_WEIGHING(JSON.parse(t.payload.value.toString()))}},STATE_WBACK_WEIGHING_WEIGHT_TAKEN:{_onEnter:function(e){e.initSTATE_WBACK_WEIGHING_WEIGHT_TAKEN()},_onExit:function(e){},EV_HMI_BTN_CLICKED:function(e,t){
t.payload.buttonId===Mt?this.transition(e,ge):t.payload.buttonId===Lt&&this.transition(e,Pe)},QAPP_ASYNC_CALL_DONE_EVENT:function(e,t){t.payload.sourceState===Me&&t.payload.metadata.request===Zt.OMNIS_REQ_SEND_REQ&&(console.log("sendRequest done"),e.handleSendRequestSuccess(t),this.transition(e,"STATE_WBACK_WEIGHING_WEIGHT_TAKEN_CONFIRM"))},QAPP_ASYNC_CALL_FAIL_EVENT:function(e,t){t.payload.sourceState===Me&&t.payload.metadata.request===Zt.OMNIS_REQ_SEND_REQ&&(console.log("sendRequest failed"),this.transition(e,e.handleSendRequestFail(t)))}},STATE_WBACK_WEIGHING_WEIGHT_TAKEN_CONFIRM:{_onEnter:function(e){e.initSTATE_WBACK_WEIGHING_WEIGHT_TAKEN_CONFIRM()},_onExit:function(e){},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===_t&&this.transition(e,e.handleTransmissionConfirmedSTATE_WBACK_WEIGHING_WEIGHT_TAKEN_CONFIRM())},EV_MQTT_UPDATE:function(e,t){
t.payload.topic===ae.MqttTopics.WEIGHING_VALUE_NET&&this.transition(e,e.handleWeighValueSTATE_WBACK_WEIGHING_WEIGHT_TAKEN_CONFIRM(JSON.parse(t.payload.value.toString())))}},STATE_REMOTE_CONTROL_IF_CHECK:{_onEnter:function(e){e.initSTATE_REMOTE_CONTROL_IF_CHECK()},_onExit:function(e){},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===Ct&&e.addToEventQueue(new h.ImmediateEvent({from:Le,to:De}))},IMMEDIATE_EVENT:function(e,t){t.payload.from===Le&&this.transition(e,t.payload.to)}},STATE_REMOTE_CONTROL:{_onEnter:function(e){e.initSTATE_REMOTE_CONTROL()},_onExit:function(e){},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===E.BTN_BACK_ID?this.transition(e,Ie):t.payload.buttonId===E.BTN_HOME_ID?e.handleActionHomeBtn():t.payload.buttonId===it?e.hideMsgBox():t.payload.buttonId===nt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SUSPEND)):t.payload.buttonId===Et?(e.hideMsgBox(),
this.transition(e,Ie)):t.payload.buttonId===E.BTN_LOGOUT_ID?e.handleLogoutBtn():t.payload.buttonId===rt?this.transition(e,e.doLogout(es.AFTER_LOGOUT_LOGOUT)):t.payload.buttonId===ot?this.transition(e,e.doLogout(es.AFTER_LOGOUT_SEL_SYS)):t.payload.buttonId===F.MESSAGEHANDLER_OK_BTN_ID&&this.transition(e,e.handleMessageHandlerOKButton())}},STATE_REMOTE_CONTROL_WEIGHT_CANCEL:{_onEnter:function(e){e.initSTATE_REMOTE_CONTROL_WEIGHT_CANCEL()},_onExit:function(e){},IMMEDIATE_EVENT:function(e,t){t.payload.from===Ce&&this.transition(e,t.payload.to)}},STATE_REMOTE_CONTROL_WEIGHT_TAKEN:{_onEnter:function(e){e.initSTATE_REMOTE_CONTROL_WEIGHT_TAKEN()},_onExit:function(e){},IMMEDIATE_EVENT:function(e,t){t.payload.from===Ce&&this.transition(e,t.payload.to)}},STATE_REMOTE_CONTROL_WEIGHT_ERROR:{_onEnter:function(e){e.initSTATE_REMOTE_CONTROL_WEIGHT_ERROR()},_onExit:function(e){},IMMEDIATE_EVENT:function(e,t){t.payload.from===Ce&&this.transition(e,t.payload.to)}},STATE_REMOTE_CONTROL_TARE_SUCCESS:{
_onEnter:function(e){e.initSTATE_REMOTE_CONTROL_TARE_SUCCESS()},_onExit:function(e){},IMMEDIATE_EVENT:function(e,t){t.payload.from===Be&&this.transition(e,t.payload.to)}},STATE_REMOTE_CONTROL_TARE_NO_TARE:{_onEnter:function(e){e.initSTATE_REMOTE_CONTROL_TARE_NO_TARE()},_onExit:function(e){},IMMEDIATE_EVENT:function(e,t){t.payload.from===Be&&this.transition(e,t.payload.to)}}};class is extends c.QAppAdvBase{constructor(){super(!0),this.rangesSubscribtion$=void 0,this.metrMax=void 0,this.doReloadSampleLists=!0,this.doReloadSamples=!0,this.doReloadSubSamples=!0,this.doReloadRequests=!0,this.discoveryCounter=0,this.discoveryTime=0,this.restcallTimeout=1e3,this.isSavedCredentialsLoginAllowed=!1,this.saveUserCredentials=!1,this.saveUserLogin="",this.saveUserPassword="",this.systems=[],this.selectedSystemTmp=void 0,this.connectedSystem=void 0,this.sampleLists=[],this.sampleListsSearchStr="",this.selectedSampleList=void 0,this.samples=[],this.samplesSearchStr="",this.selectedSample=void 0,
this.subSamples=[],this.subSamplesSearchStr="",this.selectedSubSample=void 0,this.requests=[],this.requestsSearchStr="",this.selectedRequest=void 0,this.deviceInformationTimer=void 0,this.weighingMinValue=Number.NaN,this.weighingMaxValue=Number.NaN,this.enableMinMaxCheckAndVisualization=!1,this.lastTakenWeightValue=void 0,this.isCalibObserveEnabled=!1,this.lastCalibState=void 0,this.postLogoutAction=es.AFTER_LOGOUT_SEL_SYS,this.dateTimeFormatStr="",this.deviceGetStatusData={status:{balanceMacAddress:"",balanceSerialNumber:"",loggedInSystemId:""}},this.deviceGetInformationData={information:{balanceMacAddress:"",balanceSerialNumber:"",qAppVersion:"",hostName:"",lastAdjustment:{date:new X.SatDate(Date.now()),event:"",user:""}}},this.autoLogout=!1,this.lastWeighCmd=null,this.lastTareCmd=null,this.doLocalSystemDemo=!1,this.tryingLoginFromStore=!1,this.registerAspect(new o.WaitingStabilityAspect),this.registerAspect(new Y.WaitingTareAspect),this.registerAspect(new J.LockingAspect),
this.registerAspect(new ee.EditParamsAspect),this.suppressGlobalHomeBtnHandling=!0,this.suppressGlobalLogoutBtnHandling=!0,this.omnisRestProxy=new B.OmnisProxy,this.discoveryAgent=new K.DiscoveryAgent(this.mqttHandler),this.auditTrailProxy=new j.AuditTrailProxy,this.userManagementProxy=new Z.UserManagementProxy,this.ifMngmntProxy=new te.InterfaceManagementProxy}provideSpecificAdvFsmStates(){return as}adaptFsmStates(e){super.adaptFsmStates(e);for(let t in e)e[t].EV_REST_REQUEST=function(e,t){this.transition(e,e.handleRestRequest(t))};for(let t in e){let s;void 0!==(s=e[t].EV_HMI_BTN_CLICKED)&&(e[t].EV_HMI_BTN_CLICKED_OV_OMNIS_LOCK=s),e[t].EV_HMI_BTN_CLICKED=function(s,a){
a.payload.buttonId===St?s.getLockingAspect().isLockMsgBoxEnabled()&&this.transition(s,s.handleLockOKBtnErrorMsgBox()):a.payload.buttonId===It?s.getLockingAspect().isLockMsgBoxEnabled()&&this.transition(s,s.doLogout(es.AFTER_LOGOUT_SEL_SYS)):void 0!==e[t].EV_HMI_BTN_CLICKED_OV_OMNIS_LOCK&&e[t].EV_HMI_BTN_CLICKED_OV_OMNIS_LOCK.call(this,s,a)},void 0!==(s=e[t].QAPP_ASYNC_CALL_DONE_EVENT)&&(e[t].QAPP_ASYNC_CALL_DONE_EVENT_OV_OMNIS_LOCK=s),e[t].QAPP_ASYNC_CALL_DONE_EVENT=function(s,a){a.payload.metadata.request===Zt.OMNIS_REQ_AUTH?s.handleLockAuthenticateSuccess():void 0!==e[t].QAPP_ASYNC_CALL_DONE_EVENT_OV_OMNIS_LOCK&&e[t].QAPP_ASYNC_CALL_DONE_EVENT_OV_OMNIS_LOCK.call(this,s,a)},void 0!==(s=e[t].QAPP_ASYNC_CALL_FAIL_EVENT)&&(e[t].QAPP_ASYNC_CALL_FAIL_EVENT_OV_OMNIS_LOCK=s),e[t].QAPP_ASYNC_CALL_FAIL_EVENT=function(s,a){
a.payload.metadata.request===Zt.OMNIS_REQ_AUTH?this.transition(s,s.handleLockAuthenticateError(a.payload.reason)):void 0!==e[t].QAPP_ASYNC_CALL_FAIL_EVENT_OV_OMNIS_LOCK&&e[t].QAPP_ASYNC_CALL_FAIL_EVENT_OV_OMNIS_LOCK.call(this,s,a)}}}handleEvent(e){if(e instanceof h.QAppTimerEvent){if(this.handleTimerEvent(e))return}else e instanceof C.MqttUpdateEvent&&e.payload.topic===ae.MqttTopics.CALADJ_ISOCAL_STATUS&&this.updateCalibState(JSON.parse(e.payload.value.toString()));super.handleEvent(e)}resumeAdvAspectIsReinitConditionDetectedFn(){return!0}resumeAdvAspectIsForcedReinitModificationDetectedFn(){return!1}calcResumeState(){return Ee}doAddSampleDuringReinit2PQ(e){return!1}providePQInitTaskParams(){return[]}provideSamplePQParams(e){return[]}addRemainingDataToPQ(){return[]}initFromWorkstate(){this.workstate?(this.workflowMeasurement=new N.OmnisMeasurement(this.workstate.measurementData),this.autoLogout=this.userManagementProxy.isAutoLogout(),
console.log("AdvOmnisApp::initFromWorkstate: autoLogout: "+this.autoLogout)):this.exitError("AdvOmnisApp::initFromWorkstate - workstate undefined - unexpected")}reinitWorkstate(){this.workstate&&this.deleteWorkstate(),this.prepReinitializedWorkstate({identifiers:[],samples:[]});let e=this.workflowTaskHandler.getParameter(d.TASK_DYNAMIC_OMNIS_AUTO_NEXT_SUBSAMPLE_PARAM_ID);e.appearance=i.EnumAppearance.HIDDEN,this.workflowTaskHandler.updateParameter(e),(e=this.workflowTaskHandler.getParameter(d.TASK_DYNAMIC_OMNIS_AUTO_NEXT_REQUEST_PARAM_ID)).appearance=i.EnumAppearance.HIDDEN,this.workflowTaskHandler.updateParameter(e),(e=this.workflowTaskHandler.getParameter(d.TASK_DYNAMIC_OMNIS_OMNIS_DISCOV_UDP_PORT_PARAM_ID)).appearance=i.EnumAppearance.HIDDEN,this.workflowTaskHandler.updateParameter(e),(e=this.workflowTaskHandler.getParameter(d.TASK_DYNAMIC_OMNIS_COMMECTION_TIMEOUT_PARAM_ID)).appearance=i.EnumAppearance.HIDDEN,this.workflowTaskHandler.updateParameter(e),
(e=this.workflowTaskHandler.getParameter(d.TASK_DYNAMIC_OMNIS_ALLOW_STORE_CREDENTIALS_PARAM_ID)).appearance=i.EnumAppearance.HIDDEN,this.workflowTaskHandler.updateParameter(e)}init(){super.init(),console.log("AdvOmnisApp::init"),this.systems=[],this.xP_4_SubSample=this.createEmptySubSampleParams(""),this.xP_4_Request=this.createEmptyRequestParams("");let e={id:kt,type:i.EnumParameterTypes.PARAM_QUANTITY,value:a.createEmptyQuantityParameterValue(),title:{id:"_QAPP_WF_SIZE_MIN_TITLE",args:[]},header:{id:"_QAPP_WF_SIZE_MIN_HEADER",args:[]},info:{minimum:{value:a.QUANTITY_PARAM_MIN_MAX_NAN},maximum:{value:a.QUANTITY_PARAM_MIN_MAX_NAN}},appearance:i.EnumAppearance.ENABLED};this.qP_4_SampleMin=new p.Param(this.mqttHandler,e);let t={id:Qt,type:i.EnumParameterTypes.PARAM_QUANTITY,value:a.createEmptyQuantityParameterValue(),title:{id:"_QAPP_WF_SIZE_MAX_TITLE",args:[]},header:{id:"_QAPP_WF_SIZE_MAX_HEADER",args:[]},info:{minimum:{value:a.QUANTITY_PARAM_MIN_MAX_NAN},maximum:{
value:a.QUANTITY_PARAM_MIN_MAX_NAN}},appearance:i.EnumAppearance.ENABLED};this.qP_4_SampleMax=new p.Param(this.mqttHandler,t);let s=new D.OmnisLoginScreen(this.mqttHandler);this.registerScreen(s);let o=new n.WeighingSplitScreen(this.mqttHandler,[E.createBackButtonData(),E.createPrintAddButtonData()]);this.registerScreen(o);let _=new W.WeighingScreen(this.mqttHandler,[E.createBackButtonData()]);this.registerScreen(_),this.registerButton(l.EnumFunctionalButtonType.FUNC_BTN_TAKEOVER,o.getButton(E.BTN_PRINTADD_ID)),this.getWSS().getTabApi().clearTabList(),this.winWSSParamTab=o.getTabApi().addParamListTab(ke,{id:ke,appearance:i.EnumAppearance.HIDDEN,type:T.EnumTabType.TAB_PARAMLIST,containerTitle:a.createEmptyTextStructure(),title:a.createEmptyTextStructure(),displayHeader:!1,topbuttons:[],
params:[this.xP_4_SubSample.sampleName.getPublishedId(),this.xP_4_SubSample.name.getPublishedId(),this.xP_4_SubSample.rack.getPublishedId(),this.xP_4_SubSample.size.getPublishedId(),this.xP_4_SubSample.listPos.getPublishedId()]}),this.wbackWSSParamTab=o.getTabApi().addParamListTab(Ve,{id:Ve,appearance:i.EnumAppearance.HIDDEN,type:T.EnumTabType.TAB_PARAMLIST,containerTitle:a.createEmptyTextStructure(),title:a.createEmptyTextStructure(),displayHeader:!1,topbuttons:[],params:[this.xP_4_Request.sampleName.getPublishedId(),this.xP_4_Request.subSampleName.getPublishedId(),this.xP_4_Request.operatingProcedure.getPublishedId(),this.xP_4_Request.method.getPublishedId(),this.xP_4_Request.name.getPublishedId(),this.xP_4_Request.size.getPublishedId()]}),this.getWSS().getTabApi().publishTabList();let c=new A.SingleTabButtonBarScreen(this.mqttHandler,[],E.createBackButtonData(!0));this.registerScreen(c),this.connectionInfoButton=new r.Button(this.mqttHandler,this.getButtonBarScreen(),{buttonId:Ye,
label:{id:P.EnumFontLabels.INFO,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}),this.reloadListButton=new r.Button(this.mqttHandler,this.getButtonBarScreen(),E.createReloadButtonData()),this.searchListButton=new r.Button(this.mqttHandler,this.getButtonBarScreen(),E.createSearchButtonData()),this.openWeighingButton=new r.Button(this.mqttHandler,this.getButtonBarScreen(),E.createOpenWeighingButtonData()),this.menuHomeButtonDesc=E.createHomeButtonData(),this.menuBackButtonDesc=E.createBackButtonData(),this.menuLogoutButton=new r.Button(this.mqttHandler,this.getButtonBarScreen(),E.createLogoutButtonData());let u={label:{id:"_QAPP_WF_OMNIS_SELECT_ACTION_WEIGH_IN",args:[]},icon:P.EnumFontLabels.TASK_SUBSAMPLE,buttonId:Je,appearance:i.EnumAppearance.DISABLED};this.actionWeighingInButton=new r.Button(this.mqttHandler,this.getButtonBarScreen(),u);let d={label:{id:"_QAPP_WF_OMNIS_SELECT_ACTION_REWEIGH",args:[]},icon:P.EnumFontLabels.REQUEST,buttonId:$e,
appearance:i.EnumAppearance.DISABLED};this.actionWeighingBackButton=new r.Button(this.mqttHandler,this.getButtonBarScreen(),d);let S={label:{id:"_QAPP_WF_OMNIS_SELECT_ACTION_CONTROL",args:[]},icon:P.EnumFontLabels.EXCHANGE,buttonId:ze,appearance:i.EnumAppearance.DISABLED};this.actionRemoteControlButton=new r.Button(this.mqttHandler,this.getButtonBarScreen(),S),this.restHandler.registerRestEndpoints(this.mqttHandler,[{uri:G.REST_URI_O2C_STATUS,method:["GET"],noPwdHeader:!0},{uri:G.REST_URI_O2C_INFORMATION,method:["GET"],noPwdHeader:!0},{uri:G.REST_URI_O2C_WEIGH_CMD,method:["GET","PUT","DELETE"],noPwdHeader:!0},{uri:G.REST_URI_O2C_TARE_CMD,method:["GET","PUT","DELETE"],noPwdHeader:!0}]),this.dateTimeFormatStr=V.getDateTimeFormat(V.EDateFormats.DATE_FORMAT_DATEFORMAT_LIB);const I=this.getStorageLocation(re.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC);if(!I)throw new Error("No storage directory available.");ne.initUserCredentialsStore(I)}postInit(){super.postInit(),
this.rangesSubscribtion$=b.Observable.zip(this.weighingProxy.metrologyMaximum$,this.weighingProxy.metrologyRanges$).subscribe(([e,t])=>{this.metrMax=e}),this.mqttHandler.subscribe(ae.MqttTopics.WEIGHING_VALUE_NET),this.isCalibObserveEnabled=!1,this.addInterval(ts,ss),this.mqttHandler.subscribe(ae.MqttTopics.HMI_EVENT),this.getLockingAspect().configure({getLockScreenFn:()=>this.getLockScreenCfg(),doLogoutFn:()=>this.doLogoutFromLockScreen(),handleLockUnlockDataRxFn:e=>this.handleLockUnlockDataRx(e)})}onSuspending(){this.mqttHandler.unsubscribe(ae.MqttTopics.WEIGHING_VALUE_NET),this.mqttHandler.unsubscribe(ae.MqttTopics.CALADJ_ISOCAL_STATUS),this.mqttHandler.unsubscribe(ae.MqttTopics.HMI_EVENT),this.rangesSubscribtion$&&this.rangesSubscribtion$.unsubscribe()}getWSS(){return this.screens[n.WEIGHING_SPLIT_SCREEN_ID]}getWS(){return this.screens[W.WEIGHING_SCREEN_ID]}getLS(){return this.screens[D.OMNIS_LOGIN_SCREEN_ID]}getButtonBarScreen(){
return this.screens[A.SINGLE_TAB_BUTTON_BAR_SCREEN_ID]}getKeyboard(){return this.screens[I.KEYBOARD_SCREEN_ID]}getStabilityAspect(){return this.aspects[o.WAITING_STABILITY_ASPECT]}getTareAspect(){return this.aspects[Y.WAITING_TARE_ASPECT]}getLockingAspect(){return this.aspects[$.LOCKING_ASPECT]}getEditParamAspect(){return this.aspects[ee.EDIT_PARAMS_ASPECT]}handleWeighValue(e){}isAllDevStatusDataCollected(){return""!==this.deviceGetStatusData.status.balanceMacAddress&&""!==this.deviceGetStatusData.status.balanceSerialNumber}isAllDevInformationDataCollected(){return""!==this.deviceGetInformationData.information.qAppVersion&&""!==this.deviceGetInformationData.information.hostName}initSTATE_WAIT_DEVICE_INFORMATION(){this.mqttHandler.subscribe(ae.MqttTopics.NETWORK_MAC_ADDRESS),this.mqttHandler.subscribe(ae.MqttTopics.NETWORK_HOSTNAME),this.deviceGetInformationData.information.qAppVersion=this.getQAppVersion(),
""===this.deviceGetStatusData.status.balanceSerialNumber&&this.mqttHandler.subscribe(zt),this.enableCalibrationObserve(),this.deviceInformationTimer=this.addTimer(Jt,$t)}deInitSTATE_WAIT_DEVICE_INFORMATION(){this.mqttHandler.unsubscribe(ae.MqttTopics.NETWORK_MAC_ADDRESS),this.mqttHandler.unsubscribe(ae.MqttTopics.NETWORK_HOSTNAME),this.cancelTimer(this.deviceInformationTimer)}handleMqttDeviceInformation(e){e.id===ae.MqttTopics.NETWORK_MAC_ADDRESS?(this.deviceGetStatusData.status.balanceMacAddress=e.value.string,this.deviceGetInformationData.information.balanceMacAddress=e.value.string):e.id===ae.MqttTopics.NETWORK_HOSTNAME?this.deviceGetInformationData.information.hostName=e.value.string:e.id===zt&&(this.deviceGetStatusData.status.balanceSerialNumber=e.value.string,this.deviceGetInformationData.information.balanceSerialNumber=this.deviceGetStatusData.status.balanceSerialNumber),
this.isAllDevStatusDataCollected()&&this.isAllDevInformationDataCollected()?(console.log("collectDeviceData: all data collected, continue"),this.cancelTimer(this.deviceInformationTimer),this.addToEventQueue(new h.ImmediateEvent({from:Ee,to:_e}))):console.log("collectDeviceData: retrigger collecting")}handleSimpleEventSTATE_WAIT_DEVICE_INFORMATION(e){return e.payload===Ue&&(""===this.deviceGetStatusData.status.balanceSerialNumber&&(this.deviceGetStatusData.status.balanceSerialNumber=this.getSerialNumber(),this.deviceGetInformationData.information.balanceSerialNumber=this.deviceGetStatusData.status.balanceSerialNumber),this.isAllDevStatusDataCollected()&&this.isAllDevInformationDataCollected()?(console.log("collectDeviceData: all data collected, continue"),this.addToEventQueue(new h.ImmediateEvent({from:Ee,to:_e}))):(console.log("collectDeviceData: retrigger collecting"),this.addToEventQueue(new h.SimpleEvent(Ue)))),""}initSTATE_WAIT_DEVICE_INFORMATION_TIMEOUT(){this.showLoadingScreen({
id:"",args:[]}),this.showMessageBox({type:g.EnumMessageboxType.INFO,title:{id:"_QAPP_WF_MSG_WARNING_NO_NETWORK_TITLE",args:[]},textList:[{id:"_QAPP_WF_MSG_WARNING_NO_NETWORK_REASON",args:[]},{id:"_QAPP_WF_MSG_WARNING_NO_NETWORK_SOLUTION",args:[]}],buttons:[{id:lt,label:{id:P.EnumFontLabels.OK,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}]})}initSTATE_DISCOVER_SYSTEMS(){console.log("QAppOmnis::initSTATE_DISCOVER_SYSTEMS"),this.systems=[],this.disableLockingScreen();try{this.enqueAsyncCall(this.discoveryAgent.startDiscovery(this.getSerialNumber(),Number.parseInt(this.taskHandler.getParameter(se.TASK_DYNAMIC_OMNIS_OMNIS_DISCOV_UDP_PORT_PARAM_ID).value.numbers[0])),Zt.OMNIS_REQ_DISCOVER_SYSTEMS)}catch(e){console.log(`QAppOmnis::initSTATE_DISCOVER_SYSTEMS: error starting discovery: ${e}`)}this.discoveryTime=1e3*Number.parseFloat(this.taskHandler.getParameter(d.TASK_DYNAMIC_OMNIS_COMMECTION_TIMEOUT_PARAM_ID).value.numbers[0]),
this.restcallTimeout=5e3*Number.parseFloat(this.taskHandler.getParameter(d.TASK_DYNAMIC_OMNIS_COMMECTION_TIMEOUT_PARAM_ID).value.numbers[0]),this.discoveryCounter=Math.floor(Number.parseFloat(this.taskHandler.getParameter(d.TASK_DYNAMIC_OMNIS_COMMECTION_TIMEOUT_PARAM_ID).value.numbers[0])),this.isSavedCredentialsLoginAllowed="YES"===this.taskHandler.getParameter(d.TASK_DYNAMIC_OMNIS_ALLOW_STORE_CREDENTIALS_PARAM_ID).value.selection.id,this.showLoadingScreen({id:"_QAPP_WF_LOADING_OVERLAY_TEXT_LOADING_SYSTEMS",args:[this.discoveryCounter.toFixed(0)]}),this.addTimer(Xt,_e),this.discoveryTime-=Xt,this.doLocalSystemDemo&&this.addTimer(500,"doLocalSystemDemo")}deinitSTATE_DISCOVER_SYSTEMS(){console.log("AdvOmnis::deinitSTATE_DISCOVER_SYSTEMS"),this.discoveryAgent.stopDiscovery(),this.systems.sort((e,t)=>e.systemName.toLowerCase().localeCompare(t.systemName.toLowerCase()))}handleSystemDiscoveryTimer(){this.discoveryCounter--,this.discoveryTime<=0?(this.showLoadingScreen({id:"",args:[]}),
0===this.systems.length?this.showMessageBox({type:g.EnumMessageboxType.INFO,title:{id:"_QAPP_WF_MSG_WARNING_NO_SYSTEMS_TITLE",args:[]},textList:[{id:"",args:[]},{id:"_QAPP_WF_MSG_WARNING_NO_SYSTEMS_SOLUTION",args:[]}],buttons:[{id:Ke,label:{id:P.EnumFontLabels.OK,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}]}):this.addToEventQueue(new h.ImmediateEvent({from:_e,to:le}))):(this.showLoadingScreen({id:"_QAPP_WF_LOADING_OVERLAY_TEXT_LOADING_SYSTEMS",args:[this.discoveryCounter.toFixed(0)]}),this.discoveryTime>=1e3?(this.addTimer(Xt,_e),this.discoveryTime-=Xt):(this.addTimer(this.discoveryTime,_e),this.discoveryTime=0))}handleSystemRx(e){console.log("AdvOmnis::handleSystemRx");let t=this.discoveryAgent.decodeUdpDiscoveryResponse(e);null!==t?t.supportedSystemVersion.find(e=>1===e)&&(t.systemName=t.systemName.trim(),t.systemVersion=1,t.baseURL+=`v${t.systemVersion.toFixed(0)}/weighing`,
this.systems.find(e=>e.systemId===t.systemId)?console.log("AdvOmnis::handleSystemRx: drop dupicate system (by ID): "+t.systemName):(console.log("AdvOmnis::handleSystemRx: added new system: "+t.systemName),this.systems.push(t))):console.log("AdvOmnis::handleSystemRx: dropped discovery response due to incorrect data"),console.log("AdvOmnis::handleSystemRx: done")}handleDiscoveryUdpError(e){console.log("AdvOmnis::handleDiscoveryUdpError: "+y.inspect(e))}handleDiscoveryUdpSuccess(e){console.log("AdvOmnis::handleDiscoveryUdpSuccess - FW sent UDP packet and is listening")}updateSysSelScreen(e){let t=this.systems.map((e,t)=>{let s=!0;try{new x.URL(e.baseURL)}catch(e){console.log("AdvOmnis::updateSysSelScreen: disabled system with invalid URL (value.baseURL)"),s=!1}let a={label:{id:"%arg0% %arg1% %arg2%",args:[e.systemName,s?"":`(${e.baseURL})`,s?"":"_QAPP_WF_OMNIS_SELECT_SYSTEM_INVALID_URL"]},icon:P.EnumFontLabels.OMNIS,buttonId:je+t,
appearance:s?i.EnumAppearance.ENABLED:i.EnumAppearance.DISABLED};return void 0!==this.selectedSystemTmp&&this.selectedSystemTmp.systemId===e.systemId&&(a.lastSelected=!0),r.IButtonParameterInterface2IButtonJsonInterface(a)});0===t.length&&t.push(r.IButtonParameterInterface2IButtonJsonInterface({label:{id:"_QAPP_WF_SELECT_NO_SYSTEMS",args:[]},labelAlign:"l",appearance:i.EnumAppearance.DISABLED,buttonId:Xe})),this.connectionInfoButton.setAppearance(i.EnumAppearance.ENABLED_SECONDARY),this.reloadListButton.setAppearance(i.EnumAppearance.ENABLED_SECONDARY),this.entitySelMenuTab={id:He,appearance:i.EnumAppearance.ENABLED,type:T.EnumTabType.TAB_MENU,containerTitle:{id:"_QAPP_WF_OMNIS_SELECT_SYSTEM",args:[]},title:a.createEmptyTextStructure(),topbuttons:["/QAPP/"+this.connectionInfoButton.getTopic(),"/QAPP/"+this.reloadListButton.getTopic()],menuType:T.TAB_MENU_TYPE_BULK,menuBulkButtons:t,scrollToTop:e},this.getButtonBarScreen().setMenuTab(this.entitySelMenuTab),
this.showScreen(this.getButtonBarScreen())}initSTATE_SELECT_SYSTEMFromLeft(){}initSTATE_SELECT_SYSTEM(){console.log("AdvOmnis::initSTATE_SELECT_SYSTEM"),this.connectedSystem=void 0,this.menuHomeButtonDesc.appearance=i.EnumAppearance.ENABLED_SECONDARY,this.getButtonBarScreen().setTopLeftButton(this.menuHomeButtonDesc),this.disableLockingScreen(),this.updateSysSelScreen(void 0===this.selectedSystemTmp),this.hideLoadingScreen()}handleSystemListReload(){return this.selectedSystemTmp=void 0,_e}handleConnectionInfo(){this.showMessageBox({type:g.EnumMessageboxType.INFO,title:{id:"_QAPP_WF_MSG_INFO_CONNECTION_TITLE",args:[]},textList:[{id:"_QAPP_WF_MSG_INFO_CONNECTION_MESSAGE",args:[this.taskHandler.getParameter(se.TASK_DYNAMIC_OMNIS_OMNIS_DISCOV_UDP_PORT_PARAM_ID).value.numbers[0]]}],buttons:[{id:qe,label:{id:P.EnumFontLabels.OK,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}]})}handleSystemSelection(e){return console.log("AdvOmnis::handleSystemSelection"),
this.isAllDevStatusDataCollected()?(this.selectedSystemTmp=Object.assign({},U.cloneJSON(this.systems[e]),{accessToken:"",username:null}),ce):""}initSTATE_SYSTEM_STATUS(){console.log("AdvOmnis::initSTATE_SYSTEM_STATUS"),console.log(y.inspect(this.selectedSystemTmp)),console.log("Restcall timeout: ",this.restcallTimeout),void 0!==this.selectedSystemTmp?(this.enqueAsyncCall(this.omnisRestProxy.getSystemStatus(this.selectedSystemTmp),{request:Zt.OMNIS_REQ_STATUS,payload:this.selectedSystemTmp},this.restcallTimeout),this.showLoadingScreen({id:"_QAPP_WF_LOADING_OVERLAY_TEXT_GETTING_SYSTEM_STATUS",args:[this.selectedSystemTmp.systemName]})):this.exitError("AdvOmnis::initSTATE_SYSTEM_STATUS: no selected system set")}handleGetStatusError(e){return k.isOmnisResponseError(e)?(e.getStatus(),this.handleCommunicationError(e)):this.handleCommunicationError(e)}handleGetStatusSuccess(e){return void 0!==this.selectedSystemTmp?(console.log("handleGetStatusSuccess status: "+y.inspect(e)),
this.selectedSystemTmp.systemId===e.status.systemId?(this.selectedSystemTmp.loginMode=e.status.loginMode,console.log("handleGetStatusSuccess after set: "+y.inspect(this.selectedSystemTmp)),Ae):(console.log(`handleGetStatusSuccess: mismatch in systemId selected: ${this.selectedSystemTmp.systemId} returned: ${e.status.systemId}`),this.showMessageBox({type:g.EnumMessageboxType.ERROR,title:{id:"_QAPP_WF_MSG_ERROR_LOGIN_SYSID_MISMATCH_TITLE",args:[]},textList:[{id:"_QAPP_WF_MSG_ERROR_LOGIN_SYSID_MISMATCH_REASON",args:[]},{id:"_QAPP_WF_MSG_ERROR_LOGIN_SYSID_MISMATCH_SOLUTION",args:[]}],buttons:[{id:At,label:{id:P.EnumFontLabels.OK,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}]}),"")):(this.exitError("AdvOmnis::initSTATE_SYSTEM_STATUS: no selected system set"),"")}initSTATE_SYSTEM_LOGIN(){if(console.log("AdvOmnis::initSTATE_SYSTEM_LOGIN"),console.log(y.inspect(this.selectedSystemTmp)),void 0!==this.selectedSystemTmp)switch(this.selectedSystemTmp.loginMode){
case B.ELoginMethods.LOGIN_NO_AUTH:case B.ELoginMethods.LOGIN_USB_DONGLE:this.enqueAsyncCall(this.omnisRestProxy.login(this.selectedSystemTmp,this.deviceGetStatusData.status.balanceSerialNumber),{request:Zt.OMNIS_REQ_LOGIN,payload:this.selectedSystemTmp},this.restcallTimeout),this.addToEventQueue(new h.ImmediateEvent({from:Ae,to:ue}));break;case B.ELoginMethods.LOGIN_USERNAME:case B.ELoginMethods.LOGIN_USERNAME_PASSWORD:if(this.isSavedCredentialsLoginAllowed&&!this.tryingLoginFromStore&&this.tryLoginFromStore()){this.tryingLoginFromStore=!0,this.addToEventQueue(new h.ImmediateEvent({from:Ae,to:this.doLogin()}));break}this.tryingLoginFromStore=!1,this.getLS().setDefaultUser("",!1),this.getLS().setLastUsers([],!1),this.getLS().setOnlyUserName(this.selectedSystemTmp.loginMode===B.ELoginMethods.LOGIN_USERNAME,!1),this.getLS().setAllowSaveCredentials("YES"==this.taskHandler.getParameter(d.TASK_DYNAMIC_OMNIS_ALLOW_STORE_CREDENTIALS_PARAM_ID).value.selection.id),this.getLS().setText1({
id:"_QAPP_WF_LOGIN_SCREEN_MSG_TOP",args:[]}),this.getLS().setText2({id:"",args:[]},!1),this.getLS().setTitle({id:"%arg0%",args:[this.selectedSystemTmp.systemName]},!1),this.getLS().setUsernameTitle({id:"_QAPP_WF_LOGIN_SCRREN_USERNAME",args:[]}),this.getLS().setPasswordTitle({id:"_QAPP_WF_LOGIN_SCRREN_PASSWORD",args:[]}),this.getLS().setBgImage(Kt,!1),this.showScreen(this.getLS()),this.hideLoadingScreen();break;default:console.log("AdvOmnis::initSTATE_SYSTEM_LOGIN: unknown login method received: "+this.selectedSystemTmp.loginMode),this.addToEventQueue(new h.ImmediateEvent({from:Ae,to:le}))}else this.exitError("AdvOmnis::initSTATE_SYSTEM_LOGIN: no system set")}tryLoginFromStore(){const e=this.accessControlProxy.getCurrentUser()._id;if(!e)return console.warn("AdvOmnis::handleSaveUserCredentials: no user ID available"),!1;let t=void 0;if(this.selectedSystemTmp&&(t=this.selectedSystemTmp.systemId),!t)return console.warn("AdvOmnis::handleSaveUserCredentials: no system ID available"),!1
;const s=ne.loadUserCredentials(e,t);return!!s&&(this.saveUserLogin=s.userLogin,this.saveUserPassword=s.userPassword,this.saveUserCredentials=!0,!0)}deinitSTATE_SYSTEM_LOGIN(){console.log("AdvOmnis::deinitSTATE_SYSTEM_LOGIN")}handleHmiLoginDataRx(e){if(console.log("AdvOmnis::handleLoginDataRx"),this.selectedSystemTmp){let t=void 0,s=void 0,a=void 0;for(let i of e.parameters)i.id===D.LOGIN_DATA_USER_PARAM_ID&&(t=i),i.id===D.LOGIN_DATA_PASS_PARAM_ID&&(s=i),i.id===D.LOGIN_DATA_SAVE_CREDENTIALS_PARAM_ID&&(a=i);return this.saveUserLogin=t?t.value.string:"",this.saveUserPassword=s?s.value.string:"",this.saveUserCredentials=!!a&&"DO_SAVE"===a.value.selection.id,console.log("Login credentials: ",{user:this.saveUserLogin,password:"***",saveCredentials:this.saveUserCredentials}),this.doLogin()}return this.exitError("AdvOmnis::handleLoginDataRx: no system set"),""}doLogin(){if(!this.selectedSystemTmp)return this.exitError("AdvOmnis::doLogin: no system set"),""
;switch(this.selectedSystemTmp.loginMode){case B.ELoginMethods.LOGIN_NO_AUTH:case B.ELoginMethods.LOGIN_USB_DONGLE:return"";case B.ELoginMethods.LOGIN_USERNAME:return this.enqueAsyncCall(this.omnisRestProxy.login(this.selectedSystemTmp,this.deviceGetStatusData.status.balanceSerialNumber,this.saveUserLogin),{request:Zt.OMNIS_REQ_LOGIN,payload:this.selectedSystemTmp},this.restcallTimeout),ue;case B.ELoginMethods.LOGIN_USERNAME_PASSWORD:return this.enqueAsyncCall(this.omnisRestProxy.login(this.selectedSystemTmp,this.deviceGetStatusData.status.balanceSerialNumber,this.saveUserLogin,this.saveUserPassword),{request:Zt.OMNIS_REQ_LOGIN,payload:this.selectedSystemTmp},this.restcallTimeout),ue;default:return""}}initSTATE_SYSTEM_LOGGING_IN(){console.log("initSTATE_SYSTEM_LOGGING_IN"),this.selectedSystemTmp?this.showLoadingScreen({id:"_QAPP_WF_OVERLAY_TEXT_LOGGING_IN",args:[this.selectedSystemTmp.systemName]}):this.exitError("AdvOmnis::initSTATE_SYSTEM_LOGGING_IN: no system set")}
handleLoginError(e){if(!k.isOmnisResponseError(e))return this.handleCommunicationError(e);switch(e.getStatus()){case B.OMNIS_ERR_CODE_LOGIN_UNAUTHORIZED:return e.getReason()===B.OMNIS_ERR_CODE_UNAUTHORIZED_REASON_WRONG_UN?(this.showErrorMessage(e,ut),""):(this.showErrorMessage(e,Tt),"");case B.OMNIS_ERR_CODE_LOGIN_NOT_FOUND:case B.OMNIS_ERR_CODE_LOGIN_FORBIDDEN:return this.showErrorMessage(e,Tt),"";default:return this.handleCommunicationError(e)}}handleLoginSuccess(e){return this.selectedSystemTmp?(this.connectedSystem=this.selectedSystemTmp,this.connectedSystem.accessToken=e.authResponse.omnisAccessToken,this.connectedSystem.username=e.authResponse.userName,this.saveUserCredentials&&this.handleSaveUserCredentials(),this.tryingLoginFromStore=!1,void 0!==e.authResponse.automaticLockAfterMinutes&&e.authResponse.automaticLockAfterMinutes>0?(console.log(`AdvOmnis::handleLoginSuccess: enable lock timer: ${60*e.authResponse.automaticLockAfterMinutes}s`),
this.connectedSystem.lockTimeoutSec=60*e.authResponse.automaticLockAfterMinutes,this.autoLogout?(this.showMessageBox({type:g.EnumMessageboxType.WARNING,title:{id:"_QAPP_WF_MSG_WARNING_LOGIN_AUTOLOGOUT_TITLE",args:[]},textList:[{id:"_QAPP_WF_MSG_WARNING_LOGIN_AUTOLOGOUT_REASON",args:[]},{id:"_QAPP_WF_MSG_WARNING_LOGIN_AUTOLOGOUT_SOLUTION",args:[]}],buttons:[{id:dt,label:{id:P.EnumFontLabels.OK,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}]}),""):(this.getLockingAspect().setTimeout(this.connectedSystem.lockTimeoutSec),Ie)):(console.log("AdvOmnis::handleLoginSuccess: disable lock timer"),this.connectedSystem.lockTimeoutSec=Number.NaN,this.getLockingAspect().setTimeout(Number.NaN),Ie)):(this.exitError("AdvOmnis::handleLoginSuccess: no system set"),"")}handleSaveUserCredentials(){console.log("AdvOmnis::handleSaveUserCredentials");const e=this.saveUserLogin?this.saveUserLogin.trim():"",t=this.saveUserPassword?this.saveUserPassword:""
;if(!e||!t)return void console.warn("AdvOmnis::handleSaveUserCredentials: login/password empty, nothing to store");const s=this.connectedSystem&&this.connectedSystem.systemId?this.connectedSystem.systemId:"";if(!s)return void console.warn("AdvOmnis::handleSaveUserCredentials: no system ID available");const a=this.accessControlProxy.getCurrentUser()._id;a?ne.saveUserCredentials(a,s,e,t):console.warn("AdvOmnis::handleSaveUserCredentials: no user ID available")}handleAutoLogoutConflictOKButton(){return console.log("AdvOmnis::handleAutoLogoutConflictOKButton"),this.connectedSystem?(this.getLockingAspect().setTimeout(this.connectedSystem.lockTimeoutSec),this.hideMsgBox(),Ie):(this.exitError("AdvOmnis::handleAutoLogoutConflictOKButton: no system set"),"")}initSTATE_SYSTEM_LOGGING_OUT(){this.showLoadingScreen({id:"_QAPP_WF_OVERLAY_TEXT_LOGGING_OUT",args:[]}),
this.connectedSystem?(this.postLogoutAction===es.AFTER_LOGOUT_SEL_SYS&&(console.log("------------  Remove saved user credentials ---------------"),this.removeSavedUserCredentials()),this.enqueAsyncCall(this.omnisRestProxy.logout(U.cloneJSON(this.connectedSystem)),{request:Zt.OMNIS_REQ_LOGOUT,payload:void 0},this.restcallTimeout)):this.handleLogout(void 0),this.connectedSystem=void 0,this.hideMsgBox(),this.disableLockingScreen()}removeSavedUserCredentials(){if(this.isSavedCredentialsLoginAllowed){const e=this.accessControlProxy.getCurrentUser()._id;if(!e)return void console.warn("AdvOmnis::removeSavedUserCredentials: no user ID available");const t=this.connectedSystem?this.connectedSystem.systemId:"";if(!t)return void console.warn("AdvOmnis::removeSavedUserCredentials: no system ID available");ne.deleteUserCredentials(e,t)?console.log("AdvOmnis::removeSavedUserCredentials: user/system ID removed"):console.log("AdvOmnis::removeSavedUserCredentials: user/system ID not found")}}
handleLogout(e){switch(console.log("AdvOmnis::handleLogout"),this.postLogoutAction){case es.AFTER_LOGOUT_LOGOUT:this.rememberLogout(),this.suspend();break;case es.AFTER_LOGOUT_SEL_SYS:this.addToEventQueue(new h.ImmediateEvent({from:Te,to:_e}));break;case es.AFTER_LOGOUT_SUSPEND:default:this.suspend()}}initSTATE_INVALID_SESSION_ERROR(){console.log("initSTATE_INVALID_SESSION_ERROR::handleLogout"),this.disableLockingScreen()}initSTATE_COMMUNICATION_ERROR(){console.log("AdvOmnis::initSTATE_COMMUNICATION_ERROR"),this.disableLockingScreen()}initSTATE_SELECT_ACTION(){if(this.connectedSystem){this.selectedSampleList=void 0,this.selectedSample=void 0,this.selectedSubSample=void 0,this.selectedRequest=void 0,this.menuHomeButtonDesc.appearance=i.EnumAppearance.ENABLED_SECONDARY,this.actionWeighingInButton.setAppearance(i.EnumAppearance.ENABLED_SECONDARY),this.actionWeighingBackButton.setAppearance(i.EnumAppearance.ENABLED_SECONDARY),
this.actionRemoteControlButton.setAppearance(i.EnumAppearance.ENABLED_SECONDARY),this.menuLogoutButton.setAppearance(i.EnumAppearance.ENABLED_SECONDARY),this.getButtonBarScreen().setTopLeftButton(this.menuHomeButtonDesc);let e={id:Fe,appearance:i.EnumAppearance.ENABLED,type:T.EnumTabType.TAB_MENU,containerTitle:{id:this.connectedSystem.systemName,args:[]},title:a.createEmptyTextStructure(),topbuttons:["/QAPP/"+this.menuLogoutButton.getTopic()],menuType:T.TAB_MENU_TYPE_TOPIC,tableType:T.TAB_MENU_TYPE_TOPIC,menubuttons:["/QAPP/"+this.actionWeighingInButton.getTopic(),"/QAPP/"+this.actionWeighingBackButton.getTopic(),"/QAPP/"+this.actionRemoteControlButton.getTopic()],scrollToTop:!0};this.getButtonBarScreen().setMenuTab(e),this.showScreen(this.getButtonBarScreen()),this.hideLoadingScreen()}else this.exitError("AdvOmnis::initSTATE_SELECT_ACTION: no system set")}updateSampleListSelScreen(e){console.log("AdvOmnis::updateSampleListSelScreen");let t=this.sampleListsSearchStr.toLowerCase(),s=[]
;this.sampleLists.forEach((e,a)=>{if(0===this.sampleListsSearchStr.length||this.sampleListsSearchStr.length>0&&-1!==e.name.toLowerCase().indexOf(t)){let t={icon:P.EnumFontLabels.LIST,label:{id:e.name||" ",args:[],align:"l",appearance:i.EnumAppearance.ENABLED_SECONDARY,effect:r.createButtonEmptyEffect(Ze+a)},labelRight:{id:oe(e.modificationDate,this.dateTimeFormatStr)||" ",args:[],align:"l",appearance:i.EnumAppearance.ENABLED}};void 0!==this.selectedSampleList&&this.selectedSampleList.id===e.id&&(t.lastSelected=!0),s.push(t)}}),s.length>0?(0===this.sampleListsSearchStr.length?_.setNoSearchActive(this.searchListButton,!1):_.setSearchActive(this.searchListButton,!1),this.searchListButton.setAppearance(i.EnumAppearance.ENABLED)):(s.push({label:{id:this.sampleListsSearchStr.length>0?"_QAPP_LIB_SELECT_ITEM_NO_DATA_SEARCH_ACTIVE_MSG":"_QAPP_WF_SELECT_NO_SAMPLELISTS",args:[],align:"l",appearance:i.EnumAppearance.DISABLED}}),
0===this.sampleListsSearchStr.length?(_.setNoSearchActive(this.searchListButton,!1),this.searchListButton.setAppearance(i.EnumAppearance.DISABLED)):(_.setSearchActive(this.searchListButton,!1),this.searchListButton.setAppearance(i.EnumAppearance.ENABLED_SECONDARY))),this.reloadListButton.setAppearance(i.EnumAppearance.ENABLED_SECONDARY);let n={id:We,appearance:i.EnumAppearance.ENABLED,type:T.EnumTabType.TAB_TABLE,containerTitle:{id:"_QAPP_WF_SELECT_SAMPLELIST_TITLE",args:[]},title:a.createEmptyTextStructure(),topbuttons:["/QAPP/"+this.reloadListButton.getTopic(),"/QAPP/"+this.searchListButton.getTopic(),"/QAPP/"+this.menuLogoutButton.getTopic()],tableHeader:{tableHeaderLeft:{id:"_QAPP_WF_SELECT_SAMPLELIST_COL_NAME_TITLE",args:[],align:"l"},tableHeaderRight:{id:"_QAPP_WF_SELECT_SAMPLELIST_COL_DATE_TITLE",args:[],align:"l"}},tableType:T.TAB_MENU_TYPE_BULK,menuBulkButtons:s,scrollToTop:e};this.getButtonBarScreen().setTableTab(n),this.showScreen(this.getButtonBarScreen())}
loadSampleLists(){console.log("AdvOmnis::loadSampleLists"),this.selectedSampleList=void 0,this.showLoadingScreen({id:"_QAPP_WF_LOADING_OVERLAY_TEXT_LOADING_SAMPLELISTS",args:[]}),this.enqueAsyncCall(this.omnisRestProxy.getSampleLists(this.connectedSystem),{request:Zt.OMNIS_REQ_GET_SAMPLE_LISTS_REQ,payload:this.connectedSystem},this.restcallTimeout)}initSTATE_WIN_SAMPLE_LIST(){console.log("AdvOmnis::initSTATE_WIN_SAMPLE_LIST"),this.selectedSample=void 0,this.selectedSubSample=void 0,this.menuBackButtonDesc.appearance=i.EnumAppearance.ENABLED_SECONDARY,this.getButtonBarScreen().setTopLeftButton(this.menuBackButtonDesc),this.doReloadSampleLists?this.loadSampleLists():(this.updateSampleListSelScreen(!1),this.hideLoadingScreen()),this.doReloadSampleLists=!1}initSTATE_WIN_SAMPLE_LISTFromLeft(){this.sampleListsSearchStr="",this.doReloadSampleLists=!0}handleSampleListsReload(){this.loadSampleLists()}handleSampleListsSearch(e){this.sampleListsSearchStr=e,this.updateSampleListSelScreen(!0)}
handleSampleListSelection(e){return this.selectedSampleList=this.sampleLists[e],console.log(`AdvOmnis::handleSampleListSelection: selected sampleList: ${this.selectedSampleList.id}`),pe}handleSampleListsRxFail(e){if(!k.isOmnisResponseError(e))return this.handleCommunicationError(e);switch(e.getStatus()){case B.OMNIS_ERR_CODE_GET_SAMPLE_LISTS_UNAUTHORIZED:return this.handleSessionError(e);default:return this.handleCommunicationError(e)}}handleSampleListsRx(e){console.log("AdvOmnis::handleSampleListRx"),this.sampleLists=e.sampleLists,this.updateSampleListSelScreen(!0),this.hideLoadingScreen()}updateSamplesSelScreen(e){if(console.log("AdvOmnis::updateSamplesSelScreen"),this.connectedSystem&&this.selectedSampleList){let t=this.samplesSearchStr.toLowerCase(),s=[];this.samples.forEach((e,a)=>{if(0===this.samplesSearchStr.length||this.samplesSearchStr.length>0&&-1!==e.name.toLowerCase().indexOf(t)){let t={label:{id:e.name||" ",args:[],align:"l",appearance:i.EnumAppearance.ENABLED_SECONDARY,
effect:r.createButtonEmptyEffect(et+a)},icon:P.EnumFontLabels.SAMPLE};void 0!==this.selectedSample&&this.selectedSample.id===e.id&&(t.lastSelected=!0),s.push(t)}}),s.length>0?(0===this.samplesSearchStr.length?_.setNoSearchActive(this.searchListButton,!1):_.setSearchActive(this.searchListButton,!1),this.searchListButton.setAppearance(i.EnumAppearance.ENABLED)):(s.push({label:{id:this.samplesSearchStr.length>0?"_QAPP_LIB_SELECT_ITEM_NO_DATA_SEARCH_ACTIVE_MSG":"_QAPP_WF_SELECT_NO_SAMPLES",args:[],align:"l",appearance:i.EnumAppearance.DISABLED}}),0===this.samplesSearchStr.length?(_.setNoSearchActive(this.searchListButton,!1),this.searchListButton.setAppearance(i.EnumAppearance.DISABLED)):(_.setSearchActive(this.searchListButton,!1),this.searchListButton.setAppearance(i.EnumAppearance.ENABLED_SECONDARY))),this.reloadListButton.setAppearance(i.EnumAppearance.ENABLED_SECONDARY);let n={id:xe,appearance:i.EnumAppearance.ENABLED,type:T.EnumTabType.TAB_TABLE,containerTitle:{
id:"_QAPP_WF_SELECT_SAMPLE_TITLE",args:[this.selectedSampleList.name]},title:a.createEmptyTextStructure(),topbuttons:["/QAPP/"+this.reloadListButton.getTopic(),"/QAPP/"+this.searchListButton.getTopic(),"/QAPP/"+this.menuLogoutButton.getTopic()],tableHeader:{tableHeaderLeft:{id:"_QAPP_WF_SELECT_SAMPLE_COL_NAME_TITLE",args:[],align:"l"}},tableType:T.TAB_MENU_TYPE_BULK,menuBulkButtons:s,scrollToTop:e};this.getButtonBarScreen().setTableTab(n),this.showScreen(this.getButtonBarScreen())}}loadSamples(){this.selectedSampleList?(console.log("AdvOmnis::loadSamples: list: "+this.selectedSampleList.id),this.selectedSample=void 0,this.showLoadingScreen({id:"_QAPP_WF_LOADING_OVERLAY_TEXT_LOADING_SAMPLES",args:[]}),this.enqueAsyncCall(this.omnisRestProxy.getSamples(this.connectedSystem,this.selectedSampleList),{request:Zt.OMNIS_REQ_GET_SAMPLES_REQ,payload:this.connectedSystem},this.restcallTimeout)):this.exitError("AdvOmnis::loadSamples: no sampleList selected")}initSTATE_WIN_SAMPLES(){
console.log("AdvOmnis::initSTATE_WIN_SAMPLES"),this.selectedSubSample=void 0,this.menuBackButtonDesc.appearance=i.EnumAppearance.ENABLED_SECONDARY,this.getButtonBarScreen().setTopLeftButton(this.menuBackButtonDesc),this.doReloadSamples?this.loadSamples():(this.updateSamplesSelScreen(!1),this.hideLoadingScreen()),this.doReloadSamples=!1}initSTATE_WIN_SAMPLESFromLeft(){this.samplesSearchStr="",this.doReloadSamples=!0}handleSamplesReload(){this.loadSamples()}handleSamplesSearch(e){this.samplesSearchStr=e,this.selectedSample=void 0,this.updateSamplesSelScreen(!0)}handleSamplesSelection(e){return this.selectedSample=this.samples[e],console.log(`AdvOmnis::handleSamplesSelection: selected sample: ${this.selectedSample.id}`),Ne}handleSamplesRxFail(e){if(!k.isOmnisResponseError(e))return this.handleCommunicationError(e);switch(e.getStatus()){case B.OMNIS_ERR_CODE_GET_SAMPLES_UNAUTHORIZED:return this.handleSessionError(e);case B.OMNIS_ERR_CODE_GET_SAMPLES_NOT_FOUND:
return this.doReloadSampleLists=!0,this.showErrorMessage(e,pt),"";default:return this.handleCommunicationError(e)}}handleSamplesRx(e){console.log("AdvOmnis::handleSampleRx"),this.samples=e.samples,this.updateSamplesSelScreen(!0),this.hideLoadingScreen()}updateSubSamplesSelScreen(e){if(console.log("AdvOmnis::updateSubSamplesSelScreen"),this.selectedSample){let t=this.subSamplesSearchStr.toLowerCase(),s=[],n=Number.NaN;this.subSamples.forEach((e,a)=>{if(0===this.subSamplesSearchStr.length||this.subSamplesSearchStr.length>0&&-1!==e.name.toLowerCase().indexOf(t)){void 0!==this.selectedSubSample&&this.selectedSubSample.id===e.id&&(n=s.length);let t=this.createRackInfoString(e.rack,e.samplePosition),o={icon:!0===e.done?P.EnumFontLabels.SUBSAMPLE_DONE:P.EnumFontLabels.SUBSAMPLE,label:{id:e.name||" ",args:[],align:"l",appearance:i.EnumAppearance.ENABLED_SECONDARY},labelCenter:{id:t||" ",args:[],align:"l",appearance:i.EnumAppearance.ENABLED_SECONDARY,
effect:void 0!==e.rack||void 0!==e.samplePosition?r.createButtonEmptyEffect(st+a):void 0},labelRight:{id:this.createSampleSizeString(e.size||" ",e.sizeUnit),args:[],align:"r",appearance:i.EnumAppearance.ENABLED,effect:r.createButtonEmptyEffect(tt+a)}};void 0!==this.selectedSubSample&&this.selectedSubSample.id===e.id&&(o.lastSelected=!0),s.push(o)}}),s.length>0?(0===this.subSamplesSearchStr.length?_.setNoSearchActive(this.searchListButton,!1):_.setSearchActive(this.searchListButton,!1),this.searchListButton.setAppearance(i.EnumAppearance.ENABLED)):(s.push({label:{id:this.subSamplesSearchStr.length>0?"_QAPP_LIB_SELECT_ITEM_NO_DATA_SEARCH_ACTIVE_MSG":"_QAPP_WF_SELECT_NO_SUBSAMPLES",args:[],align:"l",appearance:i.EnumAppearance.DISABLED}}),0===this.subSamplesSearchStr.length?(_.setNoSearchActive(this.searchListButton,!1),this.searchListButton.setAppearance(i.EnumAppearance.DISABLED)):(_.setSearchActive(this.searchListButton,!1),
this.searchListButton.setAppearance(i.EnumAppearance.ENABLED_SECONDARY))),this.reloadListButton.setAppearance(i.EnumAppearance.HIDDEN);let o={id:Qe,appearance:i.EnumAppearance.ENABLED,type:T.EnumTabType.TAB_TABLE,containerTitle:{id:"_QAPP_WF_SELECT_SUBSAMPLE_TITLE",args:[this.selectedSample.name]},title:a.createEmptyTextStructure(),topbuttons:["/QAPP/"+this.reloadListButton.getTopic(),"/QAPP/"+this.searchListButton.getTopic(),"/QAPP/"+this.menuLogoutButton.getTopic()],tableHeader:{tableHeaderLeft:{id:"_QAPP_WF_SELECT_SUBSAMPLE_COL_NAME_TITLE",args:[],align:"l"},tableHeaderCenter:{id:"_QAPP_WF_SELECT_SUBSAMPLE_COL_RACK_TITLE",args:[],align:"l"},tableHeaderRight:{id:"_QAPP_WF_SELECT_SUBSAMPLE_COL_SIZE_TITLE",args:[],align:"r"}},tableType:T.TAB_MENU_TYPE_BULK,menuBulkButtons:s,scrollToTop:e,forceVisibleIdx:n};this.getButtonBarScreen().setTableTab(o),this.showScreen(this.getButtonBarScreen()),this.hideLoadingScreen()
}else this.exitError("AdvOmnis::updateSubSamplesSelScreen: no sample selected")}loadSubSamples(){this.selectedSampleList&&this.selectedSample?(console.log("AdvOmnis::loadSubSamples"),this.selectedSubSample=void 0,this.showLoadingScreen({id:"_QAPP_WF_LOADING_OVERLAY_TEXT_LOADING_SUBSAMPLES",args:[]}),this.enqueAsyncCall(this.omnisRestProxy.getSubSamples(this.connectedSystem,this.selectedSampleList,this.selectedSample),{request:Zt.OMNIS_REQ_GET_SUBSAMPLES_REQ,payload:this.connectedSystem},this.restcallTimeout)):this.exitError("AdvOmnis::loadSubSamples: no sampleList or sample selected")}initSTATE_WIN_SUBSAMPLE(){console.log("AdvOmnis::initSTATE_WIN_SUBSAMPLE"),this.menuBackButtonDesc.appearance=i.EnumAppearance.ENABLED_SECONDARY,this.getButtonBarScreen().setTopLeftButton(this.menuBackButtonDesc),this.doReloadSubSamples?this.loadSubSamples():(this.updateSubSamplesSelScreen(!1),this.hideLoadingScreen()),this.doReloadSubSamples=!1}initSTATE_WIN_SUBSAMPLEFromLeft(){
this.subSamplesSearchStr="",this.doReloadSubSamples=!0}handleSubSamplesReload(){this.loadSubSamples()}handleSubSamplesSearch(e){this.subSamplesSearchStr=e,this.selectedSubSample=void 0,this.updateSubSamplesSelScreen(!0)}handleSubSampleSelection(e){return this.selectedSubSample=this.subSamples[e],console.log(`AdvOmnis::handleSubSampleSelection: selected subsample idx ${e}: ${this.selectedSubSample.id}`),Re}handleSubSampleRxFail(e){if(!k.isOmnisResponseError(e))return this.handleCommunicationError(e);switch(e.getStatus()){case B.OMNIS_ERR_CODE_GET_SUBSAMPLES_UNAUTHORIZED:return this.handleSessionError(e);case B.OMNIS_ERR_CODE_GET_SUBSAMPLES_NOT_FOUND:return this.doReloadSampleLists=!0,this.showErrorMessage(e,Nt),"";default:return this.handleCommunicationError(e)}}handleSubSampleRx(e){console.log("AdvOmnis::handleSubSampleRx"),this.subSamples=e.subsamples,this.updateSubSamplesSelScreen(!0)}handleRackEditBtn(e){if(console.log("AdvOmnis::handleRackEditBtn"),
this.selectedSubSample=this.subSamples[e],this.selectedSubSample){let e={id:"TASK/DYNAMIC_RACKEDIT",type:i.EnumParameterTypes.PARAM_GROUP,appearance:i.EnumAppearance.ENABLED,title:{id:"_QAPP_WF_SUBSAMPLE_EDIT_RACK_PARAM_TITLE_SEL_RACK_EDIT",args:[]},parameters:[]};e.parameters.push({id:wt,type:i.EnumParameterTypes.PARAM_STRING,appearance:void 0!==this.selectedSubSample.rack?i.EnumAppearance.ENABLED:i.EnumAppearance.DISABLED,title:{id:"_QAPP_WF_SUBSAMPLE_EDIT_RACK_PARAM_TITLE_RACK_NAME",args:[]},header:{id:"_QAPP_WF_SUBSAMPLE_EDIT_RACK_PARAM_HEADER_RACK_NAME",args:[]},value:{string:void 0!==this.selectedSubSample.rack?this.selectedSubSample.rack:""},info:{isNoValueAllowed:!0,minimum:{length:1},maximum:{autoCut:!1,length:250}}});let t=-1e10,s=1e10;return e.parameters.push({id:Vt,type:i.EnumParameterTypes.PARAM_QUANTITY,appearance:void 0!==this.selectedSubSample.samplePosition?i.EnumAppearance.ENABLED:i.EnumAppearance.DISABLED,title:{
id:"_QAPP_WF_SUBSAMPLE_EDIT_RACK_PARAM_TITLE_RACK_POSITION",args:[]},header:{id:"_QAPP_WF_SUBSAMPLE_EDIT_RACK_PARAM_HEADER_RACK_POSITION",args:[]},value:{unit:"",decimals:-1,numbers:void 0!==this.selectedSubSample.samplePosition?[this.selectedSubSample.samplePosition.toString(10)]:[],preferredDecimals:-1},info:{isNoValueAllowed:!1,minimum:{value:t.toString(10)},maximum:{value:s.toString(10)}},directInput:!0}),this.getEditParamAspect().configure({parameters:[e],handleParamUpdateUserActionFn:(e,t)=>!0,isValidFn:()=>!0,updateParameterFn:e=>{this.getEditParamAspect().updateParameterAndPublish(e)},cancelState:Ne,nextState:he}),ee.STATE_ASPECT_EDIT_PARAMS_EDIT_ENTER}return""}initSTATE_WIN_SUBSAMPLE_RACK_EDIT_PROCESSING(){if(console.log("AdvOmnis::initSTATE_WIN_SUBSAMPLE_RACK_EDIT_PROCESSING"),this.selectedSubSample){let e={};void 0!==this.selectedSubSample.rack&&(e.rack=this.getEditParamAspect().getConfig().parameters[0].parameters[0].value.string),
void 0!==this.selectedSubSample.samplePosition&&(e.samplePosition=parseFloat(this.getEditParamAspect().getConfig().parameters[0].parameters[1].value.numbers[0])),this.showLoadingScreen({id:"_QAPP_WF_LOADING_OVERLAY_TEXT_SENDING_SUBSAMPLE_RACK_INFO",args:[]}),this.enqueAsyncCall(this.omnisRestProxy.sendSubSampleRackInfo(this.connectedSystem,this.selectedSubSample.id,e),{request:Zt.OMNIS_REQ_SEND_SUBSAMPLE_RACK_INFO_REQ,payload:[this.connectedSystem,this.selectedSubSample,e]},this.restcallTimeout)}else this.exitError("AdvOmnis::initSTATE_WIN_SUBSAMPLE_RACK_EDIT_PROCESSING: no subsample set")}handleSendSubSampleRackInfoSuccess(e){if(console.log("AdvOmnis::handleSendSubSampleRackInfoSuccess"),this.selectedSubSample&&this.selectedSubSample.id===e.payload.metadata.payload[1].id){let t=e.payload.metadata.payload[2].rack,s=e.payload.metadata.payload[2].samplePosition;return void 0!==this.selectedSubSample.rack&&void 0!==t&&(this.selectedSubSample.rack=t),
void 0!==this.selectedSubSample.samplePosition&&void 0!==s&&(this.selectedSubSample.samplePosition=s),Ne}return this.exitError("AdvOmnis::handleSendSubSampleRackInfoSuccess: no subsample set or async id mismatch"),""}handleSendSubSampleRackInfoFail(e){let t=e.payload.reason;if(!k.isOmnisResponseError(t))return this.handleCommunicationError(t);switch(t.getStatus()){case B.OMNIS_ERR_CODE_SEND_SUBSAMPLE_RACKINFO_UNAUTHORIZED:return this.handleSessionError(t);case B.OMNIS_ERR_CODE_SEND_SUBSAMPLE_RACKINFO_NOT_FOUND:return this.doReloadSampleLists=!0,this.showErrorMessage(t,Ot),"";case B.OMNIS_ERR_CODE_SEND_SUBSAMPLE_RACKINFO_BAD_REQUEST:return this.showErrorMessage(t,gt),"";case B.OMNIS_ERR_CODE_SEND_SUBSAMPLE_RACKINFO_CONFLICT:return this.doReloadSubSamples=!0,this.showErrorMessage(t,Pt),"";default:return this.handleCommunicationError(t)}this.hideLoadingScreen()}initSTATE_WIN_WEIGHING(){if(console.log("AdvOmnis::initSTATE_WIN_WEIGHING"),this.selectedSubSample){
if(this.lastTakenWeightValue=void 0,this.getWSS().setText1(""),this.getWSS().setText2(""),void 0!==this.selectedSubSample.sizeUnit&&this.selectedSubSample.sizeUnit.length>0){if(console.log("AdvOmnis::initSTATE_WIN_WEIGHING: unit present: "+this.selectedSubSample.sizeUnit),this.weighingProxy.setButton(R.WEIGHING_BUTTON_UNIT,i.EnumAppearance.DISABLED),!this.weighingProxy.setUnit(ie.getUnitEnum(this.selectedSubSample.sizeUnit),!1)){console.log("AdvOmnis::initSTATE_WIN_WEIGHING: unit set failed");let e=l.QAppBase.clientSingleton.getWeighingProfileId(),t=new w.ProfileManagementProxy;return this.hideMsgBox(),void this.showMessageBox({type:g.EnumMessageboxType.ERROR,title:{id:"_QAPP_WF_MSG_ERROR_UNIT_NOT_AVAIL_TITLE",args:[]},textList:[{id:"_QAPP_WF_MSG_ERROR_UNIT_NOT_AVAIL_REASON",args:[this.selectedSubSample.sizeUnit,e?t.getWeighingProfileName(e):""]},{id:"_QAPP_WF_MSG_ERROR_UNIT_NOT_AVAIL_SOLUTION",args:[]}],buttons:[{id:Dt,label:{id:P.EnumFontLabels.OK,args:[]},
appearance:i.EnumAppearance.ENABLED_SECONDARY}]})}console.log("AdvOmnis::initSTATE_WIN_WEIGHING: unit set passed"),this.updateMinMaxValuesForSample(this.selectedSubSample.sizeRange,this.selectedSubSample.sizeUnit)}else console.log("AdvOmnis::initSTATE_WIN_WEIGHING: there is no unit set - enable unit button"),this.weighingProxy.setButton(R.WEIGHING_BUTTON_UNIT,i.EnumAppearance.ENABLED_SECONDARY),this.updateMinMaxValuesForSample(void 0,"");this.getWSS().setParam1(this.qP_4_SampleMin.getPublishedId()),this.getWSS().setParam2(this.qP_4_SampleMax.getPublishedId()),this.updateSubSampleWINTab(),this.winWSSParamTab.show(),this.wbackWSSParamTab.hide(),this.getWSS().getCheckBarGraph().setAreas(f.EnumAreaCount.FOUR_AREAS,!1),this.getWSS().getCheckBarGraph().setAppearance(i.EnumAppearance.HIDDEN,!1),this.getWSS().getCheckBarGraph().publishStatus(),this.updateRequestedTakeoverButtonAppearance(i.EnumAppearance.DISABLED),
this.getWSS().getButton(D.BACK_BUTTON_ID).setAppearance(i.EnumAppearance.ENABLED_SECONDARY),this.weighingProxy.setButton(R.WEIGHING_BUTTON_DO_TARE,i.EnumAppearance.ENABLED_SECONDARY),this.weighingProxy.setButton(R.WEIGHING_BUTTON_DO_ZERO,i.EnumAppearance.ENABLED_SECONDARY),this.showScreen(this.getWSS()),this.hideLoadingScreen()}else this.exitError("AdvOmnis::initSTATE_WIN_WEIGHING: no subsample set")}handleTakeoverSTATE_WIN_WEIGHING(){return console.log("AdvOmnis::handleTakeoverSTATE_WIN_WEIGHING"),this.getStabilityAspect().configure({exitStateNoStability:Re,nextState:me,mode:o.WaitingForStabilityModeEnum.WaitStableModeReporting,exitStateNotValid:Re,handleMqttEvent:e=>{e.payload.topic===ae.MqttTopics.WEIGHING_VALUE_NET&&this.handleWeighValueSTATE_WIN_WEIGHING(JSON.parse(e.payload.value.toString()))},isWeightValueValid:e=>{let t=new M.MeasureParameter(m.WeightBlockHelper.getMeasureParameter(e,ae.MqttTopics.WEIGHING_VALUE_NET),!0)
;return!(t.isSpecial()||!t.isStable())&&(!!this.selectedSubSample&&this.checkMinMax(t))}}),o.STATE_ASPECT_WAITING_FOR_STABILITY}updateSubSampleWINTab(){console.log("AdvOmnis::updateSubSampleWINTab"),this.selectedSubSample&&this.selectedSample&&(this.xP_4_SubSample.sampleName.getValue().value.string=this.selectedSample.name||"",this.xP_4_SubSample.name.getValue().value.string=this.selectedSubSample.name||"",this.xP_4_SubSample.listPos.getValue().value.string=this.selectedSubSample.listPosition.toString(10),this.xP_4_SubSample.size.getValue().value.string=this.createSampleSizeString(this.selectedSubSample.size,this.selectedSubSample.sizeUnit),this.xP_4_SubSample.rack.getValue().value.string=this.createRackInfoString(this.selectedSubSample.rack,this.selectedSubSample.samplePosition),""===this.xP_4_SubSample.rack.getValue().value.string?this.xP_4_SubSample.rack.getValue().appearance=i.EnumAppearance.HIDDEN:this.xP_4_SubSample.rack.getValue().appearance=i.EnumAppearance.ENABLED,
this.xP_4_SubSample.sampleName.publish(),this.xP_4_SubSample.name.publish(),this.xP_4_SubSample.listPos.publish(),this.xP_4_SubSample.size.publish(),this.xP_4_SubSample.rack.publish())}handleWeighValueSTATE_WIN_WEIGHING(e){if(this.selectedSubSample){let t=new M.MeasureParameter(e,!0);this.updateCheckBarGraph(t,t.getValue().value.unit),this.checkMinMax(t)&&void 0!==this.lastCalibState?this.updateRequestedTakeoverButtonAppearance(i.EnumAppearance.ENABLED_PRIMARY):this.updateRequestedTakeoverButtonAppearance(i.EnumAppearance.DISABLED)}else this.exitError("AdvOmnis::handleWeighValueSTATE_WIN_WEIGHING: no subsample set")}initSTATE_WIN_WEIGHING_WEIGHT_TAKEN(){if(console.log("AdvOmnis::initSTATE_WIN_WEIGHING_WEIGHT_TAKEN"),this.selectedSubSample&&void 0!==this.lastCalibState){let e=this.buildC2OWeighStructure(this.lastCalibState);null!==e?(this.enqueAsyncCall(this.omnisRestProxy.sendSubSampleWeight(this.connectedSystem,this.selectedSubSample.id,e),{request:Zt.OMNIS_REQ_SEND_SUBSAMPLE_WIN_REQ,
payload:[this.connectedSystem,this.selectedSubSample,e]},this.restcallTimeout),this.showLoadingScreen({id:"_QAPP_WF_LOADING_OVERLAY_TEXT_SENDING_SUBSAMPLE_WIN",args:[]})):this.exitError("AdvOmnis::initSTATE_WIN_WEIGHING_WEIGHT_TAKEN: no alibi id, although stable and valid")}else this.exitError("AdvOmnis::initSTATE_WIN_WEIGHING_WEIGHT_TAKEN: no subsample set")}handleSendSubSampleWeightSuccess(e){return this.selectedSubSample&&this.selectedSubSample.id===e.payload.metadata.payload[1].id?(this.selectedSubSample.size=e.payload.metadata.payload[2].size,this.selectedSubSample.sizeUnit=e.payload.metadata.payload[2].sizeUnit,this.selectedSubSample.done=!0,Oe):(this.exitError("AdvOmnis::handleSendSubSampleWeightSuccess: no subsample set or async id mismatch"),"")}handleSendSubSampleWeightFail(e){let t=e.payload.reason;if(!k.isOmnisResponseError(t))return this.handleCommunicationError(t);switch(t.getStatus()){case B.OMNIS_ERR_CODE_SEND_SUBSAMPLE_WEIGHT_UNAUTHORIZED:
return this.handleSessionError(t);case B.OMNIS_ERR_CODE_SEND_SUBSAMPLE_WEIGHT_NOT_FOUND:return this.doReloadSampleLists=!0,this.showErrorMessage(t,ht),"";case B.OMNIS_ERR_CODE_SEND_SUBSAMPLE_WEIGHT_BAD_REQUEST:return this.showErrorMessage(t,Rt),"";case B.OMNIS_ERR_CODE_SEND_SUBSAMPLE_WEIGHT_CONFLICT:return this.doReloadSubSamples=!0,this.showErrorMessage(t,mt),"";default:return this.handleCommunicationError(t)}}initSTATE_WIN_WEIGHING_WEIGHT_TAKEN_CONFIRM(){if(console.log("AdvOmnis::initSTATE_WIN_WEIGHING_WEIGHT_TAKEN_CONFIRM"),this.selectedSubSample){this.hideLoadingScreen();let e=this.createRackInfoString(this.selectedSubSample.rack,this.selectedSubSample.samplePosition);this.showMessageBox({type:g.EnumMessageboxType.INFO,title:{id:"_QAPP_WF_MSG_SUCCESSFULLY_TRANSMITTED_TITLE",args:[]},buttons:[{id:_t,label:{id:P.EnumFontLabels.OK,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}],textList:""!==e?[{id:"_QAPP_WF_MSG_SUCCESSFULLY_TRANSMITTED_SS_RACK_1",
args:[this.selectedSubSample.name||jt]},{id:"_QAPP_WF_MSG_SUCCESSFULLY_TRANSMITTED_SS_RACK_2",args:[]},{id:e,args:[]}]:[{id:"_QAPP_WF_MSG_SUCCESSFULLY_TRANSMITTED_SS_NO_RACK",args:[this.selectedSubSample.name||jt]}]})}else this.exitError("AdvOmnis::initSTATE_WIN_WEIGHING_WEIGHT_TAKEN_CONFIRM: no subsample set")}handleTransmissionConfirmedSTATE_WIN_WEIGHING_WEIGHT_TAKEN_CONFIRM(){if(console.log("AdvOmnis::handleTransmissionConfirmedSTATE_WIN_WEIGHING_WEIGHT_TAKEN_CONFIRM"),this.selectedSubSample){let e=this.workflowTaskHandler.getParameter(d.TASK_DYNAMIC_OMNIS_AUTO_NEXT_SUBSAMPLE_PARAM_ID).value.selection.id===d.AutonextSubSampleSelectionOption.ON,t=this.getNextUnfilteredSubsampleByPredecessorId(this.selectedSubSample.id);return void 0!==t?(this.selectedSubSample=t,e?Re:Ne):Ne}return this.exitError("AdvOmnis::handleTransmissionConfirmedSTATE_WIN_WEIGHING_WEIGHT_TAKEN_CONFIRM: no subsample set"),""}handleWeighValueSTATE_WIN_WEIGHING_WEIGHT_TAKEN_CONFIRM(e){if(this.lastTakenWeightValue){
let t=new M.MeasureParameter(e,!0);if(!t.isUseDisabled()&&(t.getAbsFloat()<.5*this.lastTakenWeightValue.getAbsFloat()||t.getSign()!==this.lastTakenWeightValue.getSign()||0===t.getAbsFloat()))return this.handleTransmissionConfirmedSTATE_WIN_WEIGHING_WEIGHT_TAKEN_CONFIRM()}return""}updateRequestSelScreen(e){console.log("AdvOmnis::updateRequestSelScreen");let t=this.requestsSearchStr.toLowerCase(),s=[];this.requests.forEach((e,a)=>{if(0===this.requestsSearchStr.length||this.requestsSearchStr.length>0&&(-1!==e.sampleName.toLowerCase().indexOf(t)||-1!==e.subsampleName.toLowerCase().indexOf(t)||-1!==e.operatingProcedureName.toLowerCase().indexOf(t))){let t={icon:!0===e.done?P.EnumFontLabels.REQUEST_DONE:P.EnumFontLabels.REQUEST,label:{id:e.sampleName||"",args:[],appearance:!0===e.done?i.EnumAppearance.DISABLED:i.EnumAppearance.ENABLED_SECONDARY,effect:r.createButtonEmptyEffect(at+a)},labelCenter:{id:e.subsampleName||"",args:[],
appearance:!0===e.done?i.EnumAppearance.DISABLED:i.EnumAppearance.ENABLED,effect:r.createButtonEmptyEffect(at+a)},labelRight:{id:e.operatingProcedureName||"",args:[],appearance:!0===e.done?i.EnumAppearance.DISABLED:i.EnumAppearance.ENABLED,effect:r.createButtonEmptyEffect(at+a)}};void 0!==this.selectedRequest&&this.selectedRequest.id===e.id&&(t.lastSelected=!0),s.push(t)}}),s.length>0?(0===this.requestsSearchStr.length?_.setNoSearchActive(this.searchListButton,!1):_.setSearchActive(this.searchListButton,!1),this.searchListButton.setAppearance(i.EnumAppearance.ENABLED)):(s.push({label:{id:this.requestsSearchStr.length>0?"_QAPP_LIB_SELECT_ITEM_NO_DATA_SEARCH_ACTIVE_MSG":"_QAPP_WF_SELECT_NO_REQUESTS",args:[],appearance:i.EnumAppearance.DISABLED}}),0===this.requestsSearchStr.length?(_.setNoSearchActive(this.searchListButton,!1),this.searchListButton.setAppearance(i.EnumAppearance.DISABLED)):(_.setSearchActive(this.searchListButton,!1),
this.searchListButton.setAppearance(i.EnumAppearance.ENABLED_SECONDARY))),this.reloadListButton.setAppearance(i.EnumAppearance.ENABLED_SECONDARY),this.openWeighingButton.setAppearance(i.EnumAppearance.ENABLED_SECONDARY);let n={id:we,appearance:i.EnumAppearance.ENABLED,type:T.EnumTabType.TAB_TABLE,containerTitle:{id:"_QAPP_WF_SELECT_REQUEST_TITLE",args:[]},title:a.createEmptyTextStructure(),topbuttons:["/QAPP/"+this.openWeighingButton.getTopic(),"/QAPP/"+this.reloadListButton.getTopic(),"/QAPP/"+this.searchListButton.getTopic(),"/QAPP/"+this.menuLogoutButton.getTopic()],tableHeader:{tableHeaderLeft:{id:"_QAPP_WF_SELECT_REQUEST_COL_SNAME_TITLE",args:[]},tableHeaderCenter:{id:"_QAPP_WF_SELECT_REQUEST_COL_SSNAME_TITLE",args:[]},tableHeaderRight:{id:"_QAPP_WF_SELECT_REQUEST_COL_OPNAME_TITLE",args:[]}},tableType:T.TAB_MENU_TYPE_BULK,menuBulkButtons:s,scrollToTop:e};this.getButtonBarScreen().setTableTab(n),this.showScreen(this.getButtonBarScreen())}loadRequests(){
console.log("AdvOmnis::loadRequests"),this.selectedRequest=void 0,this.showLoadingScreen({id:"_QAPP_WF_LOADING_OVERLAY_TEXT_LOADING_REQUESTS",args:[]}),this.enqueAsyncCall(this.omnisRestProxy.getRequests(this.connectedSystem),{request:Zt.OMNIS_REQ_GET_ALL_REQ,payload:this.connectedSystem},this.restcallTimeout)}initSTATE_WBACK_REQUEST_LIST(){console.log("AdvOmnis::initSTATE_WBACK_REQUEST_LIST"),this.menuBackButtonDesc.appearance=i.EnumAppearance.ENABLED_SECONDARY,this.getButtonBarScreen().setTopLeftButton(this.menuBackButtonDesc),this.doReloadRequests?this.loadRequests():(this.updateRequestSelScreen(!1),this.hideLoadingScreen()),this.doReloadRequests=!1}initSTATE_WBACK_REQUEST_LISTFromLeft(){this.selectedRequest=void 0,this.requestsSearchStr="",this.doReloadRequests=!0}handleRequestListReload(){this.loadRequests()}handleRequestSearch(e){this.requestsSearchStr=e,this.updateRequestSelScreen(!0)}handleRequestSelection(e){return this.selectedRequest=this.requests[e],
console.log(`AdvOmnis::handleRequestSelection: selected request idx ${e}: ${this.selectedRequest.id}`),Pe}handleRequestsRxFail(e){if(!k.isOmnisResponseError(e))return this.handleCommunicationError(e);switch(e.getStatus()){case B.OMNIS_ERR_CODE_GET_REQUESTS_UNAUTHORIZED:return this.handleSessionError(e);default:return this.handleCommunicationError(e)}}handleRequestsRx(e){console.log("AdvOmnis::handleRequestsRx"),this.requests=e.requests,this.updateRequestSelScreen(!0),this.hideLoadingScreen()}initSTATE_WBACK_PRE_WEIGHING(){console.log("AdvOmnis::initSTATE_WBACK_PRE_WEIGHING"),this.getWS().setText1(" "),this.getWS().setText2(" "),this.getWS().setParam1(""),this.getWS().setParam2(""),this.updateRequestedTakeoverButtonAppearance(i.EnumAppearance.HIDDEN),this.getWS().getButton(D.BACK_BUTTON_ID).setAppearance(i.EnumAppearance.ENABLED_SECONDARY),this.weighingProxy.setButton(R.WEIGHING_BUTTON_DO_TARE,i.EnumAppearance.ENABLED_PRIMARY),
this.weighingProxy.setButton(R.WEIGHING_BUTTON_DO_ZERO,i.EnumAppearance.ENABLED_PRIMARY),this.showScreen(this.getWS()),this.hideLoadingScreen()}initSTATE_WBACK_WEIGHING(){if(console.log("AdvOmnis::initSTATE_WBACK_WEIGHING"),this.selectedRequest){if(this.lastTakenWeightValue=void 0,this.getWSS().setText1(this.selectedRequest.message||" "),this.getWSS().setText2(""),void 0!==this.selectedRequest.subsampleSizeUnit&&this.selectedRequest.subsampleSizeUnit.length>0){if(console.log("AdvOmnis::STATE_WBACK_WEIGHING: unit present: "+this.selectedRequest.subsampleSizeUnit),!this.weighingProxy.setUnit(ie.getUnitEnum(this.selectedRequest.subsampleSizeUnit),!1)){console.log("AdvOmnis::STATE_WBACK_WEIGHING: unit set failed");let e=l.QAppBase.clientSingleton.getWeighingProfileId(),t=new w.ProfileManagementProxy;return this.hideMsgBox(),void this.showMessageBox({type:g.EnumMessageboxType.ERROR,title:{id:"_QAPP_WF_MSG_ERROR_UNIT_NOT_AVAIL_TITLE",args:[]},textList:[{
id:"_QAPP_WF_MSG_ERROR_UNIT_NOT_AVAIL_REASON",args:[this.selectedRequest.subsampleSizeUnit,e?t.getWeighingProfileName(e):""]},{id:"_QAPP_WF_MSG_ERROR_UNIT_NOT_AVAIL_SOLUTION",args:[]}],buttons:[{id:Dt,label:{id:P.EnumFontLabels.OK,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}]})}console.log("AdvOmnis::STATE_WBACK_WEIGHING: unit set passed"),this.weighingProxy.setButton(R.WEIGHING_BUTTON_UNIT,this.selectedRequest.enforceUnitSelection?i.EnumAppearance.ENABLED_SECONDARY:i.EnumAppearance.DISABLED)}else this.weighingProxy.setButton(R.WEIGHING_BUTTON_UNIT,i.EnumAppearance.ENABLED_SECONDARY);this.updateMinMaxValuesForSample(void 0,""),this.getWSS().setParam1(""),this.getWSS().setParam2(""),this.updateRequestWBACKTab(),this.wbackWSSParamTab.show(),this.winWSSParamTab.hide(),this.getWSS().getCheckBarGraph().setAppearance(i.EnumAppearance.HIDDEN,!1),this.getWSS().getCheckBarGraph().publishStatus(),this.updateRequestedTakeoverButtonAppearance(i.EnumAppearance.DISABLED),
this.getWSS().getButton(D.BACK_BUTTON_ID).setAppearance(i.EnumAppearance.ENABLED_SECONDARY),this.weighingProxy.setButton(R.WEIGHING_BUTTON_DO_TARE,i.EnumAppearance.ENABLED_SECONDARY),this.weighingProxy.setButton(R.WEIGHING_BUTTON_DO_ZERO,i.EnumAppearance.ENABLED_SECONDARY),this.showScreen(this.getWSS()),this.hideLoadingScreen()}else this.exitError("AdvOmnis::initSTATE_WBACK_WEIGHING: no request set")}handleTakeoverSTATE_WBACK_WEIGHING(){return console.log("AdvOmnis::handleTakeoverSTATE_WBACK_WEIGHING"),this.getStabilityAspect().configure({exitStateNoStability:Pe,nextState:Me,mode:o.WaitingForStabilityModeEnum.WaitStableModeReporting,exitStateNotValid:Pe,handleMqttEvent:e=>{e.payload.topic===ae.MqttTopics.WEIGHING_VALUE_NET&&this.handleWeighValueSTATE_WBACK_WEIGHING(JSON.parse(e.payload.value.toString()))},isWeightValueValid:e=>{let t=new M.MeasureParameter(m.WeightBlockHelper.getMeasureParameter(e,ae.MqttTopics.WEIGHING_VALUE_NET),!0);return!(t.isSpecial()||!t.isStable())}}),
o.STATE_ASPECT_WAITING_FOR_STABILITY}updateRequestWBACKTab(){console.log("AdvOmnis::updateRequestWBACKTab"),this.selectedRequest&&(this.xP_4_Request.sampleName.getValue().value.string=this.selectedRequest.sampleName||"",this.xP_4_Request.subSampleName.getValue().value.string=this.selectedRequest.subsampleName||"",this.xP_4_Request.name.getValue().value.string=this.selectedRequest.name||"",this.xP_4_Request.size.getValue().value.string=this.createSampleSizeString(this.selectedRequest.subsampleSize,this.selectedRequest.subsampleSizeUnit),void 0!==this.selectedRequest.methodName?(this.xP_4_Request.method.getValue().value.string=this.selectedRequest.methodName,this.xP_4_Request.method.getValue().appearance=i.EnumAppearance.ENABLED):this.xP_4_Request.method.getValue().appearance=i.EnumAppearance.HIDDEN,this.xP_4_Request.operatingProcedure.getValue().value.string=this.selectedRequest.operatingProcedureName||"",this.xP_4_Request.sampleName.publish(),this.xP_4_Request.subSampleName.publish(),
this.xP_4_Request.name.publish(),this.xP_4_Request.size.publish(),this.xP_4_Request.method.publish(),this.xP_4_Request.operatingProcedure.publish())}handleWeighValueSTATE_WBACK_WEIGHING(e){void 0!==this.lastCalibState?this.updateRequestedTakeoverButtonAppearance(i.EnumAppearance.ENABLED_PRIMARY):this.updateRequestedTakeoverButtonAppearance(i.EnumAppearance.DISABLED)}initSTATE_WBACK_WEIGHING_WEIGHT_TAKEN(){if(console.log("AdvOmnis::initSTATE_WBACK_WEIGHING_WEIGHT_TAKEN"),this.selectedRequest&&void 0!==this.lastCalibState){let e=this.buildC2OWeighStructure(this.lastCalibState);null!==e?(this.enqueAsyncCall(this.omnisRestProxy.sendRequest(this.connectedSystem,this.selectedRequest.id,e),{request:Zt.OMNIS_REQ_SEND_REQ,payload:[this.connectedSystem,this.selectedRequest,e]},this.restcallTimeout),this.showLoadingScreen({id:"_QAPP_WF_LOADING_OVERLAY_TEXT_SENDING_REQUEST_WBACK",args:[]})):this.exitError("AdvOmnis::initSTATE_WBACK_WEIGHING_WEIGHT_TAKEN: no alibi id, although stable and valid")
}else this.exitError("AdvOmnis::initSTATE_WBACK_WEIGHING_WEIGHT_TAKEN: no system or request set or calibration state not updated")}handleSendRequestSuccess(e){this.selectedRequest&&this.selectedRequest.id===e.payload.metadata.payload[1].id?(this.selectedRequest.subsampleSize=e.payload.metadata.payload[2].size,this.selectedRequest.subsampleSizeUnit=e.payload.metadata.payload[2].sizeUnit,this.selectedRequest.done=!0):this.exitError("AdvOmnis::handleSendRequestSuccess: no request set or async id mismatch")}handleSendRequestFail(e){let t=e.payload.reason;if(!k.isOmnisResponseError(t))return this.handleCommunicationError(t);switch(t.getStatus()){case B.OMNIS_ERR_CODE_SEND_REQUEST_UNAUTHORIZED:return this.handleSessionError(t);case B.OMNIS_ERR_CODE_SEND_REQUEST_REQUEST_NOT_FOUND:return this.doReloadRequests=!0,this.showErrorMessage(t,Mt),"";case B.OMNIS_ERR_CODE_SEND_REQUEST_WEIGHT_BAD_REQUEST:return this.showErrorMessage(t,Lt),"";default:return this.handleCommunicationError(t)}}
initSTATE_WBACK_WEIGHING_WEIGHT_TAKEN_CONFIRM(){console.log("AdvOmnis::initSTATE_WBACK_WEIGHING_WEIGHT_TAKEN_CONFIRM"),this.selectedRequest?(this.hideLoadingScreen(),this.showMessageBox({type:g.EnumMessageboxType.INFO,title:{id:"_QAPP_WF_MSG_SUCCESSFULLY_TRANSMITTED_TITLE",args:[]},buttons:[{id:_t,label:{id:P.EnumFontLabels.OK,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}],textList:[{id:"_QAPP_WF_MSG_SUCCESSFULLY_TRANSMITTED_REQ_1",args:[this.selectedRequest.subsampleName||jt,this.selectedRequest.sampleName||jt]},{id:"_QAPP_WF_MSG_SUCCESSFULLY_TRANSMITTED_REQ_2",args:[this.selectedRequest.subsampleName||jt,this.selectedRequest.sampleName||jt]},{id:"_QAPP_WF_MSG_SUCCESSFULLY_TRANSMITTED_REQ_3",args:[this.selectedRequest.subsampleName||jt,this.selectedRequest.sampleName||jt]}]})):this.exitError("AdvOmnis::initSTATE_WBACK_WEIGHING_WEIGHT_TAKEN_CONFIRM: no request set")}handleTransmissionConfirmedSTATE_WBACK_WEIGHING_WEIGHT_TAKEN_CONFIRM(){if(this.selectedRequest){
let e=this.workflowTaskHandler.getParameter(d.TASK_DYNAMIC_OMNIS_AUTO_NEXT_REQUEST_PARAM_ID).value.selection.id===d.AutonextRequestSelectionOption.ON,t=this.getNextUnfilteredRequestByPredecessorId(this.selectedRequest.id);return void 0!==t?(this.selectedRequest=t,e?Pe:ge):ge}return this.exitError("AdvOmnis::handleTransmissionConfirmedSTATE_WBACK_WEIGHING_WEIGHT_TAKEN_CONFIRM: no request set"),""}handleWeighValueSTATE_WBACK_WEIGHING_WEIGHT_TAKEN_CONFIRM(e){if(this.lastTakenWeightValue){let t=new M.MeasureParameter(e,!0);if(!t.isUseDisabled()&&(t.getAbsFloat()<.5*this.lastTakenWeightValue.getAbsFloat()||t.getSign()!==this.lastTakenWeightValue.getSign()||0===t.getAbsFloat()))return this.handleTransmissionConfirmedSTATE_WBACK_WEIGHING_WEIGHT_TAKEN_CONFIRM()}return""}initSTATE_REMOTE_CONTROL_IF_CHECK(){console.log("AdvOmnis::initSTATE_REMOTE_CONTROL_IF_CHECK"),this.ifMngmntProxy.isAnyInterfaceActive()?this.showMessageBox({type:g.EnumMessageboxType.WARNING,title:{
id:"_QAPP_WF_MSG_WARNING_INTERFACES_ENABLED_TITLE",args:[]},textList:[{id:"_QAPP_WF_MSG_WARNING_INTERFACES_ENABLED_REASON",args:[]},{id:"_QAPP_WF_MSG_WARNING_INTERFACES_ENABLED_SOLUTION",args:[]}],buttons:[{id:Ct,label:{id:P.EnumFontLabels.OK,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}]}):this.addToEventQueue(new h.ImmediateEvent({from:Le,to:De}))}initSTATE_REMOTE_CONTROL(){console.log("AdvOmnis::initSTATE_REMOTE_CONTROL"),this.lastTakenWeightValue=void 0,this.getWS().setText1("_QAPP_WF_REMOTE_INSTRUCTION_TOP",[],"RED"),this.getWS().setText2(""),this.getWS().setParam1(""),this.getWS().setParam2(""),this.weighingProxy.setButton(R.WEIGHING_BUTTON_UNIT,i.EnumAppearance.ENABLED_SECONDARY),this.getWS().getCheckBarGraph().setAppearance(i.EnumAppearance.HIDDEN,!1),this.getWS().getCheckBarGraph().publishStatus(),this.getWS().getButton(D.BACK_BUTTON_ID).setAppearance(i.EnumAppearance.ENABLED_SECONDARY),
this.weighingProxy.setButton(R.WEIGHING_BUTTON_DO_ZERO,i.EnumAppearance.ENABLED_SECONDARY),this.weighingProxy.setButton(R.WEIGHING_BUTTON_DO_TARE,i.EnumAppearance.ENABLED_SECONDARY),this.showScreen(this.getWS())}handleCmdRestRequest(e){if(console.log("AdvOmnis::handleCmdRestRequest"),void 0!==this.connectedSystem&&void 0!==e.payload.request.headers[G.REST_INCOMING_REQUEST_TOKEN_KEY]&&e.payload.request.headers[G.REST_INCOMING_REQUEST_TOKEN_KEY]===this.connectedSystem.systemId){console.log("AdvOmnis::handleCmdRestRequest: systemId match");let t=e.payload.subUrl.substr(e.payload.subUrl.lastIndexOf("/")+1);return"string"!=typeof t||t.length<1?(console.log("AdvOmnis::handleCmdRestRequest: no cmdId given"),Q.finalizeResponse(e.payload.response,404,G.REST_STATUS_MSG_404),""):(console.log("AdvOmnis::handleCmdRestRequest: cmdid: "+t),
e.payload.subUrl.startsWith(G.REST_URI_O2C_WEIGH_CMD)?this.handleWeighRestCall(e,t):e.payload.subUrl.startsWith(G.REST_URI_O2C_TARE_CMD)?this.handleTareRestCall(e,t):(console.log("AdvOmnis::handleCmdRestRequest: command not found"),Q.finalizeResponse(e.payload.response,404,G.REST_STATUS_MSG_404),""))}return console.log("AdvOmnis::handleCmdRestRequest: systemId mismatch"),Q.finalizeResponse(e.payload.response,401,G.REST_STATUS_MSG_401_system),""}handleWeighRestCall(e,t){switch(console.log("AdvOmnis::handleWeighRestCall"),e.payload.request.method){case"PUT":if(console.log("AdvOmnis::handleWeighRestCall: got weigh PUT"),this.getCurrentState()===De&&void 0!==this.lastCalibState){let s=e.payload.body;if(!this.checkRestCmdRequestCallback(e,s))return"";if(void 0===e.payload.request.headers.remoteaddr)return this.exitError("handleWeighRestCall: REST cmd received without remoteAddr header - check FW version?"),"";let a=this.addTimer(G.REST_CMD_SYNC_TIMEOUT_MS,{type:"WEIGH_SYNC_TIMER_PAYLOAD",
cmdId:t});return this.lastWeighCmd={status:S.ECommandStatus.REST_CMD_PENDING,restEvent:e,asyncCallBackPort:s.callbackPort,asyncCallBackHost:e.payload.request.headers.remoteaddr,cmdId:t,responseData:null,syncTimeoutId:a},this.getStabilityAspect().configure({exitStateNoStability:be,nextState:fe,mode:o.WaitingForStabilityModeEnum.WaitStableModeReporting,exitStateNotValid:ye,isWeightValueValid:e=>{let t=new M.MeasureParameter(m.WeightBlockHelper.getMeasureParameter(e,ae.MqttTopics.WEIGHING_VALUE_NET),!0);return t.isStable()&&!t.isSpecial()}}),o.STATE_ASPECT_WAITING_FOR_STABILITY}return console.log("AdvOmnis::handleWeighRestCall: send weigh PUT response 409 wrong state"),Q.finalizeResponse(e.payload.response,409,G.REST_STATUS_MSG_409),"";case"GET":console.log("AdvOmnis::handleWeighRestCall: got weigh GET");let s=this.getCurrentState()
;return s===De||s===o.STATE_ASPECT_WAITING_FOR_STABILITY&&this.getStabilityAspect().getConfig().nextState===fe?this.handleCmdRestRequestGET(e,this.lastWeighCmd,t):(console.log("AdvOmnis::handleWeighRestCall: send GET response 409 wrong state"),Q.finalizeResponse(e.payload.response,409,G.REST_STATUS_MSG_409)),"";case"DELETE":console.log("AdvOmnis::handleWeighRestCall: got weigh DELETE");let a=this.getCurrentState();return a===De||a===o.STATE_ASPECT_WAITING_FOR_STABILITY&&this.getStabilityAspect().getConfig().nextState===fe?this.handleCmdRestRequestDELETE(e,this.lastWeighCmd,t,()=>{console.log("AdvOmnis::handleWeighRestCall: cancel waiting for stability"),this.weighingProxy.cancelStableWeightBlock()}):(console.log("AdvOmnis::handleWeighRestCall: send DELETE response 409 wrong state"),Q.finalizeResponse(e.payload.response,409,G.REST_STATUS_MSG_409)),"";default:return Q.finalizeResponse(e.payload.response,405,G.REST_STATUS_MSG_405),""}}handleTareRestCall(e,t){
switch(console.log("AdvOmnis::handleTareRestCall"),e.payload.request.method){case"PUT":if(console.log("AdvOmnis::handleTareRestCall: got tare PUT"),this.getCurrentState()===De){let s=e.payload.body;if(!this.checkRestCmdRequestCallback(e,s))return"";if(void 0===e.payload.request.headers.remoteaddr)return this.exitError("handleTareRestCall: REST cmd received without remoteAddr header - check FW version?"),"";if(!s.hasOwnProperty("type")||s.type!==G.ETareType.TARE_TYPE_TARE&&s.type!==G.ETareType.TARE_TYPE_ZERO&&s.type!==G.ETareType.TARE_TYPE_ZERO_TARE_AUTO)return console.log("AdvOmnis::handleTareRestCall: no or invalid tare type parameter in command"),Q.finalizeResponse(e.payload.response,400,G.REST_STATUS_MSG_400,"no or invalid tare type parameter in command"),"";let a=this.addTimer(G.REST_CMD_SYNC_TIMEOUT_MS,{type:"TARE_SYNC_TIMER_PAYLOAD",cmdId:t});return this.lastTareCmd={status:S.ECommandStatus.REST_CMD_PENDING,restEvent:e,asyncCallBackPort:s.callbackPort,
asyncCallBackHost:e.payload.request.headers.remoteaddr,cmdId:t,responseData:null,syncTimeoutId:a},this.getTareAspect().configure({exitStateNoTare:ve,nextState:Ge,handleMqttEvent:e=>{},doFn:()=>{switch(s.type){case G.ETareType.TARE_TYPE_TARE:return this.weighingProxy.doTare(R.WEIGHING_DOZEROTARE_BEHAVIOR.WEIGHING_DOZEROTARE_BEHAVIOR_AFTER_STABILITY);case G.ETareType.TARE_TYPE_ZERO:return this.weighingProxy.doZero(R.WEIGHING_DOZEROTARE_BEHAVIOR.WEIGHING_DOZEROTARE_BEHAVIOR_AFTER_STABILITY);default:return this.weighingProxy.doZeroTareAuto(R.WEIGHING_DOZEROTARE_BEHAVIOR.WEIGHING_DOZEROTARE_BEHAVIOR_AFTER_STABILITY)}}}),Y.STATE_ASPECT_WAITING_FOR_TARE}return console.log("AdvOmnis::handleTareRestCall: send tare PUT response 409 wrong state"),Q.finalizeResponse(e.payload.response,409,G.REST_STATUS_MSG_409),"";case"GET":console.log("AdvOmnis::handleTareRestCall: got tare GET");let s=this.getCurrentState()
;return s===De||s===Y.STATE_ASPECT_WAITING_FOR_TARE&&this.getTareAspect().getConfig().nextState===Ge?this.handleCmdRestRequestGET(e,this.lastTareCmd,t):(console.log("AdvOmnis::handleTareRestCall: send GET response 409 wrong state"),Q.finalizeResponse(e.payload.response,409,G.REST_STATUS_MSG_409)),"";case"DELETE":console.log("AdvOmnis::handleTareRestCall: got tare DELETE");let a=this.getCurrentState();return a===De||a===Y.STATE_ASPECT_WAITING_FOR_TARE&&this.getTareAspect().getConfig().nextState===Ge?this.handleCmdRestRequestDELETE(e,this.lastTareCmd,t,()=>{console.log("AdvOmnis::handleTareRestCall: cancel waiting for tare"),this.weighingProxy.cancelDoing()}):(console.log("AdvOmnis::handleTareRestCall: send DELETE response 409 wrong state"),Q.finalizeResponse(e.payload.response,409,G.REST_STATUS_MSG_409)),"";default:return Q.finalizeResponse(e.payload.response,405,G.REST_STATUS_MSG_405),""}}checkRestCmdRequestCallback(e,t){console.log("AdvOmnis::checkRestCmdRequestCallback");try{
if(!t.hasOwnProperty("callbackPort")||void 0===t.callbackPort||Number.isNaN(t.callbackPort))return console.log("AdvOmnis::checkRestCmdRequestCallback: callbackPort missing in command"),Q.finalizeResponse(e.payload.response,400,G.REST_STATUS_MSG_400,"callbackPort member is missing or corrupt in command payload"),!1}catch(t){return console.log("AdvOmnis::checkRestCmdRequestCallback: callbackPort missing in command"),Q.finalizeResponse(e.payload.response,400,G.REST_STATUS_MSG_400,"callbackPort member is missing or corrupt in command payload"),!1}return!0}handleCmdRestRequestGET(e,t,s){console.log("AdvOmnis::handleCmdRestRequestGET: got REST cmd GET"),t&&t.cmdId===s?t.status===S.ECommandStatus.REST_CMD_RESULT?(console.log("AdvOmnis::handleCmdRestRequestGET: send weigh response 200"),Q.finalizeResponse(e.payload.response,200,G.REST_STATUS_MSG_200,t.responseData)):(console.log("AdvOmnis::handleCmdRestRequestGET: send weigh response 202"),
Q.finalizeResponse(e.payload.response,202,G.REST_STATUS_MSG_202)):(console.log("AdvOmnis::handleCmdRestRequestGET: send GET response 404"),Q.finalizeResponse(e.payload.response,404,G.REST_STATUS_MSG_404))}handleCmdRestRequestDELETE(e,t,s,a){console.log("AdvOmnis::handleCmdRestRequestDELETE: got REST cmd DELETE"),t&&t.cmdId===s?(t.status===S.ECommandStatus.REST_CMD_RESULT||(console.log("AdvOmnis::handleCmdRestRequestDELETE: cancel weight doings"),a()),console.log("AdvOmnis::handleCmdRestRequestDELETE: send  DELETE response 200"),Q.finalizeResponse(e.payload.response,200,G.REST_STATUS_MSG_200)):(console.log("AdvOmnis::handleCmdRestRequestDELETE: send DELETE response 404"),Q.finalizeResponse(e.payload.response,404,G.REST_STATUS_MSG_404))}initSTATE_REMOTE_CONTROL_WEIGHT_TAKEN(){if(void 0!==this.lastCalibState){let e=this.buildC2OWeighStructure(this.lastCalibState);null!==e?this.finalizeWeighCmd({result:G.EWeighCmdResult.WEIGH_RESULT_VALID,weight:e
}):this.exitError("AdvOmnis::initSTATE_REMOTE_CONTROL_WEIGHT_TAKEN: no alibi id, although stable and valid")}}initSTATE_REMOTE_CONTROL_WEIGHT_ERROR(){this.finalizeWeighCmd({result:G.EWeighCmdResult.WEIGH_RESULT_ERROR,error:{messageUserLang:this.localizerProxy.getText("_QAPP_WF_MSG_HTTP_RES_WEIGH_ERROR",[])}})}initSTATE_REMOTE_CONTROL_WEIGHT_CANCEL(){this.finalizeWeighCmd({result:G.EWeighCmdResult.WEIGH_RESULT_CANCELED})}finalizeWeighCmd(e){if(this.lastWeighCmd){if(this.lastWeighCmd.responseData=e,null!==this.lastWeighCmd.syncTimeoutId)try{this.cancelTimer(this.lastWeighCmd.syncTimeoutId)}catch(e){}this.lastWeighCmd.status===S.ECommandStatus.REST_CMD_PENDING?(console.log("AdvOmnis::finalizeWeighCmd: send response"),Q.finalizeResponse(this.lastWeighCmd.restEvent.payload.response,200,G.REST_STATUS_MSG_200,this.lastWeighCmd.responseData)):this.sendRestRequestCmdCallback(this.lastWeighCmd),this.lastWeighCmd.status=S.ECommandStatus.REST_CMD_RESULT}this.addToEventQueue(new h.ImmediateEvent({
from:Ce,to:De}))}initSTATE_REMOTE_CONTROL_TARE_SUCCESS(){this.finalizeTareCmd({result:G.ETareCmdResult.TARE_RESULT_TARED})}initSTATE_REMOTE_CONTROL_TARE_NO_TARE(){let e,t=this.getTareAspect().tareResult;e=t&&t.state===Y.ITareResultState.CANCELED?t.special&&t.special.length>0?{result:G.ETareCmdResult.TARE_RESULT_ERROR,error:{messageUserLang:this.localizerProxy.getText("_QAPP_WF_MSG_HTTP_RES_TARE_ERROR_KNOWN",[t.special])}}:{result:G.ETareCmdResult.TARE_RESULT_CANCELED}:{result:G.ETareCmdResult.TARE_RESULT_ERROR,error:{messageUserLang:this.localizerProxy.getText("_QAPP_WF_MSG_HTTP_RES_TARE_ERROR_UNKNOWN",[])}},this.finalizeTareCmd(e)}finalizeTareCmd(e){if(this.lastTareCmd){if(this.lastTareCmd.responseData=e,null!==this.lastTareCmd.syncTimeoutId)try{this.cancelTimer(this.lastTareCmd.syncTimeoutId)}catch(e){}this.lastTareCmd.status===S.ECommandStatus.REST_CMD_PENDING?(console.log("AdvOmnis::finalizeTareCmd: send response"),
Q.finalizeResponse(this.lastTareCmd.restEvent.payload.response,200,G.REST_STATUS_MSG_200,this.lastTareCmd.responseData)):this.sendRestRequestCmdCallback(this.lastTareCmd),this.lastTareCmd.status=S.ECommandStatus.REST_CMD_RESULT}this.addToEventQueue(new h.ImmediateEvent({from:Be,to:De}))}handleRestRequest(e){if("/omnis/system/status"!=e.payload.subUrl){console.log(`AdvOmnis::handleRestRequest: req ${e.payload.request.method} from ${e.payload.subUrl}`),console.log("  headers: "+y.inspect(e.payload.request.headers)),e.payload.body&&console.log("  body: "+y.inspect(e.payload.body)),console.log("  params: "),u.getParamsForRestRequestEvent(e).forEach((e,t,s)=>{console.log(`  param: '${t}' : '${e}'`)})}if(e.payload.subUrl===G.REST_URI_O2C_STATUS)return"GET"===e.payload.request.method?this.isAllDevStatusDataCollected()?(console.log("handleRestRequest: handle status get request"),
this.connectedSystem?this.deviceGetStatusData.status.loggedInSystemId=this.connectedSystem.systemId:this.deviceGetStatusData.status.loggedInSystemId="",Q.finalizeResponse(e.payload.response,200,G.REST_STATUS_MSG_200,this.deviceGetStatusData,void 0,!1)):(console.log("handleRestRequest: device data not fully collected - reject request"),Q.finalizeResponse(e.payload.response,404,G.REST_STATUS_MSG_404)):Q.finalizeResponse(e.payload.response,405,G.REST_STATUS_MSG_405),"";if(e.payload.subUrl===G.REST_URI_O2C_INFORMATION){if("GET"===e.payload.request.method)if(this.isAllDevInformationDataCollected()){console.log("handleRestRequest: handle information get request");let t=this.auditTrailProxy.getRecords({moduleList:["CALIBRATIONADJUSTMENT"],sortingColumn:"a.timestamp",sortOrder:"DESC",start:0,end:1});t.length>=1?(this.deviceGetInformationData.information.lastAdjustment.date=new X.SatDate(1e3*t[0].timestamp),this.deviceGetInformationData.information.lastAdjustment.event=t[0].eventName,
this.deviceGetInformationData.information.lastAdjustment.user=t[0].user):(this.deviceGetInformationData.information.lastAdjustment.date=new X.SatDate(Date.now()),this.deviceGetInformationData.information.lastAdjustment.event="",this.deviceGetInformationData.information.lastAdjustment.user=""),Q.finalizeResponse(e.payload.response,200,G.REST_STATUS_MSG_200,this.deviceGetInformationData)}else console.log("handleRestRequest: device data not fully collected - delay information get request"),Q.finalizeResponse(e.payload.response,404,G.REST_STATUS_MSG_404);else Q.finalizeResponse(e.payload.response,405,G.REST_STATUS_MSG_405);return""}return e.payload.subUrl.startsWith(G.REST_URI_O2C_WEIGH_CMD)?this.handleCmdRestRequest(e):e.payload.subUrl.startsWith(G.REST_URI_O2C_TARE_CMD)?this.handleCmdRestRequest(e):(Q.finalizeResponse(e.payload.response,404,G.REST_STATUS_MSG_404),"")}handleTimerEvent(e){
return"WEIGH_SYNC_TIMER_PAYLOAD"===e.payload.type?this.handleRestCmdSyncResponseTimeout(e.payload,this.lastWeighCmd):"TARE_SYNC_TIMER_PAYLOAD"===e.payload.type&&this.handleRestCmdSyncResponseTimeout(e.payload,this.lastTareCmd)}handleRestCmdSyncResponseTimeout(e,t){if(t&&e.cmdId===t.cmdId&&t.status===S.ECommandStatus.REST_CMD_PENDING&&t.restEvent){console.log("AdvOmnis::handleRestCmdSyncResponseTimeout: timeout for REST command (PUT) - answer with 202"),t.status=S.ECommandStatus.REST_CMD_PENDING_TIMEOUT,t.syncTimeoutId=null;try{Q.finalizeResponse(t.restEvent.payload.response,202,"Accepted")}catch(e){console.log("AdvOmnis::handleRestCmdSyncResponseTimeout: error sending response")}t.restEvent=null}return!0}sendRestRequestCmdCallback(e){console.log("AdvOmnis::sendRestRequestCmdCallback");try{let t=e.cmdId;console.log(`AdvOmnis::sendRestRequestCmdCallback: send to ${e.asyncCallBackHost}:${e.asyncCallBackPort}`),this.showLoadingScreen({
id:"_QAPP_WF_LOADING_OVERLAY_TEXT_CMD_SEND_ASNC_CALLBACK",args:[]});let s=new L.Socket;setTimeout(()=>{if(!s.destroyed){console.log("AdvOmnis::sendRestRequestCmdCallback::onTimeout: timeout connecting/sending callback: ");try{s.destroy()}catch(e){}}},2e4),s.on("error",e=>{console.log("AdvOmnis::sendRestRequestCmdCallback::onError: error sending callback: "+e);try{s.destroy()}catch(e){}}),s.on("close",e=>{this.hideLoadingScreen();try{s.destroy()}catch(e){}}),s.on("end",()=>{this.hideLoadingScreen();try{s.destroy()}catch(e){}}),s.connect(e.asyncCallBackPort,e.asyncCallBackHost,()=>{try{s.end(JSON.stringify({commandId:t}))}catch(e){console.log("AdvOmnis::sendRestRequestCmdCallback::onConnect: error sending callback: "+e);try{s.destroy()}catch(e){}}})}catch(e){console.log("AdvOmnis::sendRestRequestCmdCallback: error sending callback: "+e)}}buildC2OWeighStructure(e){let t=this.getStabilityAspect().alibiId
;if(void 0===t||Number.isNaN(t))return console.log("AdvOmnis::buildC2OWeighStructure: no alibi ID set in stability aspect"),null;{let s=this.reportingProxy.getWeightFromAlibi(t);if(q.isAlibiEntryError(s))return console.log("AdvOmnis::buildC2OWeighStructure: AlibiId get error from firmware"),null;return this.lastTakenWeightValue=new M.MeasureParameter(s,!0),{size:`${s.value.sign}${s.value.number}`,sizeUnit:s.value.unit,calibrationOk:e,measurementId:t,measurementValid:!s.value.isInvalid}}}getLockScreenCfg(){return void 0!==this.connectedSystem&&void 0!==this.connectedSystem.username?{title:{id:"_QAPP_WF_LOCK_SCREEN_TITLE",args:[this.connectedSystem.systemName]},text1:{id:"_QAPP_WF_LOCK_SCREEN_MSG_TOP",args:[this.connectedSystem.systemName]},text2:this.connectedSystem.loginMode===B.ELoginMethods.LOGIN_USERNAME_PASSWORD?{id:"_QAPP_WF_LOCK_SCREEN_MSG_BOTTOM_WITH_PWD",args:[this.connectedSystem.systemName]}:{id:"_QAPP_WF_LOCK_SCREEN_MSG_BOTTOM_WITHOUT_PWD",
args:[this.connectedSystem.systemName]},loginText:{id:"_QAPP_WF_LOGIN_SCRREN_USERNAME",args:[]},passwordText:{id:"_QAPP_WF_LOGIN_SCRREN_PASSWORD",args:[]},listOfLastUsers:[this.connectedSystem.username],showUsername:"DISABLED",showPassword:this.connectedSystem.loginMode===v.ELoginMethods.LOGIN_USERNAME_PASSWORD,showUserDropdown:!1,showLogoutButton:!0,imgref:qt}:z.getDefaultLockScreenContentJson()}disableLockingScreen(){this.getLockingAspect().setTimeout(Number.NaN),this.getLockingAspect().unlock(),this.getLockingAspect().hideLockLoadingScreen(),this.getLockingAspect().hideLockMsgBox()}doLogoutFromLockScreen(){return console.log("AdvOmnis::doLogoutFromLockScreen"),this.doLogout(es.AFTER_LOGOUT_SEL_SYS)}handleLockUnlockDataRx(e){if(console.log("AdvOmnis::handleLockUnlockDataRx"),this.connectedSystem){let t={};switch(t.userName=this.connectedSystem.username,this.connectedSystem.loginMode){case B.ELoginMethods.LOGIN_USERNAME_PASSWORD:let s=void 0
;for(let t of e.parameters)t.id===z.LOCK_DATA_PASS_PARAM_ID&&(s=t);let a=s?s.value.string:"";t.password=a;break;case B.ELoginMethods.LOGIN_USERNAME:case B.ELoginMethods.LOGIN_USB_DONGLE:case B.ELoginMethods.LOGIN_NO_AUTH:}console.log("AdvOmnis::handleLockUnlockDataRx: "+y.inspect(t)),this.enqueAsyncCall(this.omnisRestProxy.authenticate(this.connectedSystem,t),{request:Zt.OMNIS_REQ_AUTH,payload:this.connectedSystem},this.restcallTimeout),this.getLockingAspect().showLockLoadingScreen({id:"_QAPP_WF_LOADING_OVERLAY_TEXT_UNLOCKING",args:[this.connectedSystem.systemName]})}else this.exitError("AdvOmnis::handleLockUnlockDataRx: no system set")}handleLockOKBtnErrorMsgBox(){return console.log("AdvOmnis::handleLockOKBtnErrorMsgBox"),this.getLockingAspect().hideLockMsgBox(),""}handleLockAuthenticateError(e){if(console.log("AdvOmnis::handleLockAuthenticateError"),!k.isOmnisResponseError(e))return this.handleCommunicationError(e);switch(e.getStatus()){
case B.OMNIS_ERR_CODE_AUTHENTICATE_UNAUTHORIZED:return e.getReason()===B.OMNIS_ERR_CODE_UNAUTHORIZED_REASON_WRONG_UN?(this.showLockErrorMessage(e,St),this.getLockingAspect().hideLockLoadingScreen(),""):e.getReason()===B.OMNIS_ERR_CODE_UNAUTHORIZED_REASON_INVAL_TOKEN?this.handleSessionError(e):(this.getLockingAspect().hideLockLoadingScreen(),this.showLockErrorMessage(e,It),"");case B.OMNIS_ERR_CODE_AUTHENTICATE_FORBIDDEN:return this.getLockingAspect().hideLockLoadingScreen(),this.showLockErrorMessage(e,It),"";default:return this.handleCommunicationError(e)}this.getLockingAspect().hideLockLoadingScreen()}showLockErrorMessage(e,t){this.getLockingAspect().showLockMsgBox({type:g.EnumMessageboxType.ERROR,title:{id:"_QAPP_WF_MSG_ERROR_TITLE",args:[e.getStatus().toFixed(0)]},textList:[{id:"_QAPP_WF_MSG_ERROR_REASON",args:[e.getI18NMessage(void 0)]}],buttons:[{id:t,label:{id:P.EnumFontLabels.OK,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}]})}handleLockAuthenticateSuccess(){
console.log("AdvOmnis::handleLockAuthenticateSuccess"),this.getLockingAspect().hideLockLoadingScreen(),this.getLockingAspect().unlock()}getNextUnfilteredSubsampleByPredecessorId(e){let t=Number.NaN;if(this.subSamples.forEach((s,a)=>{s.id===e&&(t=a)}),!Number.isNaN(t)&&t<this.subSamples.length-1)return this.subSamples[t+1]}getNextUnfilteredRequestByPredecessorId(e){let t=Number.NaN;if(this.requests.forEach((s,a)=>{s.id===e&&(t=a)}),!Number.isNaN(t)&&t<this.requests.length-1)return this.requests[t+1]}handleSearchButtonClick(){console.log("AdvOmnis::handleSearchButtonClick");let e=a.createEmptyStringParameter();e.id=Yt,e.title={id:"_QAPP_LIB_SEARCH_PARAM_TITLE",args:[]},e.header={id:"_QAPP_LIB_SEARCH_PARAM_HEADER",args:[]},this.getKeyboard().setParam(e),this.getKeyboard().show()}enableCalibrationObserve(){this.isCalibObserveEnabled||(this.lastCalibState=void 0,this.mqttHandler.subscribe(ae.MqttTopics.CALADJ_ISOCAL_STATUS),this.isCalibObserveEnabled=!0)}updateCalibState(e){
this.lastCalibState=!1===e.isActive}handleSessionError(e){return this.showErrorMessage(e,ct),de}handleCommunicationError(e){return this.messageHandlerHelper.addMessage(H.EMsgHandlerMsgs.ERR_798_GENERIC_EXTERNAL_COMM_ERROR,e),Se}handleMessageHandlerOKButton(){console.log("AdvOmnis::handleMessageHandlerOKButton"),this.showLoadingScreen();let e=this.messageHandlerHelper.buildSecret(H.MESSAGE_HANDLER_SECRET_TYPE.QAPP_RUNTIME_COMM_ERROR);return this.messageHandlerProxy.deleteMessageByCategory(F.MessageHandlerCategory.QAPP,e||""),this.getLockingAspect().unlock(),this.getLockingAspect().hideLockMsgBox(),_e}showErrorMessage(e,t){console.log("AdvOmnis::showErrorMessage"),this.showMessageBox({type:g.EnumMessageboxType.ERROR,title:{id:"_QAPP_WF_MSG_ERROR_TITLE",args:[e.getStatus().toFixed(0)]},textList:[{id:"_QAPP_WF_MSG_ERROR_REASON",args:[e.getI18NMessage(void 0)]}],buttons:[{id:t,label:{id:P.EnumFontLabels.OK,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}]})}handleHomeBtn(){
console.log("AdvOmnis::handleHomeBtn"),this.showMessageBox({type:g.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MBOX_HOME_WARNING_TITLE",args:[]},buttons:[{id:nt,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY},{id:it,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}],textList:[{id:"_QAPP_LIB_MBOX_HOME_WARNING_TEXT_top",args:[]},{id:"_QAPP_LIB_MBOX_HOME_WARNING_TEXT_mid",args:[this.getTaskName()]}]})}handleActionHomeBtn(){console.log("AdvOmnis::handleActionHomeBtn"),this.showMessageBox({type:g.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MBOX_HOME_WARNING_TITLE",args:[]},buttons:[{id:it,label:{id:P.EnumFontLabels.CANCEL,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY},{id:nt,label:{id:"_QAPP_WF_MBOX_HOME_WARNING_BTN_MAIN_MENU",args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY},{id:Et,label:{id:"_QAPP_WF_MBOX_HOME_WARNING_BTN_OMNIS_ACTION_MENU",args:[]},
appearance:i.EnumAppearance.ENABLED_SECONDARY}],textList:[{id:"_QAPP_WF_MBOX_HOME_WARNING_TEXT_top",args:[]},{id:"_QAPP_WF_MBOX_HOME_WARNING_TEXT_mid",args:[]},{id:"_QAPP_WF_MBOX_HOME_WARNING_TEXT_bottom",args:[this.getTaskName()]}]})}handleLogoutBtn(){console.log("AdvOmnis::handleLogoutBtn"),this.showMessageBox({type:g.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MBOX_LOGOUT_WARNING_TITLE",args:[]},buttons:[{id:it,label:{id:P.EnumFontLabels.CANCEL,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY},{id:rt,label:{id:"_QAPP_WF_MBOX_LOGOUT_WARNING_BTN_SYSTEM_LOGOUT",args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY},{id:ot,label:{id:"_QAPP_WF_MBOX_LOGOUT_WARNING_BTN_OMNIS_LOGOUT",args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}],textList:[{id:"_QAPP_LIB_MBOX_LOGOUT_WARNING_TEXT_top",args:[]},{id:"_QAPP_WF_MBOX_LOGOUT_WARNING_TEXT_bottom",args:[this.getTaskName()]}]})}doLogout(e){return console.log("AdvOmnis::doLogout"),this.postLogoutAction=e,Te}
createEmptySubSampleParams(e){console.log("AdvOmnis::createEmptySubSampleParams");let t=a.createEmptyStringParameter();t.id=e+bt,t.title={id:"_QAPP_WF_SUBSAMPLE_SAMPLE_NAME_PARAM_TITLE",args:[]},t.header={id:"_QAPP_WF_SUBSAMPLE_SAMPLE_NAME_PARAM_HEADER",args:[]},t.appearance=i.EnumAppearance.ENABLED;let s=a.createEmptyStringParameter();s.id=e+ft,s.title={id:"_QAPP_WF_SUBSAMPLE_SUBSAMPLE_NAME_PARAM_TITLE",args:[]},s.header={id:"_QAPP_WF_SUBSAMPLE_SUBSAMPLE_NAME_PARAM_HEADER",args:[]},s.appearance=i.EnumAppearance.ENABLED;let n=a.createEmptyStringParameter();n.id=e+yt,n.title={id:"_QAPP_WF_SUBSAMPLE_SLIDX_PARAM_TITLE",args:[]},n.header={id:"_QAPP_WF_SUBSAMPLE_SLIDX_PARAM_HEADER",args:[]},n.appearance=i.EnumAppearance.ENABLED;let r=a.createEmptyStringParameter();r.id=e+Bt,r.title={id:"_QAPP_WF_SUBSAMPLE_SAMPLE_SIZE_PARAM_TITLE",args:[]},r.header={id:"_QAPP_WF_SUBSAMPLE_SAMPLE_SIZE_PARAM_HEADER",args:[]},r.appearance=i.EnumAppearance.ENABLED;let o=a.createEmptyStringParameter()
;return o.id=e+vt,o.title={id:"_QAPP_WF_SUBSAMPLE_RACK_PARAM_TITLE",args:[]},o.header={id:"_QAPP_WF_SUBSAMPLE_RACK_PARAM_HEADER",args:[]},o.appearance=i.EnumAppearance.ENABLED,{sampleName:new p.Param(this.mqttHandler,t),name:new p.Param(this.mqttHandler,s),listPos:new p.Param(this.mqttHandler,n),size:new p.Param(this.mqttHandler,r),rack:new p.Param(this.mqttHandler,o)}}createEmptyRequestParams(e){console.log("AdvOmnis::createEmptyRequestParams");let t=a.createEmptyStringParameter();t.id=e+Ht,t.title={id:"_QAPP_WF_REQUEST_NAME_PARAM_TITLE",args:[]},t.header={id:"_QAPP_WF_REQUEST_NAME_PARAM_HEADER",args:[]},t.appearance=i.EnumAppearance.ENABLED;let s=a.createEmptyStringParameter();s.id=e+Gt,s.title={id:"_QAPP_WF_REQUEST_SAMPLE_NAME_PARAM_TITLE",args:[]},s.header={id:"_QAPP_WF_REQUEST_SAMPLE_NAME_PARAM_HEADER",args:[]},s.appearance=i.EnumAppearance.ENABLED;let n=a.createEmptyStringParameter();n.id=e+Ut,n.title={id:"_QAPP_WF_REQUEST_SUBSAMPLE_NAME_PARAM_TITLE",args:[]},n.header={
id:"_QAPP_WF_REQUEST_SUBSAMPLE_NAME_PARAM_HEADER",args:[]},n.appearance=i.EnumAppearance.ENABLED;let r=a.createEmptyStringParameter();r.id=e+Ft,r.title={id:"_QAPP_WF_REQUEST_SAMPLE_SIZE_PARAM_TITLE",args:[]},r.header={id:"_QAPP_WF_REQUEST_SAMPLE_SIZE_PARAM_HEADER",args:[]},r.appearance=i.EnumAppearance.ENABLED;let o=a.createEmptyStringParameter();o.id=e+Wt,o.title={id:"_QAPP_WF_REQUEST_METHOD_PARAM_TITLE",args:[]},o.header={id:"_QAPP_WF_REQUEST_METHOD_PARAM_HEADER",args:[]},o.appearance=i.EnumAppearance.ENABLED;let E=a.createEmptyStringParameter();return E.id=e+xt,E.title={id:"_QAPP_WF_REQUEST_OP_PROC_PARAM_TITLE",args:[]},E.header={id:"_QAPP_WF_REQUEST_OP_PROC_PARAM_HEADER",args:[]},E.appearance=i.EnumAppearance.ENABLED,{name:new p.Param(this.mqttHandler,t),sampleName:new p.Param(this.mqttHandler,s),subSampleName:new p.Param(this.mqttHandler,n),size:new p.Param(this.mqttHandler,r),method:new p.Param(this.mqttHandler,o),operatingProcedure:new p.Param(this.mqttHandler,E)}}
createRackInfoString(e,t){let s="";return void 0===e&&void 0===t||(s=void 0!==e&&""!==e?e:jt,s+="/",s+=void 0!==t?t.toString(10):jt),s}createSampleSizeString(e,t){return t?`${e||jt} ${t}`:e||jt}updateMinMaxValuesForSample(e,t){console.log("AdvOmnis::updateMinMaxValuesForSample"),void 0!==e?(this.qP_4_SampleMin.getValue().value.numbers[0]=e.minimum,this.qP_4_SampleMin.getValue().value.unit=t,this.weighingMinValue=parseFloat(e.minimum),this.qP_4_SampleMax.getValue().value.numbers[0]=e.maximum,this.qP_4_SampleMax.getValue().value.unit=t,this.weighingMaxValue=parseFloat(e.maximum),this.qP_4_SampleMin.setParamAppearance(i.EnumAppearance.ENABLED),this.qP_4_SampleMax.setParamAppearance(i.EnumAppearance.ENABLED),this.enableMinMaxCheckAndVisualization=!0):(this.qP_4_SampleMin.setParamAppearance(i.EnumAppearance.HIDDEN),this.qP_4_SampleMax.setParamAppearance(i.EnumAppearance.HIDDEN),this.enableMinMaxCheckAndVisualization=!1),this.qP_4_SampleMin.publish(),this.qP_4_SampleMax.publish()}
updateCheckBarGraph(e,t){if(!this.enableMinMaxCheckAndVisualization||Number.isNaN(this.weighingMinValue)||Number.isNaN(this.weighingMaxValue)||void 0===this.metrMax)this.getWSS().getCheckBarGraph().setAppearance(i.EnumAppearance.HIDDEN);else{let s=e.getFloat(),a=O.convertWgtUnit(this.metrMax.maxValue,O.unitStringToLong(t),O.unitStringToLong(this.metrMax.maxUnit)),n=(this.weighingMaxValue+this.weighingMinValue)/2;e.getValue_().value.isWarning||e.getValue_().value.isSpecial?e.getValue_().value.isSpecial&&("High"===e.getValue_().value.number?this.getWSS().getCheckBarGraph().calc4AreaPerc(a,this.weighingMinValue,this.weighingMaxValue,a,n):this.getWSS().getCheckBarGraph().calc4AreaPerc(0,this.weighingMinValue,this.weighingMaxValue,a,n)):this.getWSS().getCheckBarGraph().calc4AreaPerc(s,this.weighingMinValue,this.weighingMaxValue,a,n),this.getWSS().getCheckBarGraph().setAppearance(i.EnumAppearance.ENABLED)}}checkMinMax(e){
return!this.enableMinMaxCheckAndVisualization||!Number.isNaN(this.weighingMinValue)&&!Number.isNaN(this.weighingMaxValue)&&e.getFloat()>=this.weighingMinValue&&e.getFloat()<=this.weighingMaxValue}}t.AdvOmnisApp=is,(new is).run(),console.log("it's time for node event loop")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(43),i=s(85),n=s(1),r=s(6),o=s(8),E=s(20),_=s(56),l=s(0);t.WEIGHING_SPLIT_SCREEN_ID="WEIGHINGSPLIT";const c={buttonId:"BARBUTTON/CANCEL",label:{id:"",args:[]},appearance:l.EnumAppearance.HIDDEN};t.WeighingSplitScreen=class extends r.AbstractScreen{constructor(e,t){super(e),this.buttonList=[],this.text1={value:"",wildcards:[]},this.text2={value:"",wildcards:[]},this.param1="",this.param2="",this.title=void 0,this.createBarButtons(t),this.publishBarButtons(),this.checkBarGraph=new _.CheckBarGraph(e),this.cancelBarButton=new o.default(this.mqttHandler,this,c),this.tabApi=new i.TabApi(e,this.getId())}getId(){
return t.WEIGHING_SPLIT_SCREEN_ID}getTabApi(){return this.tabApi}getBarButtonId(){return n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_BARBUTTONS}createBarButtons(e){e.sort(this.compareButtonBarButtons);for(let t of e){let e=new o.default(this.mqttHandler,this,t);this.buttonList.push(e),e.publish()}}publishBarButtons(){let e=[];for(let t of this.buttonList)e.push(n.MqttTopics.QAPP_NAMESPACE+"/"+t.getTopic());this.mqttHandler.publish(this.getBarButtonId(),JSON.stringify(e))}setText1(e,t){let s=!1;this.text1.value!==e&&(this.text1.value=e,s=!0),t&&this.text1.wildcards.join()!==t.join()&&(this.text1.wildcards=t,s=!0),s&&this.publishText1()}compareButtonBarButtons(e,t){return E.getButtonPriority(e.buttonId)-E.getButtonPriority(t.buttonId)}publishText1(){this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_INSTRUCTION1,JSON.stringify(this.text1),{retain:!0})}publishText2(){this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_INSTRUCTION2,JSON.stringify(this.text2),{retain:!0})}
setText2(e,t){let s=!1;this.text2.value!==e&&(this.text2.value=e,s=!0),t&&this.text2.wildcards.join()!==t.join()&&(this.text2.wildcards=t,s=!0),s&&this.publishText2()}publishTitle(){this.title?this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_TITLE,JSON.stringify(this.title),{retain:!0}):this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_TITLE,"",{retain:!0})}setTitle(e){let t=void 0;this.title&&(t=JSON.stringify(this.title)),this.title=e,this.title!==t&&this.publishTitle()}getText1(){return this.text1}getText2(){return this.text2}publishParam1(){this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_PARAM1_TOPIC,JSON.stringify(this.param1),{retain:!0})}publishParam2(){this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_PARAM2_TOPIC,JSON.stringify(this.param2),{retain:!0})}setParam1(e){this.param1!==e&&(this.param1=e,this.publishParam1())}setParam2(e){this.param2!==e&&(this.param2=e,this.publishParam2())}getParam1(){return this.param1}
getParam2(){return this.param2}getButton(e){if(e===a.CANCEL_BARBUTTON_ID)return this.cancelBarButton;for(let t of this.buttonList)if(t.getButtonId()===e)return t}show(){this.publishText1(),this.publishText2(),this.publishTitle(),this.publishParam1(),this.publishParam2();for(let e of this.buttonList)e.publish();super.show()}getCheckBarGraph(){return this.checkBarGraph}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(46);t.TabFigure=class extends a.TabBase{constructor(e,t,s,a=!1){super(t,s,a),this.imageUrl={url:""},this.imageId={id:""},this.setTabData(e)}setTabImgRefUrl(e){this.imageUrl.url!==e&&(this.imageUrl.url=e,this.tabData.imgref=this.imageUrl,this.publishIfEnabled())}setTabImgRefId(e){this.imageId.id!==e&&(this.imageId.id=e,this.tabData.imgref=this.imageId,this.publishIfEnabled())}getTabImgRef(){return this.tabData.imgref}getTabData(){return this.tabData}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),
t.functionReplacer=function(e,t){return"function"==typeof t?t.toString().replace(/(\/\*([\s\S]*?)\*\/)|(\/\/(.*)$)/gm,"").replace(/\s\s+/g,""):t},t.functionReviver=function(e,t){if(""===e)return t;if("string"==typeof t){let e=/function[^\(]*\(([^\)]*)\)[^\{]*\{([^]*)\}/,s=t.match(e);if(s){let e=s[1].split(",").map(function(e){return e.replace(/\s+/,"")});return new Function(...e,s[2])}}return t}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(46),i=s(15);t.TabGraph=class extends a.TabBase{constructor(e,t,s,a=!1){super(t,s,a),this.setTabData(e)}setData(e,t=!0){i.isEqual(this.tabData.data,e)||(this.tabData.data=e,t?this.publishIfEnabled():this.publishPending=!0)}getData(){return this.tabData.data}getTabData(){return this.tabData}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(46),i=s(63);t.TabParamList=class extends a.TabBase{constructor(e,t,s,a=!1){super(t,s,a),this.setTabData(e)}setTabParams(e){
if(this.tabData)if(!i.isITabParamList(this.tabData)||"string"!=typeof e[0]&&0!==e.length){if(!i.isITabBulkParamList(this.tabData)||"object"!=typeof e[0]&&0!==e.length)throw new Error("TabParamList: given type for parameters and mode of tab does not match");this.tabData.bulkParameters.join()!==e.join()&&(this.tabData.bulkParameters=e,this.publishIfEnabled())}else this.tabData.params.join()!==e.join()&&(this.tabData.params=e,this.publishIfEnabled())}getTabParams(){if(this.tabData){if(i.isITabParamList(this.tabData))return this.tabData.params;if(i.isITabBulkParamList(this.tabData))return this.tabData.bulkParameters;throw new Error("TabParamList expected type of tabdata found")}return[]}setTabDisplayHeader(e){this.tabData.displayHeader!==e&&(this.tabData.displayHeader=e,this.publishIfEnabled())}getTabDisplayHeader(){return this.tabData.displayHeader}publishTabParams(){this.publish()}getTabData(){return this.tabData}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{
value:!0});const a=s(46),i=s(63),n=s(8);t.TabMenu=class extends a.TabBase{constructor(e,t,s,a=!1){super(t,s,a),this.setTabData(e)}setTabMenuButtons(e,t=!0){if(this.tabData&&e.length>0)if(console.log("isMenu:"+i.isITabMenu(this.tabData)),console.log("isMenuBulk:"+i.isITabBulkMenu(this.tabData)),console.log("buttons:"+JSON.stringify(e)),i.isITabMenu(this.tabData)&&"string"==typeof e[0])this.tabData.menubuttons.join()!==e.join()&&(this.tabData.menubuttons=e,t&&this.publishIfEnabled());else{if(!i.isITabBulkMenu(this.tabData)||"object"!=typeof e[0])throw new Error("TabMenu: given type for buttons and mode of tab does not match");JSON.stringify(this.tabData.menuBulkButtons)!==JSON.stringify(e)&&(this.tabData.menuBulkButtons=e.map(e=>n.IButtonParameterInterface2IButtonJsonInterface(e)),t&&this.publishIfEnabled())}}getTabMenuButtons(){if(this.tabData){if(i.isITabMenu(this.tabData))return this.tabData.menubuttons
;if(i.isITabBulkMenu(this.tabData))return this.tabData.menuBulkButtons.map(e=>n.IButtonJsonInterface2IButtonParameterInterface(e));throw new Error("TabMenu expected type of tabdata found")}return[]}getTabData(){return this.tabData}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(46),i=s(63);t.TabTable=class extends a.TabBase{constructor(e,t,s,a=!1){super(t,s,a),this.setTabData(e)}setTabMenuButtons(e,t=!0){if(this.tabData&&e.length>0)if(console.log("isTable:"+i.isITabTable(this.tabData)),console.log("isMTableBulk:"+i.isITabBulkTable(this.tabData)),console.log("buttons:"+JSON.stringify(e)),i.isITabTable(this.tabData)&&"string"==typeof e[0])this.tabData.menubuttons.join()!==e.join()&&(this.tabData.menubuttons=e,t&&this.publishIfEnabled());else{if(!i.isITabBulkTable(this.tabData)||"object"!=typeof e[0])throw new Error("TabMTable: given type for buttons and mode of tab does not match")
;JSON.stringify(this.tabData.menuBulkButtons)!==JSON.stringify(e)&&(this.tabData.menuBulkButtons=e,t&&this.publishIfEnabled())}}getTabMenuButtons(){if(this.tabData){if(i.isITabTable(this.tabData))return this.tabData.menubuttons;if(i.isITabBulkTable(this.tabData))return this.tabData.menuBulkButtons;throw new Error("TabTable expected type of tabdata found")}return[]}getTabData(){return this.tabData}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(3),i=s(16),n=s(9),r=s(39),o=s(0),E=s(62),_=s(1);t.WAITING_STABILITY_ASPECT="WAITING_STABILITY_ASPECT",t.STATE_ASPECT_WAITING_FOR_STABILITY="STATE_ASPECT_WAITING_FOR_STABILITY",t.STABLE_WEIGHT_DATE_TIME_ID="STABLE_WEIGHT_DATE_TIME_ID";const l="WAITING_STABILITY_ASPECT_TIMEOUT_ID";var c;!function(e){e[e.WaitStableModeWeighing=0]="WaitStableModeWeighing",e[e.WaitStableModeReporting=1]="WaitStableModeReporting"}(c=t.WaitingForStabilityModeEnum||(t.WaitingForStabilityModeEnum={}))
;t.WaitingStabilityAspect=class extends i.AbstractQAppAspect{constructor(){super(),this.states={STATE_ASPECT_WAITING_FOR_STABILITY:{_onEnter:function(e){let s=e.aspects[t.WAITING_STABILITY_ASPECT];switch(s.stableWeightBlock=void 0,s.alibiId=void 0,s.dateTime.value.timestamp=0,void 0!==s.cfg.timeout&&(s.waitStabilityTimeoutTimer=e.addTimer(s.cfg.timeout.timer,l)),s.cfg.mode){case c.WaitStableModeReporting:console.log("waitStabAsp: reporting mode");const a=void 0!==s.cfg.comment?s.cfg.comment:"";e.reportingProxy.requestPrintableValue(a).isSuccess()||(console.log("waitStabAsp: trigger failed"),e.addToEventQueue(new n.ImmediateEvent({from:t.STATE_ASPECT_WAITING_FOR_STABILITY,to:s.cfg.exitStateNoStability})));break;case c.WaitStableModeWeighing:default:console.log("waitStabAsp: weighing mode"),e.weighingProxy.triggerStableWeightBlock().isSuccess()||(console.log("waitStabAsp: trigger failed"),e.addToEventQueue(new n.ImmediateEvent({from:t.STATE_ASPECT_WAITING_FOR_STABILITY,
to:s.cfg.exitStateNoStability})))}},_onExit:function(e){const s=e.aspects[t.WAITING_STABILITY_ASPECT];e.cancelTimer(s.waitStabilityTimeoutTimer)},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,s){s.payload.from&&s.payload.from===t.STATE_ASPECT_WAITING_FOR_STABILITY&&this.transition(e,s.payload.to)},EV_MQTT_UPDATE:function(e,s){const i=e.aspects[t.WAITING_STABILITY_ASPECT],n=i.cfg;switch(s.payload.topic){case _.MqttTopics.WEIGHING_WEIGHT_BLOCK:if(n.mode===c.WaitStableModeWeighing){e.cancelTimer(i.waitStabilityTimeoutTimer);let a=JSON.parse(s.payload.value.toString());n.isWeightValueValid&&!1===n.isWeightValueValid(a)?this.transition(e,n.exitStateNotValid):(e.aspects[t.WAITING_STABILITY_ASPECT].stableWeightBlock=a,e.aspects[t.WAITING_STABILITY_ASPECT].dateTime.value.timestamp=E.getTime(),this.transition(e,n.nextState))}break;case _.MqttTopics.WEIGHING_WAITING_FOR_STABILITY:
n.mode===c.WaitStableModeWeighing&&!1===JSON.parse(s.payload.value.toString()).state&&(e.cancelTimer(i.waitStabilityTimeoutTimer),this.transition(e,n.exitStateNoStability));break;case _.MqttTopics.REPORTING_PRINTABLE_VALUE:if(n.mode===c.WaitStableModeReporting){e.cancelTimer(i.waitStabilityTimeoutTimer);let t=JSON.parse(s.payload.value.toString());if(t.state===r.ReportingPrintableValueStateEnum.STABLE){let s=a.createEmptyParameterGroupOfGroups();s.id=_.MqttTopics.REPORTING_PRINTABLE_VALUE,s.parameters[0].parameters=[...t.weightBlock],console.log(JSON.stringify(s)),n.isWeightValueValid&&!1===n.isWeightValueValid(s)?this.transition(e,n.exitStateNotValid):(i.stableWeightBlock=s,i.alibiId=t.alibiId,i.dateTime.value.timestamp=E.getTime(),this.transition(e,n.nextState))}else this.transition(e,n.exitStateNoStability)}break;case _.MqttTopics.WEIGHING_STATUS_ERROR:
n.mode===c.WaitStableModeWeighing&&0!==JSON.parse(s.payload.value.toString()).state.code&&(e.cancelTimer(i.waitStabilityTimeoutTimer),this.transition(e,n.exitStateNoStability));break;default:n.handleMqttEvent&&n.handleMqttEvent(s)}},QAPP_TIMER_EVENT:function(e,s){if(s.payload===l){let s=e.aspects[t.WAITING_STABILITY_ASPECT];if(s.cfg.timeout)return e.weighingProxy.cancelStableWeightBlock(),void this.transition(e,s.cfg.timeout.exitStateTimeout)}}}},this.dateTime=a.createEmptyDateTimeParameter(),this.dateTime.id=t.STABLE_WEIGHT_DATE_TIME_ID,this.dateTime.appearance=o.EnumAppearance.ENABLED,this.dateTime.info={isDate:!0,isTime:!0}}getId(){return t.WAITING_STABILITY_ASPECT}getAspectStates(){return this.states}init(e){this.client=e,this.client?(console.log("WaitingStabilityAspect::init"),this.client.mqttHandler.subscribe(_.MqttTopics.WEIGHING_WEIGHT_BLOCK),this.client.mqttHandler.subscribe(_.MqttTopics.WEIGHING_WAITING_FOR_STABILITY),
this.client.mqttHandler.subscribe(_.MqttTopics.REPORTING_PRINTABLE_VALUE)):console.log("WaitingStabilityAspect::init - aspect not correctly initialized (no client set) - skip init")}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(64),i=s(105),n=s(54),r=s(106),o=s(49),E=s(9),_=s(86),l=s(14),c=s(33),A=s(2),u=s(1),T=s(0),d="STATE_RECONFIG_DONE",S="STATE_LOT_IDENTIFIER_DONE";t.QAppAdvBase=class extends r.QAppWorkflowBase{constructor(e){super(e),this.advBaseStates={STATE_ASPECT_RESUME_ADV_REINIT_EXIT:{_onEnter:function(e){e.addToEventQueue(new E.ImmediateEvent(i.STATE_ASPECT_RESUME_ADV_REINIT_EXIT))},_onExit:function(e){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,t){t.payload===i.STATE_ASPECT_RESUME_ADV_REINIT_EXIT&&(e.reinitialize(),this.transition(e,e.skipConfigParamAspect?d:a.STATE_ASPECT_CFG_PARAM_EDIT_ENTER))}},STATE_RECONFIG_DONE:{_onEnter:function(e){e.addToEventQueue(new E.ImmediateEvent(d))},_onExit:function(e){},_transTo:{},
_transFrom:{},IMMEDIATE_EVENT:function(e,t){t.payload===d&&(e.confIdentifierAspect(!0),this.transition(e,e.skipLotInput?S:_.STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT))}},STATE_LOT_IDENTIFIER_DONE:{_onEnter:function(e){e.saveWorkstate(!0)},_onExit:function(e){},_transTo:{},_transFrom:{},QAPP_SYNC_CALL_DONE_EVENT:function(e,t){t.payload===E.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE&&this.transition(e,i.STATE_ASPECT_RESUME_ADV_CONT_EXIT)}},STATE_ASPECT_RESUME_ADV_CONT_EXIT:{_onEnter:function(e){e.showLoadingScreen({id:"_QAPP_LIB_LOADING_OVERLAY_TEXT_PREP_CONT_APP",args:[e.getTaskName()]})},_onExit:function(e){},_transTo:{},_transFrom:{},MQTT_ADMIN_EVENT:function(e,t){e.checkForLoadingScreenEnableEvent(t)?(e.confIdentifierAspect(!0),e.aspects[_.IDENTIFIER_ASPECT].setLotIDs(e.workstate.measurementData.identifiers),e.restoreLastSelectedDisplayValueInfo(),e.initFromWorkstate(),
e.addHeartbeatEvent("INIT_PRINTQUEUE_HEARTBEAT")):e.checkForCustomHeartbeatEvent(t,"INIT_PRINTQUEUE_HEARTBEAT")&&(console.log("QAppAdvBase: clearing printQueue."),e.reportingProxy.clearPrintQueue(),e.initPQ(!0)?(console.log("QAppAdvBase: init PQ fin"),this.transition(e,e.calcResumeState())):(console.log("QAppAdvBase: there are more samples to print - add trigger to queue"),e.addToEventQueue(new E.SimpleEvent("STATE_ASPECT_RESUME_ADV_CONT_EXIT_contInitPQ"))))},SIMPLE_EVENT:function(e,t){"STATE_ASPECT_RESUME_ADV_CONT_EXIT_contInitPQ"===t.payload&&(e.initPQ(!1)?(console.log("QAppAdvBase: init PQ fin"),this.transition(e,e.calcResumeState())):(console.log("QAppAdvBase: there are more samples to print - add trigger to queue"),e.addToEventQueue(new E.SimpleEvent("STATE_ASPECT_RESUME_ADV_CONT_EXIT_contInitPQ"))))}}},this.skipConfigParamAspect=!1,this.skipLotInput=!1,this.workstate=void 0,this.isNewInitialized=!1,this.ignoreSaveWorkstate=!1,this.saveDisplayValueSelectionWithWorkstate=!1,
this.initPQIdx=0,this.cfgParamAspect=new a.ConfigParamsAspect,this.registerAspect(this.cfgParamAspect),this.resAdvAspect=new i.ResumeAdvancedAspect,this.registerAspect(this.resAdvAspect),this.workflowTaskHandler=new n.TaskHandler}init(){console.log("QAppAdvBase::init"),super.init()}postInit(){console.log("QAppAdvBase: postInit"),super.postInit(),this.confParamConfigAspect(),this.confResumeAdvAspect()}confParamConfigAspect(){console.log("QAppAdvBase::confParamConfigAspect"),this.aspects[a.CFG_PARAMS_ASPECT].configure({isValidFn:()=>this.cfgParamAspectIsValidFn(),updateTaskParameterFn:e=>this.cfgParamAspectUpdateTaskParameterFn(e),handleParamUpdateUserActionFn:(e,t)=>this.cfgParamAspectHandleParamUpdateUserActionFn(e,t),returnState:d,taskHandler:this.workflowTaskHandler})}confResumeAdvAspect(){console.log("QAppAdvBase::confResumeAdvAspect"),this.aspects[i.RESUME_ADV_ASPECT].configure({isForcedReinitModificationDetectedFn:()=>this.resumeAdvAspectIsForcedReinitModificationDetectedFn(),
isReinitConditionDetectedFn:()=>this.resumeAdvAspectIsReinitConditionDetectedFn(),isContinueConditionDetectedFn:()=>this.resumeAdvAspectIsContinueConditionDetectedFn(),isPersitentWorkstatePresentFn:()=>{let e=void 0!==this.workstate;return console.log("QAppAdvBase::isPersitentWorkstatePresentFn: ",e),e}})}confIdentifierAspect(e,t=""){console.log("QAppAdvBase::confIdentifierAspect"),this.aspects[_.IDENTIFIER_ASPECT].configure({returnState:e?S: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:A.cloneJSON(this.taskHandler.getTask()),workflowTaskHandlerData:t},this.workflowTaskHandler.setTask(this.workstate.workflowTaskHandlerData)):this.exitError("QAppAdvBase::prepReinitializedWorkstate: No task parameters in taskHandler - unexpected.")}provideStartFsmState(){return i.STATE_ASPECT_RESUME_ADV_CHECK_STARTUP_ENTER}provideFsmStates(){return Object.assign(this.advBaseStates,this.provideSpecificAdvFsmStates())}adaptFsmStates(e){console.log("QAppAdvBase::adaptFsmStates");for(let t in e){let s=e[t].MQTT_ADMIN_EVENT;void 0!==s&&(e[t].MQTT_ADMIN_EVENT_CHILD=s),e[t].MQTT_ADMIN_EVENT=function(s,a){let i=!1;try{i=a.payload.event===c.MQTT_ADMIN_EVENT_PACKET_SENT&&a.payload.packet.topic===u.MqttTopics.HMI_LOADING_MODAL_TEXT&&JSON.parse(a.payload.packet.payload.toString()).args[1]===E.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE
}catch(e){}i&&(s.saveWorkstateIntern(),s.addToEventQueue(new E.QAppSyncCallDoneEvent(E.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE))),void 0!==e[t].MQTT_ADMIN_EVENT_CHILD&&e[t].MQTT_ADMIN_EVENT_CHILD.call(this,s,a)}}}onFsmTransition(e){if(e.fromState===o.STATE_UNINITIALIZED_INTERNAL){console.log("QAppAdvBase::onFsmTransition - try to load workstate");try{this.workstate=this.taskMngProxy.getWorkstate(this.taskId),console.log("QAppAdvBase::onFsmTransition - got workstate from persistency")}catch(e){console.log("QAppAdvBase::onFsmTransition - no workstate found - error: "+e),this.workstate=void 0}this.workstate&&this.workflowTaskHandler.setTask(this.workstate.workflowTaskHandlerData)}}saveWorkstateIntern(){this.taskMngProxy.saveWorkstate(this.workstate,this.taskId)}saveWorkstate(e=!0){this.workstate&&!this.ignoreSaveWorkstate?(console.log("QAppAdvBase::saveWorkstate - save workstate: "),e?this.showLoadingScreen({id:"_QAPP_LIB_LOADING_OVERLAY_TEXT_SAVE_WORKSTATE",
args:[this.getTaskName(),E.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE]}):(this.saveWorkstateIntern(),this.addToEventQueue(new E.QAppSyncCallDoneEvent(E.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE)))):this.addToEventQueue(new E.QAppSyncCallDoneEvent(E.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE))}deleteWorkstate(){this.workstate&&this.taskMngProxy.deleteWorkstate(this.taskId)}specificRestart(){if(void 0!==this.workstate){try{this.taskMngProxy.deleteWorkstate(this.taskId)}catch(e){console.log("QAppAdvBase Restart: No workstate to delete")}this.workstate=void 0}}onSuspending(){void 0!==this.workstate&&this.saveDisplayValueSelectionWithWorkstate&&(console.log("save last display value info in workstate"),this.workstate.lastDisplayValDomain=this.lastDisplayValDomain,this.workstate.lastDisplayValAppId=this.weighingProxy.getSelectedDisplayValue().lastSelectedApplicationId,this.saveWorkstateIntern()),super.onSuspending()}
restoreLastSelectedDisplayValueInfo(){void 0!==this.workstate&&this.saveDisplayValueSelectionWithWorkstate&&(console.log("restoreLastSelectedDisplayValueInfo"),void 0!==this.workstate.lastDisplayValDomain&&(this.lastDisplayValDomain=this.workstate.lastDisplayValDomain),void 0!==this.workstate.lastDisplayValAppId&&this.weighingProxy.restoreLastSelectedDisplayValue(this.workstate.lastDisplayValAppId))}initPQ(e,t=!1){if(this.workstate&&this.workstate.measurementData&&this.workstate.measurementData.identifiers){e?(console.log("QAppAdvBase::initPQ: start initPQ"),this.addLotIds2PQ(this.workstate.measurementData.identifiers),this.addInitParams2PQ(this.providePQInitTaskParams()),this.initPQIdx=0):console.log("QAppAdvBase::initPQ: continue initPQ"),console.log("QAppAdvBase::initPQ start initPQIdx = "+this.initPQIdx);let s=0;for(;this.initPQIdx<this.workstate.measurementData.samples.length&&(s<10||t);){let e=this.workstate.measurementData.samples[this.initPQIdx];if(this.initPQIdx++,
this.doAddSampleDuringReinit2PQ(e)){let t=this.addSample2PQ(e,!0,!1);e.valid||void 0===t||this.reportingProxy.setRedactionStatus(t.getPrintItemIdentifier(),!0,e.invalidationReason),this.sampleAdded(),s++}}return console.log("QAppAdvBase::initPQ end initPQIdx = "+this.initPQIdx),this.initPQIdx>=this.workstate.measurementData.samples.length}return!0}addSample2PQ(e,t,s){console.log("QAppAdvBase::addSample2PQ"),this.sampleAdded();let a=this.addSample2PQ_withIds(e.identifiers,this.provideSamplePQParams(e),t,s);return this.updateInvalidationAspectSampleConfig({sample:e}),a}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(9),n=s(16),r=s(12),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",c="BTN_REINIT",A="BTN_CONT";t.ResumeAdvancedAspect=class extends n.AbstractQAppAspect{constructor(){super(...arguments),this.states={STATE_ASPECT_RESUME_ADV_CHECK_STARTUP_ENTER:{_onEnter:function(e){e.aspects[t.RESUME_ADV_ASPECT].cfg.isPersitentWorkstatePresentFn()?e.aspects[t.RESUME_ADV_ASPECT].cfg.isForcedReinitModificationDetectedFn()?e.addToEventQueue(new i.ImmediateEvent(E)):e.aspects[t.RESUME_ADV_ASPECT].cfg.isReinitConditionDetectedFn()?e.addToEventQueue(new i.ImmediateEvent(t.STATE_ASPECT_RESUME_ADV_REINIT_EXIT)):e.aspects[t.RESUME_ADV_ASPECT].cfg.isContinueConditionDetectedFn()?e.addToEventQueue(new i.ImmediateEvent(t.STATE_ASPECT_RESUME_ADV_CONT_EXIT)):e.addToEventQueue(new i.ImmediateEvent(_)):e.addToEventQueue(new i.ImmediateEvent(t.STATE_ASPECT_RESUME_ADV_REINIT_EXIT))},_onExit:function(){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,t){this.transition(e,t.payload)
}},STATE_ASPECT_RESUME_ADV_FORCE_REINIT:{_onEnter:function(e){e.showMessageBox({type:r.EnumMessageboxType.INFO,title:{id:"_QAPP_LIB_MSG_BOX_INFO_REINIT_TASK_NECESSARY",args:[]},textList:[{id:"_QAPP_LIB_MSG_BOX_INFO_REINIT_TASK_NECESSARY_TEXT",args:[]}],buttons:[{id:l,label:{id:o.EnumFontLabels.OK,args:[]},appearance:a.EnumAppearance.ENABLED_SECONDARY}]})},_onExit:function(e){e.hideMsgBox()},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(e,s){s.payload.buttonId===l&&this.transition(e,t.STATE_ASPECT_RESUME_ADV_REINIT_EXIT)}},STATE_ASPECT_RESUME_ADV_QUESTION_CONT:{_onEnter:function(e){e.showMessageBox({type:r.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MSG_BOX_QUESTION_RESUME_CONTINUE",args:[]},textList:[{id:"_QAPP_LIB_MSG_BOX_QUESTION_RESUME_CONTINUE_TEXT",args:[]}],buttons:[{id:c,label:{id:"_QAPP_LIB_MSG_BOX_QUESTION_RESUME_CONTINUE_BTN_REINIT",args:[]},appearance:a.EnumAppearance.ENABLED_SECONDARY},{id:A,label:{id:"_QAPP_LIB_MSG_BOX_QUESTION_RESUME_CONTINUE_BTN_CONTINUE",
args:[]},appearance:a.EnumAppearance.ENABLED_PRIMARY}]})},_onExit:function(e){e.hideMsgBox()},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(e,s){s.payload.buttonId===c?this.transition(e,t.STATE_ASPECT_RESUME_ADV_REINIT_EXIT):s.payload.buttonId===A&&this.transition(e,t.STATE_ASPECT_RESUME_ADV_CONT_EXIT)}}}}getId(){return t.RESUME_ADV_ASPECT}getAspectStates(){return this.states}init(e){this.client=e,this.client?console.log("ResumeAdvancedAspect::init"):console.log("ResumeAdvancedAspect::init - aspect not correctly initialized (no client set) - skip init")}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(24),i=s(86),n=s(15),r=s(39),o=s(3),E=s(37),_=s(27),l=s(9),c=s(107),A=s(108),u=s(42),T=s(28),d=s(2),S=s(1),I=s(0);t.QAppWorkflowBase=class extends a.QAppBase{constructor(e){super(e),this.takeoverBtnPending=!1,this.lastDisplayValDomain=u.ISelectedWeightDisplayValueDomains.SELECTED_DOMAIN_UNDEFINED,this.doRememberLastDisplayValDomain=!1,
this.identifierAspect=new i.IdentifierAspect,this.registerAspect(this.identifierAspect),this.weighingProxy.selectedDisplayValue$.subscribe(e=>{this.doRememberLastDisplayValDomain&&(this.lastDisplayValDomain=e.currentSelectedDomain)})}init(){console.log("QAppWorkflowBase::init"),super.init(),this.identifierAspect.resetSIDsPrevSample(),this.mqttHandler.subscribe(S.MqttTopics.HMI_PRINT_HEADER),this.lastDisplayValDomain=u.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===S.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()!==I.EnumAppearance.ENABLED&&this.buttons.takeoverBtn.getAppearance()!==I.EnumAppearance.ENABLED_SECONDARY&&this.buttons.takeoverBtn.getAppearance()!==I.EnumAppearance.ENABLED_PRIMARY||this.lastRequestedTakeoverBtnAppearance!==I.EnumAppearance.ENABLED&&this.lastRequestedTakeoverBtnAppearance!==I.EnumAppearance.ENABLED_SECONDARY&&this.lastRequestedTakeoverBtnAppearance!==I.EnumAppearance.ENABLED_PRIMARY)||super.handleEvent(e)}}notifyTakeOver(e=!1){this.buttons.takeoverBtn&&(this.takeoverBtnPending=!0,this.lastRequestedTakeoverBtnAppearance!==I.EnumAppearance.HIDDEN&&this.buttons.takeoverBtn.setAppearance(I.EnumAppearance.DISABLED),e&&this.addTimer(1e3,{id:"TAKEOVER_BTN_TIMER"}))}updateRequestedTakeoverButtonAppearance(e){this.lastRequestedTakeoverBtnAppearance=e,
this.takeoverBtnPending||this.updateTakeoverBtnToLastRequestedAppearance()}updateTakeoverBtnToLastRequestedAppearance(){this.buttons.takeoverBtn&&this.buttons.takeoverBtn.setAppearance(this.lastRequestedTakeoverBtnAppearance)}rememberLastSelectedDisplayValueDomain(e){this.doRememberLastDisplayValDomain=e}getLastSelectedDisplayValueDomain(){return this.lastDisplayValDomain}selectLastSelectedDisplayValue(e){this.lastDisplayValDomain===u.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===u.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=>d.cloneJSON(e.getValue()));return e.forEach((e,a)=>{i.IdentifierAspect.getLotState(a,this.taskHandler)!==E.EnumLotIdentifierOptions.OFF&&""!==e&&(s[a].value.string=e,s[a].appearance=I.EnumAppearance.ENABLED,t.push(s[a]))}),this.addInitParams2PQ(t)}addSample2PQ_withIds(e,t,s,a){console.log("QAppWorkflowBase::addSample2PQ_withIds")
;let i=[],o=n.remove(t,e=>e.id===A.PARAM_ID_SAMPLE_NO);i.push(...o),i.push(...this.prepSampleIdParams4PQ(e)),o=n.remove(t,e=>e.id===A.PARAM_ID_SAMPLE_DATE),i.push(...o),i.push(...t);let E=this.reportingProxy.printParameters(i,s?r.REPORTING_CATEGORY_COMPONENTS:r.REPORTING_CATEGORY_NONE,a);return this.updateLastSamplePQID(E.getPrintItemIdentifier()),this.updateRemainingDataPQIDs([]),console.log("QAppWorkflowBase::addSample2PQ_withIds: done"),E}prepSampleIdParams4PQ(e){console.log("QAppWorkflowBase::prepSampleIdParams4PQ");let t=[],s=this.identifierAspect.getSIDVisualParams().map(e=>d.cloneJSON(e.getValue()));return e.forEach((e,a)=>{i.IdentifierAspect.getSIDState(a,this.taskHandler)!==E.EnumSampleIdentifierOptions.OFF&&""!==e&&(s[a].value.string=e,s[a].appearance=I.EnumAppearance.ENABLED,t.push(s[a]))}),t}addStatistic2PQ(e,t){if(console.log("QAppWorkflowBase::addStatistic2PQ"),t&&t.getValues().currCalcValues.numSamples>0){let s=[],a=t.getValues().currStatPublishableParameters;if(e){
let t=o.createEmptyTextParameter();t.value.text.id=e,t.info.suppressTitle=!0,s.push(t)}if(a.n.getValue().appearance!==I.EnumAppearance.HIDDEN&&s.push(a.n.getValue()),a.avg.getValue().appearance!==I.EnumAppearance.HIDDEN&&s.push(a.avg.getValue()),a.dev.getValue().appearance!==I.EnumAppearance.HIDDEN&&s.push(a.dev.getValue()),a.variation.getValue().appearance!==I.EnumAppearance.HIDDEN&&s.push(a.variation.getValue()),a.sum.getValue().appearance!==I.EnumAppearance.HIDDEN&&s.push(a.sum.getValue()),a.min.getValue().appearance!==I.EnumAppearance.HIDDEN&&s.push(a.min.getValue()),a.max.getValue().appearance!==I.EnumAppearance.HIDDEN&&s.push(a.max.getValue()),a.diff.getValue().appearance!==I.EnumAppearance.HIDDEN&&s.push(a.diff.getValue()),s.length>0)return this.reportingProxy.printParameters(s,r.REPORTING_CATEGORY_STATISTIC,!1)}}sampleAdded(){console.log("QAppWorkflowBase::sampleAdded"),void 0!==this.buttons.docuButton&&this.buttons.docuButton.setAppearance(I.EnumAppearance.ENABLED_SECONDARY)}
updateRemainingDataPQIDs(e){console.log("QAppWorkflowBase::updateRemainingDataPQIDs ids: "+e),this.updateInvalidationAspectSampleConfig({dependentPrintItemIds:e})}updateLastSamplePQID(e){console.log("QAppWorkflowBase::updateLastSamplePQID id: "+e),this.updateInvalidationAspectSampleConfig({samplePrintItemId:e})}updateInvalidationAspectSampleConfig(e){console.log("QAppWorkflowBase::updateInvalidationAspectSampleConfig");for(let t in this.aspects)if(t===c.INVAL_SAMPLE_ASPECT)return void this.aspects[t].updateCfgSampleOnly(e)}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(0),i=s(9),n=s(16),r=s(12),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 c extends n.AbstractQAppAspect{constructor(){
super(),this.states={STATE_ASPECT_INVAL_SAMPLE_ENTER:{_onEnter:function(e){let s=e.aspects[t.INVAL_SAMPLE_ASPECT];void 0!==s.cfg.sample&&s.cfg.sample.valid?e.showMessageBox({type:r.EnumMessageboxType.QUESTION,title:{id:"",args:[]},textList:[{id:"_QAPP_LIB_MSG_BOX_QUESTION_INVALIDATE_TEXT",args:[s.cfg.sample.sampleNo.toString()]}],buttons:[{id:_,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:a.EnumAppearance.ENABLED_SECONDARY},{id:l,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},appearance:a.EnumAppearance.ENABLED_SECONDARY}]}):e.addToEventQueue(new i.ImmediateEvent({from:t.STATE_ASPECT_INVAL_SAMPLE_ENTER,to:s.cfg.exitState}))},_onExit:function(e){e.hideMsgBox()},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(e,s){let a=e.aspects[t.INVAL_SAMPLE_ASPECT];s.payload.buttonId===l?this.transition(e,a.cfg.exitState):s.payload.buttonId===_&&(void 0!==a.cfg.sample&&(a.cfg.sample.valid=!1),this.transition(e,t.STATE_ASPECT_INVAL_SAMPLE_REASON))},IMMEDIATE_EVENT:function(e,s){
s.payload.from&&s.payload.from===t.STATE_ASPECT_INVAL_SAMPLE_ENTER&&this.transition(e,s.payload.to)}},STATE_ASPECT_INVAL_SAMPLE_REASON:{_onEnter:function(e){e.screens[o.KEYBOARD_SCREEN_ID].hide();let s=e.aspects[t.INVAL_SAMPLE_ASPECT];e.screens[o.KEYBOARD_SCREEN_ID].setParam(s.sP_4_InvalReason),e.screens[o.KEYBOARD_SCREEN_ID].show()},_onExit:function(e){e.screens[o.KEYBOARD_SCREEN_ID].hide()},_transTo:{},_transFrom:{},EV_HMI_PARAM_CHANGED:function(e,s){console.log("InvalidateSampleAspect - param change in STATE_ASPECT_INVAL_SAMPLE_REASON");let a=e.aspects[t.INVAL_SAMPLE_ASPECT];if(s.payload.parameter.id===t.PARAM_ID_RT_INVAL_REASON_INP){let t=a.cfg.sample;void 0!==t&&(t.invalidationReason=s.payload.parameter.value.string,void 0===a.cfg.samplePrintItemId||isNaN(a.cfg.samplePrintItemId)||e.reportingProxy.setRedactionStatus(a.cfg.samplePrintItemId,!0,t.invalidationReason),void 0!==a.cfg.dependentPrintItemIds&&a.cfg.dependentPrintItemIds.forEach(s=>{
e.reportingProxy.setRedactionStatus(s,!0,t.invalidationReason)})),this.transition(e,a.cfg.exitState)}}}},this.sP_4_InvalReason=c.createInvalidReasonParam(t.PARAM_ID_RT_INVAL_REASON_INP)}static createInvalidReasonParam(e){let t=E.createEmptyStringParameter();return t.id=e,t.title={id:"_QAPP_LIB_PARAM_TITLE_RT_INVAL_REASON",args:[]},t.header={id:"_QAPP_LIB_PARAM_HEADER_RT_INVAL_REASON",args:[]},t}updateCfgSampleOnly(e){this.cfg=Object.assign(this.cfg,e)}getId(){return t.INVAL_SAMPLE_ASPECT}getAspectStates(){return this.states}init(e){if(this.client=e,this.client){if(console.log("InvalidateSampleAspect::init"),!this.client.screens[o.KEYBOARD_SCREEN_ID]){let e=new o.KeyboardScreen(this.client.mqttHandler);this.client.registerScreen(e)}}else console.log("InvalidateSampleAspect::init - aspect not correctly initialized (no client set) - skip init")}}t.InvalidateSampleAspect=c},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(2),i=s(0)
;t.PARAM_ID_SAMPLE_NO="QAPP_LIB_SAMPLE_NO";const n={id:t.PARAM_ID_SAMPLE_NO,type:i.EnumParameterTypes.PARAM_STRING,value:{string:""},header:{id:"_QAPP_LIB_PARAM_HEADER_SAMPLE_NO",args:[]},title:{id:"_QAPP_LIB_PARAM_TITLE_SAMPLE_NO",args:[]},appearance:i.EnumAppearance.HIDDEN,info:{minimum:{length:0},maximum:{length:0}}};function r(){return a.cloneJSON(n)}t.getSampleNumberStringParameter=r,t.createSampleNumberStringParameter=function(e){let t=a.cloneJSON(r());return t.id=e,t},t.PARAM_ID_SAMPLE_DATE="QAPP_LIB_SAMPLE_DATE";const o={id:t.PARAM_ID_SAMPLE_DATE,type:i.EnumParameterTypes.PARAM_DATE_TIME,value:{timestamp:0},header:{id:"_QAPP_LIB_PARAM_HEADER_SAMPLE_DATETIME",args:[]},title:{id:"_QAPP_LIB_PARAM_TITLE_SAMPLE_DATETIME",args:[]},appearance:i.EnumAppearance.HIDDEN,info:{isTime:!0,isDate:!0}};function E(){return a.cloneJSON(o)}t.getSampleDateDTParameter=E,t.createSampleDateDTParameter=function(e){let t=a.cloneJSON(E());return t.id=e,t}},function(e,t,s){"use strict"
;Object.defineProperty(t,"__esModule",{value:!0});const a=s(8),i=s(0),n=s(85),r=s(30),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 a.Button(this.mqttHandler,this,s),this.publishTopLeftButton()}getTab(){return this.tab}setFigureTab(e,s){let a=n.TabApi.createFigureTab(this.mqttHandler,t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,e,!0,s);return this.tab=a,a}setGraphTab(e,s){let a=n.TabApi.createGraphTab(this.mqttHandler,t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,e,!0,s);return this.tab=a,a}setParamListTab(e,s){let a=n.TabApi.createParamListTab(this.mqttHandler,t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,e,!0,s);return this.tab=a,a}setMenuTab(e,s){let a=n.TabApi.createMenuTab(this.mqttHandler,t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,e,!0,s);return this.tab=a,a}setTableTab(e,s){
let a=n.TabApi.createTableTab(this.mqttHandler,t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,e,!0,s);return this.tab=a,a}show(){if(void 0!==this.tab){this.topLeftButton.publish();for(let e of this.buttonList)e.publish();this.tab.show(),super.show()}}hide(){super.hide()}getId(){return t.SINGLE_TAB_BUTTON_BAR_SCREEN_ID}getBarButtonId(){return o.MqttTopics.HMI_SINGLETABBUTTONBAR_SCREEN_BARBUTTONS}getTopLeftButtonId(){return o.MqttTopics.HMI_SINGLETABBUTTONBAR_SCREEN_TOPLEFTBUTTON}getButton(e){for(let t of this.buttonList)if(t.getButtonId()===e)return t;if(e===this.topLeftButton.getButtonId())return this.topLeftButton}createBarButtons(e){for(let t of e){let e=new a.Button(this.mqttHandler,this,t);this.buttonList.push(e),e.publish()}}publishBarButtons(){let e=[];for(let t of this.buttonList)e.push(o.MqttTopics.QAPP_NAMESPACE+"/"+t.getTopic());this.mqttHandler.publish(this.getBarButtonId(),JSON.stringify(e))}publishTopLeftButton(){
this.mqttHandler.publish(this.getTopLeftButtonId(),JSON.stringify(o.MqttTopics.QAPP_NAMESPACE+"/"+this.topLeftButton.getTopic()))}hideTopLeftButton(e=!0){this.topLeftButton.setAppearance(i.EnumAppearance.HIDDEN,e)}showTopLeftButton(e=!0){this.topLeftButton.setAppearance(i.EnumAppearance.ENABLED,e)}setTopLeftButton(e,t=!0){this.topLeftButton.setLabel(e.label,!1),this.topLeftButton.setIcon(e.icon,!1),e.nameId&&this.topLeftButton.setNameId(e.nameId,!1),e.labelCenter&&this.topLeftButton.setLabelCenter(e.labelCenter,!1),e.labelRight&&this.topLeftButton.setLabelRight(e.labelRight,!1),this.topLeftButton.setAppearance(e.appearance,!1),this.topLeftButton.setButtonId(e.buttonId,t)}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.REST_CMD_PENDING="REST_CMD_PENDING",e.REST_CMD_PENDING_TIMEOUT="REST_CMD_PENDING_TIMEOUT",e.REST_CMD_RESULT="REST_CMD_RESULT"}(t.ECommandStatus||(t.ECommandStatus={}))},function(e,t,s){"use strict"
;Object.defineProperty(t,"__esModule",{value:!0});const a=s(112);t.OmnisMeasurement=class extends a.Measurement{createEmptySampleData(e){return{identifiers:[],date:0,valid:!0,sampleNo:0,invalidationReason:""}}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Measurement=class{constructor(e){this.data=e}getIdentifiers(){return this.data.identifiers}getSamples(){return this.data.samples}getSample(e){return this.data.samples.find(t=>t.sampleNo===e)}addSample(){let e=this.getNumberOfSamples()+1,t=this.createEmptySampleData(e);return t.sampleNo=e,console.log("Measurement: addSample as sampleNo: ",t.sampleNo," old array length: ",this.getNumberOfSamples()),this.data.samples.push(t),t}getNumberOfSamples(){return this.data.samples.length}getIdxOfSample(e){return this.data.samples.findIndex(t=>t.sampleNo===e)}getLastSample(){return this.data.samples.length>0?this.data.samples[this.data.samples.length-1]:void 0}}},function(e,t,s){"use strict"
;Object.defineProperty(t,"__esModule",{value:!0});const a=s(3),i=s(32),n=s(14),r=s(10);class o{constructor(e,t=!1){this.value=void 0,this.scaleInterval=NaN,e&&this.setValue(e,t)}setValue(e,t=!1){this.value=e,t&&this.setScaleValue(e)}getValue(){return this.value}getValue_(){return this.getValue()}isPositive(){return!!this.value&&"+"===this.value.value.sign}isNegative(){return!!this.value&&"-"===this.value.value.sign}isStable(){return!!this.value&&this.value.value.isStable}setScaleValue(e){this.setScaleInterval(e.value.interval)}setScaleInterval(e){isNaN(e)||e<=0?(console.log("MeasureParameter::setScaleInterval: invalid incoming interval value"),this.scaleInterval=NaN):this.scaleInterval=e}getScaleDecimals(){if(isNaN(this.scaleInterval))return console.log("MeasureParameter::getScaleDecimals: invalid interval value NaN"),NaN;{let e=0,t=this.scaleInterval;if(this.scaleInterval<=0)return console.log("MeasureParameter::getScaleDecimals: invalid interval value <= 0"),NaN;for(;t<1;){
if(0===t)return console.log("MeasureParameter::getScaleDecimals: numeric error - interval rounded to zero in calculation"),NaN;t*=10,e++}return e}}getScaleInterval(){return this.scaleInterval}getScaleDivider(){let e=this.getScaleInterval();if(Number.isNaN(e))return NaN;if(e<=0)return console.log("MeasureParameter::getScaleDivider: invalid interval value <= 0"),NaN;if(e<1){for(;e<1;)if(0===(e*=10))return console.log("MeasureParameter::getScaleDivider: numeric error - interval rounded to zero in calculation"),NaN}else for(;e>=10;)e/=10;return e}setFloat(e,t,s=!1){let a=t-Math.floor(Math.abs(e)).toString().length,n=Math.max(a,0);if(this.value)if(Number.isNaN(e))this.value.value.number="NaN",this.value.value.isSpecial=!0,this.value.value.isInvalid=!0;else{let t=this.getScaleDecimals(),a=this.getScaleInterval();if(Number.isNaN(t)||Number.isNaN(a))this.value.value.number="NaN",this.value.value.isSpecial=!0,this.value.value.isInvalid=!0;else{if(n<t)t=n,e=i.SartoMath.roundExactToDecimals(e,t),
a=i.SartoMath.decPowers(-1*t);else if(a<1){let n=1;s?n=this.getScaleDivider():a/=this.getScaleDivider(),e=i.SartoMath.nTimesTen(e,t),e/=n,e=i.SartoMath.roundExact(e),e*=n,e=i.SartoMath.nTimesTen(e,-1*t)}else s||(a/=this.getScaleDivider()),e/=a,e=i.SartoMath.roundExact(e),e*=a;this.value.value.number=Math.abs(e).toFixed(t),this.value.value.sign="",e<0&&-0!==e&&(this.value.value.sign="-"),e>0&&0!==e&&(this.value.value.sign="+"),this.value.value.decimals=t,this.value.value.interval=a}}}round(e,t=!1){if(this.value){let s=this.getFloat();Number.isNaN(s)||this.setFloat(s,e,t)}return this}getAbsFloat(){return this.value?parseFloat(this.value.value.number):NaN}getFloat(){let e=this.getAbsFloat();return Number.isNaN(e)?NaN:this.applySign(e)}isUseDisabled(){let e=!0;return e=!this.value||(this.value.value.isInvalid||this.value.value.isSpecial)}isSpecial(){return!!this.value&&this.value.value.isSpecial}getStepsAbs(){let e=0;if(this.value){let t=this.getScaleInterval()
;Number.isNaN(t)||(t<1?(e=this.getAbsFloat(),e=i.SartoMath.nTimesTen(e,this.getScaleDecimals()),e/=this.getScaleDivider()):e=this.getAbsFloat()/t,e=i.SartoMath.roundExact(e))}return e}getSteps(){return this.applySign(this.getStepsAbs())}applySign(e){return!Number.isNaN(e)&&this.value?"-"===this.value.value.sign?-1*e:e:NaN}getSign(){return void 0!==this.value?this.value.value.sign:"N/A"}getUnit(){return void 0!==this.value?this.value.value.unit:"none"}static convertValueQuantityToMeasure(e,t,s,E=0,_=!1,l=!1,c=!0,A=!1){let u=n.QuantityParameter.getValue(e),T={mark:s,unit:r.isArray(e.unit)?e.unit[0]:e.unit,sign:"",number:"NaN",decimals:0,interval:0,auxiliaryDigits:E,isSpecial:l,isInvalid:_,isStable:c,isWarning:A},d=a.createEmptyMeasureParameter();d.value=T;let S=new o(d,!0);return S.setScaleInterval(i.SartoMath.decPowers(-1*e.decimals)),Number.isNaN(u)?T.isSpecial=!0:S.setFloat(u,t,!1),T}}t.MeasureParameter=o},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const a=s(0),i=s(30),n=s(6),r=s(3);t.OMNIS_LOGIN_SCREEN_ID="OMNISLOGIN",t.BACK_BUTTON_ID="BTN_BACK",t.LOGIN_DATA_PARAM_ID="LOGIN_DATA",t.LOGIN_DATA_PASS_PARAM_ID="LOGIN_DATA_PASS",t.LOGIN_DATA_USER_PARAM_ID="LOGIN_DATA_USER",t.LOGIN_DATA_SAVE_CREDENTIALS_PARAM_ID="LOGIN_DATA_SAVE_CREDENTIALS";t.OmnisLoginScreen=class extends i.AbstractOverlay{constructor(e){super(e),this.screenHmiObject={appearance:a.EnumAppearance.HIDDEN,onlyUsername:!1,showUserDropdown:!1,allowSaveCredentials:!1,defaultUser:"",listOfLastUsers:[],title:r.createEmptyTextStructure(),text1:r.createEmptyTextStructure(),text2:r.createEmptyTextStructure(),loginText:r.createEmptyTextStructure(),passwordText:r.createEmptyTextStructure()},this.lastPublishedTabContent=""}getId(){return"OMNISLOGIN"}show(){this.screenHmiObject.appearance=a.EnumAppearance.ENABLED,this.publish()&&this.events$.next({type:n.ScreenEventType.SHOW_OVERLAY,id:this.getId()})}hide(){this.screenHmiObject.appearance=a.EnumAppearance.HIDDEN,
this.publish()&&this.events$.next({type:n.ScreenEventType.HIDE_OVERLAY,id:this.getId()})}setOnlyUserName(e,t=!0){this.screenHmiObject.onlyUsername=e,t&&this.publish()}setDefaultUser(e,t=!0){this.screenHmiObject.defaultUser=e,t&&this.publish()}setAllowSaveCredentials(e,t=!0){this.screenHmiObject.allowSaveCredentials=e,t&&this.publish()}setLastUsers(e,t=!0){this.screenHmiObject.listOfLastUsers=e,this.screenHmiObject.showUserDropdown=this.screenHmiObject.listOfLastUsers.length>0,t&&this.publish()}setTitle(e,t=!0){this.screenHmiObject.title=e,t&&this.publish()}setText1(e,t=!0){this.screenHmiObject.text1=e,t&&this.publish()}setText2(e,t=!0){this.screenHmiObject.text2=e,t&&this.publish()}setUsernameTitle(e,t=!0){this.screenHmiObject.loginText=e,t&&this.publish()}setPasswordTitle(e,t=!0){this.screenHmiObject.passwordText=e,t&&this.publish()}setBgImage(e,t=!0){this.screenHmiObject.imgref=e,t&&this.publish()}publish(){let e=JSON.stringify(this.screenHmiObject)
;return e!==this.lastPublishedTabContent&&(this.publishContent("",e),this.lastPublishedTabContent=e,!0)}}},function(e,t){e.exports=require("then-request")},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.REST_URI_O2C_STATUS="/omnis/system/status",t.REST_URI_O2C_INFORMATION="/omnis/system/information",t.REST_URI_O2C_WEIGH_CMD="/omnis/command/weigh/",t.REST_URI_O2C_TARE_CMD="/omnis/command/zerotare/",t.REST_INCOMING_REQUEST_TOKEN_KEY="systemid",t.REST_STATUS_MSG_200="OK",t.REST_STATUS_MSG_202="Accepted",t.REST_STATUS_MSG_400="Bad Request",t.REST_STATUS_MSG_401_system="System not authorized",t.REST_STATUS_MSG_404="Not Found",t.REST_STATUS_MSG_405="Method Not Allowed",t.REST_STATUS_MSG_409="Conflict - wrong state or ongoing command",t.REST_CMD_SYNC_TIMEOUT_MS=2e3,function(e){e[e.WEIGH_RESULT_VALID=0]="WEIGH_RESULT_VALID",e[e.WEIGH_RESULT_CANCELED=1]="WEIGH_RESULT_CANCELED",e[e.WEIGH_RESULT_ERROR=2]="WEIGH_RESULT_ERROR"
}(t.EWeighCmdResult||(t.EWeighCmdResult={})),function(e){e[e.TARE_TYPE_ZERO=0]="TARE_TYPE_ZERO",e[e.TARE_TYPE_TARE=1]="TARE_TYPE_TARE",e[e.TARE_TYPE_ZERO_TARE_AUTO=2]="TARE_TYPE_ZERO_TARE_AUTO"}(t.ETareType||(t.ETareType={})),function(e){e[e.TARE_RESULT_TARED=0]="TARE_RESULT_TARED",e[e.TARE_RESULT_CANCELED=1]="TARE_RESULT_CANCELED",e[e.TARE_RESULT_ERROR=2]="TARE_RESULT_ERROR"}(t.ETareCmdResult||(t.ETareCmdResult={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(4),i=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 a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="clockHandler"}getFormatConfiguration(){return this.body.method=i.RestMethodsCLOCK_HANDLER.getFormatConfiguration,this.body.params={
configuration:""},new a.CubisRestResponse(this.syncRequest())}getFormatConfigurationI18n(){return this.body.method=i.RestMethodsCLOCK_HANDLER.getFormatConfigurationI18n,this.body.params={configuration:""},new a.CubisRestResponse(this.syncRequest())}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(16),i=s(9),n=s(1);var r;t.WAITING_TARE_ASPECT="WAITING_TARE_ASPECT",t.STATE_ASPECT_WAITING_FOR_TARE="STATE_ASPECT_WAITING_FOR_TARE",function(e){e.NONE="NONE",e.STARTED="STARTED",e.FINISHED="FINISHED",e.CANCELED="CANCELED"}(r=t.ITareResultState||(t.ITareResultState={})),function(e){e.doZero="doZero",e.doTare="doTare",e.doZeroTare="doZeroTare",e.doTare1="doTare1",e.doTare2="doTare2"}(t.ITareResultCalledMethod||(t.ITareResultCalledMethod={}));t.WaitingTareAspect=class extends a.AbstractQAppAspect{constructor(){super(),this.states={STATE_ASPECT_WAITING_FOR_TARE:{_onEnter:function(e){let s=e.aspects[t.WAITING_TARE_ASPECT];s.tareResult=void 0
;let a=s.cfg.doFn();a.isSuccess()||(console.log("WaitingTareAspect: trigger failed"),s.tareResult={state:r.CANCELED,method:void 0,result:a.result,special:""},e.addToEventQueue(new i.ImmediateEvent({from:t.STATE_ASPECT_WAITING_FOR_TARE,to:s.cfg.exitStateNoTare})))},_onExit:function(e){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,s){s.payload.from&&s.payload.from===t.STATE_ASPECT_WAITING_FOR_TARE&&this.transition(e,s.payload.to)},EV_MQTT_UPDATE:function(e,s){let a=e.aspects[t.WAITING_TARE_ASPECT],i=a.cfg;switch(s.payload.topic){case n.MqttTopics.WEIGHING_TARE_BLOCK:let t=JSON.parse(s.payload.value.toString());a.tareResult=t,t.state===r.FINISHED&&this.transition(e,i.nextState),t.state!==r.CANCELED&&t.state!==r.NONE||this.transition(e,i.exitStateNoTare);break;default:i.handleMqttEvent&&i.handleMqttEvent(s)}}}}}getId(){return t.WAITING_TARE_ASPECT}getAspectStates(){return this.states}init(e){this.client=e,this.client?(console.log("WaitingTareAspect::init"),
this.client.mqttHandler.subscribe(n.MqttTopics.WEIGHING_TARE_BLOCK)):console.log("WaitingTareAspect::init - aspect not correctly initialized (no client set) - skip init")}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(84),i=s(120),n=s(10);t.MQTT_TOPIC_OMNIS_DISCOVERY_RESPONSE="/QAPP/UDP/OMNIS_DISCOVER_RX";t.DiscoveryAgent=class extends i.UdpGateway{constructor(e){super(e)}startDiscovery(e,s){console.log("DiscoveryAgent::startDiscovery");let a=new Uint8Array(3);a[0]=160,a[1]=160,a[2]=0;let i=Buffer.from(e),n=Buffer.concat([a,i]);return console.log(`DiscoveryAgent::startDiscovery: udp data for discovery: '${n.toString("ascii")}'`),this.sendUDPBroadcast(s,n,t.MQTT_TOPIC_OMNIS_DISCOVERY_RESPONSE)}stopDiscovery(){console.log("DiscoveryAgent::stopDiscovery"),this.cancelUDPListening(t.MQTT_TOPIC_OMNIS_DISCOVERY_RESPONSE)}decodeUdpDiscoveryResponse(e){try{console.log("DiscoveryAgent::decodeUdpDiscoveryResponse: rx "+n.inspect(e))
;let t=Buffer.from(e.data,"base64");if(10===t.readUInt8(0)&&10===t.readUInt8(1)){if(console.log("DiscoveryAgent::decodeUdpDiscoveryResponse: OMNIS discovery answer"),0===t.readUInt8(2)){console.log("DiscoveryAgent::decodeUdpDiscoveryResponse: version 0");let s=t.readInt16BE(3);console.log("DiscoveryAgent::decodeUdpDiscoveryResponse: JSON length (utf8-bytes): "+s);let i=t.toString("utf8",5,5+s);console.log("DiscoveryAgent::decodeUdpDiscoveryResponse: got JSON: "+i);let n=JSON.parse(i);return{systemName:n.name,supportedSystemVersion:n.versions,systemVersion:Number.NaN,baseURL:`https://${e.ip}:${n.port}/`,systemId:n.systemId,loginMode:a.ELoginMethods.LOGIN_UNKNOWN}}console.log("DiscoveryAgent::decodeUdpDiscoveryResponse: unsupported version of UDP discovery response: "+t.readUInt8(2))}else console.log("DiscoveryAgent::decodeUdpDiscoveryResponse: drop non OMNIS discovery response starting with: 0x"+t.readUInt8(0).toString(16))}catch(e){
console.log("DiscoveryAgent::decodeUdpDiscoveryResponse: error decoding UDP discovery response: "+e)}return null}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(4),i=s(10),n=s(5);t.UdpGateway=class extends a.BaseProxy{constructor(e){super(),this.mqttHandler=e,this.restEndpoint="deviceinformation"}sendUDPBroadcast(e,t,s){return new Promise((i,r)=>{let o=()=>{let i;if(t instanceof Buffer)console.log("UdpGateway::sendUDPBroadcast: base64 encode the buffer"),i=t.toString("base64");else{console.log("UdpGateway::sendUDPBroadcast: stringify object to JSON and base64 encode the buffer");let e=JSON.stringify(t);i=Buffer.from(e).toString("base64")}return console.log(`UdpGateway::sendUDPBroadcast: broadcast udp data to port: ${e}: ${i}`),this.body.method=n.RestMethodsDEVICE_INFORMATION.sendUDPBroadcast,this.body.params={destPort:e,data:i,responseTopic:s},new a.CubisRestResponse(this.syncRequest())}
;s?(console.log(`UdpGateway::sendUDPBroadcast: start listen on MQTT topic: ${s}`),this.mqttHandler.subscribe(s,(e,t)=>{e?(console.log("UdpGateway::sendUDPBroadcast: error subscribing to MQTT broker"),r(e)):(console.log("UdpGateway::sendUDPBroadcast: subscribed to MQTT broker"),i(o()))}),console.log("UdpGateway::sendUDPBroadcast: subscribing to MQTT broker")):(console.log("UdpGateway::sendUDPBroadcast: no answers for broadcast expected - no listening on MQTT"),i(o()))})}cancelUDPListening(e){console.log(`UdpGateway::cancelUDPListening: stop listening on MQTT topic: ${e}`),this.mqttHandler.unsubscribe(e),console.log("UdpGateway::cancelUDPListening: unsubscribed from MQTT"),this.body.method=n.RestMethodsDEVICE_INFORMATION.cancelUDP,this.body.params={responseTopic:e};let t=new a.CubisRestResponse(this.syncRequest());return console.log(`UdpGateway::cancelUDPListening: canceled listening responses for UDP broadcast: ${i.inspect(t)}`),t}listenUDP(e,t){
console.log(`UdpGateway::listenUDP: listen on MQTT topic: ${t}`),this.body.method=n.RestMethodsDEVICE_INFORMATION.listenUDP,this.body.params={listenPort:e,responseTopic:t};let s=new a.CubisRestResponse(this.syncRequest());return console.log(`UdpGateway::listenUDP: started listening responses for UDP broadcast: ${s}`),s}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(4),i=s(3),n=s(51),r=s(3),o=s(0),E=s(15),_=s(88),l=s(5);var c;!function(e){e.EVENT_CREATED="Created",e.EVENT_CHANGED="Changed",e.EVENT_DELETED="Deleted",e.EVENT_LOGIN="Login",e.EVENT_LOGUT="Logout",e.EVENT_ISOCAL="isoCAL",e.EVENT_INTERNALADJUST="InternalAdjustment",e.EVENT_EXTERNALADJUST="ExternalAdjustment",e.EVENT_USERCAL="User Calibration",e.EVENT_MESSAGE="Message",e.EVENT_ELEC_SIGNATURE="Electronic Signature",e.EVENT_OP_START="Operation Start",e.EVENT_OP_END="Operation End",e.EVENT_LICENSED="Licensed"}(t.EnumAuditTrailEvent||(t.EnumAuditTrailEvent={})),function(e){
e.WORKFLOWMANAGEMENT="WORKFLOWMANAGEMENT",e.USERMANAGEMENT="USERMANAGEMENT",e.ROLEMANAGEMENT="ROLEMANAGEMENT",e.CONFIGURATIONMANAGEMENT="CONFIGURATIONMANAGEMENT",e.AUDITTRAIL="AUDITTRAIL",e.ACCESSCONTROL="ACCESSCONTROL",e.DATAHANDLER="DATAHANDLER",e.DATABASEDRIVER="DATABASEDRIVER",e.ENCRYPTIONHELPER="ENCRYPTIONHELPER",e.RESULTMANAGEMENT="RESULTMANAGEMENT",e.EXTERNALCOMMUNICATION="EXTERNALCOMMUNICATION",e.IPPCLIENT="IPPCLIENT",e.LDAPCLIENT="LDAPCLIENT",e.NTPCLIENT="NTPCLIENT",e.SMBCLIENT="SMBCLIENT",e.INTERNALCOMMUNICATION="INTERNALCOMMUNICATION",e.WORKFLOWAUTOMATIONHANDLER="WORKFLOWAUTOMATIONHANDLER",e.REPORTING="REPORTING",e.BACKUPRESTOREHANDLER="BACKUPRESTOREHANDLER",e.DEVICEDATA="DEVICEDATA",e.TIMERDAEMON="TIMERDAEMON",e.MODBUS="MODBUS",e.OSHELPER="OSHELPER",e.STATUSSERVICE="STATUSSERVICE",e.MESSAGEBROKER="MESSAGEBROKER",e.RESTCALLHANDLER="RESTCALLHANDLER",e.MENUHANDLER="MENUHANDLER",e.LOCALIZER="LOCALIZER",e.PARAMETER="PARAMETER",e.MESSAGEHANDLER="MESSAGEHANDLER",
e.SELFMONITOR="SELFMONITOR",e.SENSORACTORHANDLER="SENSORACTORHANDLER",e.TASKMANAGEMENT="TASKMANAGEMENT",e.CALENDAR="CALENDAR",e.QAPP_FRAMEWORK="QAPP_FRAMEWORK",e.QAPPHANDLER="QAPPHANDLER",e.QAPPMANAGEMENT="QAPPMANAGEMENT",e.PROFILEMANAGEMENT="PROFILEMANAGEMENT",e.FIRMWARELOADER="FIRMWARELOADER",e.DEVICEMANAGER="DEVICEMANAGER",e.EXTERNALDEVICESERVICE="EXTERNALDEVICESERVICE",e.INTERFACEMANAGEMENT="INTERFACEMANAGEMENT",e.MOTIONSENSOR="MOTIONSENSOR",e.ALIBIMEMORY="ALIBIMEMORY",e.CLOCKHANDLER="CLOCKHANDLER",e.WATCHDOG="WATCHDOG",e.CALIBRATIONADJUSTMENT="CALIBRATIONADJUSTMENT",e.CLIMATECONTROL="CLIMATECONTROL",e.DEVICEINFORMATION="DEVICEINFORMATION",e.DRAFTSHIELD="DRAFTSHIELD",e.IONIZER="IONIZER",e.LEVELING="LEVELING",e.WEIGHING="WEIGHING",e.COUNTING="COUNTING",e.PERCENTAGE="PERCENTAGE",e.CHECKWEIGHING="CHECKWEIGHING",e.CALCULATION="CALCULATION",e.PAPERWEIGHT="PAPERWEIGHT",e.LDAP="LDAP",e.MINUSP="MINUSP",e.QAPP="QAPP",e.CONNECTORMANAGEMENT="CONNECTORMANAGEMENT",e.IMPORTEXPORT="IMPORTEXPORT",
e.TRANSFERMANAGEMENT="TRANSFERMANAGEMENT",e.__LAST__="__LAST__"}(c=t.EnumAuditTrailModule||(t.EnumAuditTrailModule={}));const A="QAPP_AUDITTRAIL_ENTRY_TASK_NAME";t.AuditTrailProxy=class extends a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="audit"}addEventWithParameters(e,t,s,a=""){let _=new n.LocalizerProxy,l=E.flatten(s.map(e=>{let t=[{id:e.title.id,args:e.title.args},{id:e.header.id,args:e.header.args}];return i.isTypeOfITextParameter(e)&&(t=[...t,{id:e.value.text.id,args:e.value.text.args}]),t}));"object"==typeof t&&(l=[...l,{id:"GLP_TASK_NAME_TITLE",args:[]},{id:"GLP_TASK_NAME_HEADER",args:[]}]);let u=_.getTexts(l),T=0;for(let e of s)e.title.id=u[T++],e.title.args=[],e.header.id=u[T++],e.header.args=[],i.isTypeOfITextParameter(e)&&(e.value.text.id=u[T++],e.value.text.args=[]);if("object"==typeof t){let e=r.createEmptyTextParameter();e.appearance=o.EnumAppearance.ENABLED,e.id=A,e.title.id=u[T++],e.header.id=u[T++],e.value.text.id=t.getTaskName()||"---",s=[e,...s],
t=c.QAPP}else if(t===c.QAPP)throw new Error("AuditTrailProxy::addEventWithParameters called with QAPP module enum but no QApp instance given.");let d=JSON.stringify(this.convertToEventParameters(s));return console.log(`AuditTrailProxy: send operation string: ' ${d}'`),this.addEventInternal(e,t,d,a)}addEvent(e,t,s,a=!1,i=""){let n;return a?(n=r.createEmptyStringParameter()).value.string=s:((n=r.createEmptyTextParameter()).value.text.id=s,n.info.suppressTitle=!0),n.id=A,n.appearance=o.EnumAppearance.ENABLED,n.title.id="AUDITTRAIL_TITLE_NONE",n.header.id="AUDITTRAIL_HEADER_NONE",this.addEventWithParameters(e,t,[n],i)}addEventInternal(e,t,s,i=""){let n;this.body.method=l.RestMethodsAUDITTRAIL.addEventExt,this.body.params={auditTrailEvent:e,moduleName:t,operation:s,destination:i};try{return(n=new a.CubisRestResponse(this.syncRequest())).isSuccess()}catch(e){return console.log("Something went wrong when calling addEventExt"),console.log(e),!1}}convertToEventParameters(e){
let t=new n.LocalizerProxy;return Array.from(e,e=>{let s=r.createEmptyTextParameter();switch(s.appearance=e.appearance,s.id=e.id,s.title=e.title,s.header=e.header,e.type){case o.EnumParameterTypes.PARAM_STRING:s.value.text.id=e.value.string;break;case o.EnumParameterTypes.PARAM_SELECTION:{const a=e.value.selection.id,i=e.info.options.find(e=>e.id===a),n=void 0!==i?t.getText(i.text.id,i.text.args):"---";s.value.text.id=n;break}case o.EnumParameterTypes.PARAM_MULTIPLE_SELECTION:{const a=e.value.selections.map(t=>e.info.options.find(e=>e.id===t.id)).map(e=>void 0===e?{id:"---",args:[]}:{id:e.text.id,args:e.text.args}),i=t.getTexts(a);s.value.text.id=i.join(", ");break}case o.EnumParameterTypes.PARAM_QUANTITY:{const t=e.value;s.value.text.id=`${t.numbers[0]} ${t.unit}`;break}case o.EnumParameterTypes.PARAM_MEASURE:{const t=e.value;s.value.text.id=`${t.sign} ${t.number} ${t.unit}`;break}case o.EnumParameterTypes.PARAM_DATE_TIME:{
const t=1e3*e.value.timestamp,{isDate:a,isTime:i}=e.info,n=_.getDateTimeConfiguration(),r=_.convertToDateTimeFormat(t,n);s.value.text.id=a&&!i?`${r.date}`:!a&&i?`${r.time}`:a&&i?`${r.date} ${r.time}`:"---";break}case o.EnumParameterTypes.PARAM_FORMULA:s.value.text.id=e.value[0].visual;break;case o.EnumParameterTypes.PARAM_TEXT:s.value=e.value;break;default:s.value.text.id="---"}return s})}getRecords(e){let t;if(this.body.method=l.RestMethodsAUDITTRAIL.getRecords,this.body.params=e,this.body.params.document="",(t=new a.CubisRestResponse(this.syncRequest())).isSuccess()){let e=t.rawReturns.document;return JSON.parse(e).data}return console.log("AuditTrailProxy::getRecords: error returned: "+t.rawReturns),[]}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(123);t.SatDate=class extends Date{toJSON(e){return this.toISOStringNoUTC()}toISOStringNoUTC(){let e=this.getTimezoneOffset(),t=new Date(this.valueOf()-60*e*1e3),s=Math.round(e/60)
;return t.toISOString().replace("Z",a.numberPadInteger(s,2,!0)+":00")}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numberPadInteger=function(e,t,s=!1){let a,i=e<0;for(a=i?(-1*e).toFixed(0):e.toFixed(0);a.length<(t||2);)a="0"+a;return i?a="-"+a:!0===s&&(a="+"+a),a}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(10),i=s(16),n=s(44),r=s(59),o=s(60),E=s(90),_=s(0),l=s(1),c="RESET",A="UNLOCK";t.LockingAspect=class extends i.AbstractQAppAspect{init(e){this.client=e,this.lockScreen=new E.LockScreenProvider(this.client.mqttHandler)}getId(){return n.LOCKING_ASPECT}getAspectStates(){return{}}adaptFsmStates(e){for(let t in e){let s;void 0!==(s=e[t].EV_HMI_BTN_CLICKED)&&(e[t].EV_HMI_BTN_CLICKED_OV_LOCKING_ASP=s),e[t].EV_HMI_BTN_CLICKED=function(s,a){let i=s.aspects[n.LOCKING_ASPECT];if(a.payload.buttonId===E.BTN_ID_LOCK_SCREEN_LOGOUT){console.log("LockingAspect: logout btn pressed");let e=i.handleLockLogoutBtn()
;console.log("LockingAspect: logout btn pressed... trans to: "+e),this.transition(s,e)}void 0!==e[t].EV_HMI_BTN_CLICKED_OV_LOCKING_ASP&&e[t].EV_HMI_BTN_CLICKED_OV_LOCKING_ASP.call(this,s,a)},void 0!==(s=e[t].EV_HMI_PARAM_CHANGED)&&(e[t].EV_HMI_PARAM_CHANGED_OV_LOCKING_ASP=s),e[t].EV_HMI_PARAM_CHANGED=function(s,a){let i=s.aspects[n.LOCKING_ASPECT];a.payload.parameter.id===E.LOCK_DATA_PARAM_ID&&this.transition(s,i.handleLockUnlockDataRx(a.payload.parameter)),void 0!==e[t].EV_HMI_PARAM_CHANGED_OV_LOCKING_ASP&&e[t].EV_HMI_PARAM_CHANGED_OV_LOCKING_ASP.call(this,s,a)}}}getLockLoadingScreen(){let e=this.client.screens[o.LOCK_LOADING_OVERLAY_ID];return void 0===e&&(e=new o.LockLoadingOverlay(this.client.mqttHandler),this.client.registerScreen(e)),e}showLockLoadingScreen(e){console.log("LockingAspect::showLockLoadingScreen() "+a.inspect(e));let t=this.getLockLoadingScreen();e?t.setText(e):t.setText({id:"",args:[]}),t.show()}hideLockLoadingScreen(){
console.log("LockingAspect::hideLockLoadingScreen()");try{this.getLockLoadingScreen().hide()}catch(e){}}getLockMsgbox(){let e=this.client.screens[r.LOCKMESSAGEBOX_ID];return void 0===e&&(e=new r.LockMessageBox(this.client.mqttHandler),this.client.registerScreen(e)),e}showLockMsgBox(e){console.log("LockingAspect::showLockMsgBox(): id "+e.title.id);let t=this.getLockMsgbox();t.setMessageBoxData(e),t.show()}hideLockMsgBox(){console.log("LockingAspect::hideLockMsgBox()"),this.getLockMsgbox().hide()}isLockMsgBoxEnabled(){return this.getLockMsgbox().getAppearance()===_.EnumAppearance.ENABLED}setTimeout(e){let t;console.log("LockingAspect::setTimeout: [s] "+e),t=Number.isNaN(e)||0===e?E.getDefaultLockScreenJson():Object.assign({},this.cfg.getLockScreenFn(),{timeoutSec:e}),console.log("LockingAspect::setTimeout ..."+a.inspect(t)),this.lockScreen.setContent(t)}resetLockTimer(){console.log("LockingAspect::resetLockTimer"),this.client.mqttHandler.publish(l.MqttTopics.HMI_LOCK_RESET,c,{retain:!1})
}handleLockUnlockDataRx(e){return console.log("LockingAspect::handleLockUnlockDataRxFn"),this.cfg.handleLockUnlockDataRxFn(e)}handleLockLogoutBtn(){console.log("LockingAspect::handleLockLogoutBtn"),this.showLockLoadingScreen(),this.unlock();let e=this.cfg.doLogoutFn();return console.log("LockingAspect::handleLockLogoutBtn... trans to "+e),e}unlock(){console.log("LockingAspect::unlock"),this.resetLockTimer(),this.client.mqttHandler.publish(l.MqttTopics.HMI_LOCK_UNLOCK,A,{retain:!1})}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(4),i=s(5);t.UserManagementProxy=class extends a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="user"}isAutoLogout(){let e;return this.body.method=i.RestMethodsUSER_MANAGEMENT.isAutoLogout,this.body.params={isAutoLogout:!1},!!(e=new a.CubisRestResponse(this.syncRequest())).isSuccess()&&e.rawReturns.isAutoLogout}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0})
;const a=s(0),i=s(47),n=s(22),r=s(16),o=s(21),E=s(31),_=s(48),l=s(14),c=s(9),A=s(65),u=s(7),T=s(2),d=s(18);t.EDIT_PARAMS_ASPECT="EDIT_PARAMS_ASPECT",t.STATE_ASPECT_EDIT_PARAMS_EDIT_ENTER="STATE_ASPECT_EDIT_PARAMS_EDIT_ENTER";const S="STATE_ASPECT_EDIT_PARAMS_EDIT",I="STATE_ASPECT_EDIT_PARAMS_USER_ACTION",p="STATE_ASPECT_EDIT_PARAMS_INSPECT",N="STATE_ASPECT_EDIT_PARAMS_OVERVIEW";t.EditParamsAspect=class extends r.AbstractQAppAspect{constructor(){super(...arguments),this.states={STATE_ASPECT_EDIT_PARAMS_EDIT_ENTER:{_onEnter:function(e){e.addToEventQueue(new c.ImmediateEvent(S))},_onExit:function(){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(e,t){t.payload===S&&this.transition(e,S)},"*":function(e){this.deferUntilTransition(e)}},STATE_ASPECT_EDIT_PARAMS_EDIT:{_onEnter:function(e){let s=e.aspects[t.EDIT_PARAMS_ASPECT],n=e.screens[i.PARAM_LIST_SCREENID].getButton(i.FINISH_BUTTON_ID);if(void 0!==n){let e=s.cfg.isValidFn()
;n.setAppearance(e?a.EnumAppearance.ENABLED_PRIMARY:a.EnumAppearance.DISABLED)}},_onExit:function(){},_transFrom:{STATE_ASPECT_EDIT_PARAMS_EDIT_ENTER:function(e){let s=e.aspects[t.EDIT_PARAMS_ASPECT],a=e.screens[i.PARAM_LIST_SCREENID];a.readFromParameterGroupArray(s.cfg.parameters),a.setShowLastVisibleCategory(!1,!1),e.showScreen(a),e.hideLoadingScreen()},STATE_ASPECT_EDIT_PARAMS_OVERVIEW:function(e){let s=e.aspects[t.EDIT_PARAMS_ASPECT],n=e.screens[i.PARAM_LIST_SCREENID];n.readFromParameterGroupArray(s.cfg.parameters),n.setShowLastVisibleCategory(!0,!1);let r=n.getButton(i.FINISH_BUTTON_ID);if(void 0!==r){let e=s.cfg.isValidFn();r.setAppearance(e?a.EnumAppearance.ENABLED_PRIMARY:a.EnumAppearance.DISABLED)}e.showScreen(n)}},EV_HMI_BTN_CLICKED:function(e,s){let a=e.aspects[t.EDIT_PARAMS_ASPECT];s.payload.buttonId===i.FINISH_BUTTON_ID&&a.cfg.isValidFn()&&(void 0===a.cfg.displayParameterOverview?this.transition(e,a.cfg.nextState):this.transition(e,N)),
s.payload.buttonId===d.CANCEL_BUTTON_ID&&this.transition(e,a.cfg.cancelState)},EV_HMI_PARAM_CHANGED:function(e,s){let a=e.aspects[t.EDIT_PARAMS_ASPECT].updateParameterGeneric(s.payload.parameter),i=[{guardFn:function(){return void 0===a},nextState:""},{guardFn:function(){return void 0!==a},nextState:I}];this.myHandler(e,i,s)},EV_HMI_PARAM_DETAIL:function(e,s){e.aspects[t.EDIT_PARAMS_ASPECT].inspectParameter(s.payload.parameter),this.transition(e,p)}},STATE_ASPECT_EDIT_PARAMS_INSPECT:{_onEnter:function(){},_onExit:function(){},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(e,t){t.payload.buttonId===d.CANCEL_BUTTON_ID&&this.transition(e,S)}},STATE_ASPECT_EDIT_PARAMS_USER_ACTION:{_onEnter:function(){},_onExit:function(){},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(e,s){let a=e.aspects[t.EDIT_PARAMS_ASPECT];if(s.payload.buttonId===d.CANCEL_BUTTON_ID)this.transition(e,a.cfg.cancelState);else{let t=a.handleParamUpdateUserActionGeneric(s)
;"boolean"==typeof t&&t&&this.transition(e,S)}}},STATE_ASPECT_EDIT_PARAMS_OVERVIEW:{_onEnter:function(){},_onExit:function(){},_transTo:{},_transFrom:{STATE_ASPECT_EDIT_PARAMS_EDIT:function(e){e.aspects[t.EDIT_PARAMS_ASPECT].initPO()}},EV_HMI_BTN_CLICKED:function(e,s){let a=e.aspects[t.EDIT_PARAMS_ASPECT];s.payload.buttonId===A.SAVE_BUTTON_ID?this.transition(e,a.cfg.nextState):s.payload.buttonId===A.BACK_BUTTON_ID?this.transition(e,S):s.payload.buttonId===d.CANCEL_BUTTON_ID&&this.transition(e,a.cfg.cancelState)}}},this.currentParamUpdateUserAction=void 0,this.isLastUserActionGenericError=!1}getId(){return t.EDIT_PARAMS_ASPECT}getAspectStates(){return this.states}getEntryState(){return t.STATE_ASPECT_EDIT_PARAMS_EDIT_ENTER}init(e){if(this.client=e,this.client){if(console.log("EditParamsAspect::init"),void 0===this.client.screens[i.PARAM_LIST_SCREENID]){let e=new i.ParameterListScreen(this.client.mqttHandler);this.client.registerScreen(e)}
}else console.log("EditParamsAspect::init - aspect not correctly initialized (no client set) - skip init")}configure(e){if(super.configure(e),void 0!==this.cfg.displayParameterOverview&&(this.client.screens[i.PARAM_LIST_SCREENID].setFinishButtonLabel({id:u.EnumFontLabels.NEXT,args:[]}),void 0===this.client.screens[A.PARAM_OVER_SCREENID])){let e=new A.ParameterOverviewScreen(this.client.mqttHandler);this.client.registerScreen(e)}}publishParameter(e){void 0!==this.client&&this.client.screens[i.PARAM_LIST_SCREENID]&&this.client.screens[i.PARAM_LIST_SCREENID].updateParameter(e)}updateParameter(e){return this.cfg.parameters.some((t,s)=>t.parameters.some((t,a)=>t.id===e.id&&(this.cfg.parameters[s].parameters[a]=e,!0)))?(console.log(`Parameter ${e.id} updated!\n`),!0):(console.log(`Parameter ${e.id} not found!\n`),!1)}updateParameterAndPublish(e){return e.type===a.EnumParameterTypes.PARAM_QUANTITY&&l.QuantityParameter.roundToDecimalPlaces(e),
!!this.updateParameter(e)&&(this.publishParameter(e),!0)}setCurrentParamUpdateUserAction(e){e?this.updateMessageBoxFromActionMessageAndShow(e.message):this.currentParamUpdateUserAction&&this.client.hideMsgBox(),this.currentParamUpdateUserAction=e}getCurrentParamUpdateUserAction(){return this.currentParamUpdateUserAction}updateParameterGeneric(e){console.log("EditParamsAspect: updateParameterGeneric");let t=void 0;!0!==e.suppressLibRuleChecks&&(t=E.checkGeneralParamRules(e)),void 0!==t?this.isLastUserActionGenericError=!0:(this.isLastUserActionGenericError=!1,t=this.cfg.updateParameterFn(e)),this.setCurrentParamUpdateUserAction(t);let s=this.client.screens[i.PARAM_LIST_SCREENID].getButton(i.FINISH_BUTTON_ID);return void 0!==s&&s.setAppearance(this.cfg.isValidFn()?a.EnumAppearance.ENABLED_PRIMARY:a.EnumAppearance.DISABLED),t}handleParamUpdateUserActionGeneric(e){console.log("EditParamsAspect: handleParamUpdateUserActionGeneric");let t=!1,s=this.getCurrentParamUpdateUserAction()
;return s?(this.isLastUserActionGenericError&&e.payload.buttonId===n.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("EditParamsAspect: handleParamUpdateUserActionGeneric - called in state, although no action set"),t}updateMessageBoxFromActionMessageAndShow(e){this.client.showMessageBox(e)}inspectParameter(e){if(this.cfg.getDetailForParameterFn){let t=this.cfg.getDetailForParameterFn(e);this.showDetailParameter(t)}else console.log("Error: Inspect parameter was clicked, but no getDetailForParameterFn was configured in EditParamsAspect")}showDetailParameter(e){let t=new _.ParamDetailsOverlay(this.client.mqttHandler);t.setTitle(e.title.id,e.title.args),
t.setAppearance(a.EnumAppearance.HIDDEN);let s=[];for(const t of e.params){let e=new o.default(this.client.mqttHandler,t);e.publish(),s.push(e.getPublishedId())}t.setParams(s),this.client.showScreen(t)}initPO(){let e=this.client.screens[A.PARAM_OVER_SCREENID];e.readFromParameterGroupArray(this.filterCfgParameterGroups(T.cloneJSON(this.cfg.parameters))),e.getButton(A.SAVE_BUTTON_ID).setAppearance(this.cfg.isValidFn()?a.EnumAppearance.ENABLED_PRIMARY:a.EnumAppearance.DISABLED),e.getButton(A.BACK_BUTTON_ID).setAppearance(a.EnumAppearance.ENABLED_SECONDARY),e.setTitle1(this.cfg.displayParameterOverview.overviewTitle1.id,this.cfg.displayParameterOverview.overviewTitle1.args),e.setTitle2(this.cfg.displayParameterOverview.overviewTitle2.id,this.cfg.displayParameterOverview.overviewTitle2.args),this.client.showScreen(e)}filterCfgParameterGroups(e){for(let t=e.length-1;t>=0;t--){
for(let s=e[t].parameters.length-1;s>=0;s--)e[t].parameters[s].appearance===a.EnumAppearance.HIDDEN&&e[t].parameters.splice(s,1);0===e[t].parameters.length&&e.splice(t,1)}return e}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(4),i=s(5);!function(e){e.DefaultEthernetInterface="DefaultEthernetInterface",e.DefaultRS232Interface="DefaultRS232Interface",e.DefaultUSBInterface="DefaultUSBInterface"}(t.ESerialInterfaceIds||(t.ESerialInterfaceIds={}));t.InterfaceManagementProxy=class extends a.BaseProxy{constructor(){super(...arguments),this.restEndpoint="interfacemanagement"}setGPIOPorts(e){let{pin15:t,pin16:s,pin17:n,pin18:r,pin19:o}=e;return this.body.method=i.RestMethodsINTERFACE_MANAGEMENT.setGPIOPorts,this.body.params={pin15:!!t,pin16:!!s,pin17:!!n,pin18:!!r,pin19:!!o},new a.CubisRestResponse(this.syncRequest())}getQappProtocolPortNumber(e){return this.body.method=i.RestMethodsINTERFACE_MANAGEMENT.getQappProtocolPortNumber,this.body.params={
interfaceId:e},new a.CubisRestResponse(this.syncRequest())}getQappProtocolInterfaces(){return this.body.method=i.RestMethodsINTERFACE_MANAGEMENT.getQappProtocolInterfaces,this.body.params={interfaceId:"",portNumber:-1,name:{}},new a.CubisRestResponse(this.syncRequest())}isAnyInterfaceActive(){let e;return this.body.method=i.RestMethodsINTERFACE_MANAGEMENT.isInterfaceActive,this.body.params={isActive:!1},!!(e=new a.CubisRestResponse(this.syncRequest())).isSuccess()&&e.rawReturns.isActive}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=s(17),i=s(38),n=s(129);function r(e){var t=new Uint8Array(e.byteLength);return t.set(e),t}const o=12;let E,_,l,c,A=!1,u=[],T=[];function d(){if(!A)throw new Error("UserCredentialsStore is not initialized. Call initUserCredentialsStore(baseDir) first.")}function S(e){var t=""+e;return t.length<2?"0"+t:t}function I(){var e=new Date
;return e.getFullYear().toString()+S(e.getMonth()+1)+S(e.getDate())+"-"+S(e.getHours())+S(e.getMinutes())+S(e.getSeconds())}function p(e){try{if(a.existsSync(e)){if(!a.lstatSync(e).isDirectory()){try{a.unlinkSync(e)}catch(s){var t=e+".file."+I()+".bak";try{a.renameSync(e,t)}catch(t){throw new Error('Failed to replace file with directory at "'+e+'": '+t.message)}}a.mkdirSync(e,{recursive:!0})}}else a.mkdirSync(e,{recursive:!0})}catch(t){throw new Error('Failed to ensure storage directory "'+e+'": '+t.message)}}function N(e,t){a.existsSync(e)&&h(e,".oldkey"),a.existsSync(t)&&h(t,".oldstore");var s,i=n.randomBytes(32);c=r(i),a.writeFileSync(e,(s=c,Buffer.from(s)),{mode:384}),T=[],R(t,u=[])}function h(e,t){try{var s=e+"."+I()+t;a.renameSync(e,s)}catch(t){try{a.unlinkSync(e)}catch(t){console.error('Failed to quarantine "'+e+'".',t)}}}function R(e,t){var s=e+".tmp."+process.pid+"."+Math.random().toString(36).slice(2);try{a.writeFileSync(s,JSON.stringify(t,null,2),{encoding:"utf8"}),
a.renameSync(s,e)}catch(t){try{a.existsSync(s)&&a.unlinkSync(s)}catch(e){}throw new Error('Atomic write failed for "'+e+'": '+t.message)}}function m(e,t){var s=r(Buffer.from(t.iv,"base64")),a=Buffer.from(t.tag,"base64"),i=Buffer.from(t.data,"base64"),o=n.createDecipheriv("aes-256-gcm",e,s);return o.setAuthTag(a),Buffer.concat([o.update(i),o.final()]).toString("utf8")}t.initUserCredentialsStore=function(e){if(!e)throw new Error("initUserCredentialsStore: baseDir is required.");E=i.resolve(e),_=i.join(E,"UserCredentials.json"),l=i.join(E,"UserCredentials_master.key"),p(E),c=function(e,t){if(!a.existsSync(e)){var s=n.randomBytes(32),i=r(s);try{a.writeFileSync(e,s,{mode:384})}catch(e){throw new Error("Failed to create master key file: "+e.message)}return i}try{var o=a.readFileSync(e),i=r(o);return 32!==i.byteLength?(console.error("Master key has invalid length; reinitializing key and wiping credentials."),N(e,t),c):i}catch(s){
return console.error("Failed to read master key; reinitializing key and wiping credentials.",s),N(e,t),c}}(l,_);var t=function(e,t){for(var s=[],a=0,i=0;i<e.length;i++){var n=e[i];try{var r=m(t,n.enc);s.push({systemUserId:n.systemUserId,selectedOmnisSystem:n.selectedOmnisSystem,userlogin:n.userlogin,userPassword:r,createdAt:n.createdAt,updatedAt:n.updatedAt})}catch(e){a++,console.error('Decryption failed for entry (user "'+n.userlogin+'", system "'+n.selectedOmnisSystem+'"). Entry will be skipped.',e)}}return{views:s,failures:a,total:e.length}}(u=function(e){if(!a.existsSync(e)){try{a.writeFileSync(e,"[]",{encoding:"utf8"})}catch(e){throw new Error("Failed to create credentials file: "+e.message)}return[]}try{var t=a.readFileSync(e,"utf8"),s=JSON.parse(t);return Array.isArray(s)?s:[]}catch(t){return console.error("Credentials file is invalid JSON; quarantining and recreating a fresh store.",t),h(e,".bad"),R(e,[]),[]}}(_),c)
;t.total>0&&t.failures===t.total?(console.error("initUserCredentialsStore: decryption failed for all entries; reinitializing master key and credentials store."),N(l,_)):T=t.views,A=!0},t.saveUserCredentials=function(e,t,s,a){if(d(),!e||!t)throw new Error("saveUserCredentials: systemUserId and selectedOmnisSystem are required.");var i=(s||"").trim(),l=a||"";if(i&&l){var A,S,I,N,h,m,O=Date.now(),g=u.findIndex(function(s){return s.systemUserId===e&&s.selectedOmnisSystem===t&&s.userlogin===i}),P=(A=c,S=l,I=r(n.randomBytes(o)),N=n.createCipheriv("aes-256-gcm",A,I),h=Buffer.concat([N.update(S,"utf8"),N.final()]),m=N.getAuthTag(),{iv:Buffer.from(I).toString("base64"),tag:m.toString("base64"),data:h.toString("base64")}),M={systemUserId:e,selectedOmnisSystem:t,userlogin:i,enc:P,createdAt:g>=0?u[g].createdAt:O,updatedAt:O};g>=0?u[g]=M:u.push(M);var L=T.findIndex(function(s){return s.systemUserId===e&&s.selectedOmnisSystem===t&&s.userlogin===i}),D=O
;g>=0&&L>=0&&T[L]&&"number"==typeof T[L].createdAt&&(D=T[L].createdAt);var C={systemUserId:e,selectedOmnisSystem:t,userlogin:i,userPassword:l,createdAt:g>=0?D:O,updatedAt:O};L>=0?T[L]=C:T.push(C),p(E),R(_,u)}else console.warn("saveUserCredentials: userlogin or userPassword is empty – nothing saved.")},t.loadUserCredentials=function(e,t){if(d(),!e||!t)throw new Error("loadUserCredentials: systemUserId and selectedOmnisSystem are required.");var s=T.filter(function(s){return s.systemUserId===e&&s.selectedOmnisSystem===t});if(0!==s.length){var a=s.reduce(function(e,t){return e.updatedAt>=t.updatedAt?e:t});return{userLogin:a.userlogin,userPassword:a.userPassword}}},t.deleteUserCredentials=function(e,t){if(d(),!e||!t)throw new Error("deleteUserCredentials: systemUserId and selectedOmnisSystem are required.");var s=u.length;u=u.filter(function(s){return!(s.systemUserId===e&&s.selectedOmnisSystem===t)});var a=T.length;T=T.filter(function(s){
return!(s.systemUserId===e&&s.selectedOmnisSystem===t)});var i=s-u.length>0||a-T.length>0;return i&&(p(E),R(_,u)),i}},function(e,t){e.exports=require("crypto")}]);