var TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi;!function(TcHmi){if(!window.hasOwnProperty("jQuery")||null===jQuery)throw new ReferenceError('Object "jQuery" is missing!');if(!window.hasOwnProperty("$")||null===$)throw new ReferenceError('Object "$" is missing!');if(!window.hasOwnProperty("acorn")||null===acorn)throw new ReferenceError('Object "acorn" is missing!');let flagOverrides=window.localStorage.getItem("TCHMI_FLAG_OVERRIDES");if(TCHMI_FLAG_OVERRIDES=null,flagOverrides)try{TCHMI_FLAG_OVERRIDES=JSON.parse(flagOverrides)}catch(e){}TCHMI_DEBUG_TIME_LOAD_LIBRARY=Date.now(),TCHMI_DYNAMIC_INSTANCE_ID="unset",window.hasOwnProperty("TCHMI_ENGINEERING")||(window.hasOwnProperty("TCHMI_ENABLE_DESIGNER_MODE")?TCHMI_ENGINEERING=TCHMI_ENABLE_DESIGNER_MODE:TCHMI_ENGINEERING=!1),TCHMI_ENABLE_DESIGNER_MODE=TCHMI_ENGINEERING,window.hasOwnProperty("TCHMI_DESIGNER")||(window.hasOwnProperty("TCHMI_ENABLE_DESIGNER_MODE_MASTER")?TCHMI_DESIGNER=TCHMI_ENABLE_DESIGNER_MODE_MASTER:TCHMI_DESIGNER=!1),TCHMI_ENABLE_DESIGNER_MODE_MASTER=TCHMI_DESIGNER,window.hasOwnProperty("TCHMI_LIVEVIEW")||(window.hasOwnProperty("TCHMI_ENABLE_DESIGNER_MODE_SLAVE")?TCHMI_LIVEVIEW=TCHMI_ENABLE_DESIGNER_MODE_SLAVE:TCHMI_LIVEVIEW=!1),TCHMI_ENABLE_DESIGNER_MODE_SLAVE=TCHMI_LIVEVIEW,window.hasOwnProperty("TCHMI_RUNTIME")||(TCHMI_ENGINEERING?TCHMI_RUNTIME=!1:TCHMI_RUNTIME=!0),window.hasOwnProperty("TCHMI_TARGET_PARTIAL")?TCHMI_TARGET_PARTIAL=tchmi_path(TCHMI_TARGET_PARTIAL):window.hasOwnProperty("TCHMI_ENABLE_DESIGNER_MODE_TARGET_PARTIAL")?TCHMI_TARGET_PARTIAL=tchmi_path(TCHMI_ENABLE_DESIGNER_MODE_TARGET_PARTIAL):TCHMI_TARGET_PARTIAL="",TCHMI_ENABLE_DESIGNER_MODE_TARGET_PARTIAL=TCHMI_TARGET_PARTIAL,window.hasOwnProperty("TCHMI_CONFIG_OVERRIDE")||(window.hasOwnProperty("TCHMI_ENABLE_DESIGNER_MODE_FALLBACK_CONFIG_JSON")?TCHMI_CONFIG_OVERRIDE=TCHMI_ENABLE_DESIGNER_MODE_FALLBACK_CONFIG_JSON:TCHMI_CONFIG_OVERRIDE=null),TCHMI_ENABLE_DESIGNER_MODE_FALLBACK_CONFIG_JSON=TCHMI_CONFIG_OVERRIDE,window.hasOwnProperty("TCHMI_ENGINEERING_WEBSOCKET")||(window.hasOwnProperty("TCHMI_ENABLE_DESIGNER_MODE_WEBSOCKET_URL")?TCHMI_ENGINEERING_WEBSOCKET=TCHMI_ENABLE_DESIGNER_MODE_WEBSOCKET_URL:TCHMI_ENGINEERING_WEBSOCKET=""),TCHMI_ENABLE_DESIGNER_MODE_WEBSOCKET_URL=TCHMI_ENGINEERING_WEBSOCKET,window.hasOwnProperty("TCHMI_CONSOLE_LOG_LEVEL")||(TCHMI_CONSOLE_LOG_LEVEL=0),TCHMI_FLAG_OVERRIDES&&void 0!==TCHMI_FLAG_OVERRIDES.TCHMI_CONSOLE_LOG_LEVEL&&null!==TCHMI_FLAG_OVERRIDES.TCHMI_CONSOLE_LOG_LEVEL&&(TCHMI_CONSOLE_LOG_LEVEL=TCHMI_FLAG_OVERRIDES.TCHMI_CONSOLE_LOG_LEVEL),window.hasOwnProperty("TCHMI_CONSOLE_LOG_PERSISTENT")||(TCHMI_CONSOLE_LOG_PERSISTENT=!1),TCHMI_FLAG_OVERRIDES&&void 0!==TCHMI_FLAG_OVERRIDES.TCHMI_CONSOLE_LOG_PERSISTENT&&null!==TCHMI_FLAG_OVERRIDES.TCHMI_CONSOLE_LOG_PERSISTENT&&(TCHMI_CONSOLE_LOG_PERSISTENT=TCHMI_FLAG_OVERRIDES.TCHMI_CONSOLE_LOG_PERSISTENT),window.hasOwnProperty("TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES")||(TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES=2e4),TCHMI_FLAG_OVERRIDES&&void 0!==TCHMI_FLAG_OVERRIDES.TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES&&null!==TCHMI_FLAG_OVERRIDES.TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES&&(TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES=TCHMI_FLAG_OVERRIDES.TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES),window.hasOwnProperty("TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES")||(TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES=!1),TCHMI_FLAG_OVERRIDES&&void 0!==TCHMI_FLAG_OVERRIDES.TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES&&null!==TCHMI_FLAG_OVERRIDES.TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES&&(TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES=TCHMI_FLAG_OVERRIDES.TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES),window.hasOwnProperty("TCHMI_CONSOLE_LOG_ENGINEERING_COM_MESSAGES")||(window.hasOwnProperty("TCHMI_CONSOLE_LOG_DESIGNER_MODE_COM_MESSAGES")?TCHMI_CONSOLE_LOG_ENGINEERING_COM_MESSAGES=TCHMI_CONSOLE_LOG_DESIGNER_MODE_COM_MESSAGES:TCHMI_CONSOLE_LOG_ENGINEERING_COM_MESSAGES=!1),TCHMI_CONSOLE_LOG_DESIGNER_MODE_COM_MESSAGES=TCHMI_CONSOLE_LOG_ENGINEERING_COM_MESSAGES,window.hasOwnProperty("TCHMI_NUGET_METADATA")||(TCHMI_NUGET_METADATA={}),window.hasOwnProperty("TCHMI_UNITTEST_MODE")||(TCHMI_UNITTEST_MODE=!1),window.hasOwnProperty("TCHMI_BENCHMARK_MODE")||(TCHMI_BENCHMARK_MODE=!1),TCHMI_EVENT_OPTION_OBJECT_SUPPORTED=!0,window.hasOwnProperty("TCHMI_SERVER_STATE_WATCH_INTERVAL")&&"number"==typeof TCHMI_SERVER_STATE_WATCH_INTERVAL||(TCHMI_SERVER_STATE_WATCH_INTERVAL=1e3),window.hasOwnProperty("TCHMI_DIAGNOSTICS_SERVER")&&"boolean"==typeof TCHMI_DIAGNOSTICS_SERVER||(TCHMI_DIAGNOSTICS_SERVER=!1),window.hasOwnProperty("TCHMI_DIAGNOSTICS_SERVER_REQUEST_HISTORY_MAX_BUFFER")&&"number"==typeof TCHMI_DIAGNOSTICS_SERVER_REQUEST_HISTORY_MAX_BUFFER||(TCHMI_DIAGNOSTICS_SERVER_REQUEST_HISTORY_MAX_BUFFER=500),window.hasOwnProperty("TCHMI_DIAGNOSTICS_SERVER_REQUEST_RESPONSE_HISTORY_MAX_BUFFER")&&"number"==typeof TCHMI_DIAGNOSTICS_SERVER_REQUEST_RESPONSE_HISTORY_MAX_BUFFER||(TCHMI_DIAGNOSTICS_SERVER_REQUEST_RESPONSE_HISTORY_MAX_BUFFER=10),window.hasOwnProperty("TCHMI_DIAGNOSTICS_SERVER_REQUEST_RESPONSE_HISTORY_MESSAGES")&&"boolean"==typeof TCHMI_DIAGNOSTICS_SERVER_REQUEST_RESPONSE_HISTORY_MESSAGES||(TCHMI_DIAGNOSTICS_SERVER_REQUEST_RESPONSE_HISTORY_MESSAGES=!1)}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.Config=
/**
     * Provides resources for accessing configuration data.
     * @preserve (Part of the public API)
     */
class{
/**
         * Returns a copy of the current object which is constructed from tchmiconfig.json
         * @preserve (Part of the public API)
         */
static get(){return tchmi_clone_object(TcHmi.System.config)}
/**
         * Returns a Dictionary with all nuget packages of the project.
         * Key is the Nuget ID.
         * @preserve (Part of the public API)
         */static getNugetPackagesMetadata(){return tchmi_clone_object(TcHmi.System.nugetPackagesMetadata)}}}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.Access=
/**
     * Provides functions for checking rights.
     * @preserve (Part of the public API)
     */
class{
/**
         * Checks if an right is allowed for the current user on this control or its parents
         * Rules for granting access:
         *      - Designer Mode Master => true
         *      - Server Auth is not restricted (IsAuthRequired == false in Server) => TRUE
         *      - Server Auth is not known right now => null
         *      - Server Auth loading error => false
         *      - On this control: 1 Group  has  ALLOW => TRUE
         *      - On this control: 0 Groups have ALLOW, but 1 Group has DENY => FALSE
         *      - On this control: 0 Groups have ALLOW, 0 Groups have DENY => Ask Parent
         *      - use control default of the bottom most control with this right. TcHmi.Controls.System.TcHmiView has operate/observe set to TRUE
         *      - control has no parent (detached control) => null
         * @param control Control to check
         * @param requestedAccessright name of the access right
         * @returns Returns true/false or null if the state is not known right now
         * @preserve (Part of the public API)
         */
static checkAccess(control,requestedAccessright){return control instanceof TcHmi.Controls.System.baseTcHmiControl!=!1&&(!TcHmi.System.isParameterTypeInvalid(requestedAccessright,"requestedAccessright",{type:"string",required:"valueNeeded",minStringLength:1})&&(TcHmi.System.Services.accessManager?TcHmi.System.Services.accessManager.checkAccess(control,requestedAccessright):null))}static setControlRightOverride(control,accessrightToOverride,forcedRight){return control instanceof TcHmi.Controls.System.baseTcHmiControl!=!1&&(!TcHmi.System.isParameterTypeInvalid(accessrightToOverride,"accessrightToForce",{type:"string",required:"valueNeeded",minStringLength:1})&&(("Deny"===forcedRight||null===forcedRight)&&(!!TcHmi.System.Services.accessManager&&(TcHmi.System.Services.accessManager.setControlRightOverride(control,accessrightToOverride,forcedRight),!0))))}static getControlRightOverrides(control){return tchmi_clone_object(TcHmi.System.Services.accessManager?.getControlRightOverrides(control)??new Set,{cloneSets:{deepCloneValues:!1}})}}}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.AnimationProvider=class{
/**
         * Deprecated. Please use new TcHmi.Animation()
         * Creates a new animation
         * @param controlName The name of the control for which the animation is intendend.
         * @param selector A CSS selector to identify the element inside the control to animate.
         * @preserve (Part of the public API)
         * @deprecated Please use new TcHmi.Animation()
         */
static create(controlName,selector=""){return new Animation(controlName,selector)}};class Animation{
/**
         * Creates a new animation
         * @param controlName The name of the control for which the animation is intendend.
         * @param selector A CSS selector to identify the element inside the control to animate.
         * @preserve (Part of the public API)
         */
constructor(controlName,selector=""){this.__keyframes=[],this.__duration=0,this.__delay=0,this.__iterationCount=1,this.__direction="normal",this.__timingFunction="ease",this.__fillMode="none",this.__cleanup=!1,this.__useCss=!0,this.__eventHandlers=[],this.__state=Animation.Status.CONFIGURE,this.__stateUpdater=status=>{this.__state=status},this.__animationController=null,this.__controlName=controlName,this.__selector=selector,this.__animationName=`anim-${tchmi_create_guid()}`}
/**
         * Returns the name of the control the animation is intended for.
         * @returns The name of the control.
         * @preserve (Part of the public API)
         */controlName(){return this.__controlName}
/**
         * Returns the selector of the element to animate.
         * @returns The selector.
         * @preserve (Part of the public API)
         */selector(){return this.__selector}
/**
         * Returns the name of the animation.
         * @returns The name of the animation.
         * @preserve (Part of the public API)
         */animationName(){return this.__animationName}
/**
         * Returns the state of the animation.
         * @returns The state.
         * @preserve (Part of the public API)
         */state(){return this.__state}addKeyframe(keyframeOrStylesOrProperty,valueOrProgressPoint,progressPoint){if(!this.__configAllowed())return this;if(1===arguments.length){if(keyframeOrStylesOrProperty.progressPoint<0||keyframeOrStylesOrProperty.progressPoint>1)throw new Error("Argument out of range: progressPoint must be between 0 and 1 inclusive.");this.__keyframes.push(keyframeOrStylesOrProperty)}else if(2===arguments.length&&"number"==typeof valueOrProgressPoint){if(valueOrProgressPoint<0||valueOrProgressPoint>1)throw new Error("Argument out of range: progressPoint must be between 0 and 1 inclusive.");let keyframe={styles:{},progressPoint:valueOrProgressPoint};for(let key in keyframeOrStylesOrProperty)keyframeOrStylesOrProperty.hasOwnProperty(key)&&("string"==typeof keyframeOrStylesOrProperty[key]?keyframe.styles[key]=[keyframeOrStylesOrProperty[key]]:keyframe.styles[key]=keyframeOrStylesOrProperty[key]);this.__keyframes.push(keyframe)}else if("string"==typeof keyframeOrStylesOrProperty&&("string"==typeof valueOrProgressPoint||Array.isArray(valueOrProgressPoint))){if(void 0===progressPoint||progressPoint<0||progressPoint>1)throw new Error("Argument out of range: progressPoint must be between 0 and 1 inclusive.");let keyframe={styles:{},progressPoint:progressPoint};keyframe.styles[keyframeOrStylesOrProperty]="string"==typeof valueOrProgressPoint?[valueOrProgressPoint]:valueOrProgressPoint,this.__keyframes.push(keyframe)}return this}
/**
         * Removes all keyframes.
         * @preserve (Part of the public API)
         */clearKeyframes(){return this.__configAllowed()?(this.__keyframes=[],this):this}
/**
         * Reverses the keyframes by subtracting the progressPoint from 1 and setting that as the new progressPoint.
         * @preserve (Part of the public API)
         */reverseKeyframes(){return this.__keyframes.forEach((keyframe=>{keyframe.progressPoint=1-keyframe.progressPoint})),this}
/**
         * Gets the keyframes of this animation.
         * @returns The keyframes.
         * @preserve (Part of the public API)
         */keyframes(){return this.__keyframes}duration(valueNew){return void 0===valueNew?this.__duration:this.__configAllowed()?(this.__duration=null===valueNew?0:valueNew,this):this}delay(valueNew){return void 0===valueNew?this.__delay:this.__configAllowed()?(this.__delay=null===valueNew?0:valueNew,this):this}iterationCount(valueNew){return void 0===valueNew?this.__iterationCount:this.__configAllowed()?(this.__iterationCount=null===valueNew?1:valueNew,this):this}direction(valueNew){return void 0===valueNew?this.__direction:this.__configAllowed()?(this.__direction=null===valueNew?"normal":valueNew,this):this}timingFunction(valueNew){return void 0===valueNew?this.__timingFunction:this.__configAllowed()?(this.__timingFunction=null===valueNew?"ease":valueNew,this):this}fillMode(valueNew){return void 0===valueNew?this.__fillMode:this.__configAllowed()?(this.__fillMode=null===valueNew?"none":valueNew,this):this}cleanup(valueNew){return void 0===valueNew?this.__cleanup:(this.__cleanup=null!==valueNew&&valueNew,this.__state===Animation.Status.ENDED&&null!==this.__animationController&&this.__animationController.cleanup(),this)}useCss(valueNew){return void 0===valueNew?this.__canUseCss()&&this.__useCss:this.__configAllowed()?(this.__useCss=null===valueNew||valueNew,this):this}
/**
         * Registers an event handler for one of the events animationstart, animationend or animationiteration.
         * @param name The name of the event.
         * @param callback The callback function.
         * @preserve (Part of the public API)
         */registerEventHandler(name,callback){return this.__eventHandlers.push({name:name,callback:callback}),this}
/**
         * Unregisters a previously registered event handler.
         * @param name The name of the event.
         * @param callback The callback function to unregister.
         * @preserve (Part of the public API)
         */unregisterEventHandler(name,callback){return this.__eventHandlers=this.__eventHandlers.filter((handler=>!(handler.name===name&&(void 0===callback||handler.callback===callback)))),this}
/**
         * Gets all event handlers
         * @returns The event handlers.
         * @preserve (Part of the public API)
         */eventHandlers(){return this.__eventHandlers}
/**
         * Run the animation.
         * @preserve (Part of the public API)
         */run(){return 0===this.__keyframes.length?(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Animation] This animation has no keyframes defined."),this):0===this.__keyframes.filter((keyframe=>0===keyframe.progressPoint)).length?(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Animation] This animation has no start keyframe with progressPoint 0 defined."),this):0===this.__keyframes.filter((keyframe=>1===keyframe.progressPoint)).length?(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Animation] This animation has no end keyframe with progressPoint 1 defined."),this):TcHmi.System.Services.animationProvider?(null!==this.__animationController&&this.__animationController.isValid()||(this.__animationController=TcHmi.System.Services.animationProvider.createAnimationController(this,this.__stateUpdater)),this.__animationController.run(),this):(TcHmi.Log.error("[Source=Framework, Module=TcHmi.Animation] System not ready."),this)}
/**
         * Pause the animation.
         * @preserve (Part of the public API)
         */pause(){return null!==this.__animationController&&this.__animationController.pause(),this}
/**
         * Cancels the animation and writes the last keyframe styles into the element CSS.
         * @preserve (Part of the public API)
         */skip(){return null!==this.__animationController&&this.__animationController.skip(),this}
/**
         * Resets the animation. This is an asynchronous operation.
         * @param callback The function to call when the animation has been reset.
         * @preserve (Part of the public API)
         */reset(callback){return null!==this.__animationController&&this.__animationController.reset(callback),this}__canUseCss(){return"string"==typeof this.__timingFunction}__configAllowed(){return this.__state===Animation.Status.CONFIGURE||this.__state===Animation.Status.ENDED||(TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.Animation] Configuring an animation is only allowed when it has the state CONFIGURE or ENDED."),!1)}}TcHmi.Animation=Animation,function(Animation){let Status;!function(Status){Status[Status.CONFIGURE=0]="CONFIGURE",Status[Status.INITIALIZED=1]="INITIALIZED",Status[Status.RUNNING=2]="RUNNING",Status[Status.PAUSED=3]="PAUSED",Status[Status.ENDED=4]="ENDED"}(Status=Animation.Status||(Animation.Status={}))}(Animation=TcHmi.Animation||(TcHmi.Animation={}))}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.Base64BinaryReader=
/**
     * Provides methods to read base64 encoded data.
     * @preserve (Part of the public API)
     */
class{
/**
         * Creates a new Base64BinaryReader.
         * This constructor throws an exception if the data is not valid base64.
         * @param data The base64 encoded string to read from.
         * @param endianness Whether the encoded data uses little endian (default) or big endian to store numbers.
         * @preserve (Part of the public API)
         */
constructor(data,endianness=TcHmi.Endianness.LittleEndian){this.__offset=0,this.__stringEncodings={"UTF-8":{decode:(bytes,endianness)=>{let codePoints=[];for(let i=0,byteLength=bytes.length;i<byteLength;i++){let byte=bytes[i];if(0===byte)return{codePoints:codePoints,byteCount:i+1};if(byte<=127)codePoints.push(byte);else if(byte>=194&&byte<=244){let followBytes=1,firstByteMask=31,mask=32;for(;mask>0;)(byte&mask)>0?(followBytes++,firstByteMask>>>=1,mask>>>=1):mask=0;let codePoint=byte&firstByteMask,lastByteIndex=i+followBytes;if(lastByteIndex>=byteLength)codePoint=65533;else for(;i<lastByteIndex;){i++;let byte=bytes[i];if(byte<128||byte>191){codePoint=65533,i--;break}codePoint=codePoint<=67108863?(codePoint<<6|63&byte)>>>0:codePoint*Math.pow(2,6)+(63&byte)}codePoints.push(codePoint)}else codePoints.push(65533)}return{codePoints:codePoints,byteCount:bytes.length}}}};let decoded=tchmi_base64decode(data);if(null===decoded)throw new Error(`Could not decode string "${data}" as base64.`);this.__data=[];for(let i=0,ii=decoded.length;i<ii;i++)this.__data.push(decoded.charCodeAt(i));this.__endianness=endianness}__getChunk(length){if(this.__offset+length>this.__data.length)throw new RangeError(`Trying to read ${length} bytes from offset ${this.__offset} exceeds the length of the data.`);let chunk=this.__data.slice(this.__offset,this.__offset+length);return this.__offset+=length,this.__endianness===TcHmi.Endianness.BigEndian&&(chunk=chunk.reverse()),chunk}__readInteger(lengthInBytes,signed){let chunk=this.__getChunk(lengthInBytes),result=0;for(let i=0,ii=chunk.length;i<ii;i++){let byte=255&chunk[i];i<4?result=(result|byte<<8*i)>>>0:result+=byte*Math.pow(256,i)}if(signed){let mask=Math.pow(2,8*lengthInBytes-1);lengthInBytes<=4?result=(result&~mask)-((result&mask)>>>0):128==(128&chunk[chunk.length-1])&&(result-=2*mask)}return result}__readBigInteger(lengthInBytes,signed){let chunk=this.__getChunk(lengthInBytes),result=0n;for(let i=0,ii=chunk.length;i<ii;i++){let byte=0xffn&BigInt(chunk[i]);result=BigInt.asUintN(8*lengthInBytes,result|byte<<8n*BigInt(i))}if(signed){let mask=BigInt(2n**(8n*BigInt(lengthInBytes)-1n));lengthInBytes<=4?result=-BigInt.asUintN(8,result&mask)+(result&~mask):128==(128&chunk[chunk.length-1])&&(result-=2n*mask),result=BigInt.asIntN(8*lengthInBytes,result)}else result=BigInt.asUintN(8*lengthInBytes,result);return result}__readFloatingPointNumber(lengthInBytes){let chunk=this.__getChunk(lengthInBytes),exponentBits=8,significandBits=23;switch(lengthInBytes){case 4:exponentBits=8,significandBits=23;break;case 8:exponentBits=11,significandBits=52}let bias=Math.pow(2,exponentBits-1)-1,parts=[{value:0,bitsToRead:significandBits},{value:0,bitsToRead:exponentBits},{value:0,bitsToRead:1}],partIndex=0,shift=0;for(let i=0;i<lengthInBytes||parts[partIndex].bitsToRead<0;i++){let carryOver=0;parts[partIndex].bitsToRead<0?(carryOver=8+parts[partIndex].bitsToRead,i--,partIndex++,shift=0):0===parts[partIndex].bitsToRead&&(partIndex++,shift=0);let byte=(255&chunk[i])>>>carryOver;parts[partIndex].bitsToRead<8&&(byte&=Math.pow(2,parts[partIndex].bitsToRead)-1),shift<=24?parts[partIndex].value=(parts[partIndex].value|byte<<shift)>>>0:parts[partIndex].value+=byte*Math.pow(2,shift),shift+=8-carryOver,parts[partIndex].bitsToRead-=8-carryOver}let significand=parts[0].value,exponent=parts[1].value,sign=parts[2].value;return exponent===Math.pow(2,exponentBits)-1?significand>0?NaN:1/0*(1===sign?-1:1):0===exponent&&0===significand?0*(1===sign?-1:1):0===exponent?(1===sign?-1:1)*significand*Math.pow(2,1-bias-significandBits):(1===sign?-1:1)*(1+significand/Math.pow(2,significandBits))*Math.pow(2,exponent-bias)}
/**
         * Reads a boolean value.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readBoolean(){return 0!==this.__readInteger(1,!1)}
/**
         * Reads a single byte of data.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readByte(){return this.__readInteger(1,!1)}
/**
         * Reads a signed byte.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readSByte(){return this.__readInteger(1,!0)}
/**
         * Reads a signed 16-bit integer.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readInt16(){return this.__readInteger(2,!0)}
/**
         * Reads an unsigned 16-bit integer.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readUInt16(){return this.__readInteger(2,!1)}
/**
         * Reads a signed 32-bit integer.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readInt32(){return this.__readInteger(4,!0)}
/**
         * Reads an unsigned 32-bit integer.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readUInt32(){return this.__readInteger(4,!1)}
/**
         * Reads a signed 64-bit integer.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readInt64(){return this.__readBigInteger(8,!0)}
/**
         * Reads an unsigned 64-bit integer.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readUInt64(){return this.__readBigInteger(8,!1)}
/**
         * Reads a single precision floating point number.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readFloat(){return this.__readFloatingPointNumber(4)}
/**
         * Reads a double precision floating point number.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readDouble(){return this.__readFloatingPointNumber(8)}
/**
         * Reads a string. Will read until a zero byte is encountered, or until the specified length has been reached, or, if no length has been specified, until the end of the data.
         * This function throws an exception if length is negative or reading the number of bytes specified by length from the current offset position would exceed the length of the available data.
         * @param length The length of the string to read in bytes.
         * @preserve (Part of the public API)
         */readString(length){let stringBytes;if(void 0!==length){if(length<0)throw new RangeError("Length of the string to read must be positive.");if(this.__offset+length>this.__data.length)throw new RangeError(`Trying to read ${length} bytes from offset ${this.__offset} exceeds the length of the data.`);stringBytes=this.__data.slice(this.__offset,this.__offset+length)}else stringBytes=this.__data.slice(this.__offset);let result=this.__stringEncodings["UTF-8"].decode(stringBytes,this.__endianness);return this.__offset+=void 0!==length?length:result.byteCount,this.__getStringFromCodePoints(result.codePoints)}__getStringFromCodePoints(codePoints){let codeUnits=[];for(let i=0,ii=codePoints.length;i<ii;i++){let codePoint=codePoints[i];if(codePoint<=65535)codeUnits.push(codePoint);else{codePoint-=65536;let highSurrogate=55296+(codePoint>>10),lowSurrogate=codePoint%1024+56320;codeUnits.push(highSurrogate,lowSurrogate)}}return String.fromCharCode(...codeUnits)}
/**
         * Returns the length of the data in bytes.
         * @preserve (Part of the public API)
         */getLength(){return this.__data.length}
/**
         * Returns the current position of the read pointer.
         * @preserve (Part of the public API)
         */getOffset(){return this.__offset}
/**
         * Sets the position of the read pointer.
         * @param offset The new position of the read pointer.
         * @preserve (Part of the public API)
         */setOffset(offset){this.__offset=Math.floor(offset)}}}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.Base64BinaryWriter=
/**
     * Provides methods to write base64 encoded data.
     * @preserve (Part of the public API)
     */
class{
/**
         * Creates a new Base64BinaryWriter.
         * @param endianness Whether to use little endian (default) or big endian when encoding numbers.
         * @param length The desired length of the data. If this parameter is omitted the data will be expanded dynamically.
         * @preserve (Part of the public API)
         */
constructor(endianness=TcHmi.Endianness.LittleEndian,length){this.__data=[],this.__stringEncodings={"UTF-8":{encode:(codePoints,endianness)=>{let bytes=[];for(let i=0,ii=codePoints.length;i<ii;i++){let codePoint=codePoints[i];if(codePoint<=127)bytes.push(codePoint);else{let cpBytes=[],firstByteTemplate=192,firstByteMask=31,followByteTemplate=128,followByteMask=63;for(;codePoint>0&&cpBytes.length<=6;)cpBytes.push(followByteTemplate|codePoint&followByteMask),codePoint<=4294967295?codePoint>>>=6:codePoint=Math.floor(codePoint/Math.pow(2,6)),codePoint<=firstByteMask?(cpBytes.push(firstByteTemplate|codePoint&firstByteMask),codePoint=0):(firstByteTemplate=followByteTemplate|firstByteTemplate>>>1,firstByteMask>>>=1);bytes=bytes.concat(cpBytes.reverse())}}return bytes}}},this.__endianness=endianness,this.__length=void 0!==length?length:1/0}__addChunk(chunk){if(this.__data.length+chunk.length>this.__length)throw new RangeError(`Trying to write ${chunk.length} bytes exceeds the length of the data.`);this.__endianness===TcHmi.Endianness.BigEndian&&(chunk=chunk.reverse()),this.__data=this.__data.concat(chunk)}__checkIntegerBounds(value,lengthInBytes,signed){if(value%1!=0)return!1;let range=Math.pow(2,8*lengthInBytes)-1,lowerBound=signed?-Math.ceil(range/2):0;return value>=lowerBound&&value<=range+lowerBound}__checkBigIntegerBounds(value,lengthInBytes,signed){if(signed){if(BigInt.asIntN(8*lengthInBytes,value)===value)return!0}else{if(BigInt.asUintN(8*lengthInBytes,value)===value)return!0}return!1}__writeInteger(value,lengthInBytes){let chunk=[];for(let i=0;i<lengthInBytes;i++)chunk.push(255&value),lengthInBytes-i<=4?value>>>=8:value=Math.floor(value/256);this.__addChunk(chunk)}__writeBigInteger(value,lengthInBytes){let chunk=[];for(let i=0;i<lengthInBytes;i++)chunk.push(Number(0xffn&value)),value=BigInt.asUintN(8*lengthInBytes,value)>>8n;this.__addChunk(chunk)}__writeFloatingPointNumber(value,lengthInBytes){let exponentBits,significandBits;switch(lengthInBytes){case 4:exponentBits=8,significandBits=23;break;case 8:exponentBits=11,significandBits=52}let exponent,significand,bias=Math.pow(2,exponentBits-1)-1,sign=value<0?1:0;if(isFinite(value))if(0===value)sign=1/value==-1/0?1:0,exponent=0,significand=0;else{value=Math.abs(value);let preComma=Math.floor(value),postComma=value-preComma,preCommaLength=0,num=preComma;for(;num>0;)preCommaLength++,num<=4294967295?num>>>=1:num=Math.floor(num/2);significand=preComma>0?preComma-Math.pow(2,preCommaLength-1):0;let significandLength=preCommaLength>0?preCommaLength-1:0;significandLength>significandBits&&(significand<=4294967295?significand>>>=significandLength-significandBits:significand=Math.floor(significand/Math.pow(2,significandLength-significandBits)),significandLength=significandBits);let postCommaIndexOfOne=-1;num=postComma;let i=0;for(;significandLength<significandBits;){num*=2;let bit=num>=1?1:0;i>=bias-1&&-1===postCommaIndexOfOne&&(postCommaIndexOfOne=i),bit&&(num--,-1===postCommaIndexOfOne&&(postCommaIndexOfOne=i,0===preCommaLength))?i++:(significand=significandLength<32?(significand<<1|bit)>>>0:2*significand+bit,(preCommaLength>0||postCommaIndexOfOne>-1||0===postComma)&&significandLength++,i++)}exponent=preCommaLength>0?preCommaLength-1:-postCommaIndexOfOne-1,exponent+=bias;let maxExponentValue=Math.pow(2,exponentBits)-1;exponent<1?exponent=0:exponent>maxExponentValue-1&&(exponent=maxExponentValue,significand=0)}else{exponent=0;for(let i=0;i<exponentBits;i++)exponent=exponent<<1|1;significand=isNaN(value)?1:0}let parts=[{value:significand,length:significandBits},{value:exponent,length:exponentBits},{value:sign,length:1}],chunk=[],partIndex=0;for(let i=0;i<lengthInBytes||parts[partIndex].length<0;i++){let carryBack=0;parts[partIndex].length<0?(carryBack=8+parts[partIndex].length,i--,partIndex++):0===parts[partIndex].length&&partIndex++,void 0===chunk[i]&&(chunk[i]=0),chunk[i]|=parts[partIndex].value<<carryBack&255,parts[partIndex].length<=32?parts[partIndex].value=parts[partIndex].value>>>8-carryBack:parts[partIndex].value=Math.floor(parts[partIndex].value/Math.pow(2,8-carryBack)),parts[partIndex].length-=8-carryBack}this.__addChunk(chunk)}
/**
         * Writes a boolean value.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The boolean value to write.
         * @preserve (Part of the public API)
         */writeBoolean(value){return this.writeByte(value?1:0),this}
/**
         * Writes a single byte of data.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The byte to write.
         * @preserve (Part of the public API)
         */writeByte(value){if(!this.__checkIntegerBounds(value,1,!1))throw new RangeError(`The value ${value} does not fit into a byte.`);return this.__writeInteger(value,1),this}
/**
         * Writes a signed byte.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The byte to write.
         * @preserve (Part of the public API)
         */writeSByte(value){if(!this.__checkIntegerBounds(value,1,!0))throw new RangeError(`The value ${value} does not fit into a signed byte.`);return this.__writeInteger(value,1),this}
/**
         * Writes a signed 16-bit integer.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The number to write.
         * @preserve (Part of the public API)
         */writeInt16(value){if(!this.__checkIntegerBounds(value,2,!0))throw new RangeError(`The value ${value} does not fit into an int16.`);return this.__writeInteger(value,2),this}
/**
         * Writes an unsigned 16-bit integer.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The number to write.
         * @preserve (Part of the public API)
         */writeUInt16(value){if(!this.__checkIntegerBounds(value,2,!1))throw new RangeError(`The value ${value} does not fit into an uint16.`);return this.__writeInteger(value,2),this}
/**
         * Writes a signed 32-bit integer.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The number to write.
         * @preserve (Part of the public API)
         */writeInt32(value){if(!this.__checkIntegerBounds(value,4,!0))throw new RangeError(`The value ${value} does not fit into a int32.`);return this.__writeInteger(value,4),this}
/**
         * Writes an unsigned 32-bit integer.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The number to write.
         * @preserve (Part of the public API)
         */writeUInt32(value){if(!this.__checkIntegerBounds(value,4,!1))throw new RangeError(`The value ${value} does not fit into an uint32.`);return this.__writeInteger(value,4),this}
/**
         * Writes a signed 64-bit integer.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The number to write.
         * @preserve (Part of the public API)
         */writeInt64(value){if(!this.__checkBigIntegerBounds(value,8,!0))throw new RangeError(`The value ${value} does not fit into a int64.`);return this.__writeBigInteger(value,8),this}
/**
         * Writes an unsigned 64-bit integer.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The number to write.
         * @preserve (Part of the public API)
         */writeUInt64(value){if(!this.__checkBigIntegerBounds(value,8,!1))throw new RangeError(`The value ${value} does not fit into a uint64.`);return this.__writeBigInteger(value,8),this}
/**
         * Writes a single precision floating point number.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The number to write.
         * @preserve (Part of the public API)
         */writeFloat(value){return this.__writeFloatingPointNumber(value,4),this}
/**
         * Writes a double precision floating point number.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The number to write.
         * @preserve (Part of the public API)
         */writeDouble(value){return this.__writeFloatingPointNumber(value,8),this}
/**
         * Writes a string.
         * This function throws an exception if the provided value does not fit into the given length or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The string to write.
         * @param length (Optional) The length of the string to write. If the string is shorter, the remaining space is filled with 0.
         * @preserve (Part of the public API)
         */writeString(value,length){let bytes=this.__stringEncodings["UTF-8"].encode(this.__getCodePointsFromString(value),this.__endianness);if(void 0!==length){for(;bytes.length<length;)bytes.push(0);if(bytes.length>length)throw new RangeError("The specified string does not fit into the specified length.")}if(this.__data.length+bytes.length>this.__length)throw new RangeError(`Trying to write ${bytes.length} bytes exceeds the length of the data.`);return this.__data=this.__data.concat(bytes),this}__getCodePointsFromString(value){let codePoints=[];for(let i=0,ii=value.length;i<ii;i++){let first=value.charCodeAt(i);if(first>=55296&&first<=56319&&i<ii-1){let second=value.charCodeAt(i+1);second>=56320&&second<=57343?(codePoints.push(1024*(first-55296)+second-56320+65536),i++):codePoints.push(first)}else codePoints.push(first)}return codePoints}
/**
         * Returns the base64 encoded string. If not enough data was written to fill the length the data should have, the rest is filled up with zeros.
         * @preserve (Part of the public API)
         */getEncodedString(){const length=this.__data.length;if(isFinite(this.__length)&&this.__data.length<this.__length){const start=this.__data.length;this.__data.length=this.__length,this.__data.fill(0,start)}const rawChunks=[];for(let i=0;i<this.__data.length;i+=1e4)rawChunks.push(String.fromCharCode(...this.__data.slice(i,i+1e4)));return this.__data.length=length,tchmi_base64encode(rawChunks.join(""))}
/**
         * Returns the length of the data that has been written.
         * @preserve (Part of the public API)
         */getLength(){return this.__data.length}}}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * Provides functions for creating and removing bindings.
     * @preserve (Part of the public API)
     */
class Binding{static __getFuncName(fn,control){let res=null,current=control;do{const propertyNames=Object.getOwnPropertyNames(current);for(const propertyName of propertyNames)if("arguments"!==propertyName&&"caller"!==propertyName&&current[propertyName]===fn){res=propertyName;break}}while(current=Object.getPrototypeOf(current));return res}
/**
         * Creates a binding between a symbol and a control attribute setter function.
         * @param expression The target symbol expression.
         * @param fn The target function as prototype reference.
         * @param control The target control instance.
         * @preserve (Part of the public API)
         */static create(expression,fn,control){const fnName=Binding.__getFuncName(fn,control);null!==fnName&&Binding.createEx(expression,fnName,control)}
/**
         * Creates a binding between a symbol and a control attribute setter function by name.
         * @param expression The target symbol expression.
         * @param fn The name of the control setter function.
         * @param control The target control instance.
         * @preserve (Part of the public API)
         */static createEx(expression,fn,control){if(!TcHmi.System.Services.controlManager||!TcHmi.System.Services.bindingManager)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] Creating binding at control "+control.getId()+" failed. System not ready."));const attr=TcHmi.System.Services.controlManager.getAttributeByPropertySetterName(control,fn);attr?TcHmi.System.Services.bindingManager.createBinding(expression,attr.propertyName,control):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] The attribute with the setter "+fn+" is not included in the description.json of "+control.getType()+". Creating a binding with this attribute failed.")}
/**
         * Creates a binding between a symbol and a control attribute setter function by name of property.
         * @param expression The target symbol expression.
         * @param propertyName The name of the control property.
         * @param control The target control instance.
         * @preserve (Part of the public API)
         */static createEx2(expression,propertyName,control){TcHmi.System.Services.bindingManager?TcHmi.System.Services.bindingManager.createBinding(expression,propertyName,control):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] Creating binding at control "+control.getId()+" failed. System not ready.")}
/**
         * Removes a binding between a symbol and a control attribute setter function.
         * @param expression [OBSOLETE] The target symbol expression.
         * @param fn The target function as prototype reference.
         * @param control The target control instance.
         * @param bReset [Optional] If set to false the setter will not resetted with null.
         * @preserve (Part of the public API)
         */static remove(expression,fn,control,bReset=!0){const fnName=Binding.__getFuncName(fn,control);null!==fnName&&Binding.removeEx(expression,fnName,control,bReset)}
/**
         * Removes a binding between a symbol and a control attribute setter function.
         * @param expression [OBSOLETE] The target symbol expression.
         * @param fn The name of the control setter function.
         * @param control The target control instance.
         * @param bReset [Optional] If set to false the setter will not resetted with null.
         * @preserve (Part of the public API)
         */static removeEx(expression,fn,control,bReset=!0){if(!TcHmi.System.Services.controlManager)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] Removing binding at control "+control.getId()+" failed. System not ready."));const attr=TcHmi.System.Services.controlManager.getAttributeByPropertySetterName(control,fn);attr?Binding.removeEx2(expression,attr.propertyName,control,bReset):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] The attribute with the setter "+fn+" is not included in the description.json of "+control.getType()+". Removing a binding with this attribute failed.")}
/**
         * Removes a binding between a symbol and a control attribute setter function by name of property.
         * @param unused [OBSOLETE] The target symbol expression.
         * @param propertyName The name of the control attribute property.
         * @param control The target control instance.
         * @param bReset [Optional] If set to false the setter will not resetted with null.
         * @preserve (Part of the public API)
         */static removeEx2(unused,propertyName,control,bReset=!0){TcHmi.System.Services.bindingManager?TcHmi.System.Services.bindingManager.removeBinding(propertyName,control,bReset):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] Removing binding at control "+control.getId()+" failed. System not ready.")}
/**
         * Returns true if a symbol is bound to the target control property.
         * @param propertyName The name of the control attribute property.
         * @param control The target control instance.
         * @preserve (Part of the public API)
         */static exists(propertyName,control){return!!Binding.resolve(propertyName,control)}
/**
         * Returns the symbol expression of a binding as string or null if no symbol is bound to the target control property.
         * @param propertyName The name of the control attribute property.
         * @param control The target control instance.
         * @preserve (Part of the public API)
         */static resolve(propertyName,control){if(!TcHmi.System.Services.bindingManager)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] Resolving binding at control "+control.getId()+" failed. System not ready."),null;const binding=TcHmi.System.Services.bindingManager.getBinding(propertyName,control);if(binding){const symbol=binding.getSymbol();if(symbol)return symbol.getExpression().toString()}return null}
/**
         * Returns the symbol expression of a binding as SymbolExpression object or null if no symbol is bound to the target control property.
         * @param propertyName The name of the control attribute property.
         * @param control The target control instance.
         * @preserve (Part of the public API)
         */static resolveEx(propertyName,control){if(!TcHmi.System.Services.bindingManager)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] Resolving binding at control "+control.getId()+" failed. System not ready."),null;const binding=TcHmi.System.Services.bindingManager.getBinding(propertyName,control);if(binding){const symbol=binding.getSymbol();if(symbol)return new TcHmi.SymbolExpression(symbol.getExpression().toString())}return null}}TcHmi.Binding=Binding}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.Callback=class{
/**
         * Calls a callback and catches exceptions to return them as value of type {Error} for further processing.
         * @param callback function to call
         * @param thisArg the this pointer in the function call
         * @param args parameters for the function call
         * @returns undefined or the Error in case of an exception
         * @template T this for the call
         * @template A Array of types for all parameter for the function
         * @preserve (Part of the public API)
         */
static callSafe(callback,thisArg,...args){let res;if(callback&&"function"==typeof callback)try{callback.call(thisArg,...args)}catch(e){res=e instanceof Error?e:new Error("Function "+(callback.name?callback.name+" ":"")+"has thrown a plain value (no Error object) and therefore lacks a callstack. Thrown value: "+e)}return res}
/**
         * Calls a callback and catches exceptions to return them as value of type {Error} for further processing and prints it to console for proper call stack.
         * @param callback function to call
         * @param thisArg the this pointer in the function call
         * @param args parameters for the function call
         * @returns undefined or the Error in case of an exception
         * @template T this for the call
         * @template A Array of types for all parameter for the function
         * @preserve (Part of the public API)
         */static callSafeEx(callback,thisArg,...args){let res;if(callback&&"function"==typeof callback)try{callback.call(thisArg,...args)}catch(e){res=e instanceof Error?e:new Error("Function "+(callback.name?callback.name+" ":"")+"has thrown a plain value (no Error object) and therefore lacks a callstack. Thrown value: "+e)}return res&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(res),res}}}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.control={};TcHmi.Control=class{}}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.ControlFactory=
/**
     * Class for creating control instances.
     * @preserve (Part of the public API)
     */
class{
/**
         * Creates a new control.
         * This function throws an exception if one of the given parameter values is invalid.
         * * Attributes are given with its html attribute names:
         * ```json
         * {
         *     'data-tchmi-attribute1' : true,
         *     'data-tchmi-attribute2' : false
         * }
         * ```
         * @param type The type of the control.
         * @param id The identifier of the control.
         * @param attributes A dictionary for the attributes with the html attribute names as keys
         * @param parent Optional. The logical parent control.
         * @template C defines the type for the new control
         * @preserve (Part of the public API)
         */
static createEx(type,id,attributes,parent){if(!TcHmi.System.Services.controlManager)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.ControlFactory] Creating a control failed. System not ready."));if(TcHmi.System.isParameterTypeInvalid(type,"type",{type:"string",required:"valueNeeded",minStringLength:1}))throw new TypeError('[[Source=Framework, Module=TcHmi.ControlFactory.createEx] Invalid value: "'+type+'" for parameter: "type"');if(TcHmi.System.isParameterTypeInvalid(id,"id",{type:"string",required:"valueNeeded",minStringLength:1}))throw new TypeError('[[Source=Framework, Module=TcHmi.ControlFactory.createEx] Invalid value: "'+id+'" for parameter: id');if(TcHmi.System.isParameterTypeInvalid(attributes,"attributes ",{type:"object",required:"nullOk"})||__tchmi_is_instanced_object(attributes))throw new TypeError('[[Source=Framework, Module=TcHmi.ControlFactory.createEx] Invalid value: "'+attributes+'" for parameter: attributes');if(parent&&!(parent instanceof TcHmi.Controls.System.baseTcHmiControl))throw new TypeError('[[Source=Framework, Module=TcHmi.ControlFactory.createEx] Invalid value: "'+parent+'" for parameter: parent');let elem=document.createElement("div");return elem.id=id,elem.setAttribute("data-tchmi-type",type),TcHmi.System.Services.controlManager.compile(elem,parent,{designerIgnore:!0,overrideAttr:attributes})}
/**
         * DEPRECATED
         * Creates a new control.
         * @param htmlOrElementOrType The HTML, jQuery element or type of the control.
         * @param id Optional the identifier of the control.
         * @param parent Optional. The logical parent control.
         * @deprecated Please use createEx()
         * @template C defines the type for the new control
         * @preserve (Part of the public API)
         */static create(htmlOrElementOrType,id,parent){if(!TcHmi.System.Services.controlManager)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.ControlFactory] Creating a control failed. System not ready."));let jControl;if(null==id)jControl="string"==typeof htmlOrElementOrType?$(htmlOrElementOrType):htmlOrElementOrType;else{if("string"!=typeof htmlOrElementOrType)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.ControlFactory] Error compiling control. Wrong input parameter given."));jControl=$('<div id="'+id+'" data-tchmi-type="'+htmlOrElementOrType+'"></div>')}if(0===jControl.length)return;if(void 0!==TcHmi.Controls.get(jControl[0].id))return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.ControlFactory] Error compiling control. A control with the name "+jControl[0].id+" already exists."));return TcHmi.System.Services.controlManager.compile(jControl[0],parent,{designerIgnore:!0})}}}(TcHmi||(TcHmi={})),function(TcHmi){!function(Controls){Controls.register=
/**
         * DEPRECATED
         * Register a control.
         * The Framework will fetch and interprete the Description.json in the Control Directory and optionally load a HTML Template file
         * @param controlTypeName Name of the Control type.
         * @param constructor Constructor which generates the TcHmi Control.
         * @param directory Directory of the Control (base path is the Controls directory).
         * @param template Template file of the Control (base path is the Controls directory).
         * @template C defines the type for the control to register
         * @preserve (Part of the public API)
         * @deprecated Please use registerEx()
         */
function(controlTypeName,constructor,directory,template){let registration={error:TcHmi.Errors.NONE,apiVersion:0,name:controlTypeName,ctrlConstructor:constructor,directory:directory,template:template};if(constructor.toString().startsWith("class"))registration.nativeEs6Control=!0;else{registration.nativeEs6Control=!1;let firstES6constructor=constructor;do{firstES6constructor=Object.getPrototypeOf(firstES6constructor)}while(firstES6constructor&&!firstES6constructor.toString().startsWith("class"));firstES6constructor&&(registration.nearestEs6Constructor=firstES6constructor)}TcHmi.System.Data.Registrations.controls.map.has(controlTypeName)?TcHmi.System.Data.Registrations.controls.map.set(controlTypeName,{apiVersion:1,error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Controls.register",reason:'Ambiguous registration for the type name: "'+controlTypeName+'". Control will not be addressable by this type name. Please try fully qualified name to access control.'}}):TcHmi.System.Data.Registrations.controls.map.set(controlTypeName,registration),TcHmi.System.Data.Registrations.controls.array.push(registration),TcHmi.EventProvider.raise("System.onControlRegistered",registration)},Controls.registerEx=
/**
         * Register a control.
         * The Framework will fetch and interprete the Description.json in the Control Directory and optionally load a HTML Template file
         * @param controlTypeName Name of the Control type.
         * @param namespace Name of the Control namespace.
         * @param constructor Constructor which generates the TcHmi Control.
         * @template C defines the type for the control to register
         * @preserve (Part of the public API)
         */
function(controlTypeName,namespace,constructor,options){let registration={error:TcHmi.Errors.NONE,apiVersion:1,name:controlTypeName,namespace:namespace,ctrlConstructor:constructor};if(constructor.toString().startsWith("class"))registration.nativeEs6Control=!0;else{registration.nativeEs6Control=!1;let firstES6constructor=constructor;do{firstES6constructor=Object.getPrototypeOf(firstES6constructor)}while(firstES6constructor&&!firstES6constructor.toString().startsWith("class"));firstES6constructor&&(registration.nearestEs6Constructor=firstES6constructor)}let qname=TcHmi.System.resolveQualifiedName(controlTypeName,namespace);if(TcHmi.System.Data.Registrations.controls.map.has(controlTypeName)?TcHmi.System.Data.Registrations.controls.map.set(controlTypeName,{apiVersion:1,error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Controls.registerEx",reason:'Ambiguous registration for the type name: "'+controlTypeName+'". Control will not be addressable by this type name. Please try fully qualified name to access control.'}}):TcHmi.System.Data.Registrations.controls.map.set(controlTypeName,registration),TcHmi.System.Data.Registrations.controls.map.has(qname)?TcHmi.System.Data.Registrations.controls.map.set(qname,{apiVersion:1,error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Controls.registerEx",reason:'Ambiguous registration for the name: " '+qname+'". Control will not be addressable by this name.'}}):(TcHmi.System.Data.Registrations.controls.map.set(qname,registration),options?.injectInGlobalObject&&TcHmi.System.injectInGlobalObject(qname,constructor)),TcHmi.System.mapControlNamesFromPackageManifestApi1ToApi0.has(qname)){let nameLegacy=TcHmi.System.mapControlNamesFromPackageManifestApi1ToApi0.get(qname);TcHmi.System.Data.Registrations.controls.map.has(nameLegacy)?TcHmi.System.Data.Registrations.controls.map.set(nameLegacy,{apiVersion:1,error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Controls.registerEx",reason:'Ambiguous registration for the name: " '+qname+'". Control will not be addressable by this name.'}}):TcHmi.System.Data.Registrations.controls.map.set(nameLegacy,registration)}TcHmi.System.Data.Registrations.controls.array.push(registration),TcHmi.EventProvider.raise("System.onControlRegistered",registration)},Controls.get=
/**
         * Get control by identifier. Returns the control or undefined.
         * @param id Identifier of the Control.
         * @template T Type of the Control
         * @preserve (Part of the public API)
         */
function(id){if(!id||!TcHmi.System.Services.controlManager)return;return TcHmi.System.Services.controlManager.getControlsCache().get(id)},Controls.getVersion=
/**
         * Gets version information of control by type.
         * @param type Type of the Control.
         * @preserve (Part of the public API)
         */
function(type){if(!type||!TcHmi.System.Services.controlManager)return null;let descr=TcHmi.System.Services.controlManager.getDescription(type);return descr&&descr.version&&"object"==typeof descr.version?tchmi_clone_object(descr.version):null},Controls.getBasePath=
/**
         * Returns the dynamic base path of a control.
         * @preserve (Part of the public API)
         * @param type Control type name
         */
function(type){return TcHmi.Environment.getControlBasePath(type)},Controls.getBasePathEx=
/**
         * Returns the dynamic base path of a control.
         * @preserve (Part of the public API)
         * @param control TcHmi Control reference
         */
function(control){return TcHmi.Environment.getControlBasePathEx(control)},Controls.getMap=
/**
         * Get an ES5 Map of all controls. Key of the map is the control identifier
         * @preserve (Part of the public API)
         */
function(){return TcHmi.System.Services.controlManager?tchmi_clone_object(TcHmi.System.Services.controlManager.getControlsCache(),{cloneMaps:{deepCloneKeys:!1,deepCloneValues:!1}}):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Controls] Accessing control map failed. System not ready."),new Map)},Controls.tachControls=
/**
         * DEPRECATED
         * Does no longer do anything
         * @deprecated  Does no longer do anything
         * @param callback will be imediately called
         * @preserve (Part of the public API)
         */
function(callback=null){TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn('[Source=Framework, Module=TcHmi.Controls] The function "TcHmi.Controls.tachControls(callback: null | ((this: void) => void) = null)" has been marked as deprecated and should no longer be used because it does no longer do anything.'),"function"==typeof callback&&callback.apply(null)},Controls.tachControlsAsync=function(callback=null){TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn('[Source=Framework, Module=TcHmi.Controls] The function "TcHmi.Controls.tachControlsAsync(callback: null | ((this: void) => void) = null)" has been marked as deprecated and should no longer be used because it does no longer do anything.'),"function"==typeof callback&&callback.apply(null)}}(TcHmi.Controls||(TcHmi.Controls={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * Provides multiple types of dialogs to the user.
     * @preserve (Part of the public API)
     */
class DialogManager{
/**
         * Change visibility of dialog and set its DialogType when showing.
         * @param dialogOwner Caller Id to prevent overwriting forreign dialogs
         * @param bVisibility Toggling visiblity of dialog
         * @param dialogType Type of dialog
         * @param options Options
         * @returns returns false if the dialog could not be opened
         * @preserve (Part of the public API)
         */
static showDialog(dialogOwner,bVisibility,dialogType,options){return TcHmi.System.Services.dialogManager?TcHmi.System.Services.dialogManager.showDialog(dialogOwner,bVisibility,dialogType,options):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.DialogManager] Creating dialog failed. System not ready."),!1)}
/**
         * Changes the output content of the Dialog to a new value.
         * Will always target DialogType.Overlay. Use updateTextEx if you want to target a specific DialogType.
         * The default DialogSeverity is Info.
         * @param dialogOwner Caller Id to prevent overwriting forreign dialogs
         * @param html Content to show
         * @param severity Severity for the content.
         * @returns Success of the text update
         * @preserve (Part of the public API)
         */static updateText(dialogOwner,html,severity=DialogManager.DialogSeverity.Info){return TcHmi.System.Services.dialogManager?TcHmi.System.Services.dialogManager.updateText(dialogOwner,html,severity):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.DialogManager] Updating dialog failed. System not ready."),!1)}
/**
         * Changes the output content of the Dialog to a new value.
         * The default DialogType is Overlay.
         * The default DialogSeverity is Info.
         * @param dialogOwner Caller Id to prevent overwriting forreign dialogs
         * @param html Text to display
         * @param options
         * @returns Success of the text update
         * @preserve (Part of the public API)
         */static updateTextEx(dialogOwner,html,options){return TcHmi.System.Services.dialogManager?TcHmi.System.Services.dialogManager.updateTextEx(dialogOwner,html,options):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.DialogManager] Updating dialog failed. System not ready."),!1)}
/**
         * Returns the current dialog owner or null.
         * @preserve (Part of the public API)
         */static getDialogOwner(){return TcHmi.System.Services.dialogManager?TcHmi.System.Services.dialogManager.getDialogOwner():(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.DialogManager] Getting dialog owner failed. System not ready."),null)}
/**
         * Builds a formatted message of hierarchical error objects for use in dialog.
         * @param error Error object to show nicely
         * @preserve (Part of the public API)
         */static buildMessage(error){let __buildMessage=function(error,level){if(!error)return"";let res="",space="&nbsp;&nbsp;";for(let i=0,ii=level;i<ii;i++)space+="&nbsp;&nbsp;";if(error.code&&(res+="Code: "+error.code+"/0x"+error.code.toString(16)),error.message&&(res+=", Message: "+error.message),error.reason&&(res+="<br />"+space+"Reason: "+error.reason),error.domain&&(res+="<br />"+space+"Domain: "+error.domain),void 0!==error.errors&&error.errors.length){res+="<br />"+space+"as result of: ";for(let i=0,ii=error.errors.length;i<ii;i++)res+=__buildMessage(error.errors[i],level+1)}return res};return __buildMessage(error,0)}}TcHmi.DialogManager=DialogManager,function(DialogManager){let DialogSeverity,DialogType;!function(DialogSeverity){DialogSeverity[DialogSeverity.Info=0]="Info",DialogSeverity[DialogSeverity.Warning=1]="Warning",DialogSeverity[DialogSeverity.Error=2]="Error"}(DialogSeverity=DialogManager.DialogSeverity||(DialogManager.DialogSeverity={})),function(DialogType){DialogType[DialogType.Overlay=1]="Overlay",DialogType[DialogType.Watermark=2]="Watermark"}(DialogType=DialogManager.DialogType||(DialogManager.DialogType={}))}(DialogManager=TcHmi.DialogManager||(TcHmi.DialogManager={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(Engineering){class ErrorPane{static add(name,content,type){TcHmi.System.Services.Engineering.errorPane&&TcHmi.System.Services.Engineering.errorPane.add(name,content,type)}static remove(name){TcHmi.System.Services.Engineering.errorPane&&TcHmi.System.Services.Engineering.errorPane.remove(name)}}Engineering.ErrorPane=ErrorPane,function(ErrorPane){let MessageType;!function(MessageType){MessageType[MessageType.Message=0]="Message",MessageType[MessageType.Error=1]="Error",MessageType[MessageType.Warning=2]="Warning",MessageType[MessageType.Information=3]="Information"}(MessageType=ErrorPane.MessageType||(ErrorPane.MessageType={}))}(ErrorPane=Engineering.ErrorPane||(Engineering.ErrorPane={}))}(TcHmi.Engineering||(TcHmi.Engineering={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * Provides environment information.
     * @preserve (Part of the public API)
     */
class Environment{
/**
         * Returns the dynamic framework base path.
         * @preserve (Part of the public API)
         */
static getBasePath(){return TcHmi.System.config.basePath}
/**
         * Returns the dynamic base path of a control.
         * @preserve (Part of the public API)
         * @param type Control type name
         */static getControlBasePath(type){let module=TcHmi.System.Data.Modules.controls.map.get(type);return module&&module.error===TcHmi.Errors.NONE&&module.package&&void 0!==module.package.basePath&&null!==module.package.basePath&&module.manifestData&&void 0!==module.manifestData.basePath&&null!==module.manifestData.basePath?tchmi_path(module.package.basePath+"/"+module.manifestData.basePath):null}
/**
         * Returns the dynamic base path of a control.
         * @preserve (Part of the public API)
         * @param control TcHmi Control reference
         */static getControlBasePathEx(control){return control?Environment.getControlBasePath(control.getType()):null}static getBrowserCapabilities(){return this.__browserCapabilities}static getHostBaseUri(){return TcHmi.System.hostBaseUri}static async __initBrowserCapabilities(){if(!("CefSharp"in window))return void(this.__browserCapabilities={isCefSharp:!1,isTcEmbeddedBrowser:!1,supportsDownload:!0});const cefSharpWindow=window;cefSharpWindow.tcEmbeddedBrowserGlobals||await cefSharpWindow.CefSharp.BindObjectAsync("tcEmbeddedBrowserGlobals"),this.__browserCapabilities={isCefSharp:!0,isTcEmbeddedBrowser:!!cefSharpWindow.tcEmbeddedBrowserGlobals,supportsDownload:cefSharpWindow.tcEmbeddedBrowserGlobals?.supportsDownload??!0}}}Environment.__browserCapabilities={isCefSharp:"CefSharp"in window,isTcEmbeddedBrowser:!1,supportsDownload:!0},TcHmi.Environment=Environment,Environment.__initBrowserCapabilities()}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * The names of the enumeration exist at runtime.
     * For example, you can (and should) use TcHmi.Errors.NONE directly in a comparison.
     * @preserve (Part of the public API)
     */
let Errors;!function(Errors){Errors[Errors.NONE=0]="NONE",Errors[Errors.ERROR=1]="ERROR",Errors[Errors.E_PARAMETER_INVALID=2]="E_PARAMETER_INVALID",Errors[Errors.E_TIMEOUT=3]="E_TIMEOUT",Errors[Errors.E_EXCEPTION=4]="E_EXCEPTION",Errors[Errors.E_INVALID=5]="E_INVALID",Errors[Errors.E_NOT_UNIQUE=6]="E_NOT_UNIQUE",Errors[Errors.E_NOT_SUPPORTED=100]="E_NOT_SUPPORTED",Errors[Errors.E_SYSTEM_NOT_READY=105]="E_SYSTEM_NOT_READY",Errors[Errors.E_NOT_ALLOWED=110]="E_NOT_ALLOWED",Errors[Errors.E_UNKNOWN=115]="E_UNKNOWN",Errors[Errors.E_UNKNOWN_TYPE=120]="E_UNKNOWN_TYPE",Errors[Errors.E_KEY_NOT_FOUND=130]="E_KEY_NOT_FOUND",Errors[Errors.E_TYPE_INVALID=150]="E_TYPE_INVALID",Errors[Errors.E_VALUE_INVALID=160]="E_VALUE_INVALID",Errors[Errors.E_REGISTRATION_MISSING=180]="E_REGISTRATION_MISSING",Errors[Errors.E_REGISTRATION_ERROR=190]="E_REGISTRATION_ERROR",Errors[Errors.E_MODULE_MISSING=200]="E_MODULE_MISSING",Errors[Errors.E_MODULE_ERROR=210]="E_MODULE_ERROR",Errors[Errors.E_WEBSOCKET_NOT_READY=1e3]="E_WEBSOCKET_NOT_READY",Errors[Errors.E_WEBSOCKET_CLOSED=1001]="E_WEBSOCKET_CLOSED",Errors[Errors.E_WEBSOCKET_NOT_SUPPORTED=1404]="E_WEBSOCKET_NOT_SUPPORTED",Errors[Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_CHECK_FAILED=1500]="E_WEBSOCKET_OPEN_SERVER_LICENSE_CHECK_FAILED",Errors[Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING=1501]="E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING",Errors[Errors.E_WEBSOCKET_OPEN_SERVER_NO_ACCESS=1502]="E_WEBSOCKET_OPEN_SERVER_NO_ACCESS",Errors[Errors.E_SYMBOL_STATE_INVALID=2e3]="E_SYMBOL_STATE_INVALID",Errors[Errors.E_SYMBOL_VALUE_INVALID=2001]="E_SYMBOL_VALUE_INVALID",Errors[Errors.E_SYMBOL_RESOLVE_SCHEMA=2002]="E_SYMBOL_RESOLVE_SCHEMA",Errors[Errors.E_SYMBOL_READONLY=2003]="E_SYMBOL_READONLY",Errors[Errors.E_SYMBOL_UNKNOWN=2010]="E_SYMBOL_UNKNOWN",Errors[Errors.E_SYMBOL_INVALID_DATA_PROVIDER_ENTRY=2020]="E_SYMBOL_INVALID_DATA_PROVIDER_ENTRY",Errors[Errors.E_SYMBOL_INVALID_PATH=2030]="E_SYMBOL_INVALID_PATH",Errors[Errors.E_SYMBOL_SUBSYMBOL_ERROR=2040]="E_SYMBOL_SUBSYMBOL_ERROR",Errors[Errors.E_SYMBOL_OBJECT_RESOLVE=2050]="E_SYMBOL_OBJECT_RESOLVE",Errors[Errors.E_SYMBOL_UNKNOWN_ATTRIBUTE=2100]="E_SYMBOL_UNKNOWN_ATTRIBUTE",Errors[Errors.E_SERVER_RESPONSE_ERROR=3e3]="E_SERVER_RESPONSE_ERROR",Errors[Errors.E_SERVER_COMMAND_ERROR=3005]="E_SERVER_COMMAND_ERROR",Errors[Errors.E_SERVER_INVALID_RESPONSE=3010]="E_SERVER_INVALID_RESPONSE",Errors[Errors.E_SERVER_COMMANDS_MISSING=3015]="E_SERVER_COMMANDS_MISSING",Errors[Errors.E_SERVER_COMMAND_MISSING=3016]="E_SERVER_COMMAND_MISSING",Errors[Errors.E_SERVER_READVALUE_MISSING=3020]="E_SERVER_READVALUE_MISSING",Errors[Errors.E_SERVER_WRITEVALUE_MISSING=3025]="E_SERVER_WRITEVALUE_MISSING",Errors[Errors.E_SERVER_RESPONSE_MISSING=3030]="E_SERVER_RESPONSE_MISSING",Errors[Errors.E_SERVER_DOMAIN_UNKNOWN=3100]="E_SERVER_DOMAIN_UNKNOWN",Errors[Errors.E_SERVER_HANDSHAKE=3200]="E_SERVER_HANDSHAKE",Errors[Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE=4e3]="E_FUNCTION_MISSING_FUNCTION_REFERENCE",Errors[Errors.E_FUNCTION_MISSING_FUNCTION_DESCRIPTION=4005]="E_FUNCTION_MISSING_FUNCTION_DESCRIPTION",Errors[Errors.E_FUNCTION_INVALID_CONFIGURATION=4010]="E_FUNCTION_INVALID_CONFIGURATION",Errors[Errors.E_FUNCTION_EXCEPTION=4020]="E_FUNCTION_EXCEPTION",Errors[Errors.E_FUNCTION_UNKNOWN=4030]="E_FUNCTION_UNKNOWN",Errors[Errors.E_FUNCTION_RESTPARAMETER_DEFINITION_MISSING=4040]="E_FUNCTION_RESTPARAMETER_DEFINITION_MISSING",Errors[Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED=4050]="E_FUNCTION_RESOLVING_PARAMETER_FAILED",Errors[Errors.E_FUNCTION_HANDLED_VIA_RETURN_VALUE=4060]="E_FUNCTION_HANDLED_VIA_RETURN_VALUE",Errors[Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR=4100]="E_FUNCTION_EXPRESSION_PARSER_ERROR",Errors[Errors.E_FUNCTION_EXPRESSION_EXCEPTION=4120]="E_FUNCTION_EXPRESSION_EXCEPTION",Errors[Errors.E_FUNCTION_CALL_ABORTED=4130]="E_FUNCTION_CALL_ABORTED",Errors[Errors.E_FUNCTION_DESTROYED=4140]="E_FUNCTION_DESTROYED",Errors[Errors.E_TRIGGER_ACTION_EXCEPTION=5050]="E_TRIGGER_ACTION_EXCEPTION",Errors[Errors.E_TRIGGER_JAVASCRIPT_EVAL_EXCEPTION=5055]="E_TRIGGER_JAVASCRIPT_EVAL_EXCEPTION",Errors[Errors.E_TRIGGER_FUNCTION_EXPRESSION_EXCEPTION=5060]="E_TRIGGER_FUNCTION_EXPRESSION_EXCEPTION",Errors[Errors.E_TRIGGER_RESOLVE_CONDITION_EXPRESSION_EXCEPTION=5065]="E_TRIGGER_RESOLVE_CONDITION_EXPRESSION_EXCEPTION",Errors[Errors.E_TRIGGER_CONDITION_INVALID=5200]="E_TRIGGER_CONDITION_INVALID",Errors[Errors.E_CONTROL_INSTANCE_NOT_FOUND=6e3]="E_CONTROL_INSTANCE_NOT_FOUND",Errors[Errors.E_CONTROL_INVALID_CONFIGURATION=6001]="E_CONTROL_INVALID_CONFIGURATION",Errors[Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND=6005]="E_CONTROL_ATTRIBUTE_NOT_FOUND",Errors[Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION=6010]="E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION",Errors[Errors.E_CONTROL_INSTANCE_NO_LONGER_AVAILABLE=6020]="E_CONTROL_INSTANCE_NO_LONGER_AVAILABLE",Errors[Errors.E_SCHEMA_INVALID=7e3]="E_SCHEMA_INVALID",Errors[Errors.E_SCHEMA_INVALID_PATH=7010]="E_SCHEMA_INVALID_PATH",Errors[Errors.E_SCHEMA_INVALID_REF_ID=7020]="E_SCHEMA_INVALID_REF_ID",Errors[Errors.E_SCHEMA_UNKNOWN_FILE=7030]="E_SCHEMA_UNKNOWN_FILE",Errors[Errors.E_SCHEMA_UNKNOWN_SOURCE=7030]="E_SCHEMA_UNKNOWN_SOURCE",Errors[Errors.E_SCHEMA_UNKNOWN_DEFINITION=7040]="E_SCHEMA_UNKNOWN_DEFINITION",Errors[Errors.E_SCHEMA_NOT_RESOLVED=7050]="E_SCHEMA_NOT_RESOLVED",Errors[Errors.E_PACKAGE=8e3]="E_PACKAGE",Errors[Errors.E_LOCALIZATION_UNKNOWN_KEY=9e3]="E_LOCALIZATION_UNKNOWN_KEY"}(Errors=TcHmi.Errors||(TcHmi.Errors={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * Provides functions for managing events.
     * @preserve (Part of the public API)
     */
class EventProvider{
/**
         * Register a callback to an event name.
         * If the name is a symbol expression the callback will be initially called when
         * there is a symbol with this name.
         * Returns a destroy function to remove the registration.
         * @param name Name of the event.
         * @param callback Callback which will be called
         * @param options Data an event can be given while registration.
         * @returns Destroy function which cleans up/unregisters
         * @preserve (Part of the public API)
         */
static register(name,callback,options){const internalEventId=this.__internalEventId++;let destroyWatch,s=null,destroy=()=>{destroyWatch&&(destroyWatch(),destroyWatch=void 0),s&&s.destroy();const event=EventProvider.__events.get(name);event&&(event.delete(internalEventId),0===event.size&&EventProvider.__events.delete(name)),s?s=null:(TcHmi.EventProvider.raise("System.EventProvider.onDestroyedCallback<"+name+">",entry),TcHmi.EventProvider.raise("System.EventProvider.onDestroyedCallback",entry))},event=EventProvider.__events.get(name);void 0===event&&(event=new Map,EventProvider.__events.set(name,event));const entry={id:internalEventId,name:name,callback:callback,options:options,destroy:destroy};return event.set(internalEventId,entry),!0===TcHmi.Symbol.isSymbolExpression(name)?(s=new TcHmi.System.Symbol(name),destroyWatch=s.watch((function(data){destroyWatch||(destroyWatch=data.destroy),data.error===TcHmi.Errors.NONE&&TcHmi.Callback.callSafeEx(callback,null,{name:name,destroy:destroy},data.value)}))):(TcHmi.EventProvider.raise("System.EventProvider.onRegisterCallback<"+name+">",entry),TcHmi.EventProvider.raise("System.EventProvider.onRegisterCallback",entry)),destroy}
/**
         * Calls all registered callbacks related to an event name.
         * @param name Name of the event.
         * @param args Optional parameter(s) which will be transfered to the callbacks
         * @preserve (Part of the public API)
         */static raise(name,...args){const eventMap=EventProvider.__events.get(name);if(eventMap)for(const event of eventMap.values())TcHmi.Callback.callSafeEx(event.callback,null,{name:event.name,destroy:event.destroy??function(){}},...args)}
/**
         * Calls the callback of an specific event registration.
         * @param event Event object
         * @param args optional parameter(s) which will be transfered to the callbacks
         * @preserve (Part of the public API)
         */static raiseEx(event,...args){TcHmi.Callback.callSafeEx(event.callback,null,{name:event.name,destroy:event.destroy??function(){}},...args)}static watchEventRegistration(name,callback){let destroyEventOnDestroyCallback=null,register=function(event){destroyEventOnDestroyCallback=TcHmi.EventProvider.register("System.EventProvider.onDestroyedCallback<"+name+">",(function(e,event){TcHmi.Callback.callSafeEx(callback,EventProvider,{error:TcHmi.Errors.NONE,type:EventProvider.EventRegWatchType.DESTROY,event:event}),destroyEventOnDestroyCallback?(destroyEventOnDestroyCallback(),destroyEventOnDestroyCallback=null):e.destroy()})),TcHmi.Callback.callSafeEx(callback,EventProvider,{error:TcHmi.Errors.NONE,type:EventProvider.EventRegWatchType.REGISTER,event:event})},eventMap=EventProvider.__events.get(name);eventMap&&eventMap.forEach(register);let destroyEventOnRegisterCallback=TcHmi.EventProvider.register("System.EventProvider.onRegisterCallback<"+name+">",(function(e,event){register(event)}));return function(){destroyEventOnRegisterCallback&&(destroyEventOnRegisterCallback(),destroyEventOnRegisterCallback=null),destroyEventOnDestroyCallback&&(destroyEventOnDestroyCallback(),destroyEventOnDestroyCallback=null)}}static has(name){return TcHmi.EventProvider.__events.has(name)}static count(name){const events=TcHmi.EventProvider.__events.get(name);return events?.size??0}}EventProvider.__events=new Map,EventProvider.__internalEventId=0,TcHmi.EventProvider=EventProvider,function(EventProvider){let EventRegWatchType;!function(EventRegWatchType){EventRegWatchType[EventRegWatchType.REGISTER=100]="REGISTER",EventRegWatchType[EventRegWatchType.DESTROY=200]="DESTROY"}(EventRegWatchType=EventProvider.EventRegWatchType||(EventProvider.EventRegWatchType={}))}(EventProvider=TcHmi.EventProvider||(TcHmi.EventProvider={}))}(TcHmi||(TcHmi={})),function(TcHmi){class FilterInstance{constructor(dataSchemaOrPath,schemaOrComparator,value,schema){if(this.__schema=null,this.__parsedFilter=null,this.__wrapInBrackets=!1,"string"==typeof dataSchemaOrPath&&"string"==typeof schemaOrComparator&&void 0!==value)value instanceof Date&&(value=new Date(value.getTime())),this.__filter=[{path:dataSchemaOrPath,comparator:schemaOrComparator,value:value}],schema&&(this.__schema=schema);else if("object"==typeof schemaOrComparator&&(this.__schema=schemaOrComparator),dataSchemaOrPath instanceof FilterInstance)this.__filter=tchmi_clone_object(dataSchemaOrPath.getFilter()),this.__schema||(this.__schema=dataSchemaOrPath.getSchema());else{if(Array.isArray(dataSchemaOrPath))return void(this.__filter=tchmi_clone_object(dataSchemaOrPath,{cloneDates:!0}));"object"==typeof dataSchemaOrPath?TcHmi.isComparison(dataSchemaOrPath)?this.__filter=[tchmi_clone_object(dataSchemaOrPath,{cloneDates:!0})]:(this.__filter=[],this.__schema=dataSchemaOrPath):this.__filter=[]}}getFilter(){return this.__filter}getSchema(){return this.__schema}and(dataOrPath,comparator,value){if(dataOrPath instanceof FilterInstance&&(dataOrPath=dataOrPath.getFilter()),Array.isArray(dataOrPath)&&0===dataOrPath.length)return this;if("string"==typeof dataOrPath){if(void 0===comparator||void 0===value)return this;dataOrPath={path:dataOrPath,comparator:comparator,value:value}}return this.__append("AND",dataOrPath),this}or(dataOrPath,comparator,value){if(dataOrPath instanceof FilterInstance&&(dataOrPath=dataOrPath.getFilter()),Array.isArray(dataOrPath)&&0===dataOrPath.length)return this.__parsedFilter=null,this.__filter=[],this.__wrapInBrackets=!1,this;if("string"==typeof dataOrPath){if(void 0===comparator||void 0===value)return this;dataOrPath={path:dataOrPath,comparator:comparator,value:value}}return this.__append("OR",dataOrPath),this}__append(logic,filter){this.__parsedFilter=null,this.__filter.length>0&&(this.__wrapInBrackets&&(this.__filter=[this.__filter]),this.__filter.push({logic:logic})),this.__filter.length>0||!Array.isArray(filter)?this.__filter.push(tchmi_clone_object(filter,{cloneDates:!0})):this.__filter=tchmi_clone_object(filter),this.__wrapInBrackets=!1}wrapInBrackets(){return this.__filter.length>=3&&(this.__wrapInBrackets=!0),this}compile(){try{this.__parsedFilter=TcHmi.System.Filter.parse(this.__filter,this.__schema)}catch(ex){return{error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],domain:"Tchmi.Filter",reason:"The provided filter or schema is invalid",exception:ex}}}return{error:TcHmi.Errors.NONE}}test(candidate,key=""){return this.__parsedFilter||(this.__parsedFilter=TcHmi.System.Filter.parse(this.__filter,this.__schema)),this.__parsedFilter.test(candidate,key)}filter(collection){if(this.__parsedFilter||(this.__parsedFilter=TcHmi.System.Filter.parse(this.__filter,this.__schema)),Array.isArray(collection)){const parsedFilter=this.__parsedFilter;return collection.filter(((item,index)=>parsedFilter.test(item,index)))}if(collection instanceof Map){const result=new Map;for(const[key,item]of collection)this.__parsedFilter.test(item,key)&&result.set(key,item);return result}if(collection instanceof Set){const result=new Set;for(const item of collection)this.__parsedFilter.test(item)&&result.add(item);return result}const result={};for(const[key,item]of Object.entries(collection))this.__parsedFilter.test(item,key)&&(result[key]=item);return result}}TcHmi.FilterInstance=FilterInstance}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.Function=
/**
     * Used to execute functions based on a static JSON description.
     * @preserve (Part of the public API)
     */
class{constructor(functionCallDescription){this.__lastExecuteId=0,this.__pendingExecutes=new Map,this.__isDestroying=!1,this.__isDestroyed=!1,this.__f=functionCallDescription;let module=TcHmi.System.Data.Modules.functions.map.get(functionCallDescription.fn);module&&(this.__module=module,this.__module.error===TcHmi.Errors.NONE&&(this.__fn=this.__module.reg?.func,this.__fnDescr=this.__module.description))}__execute(ctx,requiredArgs){if(!TcHmi.System.Services.typeManager)return ctx.error(TcHmi.Errors.E_SYSTEM_NOT_READY,{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Failed to execute. System not ready.",domain:"TcHmi.Function"}),()=>{};if(this.__isDestroyed)return ctx.error(TcHmi.Errors.E_FUNCTION_DESTROYED,{code:TcHmi.Errors.E_FUNCTION_DESTROYED,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_DESTROYED],reason:"Function was already destroyed",domain:"TcHmi.Function"}),()=>{};if(!this.__f)return ctx.error(TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE,{code:TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE],reason:"Function reference missing.",domain:"TcHmi.Function"}),()=>{};if(!this.__module)return ctx.error(TcHmi.Errors.E_MODULE_MISSING,{code:TcHmi.Errors.E_MODULE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_MODULE_MISSING],reason:this.__f.fn,domain:"TcHmi.Function"}),()=>{};if(this.__module.error!==TcHmi.Errors.NONE)return ctx.error(TcHmi.Errors.E_MODULE_ERROR,{code:TcHmi.Errors.E_MODULE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_MODULE_ERROR],reason:this.__f.fn,domain:"TcHmi.Function",errors:this.__module.errorDetails?[this.__module.errorDetails]:void 0}),()=>{};if(!this.__fn)return ctx.error(TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE,{code:TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE],reason:this.__f.fn,domain:"TcHmi.Function",errors:this.__module.errorDetails?[this.__module.errorDetails]:void 0}),()=>{};if(!this.__fnDescr)return ctx.error(TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_DESCRIPTION,{code:TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_DESCRIPTION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_DESCRIPTION],reason:this.__f.fn,domain:"TcHmi.Function",errors:this.__module.errorDetails?[this.__module.errorDetails]:void 0}),()=>{};let results=[],fnParams=this.__f.fnParams;Array.isArray(fnParams)||(fnParams=[]);let fnDescr=this.__fnDescr,fnArgDescriptions=fnDescr.function.arguments,done=!1,argoffset=0;!0===fnDescr.function.injectContextObject&&argoffset++,this.__lastExecuteId++;let executeId=this.__lastExecuteId,finish=(error,details)=>{if(!done){if(done=!0,!this.__isDestroying&&this.__pendingExecutes.has(executeId)&&this.__pendingExecutes.delete(executeId),error!==TcHmi.Errors.NONE)return ctx.error(error,details),void destroy();{let res;!0===fnDescr.function.injectContextObject&&(fnDescr.function&&fnDescr.function.waitMode&&"Asynchronous"===fnDescr.function.waitMode?results.unshift(ctx):results.unshift(ctx&&ctx.args?{args:ctx.args}:{}));try{res=this.__fn.call(this,...results)}catch(e){return ctx.error(TcHmi.Errors.E_FUNCTION_EXCEPTION,{code:TcHmi.Errors.E_FUNCTION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXCEPTION],reason:fnDescr.function.name+', Exception: "'+e+'"',domain:"TcHmi.Function"}),void destroy()}if(fnDescr.function&&(!fnDescr.function.waitMode||fnDescr.function.waitMode&&"Synchronous"===fnDescr.function.waitMode))return ctx.success(res),void destroy()}}};if(fnDescr.function&&fnDescr.function.waitMode&&"Asynchronous"===fnDescr.function.waitMode&&!1===fnDescr.function.injectContextObject)return finish(TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,{code:TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION],reason:fnDescr.function.name+", Setting waitMode=Asynchronous and injectContextObject="+fnDescr.function.injectContextObject+" is an invalid function configuration. Please define a context object if you want to use waitMode=Asynchronous.",domain:"TcHmi.Function"}),()=>{};let pending=requiredArgs.length+fnParams.length,underlyingSymbols=[],underlyingDestroyFunctions=[],isDestroyed=!1,destroy=()=>{if(!isDestroyed){for(let i=0,ii=underlyingDestroyFunctions.length;i<ii;i++){let destroy=underlyingDestroyFunctions[i];destroy&&destroy()}underlyingDestroyFunctions=[];for(let i=0,ii=underlyingSymbols.length;i<ii;i++){let symbol=underlyingSymbols[i];symbol&&symbol.destroy()}underlyingSymbols=[],done||finish(TcHmi.Errors.E_FUNCTION_CALL_ABORTED,{code:TcHmi.Errors.E_FUNCTION_CALL_ABORTED,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_CALL_ABORTED],reason:fnDescr.function.name+", Function call was aborted.",domain:"TcHmi.Function"}),isDestroyed=!0}};this.__pendingExecutes.set(executeId,destroy);let addArgumentResult=(i,descr,value)=>{if(descr){let typeSchema=TcHmi.System.Services.typeManager?.getSchema(descr.type);typeSchema&&"TcHmi.Symbol"===typeSchema.frameworkInstanceOf?value instanceof TcHmi.Symbol?results[i]=value:results[i]=null:results[i]=TcHmi.ValueConverter.toSchemaType(value,typeSchema)}else results[i]=value;pending--,0===pending&&finish(TcHmi.Errors.NONE)},resolveSymbolValue=(i,descr,s)=>{let destroy=s.readEx((function(data){data.error===TcHmi.Errors.NONE?addArgumentResult(i,descr,data.value):finish(TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED,{code:TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED],reason:fnDescr.function.name+', Resolving symbol: "'+s.getExpression()+'" for parameter: '+i+" failed.",domain:"TcHmi.Function",errors:data.details?[data.details]:void 0})}));underlyingDestroyFunctions.push(destroy)},resolveFunctionExpressionValue=(i,descr,functionExpression)=>{let func;try{func=new TcHmi.System.FunctionExpression(functionExpression),func.execute({success:function(result){addArgumentResult(i,descr,result),func?.destroy()},error:function(error,details){finish(TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED,{code:TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED],reason:fnDescr.function.name+', Resolving function expression: "'+functionExpression+'" for parameter: '+i+" failed.",domain:"TcHmi.Function",errors:details?[details]:void 0}),func?.destroy()},args:ctx.args})}catch(e){finish(TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED,{code:TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED],reason:fnDescr.function.name+', Resolving function expression: "'+functionExpression+'" for parameter: '+i+"  failed with exception.",domain:"TcHmi.Function",errors:[{code:TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION],exception:e,reason:"An uncaught exception occurred while parsing a function parameter",domain:"TcHmi.System.FunctionExpression"}]}),func?.destroy()}};if(done)return destroy;if(0===pending)return finish(TcHmi.Errors.NONE),destroy;for(let i=0,ii=requiredArgs.length;i<ii;i++){let descr,arg=requiredArgs[i];i<fnArgDescriptions.length-argoffset?descr=fnArgDescriptions[i+argoffset]:(descr=fnArgDescriptions[fnArgDescriptions.length-1],descr&&!descr.restParameter&&(descr=null)),addArgumentResult(i,descr,arg)}for(let i=0,ii=fnParams.length;i<ii;i++){if(done)return destroy;let descr,fnParam=fnParams[i];if(i<fnArgDescriptions.length-requiredArgs.length-argoffset?descr=fnArgDescriptions[i+requiredArgs.length+argoffset]:(descr=fnArgDescriptions[fnArgDescriptions.length-1],descr&&!descr.restParameter&&(descr=null)),!descr)return finish(TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,{code:TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION],reason:fnDescr.function.name,domain:"TcHmi.Function"}),destroy;if(TcHmi.IFunction.isStaticValue(fnParam))addArgumentResult(i+requiredArgs.length,descr,fnParam.value);else if(TcHmi.IFunction.isSymbol(fnParam)){let s=new TcHmi.Symbol(fnParam.symbolExpression),typeSchema=TcHmi.System.Services.typeManager.getSchema(descr.type);typeSchema&&"TcHmi.Symbol"===typeSchema.frameworkInstanceOf?addArgumentResult(i+requiredArgs.length,descr,s):resolveSymbolValue(i+requiredArgs.length,descr,s),underlyingSymbols.push(s)}else TcHmi.IFunction.isFunctionExpression(fnParam)?resolveFunctionExpressionValue(i+requiredArgs.length,descr,fnParam.functionExpression):finish(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:fnDescr.function.name,domain:"TcHmi.Function"})}return destroy}
/**
         * Will raise the function defined in constructor argument f: IFunction.
         * @param requiredArgs Optional required arguments. Will be injected before arguments defined in IFunction and after context object dummy if context object is required.
         * @preserve (Part of the public API)
         */execute(requiredArgs=[]){let res=null,bContextLock=!1,destroy=this.__execute({success:function(result){bContextLock||(bContextLock=!0,res=result)},error:function(error){bContextLock||(bContextLock=!0,res=null)}},requiredArgs);return destroy&&destroy(),res}
/**
         * Will raise the function defined in constructor argument f: IFunction and raises a callback afterwards.
         * @param requiredArgs Optional required arguments. Will be injected before arguments defined in IFunction and after context object dummy if context object is required.
         * @param callback Callback which will be called with the result
         * @preserve (Part of the public API)
         */executeEx(requiredArgs=[],callback){let __this=this;requiredArgs||(requiredArgs=[]);let bContextLock=!1;return this.__execute({success:function(result){bContextLock||(bContextLock=!0,TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,result:result}))},error:function(error,details){bContextLock||(bContextLock=!0,TcHmi.Callback.callSafeEx(callback,__this,{error:error,details:details}))}},requiredArgs)}
/**
         * Will raise the function defined in constructor argument f: IFunction and forward the context object defined in ctx: TcHmi.Context if the function supports this.
         * @param ctx Context object.
         * @param requiredArgs Optional required arguments. Will be injected before arguments defined in IFunction and after context object dummy if context object is required.
         * @preserve (Part of the public API)
         */executeEx2(ctx,requiredArgs=[]){if(!ctx)throw new TypeError("Parameter 'ctx' must be defined.");if(!ctx.success||!ctx.error)throw new TypeError("Parameter 'ctx' must be defined properly. Either 'success' or 'error' or both are missing.");if("function"!=typeof ctx.success||"function"!=typeof ctx.error)throw new TypeError("Parameter 'ctx' must be defined properly. Either 'success' or 'error' or both are not of type 'function'.");return requiredArgs||(requiredArgs=[]),this.__execute(ctx,requiredArgs)}__resolveProcessedWaitMode(){let res="Synchronous";if(this.__processedWaitMode)return res=this.__processedWaitMode,res;if(this.__isDestroyed)throw new Error("Object was already destroyed.");if(!this.__f)throw new Error("Function call description is missing.");if(!this.__fnDescr)throw new Error("Function description is missing.");if("Synchronous"===res&&(this.__fnDescr.function&&this.__fnDescr.function.waitMode&&(res=this.__fnDescr.function.waitMode),this.__f&&this.__f.fnParams))for(let i=0,ii=this.__f.fnParams.length;i<ii;i++){let fnParam=this.__f.fnParams[i];if(fnParam)if(TcHmi.IFunction.isSymbol(fnParam)){let expr=new TcHmi.SymbolExpression(fnParam.symbolExpression),type=expr.getType();if(type===TcHmi.SymbolType.Server){res="Asynchronous";break}if(type===TcHmi.SymbolType.Function){const content=expr.getContent();if(!content)continue;let func=new TcHmi.System.FunctionExpression(content);if(func.isProcessedAsync()){res="Asynchronous",func.destroy();break}func.destroy()}}else if(TcHmi.IFunction.isFunctionExpression(fnParam)){let func=new TcHmi.System.FunctionExpression(fnParam.functionExpression);if(func.isProcessedAsync()){res="Asynchronous",func.destroy();break}func.destroy()}}return this.__processedWaitMode=res,res}isProcessedAsync(){return"Asynchronous"===this.__resolveProcessedWaitMode()}
/**
         * Releases all resources of the function
         * @preserve (Part of the public API)
         */destroy(){this.__isDestroying=!0,this.__pendingExecutes.forEach((destroy=>{destroy()})),this.__pendingExecutes.clear(),this.__module=void 0,this.__f=void 0,this.__fn=void 0,this.__fnDescr=void 0,this.__isDestroying=!1,this.__isDestroyed=!0}
/**
         * Get the description of the function.
         * @preserve (Part of the public API)
         */getDescription(){return this.__fnDescr}}}(TcHmi||(TcHmi={})),function(TcHmi){!function(Functions){Functions.registerFrameworkFunction=
/**
         * Deprecated! Please use registerFunctionEx.
         * @deprecated Please use registerFunctionEx.
         * @param name name of the framework function
         * @param functionImplementation Javascript function to execute
         * @param descriptionUrl Url for the function description
         * @preserve (Part of the public API)
         */
function(name,functionImplementation,descriptionUrl){TcHmi.Functions.registerFunction(name,functionImplementation)},Functions.registerFunction=
/**
         * Registers a function created within a TwinCAT HMI project in the framework.
         * @param name Name of the function
         * @param functionImplementation Javascript function to execute
         * @preserve (Part of the public API)
         */
function(name,functionImplementation){let registration={error:TcHmi.Errors.NONE,name:name,func:functionImplementation};TcHmi.System.Data.Registrations.functions.map.has(name)?TcHmi.System.Data.Registrations.functions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Functions.registerFunction",reason:'Ambiguous registration for the name: "'+name+'". Function will not be addressable by this name. Please try fully qualified name to access function.'}}):(TcHmi.System.Data.Registrations.functions.map.set(name,registration),TcHmi.System.Data.Registrations.functions.array.push(registration)),TcHmi.EventProvider.raise("System.onFunctionRegistered",registration)},Functions.registerFunctionEx=
/**
         * Registers a function created within a TwinCAT HMI project in the framework.
         * @param name Name of the function
         * @param namespace namespace of the function
         * @param functionImplementation Javascript function to execute
         * @preserve (Part of the public API)
         */
function(name,namespace,functionImplementation,options){let qname=TcHmi.System.resolveQualifiedName(name,namespace),registration={error:TcHmi.Errors.NONE,name:name,namespace:namespace,func:functionImplementation};TcHmi.System.Data.Registrations.functions.map.has(name)?TcHmi.System.Data.Registrations.functions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Functions.registerFunctionEx",reason:'Ambiguous registration for the name: "'+name+'". Function will not be addressable by this name. Please try fully qualified name to access function.'}}):(TcHmi.System.Data.Registrations.functions.map.set(name,registration),TcHmi.System.Data.Registrations.functions.array.push(registration)),TcHmi.System.Data.Registrations.functions.map.has(qname)?TcHmi.System.Data.Registrations.functions.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Functions.registerFunctionEx",reason:'Ambiguous registration for the name: " '+qname+'". Function will not be addressable by this name.'}}):(TcHmi.System.Data.Registrations.functions.map.set(qname,registration),options?.injectInGlobalObject&&TcHmi.System.injectInGlobalObject(qname,functionImplementation)),TcHmi.EventProvider.raise("System.onFunctionRegistered",registration)},Functions.getFunction=
/**
         * Returns a registered HMI function
         * @param name Name of the function
         * @preserve (Part of the public API)
         */
function(name){let module=TcHmi.System.Data.Modules.functions.map.get(name);if(module&&module.error===TcHmi.Errors.NONE)return module.reg.func},Functions.getFunctionVersion=
/**
         * Gets version information of function by name.
         * @param name Name of the function
         * @preserve (Part of the public API)
         */
function(name){let module=TcHmi.System.Data.Modules.functions.map.get(name);return module&&module.error===TcHmi.Errors.NONE&&module.description&&module.description.version&&"object"==typeof module.description.version?module.description.version:null}}(TcHmi.Functions||(TcHmi.Functions={}))}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.Keyboard=
/**
     * Provides an interface for keyboard interaction.
     * @preserve (Part of the public API)
     */
class{static close(){TcHmi.System.Services.keyboardManager?.close()}}}(TcHmi||(TcHmi={})),function(TcHmi){class List extends Array{constructor(){super(),this.__proto__!==TcHmi.List.prototype&&(Object.setPrototypeOf?Object.setPrototypeOf(this,List.prototype):this.__proto__=List.prototype)}first(predicate){for(let i=0,len=this.length;i<len;i++)if(predicate(this[i]))return this[i];throw new Error("Array does not contain elements")}firstOrDefault(predicate,defaultValue=null){for(let i=0,len=this.length;i<len;i++)if(predicate(this[i]))return this[i];return null}remove(item){for(let i=0,len=this.length;i<len;i++)if(this[i]===item)return this.splice(i,1),!0;return!1}addRange(items){for(let i=0,len=items.length;i<len;i++)this.push(items[i])}clearAll(){for(;this.length>0;)this.pop()}findIndex(predicate){for(let i=0,len=this.length;i<len;i++)if(predicate(this[i],i,this))return i;return-1}}TcHmi.List=List}(TcHmi||(TcHmi={})),function(TcHmi){!function(Locale){Locale.load=
/**
         * Loads a language file and refreshes localization symbols.
         * Note that this does not change the Time Format Locale.
         * @param locale locale name to load
         * @param callback optional callback which is called after locale change
         * @preserve (Part of the public API)
         */
function(locale,callback=null){if(!TcHmi.System.Services.localizationManager)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Locale] Loading locale failed. System not ready."),void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],domain:"TcHmi.Locale"}});TcHmi.System.isParameterTypeInvalid(locale,"locale",{type:"string",required:"nullOk",minStringLength:1},"TcHmi.Locale",callback)||TcHmi.System.Services.localizationManager.loadLocale(locale,callback)},Locale.get=
/**
         * Returns the current locale string for texts or undefined if no localized Symbol is available.
         * Note that this is not the Time Format Locale.
         * @returns The current locale identifier.
         * @preserve (Part of the public API)
         */
function(){if(TcHmi.System.Services.localizationManager)return TcHmi.System.Services.localizationManager.getLocale();TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Locale] Fetching locale failed. System not ready.")},Locale.getRegisteredLocales=
/**
         * Returns the list of available application locales.
         * @preserve (Part of the public API)
         */
function(){let res=[],files=TcHmi.System.Services.localizationManager?.getFiles();if(!files)return res;let applicationFiles=files.get("TcHmi.System.Localization.Application");return applicationFiles?(applicationFiles.forEach(((files,key)=>{res.push(key)})),res):res},Locale.getRegisteredLocalesForControl=function(type){let res=[],files=TcHmi.System.Services.localizationManager?.getFiles();if(!files)return res;let controlFiles=files.get("TcHmi.System.Localization.Control<"+type+">");return controlFiles?(controlFiles.forEach(((files,key)=>{res.push(key)})),res):res},Locale.getRegisteredLocalesForFunction=function(type){let files=TcHmi.System.Services.localizationManager?.getFiles();if(!files)return[];let functionFiles=files.get("TcHmi.System.Localization.Function<"+type+">");return functionFiles?Array.from(functionFiles.keys()):[]};Locale.LocalizationReader=class{constructor(localization){this.__localizationDictionary=localization}getLocalization(){return this.__localizationDictionary}get(key){let res=this.__localizationDictionary[key];return null==res&&(res=key),res}};Locale.Localization=class{constructor(){this.__namespace=""}get(options){return TcHmi.System.Services.localizationManager?TcHmi.System.Services.localizationManager.get(this.__namespace,options):(TcHmi.Log.error("[Source=Framework, Module=TcHmi.Locale.Localization] System not ready."),new TcHmi.Locale.LocalizationReader({}))}watch(callback){if(!TcHmi.System.Services.localizationManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to watch localization. System not ready.",domain:"TcHmi.Locale.Localization"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),()=>{}}return TcHmi.System.Services.localizationManager.watch(this.__namespace,void 0,(data=>{TcHmi.Callback.callSafeEx(callback,this,data)}))}watchEx(options={level:TcHmi.Locale.Level.Application},callback){if(!TcHmi.System.Services.localizationManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to watch localization. System not ready.",domain:"TcHmi.Locale.Localization"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),()=>{}}return TcHmi.System.Services.localizationManager.watch(this.__namespace,options,(data=>{TcHmi.Callback.callSafeEx(callback,this,data)}))}getText(key,options){return TcHmi.System.Services.localizationManager?TcHmi.System.Services.localizationManager.getText(this.__namespace,key,options):key}watchText(key,callback){if(!TcHmi.System.Services.localizationManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to watch localization. System not ready.",domain:"TcHmi.Locale.Localization"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),()=>{}}return TcHmi.System.Services.localizationManager.watchText(this.__namespace,key,void 0,(data=>{TcHmi.Callback.callSafeEx(callback,this,data)}))}watchTextEx(key,options={level:TcHmi.Locale.Level.Application},callback){if(!TcHmi.System.Services.localizationManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to watch localization. System not ready.",domain:"TcHmi.Locale.Localization"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),()=>{}}return TcHmi.System.Services.localizationManager.watchText(this.__namespace,key,options,(data=>{TcHmi.Callback.callSafeEx(callback,this,data)}))}};class ApplicationLocalization extends TcHmi.Locale.Localization{constructor(){super(),this.__namespace="TcHmi.System.Localization.Application"}}Locale.ApplicationLocalization=ApplicationLocalization;class ControlLocalization extends TcHmi.Locale.Localization{constructor(type){super(),this.__namespace="TcHmi.System.Localization.Control<"+type+">"}}Locale.ControlLocalization=ControlLocalization;class FunctionLocalization extends TcHmi.Locale.Localization{constructor(type){super(),this.__namespace="TcHmi.System.Localization.Function<"+type+">"}}let Level;Locale.FunctionLocalization=FunctionLocalization,function(Level){Level[Level.Application=0]="Application",Level[Level.Engineering=1]="Engineering"}(Level=Locale.Level||(Locale.Level={}))}(TcHmi.Locale||(TcHmi.Locale={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * Allows handling date and time formatting.
     * @preserve (Part of the public API)
     */
class Localization{constructor(){}static __rebuildLocalizationCache(){this.__numberFormatMilliSecondsCache.clear(),this.__dateFormatCache.clear()}static __getMillisecondsFormatter(timeFormatLocaleArg){let numberFormatMilliSeconds=this.__numberFormatMilliSecondsCache.get(timeFormatLocaleArg);if(numberFormatMilliSeconds)return numberFormatMilliSeconds;let timeFormatLocale=timeFormatLocaleArg;if(!timeFormatLocale){const config=TcHmi.System.Services.accessManager?.getCurrentUserConfig();timeFormatLocale=config?.timeFormatLocale}try{numberFormatMilliSeconds=new Intl.NumberFormat(timeFormatLocale,{style:"decimal",minimumIntegerDigits:2,minimumFractionDigits:3})}catch(e){timeFormatLocale=void 0,numberFormatMilliSeconds=new Intl.NumberFormat(timeFormatLocale,{style:"decimal",minimumIntegerDigits:2,minimumFractionDigits:3})}return this.__numberFormatMilliSecondsCache.set(timeFormatLocaleArg,numberFormatMilliSeconds),numberFormatMilliSeconds}static getDateTimeFormatter(locale,timeZone,hour12,type="full"){let level1=this.__dateFormatCache.get(locale);level1||(level1=new Map,this.__dateFormatCache.set(locale,level1));let level2=level1.get(timeZone);level2||(level2=new Map,level1.set(timeZone,level2));let level3=level2.get(hour12);level3||(level3=new Map,level2.set(hour12,level3));let formatter=level3.get(type);if(formatter)return formatter;const config=TcHmi.System.Services.accessManager?.getCurrentUserConfig();let timeFormatLocale=locale;timeFormatLocale||(timeFormatLocale=config?.timeFormatLocale);let _timeZone=timeZone;_timeZone||(_timeZone=config?.timeZone);try{new Intl.DateTimeFormat(timeFormatLocale)}catch(e){timeFormatLocale=void 0}try{new Intl.DateTimeFormat(timeFormatLocale,{timeZone:_timeZone})}catch(e){e instanceof RangeError&&(_timeZone=void 0)}let IntlOptions={timeZone:_timeZone,hour12:hour12};switch(type){case"date":IntlOptions.year="numeric",IntlOptions.month="numeric",IntlOptions.day="numeric";break;case"time":case"time-no-millisec":IntlOptions.hour="numeric",IntlOptions.minute="numeric",IntlOptions.second="numeric";break;case"full":case"full-no-millisec":IntlOptions.year="numeric",IntlOptions.month="numeric",IntlOptions.day="numeric",IntlOptions.hour="numeric",IntlOptions.minute="numeric",IntlOptions.second="numeric"}return IntlOptions.hour&&"function"!=typeof Intl.DateTimeFormat.prototype.formatToParts&&(IntlOptions.hour12=!1),formatter=new Intl.DateTimeFormat(timeFormatLocale,IntlOptions),level3.set(type,formatter),formatter}
/**
         * Skip non numeric chars and parseInt the rest.
         * MS Browsers add Left-To-Right-Mark to output
         * https://github.com/tc39/ecma402/issues/28
         * @param input string input
         * @preserve (Part of the public API)
         */static parseInt(input){let value="";for(let i=0;i<input.length;i++)input.charCodeAt(i)>=32&&input.charCodeAt(i)<=126&&(value+=input[i]);return parseInt(value,10)}
/**
         * Parses a Date object
         * formats it to a time zone and split its components into an object
         * On error all entries will be NaN
         * @param date Date object to parse
         * @param options Options
         * @preserve (Part of the public API)
         */static parseDate(date,options){const dateObject={year:NaN,month:NaN,day:NaN,hour:NaN,minute:NaN,second:NaN,millisecond:NaN};if(isNaN(date.getTime()))return dateObject;let timeZone;if(options&&"string"==typeof options.timeZone&&(timeZone=options.timeZone),"function"==typeof Intl.DateTimeFormat.prototype.formatToParts){let parts=this.getDateTimeFormatter("de-DE",timeZone,!1,"full").formatToParts(date);dateObject.year=TcHmi.Localization.parseInt(parts.find((value=>"year"===value.type)).value),dateObject.month=TcHmi.Localization.parseInt(parts.find((value=>"month"===value.type)).value),dateObject.day=TcHmi.Localization.parseInt(parts.find((value=>"day"===value.type)).value),dateObject.hour=TcHmi.Localization.parseInt(parts.find((value=>"hour"===value.type)).value),dateObject.minute=TcHmi.Localization.parseInt(parts.find((value=>"minute"===value.type)).value),dateObject.second=TcHmi.Localization.parseInt(parts.find((value=>"second"===value.type)).value),dateObject.millisecond=date.getUTCMilliseconds()}else{let formatter=this.getDateTimeFormatter("de-DE",timeZone,!1,"date"),dateArray=formatter.format(date).split(".");dateObject.year=TcHmi.Localization.parseInt(dateArray[2]),dateObject.month=TcHmi.Localization.parseInt(dateArray[1]),dateObject.day=TcHmi.Localization.parseInt(dateArray[0]),formatter=this.getDateTimeFormatter("de-DE",timeZone,!1,"time");let timeArray=formatter.format(date).split(":");dateObject.hour=TcHmi.Localization.parseInt(timeArray[0]),dateObject.minute=TcHmi.Localization.parseInt(timeArray[1]),dateObject.second=TcHmi.Localization.parseInt(timeArray[2]),dateObject.millisecond=date.getUTCMilliseconds()}return dateObject}
/**
         * Formats a Date object down to milliseconds in the correct locale and time zone (config from server user or browser default)
         * On error this will be null
         * @param date Date Object to parse
         * @param options Options
         * @preserve (Part of the public API)
         */static formatDate(date,options){if(isNaN(date.getTime()))return null;let locale,timeZone,format;options&&"string"==typeof options.locale&&(locale=options.locale),options&&"string"==typeof options.timeZone&&(timeZone=options.timeZone),options&&"string"==typeof options.type&&(format=options.type);let dateString="";if("function"==typeof Intl.DateTimeFormat.prototype.formatToParts){this.getDateTimeFormatter(locale,timeZone,void 0,format).formatToParts(date).forEach((part=>{if("second"===part.type&&"time-no-millisec"!==format&&"full-no-millisec"!==format){let secMillisec=Localization.parseInt(part.value);secMillisec%1==0&&(secMillisec+=date.getMilliseconds()/1e3);let numberFormatMilliSeconds=this.__getMillisecondsFormatter(locale);dateString+=numberFormatMilliSeconds.format(secMillisec)}else dateString+=part.value}))}else{let formatter=this.getDateTimeFormatter(locale,timeZone,!1,format);if(dateString=formatter.format(date),!options||"date"!==options.type&&"time-no-millisec"!==format&&"full-no-millisec"!==format){let fractionString=this.__getMillisecondsFormatter(locale).format(date.getMilliseconds()/1e3);dateString+=fractionString.slice(2)}}return dateString}}Localization.__numberFormatMilliSecondsCache=new Map,Localization.__dateFormatCache=new Map,TcHmi.Localization=Localization}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.LocalStorage=
/**
     * Encapsulates access to the browsers localStorage. Provides methods to set, get and delete Items from localStorage
     * that take and return properly typed values. Has a validation mechanism that automatically deletes items if their
     * default initial value changes between class instantiations.
     * @preserve (Part of the public API)
     */
class{constructor(nameOrControl,__validationValues){this.__validationValues=__validationValues;const namePrefix=TcHmi.System.hostPrefix+"TcHmi.LocalStorage.data:",name="string"==typeof nameOrControl?nameOrControl:nameOrControl.getType()+":"+nameOrControl.getId();this.__name=namePrefix+name;let stored=window.localStorage.getItem(this.__name);if(null===stored){const legacyNamePrefix="TCHMI_STORAGE_USERDATA_";if(stored=window.localStorage.getItem(legacyNamePrefix+name),null!==stored)try{window.localStorage.setItem(this.__name,stored),window.localStorage.removeItem(legacyNamePrefix+name)}catch(ex){}}if(stored)try{this.__storage=JSON.parse(stored),"object"!=typeof this.__storage&&(this.__storage={})}catch(ex){this.__storage={}}else this.__storage={};for(const[key,value]of Object.entries(this.__validationValues)){const storageEntry=this.__storage[key];storageEntry&&"validation"in storageEntry&&!tchmi_equal(value,storageEntry.validation.expectedValue)&&this.delete(key)}}
/**
         * Sets a stored value for the current user. Returns a boolean that indicates if writing to localStorage was successful.
         * @param key The key of the value to set.
         * @param value The value to set.
         * @preserve (Part of the public API)
         */set(key,value){const user=TcHmi.Server.getCurrentUser();if(!user)return!1;let storageForKey=this.__storage[key];if(!storageForKey){const validationValue=this.__validationValues[key];storageForKey=void 0!==validationValue?{validation:{expectedValue:validationValue}}:{},this.__storage[key]=storageForKey}storageForKey.users||(storageForKey.users={}),storageForKey.users[user]=value;try{window.localStorage.setItem(this.__name,JSON.stringify(this.__storage))}catch(ex){return TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warnEx("[Source=Framework, Module=TcHmi.Storage] Failed to set item in localStorage. This could be caused by missing permissions or the available storage being full."+(ex instanceof Error?` Exception: ${ex.message}`:"")),!1}return!0}
/**
         * Sets a stored value for the current user only if a stored value is already set or the new value to be stored
         * is not equal to the validationValue. This is useful if you want to avoid writing a value into localStorage if
         * that value is already equal to the default value anyway. Returns a boolean that indicates if a new value was set.
         * @param key The key of the value to set.
         * @param value The value to set.
         * @preserve (Part of the public API)
         */setWithValidation(key,value){const user=TcHmi.Server.getCurrentUser();if(!user)return!1;const valueEqualsValidation=key in this.__validationValues&&tchmi_equal(value,this.__validationValues[key]);let storageForKey=this.__storage[key];if(!storageForKey){if(valueEqualsValidation)return!1;const validationValue=this.__validationValues[key];storageForKey=void 0!==validationValue?{validation:{expectedValue:validationValue}}:{},this.__storage[key]=storageForKey}if(!storageForKey.users?.[user]&&valueEqualsValidation)return!1;storageForKey.users||(storageForKey.users={}),storageForKey.users[user]=value;try{window.localStorage.setItem(this.__name,JSON.stringify(this.__storage))}catch(ex){return TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warnEx("[Source=Framework, Module=TcHmi.Storage] Failed to set item in localStorage. This could be caused by missing permissions or the available storage being full."+(ex instanceof Error?` Exception: ${ex.message}`:"")),!1}return!0}
/**
         * Returns the stored value associated with the given key for the current user.
         * @param key The key to read.
         * @preserve (Part of the public API)
         */get(key){const user=TcHmi.Server.getCurrentUser();if(!user)return;const storageForKey=this.__storage[key];return storageForKey&&storageForKey.users?storageForKey.users[user]:void 0}
/**
         * Deletes a stored value for the current user.
         * @param key The key of the value to delete.
         * @preserve (Part of the public API)
         */delete(key){const storageForKey=this.__storage[key];if(storageForKey){const user=TcHmi.Server.getCurrentUser();if(!user)return;storageForKey.users&&(delete storageForKey.users[user],0===Object.keys(storageForKey.users).length&&delete this.__storage[key])}if(Object.keys(this.__storage).length>0)try{window.localStorage.setItem(this.__name,JSON.stringify(this.__storage))}catch(ex){}else window.localStorage.removeItem(this.__name)}}}(TcHmi||(TcHmi={})),function(TcHmi){class Log{}Log.Prefix=!0,Log.Force=!1,TcHmi.Log=Log,
/**
     * Provides functions for logging.
     * @preserve (Part of the public API)
     */
function(Log){let __il=new class{constructor(){if(this.__db=null,this.__cache=[],this.__ready=!1,this.__error=!1,TCHMI_CONSOLE_LOG_PERSISTENT)if(window.indexedDB){let request=null;try{request=window.indexedDB.open("TcHmi.Log")}catch(e){this.__ready=!1,this.__error=!0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because of unexpected exception while opening database:\n",e)}null!==request&&(request.onerror=e=>{this.__ready=!1,this.__error=!0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because of request.onerror:\n",e)},request.onsuccess=e=>{this.__db=request.result,this.__ready=!0},request.onupgradeneeded=e=>{this.__db=e.target.result;try{this.__db.createObjectStore("data",{keyPath:"id",autoIncrement:!0}),this.__ready=!0}catch(e){this.__ready=!1,this.__error=!0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because of unexpected exception in request.onupgradeneeded event handler:\n",e)}})}else this.__ready=!1,this.__error=!0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because IndexedDB API is missing in your browser.")}add(timespan,type,message,...optionalParameters){if(!TCHMI_CONSOLE_LOG_PERSISTENT)return;if(!window.indexedDB)return;let optionalParametersPrepared=[];for(let i=0,ii=optionalParameters.length;i<ii;i++){let op=optionalParameters[i];try{if(null!==op&&"object"==typeof op){op=__tchmi_is_instanced_object(op)?op.constructor&&op.constructor.name?'[IndexedDBLog: Serializing data not possible for type: "object" with constructor: "'+op.constructor.name+'"]':'[IndexedDBLog: Serializing data not possible for type: "object"]':JSON.parse(JSON.stringify(op,((key,value)=>{if("function"==typeof value)return"[IndexedDBLog: Serializing data not possible for type: 'function']";if("object"==typeof value){return __tchmi_is_instanced_object(value)?value?.constructor?.name?'[IndexedDBLog: Serializing data not possible for type: "object" with constructor: "'+value.constructor.name+'"]':"[IndexedDBLog: Serializing data not possible for type: 'object']":value}return value})))}else null!==op&&"function"==typeof op&&(op='[IndexedDBLog: Serializing data not possible for type: "function"]')}catch(e){op='[IndexedDBLog: Serializing data failed with exception: "'+e+'"]'}optionalParametersPrepared.push(op)}if(!this.__ready)return void(this.__error||this.__cache.push({timespan:timespan,type:type,message:message,optionalParameters:optionalParametersPrepared}));if(this.__cache&&this.__cache.length>0){let cache=this.__cache;for(this.__cache=[];cache.length>0;){let entry=cache.shift();this.add(entry.timespan,entry.type,entry.message,...entry.optionalParameters)}}if(!this.__db)return;let ta=null;try{ta=this.__db.transaction(["data"],"readwrite")}catch(e){this.__ready=!1,this.__error=!0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because of unexpected exception:\n",e)}if(!ta)return;let os=null;try{os=ta.objectStore("data")}catch(e){this.__ready=!1,this.__error=!0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because of unexpected exception:\n",e)}if(!os)return;let count=null;try{count=os.count()}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because of unexpected exception:\n",e),this.__ready=!1,this.__error=!0}count&&(count.onsuccess=e=>{let count=e.target.result;if(count+1>TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES){let cdel=count+1-TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES,cdone=0,cursor=null;try{cursor=os.openCursor()}catch(e){this.__ready=!1,this.__error=!0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because of unexpected exception:\n",e)}if(!cursor)return;cursor.onerror=e=>{this.__ready=!1,this.__error=!0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because of unexpected exception:\n",e)},cursor.onsuccess=e=>{let cursor=e.target.result;if(cursor)return cdone<cdel?(cdone++,cursor.delete(),void cursor.continue()):void os.add({timespan:timespan,type:type,message:message,optionalParameters:optionalParametersPrepared})}}else os.add({timespan:timespan,type:type,message:message,optionalParameters:optionalParametersPrepared})})}},__oldTimerName=null,__performanceLogCache=new Map;window.addEventListener("error",(e=>{TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&__il.add(Date.now(),"Error",e.error.stack)})),Log.error=
/**
         * Prints out an error message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 1 or higher.
         * If the message is an object it will be inspectable in most debug tools. See errorEx if you want to show multiple objects.
         * Can log into a browser database, too. See "client" page in config page of the server.
         * @param message The text which will be printed out in the browsers console.
         * @param forceNoPrefix If set the date will be hidden
         * @preserve (Part of the public API)
         */
function(message,forceNoPrefix=!1){TCHMI_CONSOLE_LOG_LEVEL<1&&!TcHmi.Log.Force||(console&&console.error&&!TcHmi.System.isUnloaded&&(!0===TcHmi.Log.Prefix&&!1===forceNoPrefix&&"object"!=typeof message?console.error("["+(new Date).toISOString()+"][Error] "+message):console.error(message)),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&("string"==typeof message?__il.add(Date.now(),"Warning",message):__il.add(Date.now(),"Warning","",message)))},Log.errorEx=
/**
         * Prints out an error message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 1 or higher.
         * Can log into a browser database, too. See "client" page in config page of the server.
         * @param message The text which will be printed out in the browsers console.
         * @param optionalParameters Optional parameters
         * @preserve (Part of the public API)
         */
function(message,...optionalParameters){TCHMI_CONSOLE_LOG_LEVEL<1&&!TcHmi.Log.Force||(console&&console.error&&!TcHmi.System.isUnloaded&&(TcHmi.Log.Prefix&&(message="["+(new Date).toISOString()+"][Error] "+message),console.error(message,...optionalParameters)),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&__il.add(Date.now(),"Error",message,...optionalParameters))},Log.warn=
/**
         * Prints out a warning message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 2 or higher.
         * If the message is an object it will be inspectable in most debug tools. See warnEx if you want to show multiple objects.
         * Can log into a browser database, too. See "client" page in config page of the server.
         * @param message The text which will be printed out in the browsers console
         * @param forceNoPrefix If set the date will be hidden
         * @preserve (Part of the public API)
         */
function(message,forceNoPrefix=!1){TCHMI_CONSOLE_LOG_LEVEL<2&&!TcHmi.Log.Force||(console&&console.warn&&!TcHmi.System.isUnloaded&&(!0===TcHmi.Log.Prefix&&!1===forceNoPrefix&&"object"!=typeof message?console.warn("["+(new Date).toISOString()+"][Warning] "+message):console.warn(message)),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&("string"==typeof message?__il.add(Date.now(),"Warning",message):__il.add(Date.now(),"Warning","",message)))},Log.warnEx=
/**
         * Prints out a warning message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 2 or higher.
         * Can log into a browser database, too. See "client" page in config page of the server.
         * @param message The text which will be printed out in the browsers console.
         * @param optionalParameters Optional parameters
         * @preserve (Part of the public API)
         */
function(message,...optionalParameters){TCHMI_CONSOLE_LOG_LEVEL<2&&!TcHmi.Log.Force||(console&&console.warn&&!TcHmi.System.isUnloaded&&(TcHmi.Log.Prefix&&(message="["+(new Date).toISOString()+"][Warning] "+message),console.warn(message,...optionalParameters)),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&__il.add(Date.now(),"Warning",message,...optionalParameters))},Log.info=
/**
         * Prints out an info message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 3 or higher.
         * If the message is an object it will be inspectable in most debug tools. See infoEx if you want to show multiple objects.
         * Can log into a browser database, too. See "client" page in config page of the server.
         * @param message The text which will be printed out in the browsers console
         * @param forceNoPrefix If set the date will be hidden
         * @preserve (Part of the public API)
         */
function(message,forceNoPrefix=!1){TCHMI_CONSOLE_LOG_LEVEL<3&&!TcHmi.Log.Force||(console&&console.info&&!TcHmi.System.isUnloaded&&(!0===TcHmi.Log.Prefix&&!1===forceNoPrefix&&"object"!=typeof message?console.info("["+(new Date).toISOString()+"][Info] "+message):console.info(message)),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&("string"==typeof message?__il.add(Date.now(),"Info",message):__il.add(Date.now(),"Info","",message)))},Log.infoEx=
/**
         * Prints out an info message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 3 or higher.
         * Can log into a browser database, too. See "client" page in config page of the server.
         * @param message The text which will be printed out in the browsers console.
         * @param optionalParameters Optional parameters
         * @preserve (Part of the public API)
         */
function(message,...optionalParameters){TCHMI_CONSOLE_LOG_LEVEL<3&&!TcHmi.Log.Force||(console&&console.info&&!TcHmi.System.isUnloaded&&(TcHmi.Log.Prefix&&(message="["+(new Date).toISOString()+"][Info] "+message),console.info(message,...optionalParameters)),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&__il.add(Date.now(),"Info",message,...optionalParameters))},Log.debug=
/**
         * Prints out a debug message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 4 or higher.
         * If the message is an object it will be inspectable in most debug tools. See debugEx if you want to show multiple objects.
         * Can log into a browser database, too. See "client" page in config page of the server.
         * @param message The text which will be printed out in the browsers console.
         * @param forceNoPrefix If set the date will be hidden
         * @preserve (Part of the public API)
         */
function(message,forceNoPrefix=!1){TCHMI_CONSOLE_LOG_LEVEL<4&&!TcHmi.Log.Force||(console&&console.log&&!TcHmi.System.isUnloaded&&(!0===TcHmi.Log.Prefix&&!1===forceNoPrefix&&"object"!=typeof message?console.log("["+(new Date).toISOString()+"][Debug] "+message):console.log(message)),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&("string"==typeof message?__il.add(Date.now(),"Debug",message):__il.add(Date.now(),"Debug","",message)))},Log.debugEx=
/**
         * Prints out a debug message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 4 or higher.
         * Can log into a browser database, too. See "client" page in config page of the server.
         * @param message The text which will be printed out in the browsers console.
         * @param optionalParameters Optional parameters
         * @preserve (Part of the public API)
         */
function(message,...optionalParameters){TCHMI_CONSOLE_LOG_LEVEL<4&&!TcHmi.Log.Force||(console&&console.log&&!TcHmi.System.isUnloaded&&(TcHmi.Log.Prefix&&(message="["+(new Date).toISOString()+"][Debug] "+message),console.log(message,...optionalParameters)),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&__il.add(Date.now(),"Debug",message,...optionalParameters))},Log.performanceLog=function(timerName){if((!(TCHMI_CONSOLE_LOG_LEVEL<4)||TcHmi.Log.Force)&&window.console&&window.console.time&&window.console.timeEnd){let intTimerName="["+(new Date).toISOString()+"][Performance] "+timerName;null!==__oldTimerName&&window.console.timeEnd(__oldTimerName),"[Source=Framework, Module=TcHmi] End"!==timerName?(window.console.time(intTimerName),__oldTimerName=intTimerName):__oldTimerName=null}},Log.performanceLogStart=function(timerName){TCHMI_CONSOLE_LOG_LEVEL<4&&!TcHmi.Log.Force||(window.console&&window.console.time&&window.console.time(timerName),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&window.performance&&window.performance.now&&(__performanceLogCache.set(timerName,window.performance.now()),__il.add(Date.now(),"Debug","Timer: '"+timerName+"' started.")))},Log.performanceLogEnd=function(timerName){if((!(TCHMI_CONSOLE_LOG_LEVEL<4)||TcHmi.Log.Force)&&(window.console&&window.console.timeEnd&&window.console.timeEnd(timerName),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&window.performance&&window.performance.now)){let start=__performanceLogCache.get(timerName);if(__performanceLogCache.delete(timerName),void 0!==start){let end=window.performance.now();__il.add(Date.now(),"Debug","Timer: '"+timerName+"' finished after "+(end-start)+"ms.")}}},Log.buildMessage=
/**
         * Builds a formatted message of hierarchical error objects
         * @param error Error object to show nicely
         * @preserve (Part of the public API)
         */
function(error){const __buildMessage=function(error,level){if(!error)return"";let res="",indention="  ".repeat(level+1);if(error.code&&(res+="Code: "+error.code+"/0x"+error.code.toString(16)),error.message&&(res+=", Message: "+error.message),error.reason&&(res+="\n"+indention+"Reason: "+error.reason),error.exception&&(res+="\n"+indention+"Exception: "+error.exception),error.domain&&(res+="\n"+indention+"Domain: "+error.domain),void 0!==error.errors&&error.errors.length){res+="\n"+indention+"as result of: ";for(let[index,errorItem]of error.errors.entries())res+=__buildMessage(errorItem,level+1),index!==error.errors.length-1&&(res+="\n"+indention)}return res};return __buildMessage(error,0)}}(Log=TcHmi.Log||(TcHmi.Log={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * Convenience functionality for dealing with TwinCAT HMI object path syntax.
     * @preserve (Part of the public API)
     */
class ObjectPath{constructor(pathOrTokens){if("string"==typeof pathOrTokens)this.__path=pathOrTokens;else{let res="",tokens=pathOrTokens;for(let i=0,ii=tokens.length;i<ii;i++){let token=tokens[i];if("string"==typeof token){if(0===token.length)throw new Error("Invalid token '"+token+"' found in token array '"+JSON.stringify(tokens)+"'. Empty string tokens are not allowed.");if(token.includes("::"))throw new Error("Invalid token '"+token+"' found in token array '"+JSON.stringify(tokens)+"'. The sequence '::' is not allowed as token because this is the token separator.");0===res.length||token.length>1&&token.startsWith("[")&&token.endsWith("]")?res+=token:res+="::"+token}else res+="["+token+"]"}this.__path=res}}
/**
         * Returns the path as string.
         * @preserve (Part of the public API)
         */toString(){return this.__path}__split(options){let res=[],noArrayBrackes=options?.noArrayBrackets??!1,tokens=this.__path.split("::");for(let i=0,ii=tokens.length;i<ii;i++){let token=tokens[i];if(i>0&&0===token.length)throw new Error("Invalid token '"+token+"' found in path '"+this.__path+"'. Empty string tokens are not allowed. At least one character has to occurr before and after a '::' sequence which is not at the beginning of the path.");let temp="",bracketsContent="",bracketsOpened=0,bracketsClosed=0;for(let j=0,jj=token.length;j<jj;j++){let c=token[j];if("["===c&&temp.length>0){if(bracketsOpened++,bracketsOpened>bracketsClosed+1)throw new Error("Invalid token '"+token+"' found in path '"+this.__path+"'. Multiple opening brackets before closing brackets.");bracketsContent="",res.push(temp),temp="",noArrayBrackes||(temp+=c)}else if("]"===c){if(bracketsClosed++,bracketsOpened<bracketsClosed)throw new Error("Invalid token '"+token+"' found in path '"+this.__path+"'. Unexpected closing brackets.");if(token.length>j+1&&"["!==token[j+1])throw new Error("Invalid token '"+token+"' found in path '"+this.__path+"'. Unexpected token after closing brackets.");if(noArrayBrackes){let num=parseInt(bracketsContent,10);if(Number.isNaN(num))throw new Error("Invalid token '"+token+"' found in path '"+this.__path+"'. Unexpected token in brackets. Only numeric indices are allowed.");res.push(num)}else temp+=c,res.push(temp);temp=""}else{if("["===c){if(bracketsOpened++,bracketsOpened>bracketsClosed+1)throw new Error("Invalid token '"+token+"' found in path '"+this.__path+"'. Unexpected closing brackets.");bracketsContent=""}(!noArrayBrackes||noArrayBrackes&&"["!==c&&"]"!==c)&&(temp+=c),"["!==c&&"]"!==c&&(bracketsContent+=c),j===jj-1&&temp.length>0&&res.push(temp)}}if(bracketsOpened>bracketsClosed)throw new Error("Invalid token '"+token+"' found in path '"+this.__path+"'. Missing closing brackets.")}return res}
/**
         * Splits the object path into tokens.
         * @preserve (Part of the public API)
         */toPathTokens(){return this.__split()}
/**
         * Splits the object path into tokens but converts tokens like [0] into 0 which can directly be used as property accessor.
         * @preserve (Part of the public API)
         */toPropertyAccessors(){return this.__split({noArrayBrackets:!0})}static toString(tokens){if(0===arguments.length)return Object.toString.call(this);return new ObjectPath(tokens).toString()}
/**
         * Splits path into tokens.
         * @param path
         * @preserve (Part of the public API)
         */static toPathTokens(path){return new ObjectPath(path).toPathTokens()}
/**
         * Splits path into tokens but converts tokens like [0] into 0 which can directly be used as property accessor.
         * @param path
         * @preserve (Part of the public API)
         */static toPropertyAccessors(path){return new ObjectPath(path).toPropertyAccessors()}}TcHmi.ObjectPath=ObjectPath}(TcHmi||(TcHmi={}));var __classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(receiver,state,kind,f){if("a"===kind&&!f)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof state?receiver!==state||!f:!state.has(receiver))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===kind?f:"a"===kind?f.call(receiver):f?f.value:state.get(receiver)},TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi;
/**
 * Converts string "\t"/"\n" (symbol world) to tab/newline (HTML world).
 * This supports escaping with "\\n"
 *
 * Some controls converted newline to space in all released tchmi versions.
 * So this helper can do this with the options.newlineToSpace, but
 * do not use that parameter for new controls.
 *
 * You also probably do not need options.preserveBackslash for controls.
 *
 * @param text The text to escape
 * @param options options
 * @returns The decoded representation of parameter text.
 * @preserve (Part of the public API)
 */
function tchmi_decode_control_characters(text,options){if(!text)return"";const newlineToSpace="boolean"==typeof options?options:options?.newlineToSpace??!1,preserveBackslash="boolean"!=typeof options&&(options?.preserveBackslash??!1);if("string"!=typeof text){if("function"!=typeof text.toString)return text;text=text.toString()}if(!text.includes("\\")&&!newlineToSpace)return text;newlineToSpace&&(text=text.replace(/^\\n|([^\\])\\n/g,"$1 ").replace(/^\\r|([^\\])\\r/g,"$1 "));let decoded="",prevIndex=0,index=text.indexOf("\\");for(;-1!==index;){decoded+=text.slice(prevIndex,index);let nextChar=text.charAt(index+1);switch(nextChar){case"n":decoded+="\n";break;case"r":decoded+="\r";break;case"t":decoded+="\t";break;case"\\":preserveBackslash&&"n"!==text.charAt(index+2)&&"r"!==text.charAt(index+2)&&"t"!==text.charAt(index+2)?decoded+="\\\\":decoded+="\\";break;default:decoded+=nextChar}prevIndex=index+2,index=text.indexOf("\\",prevIndex)}return decoded+=text.slice(prevIndex),decoded}
/**
 * Converts tab/newline (HTML world) to string "\t"/"\n" (symbol world).
 * This supports escaping with "\\t"
 *
 * @param text The text to encode
 * @returns The encoded representation of parameter text.
 * @preserve (Part of the public API)
 */function tchmi_encode_control_characters(text){if(!text)return"";if("string"!=typeof text){if("function"!=typeof text.toString)return text;text=text.toString()}return text.replace(/\\/gm,"\\\\").replace(/\n/gm,"\\n").replace(/\r/gm,"\\r").replace(/\t/gm,"\\t")}
/**
 * Encodes HTML
 * @param html The html to encode
 * @returns The encoded representation of parameter html.
 * @preserve (Part of the public API)
 */function tchmi_encode_html(html){return"string"!=typeof html&&"function"==typeof html.toString&&(html=html.toString()),String(html).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}
/**
 * Decodes HTML
 * @param text The text to decode
 * @returns The decoded representation of parameter text.
 * "&#176;!\"&#167;$%&/()=?~#|&#233;&#232;€…™&#174;&#169;"
 * "°     !\"§     $%&/()=?~#|é     è     €…™®     ©"
 * @preserve (Part of the public API)
 */function tchmi_decode_html(text){return"string"!=typeof text&&"function"==typeof text.toString&&(text=text.toString()),String(text).replace(/\&amp;/g,"&").replace(/\&lt;/g,"<").replace(/\&gt;/g,">").replace(/\&quot;/g,'"').replace(/\&#39;/g,"'").replace(/\&#228;/g,"ä").replace(/\&#196;/g,"Ä").replace(/\&#246;/g,"ö").replace(/\&#214;/g,"Ö").replace(/\&#252;/g,"ü").replace(/\&#220;/g,"Ü").replace(/\&#223;/g,"ß").replace(/\&#233;/g,"é").replace(/\&#232;/g,"è").replace(/\&#176;/g,"°").replace(/\&#167;/g,"§").replace(/\&#174;/g,"®").replace(/\&#169;/g,"©").replace(/\&#181;/g,"µ")}
/**
 * Converts formatted text to formatted html.
 * @param text The text which contains the formatting placeholders which shall be encoded.
 * @returns The encoded representation of parameter text.
 * @preserve (Part of the public API)
 */function tchmi_text_to_html(text){"string"!=typeof text&&"function"==typeof text.toString&&(text=text.toString());let res=text,eSpacesCount=0;for(let i=res.length-1,ii=0;i>=ii;i--){if(" "!==res[i])break;eSpacesCount++}res=res.substr(0,res.length-eSpacesCount),res=res.replace(/\\s\\s/g," &nbsp;"),res=res.replace(/  /g," &nbsp;"),res=res.replace(/\\t/g,"&nbsp;&nbsp;&nbsp;");let eSpacesParts=[];for(let i=0,ii=eSpacesCount;i<ii;i++)i%2==0?eSpacesParts.push("&nbsp;"):eSpacesParts.push(" ");for(let i=eSpacesParts.length-1,ii=0;i>=ii;i--)res+=eSpacesParts[i];return res=res.replace(/\\r\\n/g,"<br/>"),res=res.replace(/\\n/g,"<br/>"),res}
/**
 * Decode base64 strings
 * Attention: JS strings are UTF16!
 * @param input
 * @returns Returns the String or null
 * @preserve (Part of the public API)
 */function tchmi_base64decode(input){return"string"!=typeof input&&"function"==typeof input.toString&&(input=input.toString()),window.atob(input)}
/**
 * Encode base64 strings
 * Attention: JS strings are UTF16!
 * @param input String to encode
 * @returns Returns the String or null
 * @preserve (Part of the public API)
 */function tchmi_base64encode(input){return"string"!=typeof input&&"function"==typeof input.toString&&(input=input.toString()),window.btoa(input)}
/**
 * Creates a Guid string.
 * @returns Guid
 * @preserve (Part of the public API)
 */function tchmi_create_guid(){if(window.crypto.randomUUID)return window.crypto.randomUUID();let d=performance.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(c){let r=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"===c?r:7&r|8).toString(16)}))}
/**
 * Compares 2 values for equality.
 * @param a Value 1
 * @param b Value 2
 * @param typeSafeOrOptions A boolean or option object to define how the values should be compared.
 * If it is a boolean, a value of false will perform a type unsafe comparison, i.e. 1 == "1", while
 * a value of true will cause the function to only consider the values equal if their types are also equal.
 * @preserve (Part of the public API)
 */function tchmi_equal(a,b,typeSafeOrOptions=!0){if(a===b)return!0;if(null===a||null===b)return!1;let options={convertPrimitives:!1,compareDates:!1};"boolean"==typeof typeSafeOrOptions?options.convertPrimitives=!typeSafeOrOptions:(options.convertPrimitives=typeSafeOrOptions.convertPrimitives??!1,options.compareMaps=typeSafeOrOptions.compareMaps,options.compareSets=typeSafeOrOptions.compareSets,options.compareDates=typeSafeOrOptions.compareDates??!1);let typeA=typeof a,typeB=typeof b;if(typeA!==typeB){if(options.convertPrimitives)switch(typeA){case"boolean":switch(typeB){case"number":return a==b;case"string":return a.toString()===b.toLowerCase()}break;case"number":switch(typeB){case"boolean":return a==b;case"string":return""!==b&&a==b}break;case"string":switch(typeB){case"boolean":return a.toLowerCase()===b.toString();case"number":return""!==a&&a==b}}return!1}if("number"===typeA&&isNaN(a)&&isNaN(b))return!0;if(a instanceof Map&&b instanceof Map&&options.compareMaps){if(a.size!==b.size)return!1;const aIterator=a.entries(),bIterator=b.entries();let aResult=aIterator.next(),bResult=bIterator.next();for(;!aResult.done&&!bResult.done;){const[aKey,aValue]=aResult.value,[bKey,bValue]=bResult.value;if(options.compareMaps.deepCompareKeys){if(!tchmi_equal(aKey,bKey,typeSafeOrOptions))return!1}else if(aKey!==bKey)return!1;if(options.compareMaps.deepCompareValues){if(!tchmi_equal(aValue,bValue,typeSafeOrOptions))return!1}else if(aValue!==bValue)return!1;aResult=aIterator.next(),bResult=bIterator.next()}return!0}if(a instanceof Set&&b instanceof Set&&options.compareSets){if(a.size!==b.size)return!1;const aIterator=a.values(),bIterator=b.values();let aResult=aIterator.next(),bResult=bIterator.next();for(;!aResult.done&&!bResult.done;){if(options.compareSets.deepCompareValues){if(!tchmi_equal(aResult.value,bResult.value,typeSafeOrOptions))return!1}else if(aResult.value!==bResult.value)return!1;aResult=aIterator.next(),bResult=bIterator.next()}return!0}if(a instanceof Date&&b instanceof Date&&options.compareDates)return a.valueOf()===b.valueOf();if("object"!==typeA||__tchmi_is_instanced_object(a)||__tchmi_is_instanced_object(b))return!1;let aIsArray=Array.isArray(a);if(aIsArray!==Array.isArray(b))return!1;if(aIsArray){let length=a.length;if(length!==b.length)return!1;for(let i=0;i<length;i++)if(!tchmi_equal(a[i],b[i],typeSafeOrOptions))return!1;return!0}if(Object.keys(a).length!==Object.keys(b).length)return!1;for(let key in a){if(!b.hasOwnProperty(key))return!1;if(!tchmi_equal(a[key],b[key],typeSafeOrOptions))return!1}return!0}!function(TcHmi){
/**
     * Provides functions for interaction with the TwinCAT HMI Server.
     * @preserve (Part of the public API)
     */
class Server{
/**
         * Returns the current readyState value of the underlying websocket which is connected to the TwinCAT HMI Server. Returns null when system is not ready.
         * Use constants like WebSocket.CLOSED or WebSocket.OPEN for comparison.
         * @returns The current readyState value of the underlying websocket which is connected to the TwinCAT HMI Server or null.
         * @preserve (Part of the public API)
         */
static getWebsocketReadyState(){return TcHmi.System.Services.serverManager?TcHmi.System.Services.serverManager.getWebsocketReadyState():null}
/**
         * Returns true if the websocket is ready and false if its not.
         * @returns If true the websocket is ready for connectivity.
         * @preserve (Part of the public API)
         */static isWebsocketReady(){return TcHmi.System.Services.serverManager?.getWebsocketReadyState()===WebSocket.OPEN}static getApiVersion(){return TcHmi.System.Services.serverManager?TcHmi.System.Services.serverManager.getApiVersion():null}
/**
         * Write one or more values to a TwinCAT HMI Server symbol.
         * @param symbolName The target TwinCAT HMI Server symbolname.
         * @param value The value which should be written to the target symbol.
         * @param callback Asynchronous response callback which will be raised if the operation has finished.
         * @returns Request id
         * @template W Type of the write value. Use any (or omit) if this contains multiple different types.
         * @template R Type of the read value. Use any (or omit) if this contains multiple different types.
         * @preserve (Part of the public API)
         */static writeSymbol(symbolName,value,callback){return Server.writeSymbolEx(symbolName,value,null,callback)}
/**
         * Write one or more values to a TwinCAT HMI Server symbol.
         * @param symbolName The target TwinCAT HMI Server symbolname.
         * @param value The value which should be written to the target symbol.
         * @param requestOptions Options for the request itself
         * @param callback Asynchronous response callback which will be raised if the operation has finished.
         * @returns Request id
         * @template W Type of the write value. Use any (or omit) if this contains multiple different types.
         * @template R Type of the read value. Use any (or omit) if this contains multiple different types.
         * @preserve (Part of the public API)
         */static writeSymbolEx(symbolName,value,requestOptions,callback){if(!TcHmi.System.Services.serverManager)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.Server"}}),null;let symbolNameArr,symbolValueArr;if(Array.isArray(symbolName)){if(!Array.isArray(value)||symbolName.length!==value.length)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Symbol array length does not match value array length",domain:"TcHmi.Server"}}),null;symbolNameArr=symbolName,symbolValueArr=value}else symbolNameArr=[symbolName],symbolValueArr=[value];const request={requestType:"ReadWrite",commands:[]};for(let i=0;i<symbolNameArr.length;i++){let strSymbolName=symbolNameArr[i],SymbolValue=symbolValueArr[i];if(TcHmi.System.isParameterTypeInvalid(strSymbolName,"symbolName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server",callback))return null;request.commands.push({commandOptions:["SendErrorMessage","SendWriteValue"],symbol:strSymbolName,writeValue:SymbolValue})}return TcHmi.System.Services.serverManager.requestEx(request,requestOptions,Server.__handleServerResponse({completed:data=>{TcHmi.Callback.callSafeEx(callback,null,data)}}))}
/**
         * Reads the value of a TwinCAT HMI Server symbol.
         * @param symbolName The target TwinCAT HMI Server symbolname.
         * @param callback Asynchronous response callback which will be raised if the operation has finished. The callback function gets 'error' (TcHmi.Errors.E_WEBSOCKET_NOT_READY or TcHmi.Errors.NONE) and the response
         * @returns Request id
         * @template W Type of the write value.
         * @template R Type of the read value.
         * @preserve (Part of the public API)
         */static readSymbol(symbolName,callback){return Server.readSymbolEx(symbolName,null,callback)}
/**
         * Reads the value of a TwinCAT HMI Server symbol.
         * @param symbolName The target TwinCAT HMI Server symbolname.
         * @param requestOptions Options for the request itself
         * @param callback Asynchronous response callback which will be raised if the operation has finished. The callback function gets 'error' (TcHmi.Errors.E_WEBSOCKET_NOT_READY or TcHmi.Errors.NONE) and the response
         * @returns Request id
         * @template W Type of the write value.
         * @template R Type of the read value.
         * @preserve (Part of the public API)
         */static readSymbolEx(symbolName,requestOptions,callback){if(!TcHmi.System.Services.serverManager)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.Server"}}),null;let symbolNameArr;if(Array.isArray(symbolName)){if(TcHmi.System.isParameterTypeInvalid(symbolName,"symbolName",{type:"string",expectArray:!0,required:"valueNeeded",minStringLength:1},"TcHmi.Server",callback))return null;symbolNameArr=symbolName}else{if(TcHmi.System.isParameterTypeInvalid(symbolName,"symbolName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server",callback))return null;symbolNameArr=[symbolName]}const request={requestType:"ReadWrite",commands:[]};for(let i=0;i<symbolNameArr.length;i++){let strSymbolName=symbolNameArr[i];request.commands.push({commandOptions:["SendErrorMessage","SendWriteValue"],symbol:strSymbolName})}return TcHmi.System.Services.serverManager.requestEx(request,requestOptions,Server.__handleServerResponse({completed:data=>{TcHmi.Callback.callSafeEx(callback,null,data)}}))}
/**
         * Requests a message to the hmi server with default connection parameter
         * @param request Request object
         * @param callback Asynchronous response callback which will be raised if the operation has finished. The callback function gets 'error' (TcHmi.Errors.E_WEBSOCKET_NOT_READY or TcHmi.Errors.NONE) and the response
         * @returns Request id
         * @template W Type of the write value. Use any (or omit) if this contains multiple different types.
         * @template R Type of the read value. Use any (or omit) if this contains multiple different types.
         * @preserve (Part of the public API)
         */static request(request,callback){return Server.requestEx(request,null,callback)}
/**
         * Requests a message to the hmi server with given connection parameter
         * @param request Request object
         * @param requestOptions Options for the request itself
         * @param callback Asynchronous response callback which will be raised if the operation has finished. The callback function gets 'error' (TcHmi.Errors.E_WEBSOCKET_NOT_READY or TcHmi.Errors.NONE) and the response
         * @returns Request id
         * @template W Type of the write value. Use any (or omit) if this contains multiple different types.
         * @template R Type of the read value. Use any (or omit) if this contains multiple different types.
         * @preserve (Part of the public API)
         */static requestEx(request,requestOptions,callback){return TcHmi.System.Services.serverManager?TcHmi.System.Services.serverManager.requestEx(request,requestOptions,Server.__handleServerResponse({completed:data=>{TcHmi.Callback.callSafeEx(callback,null,data)}})):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.Server"}}),null)}
/**
         * Subscribe to a to a list of commands.
         * Subscription have to be unsubscribed by use of the TcHmi.Server.unsubscribe function.
         * @param commands Command object with the subscription
         * @param interval Subscription refresh interval.
         * @param callback Asynchronous response callback which will be raised if the operation has finished.
         * @returns Request id
         * @template R Type of the read value. Use any (or omit) if this contains multiple different types.
         * @preserve (Part of the public API)
         */static subscribe(commands,interval,callback){return Server.subscribeEx(commands,interval,null,callback)}
/**
         * Subscribe to a to a list of commands.
         * Subscription have to be unsubscribed by use of the TcHmi.Server.unsubscribe function.
         * @param commands Command object with the subscription
         * @param interval Subscription refresh interval.
         * @param requestOptions Options for the request itself
         * @param callback Asynchronous response callback which will be raised if the operation has finished.
         * @returns Request id
         * @template R Type of the read value. Use any (or omit) if this contains multiple different types.
         * @preserve (Part of the public API)
         */static subscribeEx(commands,interval,requestOptions,callback){if(!TcHmi.System.Services.serverManager)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.Server"}}),null;if(TcHmi.System.isParameterTypeInvalid(commands,"commands",{type:"object",required:"valueNeeded",expectArray:!0},"TcHmi.Server",callback))return null;let request={requestType:"Subscription",commands:commands};return TcHmi.System.isParameterTypeInvalid(interval,"interval",{type:"number",required:"valueNeeded"},"TcHmi.Server",callback)?null:(null!=interval&&(request.intervalTime=interval),TcHmi.System.Services.serverManager.requestEx(request,requestOptions,Server.__handleServerResponse({completed:data=>{TcHmi.Callback.callSafeEx(callback,null,data)}})))}
/**
         * Unsubscribe a list of commands.
         * @param requestId The id of the subscription request which shall be unsubscribed.
         * @param callback Asynchronous response callback which will be raised if the operation has finished.
         * @returns Request id
         * @preserve (Part of the public API)
         */static unsubscribe(requestId,callback){return Server.unsubscribeEx(requestId,null,callback)}
/**
         * Unsubscribe a list of commands.
         * @param requestId The id of the subscription request which shall be unsubscribed.
         * @param requestOptions Options for the request itself
         * @param callback Asynchronous response callback which will be raised if the operation has finished.
         * @returns Request id
         * @preserve (Part of the public API)
         */static unsubscribeEx(requestId,requestOptions,callback){let res=null;if(!TcHmi.System.Services.serverManager)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.Server"}}),null;if(TcHmi.System.isParameterTypeInvalid(requestId,"requestId",{type:"number",required:"valueNeeded"},"TcHmi.Server",callback))return null;let requestEntry=TcHmi.System.Services.serverManager.getRequest(requestId);if(requestEntry){if(TcHmi.System.Services.serverManager.releaseRequest(requestId),!requestEntry.queue||requestEntry.queuePending){const request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"Unsubscribe",writeValue:requestId}]};return res=TcHmi.System.Services.serverManager.requestEx(request,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}})),res}return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE}),null}return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE}),null}
/**
         * Releases a request and associated resources like callbacks.
         * @param id Id of the request to release.
         * @preserve (Part of the public API)
         */static releaseRequest(id){TcHmi.System.Services.serverManager&&TcHmi.System.Services.serverManager.releaseRequest(id)}
/**
         * Get current username as string (could be __SystemGuest/__SystemUser without auth) or null when unknown (while loading).
         * @preserve (Part of the public API)
         */
static getCurrentUser(){return TcHmi.System.Services.accessManager?TcHmi.System.Services.accessManager.getCurrentUserConfig().name:(TcHmi.Log.error("[Source=Framework, Module=TcHmi.Server] System not ready."),null)}
/**
         * Get groups membership of current user as array (can be empty).
         * @preserve (Part of the public API)
         */static getGroupsOfCurrentUser(){return TcHmi.System.Services.accessManager?tchmi_clone_object(TcHmi.System.Services.accessManager.getCurrentUserConfig().userIsInGroups):(TcHmi.Log.error("[Source=Framework, Module=TcHmi.Server] System not ready."),[])}
/**
         * Get current user config.
         * @preserve (Part of the public API)
         */static getCurrentUserConfig(){return TcHmi.System.Services.accessManager?tchmi_clone_object(TcHmi.System.Services.accessManager.getCurrentUserConfig()):(TcHmi.Log.error("[Source=Framework, Module=TcHmi.Server] System not ready."),{state:0,userIsInGroups:[],name:null,domain:null,locale:void 0,configLocale:"client",timeFormatLocale:void 0,configTimeFormatLocale:"client",timeZone:void 0,configTimeZone:void 0,autoLogOffMilliSeconds:null,session:null,clientCertificate:null,clientIp:"",errorMessage:"",defaultAuthExtension:"TcHmiUserManagement",defaultUserGroup:"__SystemUsers"})}
/**
         * Login into a TcHmiServer, reloads the page on success, call of a callback after login.
         * The authentication domain can be specified by using 'Domain::UserName'. If no domain is specified the default auth extension will be used.
         * @param userName String with the username
         * @param password String with the password
         * @param persistent Should the session be valid even after browser restart
         * @param callback This callback is called if the login was sent
         * @returns returns a boolean if the login was called
         * @preserve (Part of the public API)
         */static login(userName,password,persistent=!0,callback){return Server.loginEx(userName,password,persistent,null,callback)}
/**
         * Login into a TcHmiServer, reloads the page on success, call of a callback after login.
         * The authentication domain can be specified by using 'Domain::UserName'. If no domain is specified the default auth extension will be used.
         * @param userName String with the username
         * @param password String with the password
         * @param persistent Should the session be valid even after browser restart
         * @param requestOptions Options for the request itself
         * @param callback This callback is called if the login was sent
         * @returns returns a boolean if the login was called
         * @preserve (Part of the public API)
         */static loginEx(userName,password,persistent=!0,requestOptions,callback){return Server.loginEx2(userName,password,persistent,!0,requestOptions,callback)}
/**
         * Login into a TcHmiServer, reloads the page on success if not deactivated, call of a callback after login.
         * The authentication domain can be specified by using 'Domain::UserName'. If no domain is specified the default auth extension will be used.
         * @param userName String with the username
         * @param password String with the password
         * @param persistent Should the session be valid even after browser restart
         * @param reload Reload hmi after session login.
         * @param requestOptions Options for the request itself
         * @param callback This callback is called if the login was sent
         * @returns returns a boolean if the login was called
         * @preserve (Part of the public API)
         */static loginEx2(userName,password,persistent=!0,reload=!1,requestOptions,callback){let res=!1;return TcHmi.System.Services.serverManager?!TcHmi.System.isParameterTypeInvalid(userName,"userName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server",callback)&&(!TcHmi.System.isParameterTypeInvalid(password,"password",{type:"string",required:"valueNeeded"},"TcHmi.Server",callback)&&(res=TcHmi.System.Services.serverManager.login(userName,password,persistent,reload,requestOptions,callback),res)):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.Server"}}),!1)}
/**
         * Logout from a TcHmiServer, reloads the page on success
         * @param callback This callback is called after the logout was sent
         * @returns returns a boolean if the logout was called
         * @preserve (Part of the public API)
         */static logout(callback){return Server.logoutEx(null,callback)}
/**
         * Logout from a TcHmiServer, reloads the page on success
         * @param requestOptions Options for the request itself
         * @param callback This callback is called after the logout was sent
         * @returns returns a boolean if the logout was called
         * @preserve (Part of the public API)
         */static logoutEx(requestOptions,callback){return TcHmi.Server.logoutEx2(!0,requestOptions,callback)}
/**
         * Logout from a TcHmiServer, optional reloads the page on success
         * @param reload Reload hmi after session logout
         * @param requestOptions Options for the request itself
         * @param callback This callback is called after the logout was sent
         * @returns returns a boolean if the logout was called
         * @preserve (Part of the public API)
         */static logoutEx2(reload=!0,requestOptions,callback){let res=!1;return TcHmi.System.Services.serverManager?(res=TcHmi.System.Services.serverManager.logout(reload,requestOptions,callback),res):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.Server"}}),res)}
/**
         * Logout all users with a specific username or all users from a TcHmiServer
         * @param username username to logout.
         * If empty string or null is provided, all users are logged out.
         * The authentication domain can be specified by using 'Domain::UserName'. If no domain is specified all users with the given name will be logged out.
         * 'Domain::' will logout every user from this domain
         * @param callback This callback is called after the request was sent
         * @returns returns a boolean if the logout was called
         * @preserve (Part of the public API)
         */static forceLogout(username,callback){return Server.forceLogoutEx(username,null,callback)}
/**
         * Logout all users with a specific username or all users from a TcHmiServer
         * @param userName username to logout.
         * If empty string or null is provided, all users are logged out.
         * The authentication domain can be specified by using 'Domain::UserName'. If no domain is specified all users with the given name will be logged out.
         * 'Domain::' will logout every user from this domain
         * @param requestOptions Options for the request itself
         * @param callback This callback is called after the request was sent
         * @returns returns a boolean if the logout was called
         * @preserve (Part of the public API)
         */static forceLogoutEx(userName,requestOptions,callback){let res=!1;return TcHmi.System.Services.serverManager?(void 0!==userName&&""!==userName||(userName=null),res=TcHmi.System.Services.serverManager.forceLogout(userName,requestOptions,callback),res):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.Server"}}),!1)}static __handleServerResponse(p){return function(data){if(data.error!==TcHmi.Errors.NONE)return TcHmi.Callback.callSafeEx(p.error,null,data),void TcHmi.Callback.callSafeEx(p.completed,null,data);let response=data.response;if(!response)return TcHmi.Callback.callSafeEx(p.error,null,{error:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_MISSING],reason:"Missing response from server.",domain:"TcHmi.Server"}}),void TcHmi.Callback.callSafeEx(p.completed,null,{error:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_MISSING],reason:"Missing response from server.",domain:"TcHmi.Server"}});if(response.error)return TcHmi.Callback.callSafeEx(p.error,null,{error:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],reason:"Error in response from server with id: "+response.id,domain:"TcHmi.Server",errors:[response.error]},response:response}),void TcHmi.Callback.callSafeEx(p.completed,null,{error:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],reason:"Error in response from server with id: "+response.id,domain:"TcHmi.Server",errors:[response.error]},response:response});let commands=response.commands;if(!commands||0===commands.length)return TcHmi.Callback.callSafeEx(p.error,null,{error:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,details:{code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:"Missing commands in response from server with id: "+response.id,domain:"TcHmi.Server"},response:response}),void TcHmi.Callback.callSafeEx(p.completed,null,{error:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,details:{code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:"Missing commands in response from server with id: "+response.id,domain:"TcHmi.Server"},response:response});let hasCommandError=!1,commandErrors=[];data.results=[];for(const[index,command]of commands.entries())data.responseCommandIndices&&!data.responseCommandIndices.includes(index)||(command.error?(hasCommandError=!0,commandErrors.push({code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:'Error in command for symbol: "'+command.symbol+'" in response from server with id: '+response.id,domain:"TcHmi.Server",errors:[command.error]}),data.results.push({error:TcHmi.Errors.E_SERVER_COMMAND_ERROR,details:{code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:'Error in command for symbol: "'+command.symbol+'" in response from server with id: '+response.id,domain:"TcHmi.Server",errors:[command.error]},symbol:command.symbol})):data.results.push({error:TcHmi.Errors.NONE,symbol:command.symbol,value:command.readValue}));hasCommandError?TcHmi.Callback.callSafeEx(p.error,null,data):TcHmi.Callback.callSafeEx(p.success,null,data),TcHmi.Callback.callSafeEx(p.completed,null,data)}}}TcHmi.Server=Server,function(Server){var _a,_RecipeManagement_fetchAllRecipeTypes;let Error,ACCESS;!function(Error){Error[Error.HMI_SUCCESS=0]="HMI_SUCCESS",Error[Error.HMI_E_FAIL=257]="HMI_E_FAIL",Error[Error.HMI_E_SYMBOL_IN_USE=274]="HMI_E_SYMBOL_IN_USE",Error[Error.HMI_E_SYMBOL_NOT_MAPPED=513]="HMI_E_SYMBOL_NOT_MAPPED",Error[Error.HMI_E_LICENSE_TARGET=778]="HMI_E_LICENSE_TARGET",Error[Error.HMI_E_MISSING_LICENSE_HANDSHAKE=781]="HMI_E_MISSING_LICENSE_HANDSHAKE",Error[Error.HMI_E_LICENSE_VERIFY=782]="HMI_E_LICENSE_VERIFY",Error[Error.HMI_E_INSUFFICIENT_ACCESS=4101]="HMI_E_INSUFFICIENT_ACCESS"}(Error=Server.Error||(Server.Error={})),function(ACCESS){ACCESS[ACCESS.NONE=0]="NONE",ACCESS[ACCESS.READ=1]="READ",ACCESS[ACCESS.WRITE=2]="WRITE",ACCESS[ACCESS.READWRITE=3]="READWRITE"}(ACCESS=Server.ACCESS||(Server.ACCESS={}));Server.UserManagement=class{
/**
             * Add a new user with a given password
             * @param userName Username to add.
             * @param password Password for the new user. Could be null if the extension does not support passwords.
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */
static addUser(userName,password,callback=null){return this.addUserEx(userName,password,null,null,callback)}
/**
             * Add a new user with a given password
             * @param userName Username to add.
             * @param password Password for the new user. Could be null if the extension does not support passwords.
             * @param options Optional details for this new user.
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static addUserEx(userName,password,options=null,requestOptions=null,callback=null){const paramInvalid=TcHmi.System.isParameterTypeInvalid(userName,"userName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;if(!TcHmi.System.Services.accessManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to add user. System not ready.",domain:"TcHmi.Server"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let writeValue={domain:TcHmi.System.Services.accessManager.getCurrentUserConfig().defaultAuthExtension,userName:userName,parameters:{password:password||void 0},settings:{}};if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(writeValue.domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.enabled,"options.enabled",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.UserManagement",callback),paramInvalid)return paramInvalid;if("boolean"==typeof options.enabled&&(writeValue.parameters.enabled=options.enabled),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.locale,"options.locale",{type:"string",required:"undefinedOk"},"TcHmi.Server.UserManagement",callback),paramInvalid)return paramInvalid;if(("string"==typeof options.locale&&options.locale.length>0||null===options.locale)&&(writeValue.settings.locale=options.locale),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.timeFormatLocale,"options.timeFormatLocale",{type:"string",required:"undefinedOk"},"TcHmi.Server.UserManagement",callback),paramInvalid)return paramInvalid;if(("string"==typeof options.timeFormatLocale&&options.timeFormatLocale.length>0||null===options.timeFormatLocale)&&(writeValue.settings.timeFormatLocale=options.timeFormatLocale),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.timeZone,"options.timeFormatLocale",{type:"string",required:"undefinedOk"},"TcHmi.Server.UserManagement",callback),paramInvalid)return paramInvalid;if(("string"==typeof options.timeZone&&options.timeZone.length>0||null===options.timeZone)&&(writeValue.settings.timeZone=options.timeZone),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.autoLogout,"options.autoLogout",{type:"string",required:"undefinedOk"},"TcHmi.Server.UserManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.autoLogout&&options.autoLogout.length>0&&(writeValue.settings.autoLogoff=options.autoLogout),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.groups,"options.groups",{type:"string",expectArray:!0,required:"undefinedOk"},"TcHmi.Server.UserManagement",callback),paramInvalid)return paramInvalid;options.groups&&(writeValue.settings.groups=options.groups)}const request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"AddOrChangeUser",writeValue:writeValue}]};if(null===Server.requestEx(request,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Lists all usernames as a string array
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static listUsernames(callback=null){return this.listUsernamesEx(null,null,callback)}
/**
             * Lists all usernames as a string array
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static listUsernamesEx(options,requestOptions=null,callback=null){if(!TcHmi.System.Services.accessManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to list usernames. System not ready.",domain:"TcHmi.Server"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain=TcHmi.System.Services.accessManager.getCurrentUserConfig().defaultAuthExtension;if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}if(null===Server.requestEx({requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"ListUserNames"}]},requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{if(data.results[0].value){let userList=[],isDefaultAuthExtension=domain===TcHmi.System.Services.accessManager.getCurrentUserConfig().defaultAuthExtension;for(const user of data.results[0].value){let userAndDomain=user.split("::");isDefaultAuthExtension&&1===userAndDomain.length?userList.push(userAndDomain[0]):isDefaultAuthExtension||2!==userAndDomain.length||userAndDomain[0]!==domain||userList.push(userAndDomain[1])}TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,userList:userList})}else TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,userList:void 0})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Lists all username as a dictionary with all meta data
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static listUsers(callback=null){return this.listUsersEx(null,null,callback)}
/**
             * Lists all username as a dictionary with all meta data
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static listUsersEx(options,requestOptions=null,callback=null){if(!TcHmi.System.Services.accessManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to list users. System not ready.",domain:"TcHmi.Server"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain=TcHmi.System.Services.accessManager.getCurrentUserConfig().defaultAuthExtension;if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"TcHmiSrv.Config::USERGROUPUSERS::"+domain},{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".ListDisabledUsers"}]};if(null===Server.requestEx(request,requestOptions,Server.__handleServerResponse({completed:data=>{if(data.error!==TcHmi.Errors.NONE||!data.response)return void TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details});let result={},disabledUsers=data.response.commands.find((x=>x.symbol===domain+".ListDisabledUsers"))?.readValue??[],userConfigListCommand=data.response.commands.find((x=>x.symbol==="TcHmiSrv.Config::USERGROUPUSERS::"+domain));if(!userConfigListCommand||userConfigListCommand.error)return void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_COMMAND_ERROR,details:{code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:'Error in command for symbol: "TcHmiSrv.Config::USERGROUPUSERS::'+domain+'" in response from server with id: '+data.response.id,domain:"TcHmi.Server",errors:userConfigListCommand?.error?[userConfigListCommand.error]:void 0}});let userConfigList=userConfigListCommand.readValue;for(let userName in userConfigList)result[userName]={domain:domain,enabled:!disabledUsers.includes(userName),autoLogout:userConfigList[userName].USERGROUPUSERS_AUTO_LOGOFF,locale:userConfigList[userName].USERGROUPUSERS_LOCALE,timeFormatLocale:userConfigList[userName].USERGROUPUSERS_TIMEFORMATLOCALE,timeZone:userConfigList[userName].USERGROUPUSERS_TIMEZONE,groups:userConfigList[userName].USERGROUPUSERS_GROUPS};TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,userDetails:result})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Lists all user groups as a dictionary with all meta data
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static listUserGroups(callback=null){return this.listUserGroupsEx(null,null,callback)}
/**
             * Lists all user groups as a dictionary with all meta data
             * @param options (not used till now)
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static listUserGroupsEx(options,requestOptions=null,callback=null){if(null===Server.requestEx({requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"TcHmiSrv.Config::USERGROUPS"}]},requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{let result={},groupList=data.results[0].value;for(let groupName in groupList)result[groupName]={enabled:groupList[groupName].ENABLED,fileAccess:groupList[groupName].FILEACCESS,files:groupList[groupName].FILES,symbolAccess:groupList[groupName].SYMBOLACCESS,symbols:groupList[groupName].SYMBOLS};TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,groupDetailsList:result})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Lists all users of a group as a string array
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static listUsersInGroup(groupName,callback=null){return this.listUsersInGroupEx(groupName,null,null,callback)}
/**
             * Lists all users of a group as a string array
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static listUsersInGroupEx(groupName,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(groupName,"groupName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;if(!TcHmi.System.Services.accessManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to list users in group. System not ready.",domain:"TcHmi.Server"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain=TcHmi.System.Services.accessManager.getCurrentUserConfig().defaultAuthExtension;if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"TcHmiSrv.Config::USERGROUPS"},{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"TcHmiSrv.Config::USERGROUPUSERS::"+domain}]};if(null===Server.requestEx(request,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results.filter((data=>data.error!==TcHmi.Errors.NONE))[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{const groupList=data.results[0].value;if(groupName in groupList){let result=data.response.commands[1].readValue,userList=[];for(let userName in result)result[userName].USERGROUPUSERS_GROUPS&&result[userName].USERGROUPUSERS_GROUPS.includes(groupName)&&userList.push(userName);TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,userList:userList})}else TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_KEY_NOT_FOUND,details:{code:TcHmi.Errors.E_KEY_NOT_FOUND,reason:"Requested user group not found",domain:"TcHmi.Server.UserManagement"}})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Removes a user
             * @param userName
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static removeUser(userName,callback=null){return this.removeUserEx(userName,null,null,callback)}
/**
             * Removes a user
             * @param userName Username
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static removeUserEx(userName,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(userName,"userName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;if(!TcHmi.System.Services.accessManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to remove user. System not ready.",domain:"TcHmi.Server"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain=TcHmi.System.Services.accessManager.getCurrentUserConfig().defaultAuthExtension;if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"RemoveUser",writeValue:{userName:userName,domain:domain}}]};if(null===Server.requestEx(request,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Update user config
             * @param userName Username to update.
             * @param options Details for this user.
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static updateUser(userName,options,callback=null){return this.updateUserEx(userName,options,null,callback)}
/**
             * Update user config
             * @param userName Username to update.
             * @param options Details for this user.
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static updateUserEx(userName,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(userName,"userName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options,"options",{type:"object",required:"valueNeeded"},"TcHmi.Server.UserManagement",callback),paramInvalid)return paramInvalid;if(!TcHmi.System.Services.accessManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to update user. System not ready.",domain:"TcHmi.Server"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain=TcHmi.System.Services.accessManager.getCurrentUserConfig().defaultAuthExtension;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback),paramInvalid)return paramInvalid;options&&"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain);if(null!==TcHmi.Server.requestEx({requestType:"ReadWrite",commands:[{commandOptions:["SendWriteValue"],symbol:"GetSymbolAccess",writeValue:"AddOrChangeUser"},{commandOptions:["SendWriteValue"],symbol:"GetSymbolAccess",writeValue:domain+".EnableUser"},{commandOptions:["SendWriteValue"],symbol:"GetSymbolAccess",writeValue:domain+".DisableUser"},{commandOptions:["SendWriteValue"],symbol:"GetSymbolAccess",writeValue:domain+".RenameUser"}]},{},(data=>{if(data.error||!data.response){const errorDetail={code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],domain:"TcHmi.Server.UserManagement",errors:data.details?[data.details]:void 0};return void TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}let AddOrChangeUserAccessCommand=data.response.commands.find((value=>"AddOrChangeUser"===value.writeValue));if(AddOrChangeUserAccessCommand.readValue===TcHmi.Server.ACCESS.NONE||AddOrChangeUserAccessCommand.readValue===TcHmi.Server.ACCESS.READ){if(options){if(options.newName){const errorDetail={code:TcHmi.Errors.E_NOT_ALLOWED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_ALLOWED],reason:"Missing access rights for renaming "+userName,domain:"TcHmi.Server.UserManagement"};return void TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}if(options.addGroups?.length){const errorDetail={code:TcHmi.Errors.E_NOT_ALLOWED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_ALLOWED],reason:"Missing access rights for adding groups of "+userName,domain:"TcHmi.Server.UserManagement"};return void TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}if(options.removeGroups?.length){const errorDetail={code:TcHmi.Errors.E_NOT_ALLOWED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_ALLOWED],reason:"Missing access rights for removing groups of "+userName,domain:"TcHmi.Server.UserManagement"};return void TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}if(void 0!==options.enabled){const errorDetail={code:TcHmi.Errors.E_NOT_ALLOWED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_ALLOWED],reason:"Missing access rights to "+(options.enabled?"enable ":"disable ")+userName,domain:"TcHmi.Server.UserManagement"};return void TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}if(options.autoLogout){const errorDetail={code:TcHmi.Errors.E_NOT_ALLOWED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_ALLOWED],reason:"Missing access rights for changing auto logout of "+userName,domain:"TcHmi.Server.UserManagement"};return void TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}const writeValue={},request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"ChangeUserSettings",writeValue:writeValue}]};if(TcHmi.System.isParameterTypeInvalid(options.locale,"options.locale",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback))return;if(("string"==typeof options.locale&&options.locale.length>0||null===options.locale)&&(writeValue.locale=options.locale),TcHmi.System.isParameterTypeInvalid(options.timeFormatLocale,"options.locale",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback))return;if(("string"==typeof options.timeFormatLocale&&options.timeFormatLocale.length>0||null===options.timeFormatLocale)&&(writeValue.timeFormatLocale=options.timeFormatLocale),TcHmi.System.isParameterTypeInvalid(options.timeZone,"options.timeZone",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback))return;if(("string"==typeof options.timeZone&&options.timeZone.length>0||null===options.timeZone)&&(writeValue.timeZone=options.timeZone),TcHmi.System.isParameterTypeInvalid(options.password,"options.password",{type:"string",required:"undefinedOk"},"TcHmi.Server.UserManagement",callback))return;if("string"==typeof options.password){if(TcHmi.System.isParameterTypeInvalid(options.currentPassword,"options.currentPassword",{type:"string",required:"valueNeeded"},"TcHmi.Server.UserManagment",callback))return;writeValue.changePassword={currentPassword:options.currentPassword,newPassword:options.password}}if(Object.keys(writeValue).length){const rId=Server.requestEx(request,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){for(const res of data.results)if(res.error)return void TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details});TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}));if(null===rId){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}}else TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}else{const parameters={},settings={},writeValue={domain:domain,userName:userName,parameters:parameters,settings:settings},request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"AddOrChangeUser",writeValue:writeValue}]};if(options){if(options.currentPassword&&TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.Server.UserManagement.updateUser] The current user has access to server symbol AddOrChangeUser thus the given current password will be ignored by the server."),TcHmi.System.isParameterTypeInvalid(options.password,"options.password",{type:"string",required:"undefinedOk"},"TcHmi.Server.UserManagement",callback))return;if("string"==typeof options.password)parameters.password=options.password,parameters.enabled=options.enabled??void 0;else if("boolean"==typeof options.enabled){const EnOrDisableCommandName=options.enabled?"EnableUser":"DisableUser";let EnOrDisableUserAccessCommand=data.response.commands.find((value=>value.writeValue===domain+"."+EnOrDisableCommandName));EnOrDisableUserAccessCommand.readValue!==TcHmi.Server.ACCESS.READWRITE&&EnOrDisableUserAccessCommand.readValue!==TcHmi.Server.ACCESS.WRITE||request.commands.push({commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+"."+EnOrDisableCommandName,writeValue:userName})}if(TcHmi.System.isParameterTypeInvalid(options.autoLogout,"options.autoLogout",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback))return;if("string"==typeof options.autoLogout&&(settings.autoLogoff=options.autoLogout),TcHmi.System.isParameterTypeInvalid(options.locale,"options.locale",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback))return;if(("string"==typeof options.locale&&options.locale.length>0||null===options.locale)&&(settings.locale=options.locale),TcHmi.System.isParameterTypeInvalid(options.timeFormatLocale,"options.timeFormatLocale",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback))return;if(("string"==typeof options.timeFormatLocale&&options.timeFormatLocale.length>0||null===options.timeFormatLocale)&&(settings.timeFormatLocale=options.timeFormatLocale),TcHmi.System.isParameterTypeInvalid(options.timeZone,"options.timeZone",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback))return;if(("string"==typeof options.timeZone&&options.timeZone.length>0||null===options.timeZone)&&(settings.timeZone=options.timeZone),TcHmi.System.isParameterTypeInvalid(options.newName,"options.newName",{type:"string",required:"fullOptional",minStringLength:1},"TcHmi.Server.UserManagement",callback))return;if(options.newName&&options.newName===userName);else if("string"==typeof options.newName&&options.newName.length>0){let RenameUserAccessCommand=data.response.commands.find((value=>value.writeValue===domain+".RenameUser"));RenameUserAccessCommand.readValue!==TcHmi.Server.ACCESS.READWRITE&&RenameUserAccessCommand.readValue!==TcHmi.Server.ACCESS.WRITE||request.commands.push({commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".RenameUser",writeValue:{currentUserName:userName,newUserName:options.newName}})}writeValue.parameters&&0===Object.keys(writeValue.parameters).length&&delete writeValue.parameters,writeValue.settings&&0===Object.keys(writeValue.settings).length&&delete writeValue.settings;const rId=Server.requestEx(request,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){for(const res of data.results)if(res.error)return void TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details});TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{let AddOrChangeUserCommandResult=data.results.find((value=>"AddOrChangeUser"===value.symbol)),newGroups=tchmi_clone_object(AddOrChangeUserCommandResult.value?.settings?.groups)??[];if(!TcHmi.System.isParameterTypeInvalid(options.addGroups,"options.addGroups",{type:"string",required:"undefinedOk",minStringLength:1,expectArray:!0},"TcHmi.Server.UserManagement",callback)&&(Array.isArray(options.addGroups)&&options.addGroups.forEach((newGroup=>{newGroups.includes(newGroup)||newGroups.push(newGroup)})),!TcHmi.System.isParameterTypeInvalid(options.removeGroups,"options.removeGroups",{type:"string",required:"undefinedOk",minStringLength:1,expectArray:!0},"TcHmi.Server.UserManagement",callback)))if(Array.isArray(options.removeGroups)&&options.removeGroups.forEach((deleteGroup=>{let deleteIndex=newGroups.indexOf(deleteGroup);-1!==deleteIndex&&newGroups.splice(deleteIndex,1)})),tchmi_equal(tchmi_clone_object(newGroups).sort(),tchmi_clone_object(AddOrChangeUserCommandResult.value?.settings?.groups??[]).sort()))TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE});else{const request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"AddOrChangeUser",writeValue:{domain:domain,userName:userName,settings:{groups:newGroups}}}]};"string"==typeof options.newName&&options.newName.length>0&&options.newName!==userName&&(request.commands[0].writeValue.userName=options.newName),Server.requestEx(request,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){for(const res of data.results)if(res.error)return void TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details});TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))}}}));if(null===rId){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}}}})))return{code:TcHmi.Errors.NONE};{const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}}
/**
             * Check access rights for usermanagement functions
             * @param options Option for setting usermanagement domain
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static getApiAccess(options,callback=null){if(!TcHmi.System.Services.accessManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to check api access. System not ready.",domain:"TcHmi.Server"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain=TcHmi.System.Services.accessManager.getCurrentUserConfig().defaultAuthExtension;if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const canRead=function(access){if(void 0===access)throw new globalThis.Error("Internal Error: This symbol access was not requested. Please adjust request.");return access===ACCESS.READWRITE||access===ACCESS.READ},canWrite=function(access){if(void 0===access)throw new globalThis.Error("Internal Error: This symbol access was not requested. Please adjust request.");return access===ACCESS.READWRITE||access===ACCESS.WRITE},symbolToCheck={};symbolToCheck.AddOrChangeUser=TcHmi.Server.ACCESS.NONE,symbolToCheck.ListUserNames=TcHmi.Server.ACCESS.NONE,symbolToCheck.RemoveUser=TcHmi.Server.ACCESS.NONE,symbolToCheck.ChangeUserSettings=TcHmi.Server.ACCESS.NONE,symbolToCheck["TcHmiSrv.Config"]=TcHmi.Server.ACCESS.NONE,symbolToCheck[domain+".EnableUser"]=TcHmi.Server.ACCESS.NONE,symbolToCheck[domain+".DisableUser"]=TcHmi.Server.ACCESS.NONE,symbolToCheck[domain+".RenameUser"]=TcHmi.Server.ACCESS.NONE,symbolToCheck[domain+".AddUser"]=TcHmi.Server.ACCESS.NONE,symbolToCheck[domain+".RemoveUser"]=TcHmi.Server.ACCESS.NONE,symbolToCheck[domain+".ChangePassword"]=TcHmi.Server.ACCESS.NONE;let commands=[];for(let symbolName of Object.keys(symbolToCheck))commands.push({commandOptions:["SendWriteValue","SendErrorMessage"],symbol:"GetSymbolAccess",writeValue:symbolName});commands.push({commandOptions:["SendErrorMessage"],symbol:"TcHmiSrv.Config::USERGROUPUSERS::"+domain});if(null!==TcHmi.Server.requestEx({requestType:"ReadWrite",commands:commands},{},(data=>{if(data.error||!data.response?.commands){const errorDetail={code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],domain:"TcHmi.Server.UserManagement",errors:data.details?[data.details]:void 0};return void TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}for(let symbolName of Object.keys(symbolToCheck))symbolToCheck[symbolName]=data.response.commands.find((value=>value.writeValue===symbolName)).readValue;let usergroupUsers=null!==data.response.commands.find((command=>command.symbol==="TcHmiSrv.Config::USERGROUPUSERS::"+domain))?.readValue;TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,result:{addUser:{general:null!==symbolToCheck[domain+".AddUser"]&&canWrite(symbolToCheck.AddOrChangeUser),enable:null!==symbolToCheck[domain+".AddUser"]&&canWrite(symbolToCheck.AddOrChangeUser),locale:null!==symbolToCheck[domain+".AddUser"]&&canWrite(symbolToCheck.AddOrChangeUser),timeFormatLocale:null!==symbolToCheck[domain+".AddUser"]&&canWrite(symbolToCheck.AddOrChangeUser),timeZone:null!==symbolToCheck[domain+".AddUser"]&&canWrite(symbolToCheck.AddOrChangeUser),autoLogoff:null!==symbolToCheck[domain+".AddUser"]&&canWrite(symbolToCheck.AddOrChangeUser),groups:null!==symbolToCheck[domain+".AddUser"]&&canWrite(symbolToCheck.AddOrChangeUser)},listUserNames:{general:canRead(symbolToCheck.ListUserNames)},listUsers:{general:usergroupUsers&&canRead(symbolToCheck["TcHmiSrv.Config"]),enabled:usergroupUsers&&canRead(symbolToCheck["TcHmiSrv.Config"]),locale:usergroupUsers&&canRead(symbolToCheck["TcHmiSrv.Config"]),timeFormatLocale:usergroupUsers&&canRead(symbolToCheck["TcHmiSrv.Config"]),timeZone:usergroupUsers&&canRead(symbolToCheck["TcHmiSrv.Config"]),autoLogoff:usergroupUsers&&canRead(symbolToCheck["TcHmiSrv.Config"]),groups:usergroupUsers&&canRead(symbolToCheck["TcHmiSrv.Config"])},listUserGroups:{general:canRead(symbolToCheck["TcHmiSrv.Config"]),enabled:canRead(symbolToCheck["TcHmiSrv.Config"]),fileAccess:canRead(symbolToCheck["TcHmiSrv.Config"]),files:canRead(symbolToCheck["TcHmiSrv.Config"]),symbolAccess:canRead(symbolToCheck["TcHmiSrv.Config"]),symbols:canRead(symbolToCheck["TcHmiSrv.Config"])},listUsersInGroup:{general:usergroupUsers&&canRead(symbolToCheck["TcHmiSrv.Config"])},removeUser:{general:null!==symbolToCheck[domain+".RemoveUser"]&&canWrite(symbolToCheck.RemoveUser)},updateUser:{general:canWrite(symbolToCheck.ChangeUserSettings)||canWrite(symbolToCheck.AddOrChangeUser),newName:canWrite(symbolToCheck.AddOrChangeUser)&&canWrite(symbolToCheck[domain+".RenameUser"]),addGroups:canWrite(symbolToCheck.AddOrChangeUser),removeGroups:canWrite(symbolToCheck.AddOrChangeUser),enabled:canWrite(symbolToCheck.AddOrChangeUser)&&canWrite(symbolToCheck[domain+".EnableUser"])&&canWrite(symbolToCheck[domain+".DisableUser"]),autoLogout:canWrite(symbolToCheck.AddOrChangeUser),locale:canWrite(symbolToCheck.ChangeUserSettings)||canWrite(symbolToCheck.AddOrChangeUser),timeFormatLocale:canWrite(symbolToCheck.ChangeUserSettings)||canWrite(symbolToCheck.AddOrChangeUser),timeZone:canWrite(symbolToCheck.ChangeUserSettings)||canWrite(symbolToCheck.AddOrChangeUser),changeOwnPassword:null!==symbolToCheck[domain+".ChangePassword"]&&(canWrite(symbolToCheck.ChangeUserSettings)||canWrite(symbolToCheck.AddOrChangeUser)),changePassword:null!==symbolToCheck[domain+".AddUser"]&&canWrite(symbolToCheck.AddOrChangeUser)}}})})))return{code:TcHmi.Errors.NONE};{const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}}};class RecipeManagement{
/**
             * Lists all available recipe types
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */
static listRecipeTypes(callback=null){return this.listRecipeTypesEx(null,null,callback)}
/**
             * Lists all available recipe types
             * This function provides more options to manipulate the request
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static listRecipeTypesEx(options,requestOptions=null,callback=null){let domain="TcHmiRecipeManagement",path="";if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.path,"options.path",{type:"string",required:"fullOptional"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.path&&options.path.length>0&&(path="::"+options.path),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeTypeList"+path}]};options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.results[0].value})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Watches a list of all available recipe types
             * @param options Options for the watch
             * @param callback Callback which is called once and on every change
             * @preserve (Part of the public API)
             */static watchRecipeTypesList(options,callback=null){let domain="TcHmiRecipeManagement";if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return function(){};if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return function(){}}let destroy,recipeSymbol=new TcHmi.Symbol(`%s%${domain}.Config::recipeTypeList${options?.parallel?"|Parallel=True":""}%/s%`);return destroy=recipeSymbol.watch((function(data){destroy||(destroy=data.destroy),data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.value,destroy:destroy}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:recipeSymbol.getExpression().toString(),domain:"TcHmi.Server.RecipeManagement",errors:data.details?[data.details]:void 0},destroy:destroy})})),destroy}
/**
             * Returns a recipe types addressed by name and optional path
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static getRecipeType(recipeTypeName,path,callback=null){return this.getRecipeTypeEx(recipeTypeName,path,null,null,callback)}
/**
             * Returns a recipe types addressed by name and optional path
             * This function provides more options to manipulate the request
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static getRecipeTypeEx(recipeTypeName,path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeTypeName,"recipeTypeName",{type:"string",required:"valueNeeded"},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const recipeTypeFullPath=path&&recipeTypeName?path+"::"+recipeTypeName:recipeTypeName||(path||"");return options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0}),this.listRecipeTypesEx({domain:domain,path:recipeTypeFullPath},requestOptions,callback)}
/**
             * Watches a recipe type
             * @param options Options for the watch
             * @param callback Callback which is called once and on every change
             * @preserve (Part of the public API)
             */static watchRecipeType(recipeTypeName,path,options,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeTypeName,"recipeTypeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return function(){};if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return function(){};let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return function(){};if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return function(){}}let destroy,recipeSymbol=new TcHmi.Symbol(`%s%${domain}.Config::recipeTypeList::${(path?path+"::":"")+recipeTypeName}${options?.parallel?"|Parallel=True":""}%/s%`);return destroy=recipeSymbol.watch((function(data){destroy||(destroy=data.destroy),data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.value,destroy:destroy}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:recipeSymbol.getExpression().toString(),domain:"TcHmi.Server.RecipeManagement",errors:data.details?[data.details]:void 0},destroy:destroy})})),destroy}
/**
             * Creates a recipe type folder
             * @param path name of the new folder
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static createRecipeTypeFolder(path,callback=null){return this.createRecipeTypeFolderEx(path,null,null,callback)}
/**
             * Creates a recipe type folder
             * This function provides more options to manipulate the request
             * @param path Name of the new folder
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static createRecipeTypeFolderEx(path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeTypeList::"+path,writeValue:{}}]};options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Deletes a recipe type folder
             * @param path name of the folder
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static deleteRecipeTypeFolder(path,callback=null){return this.deleteRecipeTypeFolderEx(path,null,null,callback)}
/**
             * Deletes a recipe type folder
             * This function provides more options to manipulate the request
             * @param path Name of the folder
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static deleteRecipeTypeFolderEx(path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue","Delete"],symbol:domain+".Config::recipeTypeList::"+path}]};options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Creates a new recipe type
             * @param recipeTypeName name of the recipe type
             * @param recipeType recipe type definition
             * @param path Path of the recipe type (root folder if set to null)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static createRecipeType(recipeTypeName,recipeType,path,callback=null){return this.createRecipeTypeEx(recipeTypeName,recipeType,path,null,null,callback)}
/**
             * Creates a new recipe type
             * This function provides more options to manipulate the request
             * @param recipeTypeName Name of the recipe type
             * @param recipeType Recipe type definition
             * @param path Path of the recipe type (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static createRecipeTypeEx(recipeTypeName,recipeType,path,options,requestOptions=null,callback=null){return this.__manipulateRecipeType(!1,recipeTypeName,recipeType,path,options,requestOptions,callback)}
/**
             * Updates a recipe type
             * @param recipeTypeName name of the recipe type
             * @param recipeType recipe type definition
             * @param path Path of the recipe type (root folder if set to null)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static updateRecipeType(recipeTypeName,recipeType,path,callback=null){return this.updateRecipeTypeEx(recipeTypeName,recipeType,path,null,null,callback)}
/**
             * Updates a recipe type
             * This function provides more options to manipulate the request
             * @param recipeTypeName Name of the recipe type
             * @param recipeType Recipe type definition
             * @param path Path of the recipe type (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static updateRecipeTypeEx(recipeTypeName,recipeType,path,options,requestOptions=null,callback=null){return this.__manipulateRecipeType(!0,recipeTypeName,recipeType,path,options,requestOptions,callback)}static __manipulateRecipeType(update,recipeTypeName,recipeType,path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeTypeName,"recipeTypeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeTypeList::"+(path?path+"::":"")+recipeTypeName,writeValue:recipeType}]};update&&writeRequest.commands[0].commandOptions.push("Replace"),options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Renames or moves a recipe type
             * @param recipeTypeName Old name of the recipe type
             * @param path Old path of the recipe type (root folder if set to null)
             * @param newName New name of the recipe type
             * @param newPath New path of the recipe type (root folder if set to null)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static renameRecipeType(recipeTypeName,path,newName,newPath,callback=null){return this.renameRecipeTypeEx(recipeTypeName,path,newName,newPath,null,null,callback)}
/**
             * Renames or moves a recipe type
             * This function provides more options to manipulate the request
             * @param recipeTypeName Old name of the recipe type
             * @param path Old path of the recipe type (root folder if set to null)
             * @param newName New name of the recipe type
             * @param newPath New path of the recipe type (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static renameRecipeTypeEx(recipeTypeName,path,newName,newPath,options,requestOptions=null,callback=null){return this.__renameRecipeEntry("recipeTypeList",recipeTypeName,path,newName,newPath,options,requestOptions,callback)}
/**
             * Renames or moves a recipe type folder
             * @param recipeTypeFolderName Old name of the recipe type
             * @param path Old path of the recipe type (root folder if set to null)
             * @param newName New name of the recipe type
             * @param newPath New path of the recipe type (root folder if set to null)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static renameRecipeTypeFolder(recipeTypeFolderName,path,newName,newPath,callback=null){return this.renameRecipeTypeFolderEx(recipeTypeFolderName,path,newName,newPath,null,null,callback)}
/**
             * Renames or moves a recipe type folder
             * This function provides more options to manipulate the request
             * @param recipeTypeFolderName Old name of the recipe type
             * @param path Old path of the recipe type (root folder if set to null)
             * @param newName New name of the recipe type
             * @param newPath New path of the recipe type (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static renameRecipeTypeFolderEx(recipeTypeFolderName,path,newName,newPath,options,requestOptions=null,callback=null){return this.__renameRecipeEntry("recipeTypeList",recipeTypeFolderName,path,newName,newPath,options,requestOptions,callback)}static __renameRecipeEntry(rootFolder,oldName,path,newName,newPath,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(oldName,"oldName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(newName,"newName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(newPath,"newpath",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"Rename",writeValue:{domain:domain,configuration:"default",old:rootFolder+"::"+(path?path+"::":"")+oldName,new:rootFolder+"::"+(newPath?newPath+"::":"")+newName}}]};options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Deletes a recipe type
             * @param recipeTypeName name of the recipe type
             * @param path Path of the recipe type (root folder if set to null)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static deleteRecipeType(recipeTypeName,path,callback=null){return this.deleteRecipeTypeEx(recipeTypeName,path,null,null,callback)}
/**
             * Deletes a recipe type
             * This function provides more options to manipulate the request
             * @param recipeTypeName Name of the recipe type
             * @param path Path of the recipe type (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static deleteRecipeTypeEx(recipeTypeName,path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeTypeName,"recipeTypeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue","Delete"],symbol:domain+".Config::recipeTypeList::"+(path?path+"::":"")+recipeTypeName}]};options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Lists all available recipes
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static listRecipes(callback=null){return this.listRecipesEx(null,null,callback)}
/**
             * Lists all available recipes
             * This function provides more options to manipulate the request
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static listRecipesEx(options,requestOptions=null,callback=null){let path="",domain="TcHmiRecipeManagement";if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.path,"options.path",{type:"string",required:"fullOptional"},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if("string"==typeof options.path&&options.path.length>0&&(path="::"+options.path),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeList"+path}]};options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.results[0].value})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Watches a list of all available recipes
             * @param options Options for the watch
             * @param callback Callback which is called once and on every change
             * @preserve (Part of the public API)
             */static watchRecipeList(options,callback=null){let domain="TcHmiRecipeManagement";if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return function(){};if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return function(){}}options&&"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain);let destroy,recipeSymbol=new TcHmi.Symbol(`%s%${domain}.Config::recipeList${options?.parallel?"|Parallel=True":""}%/s%`);return destroy=recipeSymbol.watch((function(data){destroy||(destroy=data.destroy),data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.value,destroy:destroy}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:recipeSymbol.getExpression().toString(),domain:"TcHmi.Server.RecipeManagement",errors:data.details?[data.details]:void 0},destroy:destroy})})),destroy}
/**
             * Creates a recipe folder
             * @param path name of the new folder
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static createRecipeFolder(path,callback=null){return this.createRecipeFolderEx(path,null,null,callback)}
/**
             * Creates a recipe folder
             * This function provides more options to manipulate the request
             * @param path name of the new folder
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static createRecipeFolderEx(path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeList::"+path,writeValue:{}}]};options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Deletes a recipe folder
             * @param path name of the folder
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static deleteRecipeFolder(path,callback=null){return this.deleteRecipeFolderEx(path,null,null,callback)}
/**
             * Deletes a recipe folder
             * This function provides more options to manipulate the request
             * @param path Name of the folder
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static deleteRecipeFolderEx(path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue","Delete"],symbol:domain+".Config::recipeList::"+path}]};options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Creates a new recipe
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param recipe recipe definition
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static createRecipe(recipeName,path,recipe,callback=null){return this.createRecipeEx(recipeName,path,recipe,null,null,callback)}
/**
             * Creates a new recipe
             * This function provides more options to manipulate the request
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param recipe Recipe definition
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static createRecipeEx(recipeName,path,recipe,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeName,"recipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const recipeFullPath=path&&recipeName?path+"::"+recipeName:recipeName||(path||""),writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeList"+(recipeFullPath?"::"+recipeFullPath:""),writeValue:recipe}]};options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});const rId=Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage"],symbol:domain+".UpdateRecipe",writeValue:{path:(path?path+"::":"")+recipeName}}]};Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))}}));if(null===rId){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Lists one recipe
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static getRecipe(recipeName,path,callback=null){return this.getRecipeEx(recipeName,path,null,null,callback)}
/**
             * Lists one recipe
             * This function provides more options to manipulate the request
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static getRecipeEx(recipeName,path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeName,"recipeName",{type:"string",required:"valueNeeded"},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const recipeFullPath=path&&recipeName?path+"::"+recipeName:recipeName||(path||""),writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeList"+(recipeFullPath?"::"+recipeFullPath:"")}]};options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.results[0].value})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Watches a recipe
             * @param options Options for the watch
             * @param callback Callback which is called once and on every change
             * @preserve (Part of the public API)
             */static watchRecipe(recipeName,path,options,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeName,"recipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return function(){};if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return function(){};let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return function(){};if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return function(){}}const recipeFullPath=path&&recipeName?path+"::"+recipeName:recipeName||(path||"");let destroy,recipeSymbol=new TcHmi.Symbol(`%s%${domain}.Config::recipeList${recipeFullPath?"::"+recipeFullPath:""}${options?.parallel?"|Parallel=True":""}%/s%`);return destroy=recipeSymbol.watch((function(data){destroy||(destroy=data.destroy),data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.value,destroy:destroy}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:recipeSymbol.getExpression().toString(),domain:"TcHmi.Server.RecipeManagement",errors:data.details?[data.details]:void 0},destroy:destroy})})),destroy}
/**
             * Updates a recipe
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param newValues dictionary of the new values
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static updateRecipe(recipeName,path,newValues,callback=null){return this.updateRecipeEx(recipeName,path,newValues,null,null,callback)}
/**
             * Updates a recipe
             * This function provides more options to manipulate the request
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param newValues Dictionary of the new values
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static updateRecipeEx(recipeName,path,newValues,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeName,"recipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(newValues,"newValues",{type:"object",required:"valueNeeded"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeList"+(path?"::"+path:"")+"::"+recipeName+"::values",writeValue:newValues}]};options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Reads all values which is referenced by a recipe
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static readFromTarget(recipeName,path,callback=null){return this.readFromTargetEx(recipeName,path,null,null,callback)}
/**
             * Reads all values which is referenced by a recipe
             * This function provides more options to manipulate the request
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static readFromTargetEx(recipeName,path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeName,"recipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".ReadFromTarget",writeValue:{path:(path?path+"::":"")+recipeName}}]};options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.results[0].value})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Reads the current values which are referenced from a base recipe and write it back
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static teach(recipeName,path,callback=null){return this.teachEx(recipeName,path,null,null,callback)}
/**
             * Reads the current values which are referenced from a base recipe and write it back
             * This function provides more options to manipulate the request
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static teachEx(recipeName,path,options,requestOptions=null,callback=null){return this.readFromTargetEx(recipeName,path,options,requestOptions,(function(readFromTargetData){readFromTargetData.error===TcHmi.Errors.NONE?RecipeManagement.createRecipeEx(recipeName,path,readFromTargetData.value[(path?path+"::":"")+recipeName],options,requestOptions,(createRecipeData=>{createRecipeData.error!==TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,createRecipeData):TcHmi.Callback.callSafeEx(callback,null,readFromTargetData)})):TcHmi.Callback.callSafeEx(callback,null,readFromTargetData)}))}
/**
             * Reads the current values which are referenced from a base recipe and write it into a new recipe
             * @param recipeName Name of the base recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param newrecipeName Name of the new recipe. (could be prefixed with a path if separated with ::)
             * @param newRecipePath Path of the new recipe. (root folder if set to null)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static teachAsNewRecipe(recipeName,path,newRecipeName,newRecipePath,callback=null){return this.teachAsNewRecipeEx(recipeName,path,newRecipeName,newRecipePath,null,null,callback)}
/**
             * Reads the current values which are referenced from a base recipe and write it into a new recipe
             * This function provides more options to manipulate the request
             * @param recipeName Name of the base recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param newrecipeName Name of the new recipe. (could be prefixed with a path if separated with ::)
             * @param newRecipePath Path of the new recipe. (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static teachAsNewRecipeEx(recipeName,path,newRecipeName,newRecipePath,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeName,"recipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);return paramInvalid||(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid||(paramInvalid=TcHmi.System.isParameterTypeInvalid(newRecipeName,"newRecipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid||(paramInvalid=TcHmi.System.isParameterTypeInvalid(newRecipePath,"newRecipepath",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid||this.readFromTargetEx(recipeName,path,options,requestOptions,(function(data){data.error===TcHmi.Errors.NONE?RecipeManagement.createRecipeEx(newRecipeName,newRecipePath,data.value[(path?path+"::":"")+recipeName],options,requestOptions,callback):TcHmi.Callback.callSafeEx(callback,null,data)})))))}
/**
             * Activates a recipe (writes all values)
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static activate(recipeName,path,callback=null){return this.activateEx(recipeName,path,null,null,callback)}
/**
             * Activates a recipe (writes all values)
             * This function provides more options to manipulate the request
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static activateEx(recipeName,path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeName,"recipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".ActivateRecipe",writeValue:{path:(path?path+"::":"")+recipeName}}]};options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Lists all active recipes
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static getActiveRecipes(callback=null){return this.getActiveRecipesEx(null,null,callback)}
/**
             * Lists all active recipes
             * This function provides more options to manipulate the request
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static getActiveRecipesEx(options,requestOptions=null,callback=null){let domain="TcHmiRecipeManagement";if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".GetActiveRecipes"}]};options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,recipeList:data.results[0].value})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Watches a list of all active recipes
             * @param options Options for the watch
             * @param callback Callback which is called once and on every change
             * @preserve (Part of the public API)
             */static watchActiveRecipes(options,callback=null){let domain="TcHmiRecipeManagement";if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return function(){};if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return function(){}}let destroy,recipeSymbol=new TcHmi.Symbol(`%s%${domain}.GetActiveRecipes${options?.parallel?"|Parallel=True":""}%/s%`);return destroy=recipeSymbol.watch((function(data){destroy||(destroy=data.destroy),data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.value,destroy:destroy}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:recipeSymbol.getExpression().toString(),domain:"TcHmi.Server.RecipeManagement",errors:data.details?[data.details]:void 0},destroy:destroy})})),destroy}
/**
             * Renames or moves a recipe
             * @param recipeName Old name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Old path of the recipe (root folder if set to null)
             * @param newName New name of the recipe
             * @param newPath New path of the recipe (root folder if set to null)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static renameRecipe(recipeName,path,newName,newPath,callback=null){return this.renameRecipeEx(recipeName,path,newName,newPath,null,null,callback)}
/**
             * Renames or moves a recipe
             * This function provides more options to manipulate the request
             * @param recipeName Old name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Old path of the recipe (root folder if set to null)
             * @param newName New name of the recipe
             * @param newPath New path of the recipe (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static renameRecipeEx(recipeName,path,newName,newPath,options,requestOptions=null,callback=null){return this.__renameRecipeEntry("recipeList",recipeName,path,newName,newPath,options,requestOptions,callback)}
/**
             * Renames or moves a recipe folder
             * @param recipeFolderName Old name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Old path of the recipe (root folder if set to null)
             * @param newName New name of the recipe
             * @param newPath New path of the recipe (root folder if set to null)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static renameRecipeFolder(recipeFolderName,path,newName,newPath,callback=null){return this.renameRecipeFolderEx(recipeFolderName,path,newName,newPath,null,null,callback)}
/**
             * Renames or moves a recipe folder
             * This function provides more options to manipulate the request
             * @param recipeFolderName Old name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Old path of the recipe (root folder if set to null)
             * @param newName Mew name of the recipe
             * @param newPath New path of the recipe (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static renameRecipeFolderEx(recipeFolderName,path,newName,newPath,options,requestOptions=null,callback=null){return this.__renameRecipeEntry("recipeList",recipeFolderName,path,newName,newPath,options,requestOptions,callback)}
/**
             * Deletes a recipe
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static deleteRecipe(recipeName,path,callback=null){return this.deleteRecipeEx(recipeName,path,null,null,callback)}
/**
             * Deletes a recipe
             * This function provides more options to manipulate the request
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static deleteRecipeEx(recipeName,path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeName,"recipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue","Delete"],symbol:domain+".Config::recipeList::"+(path?path+"::":"")+recipeName}]};options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Downloads one or more recipes. Downloads all recipes when filter is the empty string, empty array or null.
             * The sibling API downloadRecipesEx can include the referenced recipe types, too.
             * This needs to be triggered by a user interaction (not on load or symbol change).
             * @param filter Name or names of the recipes (could be prefixed with a path if separated with ::)
             * @param path Path of the recipes (root folder if set to null)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static downloadRecipes(filter,path,callback=null){return this.downloadRecipesEx(filter,path,null,null,callback)}
/**
             * Downloads one or more recipes. Downloads all recipes when filter is the empty string, empty array or null.
             * Can include the referenced recipe types, too, when set in options.
             * This function provides more options to manipulate the request.
             * This needs to be triggered by a user interaction (not on load or symbol change).
             * @param filter Name or names of the recipes (could be prefixed with a path if separated with ::)
             * @param path Path of the recipes (root folder if set to null)
             * @param options Options for the download recipeManagement
             * @param requestOptions Options for the request itself (not used right now)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static downloadRecipesEx(filter,path,options,requestOptions=null,callback=null){let filterArr;if(null===filter)filterArr=[""];else if(Array.isArray(filter)&&0===filter.length)filterArr=[""];else if(Array.isArray(filter)){let paramInvalid=TcHmi.System.isParameterTypeInvalid(filter,"filter",{type:"string",expectArray:!0,required:"nullOk"},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;filterArr=filter}else{let paramInvalid=TcHmi.System.isParameterTypeInvalid(filter,"recipeName",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;filterArr=[filter]}let paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.referencedRecipeTypes,"options.referencedRecipeTypes",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}return new Promise(((resolve,reject)=>{const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeList"},{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeTypeList"}]};options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0});null!==Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];reject({error:res.error,details:res.details})}else reject({error:data.error,details:data.details})},success:data=>{const allRecipes=data.results.find((data=>data.symbol===domain+".Config::recipeList"))?.value,allRecipeTypes=data.results.find((data=>data.symbol===domain+".Config::recipeTypeList"))?.value;allRecipes&&allRecipeTypes?resolve({allRecipes:allRecipes,allRecipeTypes:allRecipeTypes}):reject({error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request had wrong content.",domain:"TcHmi.Server.RecipeManagement"}})}}))||reject({error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"}})})).then((data=>{const allRecipeTypesMap=new Map,allRecipeTypesOrFolderMap=new Map,buildRecipeTypeMap=(currentRecipeTypeOrFolder,path)=>{if(allRecipeTypesOrFolderMap.set(path,currentRecipeTypeOrFolder),this.isRecipeType(currentRecipeTypeOrFolder))allRecipeTypesMap.set(path,currentRecipeTypeOrFolder);else for(const[subPath,subRecipeTypeFolder]of Object.entries(currentRecipeTypeOrFolder))buildRecipeTypeMap(subRecipeTypeFolder,path?path+"::"+subPath:subPath)};buildRecipeTypeMap(data.allRecipeTypes,"");const allRecipesMap=new Map;let referencedRecipe=new Map,referencedRecipeTypes=new Map;const buildRecipeMap=(currentRecipeOrFolder,path)=>{if(allRecipesMap.set(path,currentRecipeOrFolder),this.isRecipe(currentRecipeOrFolder)){referencedRecipeTypes.set(path,currentRecipeOrFolder.recipeTypeName),referencedRecipe.set(path,[]);const typeMembers=allRecipeTypesMap.get(currentRecipeOrFolder.recipeTypeName)?.members;if(typeMembers)for(const recipeTypeMember of Object.values(typeMembers))if(recipeTypeMember&&"recipeType"in recipeTypeMember){const linkedRecipePath=currentRecipeOrFolder.values[recipeTypeMember.recipeType];linkedRecipePath&&referencedRecipe.get(path)?.push(linkedRecipePath)}}else for(const[subPath,subRecipeFolder]of Object.entries(currentRecipeOrFolder))buildRecipeMap(subRecipeFolder,path?path+"::"+subPath:subPath)};buildRecipeMap(data.allRecipes,"");const resultMessage={requestType:"ReadWrite",commands:[]},includedRecipePaths=new Set,includedRecipeTypePaths=new Set,buildRecipeTypeCommand=referencedRecipeType=>{if(referencedRecipeType&&!includedRecipeTypePaths.has(referencedRecipeType)){includedRecipeTypePaths.add(referencedRecipeType);const referencedRecipeTypeObj=allRecipeTypesMap.get(referencedRecipeType);resultMessage.commands?.unshift({commandOptions:["SendErrorMessage"],symbol:domain+".Config::recipeTypeList"+(referencedRecipeType?"::"+referencedRecipeType:""),writeValue:referencedRecipeTypeObj});for(const subReferencedRecipeType of referencedRecipeTypeObj?.recipeTypeNames??[])buildRecipeTypeCommand(subReferencedRecipeType)}else void 0===referencedRecipeType&&resultMessage.commands?.unshift({commandOptions:["SendErrorMessage"],symbol:domain+".Config::recipeTypeList",writeValue:allRecipeTypesOrFolderMap.get("")})},buildRecipeCommand=recipePath=>{if(includedRecipePaths.has(recipePath))return;includedRecipePaths.add(recipePath),resultMessage.commands?.push({commandOptions:["SendErrorMessage"],symbol:domain+".Config::recipeList"+(recipePath?"::"+recipePath:""),writeValue:allRecipesMap.get(recipePath)});const referencedRecipeType=referencedRecipeTypes.get(recipePath);options?.referencedRecipeTypes&&(resultMessage.commands?.some((cmd=>cmd.symbol===domain+".Config::recipeTypeList"))||buildRecipeTypeCommand(referencedRecipeType));for(const referencedPath of referencedRecipe.get(recipePath)??[])buildRecipeCommand(referencedPath)};for(const recipePath of filterArr)buildRecipeCommand(path?path+"::"+recipePath:recipePath);const downloaderAElement=document.createElement("a");downloaderAElement.download=(1===filterArr.length&&filterArr[0]?filterArr[0].replace(/::/g,"_"):domain+"_recipeList")+(options?.referencedRecipeTypes?"+ref":"")+".json",downloaderAElement.href="data:application/json;charset=utf8,"+encodeURI(JSON.stringify(resultMessage)),downloaderAElement.style.display="none",document.body.appendChild(downloaderAElement),downloaderAElement.click(),downloaderAElement.remove(),TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})})).catch((errorDetails=>{errorDetails instanceof globalThis.Error?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Unknown error in downloadRecipeEx",domain:"TcHmi.Server.RecipeManagement",exception:errorDetails}}):TcHmi.Callback.callSafeEx(callback,null,{error:errorDetails?.code,details:errorDetails})})),{code:TcHmi.Errors.NONE}}
/**
             * Downloads one or more recipe types. Downloads all recipe types when recipeTypeName is the empty string or null.
             * The sibling API downloadRecipeTypesEx can include the referenced recipe types, too.
             * This needs to be triggered by a user interaction (not on load or symbol change).
             * @param filter Name or names of the recipe types (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe types (root folder if set to null)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static downloadRecipeTypes(filter,path,callback=null){return this.downloadRecipeTypesEx(filter,path,null,null,callback)}
/**
             * Downloads one or more recipe types. Downloads all recipe types when recipeTypeName is the empty string or null.
             * Can include the referenced recipe types, too, when set in options.
             * This function provides more options to manipulate the request.
             * This needs to be triggered by a user interaction (not on load or symbol change).
             * @param filter Name or names of the recipe types (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe types (root folder if set to null)
             * @param options Options for the download recipeManagement
             * @param requestOptions Options for the request itself (not used right now)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static downloadRecipeTypesEx(filter,path,options,requestOptions=null,callback=null){let filterArr;if(Array.isArray(filter)){let paramInvalid=TcHmi.System.isParameterTypeInvalid(filter,"filter",{type:"string",expectArray:!0,required:"nullOk"},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;filterArr=filter}else{let paramInvalid=TcHmi.System.isParameterTypeInvalid(filter,"recipeTypeName",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;filterArr=[filter]}let paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.referencedRecipeTypes,"options.referencedRecipeTypes",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}return __classPrivateFieldGet(this,_a,"m",_RecipeManagement_fetchAllRecipeTypes).call(this,filterArr,path,options,requestOptions).then((allPromiseResults=>{const seenPath=new Set,resultMessage={requestType:"ReadWrite",commands:allPromiseResults.flat(1).filter((data=>!seenPath.has(data.symbol)&&(seenPath.add(data.symbol),!0)))},downloaderAElement=document.createElement("a");downloaderAElement.download=(1===filterArr.length&&filterArr[0]?filterArr[0].replace(/::/g,"_"):domain+"_recipeTypeList")+(options?.referencedRecipeTypes?"+ref":"")+".json",downloaderAElement.href="data:application/json;charset=utf8,"+encodeURI(JSON.stringify(resultMessage)),downloaderAElement.style.display="none",document.body.appendChild(downloaderAElement),downloaderAElement.click(),downloaderAElement.remove(),TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})})).catch((errorDetails=>{errorDetails instanceof globalThis.Error?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Unknown error in downloadRecipeTypesEx",domain:"TcHmi.Server.RecipeManagement",exception:errorDetails}}):TcHmi.Callback.callSafeEx(callback,null,{error:errorDetails?.code,details:errorDetails})})),{code:TcHmi.Errors.NONE}}
/**
             * Uploads one or more recipe files (each containing one or all recipes or recipe types of a server).
             * This needs to be triggered by a user interaction (not on load or symbol change).
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static uploadRecipeFiles(callback=null){return this.uploadRecipeFilesEx(null,null,callback)}
/**
             * Uploads one or more recipe files (each containing one or all recipes or recipe types of a server).
             * This needs to be triggered by a user interaction (not on load or symbol change).
             * This function provides more options to manipulate the request
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static uploadRecipeFilesEx(options,requestOptions=null,callback=null){let domain;if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid}const inputElement=document.createElement("input");inputElement.type="file",inputElement.accept=".json",inputElement.multiple=!0;let pendingFileCount=0;return inputElement.addEventListener("change",(()=>{if(inputElement.files){pendingFileCount+=inputElement.files.length;for(const file of inputElement.files){const reader=new FileReader;reader.addEventListener("loadend",(()=>{if(pendingFileCount<=0)return;const request=TcHmi.ValueConverter.toObject(reader.result);if(!request)return pendingFileCount=0,void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Selected file to upload has invalid content.",domain:"TcHmi.Server.RecipeManagment"}});options?.parallel&&(requestOptions?requestOptions.parallel=!0:requestOptions={parallel:!0}),TcHmi.Server.requestEx(request,requestOptions,(data=>{if(!(pendingFileCount<=0)){if(data.error||!data.results)return pendingFileCount=0,void TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details});for(const res of data.results)if(res.error!==TcHmi.Errors.NONE)return pendingFileCount=0,void TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details});pendingFileCount--,pendingFileCount<=0&&TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))})),reader.addEventListener("error",(data=>{pendingFileCount<=0||(pendingFileCount=0,TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Reading recipe file to upload has failed.",domain:"TcHmi.Server.RecipeManagment"}}))})),reader.readAsText(file)}}else pendingFileCount=0,TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})})),inputElement.click(),{code:TcHmi.Errors.NONE}}}_a=RecipeManagement,_RecipeManagement_fetchAllRecipeTypes=function _RecipeManagement_fetchAllRecipeTypes(filterList,path,options,requestOptions){const domain=options?.domain??"TcHmiRecipeManagement",allTypePromises=[];for(const filter of filterList){const recipeTypeFullPath=path&&filter?path+"::"+filter:filter||(path||"");allTypePromises.push(new Promise(((typeResolve,typeReject)=>{TcHmi.Server.RecipeManagement.getRecipeTypeEx(recipeTypeFullPath,null,options,requestOptions,(typeData=>{if(typeData.error||!typeData.value){const errorDetail={code:typeData.error,message:TcHmi.Errors[typeData.error],reason:"Request for type "+recipeTypeFullPath+" failed.",domain:"TcHmi.Server.RecipeManagement",errors:typeData.details?[typeData.details]:void 0};return void typeReject(errorDetail)}const recipeTypeOrFolder=typeData.value,recipeTypeCommand={symbol:domain+".Config::recipeTypeList"+(recipeTypeFullPath?"::"+recipeTypeFullPath:""),writeValue:recipeTypeOrFolder};if(options?.referencedRecipeTypes&&""!==recipeTypeFullPath){const allSubTypes=new Set,findTypesInRecipeTypeFolder=currentRecipeTypeOrFolder=>{if(this.isRecipeType(currentRecipeTypeOrFolder))for(const reference of currentRecipeTypeOrFolder.recipeTypeNames??[])allSubTypes.add(reference);else for(const subRecipeType of Object.values(currentRecipeTypeOrFolder))findTypesInRecipeTypeFolder(subRecipeType)};findTypesInRecipeTypeFolder(recipeTypeOrFolder),__classPrivateFieldGet(this,_a,"m",_RecipeManagement_fetchAllRecipeTypes).call(this,allSubTypes,null,options,requestOptions).then((data=>{typeResolve([...data,recipeTypeCommand])})).catch((err=>{typeReject(err)}))}else typeResolve([recipeTypeCommand])}))})))}return Promise.all(allTypePromises).then((data=>Promise.resolve(data.flat(1))))},Server.RecipeManagement=RecipeManagement,function(RecipeManagement){RecipeManagement.isRecipe=function(candidate){return"string"==typeof candidate.recipeTypeName&&"object"==typeof candidate.values&&null!==candidate.values},RecipeManagement.isRecipeType=function(candidate){if("object"!=typeof candidate.members||null===candidate.members)return!1;for(const member of Object.values(candidate.members))if("string"!=typeof member.recipeType){if("string"!=typeof member.symbol)return!1;if(!("defaultValue"in member))return!1}const additionalChecksRequired=0===Object.keys(candidate.members).length;let recipeTypeNamesValid=!1,optionsValid=!1;if("recipeTypeNames"in candidate){if(!Array.isArray(candidate.recipeTypeNames))return!1;for(const entry of candidate.recipeTypeNames){if("string"!=typeof entry)return!1;recipeTypeNamesValid=!0}}if("options"in candidate){if("object"!=typeof candidate.options||null===candidate.options)return!1;if("enabled"in candidate.options){if("None"!==candidate.options.enabled&&"Disabled"!==candidate.options.enabled)return!1;optionsValid=!0}if("comment"in candidate.options){if("string"!=typeof candidate.options.comment)return!1;optionsValid=!0}}return!(additionalChecksRequired&&!recipeTypeNamesValid&&!optionsValid)}}(RecipeManagement=Server.RecipeManagement||(Server.RecipeManagement={}));Server.Historize=class{
/**
             * Adding a Symbol to the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param settings
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */
static add(symbolName,settings,callback=null){return this.addEx2(symbolName,settings,null,null,callback)}
/**
             * Adding a Symbol to the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param settings
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static addEx(symbolName,settings,requestOptions,callback=null){return this.addEx2(symbolName,settings,null,requestOptions,callback)}
/**
             * Adding a Symbol to the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param settings
             * @param options global settings
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static addEx2(symbolName,settings,options,requestOptions,callback=null){if(!symbolName){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Invalid parameter symbolName given",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}if(null==settings||"object"!=typeof settings){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Invalid parameter settings given",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain="TcHmiSqliteHistorize";options&&"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain);let writeValue={interval:"PT1S",maxEntries:1e4,rowLimit:1e4,recordingEnabled:!0};void 0!==settings.INTERVAL&&(writeValue.interval=settings.INTERVAL),void 0!==settings.MAXENTRIES&&(writeValue.maxEntries=settings.MAXENTRIES),void 0!==settings.ROWLIMIT&&(writeValue.rowLimit=settings.ROWLIMIT),void 0!==settings.RECORDINGENABLED&&(writeValue.recordingEnabled=settings.RECORDINGENABLED);const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::historizedSymbolList::"+symbolName,writeValue:writeValue}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Removing a Symbol from the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static remove(symbolName,callback=null){return this.removeEx2(symbolName,null,null,callback)}
/**
             * Removing a Symbol from the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static removeEx(symbolName,requestOptions,callback=null){return this.removeEx2(symbolName,null,requestOptions,callback)}
/**
             * Removing a Symbol from the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param options global settings
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static removeEx2(symbolName,options,requestOptions,callback=null){if(!symbolName){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Invalid parameter symbolName given",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain="TcHmiSqliteHistorize";options&&"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain);const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue","Delete"],symbol:domain+".Config::historizedSymbolList::"+symbolName}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Update a config of a Symbol in the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param settings
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static update(symbolName,settings,callback=null){return this.updateEx2(symbolName,settings,null,null,callback)}
/**
             * Update a config of a Symbol in the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param settings
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static updateEx(symbolName,settings,requestOptions,callback=null){return this.updateEx2(symbolName,settings,null,requestOptions,callback)}
/**
             * Update a config of a Symbol in the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param settings
             * @param options global settings
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static updateEx2(symbolName,settings,options,requestOptions,callback=null){if(!symbolName){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Invalid parameter symbolName given",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}if(null==settings||"object"!=typeof settings){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Invalid parameter settings given",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain="TcHmiSqliteHistorize";options&&"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain);const readRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage"],symbol:domain+".Config::historizedSymbolList::"+symbolName}]};if(null===Server.requestEx(readRequest,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{let readValue=data.results[0].value;if(!readValue)return void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_READVALUE_MISSING});let writeValue=tchmi_clone_object(readValue);void 0!==settings.INTERVAL&&(writeValue.interval=settings.INTERVAL),void 0!==settings.MAXENTRIES&&(writeValue.maxEntries=settings.MAXENTRIES),void 0!==settings.ROWLIMIT&&(writeValue.rowLimit=settings.ROWLIMIT),void 0!==settings.RECORDINGENABLED&&(writeValue.recordingEnabled=settings.RECORDINGENABLED);const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::historizedSymbolList::"+symbolName,writeValue:writeValue}]};Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Gets the current config of a Symbol in the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static get(symbolName,callback=null){return this.getEx2(symbolName,null,null,callback)}
/**
             * Gets the current config of a Symbol in the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static getEx(symbolName,requestOptions,callback=null){return this.getEx2(symbolName,null,requestOptions,callback)}
/**
             * Gets the current config of a Symbol in the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param options global settings
             * @param requestOptions Options for the request itself
             * @param callback Will be called after request.
             * @preserve (Part of the public API)
             */static getEx2(symbolName,options,requestOptions,callback=null){if(!symbolName){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Invalid parameter symbolName given.",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain="TcHmiSqliteHistorize";options&&"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain);const readRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::historizedSymbolList::"+symbolName}]};if(null===Server.requestEx(readRequest,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{let readValue=data.results[0].value;if(!readValue)return void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_READVALUE_MISSING});let settings={};void 0!==readValue.interval&&(settings.INTERVAL=readValue.interval),void 0!==readValue.maxEntries&&(settings.MAXENTRIES=readValue.maxEntries),void 0!==readValue.rowLimit&&(settings.ROWLIMIT=readValue.rowLimit),void 0!==readValue.recordingEnabled&&(settings.RECORDINGENABLED=readValue.recordingEnabled),TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,key:symbolName,settings:settings})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}};class Events{static confirmAlarm(alarm,callback){let rawAlarm={name:alarm.name,domain:alarm.sourceDomain,severity:alarm.severity,timeRaised:alarm.timeRaised.toISOString(),params:alarm.params,id:alarm.id,timeCleared:alarm.timeCleared?.toISOString()??null,timeConfirmed:alarm.timeConfirmed?.toISOString()??null,alarmState:alarm.alarmState,confirmationState:alarm.confirmationState};if(TcHmi.System.Services.serverEventManager)TcHmi.System.Services.serverEventManager.confirmAlarm(rawAlarm,callback);else{const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to confirm alarm. System not ready.",domain:"TcHmi.Server.Events"};TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}}static registerConsumer(filter,callbacks,doneCallback){let parsedFilter;try{parsedFilter=TcHmi.System.Filter.parse(filter,TcHmi.Type.getSchema("tchmi:server#/definitions/eventFilter"))}catch(e){const error={error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"An uncaught exception occurred while parsing the filter",exception:e,domain:"TcHmi.Server.Events"}};return TcHmi.Callback.callSafeEx(callbacks.list,null,error),TcHmi.Callback.callSafeEx(callbacks.subscription,null,error),TcHmi.Callback.callSafeEx(doneCallback,null,error),null}let consumer={filter:parsedFilter,rawFilter:filter,activeAlarmIds:[],listCallback:callbacks.list,subscriptionCallback:callbacks.subscription,registration:{listPending:void 0!==callbacks.list,subscriptionPending:void 0!==callbacks.subscription,callback:doneCallback}};return this.__consumersToAdd.push(consumer),-1!==this.__registerTimeoutId&&window.clearTimeout(this.__registerTimeoutId),this.__registerTimeoutId=window.setTimeout((()=>{this.__registerTimeoutId=-1,this.__addConsumers()}),200),()=>{const indexToAdd=this.__consumersToAdd.indexOf(consumer),indexAdded=this.__consumers.indexOf(consumer);-1!==indexToAdd&&this.__consumersToAdd.splice(indexToAdd,1),-1!==indexAdded&&(this.__consumers.splice(indexAdded,1),consumer.subscriptionCallback&&(-1!==this.__unregisterTimeoutId&&window.clearTimeout(this.__unregisterTimeoutId),this.__unregisterTimeoutId=window.setTimeout((()=>{this.__unregisterTimeoutId=-1,this.__updateSubscription()}),500)))}}static __addConsumers(){this.__listEvents(this.__consumersToAdd),this.__consumers.push(...this.__consumersToAdd),this.__consumersToAdd=[],this.__updateSubscription((data=>{for(const consumer of this.__consumers)consumer.registration.subscriptionPending&&(consumer.registration.subscriptionPending=!1,!consumer.registration.listPending&&consumer.registration.callback&&TcHmi.Callback.callSafeEx(consumer.registration.callback,null,data))}))}static __feedListConsumers(consumers,events){for(let i=0,ii=consumers.length;i<ii;i++){let consumer=consumers[i];if(!consumer.listCallback)continue;consumer.activeAlarmIds=[];let eventsForConsumer=[];for(let j=0,jj=events.length;j<jj;j++){let parsedEvent=this.parseServerEvent(events[j]);consumer.filter.test(parsedEvent)&&(eventsForConsumer.push(parsedEvent),Events.isAlarm(parsedEvent)&&parsedEvent.id>-1&&!consumer.activeAlarmIds.includes(parsedEvent.id)&&consumer.activeAlarmIds.push(parsedEvent.id))}TcHmi.Callback.callSafeEx(consumer.listCallback,null,{error:TcHmi.Errors.NONE,events:eventsForConsumer}),consumer.registration.listPending&&(consumer.registration.listPending=!1,!consumer.registration.subscriptionPending&&consumer.registration.callback&&TcHmi.Callback.callSafeEx(consumer.registration.callback,null,{error:TcHmi.Errors.NONE}))}}static __feedSubscriptionConsumers(event){for(let i=0,ii=this.__consumers.length;i<ii;i++){let consumer=this.__consumers[i];if(!consumer.subscriptionCallback)continue;let parsedEvent=this.parseServerEvent(event);if(consumer.filter.test(parsedEvent))Events.isAlarm(parsedEvent)&&parsedEvent.id>-1&&!consumer.activeAlarmIds.includes(parsedEvent.id)&&consumer.activeAlarmIds.push(parsedEvent.id),consumer.subscriptionCallback({error:TcHmi.Errors.NONE,event:parsedEvent,changeType:this.__toServerEventChangeType(event.changeType),removedByFilter:!1});else if(Events.isAlarm(parsedEvent)&&parsedEvent.id>-1){let alarmIndex=consumer.activeAlarmIds.indexOf(parsedEvent.id);-1!==alarmIndex&&(consumer.activeAlarmIds.splice(alarmIndex,1),TcHmi.Callback.callSafeEx(consumer.subscriptionCallback,null,{error:TcHmi.Errors.NONE,event:parsedEvent,changeType:this.__toServerEventChangeType(event.changeType),removedByFilter:!0}))}}}static __listEvents(consumers){if(!TcHmi.System.Services.serverEventManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to handle events. System not ready.",domain:"TcHmi.Server.Events"};for(const consumer of consumers)TcHmi.Callback.callSafeEx(consumer.listCallback,null,{error:errorDetail.code,details:errorDetail}),consumer.registration.listPending&&(consumer.registration.listPending=!1,!consumer.registration.subscriptionPending&&consumer.registration.callback&&TcHmi.Callback.callSafeEx(consumer.registration.callback,null,{error:errorDetail.code,details:errorDetail}));return}const filter=this.__accumulateFilters(consumers,!1);void 0!==filter&&TcHmi.System.Services.serverEventManager.listEvents(filter,(data=>{if(data.error===TcHmi.Errors.NONE&&data.events)this.__feedListConsumers(consumers,data.events);else for(const consumer of consumers)TcHmi.Callback.callSafeEx(consumer.listCallback,null,{error:data.error,details:data.details}),consumer.registration.listPending&&(consumer.registration.listPending=!1,!consumer.registration.subscriptionPending&&consumer.registration.callback&&TcHmi.Callback.callSafeEx(consumer.registration.callback,null,{error:data.error,details:data.details}))}))}static __updateSubscription(callback){if(!TcHmi.System.Services.serverEventManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to handle events. System not ready.",domain:"TcHmi.Server.Events"};return void TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}const filter=this.__accumulateFilters(this.__consumers,!0);if(void 0!==filter)if(-1===this.__subscriptionId){let subscriptionId=TcHmi.System.Services.serverEventManager.subscribe(filter,this.__onEventReveived(),callback);subscriptionId?(this.__subscriptionId=subscriptionId,this.__onLocaleChangedDestroyer=TcHmi.EventProvider.register("onLocaleChanged",this.__onLocaleChanged())):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Server] Reached maxium of parallel requests.")}else TcHmi.System.Services.serverEventManager.updateSubscription(this.__subscriptionId,filter,callback);else-1!==this.__subscriptionId&&(TcHmi.System.Services.serverEventManager.unsubscribe(this.__subscriptionId,callback),this.__subscriptionId=-1,this.__onLocaleChangedDestroyer&&(this.__onLocaleChangedDestroyer(),this.__onLocaleChangedDestroyer=null))}static __onEventReveived(){return data=>{data.error===TcHmi.Errors.NONE&&data.event?this.__feedSubscriptionConsumers(data.event):this.__consumers.forEach((consumer=>TcHmi.Callback.callSafeEx(consumer.subscriptionCallback,null,{error:data.error})))}}static __onLocaleChanged(){return()=>{this.__listEvents(this.__consumers)}}static __accumulateFilters(consumers,forSubscription){let filter;if(1===consumers.length)filter=forSubscription&&consumers[0].subscriptionCallback||!forSubscription&&consumers[0].listCallback?consumers[0].rawFilter:void 0;else{filter=[];for(let i=0,ii=consumers.length;i<ii;i++){if(forSubscription&&!consumers[i].subscriptionCallback||!forSubscription&&!consumers[i].listCallback)continue;const rawFilter=consumers[i].rawFilter;if(null===rawFilter||0===rawFilter.length){filter=null;break}filter.push(1===rawFilter.length?rawFilter[0]:rawFilter),i+1!==ii&&filter.push({logic:"OR"})}null!==filter&&0===filter.length&&(filter=void 0)}return filter}static parseServerEvent(rawEvent){switch(rawEvent.payloadType??Events.Type.Payload){case Events.Type.Message:let rawMessage=rawEvent.payload,message={type:Events.Type.Message,domain:rawEvent.domain,sourceDomain:rawMessage.domain,name:rawMessage.name,severity:rawMessage.severity,text:rawEvent.localizedString,timeRaised:new Date(rawMessage.timeRaised),timeReceived:new Date(rawEvent.timeReceived),params:rawMessage.params};return void 0!==rawEvent.sessionId&&(message.sessionId=rawEvent.sessionId),message;case Events.Type.Alarm:let rawAlarm=rawEvent.payload,alarm={type:Events.Type.Alarm,domain:rawEvent.domain,sourceDomain:rawAlarm.domain,name:rawAlarm.name,severity:rawAlarm.severity,id:rawAlarm.id,text:rawEvent.localizedString,timeRaised:new Date(rawAlarm.timeRaised),timeCleared:rawAlarm.timeCleared?new Date(rawAlarm.timeCleared):null,timeConfirmed:rawAlarm.timeConfirmed?new Date(rawAlarm.timeConfirmed):null,timeReceived:new Date(rawEvent.timeReceived),alarmState:rawAlarm.alarmState,confirmationState:rawAlarm.confirmationState,params:rawAlarm.params};return void 0!==rawEvent.sessionId&&(alarm.sessionId=rawEvent.sessionId),alarm;case Events.Type.Payload:let payloadEvent={type:Events.Type.Payload,domain:rawEvent.domain,name:rawEvent.name,timeReceived:new Date(rawEvent.timeReceived)};return void 0!==rawEvent.payload&&(payloadEvent.payload=rawEvent.payload),void 0!==rawEvent.sessionId&&(payloadEvent.sessionId=rawEvent.sessionId),payloadEvent}}static __toServerEventChangeType(alarmChangeType){if(void 0===alarmChangeType)return Events.ChangeType.MessageSent;switch(alarmChangeType){case TcHmi.Server.Events.ServerAlarmChangeType.Raise:return Events.ChangeType.AlarmRaised;case TcHmi.Server.Events.ServerAlarmChangeType.Change:return Events.ChangeType.AlarmChanged;case TcHmi.Server.Events.ServerAlarmChangeType.Dispose:return Events.ChangeType.AlarmDisposed}}static createEvent(event,callback){if(TcHmi.System.isParameterTypeInvalid(event,"event",{type:"object",required:"valueNeeded",expectArray:!1},"TcHmi.Server.Events",callback))return;const rawEvent={domain:event.domain,name:event.name,timeReceived:event.timeReceived.toISOString()};switch(event.sessionId&&(rawEvent.sessionId=event.sessionId),event.type){case Events.Type.Message:const rawMessage={name:event.name,domain:event.domain,severity:event.severity,timeRaised:event.timeRaised.toISOString(),params:event.params};rawEvent.payloadType=Events.Type.Message,rawEvent.payload=rawMessage,event.text&&(rawEvent.localizedString=event.text);break;case Events.Type.Payload:event.payload&&(rawEvent.payloadType=Events.Type.Payload,rawEvent.payload=event.payload)}Server.writeSymbol("CreateEvent",rawEvent,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,this,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}}))}}Events.__consumers=[],Events.__consumersToAdd=[],Events.__registerTimeoutId=-1,Events.__unregisterTimeoutId=-1,Events.__subscriptionId=-1,Events.__onLocaleChangedDestroyer=null,Server.Events=Events,function(Events){let Type,Severity,AlarmState,ConfirmationState,ChangeType,ServerAlarmChangeType;!function(Type){Type[Type.Message=0]="Message",Type[Type.Alarm=1]="Alarm",Type[Type.Payload=2]="Payload"}(Type=Events.Type||(Events.Type={})),function(Severity){Severity[Severity.Verbose=0]="Verbose",Severity[Severity.Info=1]="Info",Severity[Severity.Warning=2]="Warning",Severity[Severity.Error=3]="Error",Severity[Severity.Critical=4]="Critical"}(Severity=Events.Severity||(Events.Severity={})),function(AlarmState){AlarmState[AlarmState.Raised=0]="Raised",AlarmState[AlarmState.Confirmed=1]="Confirmed",AlarmState[AlarmState.Cleared=2]="Cleared",AlarmState[AlarmState.ClearedAndConfirmed=3]="ClearedAndConfirmed",AlarmState[AlarmState.Invalid=4]="Invalid"}(AlarmState=Events.AlarmState||(Events.AlarmState={})),function(ConfirmationState){ConfirmationState[ConfirmationState.NotSupported=0]="NotSupported",ConfirmationState[ConfirmationState.NotRequired=1]="NotRequired",ConfirmationState[ConfirmationState.WaitForConfirmation=2]="WaitForConfirmation",ConfirmationState[ConfirmationState.Confirmed=3]="Confirmed",ConfirmationState[ConfirmationState.Reset=4]="Reset"}(ConfirmationState=Events.ConfirmationState||(Events.ConfirmationState={})),function(ChangeType){ChangeType[ChangeType.AlarmRaised=0]="AlarmRaised",ChangeType[ChangeType.AlarmChanged=1]="AlarmChanged",ChangeType[ChangeType.AlarmDisposed=2]="AlarmDisposed",ChangeType[ChangeType.MessageSent=3]="MessageSent"}(ChangeType=Events.ChangeType||(Events.ChangeType={})),function(ServerAlarmChangeType){ServerAlarmChangeType[ServerAlarmChangeType.Raise=0]="Raise",ServerAlarmChangeType[ServerAlarmChangeType.Change=1]="Change",ServerAlarmChangeType[ServerAlarmChangeType.Dispose=2]="Dispose"}(ServerAlarmChangeType=Events.ServerAlarmChangeType||(Events.ServerAlarmChangeType={})),Events.isAlarm=function(value){return value.type===Type.Alarm},Events.isMessage=function(value){return value.type===Type.Message},Events.isPayload=function(value){return value.type===Type.Payload}}(Events=Server.Events||(Server.Events={}));class ADS{static checkLicense(licenseId,callback=null){return Server.ADS.checkLicenseEx(licenseId,null,callback)}static checkLicenseEx(licenseId,requestOptions,callback=null){return licenseId?(TcHmi.Server.requestEx({requestType:"ReadWrite",commands:[{symbol:"ADS.CheckLicense",writeValue:licenseId,commandOptions:["SendWriteValue","SendErrorMessage"]}]},requestOptions,(data=>{if(data.error===TcHmi.Errors.NONE){let response=data.response;if(!response)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_MISSING],reason:"Missing response from server.",domain:"TcHmi.Server.ADS"}}),{code:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_MISSING],reason:"Missing response from server.",domain:"TcHmi.Server.ADS"};if(response.error)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],reason:"Error in response from server with id: "+response.id,domain:"TcHmi.Server.ADS",errors:[response.error]}}),{code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],reason:"Error in response from server with id: "+response.id,domain:"TcHmi.Server.ADS",errors:[response.error]};let commands=response.commands;if(!commands)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,details:{code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:"Missing commands in response from server with id: "+response.id,domain:"TcHmi.Server.ADS"}}),{code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:"Missing commands in response from server with id: "+response.id,domain:"TcHmi.Server.ADS"};let command=null;for(let i=0,ii=commands.length;i<ii;i++){if(command=commands[i],"ADS.CheckLicense"===command.symbol){if(command.error)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_COMMAND_ERROR,details:{code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:'Error in command for symbol: "ADS.CheckLicense" in response from server with id: '+response.id,domain:"TcHmi.Server.ADS",errors:[command.error]}}),{code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:'Error in command for symbol: "ADS.CheckLicense" in response from server with id: '+response.id,domain:"TcHmi.Server.ADS",errors:[command.error]};break}command=null}if(!command)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_COMMAND_MISSING,details:{code:TcHmi.Errors.E_SERVER_COMMAND_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_MISSING],reason:'Missing command for symbol: "ADS.CheckLicense" in response from server with id: '+response.id,domain:"TcHmi.Server.ADS"}}),{code:TcHmi.Errors.E_SERVER_COMMAND_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_MISSING],reason:'Missing command for symbol: "ADS.CheckLicense" in response from server with id: '+response.id,domain:"TcHmi.Server.ADS"};let rv=command.readValue;return rv?(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,count:rv.count,expireTimeUTC:rv.expireTimeUTC,result:rv.result}),{code:TcHmi.Errors.NONE,message:TcHmi.Errors[TcHmi.Errors.NONE]}):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_READVALUE_MISSING,details:{code:TcHmi.Errors.E_SERVER_READVALUE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_READVALUE_MISSING],reason:'Missing property: "readValue" in command for symbol: "ADS.CheckLicense" in response from server with id: '+response.id,domain:"TcHmi.Server.ADS"}}),{code:TcHmi.Errors.E_SERVER_READVALUE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_READVALUE_MISSING],reason:'Missing property: "readValue" in command for symbol: "ADS.CheckLicense" in response from server with id: '+response.id,domain:"TcHmi.Server.ADS"})}return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request failed.",domain:"TcHmi.Server.ADS",errors:data.details?[data.details]:void 0}}),{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request failed.",domain:"TcHmi.Server.ADS",errors:data.details?[data.details]:void 0}})),{code:TcHmi.Errors.NONE,message:TcHmi.Errors[TcHmi.Errors.NONE]}):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'Parameter: "licenseId" must not be empty or undefined or null.',domain:"TcHmi.Server.ADS"}}),{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'Parameter: "licenseId" must not be empty or undefined or null.',domain:"TcHmi.Server.ADS"})}}Server.ADS=ADS,function(ADS){let CheckLicenseResult;!function(CheckLicenseResult){CheckLicenseResult[CheckLicenseResult.S_VALID=0]="S_VALID",CheckLicenseResult[CheckLicenseResult.S_PENDING=515]="S_PENDING",CheckLicenseResult[CheckLicenseResult.E_LICENSENOTFOUND=-403769124]="E_LICENSENOTFOUND",CheckLicenseResult[CheckLicenseResult.E_LICENSEEXPIRED=-403769125]="E_LICENSEEXPIRED",CheckLicenseResult[CheckLicenseResult.E_LICENSEEXCEEDED=-403769126]="E_LICENSEEXCEEDED",CheckLicenseResult[CheckLicenseResult.E_LICENSEINVALID=-403769127]="E_LICENSEINVALID",CheckLicenseResult[CheckLicenseResult.E_LICENSESYSTEMID=-403769128]="E_LICENSESYSTEMID",CheckLicenseResult[CheckLicenseResult.E_LICENSENOTIMELIMIT=-403769129]="E_LICENSENOTIMELIMIT",CheckLicenseResult[CheckLicenseResult.E_LICENSEFUTUREISSUE=-403769130]="E_LICENSEFUTUREISSUE",CheckLicenseResult[CheckLicenseResult.E_LICENSETIMETOLONG=-403769131]="E_LICENSETIMETOLONG"}(CheckLicenseResult=ADS.CheckLicenseResult||(ADS.CheckLicenseResult={}))}(ADS=Server.ADS||(Server.ADS={}));Server.Domains=class{static watch(name,callback){let destroy,s=new TcHmi.Symbol("%s%ListDomains%/s%");return destroy=s.watch((data=>{destroy||(destroy=data.destroy),data&&data.error===TcHmi.Errors.NONE?data.value&&data.value[name]?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value[name]),destroy:destroy}):TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_DOMAIN_UNKNOWN,details:{code:TcHmi.Errors.E_SERVER_DOMAIN_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_DOMAIN_UNKNOWN],reason:"Domain is unknown!",domain:"TcHmi.Server.Domains",errors:data.details?[data.details]:void 0}}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})})),()=>{destroy&&(destroy(),destroy=void 0),s?.destroy(),s=null}}}}(Server=TcHmi.Server||(TcHmi.Server={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * Provides functions for manipulating HTML elements.
     * @preserve (Part of the public API)
     */
class StyleProvider{
/**
         * Returns the given computed CSS property on the first given element. Does return values set by CSS files, the other Style APIs and AnimationProvider
         * Unset or unknown CSS values will not be set in the result object.
         * @param element The jQuery collection or single HTML/SVG element.
         * @param propertyNameOrPropertyNames The CSS property (string) or properties (string array) to get.
         * @preserve (Part of the public API)
         */
static getComputedElementStyle(element,propertyNameOrPropertyNames){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to get style. System not ready.");return TcHmi.System.Services.styleManager.__getElementStyle(element,propertyNameOrPropertyNames,!0)}
/**
         * Returns the given CSS property on the first given element. Does not return values set by CSS files, the other Style APIs and AnimationProvider
         * @param element The jQuery element.
         * @param propertyNameOrPropertyNames The CSS property (string) or properties (string array) to get.
         * @preserve (Part of the public API)
         */static getSimpleElementStyle(element,propertyNameOrPropertyNames){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to get style. System not ready.");return TcHmi.System.Services.styleManager.__getElementStyle(element,propertyNameOrPropertyNames,!1)}
/**
         * Style setter for simple styles in a collection of JQuery elements or single HTML or SVG Elements.
         * @param element The jQuery element.
         * @param propertyName The CSS property to process or a dictionary of property value pairs.
         * @param [value] The value for the CSS property or an array of values. Only used if second parameter is no object.
         * @preserve (Part of the public API)
         */static setSimpleElementStyle(element,propertyNameOrPropertyNames,valueOrValues=null){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.__setSimpleElementStyle(element,propertyNameOrPropertyNames,valueOrValues)}static processGenericStyle(controlName,selector,propertyName,value=null){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processGenericStyle(controlName,selector,propertyName,value)}
/**
         * Resolves a SolidColor object to a string representation for use as css color property.
         * Has to be called with a valid SolidColor. Use isSolidColor to check
         * @param colorObject The SolidColor to resolve.
         * @preserve (Part of the public API)
         */static resolveSolidColorAsCssValue(colorObject){return"none"===colorObject.color.toLowerCase()?"transparent":colorObject.color}
/**
         * Resolve a SolidColor object to a RGBAColor object.
         * Has to be called with a valid SolidColor. Use isSolidColor to check
         * @param colorObject The SolidColor to resolve.
         * @preserve (Part of the public API)
         */static resolveSolidColorAsRGBA(colorObject){const canvas=document.createElement("canvas");canvas.width=canvas.height=1;const ctx=canvas.getContext("2d");ctx.clearRect(0,0,1,1),ctx.fillStyle=StyleProvider.resolveSolidColorAsCssValue(colorObject),ctx.fillRect(0,0,1,1);const rgba=ctx.getImageData(0,0,1,1).data;return{r:rgba[0],g:rgba[1],b:rgba[2],a:rgba[3]}}
/**
         * Normalize a SolidColor object
         * Every supported color format will be returned as
         * for example '#ff0000' or with transparency as 'rgba(255, 0, 0, 0.333)'
         * Has to be called with a valid SolidColor. Use isSolidColor to check
         * @param colorObject The SolidColor to normalize.
         * @preserve (Part of the public API)
         */static normalizeColorAsCssValue(colorObject){const savedColor=StyleProvider.__normalizedColorMap.get(colorObject.color);if(savedColor)return savedColor;const ctx=document.createElement("canvas").getContext("2d");ctx.strokeStyle=StyleProvider.resolveSolidColorAsCssValue(colorObject);const resolvedColor=ctx.strokeStyle;return StyleProvider.__normalizedColorMap.set(colorObject.color,resolvedColor),resolvedColor}
/**
         * Resolves a LinearGradientColor object to a string representation for use in css background-image property.
         * Has to be called with a valid LinearGradientColor. Use isLinearGradientColor to check
         * @param colorObject The LinearGradientColor to resolve.
         * @preserve (Part of the public API)
         */static resolveLinearGradientColorAsCssValue(colorObject){let angle=colorObject.angle;null==angle&&(angle=0);let backgroundCssString="linear-gradient(";if(backgroundCssString+=angle+"deg",colorObject.stopPoints)for(let i=0,ii=colorObject.stopPoints.length;i<ii;i++){let stopPoint=colorObject.stopPoints[i];void 0!==stopPoint.stop&&null!==stopPoint.stop?backgroundCssString+=","+stopPoint.color+" "+stopPoint.stop:backgroundCssString+=","+stopPoint.color}return backgroundCssString+=")",backgroundCssString}
/**
         * Style Processor for background.
         * @param element The jQuery element.
         * @param valueNew  The new value for the background.
         * @preserve (Part of the public API)
         */static processBackground(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processBackground(element,valueNew)}
/**
         * Style Processor for background colors and gradients.
         * @param element The jQuery element.
         * @param valueNew  The new value for the background.
         * @preserve (Part of the public API)
         */static processBackgroundColor(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processBackground(element,{color:valueNew})}
/**
         * Style Processor for background images.
         * @param element The jQuery element.
         * @param valueNew  The URL of the image.
         * @preserve (Part of the public API)
         */static processBackgroundImage(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processBackground(element,{image:valueNew})}
/**
         * Style processor for SVG fill color.
         * @param element The jQuery element.
         * @param valueNew The new fill color.
         * @preserve (Part of the public API)
         * HTMLElement allowed because default jQuery type is HTMLElement
         */static processFillColor(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processFillColor(element,valueNew)}
/**
         * Style processor for SVG stroke color.
         * @param element The jQuery element.
         * @param valueNew      The new stroke color.
         * @preserve (Part of the public API)
         * HTMLElement allowed because default jQuery type is HTMLElement
         */static processStrokeColor(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processStrokeColor(element,valueNew)}
/**
         * Style processor for text color.
         * @param element The jQuery element.
         * @param valueNew      The new text color.
         * @preserve (Part of the public API)
         */static processTextColor(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processTextColor(element,valueNew)}
/**
         * Style processor for border color.
         * @param element The jQuery element.
         * @param valueNew The new border color.
         * @preserve (Part of the public API)
         */static processBorderColor(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processBorderColor(element,valueNew)}
/**
         * Style processor for border width.
         * @param element The jQuery element.
         * @param valueNew The new border widths.
         * @preserve (Part of the public API)
         */static processBorderWidth(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processBorderWidth(element,valueNew)}
/**
         * Style processor for border radius.
         * @param element The jQuery element.
         * @param valueNew The new border radii.
         * @preserve (Part of the public API)
         */static processBorderRadius(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processBorderRadius(element,valueNew)}
/**
         * Style processor for border style.
         * @param element The jQuery element.
         * @param valueNew The new border styles.
         * @preserve (Part of the public API)
         */static processBorderStyle(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processBorderStyle(element,valueNew)}
/**
         * Style processor for box shadow.
         * @param element The jQuery element.
         * @param valueNew      The new border styles.
         * @preserve (Part of the public API)
         */static processBoxShadow(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processBoxShadow(element,valueNew)}
/**
         * Style processor for font family.
         * @param element The jQuery element.
         * @param valueNew      The new font family.
         * @preserve (Part of the public API)
         */static processFontFamily(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processFontFamily(element,valueNew)}
/**
         * Style processor for font size.
         * @param element The jQuery element.
         * @param valueNew      The new font size.
         * @param unitNew       The new font size unit. Defaults to "px".
         * @preserve (Part of the public API)
         */static processFontSize(element,valueNew,unitNew="px"){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processFontSize(element,valueNew,unitNew)}
/**
         * Style processor for font style.
         * @param element The jQuery element.
         * @param valueNew      The new font style. Allowed values are "Normal", "Italic" and "Oblique".
         * @preserve (Part of the public API)
         */static processFontStyle(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processFontStyle(element,valueNew)}
/**
         * Style processor for font weight.
         * @param element The jQuery element.
         * @param valueNew      The new font weight. Allowed values are "Normal" and "Bold".
         * @preserve (Part of the public API)
         */static processFontWeight(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processFontWeight(element,valueNew)}
/**
         * Style processor for visibility.
         * Visibility also affects pointer events, i.e. a hidden element will not receive mouse click events.
         * Hidden still uses space in fluid calculations, collapsed is ignored there.
         * @param element The jQuery element.
         * @param valueNew      The new visibility. Allowed values are "Visible", "Collapsed" and "Hidden". Hidden still uses space in fluid calculations, collapsed is ignored there.
         * @preserve (Part of the public API)
         */static processVisibility(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processVisibility(element,valueNew)}
/**
         * Style processor for horizontal alignment. This aligns the content of the target element, not the target element itself.
         * @param element The jQuery element.
         * @param valueNew      The new horizontal alignment. Allowed values are "Left", "Center" and "Right".
         * @preserve (Part of the public API)
         */static processContentHorizontalAlignment(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processContentHorizontalAlignment(element,valueNew)}
/**
         * Style processor for vertical alignment. This aligns the content of the target element, not the target element itself.
         * @param element The jQuery element.
         * @param valueNew      The new vertical alignment. Allowed values are "Top", "Center" and "Bottom".
         * @preserve (Part of the public API)
         */static processContentVerticalAlignment(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processContentVerticalAlignment(element,valueNew)}
/**
         * Style processor for content padding.
         * Note: Percentages always refer to the width of the element, never its height (even for top and bottom).
         * @param element The jQuery element.
         * @param valueNew      The new content padding.
         * @preserve (Part of the public API)
         */static processContentPadding(element,valueNew){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processContentPadding(element,valueNew)}
/**
         * Theme processor for transforms.
         * @param element The jQuery element.
         * @param valueNew      The new transform value or an array of transform values.
         * @param order         If this parameter is passed, the transforms in valueNew will replace the transform at the specified place, instead of replacing all transforms.
         * @preserve (Part of the public API)
         */static processTransform(element,valueNew,order){if(!TcHmi.System.Services.styleManager)throw new Error("Failed to set style. System not ready.");TcHmi.System.Services.styleManager.processTransform(element,valueNew,order)}}StyleProvider.__normalizedColorMap=new Map,TcHmi.StyleProvider=StyleProvider}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * Provides methods to read and write symbol values and schemas.
     * @template ST Type of the value in the symbol.
     * @preserve (Part of the public API)
     */
class Symbol{constructor(p){this.__symbol=new TcHmi.System.Symbol(p)}
/**
         * Reads the value of the current symbol.
         * return undefined if the symbol is not available
         * @returns A copy of the value
         * @template T Type of the read value. Falls back to type of the symbol.
         * @preserve (Part of the public API)
         */read(){if(!this.__symbol)return;let res;return this.__symbol.isProcessedAsync()?(TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn('[Source=Framework, Module=TcHmi.Symbol] The non static function "TcHmi.Symbol.read()" does no longer support synchronous access to this symbol. Please use the non static function "TcHmi.Symbol.readEx(callback ?: (this: TcHmi.Symbol, data: TcHmi.Symbol.IReadResultObject | TcHmi.Symbol.IServerReadResultObject) => void)" instead.'),res):(this.__symbol.read((data=>{data.error===TcHmi.Errors.NONE&&(res=data.value)})),res)}
/**
         * Reads the value of the current symbol and raises a callback with a copy of the result.
         * Returns a destroy function to terminate reading of asynchronous values.
         * @param callback with gets a copy of the value
         * @template T Type of the read value. Falls back to type of the symbol.
         * @preserve (Part of the public API)
         */readEx(callback){return this.readEx2(null,callback)}
/**
         * Reads the value of the current symbol and raises a callback with a copy of the result.
         * Returns a destroy function to terminate reading of asynchronous values.
         * @param options
         * @param callback with gets a copy of the value
         * @template T Type of the read value. Falls back to type of the symbol.
         * @preserve (Part of the public API)
         */readEx2(options,callback){let __this=this,destroy=this.__symbol.readEx(options,(data=>{const result={error:data.error};void 0!==data.value&&(result.value=data.value),data.details&&(result.details=data.details),Symbol.isIServerReadResultObject(data)&&(result.response=data.response),TcHmi.Callback.callSafeEx(callback,__this,result)}));return()=>{destroy?.(),destroy=null}}
/**
         * Writes the value of the current symbol.
         * Returns a destroy function to terminate writing of asynchronous values.
         * @param value The new value
         * @param callback callback will be called after success or failure
         * @template T Type of the write value. Falls back to type of the symbol.
         * @preserve (Part of the public API)
         */write(value,callback){return this.writeEx(value,null,callback)}
/**
         * Writes the value of the current symbol.
         * Returns a destroy function to terminate writing of asynchronous values.
         * @param value
         * @param options
         * @param callback
         * @template T Type of the write value. Falls back to type of the symbol.
         * @preserve (Part of the public API)
         */writeEx(value,options,callback){let __this=this,destroy=this.__symbol.writeEx2(value,options,null,(data=>{const result={error:data.error};void 0!==data.value&&(result.value=data.value),data.details&&(result.details=data.details),Symbol.isIServerReadResultObject(data)&&(result.response=data.response),TcHmi.Callback.callSafeEx(callback,__this,result)}));return()=>{destroy?.(),destroy=null}}
/**
         * Watches for changes of the current symbol and raises the callback in case of a change.
         * Returns a destroy function to remove the watch.
         * @param callback callback will be called with each change of the value of the symbol
         * @template T Type of the value to watch. Falls back to type of the symbol.
         * @preserve (Part of the public API)
         */watch(callback){return this.watchEx(null,callback)}
/**
         * Watches for changes of the current symbol and raises the callback in case of a change.
         * Returns a destroy function to remove the watch.
         * @param callback
         * @template T Type of the value to watch. Falls back to type of the symbol.
         * @preserve (Part of the public API)
         */watchEx(options,callback){let destroy=this.__symbol.watchEx(options,(data=>{Symbol.isIServerReadResultObject(data)?TcHmi.Callback.callSafeEx(callback,this,{error:data.error,value:data.value,response:data.response,destroy:data.destroy,details:data.details}):TcHmi.Callback.callSafeEx(callback,this,{error:data.error,value:data.value,destroy:data.destroy,details:data.details})}));return()=>{destroy?.(),destroy=null}}
/**
         * Returns the underlying TcHmi.SymbolExpression object.
         * @preserve (Part of the public API)
         */getExpression(){return this.__symbol.getExpression()}
/**
         * Resolves the schema of the current symbol.
         * @param callback callback will be called after success (with the schema) or failure
         * @preserve (Part of the public API)
         */resolveSchema(callback){let __this=this;this.__symbol.resolveSchema((function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,schema:data.schema}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}))}
/**
         * Resolves a dictionary of PLC (?) attributes from the underlying schema.
         * @param callback callback will be called after success (with the attributes) or failure
         * @preserve (Part of the public API)
         */resolveAttributes(callback){this.__symbol.resolveAttributes((data=>{TcHmi.Callback.callSafeEx(callback,this,data)}))}
/**
         * Resolves a PLC (?) attribute by name from the underlying schema.
         * @param name Name of the PLC (?) attribute
         * @param callback callback will be called after success (with the attribute) or failure
         * @preserve (Part of the public API)
         */resolveAttribute(name,callback){this.__symbol.resolveAttribute(name,(data=>{TcHmi.Callback.callSafeEx(callback,this,data)}))}
/**
         * Checks if this symbol exists
         * @param callback callback will be called after success or failure
         * @preserve (Part of the public API)
         */exists(callback){this.__symbol.exists((data=>{data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:data.result}):TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})}))}isProcessedAsync(){return this.__symbol.isProcessedAsync()}
/**
         * Destroys the current symbol object.
         * @preserve (Part of the public API)
         */destroy(){this.__symbol.destroy()}
/**
         * Reads the value of a symbol by name and type.
         * This function throws an exception if the symbol type is not supported.
         * @param name Name of the symbol (without for example %i% marker)
         * @param type Type of the symbol as enum value
         * @template T Type of the read value.
         * @preserve (Part of the public API)
         */static read(name,type){let typeString,res;switch(type){case SymbolType.Internal:typeString="i";break;case SymbolType.LocalizedText:typeString="l";break;case SymbolType.PartialParam:typeString="pp";break;case SymbolType.Server:typeString="s";break;case SymbolType.TemplateParam:typeString="tp";break;case SymbolType.Control:typeString="ctrl";break;case SymbolType.Context:typeString="ctx";break;case SymbolType.ThemedResource:typeString="tr";break;default:throw new TypeError("Unsupported SymbolType="+(TcHmi.SymbolType[type]?TcHmi.SymbolType[type]:type)+".")}let s=new Symbol("%"+typeString+"%"+name+"%/"+typeString+"%");return s.__symbol.isProcessedAsync()?(TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn('[Source=Framework, Module=TcHmi.Symbol] The static function "TcHmi.Symbol.read(name: string, type: TcHmi.SymbolType)" does no longer support synchronous access to this symbol. Please use the non static function "TcHmi.Symbol.readEx2(expression: string, callback?: (this: void, data: TcHmi.Symbol.IReadResultObject)" instead.'),s.destroy(),res):(s.readEx((data=>{data.error===TcHmi.Errors.NONE&&(res=data.value),s.destroy()})),res)}
/**
         * Reads the value of a symbol by expression.
         * @param expression expression for the symbol
         * @template T Type of the read value.
         * @preserve (Part of the public API)
         */static readEx(expression){let s=new Symbol(expression);if(s.__symbol.isProcessedAsync())return TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn('[Source=Framework, Module=TcHmi.Symbol] The static function "TcHmi.Symbol.readEx(expression: string)" does no longer support synchronous access to this symbol. Please use the non static function "TcHmi.Symbol.readEx2(expression: string, callback?: (this: void, data: TcHmi.Symbol.IReadResultObject)" instead.'),void s.destroy();let res=s.read();return s.destroy(),res}
/**
         * Reads the value of a symbol by expression and raises a callback with the result.
         * Returns a destroy function to terminate reading of asynchronous values.
         * @param expression expression for the symbol to read
         * @param callback callback will be called after success (with the value) or failure
         * @template T Type of the read value.
         * @preserve (Part of the public API)
         */static readEx2(expression,callback){return Symbol.readEx3(expression,null,callback)}
/**
         * Reads the value of a symbol by expression and raises a callback with the result.
         * Returns a destroy function to terminate reading of asynchronous values.
         * @param expression
         * @param options
         * @param callback
         * @template T Type of the read value.
         * @preserve (Part of the public API)
         */static readEx3(expression,options,callback){let s=new Symbol(expression),destroy=s.readEx2(options,(data=>{const result={error:data.error,value:data.value};data.details&&(result.details=data.details),Symbol.isIServerReadResultObject(data)&&(result.response=data.response),TcHmi.Callback.callSafeEx(callback,null,result),s&&s.destroy(),s=null}));return()=>{destroy?.(),destroy=null}}
/**
         * Writes the value of a symbol by name and type.
         * This function throws an exception if the symbol type is not supported.
         * Returns a destroy function to terminate writing of asynchronous values.
         * @param name Name of the symbol (without for example %i% marker)
         * @param type Type of the symbol as enum value
         * @param value The new value
         * @param callback callback will be called after success or failure
         * @template T Type of the write value.
         * @preserve (Part of the public API)
         */static write(name,type,value,callback){let typeString;switch(type){case SymbolType.Internal:typeString="i";break;case SymbolType.LocalizedText:typeString="l";break;case SymbolType.PartialParam:typeString="pp";break;case SymbolType.Server:typeString="s";break;case SymbolType.TemplateParam:typeString="tp";break;case SymbolType.Control:typeString="ctrl";break;case SymbolType.Context:typeString="ctx";break;case SymbolType.ThemedResource:typeString="tr";break;default:throw new TypeError("Unsupported SymbolType="+(TcHmi.SymbolType[type]?TcHmi.SymbolType[type]:type)+".")}let s=new Symbol("%"+typeString+"%"+name+"%/"+typeString+"%"),destroy=s.write(value,(data=>{const result={error:data.error,value:data.value};data.details&&(result.details=data.details),Symbol.isIServerReadResultObject(data)&&(result.response=data.response),TcHmi.Callback.callSafeEx(callback,null,result),s&&s.destroy(),s=null}));return()=>{destroy?.(),destroy=null}}
/**
         * Writes the value of a symbol by expression.
         * Returns a destroy function to terminate writing of asynchronous values.
         * @param expression expression for the symbol
         * @param value Value to write
         * @param callback callback will be called after success or failure
         * @template T Type of the write value.
         * @preserve (Part of the public API)
         */static writeEx(expression,value,callback){return Symbol.writeEx2(expression,value,null,callback)}
/**
         * Writes the value of a symbol by expression.
         * Returns a destroy function to terminate writing of asynchronous values.
         * @param expression
         * @param value
         * @param callback
         * @template T Type of the write value.
         * @preserve (Part of the public API)
         */static writeEx2(expression,value,options,callback){let s=new Symbol(expression),destroy=s.writeEx(value,options,(data=>{const result={error:data.error};void 0!==data.value&&(result.value=data.value),data.details&&(result.details=data.details),Symbol.isIServerReadResultObject(data)&&(result.response=data.response),TcHmi.Callback.callSafeEx(callback,null,result),s?.destroy(),s=null}));return()=>{destroy?.(),destroy=null}}
/**
         *
         * @preserve (Part of the public API)
         */getReferenceDelegation(){return this.__symbol.getReferenceDelegation()}
/**
         * Resolves the schema of the current symbol.
         * @param expression expression for the symbol
         * @param callback callback will be called after success or failure
         * @preserve (Part of the public API)
         */static resolveSchema(expression,callback){let s=new Symbol(expression);s.resolveSchema((function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,schema:data.schema}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details}),s.destroy()}))}
/**
         * Resolves a dictionary of PLC (?) attributes from the underlying schema.
         * @param expression expression for the symbol
         * @param callback callback will be called after success or failure
         * @preserve (Part of the public API)
         */static resolveAttributes(expression,callback){const s=new Symbol(expression);s.resolveAttributes((data=>{TcHmi.Callback.callSafeEx(callback,null,data),s.destroy()}))}
/**
         * Resolves an PLC (?) attribute by name from the underlying schema.
         * @param expression expression for the symbol
         * @param name Name of the PLC (?) attribute
         * @param callback callback will be called after success or failure
         * @preserve (Part of the public API)
         */static resolveAttribute(expression,name,callback){const s=new Symbol(expression);s.resolveAttribute(name,(data=>{TcHmi.Callback.callSafeEx(callback,null,data),s.destroy()}))}
/**
         * Checks if a symbol exists.
         * @param expression expression for the symbol
         * @param callback callback will be called after success or failure
         * @preserve (Part of the public API)
         */static exists(expression,callback){let s=new Symbol(expression);s.exists((data=>{data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,result:data.result}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details}),s.destroy()}))}
/**
         * Returns true if the expression is a valid symbol expression
         * @param expression expression for the symbol
         * @preserve (Part of the public API)
         */static isSymbolExpression(expression){if("string"!=typeof expression)return!1;const exprMatch=expression.match(TcHmi.SymbolExpression.RegExpExpression);return null!=exprMatch&&0===exprMatch.index}
/**
         * Returns true if expression is escaped with $ in opening expression tag before type token.
         * Example:
         *    %$i%... -> true
         *    %i%...  -> false
         * @param expression expression for the symbol
         * @preserve (Part of the public API)
         */static isSymbolExpressionEscaped(expression){if("string"!=typeof expression)return!1;const exprMatch=expression.match(TcHmi.SymbolExpression.RegExpExpressionEscaped);return null!=exprMatch&&0===exprMatch.index}
/**
         * Will remove one escape level from expression and return it.
         * @param expression expression for the symbol
         * @preserve (Part of the public API)
         */static escapeSymbolExpression(expression){const exprMatch=expression.match(TcHmi.SymbolExpression.RegExpExpressionEscaped);return null!=exprMatch&&0===exprMatch.index?expression.replace("$",""):expression}static isIServerReadResultObject(data){return"response"in data}}let SymbolType;TcHmi.Symbol=Symbol,function(Symbol){Symbol.ObjectResolver=
/**
         * @preserve (Part of the public API)
         */
class{constructor(obj,parentControl){this.__obj=obj,this.__parentControl=parentControl}__resolve(obj,callback){const clone=tchmi_clone_object(obj);let details,error=TcHmi.Errors.NONE;const symbolInfoByExpression=new Map;let pending=0,destroyOnInitialized=null;const process=()=>{pending>0||(error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(clone)}):TcHmi.Callback.callSafeEx(callback,null,{error:error,details:details}))},read=symbolInfo=>{void 0===symbolInfo.value&&(pending++,symbolInfo.obj.readEx((function(data){if(data.error===TcHmi.Errors.NONE){symbolInfo.value=data.value;for(const[obj,keys]of symbolInfo.refs)for(const key of keys)obj&&null!=key&&(obj[key]=symbolInfo.value,resolveSymbolInfo(obj,key,obj[key]));for(const symbolInfo of symbolInfoByExpression.values())read(symbolInfo);pending>0&&pending--,process()}else{if(error=TcHmi.Errors.ERROR,details||(details={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.Symbol.ObjectResolver"}),data.details){details.errors||(details.errors=[]);let exists=!1;for(let i=0,ii=details.errors.length;i<ii;i++)if(tchmi_equal(details.errors[i],data.details)){exists=!0;break}exists||details.errors.push(data.details)}pending>0&&pending--,process()}})))},resolveSymbolInfo=(o,k,value)=>{if(value)if("object"==typeof value){if(__tchmi_is_instanced_object(value))return;if(Array.isArray(value))for(let i=0,ii=value.length;i<ii;i++)resolveSymbolInfo(value,i,value[i]);else{if(value&&value.objectType&&"Symbol"===value.objectType)return;for(let key in value)resolveSymbolInfo(value,key,value[key])}}else if("string"==typeof value){if(!o)return;if(null==k)return;let isSymbolExpression=TcHmi.Symbol.isSymbolExpression(value),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(value);if(isSymbolExpression&&!isSymbolExpressionEscaped){let symbolInfoNew=null,symbolInfo=symbolInfoByExpression.get(value);if(symbolInfo){void 0!==symbolInfo.value&&(o[k]=symbolInfo.value);let ref=symbolInfo.refs.get(o);ref?ref.push(k):symbolInfo.refs.set(o,[k])}else{let symbol=new TcHmi.Symbol(value),refs=new Map;refs.set(o,[k]),symbolInfoNew={obj:symbol,refs:refs},symbolInfoByExpression.set(value,symbolInfoNew)}}else isSymbolExpressionEscaped&&(o[k]=TcHmi.Symbol.escapeSymbolExpression(value))}},run=()=>{if(symbolInfoByExpression.size>0)for(const symbolInfo of symbolInfoByExpression.values())read(symbolInfo);else process()};if(resolveSymbolInfo(null,null,clone),this.__parentControl&&symbolInfoByExpression.size>0){let partial=null,parent=this.__parentControl;for(;null!==parent;){let parentType=parent.getType();if(("TcHmi.Controls.System.TcHmiView"===parentType||"TcHmi.Controls.System.TcHmiContent"===parentType||"TcHmi.Controls.System.TcHmiUserControl"===parentType)&&!partial){partial=parent;break}parent=parent.getParent()}partial&&!partial.getIsInitialized()?destroyOnInitialized=TcHmi.EventProvider.register(partial.getId()+".onInitialized",(e=>{e?.destroy?.(),destroyOnInitialized=null,run()})):this.__parentControl&&!this.__parentControl.getIsInitialized()?destroyOnInitialized=TcHmi.EventProvider.register(this.__parentControl.getId()+".onInitialized",(e=>{e?.destroy?.(),destroyOnInitialized=null,run()})):run()}else run();return function(){destroyOnInitialized&&(destroyOnInitialized(),destroyOnInitialized=null);for(const symbolInfo of symbolInfoByExpression.values())symbolInfo.obj.destroy();symbolInfoByExpression.clear()}}
/**
             * Resolves all symbol expression refs in the current object.
             * @param callback Callback will be called after success or failure
             * @preserve (Part of the public API)
             */resolve(callback){return"object"==typeof this.__obj&&null!==this.__obj?this.__resolve(this.__obj,callback):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:this.__obj}),function(){})}__watch(obj,callback){let clone=tchmi_clone_object(obj),errorsBySymbolInfo=new Map;const symbolInfosByRef=new Map,symbolInfoByExpression=new Map;let last,pending=0,destroyOnInitialized=null;const destroy=()=>{destroyOnInitialized&&(destroyOnInitialized(),destroyOnInitialized=null);for(const symbolInfo of symbolInfoByExpression.values())symbolInfo.unwatch&&(symbolInfo.unwatch(),symbolInfo.unwatch=void 0),symbolInfo.obj&&(symbolInfo.obj.destroy(),symbolInfo.obj=void 0);symbolInfoByExpression.clear(),symbolInfosByRef.clear()},process=()=>{if(pending>0)return;let details,error=TcHmi.Errors.NONE;for(const errorDetails of errorsBySymbolInfo.values())if(error=TcHmi.Errors.ERROR,details||(details={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.Symbol.ObjectResolver"}),errorDetails){details.errors||(details.errors=[]);let exists=!1;for(let i=0,ii=details.errors.length;i<ii;i++)if(tchmi_equal(details.errors[i],errorDetails)){exists=!0;break}exists||details.errors.push(errorDetails)}if(error===TcHmi.Errors.NONE){if(tchmi_equal(last,clone))return;last=tchmi_clone_object(clone),TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(clone),destroy:destroy})}else TcHmi.Callback.callSafeEx(callback,null,{error:error,details:details,destroy:destroy})},watch=symbolInfo=>{symbolInfo.obj&&(symbolInfo.active||(symbolInfo.active=!0,pending++,symbolInfo.unwatch=symbolInfo.obj.watch((function(data){if(symbolInfo.unwatch??(symbolInfo.unwatch=data.destroy),symbolInfo.obj)if(data.error===TcHmi.Errors.NONE){if(errorsBySymbolInfo.has(symbolInfo.obj)&&errorsBySymbolInfo.delete(symbolInfo.obj),symbolInfo.refs){let removeableSymbolInfo=null,removeableExpressions=[],removeableRefs=[],resolveableRefs=[];symbolInfo.value=data.value;for(const[obj,keys]of symbolInfo.refs)for(let i=0,ii=keys.length;i<ii;i++){let key=keys[i];if(null!=key&&obj){let ref=obj[key];if(obj[key]=symbolInfo.value,"object"==typeof ref&&null!=ref){let symbolInfos2=symbolInfosByRef.get(ref);if(symbolInfos2)for(let i=0,ii=symbolInfos2.length;i<ii;i++){let symbolInfo2=symbolInfos2[i];if(symbolInfo2&&symbolInfo2.refs&&symbolInfo2.obj&&(symbolInfo2.refs.delete(ref),0===symbolInfo2.refs.size)){removeableExpressions.push(symbolInfo2.obj.getExpression().toString()),removeableRefs.push(ref),removeableSymbolInfo=symbolInfo2;break}}}resolveableRefs.push({o:obj,k:key,ref:obj[key]})}}for(const removeabelExpression of removeableExpressions)symbolInfoByExpression.delete(removeabelExpression);removeableExpressions=[];for(const removeableRef of removeableRefs)symbolInfosByRef.delete(removeableRef);removeableRefs=[],removeableSymbolInfo&&(removeableSymbolInfo.unwatch?.(),removeableSymbolInfo.unwatch=void 0,removeableSymbolInfo.obj?.destroy());for(const resolveableRef of resolveableRefs)resolveSymbolInfo(resolveableRef.o,resolveableRef.k,resolveableRef.ref);resolveableRefs=[];for(const symbolInfo of symbolInfoByExpression.values())watch(symbolInfo);pending>0&&!1===symbolInfo.initialized&&pending--,symbolInfo.initialized=!0,process()}}else pending>0&&!1===symbolInfo.initialized&&pending--,symbolInfo.initialized=!0,data.details?errorsBySymbolInfo.set(symbolInfo.obj,data.details):errorsBySymbolInfo.set(symbolInfo.obj,{code:data.error,message:TcHmi.Errors[data.error],reason:"Got an error while watching "+symbolInfo.obj.getExpression().toString(),domain:"TcHmi.Symbol"}),process()}))))},resolveSymbolInfo=(o,k,value)=>{if(value)if("object"==typeof value){if(__tchmi_is_instanced_object(value))return;if(Array.isArray(value))for(let i=0,ii=value.length;i<ii;i++)resolveSymbolInfo(value,i,value[i]);else{if(value&&value.objectType&&"Symbol"===value.objectType)return;for(let key in value)resolveSymbolInfo(value,key,value[key])}}else if("string"==typeof value){if(!o)return;if(null==k)return;let isSymbolExpression=TcHmi.Symbol.isSymbolExpression(value),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(value);if(isSymbolExpression&&!isSymbolExpressionEscaped){let symbolInfo=symbolInfoByExpression.get(value);if(symbolInfo){void 0!==symbolInfo.value&&(o[k]=symbolInfo.value);let ref=symbolInfo.refs.get(o);ref?ref.push(k):symbolInfo.refs.set(o,[k])}else{let symbol=new TcHmi.Symbol(value),refs=new Map;refs.set(o,[k]);const symbolInfoNew={obj:symbol,refs:refs,active:!1,initialized:!1};symbolInfoByExpression.set(value,symbolInfoNew);const symbolInfoRefArr=symbolInfosByRef.get(o);symbolInfoRefArr?symbolInfoRefArr.push(symbolInfoNew):symbolInfosByRef.set(o,[symbolInfoNew])}}else isSymbolExpressionEscaped&&(o[k]=TcHmi.Symbol.escapeSymbolExpression(value))}},run=()=>{if(symbolInfoByExpression.size>0)for(const symbolInfo of symbolInfoByExpression.values())watch(symbolInfo);else process()};if(resolveSymbolInfo(null,null,clone),this.__parentControl&&symbolInfoByExpression.size>0){let partial=null,parent=this.__parentControl;for(;null!==parent;){let parentType=parent.getType();if(("TcHmi.Controls.System.TcHmiView"===parentType||"TcHmi.Controls.System.TcHmiContent"===parentType||"TcHmi.Controls.System.TcHmiUserControl"===parentType)&&!partial){partial=parent;break}parent=parent.getParent()}partial&&!partial.getIsInitialized()?destroyOnInitialized=TcHmi.EventProvider.register(partial.getId()+".onInitialized",(e=>{e?.destroy?.(),destroyOnInitialized=null,run()})):this.__parentControl&&!this.__parentControl.getIsInitialized()?destroyOnInitialized=TcHmi.EventProvider.register(this.__parentControl.getId()+".onInitialized",(e=>{e?.destroy?.(),destroyOnInitialized=null,run()})):run()}else run();return destroy}
/**
             * Watches for changes of symbol expressions in the current object und returns the object with updated values.
             * Returns a destroy function to remove the watch.
             * @param callback Callback will be called after success or failure
             * @preserve (Part of the public API)
             */watch(callback){return"object"==typeof this.__obj&&null!==this.__obj?this.__watch(this.__obj,callback):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:this.__obj}),function(){})}
/**
             * Destroys the current object.
             * @preserve (Part of the public API)
             */destroy(){this.__obj=null}}}(Symbol=TcHmi.Symbol||(TcHmi.Symbol={})),function(SymbolType){SymbolType[SymbolType.Invalid=0]="Invalid",SymbolType[SymbolType.Server=10]="Server",SymbolType[SymbolType.Internal=20]="Internal",SymbolType[SymbolType.LocalizedText=30]="LocalizedText",SymbolType[SymbolType.PartialParam=40]="PartialParam",SymbolType[SymbolType.TemplateParam=50]="TemplateParam",SymbolType[SymbolType.Function=60]="Function",SymbolType[SymbolType.Control=70]="Control",SymbolType[SymbolType.Context=80]="Context",SymbolType[SymbolType.ThemedResource=90]="ThemedResource"}(SymbolType=TcHmi.SymbolType||(TcHmi.SymbolType={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * Symbol expression parser.
     * @preserve (Part of the public API)
     */
class SymbolExpression{constructor(expression){if(this.__path=null,this.__pathEx=null,this.__pathTokens=null,this.__pathTokensEx=null,this.__type=TcHmi.SymbolType.Invalid,this.__options={},TcHmi.System.isParameterTypeInvalid(expression,"expression",{type:"string",required:"valueNeeded"}))throw new Error("The expression of a new TcHmi.SymbolExpression needs to be a string.");this.__expression=expression;let expressionMatch=expression.match(SymbolExpression.RegExpExpression);if(null!=expressionMatch&&3===expressionMatch.length){switch(this.__tag=expressionMatch[1],this.__tag){case"s":this.__type=TcHmi.SymbolType.Server,this.__content=this.__expression.substr(3,this.__expression.length-7);break;case"i":this.__type=TcHmi.SymbolType.Internal,this.__content=this.__expression.substr(3,this.__expression.length-7);break;case"l":this.__type=TcHmi.SymbolType.LocalizedText,this.__content=this.__expression.substr(3,this.__expression.length-7);break;case"pp":this.__type=TcHmi.SymbolType.PartialParam,this.__content=this.__expression.substr(4,this.__expression.length-9);break;case"tp":this.__type=TcHmi.SymbolType.TemplateParam,this.__content=this.__expression.substr(4,this.__expression.length-9);break;case"f":this.__type=TcHmi.SymbolType.Function,this.__content=this.__expression.substr(3,this.__expression.length-7);break;case"ctrl":this.__type=TcHmi.SymbolType.Control,this.__content=this.__expression.substr(6,this.__expression.length-13);break;case"ctx":this.__type=TcHmi.SymbolType.Context,this.__content=this.__expression.substr(5,this.__expression.length-11);break;case"tr":this.__type=TcHmi.SymbolType.ThemedResource,this.__content=this.__expression.substr(4,this.__expression.length-9);break;default:this.__type=TcHmi.SymbolType.Invalid}let expressionTokens=expressionMatch[2].match(SymbolExpression.RegExpExpressionGroupByPipe);if(null!=expressionTokens&&expressionTokens.length>0){if(this.__type===TcHmi.SymbolType.Control||this.__type===TcHmi.SymbolType.Internal||this.__type===TcHmi.SymbolType.LocalizedText||this.__type===TcHmi.SymbolType.PartialParam||this.__type===TcHmi.SymbolType.TemplateParam||this.__type===TcHmi.SymbolType.ThemedResource||this.__type===TcHmi.SymbolType.Server){let firstBracketPos=expressionTokens[0].indexOf("["),firstColonPos=expressionTokens[0].indexOf("::"),splitPos=-1;splitPos=-1===firstBracketPos?firstColonPos:-1===firstColonPos||firstBracketPos<firstColonPos?firstBracketPos:firstColonPos,-1!==splitPos?(this.__name=expressionTokens[0].substring(0,splitPos),this.__path=expressionTokens[0].substring(splitPos),this.__pathTokens=TcHmi.ObjectPath.toPathTokens(this.__path)):(this.__name=expressionTokens[0],this.__path=null,this.__pathTokens=null),this.__nameEx=this.__name,this.__pathEx=this.__path,this.__pathTokensEx=this.__pathTokens,this.__fullName=expressionTokens[0],this.__type===TcHmi.SymbolType.Server&&(this.__name=expressionTokens[0],this.__path=null,this.__pathTokens=null)}else this.__type===TcHmi.SymbolType.Context?(this.__path=expressionTokens[0],this.__pathTokens=TcHmi.ObjectPath.toPathTokens(this.__path),this.__nameEx=this.__name,this.__pathEx=this.__path,this.__pathTokensEx=this.__pathTokens,this.__fullName=expressionTokens[0]):this.__type===TcHmi.SymbolType.Function&&(this.__name=expressionTokens[0],this.__nameEx=this.__name,this.__pathEx=this.__path,this.__pathTokensEx=this.__pathTokens,this.__fullName=expressionTokens[0]);if(this.__type!==TcHmi.SymbolType.Function)for(let i=1,len=expressionTokens.length;i<len;i++){if(this.__type===TcHmi.SymbolType.Server){const matchInterval=/^(?:Interval\s*=)\s*(\d+)\s*$/i.exec(expressionTokens[i]);null!==matchInterval&&0!==matchInterval.length&&(this.__options.Interval=parseInt(matchInterval[1],10));const matchTimeout=/^(?:Timeout\s*=)\s*(\d+)\s*$/i.exec(expressionTokens[i]);null!==matchTimeout&&0!==matchTimeout.length&&(this.__options.Timeout=parseInt(matchTimeout[1],10));const matchParallel=/^(?:Parallel\s*=)\s*([a-zA-Z]+)\s*$/i.exec(expressionTokens[i]);null!==matchParallel&&0!==matchParallel.length&&(this.__options.Parallel="true"===matchParallel[1].toLowerCase());const matchSubscriptionGroup=/^(?:SubscriptionGroup\s*=)\s*(\d+)\s*$/i.exec(expressionTokens[i]);null!==matchSubscriptionGroup&&0!==matchSubscriptionGroup.length&&(this.__options.SubscriptionGroup=parseInt(matchSubscriptionGroup[1],10));const matchReadWriteGroup=/^(?:ReadWriteGroup\s*=)\s*(\d+)\s*$/i.exec(expressionTokens[i]);null!==matchReadWriteGroup&&0!==matchReadWriteGroup.length&&(this.__options.ReadWriteGroup=parseInt(matchReadWriteGroup[1],10));const matchUniqueHash=/^(?:UniqueHash\s*=)\s*([a-zA-Z]+)\s*$/i.exec(expressionTokens[i]);null!==matchUniqueHash&&0!==matchUniqueHash.length&&(this.__options.UniqueHash="true"===matchUniqueHash[1].toLowerCase())}const matchBindingMode=/^(?:BindingMode\s*=)\s*([a-zA-Z]+)\s*$/i.exec(expressionTokens[i]);null!==matchBindingMode&&0!==matchBindingMode.length&&(this.__options.BindingMode=matchBindingMode[1]);const matchBindingEvent=/^(?:BindingEvent\s*=)\s*([a-zA-Z]+)\s*$/i.exec(expressionTokens[i]);null!==matchBindingEvent&&0!==matchBindingEvent.length&&(this.__options.BindingEvent||(this.__options.BindingEvent=matchBindingEvent[1]),this.__options.BindingEvents||(this.__options.BindingEvents=[]),this.__options.BindingEvents.push(matchBindingEvent[1]));const matchSubscriptionMode=/^(?:SubscriptionMode\s*=)\s*([a-zA-Z]+)\s*$/i.exec(expressionTokens[i]);null!==matchSubscriptionMode&&0!==matchSubscriptionMode.length&&(this.__options.SubscriptionMode=matchSubscriptionMode[1])}}}}
/**
         * Returns the expression string.
         * @preserve (Part of the public API)
         */toString(){return this.__expression}
/**
         * Returns the content of the expression. The content is everything except the expression tags.
         * @preserve (Part of the public API)
         */getContent(){return this.__content}
/**
         * Returns the tag of the expression. For example "s" in case of an expression of type Server.
         * @preserve (Part of the public API)
         */getTag(){return this.__tag}
/**
         * Returns the name of the expression.
         * In case of an expression of type Server getName will also contain the path. Use getNameEx to retrieve the name in all expressions which support having a name.
         * @preserve (Part of the public API)
         */getName(){return this.__name}
/**
         * Returns the name of the expression.
         * @preserve (Part of the public API)
         */getNameEx(){return this.__nameEx}
/**
         * Returns the full name containing the base name and the path of the expression but no options.
         * @preserve (Part of the public API)
         */getFullName(){return this.__fullName}
/**
         * Returns the path of the expression.
         * In case of an expression of type Server getPath will return null. Use getPathEx if you want to retrieve the path in all expressions which support having a path.
         * @preserve (Part of the public API)
         */getPath(){return this.__path}
/**
         * Returns the path of the expression.
         * @preserve (Part of the public API)
         */getPathEx(){return this.__pathEx}
/**
         * Returns the path tokens.
         * In case of an expression of type Server getPathTokens will return null. Use getPathTokensEx if you want to retrieve the path tokens in all expressions which support having a path.
         * @preserve (Part of the public API)
         */getPathTokens(){return this.__pathTokens}
/**
         * Returns the path tokens.
         * @preserve (Part of the public API)
         */getPathTokensEx(){return this.__pathTokensEx}
/**
         * Returns the type of the expression.
         * @preserve (Part of the public API)
         */getType(){return this.__type}
/**
         * Returns a Dictionary of option flags.
         * @preserve (Part of the public API)
         */getOptions(){return this.__options}}
/**
     * Split string by pipe, but ignore pipes in brackets.
     * @preserve (Part of the public API)
     */SymbolExpression.RegExpExpressionGroupByPipe=/([^|()]+|[(](['][^']*[']|["][^"]*["]|[^)])*[)])+/g,
/**
     * Resolves the first expression occurrence and the content including line breaks.
     * @preserve (Part of the public API)
     */
SymbolExpression.RegExpExpression=new RegExp("^\\%[$]*(s|i|l|pp|tp|f|ctrl|ctx|tr)\\%([^]*)\\%/\\1\\%$"),
/**
     * Resolves the first escapted expression occurrence and the content including line breaks.
     * @preserve (Part of the public API)
     */
SymbolExpression.RegExpExpressionEscaped=new RegExp("^\\%[$]+(s|i|l|pp|tp|f|ctrl|ctx|tr)\\%([^]*)\\%/\\1\\%$"),TcHmi.SymbolExpression=SymbolExpression}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.TimedAsyncTask=class{constructor(duration){this.__duration=duration,this.__than=0}do(callback){if(!callback)return 0;if(this.__duration===1/0)return callback(),0;let now=Date.now();return 0===this.__than&&(this.__than=now),now-this.__than>this.__duration?(this.__than=now,setTimeout(callback)):(callback(),0)}}}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * Functions for interaction with TcSpeech.
     * @preserve (Part of the public API)
     */
class TcSpeech{
/**
         * (Re-)Starts the rtc connection to TwinCAT speech engine.
         * @param options This option can override all setting from tchmiconfig.json and more
         * @param callback Gets notification when opening connection failed.
         * @preserve (Part of the public API)
         */
static openConnection(options={},callback){if(!(TcHmi.System.isParameterTypeInvalid(options.confidenceThreshold,"options.confidenceThreshold",{type:"number",required:"undefinedOk"},"TcHmi.Speech",callback)||TcHmi.System.isParameterTypeInvalid(options.defaultVolume,"options.defaultVolume",{type:"number",required:"undefinedOk"},"TcHmi.Speech",callback)||TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Speech",callback)||TcHmi.System.isParameterTypeInvalid(options.enableMicrophone,"options.enableMicrophone",{type:"boolean",required:"undefinedOk"},"TcHmi.Speech",callback)||TcHmi.System.isParameterTypeInvalid(options.enableSpeaker,"options.enableSpeaker",{type:"boolean",required:"undefinedOk"},"TcHmi.Speech",callback)||TcHmi.System.isParameterTypeInvalid(options.remoteSocketId,"options.remoteSocketId",{type:"number",required:"undefinedOk"},"TcHmi.Speech",callback)||TcHmi.System.isParameterTypeInvalid(options.sinkConstraints,"options.sinkConstraints",{type:"object",required:"undefinedOk"},"TcHmi.Speech",callback)||TcHmi.System.isParameterTypeInvalid(options.sourceConstraints,"options.sourceConstraints",{type:"object",required:"undefinedOk"},"TcHmi.Speech",callback)))if(TcHmi.System.Services.tcSpeechManager)TcHmi.System.Services.tcSpeechManager.openConnection(options,callback);else{const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to open connection. System not ready.",domain:"TcHmi.TcSpeech"};TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}}
/**
         * Closes an active connection to TwinCAT speech engine.
         * @param options Can target a specific remote TwinCAT speech engine
         * @param callback A callback to get feedback
         * @preserve (Part of the public API)
         */static closeConnection(options={},callback){if(!TcHmi.System.isParameterTypeInvalid(options.remoteSocketId,"options.remoteSocketId",{type:"number",required:"undefinedOk"},"TcHmi.Speech",callback))if(TcHmi.System.Services.tcSpeechManager)TcHmi.System.Services.tcSpeechManager.closeConnection(options,callback);else{const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to close connection. System not ready.",domain:"TcHmi.TcSpeech"};TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}}
/**
         * Sets the volume (between 0 and 1) of speech output on this device.
         * @param valueNew new volume. Will be capped between 0 and 1.
         * @preserve (Part of the public API)
         */static setVolume(valueNew){TcHmi.System.Services.tcSpeechManager?TcHmi.System.Services.tcSpeechManager.setVolume(valueNew):TcHmi.Log.error("[Source=Framework, Module=TcHmi.TcSpeech] Unable to set volume. System not ready.")}}TcHmi.TcSpeech=TcSpeech,function(TcSpeech){let AudioEntityPriority;TcSpeech.SpeechSynthesis=class{constructor(text,options){this.text=text,this.options=options}
/**
             * Starting output of text. The connection must be open at this point and we have to have enableSpeaker.
             * The callback will get a guid which can be used to stop or request status of the speech synthesis.
             * @param callback The callback will get a guid which can be used to stop or request status of the speech synthesis.
             * @preserve (Part of the public API)
             */start(callback){TcHmi.System.Services.tcSpeechManager?TcHmi.System.Services.tcSpeechManager.speechSynthesisStart(this.text,this.options,(data=>{this.__guid=data.guid,TcHmi.Callback.callSafe(callback,null,data)})):TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,domain:"TcHmi.TcSpeech",reason:"System not ready."}})}
/**
             * Request the state (queued, playing, stopped) of a given speech synthesis call.
             * @param callback The callback will get the state of the speech synthesis
             * @preserve (Part of the public API)
             */getStatus(callback){TcHmi.System.Services.tcSpeechManager?this.__guid?TcHmi.System.Services.tcSpeechManager.speechSynthesisGetStatus(this.__guid,callback):TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,domain:"TcHmi.TcSpeech",reason:"No current speech synthesis."}}):TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,domain:"TcHmi.TcSpeech",reason:"System not ready."}})}
/**
             * Stops a given speech synthesis call.
             * @param callback The callback will get the state of the speech synthesis
             * @preserve (Part of the public API)
             */stop(callback){TcHmi.System.Services.tcSpeechManager?this.__guid?TcHmi.System.Services.tcSpeechManager.speechSynthesisStop(this.__guid,callback):TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,domain:"TcHmi.TcSpeech",reason:"No current speech synthesis."}}):TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,domain:"TcHmi.TcSpeech",reason:"System not ready."}})}},function(AudioEntityPriority){AudioEntityPriority[AudioEntityPriority.Low=5]="Low",AudioEntityPriority[AudioEntityPriority.Normal=10]="Normal",AudioEntityPriority[AudioEntityPriority.High=15]="High"}(AudioEntityPriority=TcSpeech.AudioEntityPriority||(TcSpeech.AudioEntityPriority={}))}(TcSpeech=TcHmi.TcSpeech||(TcHmi.TcSpeech={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * Provides functions for managing and changing themes.
     * @preserve (Part of the public API)
     */
class Theme{
/**
         * Returns the active theme.
         * @preserve (Part of the public API)
         */
static get(){return TcHmi.System.Services.themeManager?TcHmi.System.Services.themeManager.getTheme():"Base"}
/**
         * Sets the active theme.
         * @param valueNew Name of the new theme.
         * @preserve (Part of the public API)
         */static set(valueNew){return TcHmi.System.Services.themeManager?TcHmi.System.isParameterTypeInvalid(valueNew,"valueNew",{type:"string",required:"valueNeeded",minStringLength:1})?TcHmi.Errors.E_PARAMETER_INVALID:TcHmi.System.Services.themeManager.setTheme(valueNew,!0):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Theme] Setting theme failed. System not ready."),TcHmi.Errors.E_SYSTEM_NOT_READY)}
/**
         * Returns all registered themes of the project.
         * @preserve (Part of the public API)
         */static getRegisteredThemes(){return Object.keys(TcHmi.System.config.themes)}}TcHmi.Theme=Theme,function(Theme){Theme.Properties=
/**
         * Control property related API
         * @preserve (Part of the public API)
         */
class{
/**
             * Parses every source of implicit properties and returns this or null
             * Can have different value after the event onThemeDataChanged.
             * The order of resources are
             * 1) control class
             * 2) theme definition of the control type in project
             * 3) theme definition in control
             * 4) defaultValueInternal in Description.json of the control
             * @param control Control which needs the resource
             * @param propertyName name of the property
             * @template T Type of the default value
             * @preserve (Part of the public API)
             */
static getDefaultValue(control,propertyName){return TcHmi.System.Services.themeManager?control instanceof TcHmi.Controls.System.baseTcHmiControl==!1||TcHmi.System.isParameterTypeInvalid(propertyName,"propertyName",{type:"string",required:"valueNeeded",minStringLength:1})?{error:TcHmi.Errors.E_PARAMETER_INVALID,origin:"system",originThemeName:TcHmi.System.Services.themeManager.getTheme(),value:null}:TcHmi.System.Services.themeManager.getDefaultPropertyValue(control,propertyName):{error:TcHmi.Errors.ERROR,origin:"system",originThemeName:"",value:null}}
/**
             * Sets the default value of a property and change it (if needed) on theme change.
             * @param control
             * @param propertyName
             * @returns returns an Error code
             * @preserve (Part of the public API)
             */static setThemeValue(control,propertyName){if(control instanceof TcHmi.Controls.System.baseTcHmiControl==!1)return TcHmi.Errors.E_PARAMETER_INVALID;if(TcHmi.System.isParameterTypeInvalid(propertyName,"propertyName",{type:"string",required:"valueNeeded",minStringLength:1}))return TcHmi.Errors.E_PARAMETER_INVALID;if(!TcHmi.System.Services.themeManager||!TcHmi.System.Services.controlManager)return TcHmi.Log.error("[Source=Framework, Module=TcHmi.Theme] System not ready."),TcHmi.Errors.E_SYSTEM_NOT_READY;let error=TcHmi.System.Services.controlManager.setControlProperty(control,propertyName,null);return error?error.code:TcHmi.Errors.NONE}
/**
             * After calling this function the control property will not be changed on theme change anymore.
             * Does not change the property value.
             * @param control
             * @param propertyName
             * @returns returns an Error code
             * @preserve (Part of the public API)
             */static releaseThemeValue(control,propertyName){return control instanceof TcHmi.Controls.System.baseTcHmiControl==!1||TcHmi.System.isParameterTypeInvalid(propertyName,"propertyName",{type:"string",required:"valueNeeded",minStringLength:1})?TcHmi.Errors.E_PARAMETER_INVALID:TcHmi.System.Services.themeManager&&TcHmi.System.Services.controlManager?(TcHmi.System.Services.themeManager.unwatchAttributeDefaults(control,propertyName),TcHmi.Errors.NONE):(TcHmi.Log.error("[Source=Framework, Module=TcHmi.Theme] System not ready."),TcHmi.Errors.E_SYSTEM_NOT_READY)}};Theme.Resources=
/**
         * Control resource related API
         * @preserve (Part of the public API)
         */
class{
/**
            * Gets a themed resource.
            * Parses every source of properties and returns this or null
            * Can have different value after the event onThemeDataChanged.
            * The order of resources are
            * 1) control class
            * 2) theme definition of the control type in project
            * 3) theme definition in control

            * @param control Control which needs the resource
            * @param resourceName name of the resource
            * @returns returns the resource or null
            * @template T Type of the value
            * @preserve (Part of the public API)
            */
static get(control,resourceName){return TcHmi.System.Services.themeManager?control instanceof TcHmi.Controls.System.baseTcHmiControl==!1||TcHmi.System.isParameterTypeInvalid(resourceName,"resourceName",{type:"string",required:"valueNeeded",minStringLength:1})?{error:TcHmi.Errors.E_PARAMETER_INVALID,origin:"system",originThemeName:TcHmi.System.Services.themeManager.getTheme(),value:null}:TcHmi.System.Services.themeManager.getThemeResource(control,resourceName):{error:TcHmi.Errors.ERROR,origin:"system",originThemeName:"",value:null}}static resolveBasePath(control,resource){let url;if("control"===resource.origin){let module=TcHmi.System.Data.Modules.controls.map.get(control.getType());url=module&&module.error===TcHmi.Errors.NONE?module.package.basePath+"/"+module.manifestData.basePath+"/Themes/"+resource.originThemeName+"/":module&&module.error!==TcHmi.Errors.NONE?"ControlModuleHasError/":"controlNotFoundInSystemCache/"}else url="/Themes/"+resource.originThemeName+"/";return url}}}(Theme=TcHmi.Theme||(TcHmi.Theme={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * Provides a layer to show elements above the normal visualization.
     * @preserve (Part of the public API)
     */
class TopMostLayer{static add(control,element,options){return!(!control||!TcHmi.System.Services.topMostLayer)&&((!options||!(TcHmi.System.isParameterTypeInvalid(options.centerHorizontal,"options.centerHorizontal",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.centerVertical,"options.centerVertical",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.closeOnBackground,"options.closeOnBackground",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.dimBackground,"options.dimBackground",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.modal,"options.modal",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.allowMultipleCall,"options.allowMultipleCall",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.removeCb,"options.removeCb",{type:"function",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.resizeCb,"options.resizeCb",{type:"function",required:"undefinedOk"})))&&TcHmi.System.Services.topMostLayer.add(control,element,options))}static remove(control,element){return control&&TcHmi.System.Services.topMostLayer?TcHmi.System.Services.topMostLayer.remove(control,element,!1):element}static addEx(element,options){return!!TcHmi.System.Services.topMostLayer&&((!options||!(TcHmi.System.isParameterTypeInvalid(options.centerHorizontal,"options.centerHorizontal",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.centerVertical,"options.centerVertical",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.closeOnBackground,"options.closeOnBackground",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.dimBackground,"options.dimBackground",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.modal,"options.modal",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.allowMultipleCall,"options.allowMultipleCall",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.justAbove,"options.justAbove",{type:"object",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.removeCb,"options.removeCb",{type:"function",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.resizeCb,"options.resizeCb",{type:"function",required:"undefinedOk"})))&&TcHmi.System.Services.topMostLayer.add(globalThis,element,options))}static removeEx(element){return TcHmi.System.Services.topMostLayer?TcHmi.System.Services.topMostLayer.remove(globalThis,element,!1):element}}TcHmi.TopMostLayer=TopMostLayer,function(TopMostLayer){let ConflictResolution;!function(ConflictResolution){ConflictResolution[ConflictResolution.Up=0]="Up",ConflictResolution[ConflictResolution.Down=1]="Down"}(ConflictResolution=TopMostLayer.ConflictResolution||(TopMostLayer.ConflictResolution={}))}(TopMostLayer=TcHmi.TopMostLayer||(TcHmi.TopMostLayer={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(Type){let Schema;Type.getSchema=
/**
         * Returns the schema object for a type definition.
         * Can be used for example with 'tchmi:general#/definitions/String'
         * Returns null on error
         * For schema information on Symbols use its resolveSchema()
         * or for SymbolExpressions use TcHmi.Symbol.resolveSchema()
         * @param typeName Name of the type reference (for example 'tchmi:general#/definitions/String')
         * @preserve (Part of the public API)
         */
function(typeName){return TcHmi.System.Services.typeManager?TcHmi.System.Services.typeManager.getSchema(typeName):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Type] Getting Schema failed. System not ready."),null)},function(Schema){Schema.resolveDefault=
/**
             * Generates an Javascript object or data primitive from the default values of a schema object.
             * Hint:
             * If you have a type definition string you can use TcHmi.Type.getSchema() API to get the schema object.
             * @preserve (Part of the public API)
             */
function(schema){return TcHmi.System.Services.typeManager?TcHmi.System.Type.Schema.resolveDefault(schema):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Type] Resolving default failed. System not ready."),null)},Schema.resolveType=
/**
             * Resolves the effective type value/s of a schema except those with additional conversion rules.
             * Hint:
             * If you have a type definition string you can use TcHmi.Type.getSchema() API to get the schema object.
             * @param schema Schema to resolve
             * @preserve (Part of the public API)
             */
function(schema){if(TcHmi.System.Services.typeManager)return TcHmi.System.Type.Schema.resolveType(schema);TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Type] Resolving default failed. System not ready.")}}(Schema=Type.Schema||(Type.Schema={}))}(TcHmi.Type||(TcHmi.Type={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * Provides an interface for Ui Provider.
     * @preserve (Part of the public API)
     */
let UiProvider;!function(UiProvider){function getProvider(type,providerName){return TcHmi.System.Data.Registrations.uiProvider.providers[type].get(providerName)}UiProvider.register=function(provider){const typeMap=TcHmi.System.Data.Registrations.uiProvider.providers[provider.type];if(typeMap.has(provider.providerName))throw new Error(`Provider ${provider.providerName} is already registered as a ${provider.type} provider. Duplicate registrations are not allowed.`);typeMap.set(provider.providerName,provider)},UiProvider.getProviders=function(type){return TcHmi.System.Data.Registrations.uiProvider.providers[type]},UiProvider.getProvider=getProvider,UiProvider.getPreferredProvider=function(type){let name;switch(type){case"keyboard":name=TcHmi.Config.get().systemKeyboard?.providerName;break;case"popup":name=TcHmi.Config.get().systemPopups?.providerName;break;default:throw new Error(`The provider type '${type}' is unknown. Please make sure this switch-case covers all possible values of the parameter 'type'.`)}if(!name)return;const preferredProvider=getProvider(type,name);if(!preferredProvider)throw new Error(`The configured provider '${name}' is not registered. Please make sure that the provider that is configured in tchmiconfig.json is registered with TcHmi.UiProvider.register().`);return preferredProvider};class BaseProvider{constructor(providerName,type){if("string"!=typeof providerName)throw new SyntaxError("providerName parameter has invalid type");if("string"!=typeof type)throw new SyntaxError("type parameter has invalid type");this.providerName=providerName}}UiProvider.BaseProvider=BaseProvider;UiProvider.KeyboardProvider=class extends BaseProvider{constructor(providerName){super(providerName,"keyboard"),this.type="keyboard"}};class PopupProvider extends BaseProvider{constructor(providerName){super(providerName,"popup"),this.type="popup"}}UiProvider.PopupProvider=PopupProvider,function(PopupProvider){let PositioningMode,BackgroundMode;!function(PositioningMode){PositioningMode[PositioningMode.Centered=1]="Centered",PositioningMode[PositioningMode.Floating=2]="Floating"}(PositioningMode=PopupProvider.PositioningMode||(PopupProvider.PositioningMode={})),function(BackgroundMode){BackgroundMode[BackgroundMode.None=1]="None",BackgroundMode[BackgroundMode.Dimmed=2]="Dimmed"}(BackgroundMode=PopupProvider.BackgroundMode||(PopupProvider.BackgroundMode={}));class Popup{constructor(parentControl){}}PopupProvider.Popup=Popup;PopupProvider.MessageBox=class extends Popup{constructor(header,content,buttons,parentControl){super(parentControl)}};PopupProvider.HtmlElementBox=class extends Popup{constructor(header,content,buttons,parentControl){super(parentControl)}};PopupProvider.InputPrompt=class extends Popup{constructor(header,label,validation,parentControl){super(parentControl)}}}(PopupProvider=UiProvider.PopupProvider||(UiProvider.PopupProvider={}))}(UiProvider=TcHmi.UiProvider||(TcHmi.UiProvider={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * Allows converting of values from any type to any type if types are compatible.
     * @preserve (Part of the public API)
     */
class ValueConverter{constructor(){}
/**
         * Converts a value to {Object/Array} and returns the {Object/Array} or null if the type of value is not compatible to {Object/Array}.
         * No content check will be done!
         * @param value The value to convert.
         * @param defaultValue The fallback value (null if not given)
         * @template T Type of the resulting object.
         * @preserve (Part of the public API)
         */static toObject(value,defaultValue=null){return ValueConverter.toObjectEx(value,{defaultValue:defaultValue}).value}
/**
         * Converts a value to {Object/Array} and returns the {Object/Array} or null if the type of value is not compatible to {Object/Array}. Returns a result object for error detection.
         * No content check will be done!
         * @param value The value to convert.
         * @param options
         
         * @template T Type of the resulting object.
         * @preserve (Part of the public API)
         */static toObjectEx(value,options){const defaultValue=options?.defaultValue??null;let res={error:TcHmi.Errors.NONE,value:defaultValue};if(null==value)return res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value must not be null or undefined."},res;if("string"==typeof value&&""!==value)try{res.value=JSON.parse(value)}catch(e){res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:String(e)}}else"object"==typeof value?null!==value&&(res.value=value):(res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value is not compatible with type object."});return res}
/**
         * Converts a value to {string} and returns the {string} or null if the type of value is not compatible to {string}.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible to string (null if not given)
         * @returns Returns a string or defaultValue if the type of value is not compatible.
         * @preserve (Part of the public API)
         */static toString(value,defaultValue=null){return ValueConverter.toStringEx(value,{defaultValue:defaultValue}).value}
/**
         * Converts a value to {string} and returns the {string} or null if the type of value is not compatible to {string}. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @returns Returns a string or defaultValue if the type of value is not compatible.
         * @preserve (Part of the public API)
         */static toStringEx(value,options){const defaultValue=options?.defaultValue??null;let res={error:TcHmi.Errors.NONE,value:defaultValue};if(0===arguments.length)return res.value=Object.toString.call(this),res;if(null==value)return res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value must not be null or undefined."},res;switch(typeof value){case"boolean":case"number":case"bigint":res.value=value.toString();break;case"object":"toJSON"in value&&"function"==typeof value.toJSON?res.value=value.toJSON():value instanceof TcHmi.Controls.System.baseTcHmiControl!=!0&&value instanceof Element!=!0&&(res.value=JSON.stringify(value));break;case"string":res.value=value;break;default:res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter"}}return res}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toDimensionUnit(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.DimensionUnitList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options Further options
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toDimensionUnitEx(value,options){return ValueConverter.toEnumEx(value,ValueConverter.DimensionUnitList,options)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toAngleUnit(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.AngleUnitList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toAngleUnitEx(value,options){return ValueConverter.toEnumEx(value,ValueConverter.AngleUnitList,options)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toBorderStyleValue(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.BorderStyleValueList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toBorderStyleValueEx(value,options){return ValueConverter.toEnumEx(value,ValueConverter.BorderStyleValueList,options)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toFontStyle(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.FontStyleList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toFontStyleEx(value,options){return ValueConverter.toEnumEx(value,ValueConverter.FontStyleList,options)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toFontSizeUnit(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.FontSizeUnitList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toFontSizeUnitEx(value,options){return ValueConverter.toEnumEx(value,ValueConverter.FontSizeUnitList,options)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toFontWeight(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.FontWeightList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toFontWeightEx(value,options){return ValueConverter.toEnumEx(value,ValueConverter.FontWeightList,options)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toHorizontalAlignment(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.HorizontalAlignmentList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toHorizontalAlignmentEx(value,options){return ValueConverter.toEnumEx(value,ValueConverter.HorizontalAlignmentList,options)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toScaleModeString(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.ScaleModeStringList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toScaleModeStringEx(value,options){return ValueConverter.toEnumEx(value,ValueConverter.ScaleModeStringList,options)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toSizeMode(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.SizeModeList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toSizeModeEx(value,options){return ValueConverter.toEnumEx(value,ValueConverter.SizeModeList,options)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toSizeModeWithContent(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.SizeModeWithContentList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toSizeModeWithContentEx(value,options){return ValueConverter.toEnumEx(value,ValueConverter.SizeModeWithContentList,options)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toVerticalAlignment(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.VerticalAlignmentList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toVerticalAlignmentEx(value,options){return ValueConverter.toEnumEx(value,ValueConverter.VerticalAlignmentList,options)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toVisibility(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.VisibilityList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toVisibilityEx(value,options){return ValueConverter.toEnumEx(value,ValueConverter.VisibilityList,options)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toToggleState(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.ToggleStateList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toToggleStateEx(value,options){return ValueConverter.toEnumEx(value,ValueConverter.ToggleStateList,options)}
/**
         * Converts a value to fontFamily value and returns the string or null if the type of value is not compatible to {string}.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns or null if the type of value is not compatible to string.
         * @preserve (Part of the public API)
         */static toFontFamily(value,defaultValue){return ValueConverter.toString(value,defaultValue)}
/**
         * Converts a value to fontFamily value and returns the string or null if the type of value is not compatible to {string}. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @returns or null if the type of value is not compatible to string.
         * @preserve (Part of the public API)
         */static toFontFamilyEx(value,options){return ValueConverter.toStringEx(value,options)}static __parseFloatStrict(value){return/^(\-|\+)?(\d+(\.\d+)?([e,E](\-|\+)?\d+)?|Infinity)$/.test(value)?parseFloat(value):NaN}
/**
         * Converts a value to {number}.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible to number (null if not given)
         * @returns Returns a string or defaultValue if the type of value is not compatible.
         * @preserve (Part of the public API)
         */static toNumber(value,defaultValue=null){return ValueConverter.toNumberEx(value,{defaultValue:defaultValue}).value}
/**
         * Converts a value to {number}. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @returns Returns a string or defaultValue if the type of value is not compatible.
         * @preserve (Part of the public API)
         */static toNumberEx(value,options){const defaultValue=options?.defaultValue??null;let res={error:TcHmi.Errors.NONE,value:defaultValue};if(null==value)return res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value must not be null or undefined."},res;switch(typeof value){case"string":res.value=ValueConverter.__parseFloatStrict(value),isNaN(res.value)&&"NaN"!==value&&(res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value is not a valid number."},res.value=defaultValue);break;case"boolean":switch(value){case!0:res.value=1;break;case!1:res.value=0}break;case"number":res.value=value;break;case"bigint":value>BigInt(Number.MAX_SAFE_INTEGER)?(res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value must not be greater than Number.MAX_SAFE_INTEGER."},res.value=defaultValue):value<BigInt(Number.MIN_SAFE_INTEGER)?(res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value must not be smaller than Number.MIN_SAFE_INTEGER."},res.value=defaultValue):res.value=Number(value);break;default:res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter"}}return res}
/**
         * Converts a value to {boolean} and returns the {boolean} or null if the type of value is not compatible to {boolean}.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible to boolean (null if not given)
         * @preserve (Part of the public API)
         */static toBoolean(value,defaultValue=null){return ValueConverter.toBooleanEx(value,{defaultValue:defaultValue}).value}
/**
         * Converts a value to {boolean} and returns the {boolean} or null if the type of value is not compatible to {boolean}.
         * @param value The value to convert.
         * @param options
         * @preserve (Part of the public API)
         */static toBooleanEx(value,options){const defaultValue=options?.defaultValue??null;let res={error:TcHmi.Errors.NONE,value:defaultValue};if(null==value)return res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value must not be null or undefined."},res;switch(typeof value){case"string":switch(value.toLowerCase()){case"true":res.value=!0;break;case"false":res.value=!1;break;default:res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value must be either 'true' or 'false' without case sensitivity."},res.value=defaultValue}break;case"number":switch(value){case 1:res.value=!0;break;case 0:res.value=!1;break;default:res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value must be either '1' or '0'."},res.value=defaultValue}break;case"bigint":switch(value){case 1n:res.value=!0;break;case 0n:res.value=!1;break;default:res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value must be either '1n' or '0n'."},res.value=defaultValue}break;case"boolean":res.value=value;break;default:res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The type of value must be 'string', 'number', 'bigint' or 'boolean'."},res.value=defaultValue}return res}
/**
         * Converts a value to {BigInt} and returns the {BigInt} or null if the type of value is not compatible to {BigInt}.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible to boolean (null if not given)
         * @preserve (Part of the public API)
         */static toBigInt(value,defaultValue=null){return ValueConverter.toBigIntEx(value,{defaultValue:defaultValue}).value}
/**
         * Converts a value to {BigInt} and returns the 64 bit {BigInt} or null if the type of value is not compatible to {BigInt}. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @preserve (Part of the public API)
         */static toBigIntEx(value,options){const defaultValue=options?.defaultValue??null;let res={error:TcHmi.Errors.NONE,value:defaultValue};if(null==value)return res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value must not be null or undefined."},res;try{let bigint=BigInt(value);return"number"==typeof value&&bigint!=value?(res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value is not a valid bigint."},res.value=defaultValue,res):(res.value=bigint,res)}catch(e){if("string"!=typeof value)return res.error=TcHmi.Errors.E_EXCEPTION,res.details={code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],domain:"TcHmi.ValueConverter",reason:String(e)},res.value=defaultValue,res;try{let num=ValueConverter.toNumber(value);if(null!==num){let bigint=BigInt(num);return bigint!=num?(res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value is not a valid bigint."},res.value=defaultValue,res):(res.value=bigint,res)}return res.error=TcHmi.Errors.E_EXCEPTION,res.details={code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],domain:"TcHmi.ValueConverter",reason:String(e)},res.value=defaultValue,res}catch(e){return res.error=TcHmi.Errors.E_EXCEPTION,res.details={code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],domain:"TcHmi.ValueConverter",reason:String(e)},res.value=defaultValue,res}}}
/**
         * Converts a value to 64 bit {BigInt} (clamping the BigInt value to 64 bits) and returns the 64 bit {BigInt} or null if the type of value is not compatible to 64 bit {BigInt}.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible to boolean (null if not given)
         * @preserve (Part of the public API)
         */static toBigInt64(value,defaultValue=null){return ValueConverter.toBigInt64Ex(value,{defaultValue:defaultValue}).value}
/**
         * Converts a value to 64 bit {BigInt} (clamping the BigInt value to 64 bits) and returns the 64 bit {BigInt} or null if the type of value is not compatible to 64 bit {BigInt}. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @preserve (Part of the public API)
         */static toBigInt64Ex(value,options){const defaultValue=options?.defaultValue??null;let res={error:TcHmi.Errors.NONE,value:defaultValue};if(null==value)return res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value must not be null or undefined."},res;let bigint=ValueConverter.toBigInt(value);if(null===bigint)return res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value is not a valid 64 bit integer."},res.value=defaultValue,res;let bigint64=BigInt.asIntN(64,bigint);return bigint64!==bigint?(res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value is not a valid 64 bit integer."},res.value=defaultValue,res):(res.value=bigint64,res)}
/**
         * Converts a value to unsigned 64 bit {BigInt} (clamping the BigInt value to 64 bits) and returns the 64 bit {BigInt} or null if the type of value is not compatible to 64 bit {BigInt}.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible to boolean (null if not given)
         * @preserve (Part of the public API)
         */static toUnsignedBigInt64(value,defaultValue=null){return ValueConverter.toUnsignedBigInt64Ex(value,{defaultValue:defaultValue}).value}
/**
         * Converts a value to unsigned 64 bit {BigInt} (clamping the BigInt value to 64 bits) and returns the 64 bit {BigInt} or null if the type of value is not compatible to 64 bit {BigInt}. Returns a result object for error detection.
         * @param value The value to convert.
         * @param options
         * @preserve (Part of the public API)
         */static toUnsignedBigInt64Ex(value,options){const defaultValue=options?.defaultValue??null;let res={error:TcHmi.Errors.NONE,value:defaultValue};if(null==value)return res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value must not be null or undefined."},res;let bigint=ValueConverter.toBigInt(value);if(null===bigint)return res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value is not a valid 64 bit unsigned integer."},res.value=defaultValue,res;let ubigint64=BigInt.asUintN(64,bigint);return ubigint64!==bigint?(res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value is not a valid 64 bit unsigned integer."},res.value=defaultValue,res):(res.value=ubigint64,res)}
/**
         * Converts a value to enum {number} and returns the enum {number} or null if the type of value is not compatible to enum {Object}.
         * @param value The value to convert.
         * @param enumType
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns number
         * @preserve (Part of the public API)
         */static toEnum(value,enumType,defaultValue=null){return ValueConverter.toEnumEx(value,enumType,{defaultValue:defaultValue}).value}
/**
         * Converts a value to enum {number} and returns the enum {number} or null if the type of value is not compatible to enum {Object}. Returns a result object for error detection.
         * @param value The value to convert.
         * @param enumType
         * @param options
         * @returns number
         * @preserve (Part of the public API)
         */static toEnumEx(value,enumType,options){const defaultValue=options?.defaultValue??null;let res={error:TcHmi.Errors.NONE,value:defaultValue};if(null==value)return res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value must not be null or undefined."},res;switch(typeof value){case"string":if(""===value)break;const numValue=parseInt(value,10);isNaN(numValue)?(res.value=enumType[value],void 0===res.value&&(res.value=enumType[value.toLowerCase()]),void 0===res.value&&(res.value=enumType[value.toUpperCase()]),void 0===res.value&&(res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value is not valid for the given enumeration."},res.value=defaultValue)):res=this.toEnumEx(numValue,enumType,defaultValue);break;case"number":void 0!==enumType[value]?res.value=value:(res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value is not valid for the given enumeration."},res.value=defaultValue);break;case"boolean":res=this.toEnumEx(this.toNumber(value),enumType,defaultValue);break;default:res.error=TcHmi.Errors.E_VALUE_INVALID,res.details={code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value must be of type 'string', 'number' or 'boolean'."},res.value=defaultValue}return res}
/**
         * Converts a value to the best effort value related to schema addressed by its by name or null if no schema related type is matching or schema is unknown.
         * @param value
         * @param typeName
         * @param options
         * @preserve (Part of the public API)
         */static toType(value,typeName,options){return ValueConverter.toTypeEx(value,typeName,options).value}
/**
         * Converts a value to the best effort value related to schema addressed by its by name or null if no schema related type is matching or schema is unknown. Returns a result object for error detection.
         * @param value
         * @param typeName
         * @param options
         * @preserve (Part of the public API)
         */static toTypeEx(value,typeName,options){if(!TcHmi.System.Services.typeManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"System not ready.",domain:"TcHmi.ValueConverter"};return{error:errorDetail.code,details:errorDetail,value:null}}if(null==value){return{error:TcHmi.Errors.E_VALUE_INVALID,details:{code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value must not be null or undefined."},value:null}}const schemaRes=TcHmi.System.Services.typeManager.getSchemaEx(typeName);if(schemaRes.error!==TcHmi.Errors.NONE){return{error:schemaRes.error,details:{code:schemaRes.error,message:TcHmi.Errors[schemaRes.error],domain:"TcHmi.ValueConverter",reason:"Resolving the schema: '"+typeName+"' failed.",errors:schemaRes.details?[schemaRes.details]:void 0},value:null}}const valueRes=ValueConverter.toSchemaType(value,schemaRes.schema,options);return{error:TcHmi.Errors.NONE,value:valueRes}}
/**
         * Converts a value to the best effort value related to schema or null if no schema related type is matching.
         * @param value
         * @param schema
         * @param options Optional options
         * @preserve (Part of the public API)
         */static toSchemaType(value,schema,options){return ValueConverter.toSchemaTypeEx(value,schema,options).value}
/**
         * Converts a value to the best effort value related to schema or null if no schema related type is matching. Returns a result object for error detection.
         * @param value
         * @param schema
         * @param options Optional options
         * @preserve (Part of the public API)
         */static toSchemaTypeEx(value,schema,options){if(null==value){return{error:TcHmi.Errors.E_VALUE_INVALID,details:{code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value must not be null or undefined."},value:null}}if(null==schema)return{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],domain:"TcHmi.ValueConverter",reason:"The parameter: 'schema' must be a valid object of type: 'TcHmi.JsonSchema'."},value:null};if(options&&options.resolveFunctionWriteValue&&schema.writeValue)return this.toSchemaTypeEx(value,schema.writeValue,options.convertDirection?{convertDirection:options.convertDirection}:void 0);const typeOfValue=typeof value;if(options&&options.convertDirection===ValueConverter.ConvertDirection.Backward){const ruleSchemas=TcHmi.System.Type.Schema.resolveTypeConversionRuleSchemas(schema);if(ruleSchemas){let res;for(const key of ruleSchemas.keys()){if(!key)continue;const ruleSchema=ruleSchemas.get(key);if(ruleSchema&&"string"===key){if(res=ValueConverter.toString(value),ruleSchema&&(!ruleSchema.enum||ruleSchema.enum&&ruleSchema.enum.includes(res)))break;res=void 0}}if(void 0!==res)return{error:TcHmi.Errors.NONE,value:res}}}else{const ruleSchemas=TcHmi.System.Type.Schema.resolveTypeConversionRuleSchemas(schema),ruleSchema=ruleSchemas?.get(typeOfValue);if(ruleSchema)switch(ruleSchema.convert){case"number":return ValueConverter.toNumberEx(value);case"string":return ValueConverter.toStringEx(value);case"boolean":return ValueConverter.toBooleanEx(value);case"bigint":return ValueConverter.toBigIntEx(value);case"bigint64":return ValueConverter.toBigInt64Ex(value);case"unsignedbigint64":return ValueConverter.toUnsignedBigInt64Ex(value)}}const schemaType=TcHmi.System.Type.Schema.resolveType(schema);if("string"!=typeof schemaType&&!Array.isArray(schemaType))return{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.ValueConverter",reason:"Failed to resolve type from given schema."},value:null};if(Array.isArray(schemaType)){if("string"===typeOfValue||"number"===typeOfValue||"boolean"===typeOfValue||"object"===typeOfValue){if(schemaType.includes(typeOfValue))return{error:TcHmi.Errors.NONE,value:value};for(const validType of schemaType){let res;switch(validType){case"object":case"array":res=ValueConverter.toObjectEx(value);break;case"string":res=ValueConverter.toStringEx(value);break;case"integer":case"number":res=ValueConverter.toNumberEx(value);break;case"boolean":res=ValueConverter.toBooleanEx(value);break;default:res=null}if(null!==res)return{error:TcHmi.Errors.NONE,value:res.value}}}}else switch(schemaType){case"object":case"array":return ValueConverter.toObjectEx(value);case"string":return ValueConverter.toStringEx(value);case"integer":case"number":return ValueConverter.toNumberEx(value);case"boolean":return ValueConverter.toBooleanEx(value)}return{error:TcHmi.Errors.E_VALUE_INVALID,details:{code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],domain:"TcHmi.ValueConverter",reason:"The value is not compatible with any definition in the given schema."},value:null}}}ValueConverter.AngleUnitList={deg:"deg",rad:"rad",turn:"turn",grad:"grad"},ValueConverter.BorderStyleValueList={Solid:"Solid",Dashed:"Dashed",Dotted:"Dotted",None:"None"},ValueConverter.DimensionUnitList={px:"px","%":"%"},ValueConverter.FontSizeUnitList={px:"px","%":"%",em:"em",rem:"rem"},ValueConverter.FontStyleList={Normal:"Normal",Italic:"Italic",Oblique:"Oblique",Auto:"Auto"},ValueConverter.FontWeightList={Normal:"Normal",Bold:"Bold",Auto:"Auto"},ValueConverter.HorizontalAlignmentList={Left:"Left",Center:"Center",Right:"Right"},ValueConverter.ScaleModeStringList={None:"None",ScaleToFill:"ScaleToFill",ScaleToFit:"ScaleToFit",ScaleToFitWidth:"ScaleToFitWidth",ScaleToFitHeight:"ScaleToFitHeight"},ValueConverter.SizeModeList={Value:"Value",Parent:"Parent"},ValueConverter.SizeModeWithContentList={Value:"Value",Parent:"Parent",Content:"Content"},ValueConverter.ToggleStateList={Normal:"Normal",Active:"Active"},ValueConverter.VerticalAlignmentList={Top:"Top",Center:"Center",Bottom:"Bottom"},ValueConverter.VisibilityList={Visible:"Visible",Hidden:"Hidden",Collapsed:"Collapsed"},TcHmi.ValueConverter=ValueConverter,function(ValueConverter){let ConvertDirection;!function(ConvertDirection){ConvertDirection[ConvertDirection.Forward=0]="Forward",ConvertDirection[ConvertDirection.Backward=1]="Backward"}(ConvertDirection=ValueConverter.ConvertDirection||(ValueConverter.ConvertDirection={}))}(ValueConverter=TcHmi.ValueConverter||(TcHmi.ValueConverter={}))}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.View=
/**
     * Provides functions to set partials as view.
     * @preserve (Part of the public API)
     */
class{
/**
         * Loads a view partial into the dom.
         * @param url
         * @param callback
         * @preserve (Part of the public API)
         */
static load(url,callback=null){if(!0===TCHMI_DESIGNER)TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.View] Loading an additional view level element in designer context is not allowed and therefore blocked."),TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.E_NOT_ALLOWED});else if(TcHmi.System.Services.viewManager){if(TcHmi.System.isParameterTypeInvalid(url,"url",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.View",callback))return;TcHmi.System.Services.viewManager.loadView(url,callback)}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.View] Loading view failed. System not ready."),TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.ERROR})}
/**
         * Returns the current view object.
         * @preserve (Part of the public API)
         */static get(){return!0===TCHMI_DESIGNER?(TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.View] Accessing a view level element is not allowed in designer context and therefore blocked."),null):TcHmi.System.Services.viewManager?TcHmi.System.Services.viewManager.getView():(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.View] Getting view failed. System not ready."),null)}
/**
         * Sets the view scale mode.
         * @preserve (Part of the public API)
         */static setScaleMode(scaleMode){!0===TCHMI_DESIGNER?TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.View] Accessing a view level element is not allowed in designer context and therefore blocked."):TcHmi.System.Services.viewManager?TcHmi.System.Services.viewManager.setScaleMode(scaleMode):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.View] Setting view scale mode failed. System not ready.")}}}(TcHmi||(TcHmi={}));const __tchmi_is_instanced_object=function(obj){if(null===obj||"object"!=typeof obj)return!1;void 0===__tchmi_is_instanced_object.__objectPrototype&&(__tchmi_is_instanced_object.__objectPrototype=Object.getPrototypeOf({})),void 0===__tchmi_is_instanced_object.__arrayPrototype&&(__tchmi_is_instanced_object.__arrayPrototype=Object.getPrototypeOf([]));let proto=Object.getPrototypeOf(obj);return null!==proto&&proto!==__tchmi_is_instanced_object.__objectPrototype&&proto!==__tchmi_is_instanced_object.__arrayPrototype};
/**
 * Clones the data {Object} in param obj and returns a clone of it.
 * This function will not create clones of objects based on a prototype definition (like class instances) and function references
 * and return the original reference instead.
 * String, null, undefined are returned directly as they are immutable / handled by value.
 * @param obj The object to clone.
 * @param options Options to define what should be cloned and how it should be cloned.
 * @param options.cloneMaps If set, maps will be cloned. Otherwise maps will be returned unchanged.
 * @param options.cloneMaps.deepCloneKeys Set to true to also clone map keys. Otherwise map keys will be reference equal to the keys in the original map.
 * @param options.cloneMaps.deepCloneValues Set to true to also clone map values. Otherwise map values will be reference equal to the values in the original map.
 * @param options.cloneSets If set, sets will be cloned. Otherwise sets will be returned unchanged.
 * @param options.cloneSets.deepCloneValues Set to true to also clone set values. Otherwise set values will be reference equal to the values in the original set.
 * @param options.cloneDates If true, dates will be cloned. Otherwise dates will be returned unchanged.
 * @returns Clone of param obj.
 * @template T defines the type of the target object
 * @preserve (Part of the public API)
 */function tchmi_clone_object(obj,options){const clone=function(value){const valueType=typeof value;if("function"===valueType)return value;if(options){if(options.cloneMaps&&value instanceof Map){const result=new Map;for(const[key,member]of value)result.set(options.cloneMaps.deepCloneKeys?tchmi_clone_object(key,options):key,options.cloneMaps.deepCloneValues?tchmi_clone_object(member,options):member);return result}if(options.cloneSets&&value instanceof Set){const result=new Set;for(const member of value)result.add(options.cloneSets.deepCloneValues?tchmi_clone_object(member,options):member);return result}if(options.cloneDates&&value instanceof Date)return new Date(value.valueOf())}if(null===value||"object"!==valueType||__tchmi_is_instanced_object(value))return value;if(Array.isArray(value)){const result=[];for(let[i,elem]of value.entries())i in value?result.push(clone(elem)):result.length++;return result}{const result={};for(let key in value)result[key]=clone(value[key]);return result}};return clone(obj)}function tchmi_compare_object(o1,o2,entryPath){if(__tchmi_is_instanced_object(o1)||__tchmi_is_instanced_object(o2))return null;let res=[];entryPath??(entryPath="");for(const p in o1)if(void 0!==o1[p]&&null!==o1[p]&&void 0!==o2[p]&&null!==o2[p]&&"object"==typeof o1[p]&&"object"==typeof o2[p])if(Array.isArray(o1)){const subDirtyPath=tchmi_compare_object(o1[p],o2[p],entryPath+"["+p+"]");if(null===subDirtyPath)return null;res=res.concat(subDirtyPath)}else{const subDirtyPath=tchmi_compare_object(o1[p],o2[p],entryPath+"::"+p);if(null===subDirtyPath)return null;res=res.concat(subDirtyPath)}else tchmi_equal(o1[p],o2[p])||(Array.isArray(o1)?res.push(entryPath+"["+p+"]"):res.push(entryPath+"::"+p));for(const p in o2)void 0!==o2[p]&&void 0===o1[p]&&(Array.isArray(o2)?res.push(entryPath+"["+p+"]"):res.push(entryPath+"::"+p));return res}
/*
 * Unify a path string.
 * Replace all backslashes with slashes, replace multiple slashes with single slashes except ://, remove leading slash.
 * @param path The path.
 * @returns Unified path.
 * @preserve (Part of the public API)
 */function tchmi_path(path){if("string"==typeof path){if(path.startsWith("data:")||path.startsWith("file:")||path.startsWith("http://")||path.startsWith("https://")||path.startsWith("ws://")||path.startsWith("wss://"))return new URL(path).toString();let tokens=path.replace(/\\+/g,"/").split("/");for(let i=0,ii=tokens.length;i<ii;i++){let token=tokens[i];if(""===token)tokens.splice(i,1),i--;else if("."===token)tokens.splice(i,1),i--;else if(".."===token){let tokenprev=tokens[i-1];tokenprev&&".."!==tokenprev&&(tokens.splice(i,1),tokens.splice(i-1,1),i-=2)}}return tokens.join("/")}return path}
/**
 * Converts a String to a valid CSS id pattern by escaping all reserved characters.
 * @param id The target id.
 * @returns Converted id.
 * @preserve (Part of the public API)
 */function tchmi_css_escape_selector(id){return CSS&&CSS.escape?CSS.escape(id):jQuery.escapeSelector(id)}
/**
 * tchmi_escape_regex
 * @param text
 * @preserve (Part of the public API)
 */function tchmi_escape_regex(text){return"string"!=typeof text&&"function"==typeof text.toString&&(text=text.toString()),text.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function tchmi_format_string(formatString,...args){let formattedString="",index=0;for(let i=0,ii=formatString.length;i<ii;i++)if("{"===formatString[i])if("{"===formatString[i+1])formattedString+="{",i++;else{let end=formatString.indexOf("}",i),placeholder=formatString.substring(i+1,end),regEx=/(?:([0-9]\d*)\||\(([^\)]+)\))?(\+)?(0|'[^|])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/.exec(placeholder);if(null!==regEx){let regExDescription={placeholder:regEx[0],parameterIndex:regEx[1],key:regEx[2],sign:regEx[3],charToAddBefore:regEx[4],align:regEx[5],lengthToAdd:regEx[6],decimal:regEx[7],type:regEx[8]},indexNow=index;if(null===regEx[8]||void 0===regEx[0]){formattedString+=regEx[1],i=end,index++;continue}null!==regExDescription.parameterIndex&&void 0!==regExDescription.parameterIndex&&(indexNow=parseInt(regExDescription.parameterIndex,10));let arg=args[indexNow],decimal=null!==regEx?parseInt(regExDescription.decimal,10):void 0;switch(regExDescription.type){case"d":case"i":case"u":arg=parseInt(arg,10);break;case"o":arg=parseInt(arg,10).toString(8);break;case"x":arg=parseInt(arg,10).toString(16);break;case"X":arg=parseInt(arg,10).toString(16).toUpperCase();break;case"f":arg=decimal?parseFloat(arg).toFixed(decimal):parseFloat(arg);break;case"e":arg=decimal?parseFloat(arg).toExponential(decimal):parseFloat(arg).toExponential();break;case"g":arg=decimal?String(Number(arg.toPrecision(decimal))):parseFloat(arg);break;case"s":arg=null===arg?"null":void 0===arg?"undefined":TcHmi.ValueConverter.toString(arg,""),arg=decimal?arg.substring(0,decimal):arg;break;case"b":arg=parseInt(arg,10).toString(2);break;case"t":arg=TcHmi.ValueConverter.toBoolean(arg),null===arg&&(arg=void 0),arg=decimal?arg.substring(0,decimal):arg;break;case"T":arg=null===arg?"null":typeof arg,arg=decimal?arg.substring(0,decimal):arg;break;case"v":arg=null===arg?"null":void 0===arg?"undefined":arg.valueOf(),arg=decimal?arg.substring(0,decimal):arg;break;case"j":arg=JSON.stringify(arg,null,regExDescription.lengthToAdd?parseInt(regExDescription.lengthToAdd,10):0)}if(/[j]/.exec(regExDescription.type))formattedString+=arg;else{let isPositive,sign,isNumber=/[d-g,i]/.test(regExDescription.type);isNumber&&(isPositive=arg>=0),!isNumber||isPositive&&!regExDescription.sign||isNaN(arg)?sign="":(sign=isPositive?"+":"",arg=arg.toString().replace(regExDescription.sign,""));let char=regExDescription.charToAddBefore?"0"===regExDescription.charToAddBefore?"0":regExDescription.charToAddBefore.charAt(1):" ",charLength=parseInt(regExDescription.lengthToAdd,10)-(sign+arg).length,charToAdd=regExDescription.lengthToAdd&&charLength>0?Array(charLength+1).join(char):"";formattedString+=regExDescription.align?sign+arg+charToAdd:"0"===char?sign+charToAdd+arg:charToAdd+sign+arg}index++,i=end}else{let onlyNumber=/([0-9]\d*)/.exec(placeholder);if(null!==onlyNumber){formattedString+=args[onlyNumber[0]],i=end}}}else"}"===formatString[i]?"}"===formatString[i+1]&&(formattedString+="}",i++):formattedString+=formatString[i];return formattedString}
/**
 * TwinCAT HMI API
 * Check out
 * https://infosys.beckhoff.com/content/1031/te2000_tc3_hmi_engineering/3730606987.html?id=1426887615595781518
 * for an API reference.
 * @preserve (Part of the public API)
 */var TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi;function gIsolatedEval_TcHmi_System_FunctionExpression_Results(s,resSE,resFCE){return eval(s)}function gIsolatedEval_TcHmi_System_FunctionExpression(s){return eval(s)}function gIsolatedEval_TcHmi_System_TriggerManager_JavaScriptAction(ctx,s){return eval(s)}function gIsolatedEval_TcHmi_System_TriggerManager_ConditionExpressionsResult(s,results){return eval(s)}!function(TcHmi){let IFunction,Endianness,PartialType,Trigger;TcHmi.isSolidColor=function(colorObject){return null!=colorObject&&"string"==typeof colorObject.color},TcHmi.isLinearGradientColor=function(colorObject){if(null==colorObject)return!1;let angle=colorObject.angle;return!(!Array.isArray(colorObject.stopPoints)||"number"!=typeof angle&&("string"!=typeof angle||isNaN(parseFloat(angle))))},TcHmi.isBackground=
/**
     * Checks if the parameter is a TcHmi.Background
     * @param obj object to test
     * @preserve (Part of the public API)
     */
function(obj){return null!=obj&&(void 0!==obj.color&&void 0!==obj.image&&void 0!==obj.imageWidth&&void 0!==obj.imageWidthUnit&&void 0!==obj.imageHeight&&void 0!==obj.imageHeightUnit&&void 0!==obj.imageHorizontalAlignment&&void 0!==obj.imageVerticalAlignment&&void 0!==obj.imagePadding)},TcHmi.isTranslate=
/**
     * Checks if the parameter is a TcHmi.checkTransform
     * @param transformObject object to test
     * @preserve (Part of the public API)
     */
function(transformObject){return!!transformObject&&"Translate"===transformObject.transformType},TcHmi.isRotate=
/**
     * Checks if the parameter is a TcHmi.Rotate
     * @param transformObject object to test
     * @preserve (Part of the public API)
     */
function(transformObject){return!!transformObject&&"Rotate"===transformObject.transformType},TcHmi.isScale=
/**
     * Checks if the parameter is a TcHmi.Scale
     * @param transformObject object to test
     * @preserve (Part of the public API)
     */
function(transformObject){return!!transformObject&&"Scale"===transformObject.transformType},TcHmi.isSkew=
/**
     * Checks if the parameter is a TcHmi.Skew
     * @param transformObject object to test
     * @preserve (Part of the public API)
     */
function(transformObject){return!!transformObject&&"Skew"===transformObject.transformType},TcHmi.isOrigin=
/**
     * Checks if the parameter is a TcHmi.Origin
     * @param transformObject object to test
     * @preserve (Part of the public API)
     */
function(transformObject){return!!transformObject&&"Origin"===transformObject.transformType},TcHmi.isPerspective=
/**
     * Checks if the parameter is a TcHmi.Perspective
     * @param transformObject object to test
     * @preserve (Part of the public API)
     */
function(transformObject){return!!transformObject&&"Perspective"===transformObject.transformType},function(IFunction){IFunction.isStaticValue=function(value){return!!value&&"StaticValue"===value.objectType},IFunction.isSymbol=function(value){return!!value&&"Symbol"===value.objectType},IFunction.isEventDataObject=function(value){return!!value&&"EventDataObject"===value.objectType},IFunction.isFunctionExpression=function(value){return!!value&&"FunctionExpression"===value.objectType}}(IFunction=TcHmi.IFunction||(TcHmi.IFunction={})),function(Endianness){Endianness[Endianness.LittleEndian=0]="LittleEndian",Endianness[Endianness.BigEndian=1]="BigEndian"}(Endianness=TcHmi.Endianness||(TcHmi.Endianness={})),TcHmi.isComparison=function(value){return!!value&&(["==","!=","<",">","<=",">=","contains","contains not","== [ignore case]","!= [ignore case]","contains [ignore case]","contains not [ignore case]"].includes(value.comparator)&&(["string","number","boolean"].includes(typeof value.value)||value.value instanceof Date||null===value.value))},TcHmi.isLogicOperator=function(value){if(!value)return!1;let logic=value.logic;return"AND"===logic||"OR"===logic},function(PartialType){PartialType[PartialType.Invalid=0]="Invalid",PartialType[PartialType.View=1]="View",PartialType[PartialType.Content=2]="Content",PartialType[PartialType.UserControl=3]="UserControl"}(PartialType=TcHmi.PartialType||(TcHmi.PartialType={})),function(Trigger){Trigger.isCondition=function(obj){return"Condition"===obj.objectType},Trigger.isSwitchCase=function(obj){return"SwitchCase"===obj.objectType},Trigger.isControlApiFunction=function(obj){return"ControlApiFunction"===obj.objectType},Trigger.isWriteToSymbol=function(obj){return"WriteToSymbol"===obj.objectType},Trigger.isComment=function(obj){return"Comment"===obj.objectType},Trigger.isFunction=function(obj){return null!==obj&&"Function"===obj.objectType},Trigger.isJavaScript=function(obj){return"JavaScript"===obj.objectType},Trigger.isActionTemplate=function(obj){return"ActionTemplate"===obj.objectType},Trigger.isFunctionExpression=function(obj){return null!==obj&&"FunctionExpression"===obj.objectType},Trigger.isControlAttributeBindingTarget=function(obj){return"ControlAttributeBindingTarget"===obj.objectType}}(Trigger=TcHmi.Trigger||(TcHmi.Trigger={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){let ControlAttributeType,ControlAttributeValueType;!function(ControlAttributeType){ControlAttributeType[ControlAttributeType.Invalid=0]="Invalid",ControlAttributeType[ControlAttributeType.General=1]="General",ControlAttributeType[ControlAttributeType.Control=2]="Control",ControlAttributeType[ControlAttributeType.UserControlParameter=3]="UserControlParameter"}(ControlAttributeType=System.ControlAttributeType||(System.ControlAttributeType={})),function(ControlAttributeValueType){ControlAttributeValueType[ControlAttributeValueType.Invalid=0]="Invalid",ControlAttributeValueType[ControlAttributeValueType.Simple=1]="Simple",ControlAttributeValueType[ControlAttributeValueType.Complex=2]="Complex",ControlAttributeValueType[ControlAttributeValueType.Unknown=3]="Unknown"}(ControlAttributeValueType=System.ControlAttributeValueType||(System.ControlAttributeValueType={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.resolveControlHierarchy=function(ctrl,pctrl=null){let childrenHierarchyArr=[];if("function"==typeof ctrl.getChildren){const cc=ctrl.getChildren();for(let i=0,ii=cc.length;i<ii;i++)childrenHierarchyArr.push(TcHmi.System.resolveControlHierarchy(cc[i],ctrl))}return{ctrl:ctrl,children_hierarchy:childrenHierarchyArr,pctrl:pctrl}},System.resolveAttributesFromControlElement=function(elem){const res={error:TcHmi.Errors.NONE,value:{}},targetUserControlId=elem.getAttribute("data-tchmi-target-user-control"),controlType=elem.getAttribute("data-tchmi-type"),cj=targetUserControlId?TcHmi.System.Data.Caches.partialCompositeConfigCache.get(tchmi_path(targetUserControlId.replace(".usercontrol",".usercontrol.json"))):void 0;for(const elemChild of elem.children)if(elemChild.hasAttribute("data-tchmi-target-attribute")&&"application/json"===elemChild.getAttribute("type")){const attrName=elemChild.getAttribute("data-tchmi-target-attribute");let value=null;const innerHTML=elemChild.innerHTML.trim();if(innerHTML)try{value=JSON.parse(innerHTML.replace(/\\\\n/g,"\\\\\\n").replace(/\\\\r/g,"\\\\\\r").replace(/\\\\t/g,"\\\\\\t").replace(/\\n/g,"\\\\n").replace(/\\r/g,"\\\\r").replace(/\\t/g,"\\\\t"))}catch(ex){const e=ex;res.error=TcHmi.Errors.ERROR;let error={code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:'Parsing json of attribute: "'+attrName+'" failed with exception: '+e,domain:"TcHmi.System",exception:e};res.details?(res.details.errors||(res.details.errors=[]),res.details.errors.push(error)):res.details={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System",errors:[error]}}let meta={name:attrName,value:value,valueType:System.ControlAttributeValueType.Complex,type:System.ControlAttributeType.General,descr:TcHmi.System.Services.controlManager?.getDescriptionAttributeByName(controlType,attrName)??null};if(null!==meta.descr&&(meta.type=System.ControlAttributeType.Control),cj&&cj.parameters)for(const paramDescription of cj.parameters)paramDescription.name.toLowerCase()===meta.name.toLowerCase()&&(meta.descr=paramDescription,null!==meta.descr&&(meta.type=System.ControlAttributeType.UserControlParameter));res.value[meta.name]=meta}for(const elementAttribute of elem.attributes){let meta={name:elementAttribute.name,value:elementAttribute.value,type:System.ControlAttributeType.Invalid,valueType:System.ControlAttributeValueType.Simple,descr:TcHmi.System.Services.controlManager?.getDescriptionAttributeByName(controlType,elementAttribute.name)??null};if(null!==meta.descr&&(meta.type=System.ControlAttributeType.Control),cj?.parameters)for(const cjParamDescr of cj.parameters)if(cjParamDescr.name===meta.name&&(meta.descr=cjParamDescr,null!==meta.descr)){meta.type=System.ControlAttributeType.UserControlParameter;break}res.value[meta.name]=meta}return res},System.__unload=function(){TcHmi.System.isUnloaded||(TcHmi.System.isUnloaded=!0,TcHmi.EventProvider.raise("System.disableCommunication"))},System.resolveQualifiedName=function(name,namespace){return null!=namespace&&""!==namespace?namespace+"."+name:name},System.parseIdFromHtml=function(markup){let state=2,idStartIdx=0,idEndIdx=0;for(let charIdx=0;charIdx<markup.length;charIdx++){switch(markup[charIdx]){case"i":1===state&&(state=3);break;case"d":3===state?state=4:6===state||7===state||(state=2);break;case"=":4===state&&(state=5);break;case"'":5===state?(state=6,idStartIdx=charIdx+1):6===state&&(idEndIdx=charIdx);break;case'"':5===state?(state=7,idStartIdx=charIdx+1):7===state&&(idEndIdx=charIdx);break;case"<":case">":state=1;break;case" ":case"\t":case"\r":case"\n":4===state||5===state||(state=1);break;default:3===state?state=0:6===state||7===state||(state=2)}if(idEndIdx)break}if(idEndIdx)return markup.slice(idStartIdx,idEndIdx)},System.tchmi_utf8str_base64decode=function(input){try{return decodeURIComponent(Array.prototype.map.call(window.atob(input),(function(c){return"%"+("00"+c.charCodeAt(0).toString(16)).slice(-2)})).join(""))}catch(e){return null}},System.tchmi_utf8str_base64encode=function(input){try{return window.btoa(encodeURIComponent(input).replace(/%([0-9A-F]{2})/g,(function(match,p1){return String.fromCharCode(parseInt("0x"+p1,16))})))}catch(e){return null}},System.compareISO8601ServerCommandDateTimeStrings=function(a,b){if(a.length===b.length)return a<b?-1:a>b?1:0;{let aDate=new Date(a),bDate=new Date(b);if(aDate<bDate)return-1;if(aDate>bDate)return 1;{let aSubSeconds=null,aIndex1=a.indexOf("."),aIndex2=a.indexOf("Z");if(aIndex1>-1&&aIndex2>-1&&(aSubSeconds=a.substring(aIndex1+1,aIndex2)),aSubSeconds&&aSubSeconds.length<6)for(let i=0,ii=6-aSubSeconds.length;i<ii;i++)aSubSeconds+="0";let bSubSeconds=null,bIndex1=b.indexOf("."),bIndex2=b.indexOf("Z");if(bIndex1>-1&&bIndex2>-1&&(bSubSeconds=b.substring(bIndex1+1,bIndex2)),bSubSeconds&&bSubSeconds.length<6)for(let i=0,ii=6-bSubSeconds.length;i<ii;i++)bSubSeconds+="0";return null!==aSubSeconds&&null!==bSubSeconds&&aSubSeconds<bSubSeconds?-1:null!==aSubSeconds&&null!==bSubSeconds&&aSubSeconds>bSubSeconds?1:0}}};const regexISO8601ServerCommandDurationParts=/^P(?=.{2,})(\d+Y|\d+[.,]\d+Y$)?(\d+M|\d+[.,]\d+M$)?(\d+W|\d+[.,]\d+W$)?(\d+D|\d+[.,]\d+D$)?(?:T(\d+H|\d+[.,]\d+H$)?(\d+M|\d+[.,]\d+M$)?(\d+S|\d+[.,]\d+S$)?)?$/;System.compareISO8601ServerCommandDurationStrings=function(a,b){const resA=regexISO8601ServerCommandDurationParts.exec(a),resB=regexISO8601ServerCommandDurationParts.exec(b);if(null===resA)throw new Error("Wrong format for arugment: 'a'.");if(null===resB)throw new Error("Wrong format for arugment: 'b'.");const partsA=resA.slice(1),partsB=resB.slice(1),partsAMapped=partsA.map((value=>value?parseFloat(value.slice(0,-1)):0)),partsBMapped=partsB.map((value=>value?parseFloat(value.slice(0,-1)):0));for(const[index,value]of partsAMapped.entries()){if(value<partsBMapped[index])return-1;if(value>partsBMapped[index])return 1}return 0},System.compareVersionStrings=function(a,b){let tokensA=a.split("."),tokensB=b.split(".");if(tokensA.length!==tokensB.length)throw new Error("Version range missmatch. Both version strings must have the same range.");for(let i=0;i<tokensA.length;i++){let tokenA=tokensA[i],tokenB=tokensB[i],numA=parseInt(tokenA,10),numB=parseInt(tokenB,10);if(numA<numB)return-1;if(numA>numB)return 1}return 0},System.isParameterTypeInvalid=function(parameter,parameterName,options,domain,callback){const callCallback=reason=>{const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:reason};return domain&&(errorDetail.domain=domain),TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail},checkOne=variable=>typeof variable!==options.type?callCallback("Parameter "+parameterName+" has type "+typeof variable+", but must have type "+options.type):"string"===options.type&&"number"==typeof options.minStringLength&&variable.length<options.minStringLength&&callCallback("String parameter "+parameterName+" has length of "+variable.length+", but must have at least "+options.minStringLength);if(void 0!==parameter||"undefinedOk"!==options.required&&"fullOptional"!==options.required){if(null!==parameter||"nullOk"!==options.required&&"fullOptional"!==options.required){if(null==parameter)return callCallback("Required parameter "+parameterName+" must not be "+parameter);if(!0===options.expectArray){if(Array.isArray(parameter)){if("number"==typeof options.minArrayLength&&parameter.length<options.minArrayLength)return callCallback("Array parameter "+parameterName+" has "+parameter.length+" items, but must have at least "+options.minStringLength);if(options.type){for(let item of parameter){const itemIsInvalid=checkOne(item);if(itemIsInvalid)return itemIsInvalid}return!1}return!1}return callCallback("Parameter "+parameterName+" must be an array")}return!1===options.expectArray&&Array.isArray(parameter)?callCallback("Parameter "+parameterName+" must not be an array"):checkOne(parameter)}return!1}return!1},System.injectInGlobalObject=function(fullName,injectObj){const pathArr=fullName.split(".");if(pathArr.some((path=>!path)))throw new Error("Empty parts for namespace not allowed.");const name=pathArr.pop();let iteratingTargetObject=window;for(const path of pathArr){if(path in iteratingTargetObject||(iteratingTargetObject[path]={}),"object"!=typeof iteratingTargetObject[path]||null===iteratingTargetObject[path])throw new Error(`The requested namespace ${fullName} has conflicts with existing window properties.`);iteratingTargetObject=iteratingTargetObject[path]}if(name in iteratingTargetObject)throw new Error("There is already an object at the requested place "+fullName);iteratingTargetObject[name]=injectObj},System.resolveSymbolPathToTokenArray=function(path){return TcHmi.ObjectPath.toPathTokens(path)},System.resolveElementStyleDimensions=function(j){let clone=j.clone(),tempDiv=document.createElement("div"),helper=$(tempDiv);helper.css("display","none"),helper.append(clone),TcHmi.System.SharedResources.jqBody.append(helper);const s=window.getComputedStyle(clone[0],null);let res={width:s.width?s.width:"auto",height:s.height?s.height:"auto",top:s.top?s.top:"auto",left:s.left?s.left:"auto",right:s.right?s.right:"auto",bottom:s.bottom?s.bottom:"auto"};return helper.remove(),res},System.toCamelCase=function(text){let res="";if(null==text||""===text)return res;let s=text;for(let i=0,ii=s.length;i<ii;i++){let c=s[i];0!==i?"-"===s[i-1]?res+=c.toUpperCase():"-"!==c&&(res+=c):res+=c.toUpperCase()}return res},System.toDashCase=function(text){let res="";if(null==text||""===text)return res;let s=text;for(let i=0,ii=s.length;i<ii;i++){let c=s[i];"-"!==c&&c.toUpperCase()===c&&i>0?res+="-"+c:res+=c}return res.toLowerCase()}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){let SharedResources;SharedResources=System.SharedResources||(System.SharedResources={})}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){let Services,Data;!function(Services){let Engineering;Engineering=Services.Engineering||(Services.Engineering={})}(Services=System.Services||(System.Services={})),function(Data){let Modules,Registrations,Caches;Data.packages=new Map,function(Modules){Modules.controls={map:new Map,array:[],urlMap:new Map},Modules.functions={map:new Map,array:[]}}(Modules=Data.Modules||(Data.Modules={})),function(Registrations){Registrations.controls={map:new Map,array:[]},Registrations.functions={map:new Map,array:[]},Registrations.uiProvider={providers:{keyboard:new Map,popup:new Map}}}(Registrations=Data.Registrations||(Data.Registrations={})),function(Caches){Caches.templateMarkupCache=new Map,Caches.partialMarkupCache=new Map,Caches.partialCompositeConfigCache=new Map}(Caches=Data.Caches||(Data.Caches={})),Data.isKeepAlivePartial=new Map,Data.isLoadSyncContent=new Map,Data.isPreloadBindingPartial=new Map}(Data=System.Data||(System.Data={})),System.config={basePath:"",scaleMode:"None",startupView:"",activeTheme:"Base",themes:{},tcHmiServer:{websocketIntervalTime:500,websocketSystemTimeout:6e4,websocketTimeout:6e4},symbols:{internal:{},themedResources:{}},trigger:[],packages:[],views:[],userFunctions:[],userControls:[],content:[],actionTemplates:[],languages:{},keyboardLayouts:[],creatorSettings:{viewport:{defaultHeight:600,defaultWidth:800}},binding:{symbolError:"Ignore"}},System.nugetPackagesMetadata=TCHMI_NUGET_METADATA,System.hostBaseUri=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),System.hostPrefix="",System.isInitialized=!1,System.isPreloaded=!1,System.isUnloaded=!1,System.destroyGlobalTrigger=null,System.mapControlNamesFromPackageManifestApi0ToApi1=new Map([["tchmi-bar-chart","TcHmi.Controls.Beckhoff.TcHmiBarChart"],["tchmi-button","TcHmi.Controls.Beckhoff.TcHmiButton"],["tchmi-checkbox","TcHmi.Controls.Beckhoff.TcHmiCheckbox"],["tchmi-combobox","TcHmi.Controls.Beckhoff.TcHmiCombobox"],["tchmi-datagrid","TcHmi.Controls.Beckhoff.TcHmiDatagrid"],["tchmi-date-time-picker","TcHmi.Controls.Beckhoff.TcHmiDateTimePicker"],["tchmi-ellipse","TcHmi.Controls.Beckhoff.TcHmiEllipse"],["tchmi-event-grid","TcHmi.Controls.Beckhoff.TcHmiEventGrid"],["tchmi-iframe","TcHmi.Controls.Beckhoff.TcHmiIFrame"],["tchmi-image","TcHmi.Controls.Beckhoff.TcHmiImage"],["tchmi-keyboard","TcHmi.Controls.Beckhoff.TcHmiKeyboard"],["tchmi-line","TcHmi.Controls.Beckhoff.TcHmiLine"],["tchmi-linear-gauge","TcHmi.Controls.Beckhoff.TcHmiLinearGauge"],["tchmi-line-chart","TcHmi.Controls.Beckhoff.TcHmiLineChart"],["tchmi-polygon","TcHmi.Controls.Beckhoff.TcHmiPolygon"],["tchmi-radial-gauge","TcHmi.Controls.Beckhoff.TcHmiRadialGauge"],["tchmi-rectangle","TcHmi.Controls.Beckhoff.TcHmiRectangle"],["tchmi-textblock","TcHmi.Controls.Beckhoff.TcHmiTextblock"],["tchmi-textbox","TcHmi.Controls.Beckhoff.TcHmiTextbox"],["tchmi-timespan-picker","TcHmi.Controls.Beckhoff.TcHmiTimespanPicker"],["tchmi-toggle-button","TcHmi.Controls.Beckhoff.TcHmiToggleButton"],["tchmi-trend-line-chart","TcHmi.Controls.Beckhoff.TcHmiTrendLineChart"],["tchmi-video","TcHmi.Controls.Beckhoff.TcHmiVideo"],["tchmi-container","TcHmi.Controls.System.TcHmiContainer"],["tchmi-container-control","TcHmi.Controls.System.TcHmiContainerControl"],["tchmi-content","TcHmi.Controls.System.TcHmiContent"],["tchmi-control","TcHmi.Controls.System.TcHmiControl"],["tchmi-grid","TcHmi.Controls.System.TcHmiGrid"],["tchmi-html-host","TcHmi.Controls.System.TcHmiHtmlHost"],["tchmi-partial","TcHmi.Controls.System.TcHmiPartial"],["tchmi-region","TcHmi.Controls.System.TcHmiRegion"],["tchmi-user-control","TcHmi.Controls.System.TcHmiUserControl"],["tchmi-user-control-host","TcHmi.Controls.System.TcHmiUserControlHost"]]),System.mapControlNamesFromPackageManifestApi1ToApi0=new Map([["TcHmi.Controls.Beckhoff.TcHmiBarChart","tchmi-bar-chart"],["TcHmi.Controls.Beckhoff.TcHmiButton","tchmi-button"],["TcHmi.Controls.Beckhoff.TcHmiCheckbox","tchmi-checkbox"],["TcHmi.Controls.Beckhoff.TcHmiCombobox","tchmi-combobox"],["TcHmi.Controls.Beckhoff.TcHmiDatagrid","tchmi-datagrid"],["TcHmi.Controls.Beckhoff.TcHmiDateTimePicker","tchmi-date-time-picker"],["TcHmi.Controls.Beckhoff.TcHmiEllipse","tchmi-ellipse"],["TcHmi.Controls.Beckhoff.TcHmiEventGrid","tchmi-event-grid"],["TcHmi.Controls.Beckhoff.TcHmiIFrame","tchmi-iframe"],["TcHmi.Controls.Beckhoff.TcHmiImage","tchmi-image"],["TcHmi.Controls.Beckhoff.TcHmiKeyboard","tchmi-keyboard"],["TcHmi.Controls.Beckhoff.TcHmiLine","tchmi-line"],["TcHmi.Controls.Beckhoff.TcHmiLinearGauge","tchmi-linear-gauge"],["TcHmi.Controls.Beckhoff.TcHmiLineChart","tchmi-line-chart"],["TcHmi.Controls.Beckhoff.TcHmiPolygon","tchmi-polygon"],["TcHmi.Controls.Beckhoff.TcHmiRadialGauge","tchmi-radial-gauge"],["TcHmi.Controls.Beckhoff.TcHmiRectangle","tchmi-rectangle"],["TcHmi.Controls.Beckhoff.TcHmiTextblock","tchmi-textblock"],["TcHmi.Controls.Beckhoff.TcHmiTextbox","tchmi-textbox"],["TcHmi.Controls.Beckhoff.TcHmiTimespanPicker","tchmi-timespan-picker"],["TcHmi.Controls.Beckhoff.TcHmiToggleButton","tchmi-toggle-button"],["TcHmi.Controls.Beckhoff.TcHmiTrendLineChart","tchmi-trend-line-chart"],["TcHmi.Controls.Beckhoff.TcHmiVideo","tchmi-video"],["TcHmi.Controls.System.TcHmiContainer","tchmi-container"],["TcHmi.Controls.System.TcHmiContainerControl","tchmi-container-control"],["TcHmi.Controls.System.TcHmiContent","tchmi-content"],["TcHmi.Controls.System.TcHmiControl","tchmi-control"],["TcHmi.Controls.System.TcHmiGrid","tchmi-grid"],["TcHmi.Controls.System.TcHmiHtmlHost","tchmi-html-host"],["TcHmi.Controls.System.TcHmiPartial","tchmi-partial"],["TcHmi.Controls.System.TcHmiRegion","tchmi-region"],["TcHmi.Controls.System.TcHmiUserControl","tchmi-user-control"],["TcHmi.Controls.System.TcHmiUserControlHost","tchmi-user-control-host"],["TcHmi.Controls.System.TcHmiView","tchmi-view"]])}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(acornSymbolExpressionExtension){let tt=acorn.tokTypes,tc=acorn.tokContexts;tc.symbolExpressionOpenTag=new acorn.TokContext("%tag",!1),tc.symbolExpressionCloseTag=new acorn.TokContext("%/tag",!1),tc.symbolExpressionExpression=new acorn.TokContext("%tag%...%/tag%",!0,!0),tt.symbolExpressionTagName=new acorn.TokenType("symbolExpressionTagName"),tt.symbolExpressionSymbolName=new acorn.TokenType("symbolExpressionSymbolName",{beforeExpr:!0}),tt.symbolExpressionOpenTagStart=new acorn.TokenType("symbolExpressionOpenTagStart"),tt.symbolExpressionOpenTagEnd=new acorn.TokenType("symbolExpressionOpenTagEnd"),tt.symbolExpressionCloseTagStart=new acorn.TokenType("symbolExpressionCloseTagStart"),tt.symbolExpressionCloseTagEnd=new acorn.TokenType("symbolExpressionCloseTagEnd"),tt.symbolExpressionOpenTagStart.updateContext=function(){this.context.push(tc.symbolExpressionExpression),this.context.push(tc.symbolExpressionOpenTag),this.exprAllowed=!1},tt.symbolExpressionOpenTagEnd.updateContext=function(prevType){this.context.pop(),this.exprAllowed=!0},tt.symbolExpressionCloseTagStart.updateContext=function(){this.context.pop(),this.context.push(tc.symbolExpressionCloseTag),this.exprAllowed=!1},tt.symbolExpressionCloseTagEnd.updateContext=function(prevType){this.context.pop(),this.exprAllowed=!1};let pp=acorn.Parser.prototype;pp.symbolExpression_readToken=function(){let out="";const chunkStart=this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated BEX contents");let ch=this.input.charCodeAt(this.pos);if(37===ch)return this.pos===this.start?this.getTokenFromCode(ch):(out+=this.input.slice(chunkStart,this.pos),this.finishToken(tt.symbolExpressionSymbolName,out));++this.pos}},pp.symbolExpression_readWord=function(){let ch,start=this.pos;do{ch=this.input.charCodeAt(++this.pos)}while(acorn.isIdentifierChar(ch)||45===ch);return this.finishToken(tt.symbolExpressionTagName,this.input.slice(start,this.pos))},pp.symbolExpression_parseString=function(){const value=this.value;return this.next(),value},pp.symbolExpression_parseOpeningTagName=function(){const tagName=this.symbolExpression_parseString();return this.expect(tt.symbolExpressionOpenTagEnd),tagName},pp.symbolExpression_parseClosingTagName=function(){const tagName=this.symbolExpression_parseString();return this.expect(tt.symbolExpressionCloseTagEnd),tagName},pp.symbolExpression_parseElementAt=function(startPos,startLoc){const node=this.startNodeAt(startPos,startLoc);let symbol="";const openingTagName=this.symbolExpression_parseOpeningTagName();let closingTagName="";contents:for(;;)switch(this.type){case tt.symbolExpressionOpenTagStart:this.next();break;case tt.symbolExpressionSymbolName:symbol=this.symbolExpression_parseString();break;case tt.symbolExpressionCloseTagStart:if(this.next(),this.eat(tt.slash)){closingTagName=this.symbolExpression_parseClosingTagName();break contents}default:this.unexpected()}return closingTagName!==openingTagName&&this.raise(node.start,"Expected corresponding closing tag for %/"+openingTagName+"%"),node.expression=`%${openingTagName}%${symbol}%/${closingTagName}%`,this.options.plugins.symbolExpression.onSymbol&&this.options.plugins.symbolExpression.onSymbol(node),this.finishNode(node,"SymbolExpression")},pp.symbolExpression_parseElement=function(){let startPos=this.start,startLoc=this.startLoc;return this.next(),this.symbolExpression_parseElementAt(startPos,startLoc)},acorn.plugins.symbolExpression=(instance,options)=>{options&&("object"!=typeof options&&(options={}),Array.isArray(options.onSymbol)&&function(){let bindings=options.onSymbol;options.onSymbol=function(binding){return bindings.push(binding)}}(),Array.isArray(options.onCallExpression)&&(()=>{let callExpressions=options.onCallExpression;options.onSymbol=expression=>callExpressions.push(expression)})(),instance.extend("parseExprAtom",(function(inner){return function(refShortHandDefaultPos){return this.type===tt.symbolExpressionSymbolName?this.parseLiteral(this.value):this.type===tt.symbolExpressionOpenTagStart?this.symbolExpression_parseElement():inner.call(this,refShortHandDefaultPos)}})),instance.extend("readToken",(function(inner){return function(code){let context=this.curContext();if(context===tc.symbolExpressionExpression)return 37===code?(++this.pos,this.finishToken(tt.symbolExpressionCloseTagStart)):this.symbolExpression_readToken();if(context===tc.symbolExpressionOpenTag||context===tc.symbolExpressionCloseTag){if(acorn.isIdentifierStart(code))return this.symbolExpression_readWord();if(37===code)return++this.pos,context===tc.symbolExpressionCloseTag?this.finishToken(tt.symbolExpressionCloseTagEnd):this.finishToken(tt.symbolExpressionOpenTagEnd)}return 37===code&&this.exprAllowed?(++this.pos,this.finishToken(tt.symbolExpressionOpenTagStart)):inner.call(this,code)}})),instance.extend("updateContext",(function(inner){return function(prevType){return inner.call(this,prevType)}})),instance.extend("finishNode",(function(inner){return function(node,type){return"CallExpression"===type&&this.options.plugins.symbolExpression.onCallExpression&&this.options.plugins.symbolExpression.onCallExpression(node),inner.call(this,node,type)}})))}}(System.acornSymbolExpressionExtension||(System.acornSymbolExpressionExtension={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Callback){Callback.callSafeCallbacks1Param=function(callbacks,thisArg,data){let callbackList=[];for(let i=0,ii=callbacks.length;i<ii;i++)callbackList.push(callbacks[i]);for(let innerCallback of callbackList)callbacks.includes(innerCallback)&&TcHmi.Callback.callSafeEx(innerCallback,thisArg,data)}}(System.Callback||(System.Callback={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.InternalSymbolManager=class{constructor(){this.__entries=new Map}add(name,item){const entryEx={callbacks:[],...item};if(this.__entries.set(name,entryEx),void 0===entryEx.value){let schema=TcHmi.Type.getSchema(item.type);schema&&(entryEx.value=TcHmi.Type.Schema.resolveDefault(schema))}const fullName=TcHmi.System.hostPrefix+"TcHmi.System.InternalSymbolManager.symbol:"+name;if(entryEx.persist){let savedValue=window.localStorage.getItem(fullName);if(null===savedValue){const legacyFullName="TCHMI_INTERNALSYMBOL_"+name;if(savedValue=window.localStorage.getItem(legacyFullName),null!==savedValue)try{window.localStorage.setItem(fullName,savedValue),window.localStorage.removeItem(legacyFullName)}catch(ex){}}if(null!==savedValue)try{entryEx.value=JSON.parse(savedValue)}catch(e){}}else window.localStorage.removeItem(fullName)}remove(name){this.__entries.delete(name)}update(name,item){let entry=this.__entries.get(name);if(!entry)return;let refresh=!1;tchmi_equal(entry.type,item.type)||(entry.type=item.type,refresh=!0);let value=item.value;if(void 0===value){let schema=TcHmi.Type.getSchema(item.type);schema&&(value=TcHmi.Type.Schema.resolveDefault(schema))}if(tchmi_equal(entry.value,value)||(entry.value=value,refresh=!0),tchmi_equal(entry.persist,item.persist)||(entry.persist=item.persist,refresh=!0),tchmi_equal(entry.readonly,item.readonly)||(entry.readonly=item.readonly,refresh=!0),refresh){let callbackList=Array.from(entry.callbacks);for(let innerCallback of callbackList)entry.callbacks.includes(innerCallback)&&TcHmi.Callback.callSafeEx(innerCallback.callback,this,{error:TcHmi.Errors.NONE,value:entry.value,destroy:innerCallback.destroy})}}write(name,value,dirtyPaths,callback){let entry=this.__entries.get(name);if(entry)if(entry.readonly)TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_READONLY,details:{code:TcHmi.Errors.E_SYMBOL_READONLY,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_READONLY],reason:"Internal symbol with name="+name+" is readonly.",domain:"TcHmi.System.InternalSymbolManager"}});else if(tchmi_equal(entry.value,value))TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE});else{null===dirtyPaths&&(dirtyPaths=void 0);let dirtyPathsNew=null;if(dirtyPaths&&dirtyPaths.length>0?dirtyPathsNew=Array.from(dirtyPaths):entry.value&&value&&"object"==typeof entry.value&&"object"==typeof value&&(dirtyPathsNew=tchmi_compare_object(entry.value,value)),entry.value=value,entry.persist)try{window.localStorage.setItem(TcHmi.System.hostPrefix+"TcHmi.System.InternalSymbolManager.symbol:"+name,JSON.stringify(entry.value))}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.InternalSymbolManager] An uncaught exception occurred:\n",e)}let callbackList=Array.from(entry.callbacks);for(let innerCallback of callbackList)entry.callbacks.includes(innerCallback)&&TcHmi.Callback.callSafeEx(innerCallback.callback,this,dirtyPathsNew&&dirtyPathsNew.length>0?{error:TcHmi.Errors.NONE,value:entry.value,dirtyPaths:dirtyPathsNew,destroy:innerCallback.destroy}:{error:TcHmi.Errors.NONE,value:entry.value,destroy:innerCallback.destroy});TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:"Internal symbol with name="+name+" does not exist.",domain:"TcHmi.System.InternalSymbolManager"}})}read(name,callback){let entry=this.__entries.get(name);entry?TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:entry.value}):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:"Internal symbol with name="+name+" does not exist.",domain:"TcHmi.System.InternalSymbolManager"}})}getType(name,callback){let entry=this.__entries.get(name);entry?TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,type:entry.type}):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:"Internal symbol with name="+name+" does not exist.",domain:"TcHmi.System.InternalSymbolManager"}})}watch(name,callback){let entry=this.__entries.get(name);if(!entry)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:"Internal symbol with name="+name+" does not exist.",domain:"TcHmi.System.InternalSymbolManager"}}),function(){};let destroy=function(){if(!entry)return;let index=entry.callbacks.indexOf(co);-1!==index&&(entry.callbacks.splice(index,1),co.callback=null),entry=void 0},co={callback:callback,destroy:destroy};return entry.callbacks.push(co),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:entry.value,destroy:destroy}),destroy}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.TemplateParamSymbolManager=class{constructor(){this.__entries=new Map}add(name,type,value){let prepValue;if(void 0===value){let schema=TcHmi.Type.getSchema(type);schema&&(prepValue=TcHmi.Type.Schema.resolveDefault(schema))}else prepValue=value;let entry={name:name,type:type,value:prepValue,callbacks:[]};this.__entries.set(name,entry)}remove(name){let entry=this.__entries.get(name);entry&&(entry.value instanceof TcHmi.System.Symbol&&entry.value.destroy(),entry.value=null,this.__entries.delete(name))}get(name){return this.__entries.get(name)}destroy(){this.__entries.forEach((entry=>{entry.value instanceof TcHmi.System.Symbol&&entry.value.destroy()})),this.__entries.clear()}keepAlive(name){let entry=this.__entries.get(name);return!!(entry&&entry.callbacks.length>0)}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(Controls){!function(System){System.baseTcHmiControl=
/**
             * Abstract base class for all TwinCAT HMI Controls.
             * Needed for handling controls in Framework APIs.
             * Check out
             * https://infosys.beckhoff.com/content/1031/te2000_tc3_hmi_engineering/3845361931.html?id=3265481440996758836
             * for an API reference.
             * @preserve (Part of the public API)
             */
class{constructor(element,pcElement,attrs){}}}(Controls.System||(Controls.System={}))}(TcHmi.Controls||(TcHmi.Controls={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.AccessManager=class{constructor(){this.__overrideRightStorage=new WeakMap,this.__isReady=!1,this.__lastUserInteraction=Date.now(),this.__lastUserInteractionSentToServer=this.__lastUserInteraction,this.__autoLogoffTimeoutID=0,this.__oldName=null,this.__subscriptionId=null,this.__reload=!0,this.__accessCache=new WeakMap,this.__handleServerResponse=data=>{let userDataChanged=!1,userChanged=!1,userInGroupChanged=!1,websocketClosed=!1;const userConfigOnServer=this.__userConfigOnServer;if(data.error===TcHmi.Errors.E_WEBSOCKET_CLOSED)userConfigOnServer.state=1,userConfigOnServer.errorMessage="Websocket was closed.",websocketClosed=!0,userChanged=!0,userDataChanged=!0,userInGroupChanged=!0;else if(data.error===TcHmi.Errors.E_WEBSOCKET_NOT_READY)userConfigOnServer.state=1,userConfigOnServer.errorMessage="Communication not ready.",userChanged=!0,userDataChanged=!0,userInGroupChanged=!0;else if(data.error===TcHmi.Errors.NONE&&data.response&&void 0!==data.response.error)userConfigOnServer.state=1,userConfigOnServer.errorMessage="Unknown Server error: "+data.response.error.message,userChanged=!0,userDataChanged=!0,userInGroupChanged=!0,data.response.error.code===TcHmi.Server.Error.HMI_E_MISSING_LICENSE_HANDSHAKE&&(!0===TCHMI_ENGINEERING?userConfigOnServer.errorMessage="Server is not licensed. Please try in a few seconds again.":userConfigOnServer.errorMessage="Server is not licensed.");else if(data.error===TcHmi.Errors.NONE&&data.response){let hasReturnedFromError=!1;1===userConfigOnServer.state&&(hasReturnedFromError=!0),0===userConfigOnServer.state&&(userConfigOnServer.state=1),userConfigOnServer.errorMessage="Got no valid answer.";let responseCommands=data.response.commands;void 0===responseCommands&&(responseCommands=[]);for(let i=0,ii=responseCommands.length;i<ii;i++){const commandGeneric=responseCommands[i];if("GetCurrentUser"===commandGeneric.symbol){let command=commandGeneric;if(void 0!==command.error){userConfigOnServer.errorMessage="Got no valid answer for "+command.symbol+". Error code: "+command.error.code,userChanged=!0,userDataChanged=!0,userInGroupChanged=!0;break}if(void 0===command.readValue){userConfigOnServer.errorMessage="Got no valid answer for "+command.symbol+".",userChanged=!0,userDataChanged=!0,userInGroupChanged=!0;break}if(userConfigOnServer.errorMessage="",void 0!==command.readValue.name&&null!==command.readValue.name&&userConfigOnServer.name!==command.readValue.name){if(4===userConfigOnServer.state&&void 0!==userConfigOnServer.name&&null!==userConfigOnServer.name&&"__SystemGuest"===command.readValue.name&&!0===this.__reload)return void window.location.reload();if(!1===this.__reload&&(this.__reload=!0),"ReadWrite"===data.response.requestType&&null!==this.__oldName&&this.__oldName!==command.readValue.name)return userConfigOnServer.state=1,TcHmi.System.Services.dialogManager.showDialog(null,!1),TcHmi.System.Services.dialogManager.updateTextEx("__AccessManager",TcHmi.System.Services.localization.getText("Connection_Recovered_Auth_Invalid",{level:TcHmi.Locale.Level.Engineering})+' <input type="submit" value="'+TcHmi.System.Services.localization.getText("Reload",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;" onclick="window.location = \'/Logout?Location='+window.location.pathname+"&Name="+encodeURIComponent(TcHmi.System.Services.accessManager.__oldName||"")+"'\">",{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!1}),void TcHmi.System.Services.dialogManager.showDialog("__AccessManager",!0,TcHmi.DialogManager.DialogType.Overlay);userChanged=!0,userDataChanged=!0,userConfigOnServer.name=command.readValue.name}if(command.readValue.autoLogoff){const parts=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/.exec(command.readValue.autoLogoff);if(null===parts)break;const years=parseInt(parts[2],10)||0,months=parseInt(parts[3],10)||0,weeks=parseInt(parts[4],10)||0,days=parseInt(parts[5],10)||0,hours=parseInt(parts[6],10)||0,minutes=parseInt(parts[7],10)||0;let newTime=1e3*((parseFloat(parts[8])||0)+60*(minutes+60*(hours+24*(days+30*months+7*weeks)+365*years)));userConfigOnServer.autoLogOffMilliSeconds!==newTime&&(userConfigOnServer.autoLogOffMilliSeconds=newTime,userDataChanged=!0,TcHmi.System.Services.accessManager.__rearmAutoLogoffTimer())}(hasReturnedFromError||void 0!==command.readValue.groups&&!tchmi_equal(userConfigOnServer.userIsInGroups.sort(),command.readValue.groups.sort()))&&(userDataChanged=!0,userInGroupChanged=!0,userConfigOnServer.userIsInGroups=command.readValue.groups??[]),void 0!==command.readValue.domain&&userConfigOnServer.domain!==command.readValue.domain&&(userDataChanged=!0,userConfigOnServer.domain=command.readValue.domain),void 0!==command.readValue.session&&userConfigOnServer.session!==command.readValue.session&&(userDataChanged=!0,userConfigOnServer.session=command.readValue.session),void 0!==command.readValue.clientCertificate&&userConfigOnServer.clientCertificate!==command.readValue.clientCertificate&&(userDataChanged=!0,userConfigOnServer.clientCertificate=command.readValue.clientCertificate),void 0!==command.readValue.clientIp&&userConfigOnServer.clientIp!==command.readValue.clientIp&&(userDataChanged=!0,userConfigOnServer.clientIp=command.readValue.clientIp);let serverLocale=command.readValue.locale;serverLocale&&"client"!==serverLocale||(serverLocale=void 0),userConfigOnServer.locale!==serverLocale&&(userConfigOnServer.locale=serverLocale),userConfigOnServer.configLocale!==command.readValue.configLocale&&(userDataChanged=!0,userConfigOnServer.configLocale=command.readValue.configLocale);let serverTimeFormatLocale=command.readValue.timeFormatLocale;serverTimeFormatLocale&&"client"!==serverTimeFormatLocale||(serverTimeFormatLocale=void 0),userConfigOnServer.timeFormatLocale!==serverTimeFormatLocale&&(userDataChanged=!0,userConfigOnServer.timeFormatLocale=serverTimeFormatLocale),userConfigOnServer.configTimeFormatLocale!==command.readValue.configTimeFormatLocale&&(userDataChanged=!0,userConfigOnServer.configTimeFormatLocale=command.readValue.configTimeFormatLocale);let serverTimezone=command.readValue.timeZone;serverTimezone&&"client"!==serverTimezone||(serverTimezone=void 0),userConfigOnServer.timeZone!==serverTimezone&&(userDataChanged=!0,userConfigOnServer.timeZone=serverTimezone),userConfigOnServer.configTimeZone!==command.readValue.configTimeZone&&(userDataChanged=!0,userConfigOnServer.configTimeZone=command.readValue.configTimeZone),TcHmi.Localization.__rebuildLocalizationCache()}else if("IsAuthRequired"===commandGeneric.symbol){let command=commandGeneric;if(void 0!==command.error){userConfigOnServer.errorMessage="Got no valid answer for "+command.symbol+". Error code: "+command.error.code;break}if(!0===command.readValue)4!==userConfigOnServer.state&&(userConfigOnServer.state=4,userConfigOnServer.errorMessage="",userDataChanged=!0);else{if(!1!==command.readValue){userConfigOnServer.state=1,userConfigOnServer.errorMessage="Got no valid answer for "+command.symbol+".",userDataChanged=!0;break}2!==userConfigOnServer.state&&(userConfigOnServer.state=2,userConfigOnServer.errorMessage="",userDataChanged=!0)}}}4===userConfigOnServer.state&&(userConfigOnServer.name?0===userConfigOnServer.userIsInGroups.length&&(userDataChanged=!0,userConfigOnServer.state=1,userConfigOnServer.errorMessage="Got no group membership but should have one."):(userDataChanged=!0,userConfigOnServer.state=1,userConfigOnServer.errorMessage="Got no user login but should have one."))}userDataChanged&&!TcHmi.System.isUnloaded&&this.__handleConfigChanged({user:userChanged,group:userInGroupChanged},websocketClosed)},this.__clearControlAccessCache=(evt,data)=>{this.__accessCache=new WeakMap},this.__updateLastUserinteraction=evt=>{this.__sendHeartbeat(),this.__lastUserInteraction=Date.now()},this.__sendHeartbeat=force=>{const dateNow=Date.now();(this.__userConfigOnServer.autoLogOffMilliSeconds&&dateNow-this.__lastUserInteractionSentToServer>this.__userConfigOnServer.autoLogOffMilliSeconds/2||force)&&(this.__lastUserInteractionSentToServer=dateNow,TcHmi.Server.requestEx({requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage"],symbol:"Heartbeat"}]},{timeout:TcHmi.System.config.tcHmiServer.websocketSystemTimeout}))},this.__logoutSent=!1,this.__logoutIfNoInteraction=()=>{if(!this.__logoutSent)return this.__userConfigOnServer.autoLogOffMilliSeconds&&Date.now()-this.__lastUserInteraction>this.__userConfigOnServer.autoLogOffMilliSeconds?(this.__logoutSent=!0,void TcHmi.Server.logoutEx2(!0,null)):void this.__rearmAutoLogoffTimer()},this.__userConfigOnServer={state:0,userIsInGroups:[],name:null,domain:null,locale:void 0,configLocale:"client",timeFormatLocale:void 0,configTimeFormatLocale:"client",timeZone:void 0,configTimeZone:void 0,autoLogOffMilliSeconds:null,session:null,clientCertificate:null,clientIp:"",errorMessage:"",defaultAuthExtension:"TcHmiUserManagement",defaultUserGroup:"__SystemUsers"},TcHmi.EventProvider.register("onWebSocketOpened",this.__onWebsocketOpen()),TcHmi.EventProvider.register("onWebSocketClosed",this.__onWebsocketClosed()),TcHmi.EventProvider.register("System.AccessConfigChanged",this.__clearControlAccessCache),TcHmi.EventProvider.register("System.ParentChanged",this.__clearControlAccessCache)}setControlRightOverride(control,accessrightToOverride,forcedRight){let controlForcedRights=this.__overrideRightStorage.get(control);controlForcedRights||(controlForcedRights=new Set,this.__overrideRightStorage.set(control,controlForcedRights)),null===forcedRight?(controlForcedRights.delete(accessrightToOverride),controlForcedRights.size||this.__overrideRightStorage.delete(control)):"Deny"===forcedRight&&controlForcedRights.add(accessrightToOverride),this.__accessCache=new WeakMap,control.__processAccessConfig()}getControlRightOverrides(control){return this.__overrideRightStorage.get(control)??new Set}__onWebsocketClosed(){return evt=>{this.unsubscribe(),this.__oldName=this.__userConfigOnServer.name,this.__userConfigOnServer={state:1,userIsInGroups:[],name:null,domain:null,locale:void 0,configLocale:"client",timeFormatLocale:void 0,configTimeFormatLocale:"client",timeZone:void 0,configTimeZone:void 0,autoLogOffMilliSeconds:null,session:null,clientCertificate:null,clientIp:"",errorMessage:"",defaultAuthExtension:"TcHmiUserManagement",defaultUserGroup:"__SystemUsers"}}}__onWebsocketOpen(){return evt=>{TcHmi.Server.readSymbol(["DefaultAuthExtension","DefaultUserGroup"],TcHmi.Server.__handleServerResponse({completed:data=>{if(data.error!==TcHmi.Errors.NONE){if(TCHMI_CONSOLE_LOG_LEVEL>=1){const details=data.details;TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.AccessManager] Internal Error. Failed to load DefaultAuthExtension and DefaultUserGroup. Using default TcHmiUserManagement and __SystemUsers: "+TcHmi.Log.buildMessage(details))}}else if(data.results)for(const res of data.results)"DefaultAuthExtension"===res.symbol&&res.value&&res.value!==this.__userConfigOnServer.defaultAuthExtension?this.__userConfigOnServer.defaultAuthExtension=res.value:"DefaultUserGroup"===res.symbol&&res.value&&res.value!==this.__userConfigOnServer.defaultUserGroup&&(this.__userConfigOnServer.defaultUserGroup=res.value);this.subscribe()}}))}}getCurrentUserConfig(){return this.__userConfigOnServer}enableReload(value){this.__reload=value}isReady(){return this.__isReady}unsubscribe(callback){if(null!==this.__subscriptionId){const oldId=this.__subscriptionId;this.__subscriptionId=null,TcHmi.Server.unsubscribe(oldId,(data=>{TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}))}else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}subscribe(callback){if(null===this.__subscriptionId){let callbackOnce=callback;this.__subscriptionId=TcHmi.Server.subscribeEx([{symbol:"IsAuthRequired"},{symbol:"GetCurrentUser"}],1e3,{timeout:TcHmi.System.config.tcHmiServer.websocketSystemTimeout},(data=>{this.__handleServerResponse(data),TcHmi.System.Services.localizationManager.processLocale(this.__userConfigOnServer.locale,{level:TcHmi.Locale.Level.Application},(data=>{let raiseReadyEvent=!this.__isReady;this.__isReady=!0,TcHmi.Callback.callSafeEx(callbackOnce,this,{error:TcHmi.Errors.NONE}),callbackOnce=void 0,raiseReadyEvent&&TcHmi.EventProvider.raise("System.onAccessManagerReady")}))}))}else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}__handleConfigChanged(changed,websocketClosed){if(this.__accessCache=new WeakMap,1===this.__userConfigOnServer.state){const oldDialogOwner=TcHmi.System.Services.dialogManager.getDialogOwner();"__TcHmiMain"!==oldDialogOwner&&"__TcHmiViewAccess"!==oldDialogOwner||TcHmi.System.Services.dialogManager.showDialog(oldDialogOwner,!1),!0!==websocketClosed&&(TcHmi.System.Services.dialogManager.updateTextEx("__AccessManager",TcHmi.System.Services.localization.getText("Loading_User_Config_Failed",{level:TcHmi.Locale.Level.Engineering})+(this.__userConfigOnServer.errorMessage?": "+this.__userConfigOnServer.errorMessage:".")+' <input type="submit" value="'+TcHmi.System.Services.localization.getText("Reload",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;" onclick="window.location = \'/Logout?Location='+window.location.pathname+"'\">",{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!1}),TcHmi.System.Services.dialogManager.showDialog("__AccessManager",!0,TcHmi.DialogManager.DialogType.Overlay)),TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.AccessManager] Internal Error. Loading User Login Config from Server failed"+(this.__userConfigOnServer.errorMessage?": "+this.__userConfigOnServer.errorMessage:"."))}if(changed.group){2!==this.__userConfigOnServer.state&&4!==this.__userConfigOnServer.state||TcHmi.EventProvider.raise("onUserInGroupChanged",this.__userConfigOnServer.userIsInGroups);const currentView=TcHmi.System.Services.viewManager.getView();null!==currentView&&currentView.__processAccessConfig()}changed.user&&TcHmi.EventProvider.raise("onUserChanged",this.__userConfigOnServer.name),TcHmi.EventProvider.raise("onUserDataChanged",this.__userConfigOnServer)}checkAccess(control,requestedAccessright){if(!0===TCHMI_DESIGNER)return!0;if(2===this.__userConfigOnServer.state)return!0;if(this.__userConfigOnServer.userIsInGroups.includes("__SystemAdministrators"))return!0;if(1===this.__userConfigOnServer.state)return!1;if(0===this.__userConfigOnServer.state)return null;let accessCacheControlEntry=this.__accessCache.get(control);if(accessCacheControlEntry){const accessCacheAccessrightEntry=accessCacheControlEntry.get(requestedAccessright);if(void 0!==accessCacheAccessrightEntry)return accessCacheAccessrightEntry}else accessCacheControlEntry=new Map,this.__accessCache.set(control,accessCacheControlEntry);if(this.getControlRightOverrides(control).has(requestedAccessright))return accessCacheControlEntry.set(requestedAccessright,!1),!1;let defaultValueInternal=null,mappedAccessRight=requestedAccessright,recursiveControl=control;do{let foundDeny=!1;const recursiveControlType=recursiveControl.getType();let recursiveAccessDefinition=TcHmi.System.Services.controlManager.getDescriptionAccessByName(recursiveControlType,mappedAccessRight);if(recursiveAccessDefinition?.dependsOn?.length)for(const dependingRight of recursiveAccessDefinition.dependsOn)if(dependingRight&&"string"==typeof dependingRight){const dependingResult=this.checkAccess(recursiveControl,dependingRight);if(!1===dependingResult)return accessCacheControlEntry.set(requestedAccessright,!1),!1;if(null===dependingResult)return dependingResult}const recursiveCtrlAccessConfig=recursiveControl.getAccessConfig();for(const AccessRightsEntry of recursiveCtrlAccessConfig)if(AccessRightsEntry.accessright===mappedAccessRight&&this.__userConfigOnServer.userIsInGroups.includes(AccessRightsEntry.group)){if("Allow"===AccessRightsEntry.permission)return accessCacheControlEntry.set(requestedAccessright,!0),!0;if("Deny"===AccessRightsEntry.permission)foundDeny=!0;else if("Inherit"!==AccessRightsEntry.permission)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.AccessManager] Access check failed on control "+control.getId()+": Invalid config found! Access rejected!"),!1}if(!0===foundDeny)return accessCacheControlEntry.set(requestedAccessright,!1),!1;null===recursiveAccessDefinition&&"function"==typeof recursiveControl.getDescriptionAccessByName&&(recursiveAccessDefinition=recursiveControl.getDescriptionAccessByName(mappedAccessRight)),"boolean"==typeof recursiveAccessDefinition?.defaultValueInternal&&(defaultValueInternal=recursiveAccessDefinition.defaultValueInternal);const parentCtrl=recursiveControl.getParent();if(!parentCtrl){if("TcHmi.Controls.System.TcHmiView"===recursiveControlType){recursiveControl=null;break}if(recursiveControl.getElement()?.[0].classList.contains("tchmi-in-topmostlayer")){if(recursiveControl=null,null===defaultValueInternal){const viewAccessDefinition=TcHmi.System.Services.controlManager.getDescriptionAccessByName("TcHmi.Controls.System.TcHmiView",mappedAccessRight);"boolean"==typeof viewAccessDefinition?.defaultValueInternal&&(defaultValueInternal=viewAccessDefinition.defaultValueInternal)}break}return null}{let virtualControlRightMapping=recursiveControl.getVirtualControlRightMappings();if(!Array.isArray(virtualControlRightMapping)||!Array.isArray(recursiveCtrlAccessConfig))return!1;for(let virtualControlRightMap of virtualControlRightMapping)if(virtualControlRightMap.controlRight===mappedAccessRight){mappedAccessRight=virtualControlRightMap.virtualControlRight;break}recursiveControl=parentCtrl}}while(null!==recursiveControl);return accessCacheControlEntry.set(requestedAccessright,defaultValueInternal),defaultValueInternal}__rearmAutoLogoffTimer(){if(4!==this.__userConfigOnServer.state||null===this.__userConfigOnServer.autoLogOffMilliSeconds||0===this.__userConfigOnServer.autoLogOffMilliSeconds)return;window.clearTimeout(this.__autoLogoffTimeoutID);const passiveEventOptions={passive:!0,capture:!0};document.removeEventListener("keydown",this.__updateLastUserinteraction,passiveEventOptions),document.removeEventListener("mousemove",this.__updateLastUserinteraction,passiveEventOptions),document.removeEventListener("mousedown",this.__updateLastUserinteraction,passiveEventOptions),document.removeEventListener("touchstart",this.__updateLastUserinteraction,passiveEventOptions),document.removeEventListener("visibilitychange",this.__updateLastUserinteraction,passiveEventOptions),document.addEventListener("keydown",this.__updateLastUserinteraction,passiveEventOptions),document.addEventListener("mousemove",this.__updateLastUserinteraction,passiveEventOptions),document.addEventListener("mousedown",this.__updateLastUserinteraction,passiveEventOptions),document.addEventListener("touchstart",this.__updateLastUserinteraction,passiveEventOptions),document.addEventListener("visibilitychange",this.__updateLastUserinteraction,passiveEventOptions);let newDelay=this.__lastUserInteraction+this.__userConfigOnServer.autoLogOffMilliSeconds-Date.now();newDelay<0?this.__logoutIfNoInteraction():(newDelay>2147483647&&(newDelay=2147483647),this.__autoLogoffTimeoutID=window.setTimeout(this.__logoutIfNoInteraction,newDelay))}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.AnimationProvider=class{constructor(){}createAnimationController(animation,statusChangeCallback){return animation.useCss()?new CssAnimationController(animation,statusChangeCallback):new JavaScriptAnimationController(animation,statusChangeCallback)}};class CssAnimationController{constructor(animation,statusChangeCallback){this.__hasStarted=!1,this.__animation=animation,this.__statusChangeCallback=statusChangeCallback,this.__styleManager=System.Services.styleManager}isValid(){return this.__animation.useCss()}run(){let doRun=()=>{if(TcHmi.Controls.get(this.__animation.controlName()))if(this.__animation.state()===TcHmi.Animation.Status.CONFIGURE||this.__animation.state()===TcHmi.Animation.Status.INITIALIZED){this.__statusChangeCallback(TcHmi.Animation.Status.INITIALIZED);const animName=this.__animation.animationName();this.__getElement().on("animationstart."+animName+".animationcontrol",this.__onAnimationStart()).on("animationiteration."+animName+".animationcontrol",this.__onAnimationIteration()).on("animationend."+animName+".animationcontrol",this.__onAnimationEnd()),this.__writeAnimationToCss()}else this.__animation.state()===TcHmi.Animation.Status.PAUSED&&(this.__setPlayState("running"),this.__hasStarted?this.__statusChangeCallback(TcHmi.Animation.Status.RUNNING):this.__statusChangeCallback(TcHmi.Animation.Status.INITIALIZED))};this.__animation.state()===TcHmi.Animation.Status.ENDED?(this.reset(doRun),this.__statusChangeCallback(TcHmi.Animation.Status.INITIALIZED)):doRun()}pause(){this.__animation.state()!==TcHmi.Animation.Status.RUNNING&&this.__animation.state()!==TcHmi.Animation.Status.INITIALIZED||(this.__setPlayState("paused"),this.__statusChangeCallback(TcHmi.Animation.Status.PAUSED))}skip(){this.cleanup(!0),this.__statusChangeCallback(TcHmi.Animation.Status.ENDED),this.__getElement().off("animationstart."+this.__animation.animationName()+".animationcontrol").off("animationiteration."+this.__animation.animationName()+".animationcontrol").off("animationend."+this.__animation.animationName()+".animationcontrol")}reset(callback){let selector=this.__styleManager.expandSelector(this.__animation.selector(),this.__animation.controlName()),styles=this.__styleManager.getExistingStyleOverwrites(this.__animation.controlName());if(void 0===styles[selector]||void 0===styles[selector]["animation-name"])return void requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.__statusChangeCallback(TcHmi.Animation.Status.CONFIGURE),"function"==typeof callback&&callback()}))}));let animationIndex=styles[selector]["animation-name"][0].split(",").map((function(n){return n.trim()})).indexOf(this.__animation.animationName());if(-1!==animationIndex){for(let i=0,ii=styles[selector]["animation-name"].length;i<ii;i++){let animPropertyArray=styles[selector]["animation-name"][i].split(",").map((function(n){return n.trim()}));animPropertyArray.splice(animationIndex,1,"reset"),styles[selector]["animation-name"][i]=animPropertyArray.join(", ")}for(let i=0,ii=styles[selector]["animation-play-state"].length;i<ii;i++){let animPropertyArray=styles[selector]["animation-play-state"][i].split(",").map((function(n){return n.trim()}));animPropertyArray.splice(animationIndex,1,"paused"),styles[selector]["animation-play-state"][i]=animPropertyArray.join(", ")}this.__styleManager.writeStyles(this.__animation.controlName(),styles),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(void 0!==TcHmi.Controls.get(this.__animation.controlName())){for(let i=0,ii=styles[selector]["animation-name"].length;i<ii;i++){let animPropertyArray=styles[selector]["animation-name"][i].split(",").map((function(n){return n.trim()}));animPropertyArray.splice(animationIndex,1,this.__animation.animationName()),styles[selector]["animation-name"][i]=animPropertyArray.join(", ")}this.__styleManager.writeStyles(this.__animation.controlName(),styles),this.__statusChangeCallback(TcHmi.Animation.Status.CONFIGURE)}"function"==typeof callback&&callback()}))})),this.__hasStarted=!1}else requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.__statusChangeCallback(TcHmi.Animation.Status.CONFIGURE),"function"==typeof callback&&callback()}))}))}cleanup(skip=!1){let progressPoint=null;if("forwards"===this.__animation.fillMode()||"both"===this.__animation.fillMode()||skip)switch(this.__animation.direction()){case"normal":progressPoint=1;break;case"reverse":progressPoint=0;break;case"alternate":progressPoint=this.__animation.iterationCount()%2==0?0:1;break;case"alternate-reverse":progressPoint=this.__animation.iterationCount()%2==0?1:0}let selector=this.__styleManager.expandSelector(this.__animation.selector(),this.__animation.controlName()),styles=this.__styleManager.getExistingStyleOverwrites(this.__animation.controlName());if(void 0===styles[selector]||void 0===styles[selector]["animation-name"])return;let animationIndex=styles[selector]["animation-name"][0].split(",").map((function(n){return n.trim()})).indexOf(this.__animation.animationName());if(-1!==animationIndex&&(deleteAnimationProperty("animation-name"),deleteAnimationProperty("animation-duration"),deleteAnimationProperty("animation-delay"),deleteAnimationProperty("animation-iteration-count"),deleteAnimationProperty("animation-direction"),deleteAnimationProperty("animation-timing-function"),deleteAnimationProperty("animation-fill-mode"),deleteAnimationProperty("animation-play-state"),delete styles[`@keyframes ${this.__animation.animationName()}`],this.__styleManager.writeStyles(this.__animation.controlName(),styles),null!==progressPoint)){let keyframes=this.__animation.keyframes().filter((keyframe=>keyframe.progressPoint===progressPoint));if(0===keyframes.length)return;let newStyles=keyframes[0].styles;TcHmi.StyleProvider.setSimpleElementStyle(this.__getElement(),newStyles)}function deleteAnimationProperty(property){if(void 0!==styles[selector][property])for(let i=0,ii=styles[selector][property].length;i<ii;i++){let animPropertyArray=styles[selector][property][i].split(",").map((function(n){return n.trim()}));animPropertyArray.splice(animationIndex,1),styles[selector][property][i]=animPropertyArray.join(", ")}}}__writeAnimationToCss(run=!0){let selector=this.__styleManager.expandSelector(this.__animation.selector(),this.__animation.controlName()),styles=this.__styleManager.getExistingStyleOverwrites(this.__animation.controlName());void 0===styles[selector]&&(styles[selector]={});let animationIndex=-1;if(void 0!==styles[selector]["animation-name"]){let names=styles[selector]["animation-name"][0].split(",").map((function(n){return n.trim()}));animationIndex=names.indexOf(this.__animation.animationName())}function insertAnimationProperty(property,value){if(void 0===styles[selector][property])styles[selector][property]=[value];else for(let i=0,ii=styles[selector][property].length;i<ii;i++){let animPropertyArray=splitOutsideOfBraces(styles[selector][property][i],",").map((function(n){return n.trim()}));-1===animationIndex?animPropertyArray.push(value):animPropertyArray.splice(animationIndex,1,value),styles[selector][property][i]=animPropertyArray.join(", ")}}function splitOutsideOfBraces(value,token){let startindex=0,braceCounter=0,res=[];for(let i=0,ii=value.length;i<ii;i++)switch(value.charAt(i)){case"(":braceCounter++;break;case")":braceCounter>0&&braceCounter--;break;case token:0===braceCounter&&i>startindex&&res.push(value.substring(startindex,i).trim()),startindex=i+1}return(0===value.length||startindex<value.length)&&res.push(value.substring(startindex).trim()),res}insertAnimationProperty("animation-name",this.__animation.animationName()),insertAnimationProperty("animation-duration",this.__animation.duration()+"ms"),insertAnimationProperty("animation-delay",this.__animation.delay()+"ms"),insertAnimationProperty("animation-iteration-count",this.__animation.iterationCount().toString()),insertAnimationProperty("animation-direction",this.__animation.direction()),insertAnimationProperty("animation-timing-function",this.__animation.timingFunction()),insertAnimationProperty("animation-fill-mode",this.__animation.fillMode()),insertAnimationProperty("animation-play-state",run?"running":"paused");let cssKeyframes={},keyframes=this.__animation.keyframes();for(let i=0,ii=keyframes.length;i<ii;i++)cssKeyframes[100*keyframes[i].progressPoint+"%"]=keyframes[i].styles;styles[`@keyframes ${this.__animation.animationName()}`]=cssKeyframes,this.__styleManager.writeStyles(this.__animation.controlName(),styles)}__setPlayState(playState){let selector=this.__styleManager.expandSelector(this.__animation.selector(),this.__animation.controlName()),styles=this.__styleManager.getExistingStyleOverwrites(this.__animation.controlName());if(void 0===styles[selector]["animation-name"])return;let animationIndex=styles[selector]["animation-name"][0].split(",").map((function(n){return n.trim()})).indexOf(this.__animation.animationName());if(-1!==animationIndex){for(let i=0,ii=styles[selector]["animation-play-state"].length;i<ii;i++){let animPropertyArray=styles[selector]["animation-play-state"][i].split(",").map((function(n){return n.trim()}));animPropertyArray.splice(animationIndex,1,playState),styles[selector]["animation-play-state"][i]=animPropertyArray.join(", ")}this.__styleManager.writeStyles(this.__animation.controlName(),styles)}}__onAnimationStart(){return event=>{const animationEvent=event.originalEvent;animationEvent.animationName===this.__animation.animationName()&&(this.__statusChangeCallback(TcHmi.Animation.Status.RUNNING),this.__animation.eventHandlers().filter((handler=>"animationstart"===handler.name)).forEach((handler=>handler.callback({error:TcHmi.Errors.NONE,animationName:animationEvent.animationName,elapsedTime:animationEvent.elapsedTime,JQueryEvent:event}))))}}__onAnimationIteration(){return event=>{const animationEvent=event.originalEvent;animationEvent.animationName===this.__animation.animationName()&&this.__animation.eventHandlers().filter((handler=>"animationiteration"===handler.name)).forEach((handler=>handler.callback({error:TcHmi.Errors.NONE,animationName:animationEvent.animationName,elapsedTime:animationEvent.elapsedTime,JQueryEvent:event})))}}__onAnimationEnd(){return event=>{const animationEvent=event.originalEvent;animationEvent.animationName===this.__animation.animationName()&&(this.__statusChangeCallback(TcHmi.Animation.Status.ENDED),this.__getElement().off("animationstart."+this.__animation.animationName()+".animationcontrol").off("animationiteration."+this.__animation.animationName()+".animationcontrol").off("animationend."+this.__animation.animationName()+".animationcontrol"),this.__animation.cleanup()&&this.cleanup(),this.__animation.eventHandlers().filter((handler=>"animationend"===handler.name)).forEach((handler=>handler.callback({error:TcHmi.Errors.NONE,animationName:animationEvent.animationName,elapsedTime:animationEvent.elapsedTime,JQueryEvent:event}))))}}__getElement(){return $(this.__styleManager.expandSelector(this.__animation.selector(),this.__animation.controlName()))}}System.CssAnimationController=CssAnimationController;class JavaScriptAnimationController{constructor(animation,statusChangeCallback){this.__animatedStyles={},this.__initialStyles={},this.__animationFrameID=null,this.__start=null,this.__started=0,this.__iteration=0,this.__elapsedTime=0,this.__resetToInitial=!0,this.__delayTimer=null,this.__animation=animation,this.__statusChangeCallback=statusChangeCallback,this.__element=$(System.Services.styleManager.expandSelector(this.__animation.selector(),this.__animation.controlName()))}isValid(){return!this.__animation.useCss()}run(){if(this.__animation.state()===TcHmi.Animation.Status.CONFIGURE||this.__animation.state()===TcHmi.Animation.Status.ENDED){this.__animationRunner=this.__getAnimationRunner(),this.__iteration=0,this.__start=null,this.__elapsedTime=0,this.__resetToInitial=!0,this.__animation.delay()>0?this.__delayTimer=new Timer((()=>{this.__animationRunner&&(this.__animationFrameID=window.requestAnimationFrame(this.__animationRunner),this.__delayTimer=null)}),this.__animation.delay()):this.__animationFrameID=window.requestAnimationFrame(this.__animationRunner),this.__statusChangeCallback(TcHmi.Animation.Status.INITIALIZED),this.__animatedStyles={};let keyframes=this.__animation.keyframes();for(let i=0,ii=keyframes.length;i<ii;i++)for(let key in keyframes[i].styles)keyframes[i].styles.hasOwnProperty(key)&&(void 0===this.__animatedStyles[key]&&(this.__animatedStyles[key]=[]),this.__animatedStyles[key].push({progressPoint:keyframes[i].progressPoint,values:keyframes[i].styles[key].map((value=>this.__parseKeyframeStyle(value)))}));let initialStyles=TcHmi.StyleProvider.getSimpleElementStyle(this.__element);this.__initialStyles={};for(let key in this.__animatedStyles)if(this.__animatedStyles.hasOwnProperty(key)){if(this.__animatedStyles[key].sort(((a,b)=>a.progressPoint-b.progressPoint)),0!==this.__animatedStyles[key][0].progressPoint||1!==this.__animatedStyles[key][this.__animatedStyles[key].length-1].progressPoint)throw new Error("Start and end keyframes with progress points 0 and 1 must be defined for all animated properties.");this.__initialStyles[key]=initialStyles&&void 0!==initialStyles[key]?initialStyles[key]:null}let fillMode=this.__animation.fillMode();if("backwards"===fillMode||"both"===fillMode)switch(this.__animation.direction()){case"normal":case"alternate":TcHmi.StyleProvider.setSimpleElementStyle(this.__element,keyframes.filter((keyframe=>0===keyframe.progressPoint))[0].styles);break;case"reverse":case"alternate-reverse":TcHmi.StyleProvider.setSimpleElementStyle(this.__element,keyframes.filter((keyframe=>1===keyframe.progressPoint))[0].styles)}}else this.__animation.state()===TcHmi.Animation.Status.PAUSED&&(null!==this.__delayTimer?this.__delayTimer.resume():this.__animationRunner&&(this.__animationFrameID=window.requestAnimationFrame(this.__animationRunner)))}pause(){this.__animation.state()===TcHmi.Animation.Status.RUNNING?(null!==this.__animationFrameID&&window.cancelAnimationFrame(this.__animationFrameID),this.__statusChangeCallback(TcHmi.Animation.Status.PAUSED)):this.__animation.state()===TcHmi.Animation.Status.INITIALIZED&&null!==this.__delayTimer&&(this.__delayTimer.pause(),this.__statusChangeCallback(TcHmi.Animation.Status.PAUSED))}skip(){this.__animation.state()!==TcHmi.Animation.Status.ENDED&&(null!==this.__animationFrameID&&window.cancelAnimationFrame(this.__animationFrameID),this.cleanup(!0),this.__statusChangeCallback(TcHmi.Animation.Status.ENDED))}reset(callback){if(this.__resetToInitial&&this.__animation.state()!==TcHmi.Animation.Status.CONFIGURE)for(let key in this.__initialStyles)this.__initialStyles.hasOwnProperty(key)&&TcHmi.StyleProvider.setSimpleElementStyle(this.__element,key,this.__initialStyles[key]);this.__statusChangeCallback(TcHmi.Animation.Status.CONFIGURE),"function"==typeof callback&&callback()}cleanup(skip=!1){let progressPoint=null;if("forwards"===this.__animation.fillMode()||"both"===this.__animation.fillMode()||skip)switch(this.__animation.direction()){case"normal":progressPoint=1;break;case"reverse":progressPoint=0;break;case"alternate":progressPoint=this.__animation.iterationCount()%2==0?0:1;break;case"alternate-reverse":progressPoint=this.__animation.iterationCount()%2==0?1:0}null===progressPoint?TcHmi.StyleProvider.setSimpleElementStyle(this.__element,this.__initialStyles):TcHmi.StyleProvider.setSimpleElementStyle(this.__element,this.__animation.keyframes().filter((keyframe=>keyframe.progressPoint===progressPoint))[0].styles)}__parseKeyframeStyle(value){let numberAndUnitMatch=/^(-?\d*\.?\d+)(?:%|px)?$/.exec(value);if(null!==numberAndUnitMatch)return[parseFloat(numberAndUnitMatch[1]),value.substring(numberAndUnitMatch[1].length)];let parsed=[],hexColorRegEx=/#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3}/g,hexColorMatch=hexColorRegEx.exec(value);for(;null!==hexColorMatch;){let hexString=hexColorMatch[0].slice(1);parsed.push({value:Color.fromHexString(hexString),replaceIndex:hexColorMatch.index,replaceLength:hexColorMatch[0].length}),hexColorMatch=hexColorRegEx.exec(value)}let rgbaColorRegEx=/rgba?\( *(-?\d+) *, *(-?\d+) *, *(-?\d+) *(?:, *(-?\d*\.?\d+) *)?\)/g,rgbaColorMatch=rgbaColorRegEx.exec(value);for(;null!==rgbaColorMatch;){let r=parseInt(rgbaColorMatch[1],10),g=parseInt(rgbaColorMatch[2],10),b=parseInt(rgbaColorMatch[3],10),a=rgbaColorMatch[4]?parseFloat(rgbaColorMatch[4]):1;parsed.push({value:Color.fromRgb(r,g,b,a),replaceIndex:rgbaColorMatch.index,replaceLength:rgbaColorMatch[0].length}),rgbaColorMatch=rgbaColorRegEx.exec(value)}let hslaColorRegEx=/hsla?\( *(-?\d*\.?\d+) *, *(-?\d*\.?\d+)% *, *(-?\d*\.?\d+)% *(?:, *(-?\d*\.?\d+) *)?\)/g,hslaColorMatch=hslaColorRegEx.exec(value);for(;null!==hslaColorMatch;){let h=parseFloat(hslaColorMatch[1]),s=parseFloat(hslaColorMatch[2])/100,l=parseFloat(hslaColorMatch[3])/100,a=hslaColorMatch[4]?parseFloat(hslaColorMatch[4]):1;parsed.push({value:Color.fromHsl(h,s,l,a),replaceIndex:hslaColorMatch.index,replaceLength:hslaColorMatch[0].length}),hslaColorMatch=hslaColorRegEx.exec(value)}let res=[];if(parsed.length>0){parsed.sort(((a,b)=>a.replaceIndex-b.replaceIndex));for(let i=parsed.length-1,ii=0;i>=ii;i--){let start=parsed[i].replaceIndex+parsed[i].replaceLength,end=i<parsed.length-1?parsed[i+1].replaceIndex:void 0;start!==end&&start<value.length&&res.unshift(value.substring(start,end)),res.unshift(parsed[i].value)}parsed[0].replaceIndex>0&&res.unshift(value.substring(0,parsed[0].replaceIndex-1))}else res.push(value);let numberRegex=/-?\d*\.?\d+/;for(let i=0,ii=res.length;i<ii;i++){let item=res[i];if("string"==typeof item){let numberMatch=numberRegex.exec(item);if(null!==numberMatch){let replace=[],iIncrement=0;numberMatch.index>0&&(replace.push(item.substring(0,numberMatch.index)),ii++,iIncrement++),replace.push(parseFloat(numberMatch[0])),numberMatch.index+numberMatch[0].length<item.length&&(replace.push(item.substring(numberMatch.index+numberMatch[0].length)),ii++),res.splice(i,1,...replace),i+=iIncrement}}}return res}__getTimingFunction(){let tf=this.__animation.timingFunction();if("function"==typeof tf)return tf;function createCubicBezier(x1,y1,x2,y2){let points=[{x:0,y:0},{x:x1,y:y1},{x:x2,y:y2},{x:1,y:1}];return x=>{function reduce(points,t){let reduced=[];for(let i=0;i<points.length-1;i++){let x=points[i].x+(points[i+1].x-points[i].x)*t,y=points[i].y+(points[i+1].y-points[i].y)*t;reduced.push({x:x,y:y})}return 1===reduced.length?reduced[0]:reduce(reduced,t)}let point={x:0,y:0},t=.5,lowerBound=0,upperBound=1;for(let i=0;i<10;i++){if(point=reduce(points,t),Math.abs(point.x-x)<5e-4)return point.y;point.x<x?lowerBound=t:upperBound=t,t=lowerBound+(upperBound-lowerBound)/2}return point.y}}function createSteps(count,startLeft){let step=1/count;return t=>startLeft?Math.ceil(t/step)*step:Math.floor(t/step)*step}switch(tf){case"linear":return t=>t;case"ease":return createCubicBezier(.25,.1,.25,1);case"ease-in":return createCubicBezier(.42,0,1,1);case"ease-out":return createCubicBezier(0,0,.58,1);case"ease-in-out":return createCubicBezier(.42,0,.58,1);case"step-start":return createSteps(1,!0);case"step-end":return createSteps(1,!1);default:let bezierMatch=/cubic-bezier\( *(1(?:.0+)?|0|0?\.\d+) *, *(-?\d*\.?\d+) *, *(1(?:.0+)?|0|0?\.\d+) *, *(-?\d*\.?\d+) *\)/.exec(tf);if(null!==bezierMatch)return createCubicBezier(parseFloat(bezierMatch[1]),parseFloat(bezierMatch[2]),parseFloat(bezierMatch[3]),parseFloat(bezierMatch[4]));let stepMatch=/steps\( *([1-9][0-9]*) *(?:, *(start|end) *)?\)/.exec(tf);if(null!==stepMatch)return createSteps(parseInt(stepMatch[1],10),"start"===stepMatch[2])}return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(`[Source=Framework, Module=TcHmi.System.AnimationProvider] Unknown timing function ${tf}.`),createCubicBezier(.25,.1,.25,1)}__getAnimationRunner(){let directionFunction,duration=this.__animation.duration(),timingFunction=this.__getTimingFunction();switch(this.__animation.direction()){case"normal":directionFunction=progress=>progress;break;case"reverse":directionFunction=progress=>1-progress;break;case"alternate":directionFunction=progress=>this.__iteration%2==0?progress:1-progress;break;case"alternate-reverse":directionFunction=progress=>this.__iteration%2==0?1-progress:progress}let doRun=timestamp=>{if(null===this.__start)this.__started=this.__start=timestamp,this.__statusChangeCallback(TcHmi.Animation.Status.RUNNING),this.__animation.eventHandlers().filter((handler=>"animationstart"===handler.name)).forEach((handler=>handler.callback({error:TcHmi.Errors.NONE,animationName:this.__animation.animationName(),elapsedTime:0})));else if(this.__animation.state()===TcHmi.Animation.Status.PAUSED){let pausedTime=timestamp-this.__elapsedTime-this.__start;this.__start+=pausedTime,this.__started+=pausedTime,this.__statusChangeCallback(TcHmi.Animation.Status.RUNNING)}this.__elapsedTime=timestamp-this.__start;let progress=this.__elapsedTime/duration;progress=directionFunction(progress);let styles={};for(let key in this.__animatedStyles)if(this.__animatedStyles.hasOwnProperty(key)){let keyframes=this.__getBorderingKeyframes(key,progress);if(1===keyframes.length)styles[key]=keyframes[0].values.map((value=>value.join("")));else{let interFrameProgress=(progress-keyframes[0].progressPoint)/(keyframes[1].progressPoint-keyframes[0].progressPoint);styles[key]=this.__interpolate(keyframes[0].values,keyframes[1].values,timingFunction(interFrameProgress))}}try{TcHmi.StyleProvider.setSimpleElementStyle(this.__element,styles)}catch(ex){return void this.__statusChangeCallback(TcHmi.Animation.Status.PAUSED)}if(progress>=0&&progress<=1)this.__animationFrameID=window.requestAnimationFrame(doRun);else{this.__iteration++;let iterationCount=this.__animation.iterationCount();"infinite"===iterationCount||this.__iteration<iterationCount?(this.__start=timestamp,this.__animationFrameID=window.requestAnimationFrame(doRun),this.__animation.eventHandlers().filter((handler=>"animationiteration"===handler.name)).forEach((handler=>handler.callback({error:TcHmi.Errors.NONE,animationName:this.__animation.animationName(),elapsedTime:(timestamp-this.__started)/1e3})))):(this.__animationFrameID=null,this.__statusChangeCallback(TcHmi.Animation.Status.ENDED),this.__animation.cleanup()&&(this.__resetToInitial=!1),this.cleanup(),this.__animation.eventHandlers().filter((handler=>"animationend"===handler.name)).forEach((handler=>handler.callback({error:TcHmi.Errors.NONE,animationName:this.__animation.animationName(),elapsedTime:(timestamp-this.__started)/1e3}))))}};return doRun}__getBorderingKeyframes(style,progress){let styles=this.__animatedStyles[style];for(let i=0,ii=styles.length;i<ii;i++){if(styles[i].progressPoint===progress)return[styles[i]];if(styles[i].progressPoint>progress)return i<1?[styles[i]]:[styles[i-1],styles[i]]}return[styles[styles.length-1]]}__interpolate(start,end,progress){let res=[];function numInterpolate(start,end){return start+(end-start)*progress}for(let i=0,ii=Math.min(start.length,end.length);i<ii;i++){let interpolated=[];for(let j=0,jj=Math.max(start[i].length,end[i].length);j<jj;j++){let startValue=start[i][j],endValue=end[i][j],startType=typeof startValue,endType=typeof endValue;if(void 0===startValue){switch(endType){case"string":startValue=endValue;break;case"number":startValue=0;break;case"object":startValue=Color.fromRgb(0,0,0,0)}startType=endType}if(void 0===endValue){switch(startType){case"string":endValue=startValue;break;case"number":endValue=0;break;case"object":endValue=Color.fromRgb(0,0,0,0)}endType=startType}if(startType!==endType||"string"===startType)interpolated.push(progress<.5?startValue:endValue);else switch(startType){case"number":interpolated.push(numInterpolate(startValue,endValue));break;case"object":interpolated.push(Color.fromRgb(numInterpolate(startValue.red,endValue.red),numInterpolate(startValue.green,endValue.green),numInterpolate(startValue.blue,endValue.blue),numInterpolate(startValue.alpha,endValue.alpha)))}}res.push(interpolated.join(""))}return res}}System.JavaScriptAnimationController=JavaScriptAnimationController;class Timer{constructor(callback,delay){this.__timerId=0,this.__start=0,this.__callback=callback,this.__remaining=delay,this.resume()}pause(){window.clearTimeout(this.__timerId),this.__remaining-=Date.now()-this.__start}resume(){this.__start=Date.now(),window.clearTimeout(this.__timerId),this.__timerId=window.setTimeout(this.__callback,this.__remaining)}}class Color{constructor(red,green,blue,alpha){function clamp(num,min,max){return num<=min?min:num>=max?max:num}this.red=Math.round(clamp(red,0,255)),this.green=Math.round(clamp(green,0,255)),this.blue=Math.round(clamp(blue,0,255)),this.alpha=clamp(alpha,0,1)}static fromRgb(r,g,b,a=1){return new Color(r,g,b,a)}static fromHsl(h,s,l,a=1){function clamp(num,min,max){return num<=min?min:num>=max?max:num}let r,g,b;if(h=clamp(h%360/360,0,1),s=clamp(s,0,1),l=clamp(l,0,1),0===s)r=g=b=l;else{let hue2rgb=(p,q,t)=>(t<0&&(t+=1),t>1&&(t-=1),t<1/6?p+6*(q-p)*t:t<.5?q:t<2/3?p+(q-p)*(2/3-t)*6:p),q=l<.5?l*(1+s):l+s-l*s,p=2*l-q;r=hue2rgb(p,q,h+1/3),g=hue2rgb(p,q,h),b=hue2rgb(p,q,h-1/3)}return new Color(255*r,255*g,255*b,a)}static fromHexString(hex){return 3===hex.length&&(hex=hex.replace(/./g,"$&$&")),new Color(parseInt(hex.substr(0,2),16),parseInt(hex.substr(2,2),16),parseInt(hex.substr(4,2),16),1)}toString(){return`rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){class Binding{static __compareTiming(a,b){return null===TcHmi.Server.getApiVersion()?TcHmi.System.compareISO8601ServerCommandDateTimeStrings(a,b):TcHmi.System.compareISO8601ServerCommandDurationStrings(a,b)}constructor(expression,propertyName,control){if(this.__diagGUID="",this.__stateOld=Binding.State.Invalid,this.__destroyWatch=null,this.__destroyRead=null,this.__destroyHostPreloadingBindingsWatch=null,this.__lockWriteToControl=!1,this.__lockWatchError=!1,this.__lockLastWriteError=!1,this.__pendingWriteCount=0,this.__latestWrite=!1,this.__forwardWriteToSymbolResponse=!1,this.__pendingForceReadRequestId=null,this.__resumeLock=!1,this.__resumeStage=0,this.__resume=forcePreload=>{if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume called."),!TcHmi.System.isPreloaded&&!forcePreload)return void TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume aborted. System is not preloaded and forced preload is not set.");if(this.__resumeLock)return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume aborted. Pending lock."));if(!this.__control)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Binding, Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume aborted. Binding is already destroyed."));if(!this.__symbol)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Binding, Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume aborted. Binding is already destroyed."));let processSymbolReference=()=>{if(this.__symbol&&"TcHmi.Symbol"===this.__attrSchema?.frameworkInstanceOf){if(this.__state===Binding.State.Initializing||this.__state===Binding.State.Preloading||this.__state===Binding.State.Resuming&&this.__stateOld!==Binding.State.Initialized){let preload=!1;this.__attr.allowSymbolReferencePreloading&&this.__preload&&!TcHmi.System.isPreloaded&&(preload=!0);let ref=new TcHmi.Symbol(this.__expression),referenceDelegation=ref.getReferenceDelegation();this.__writeToControl(ref),preload&&referenceDelegation&&referenceDelegation.preload&&referenceDelegation.preload((()=>{this.__stateOld=this.__state,this.__state=Binding.State.Initialized,this.__procWatchState()}))}return this.__stateOld=this.__state,this.__attr.allowSymbolReferencePreloading&&this.__preload&&!TcHmi.System.isPreloaded?this.__state=Binding.State.Preloading:this.__state===Binding.State.Preloading?this.__state=Binding.State.Initialized:(this.__state===Binding.State.Initializing||this.__state===Binding.State.Resuming)&&(this.__state=Binding.State.Ready),this.__procWatchState(),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume finished."),!0}return!1};if(0===this.__resumeStage){if(this.__attr?.allowEarlySymbolReferenceInjection&&processSymbolReference())return;if(!this.__control.getIsInitialized())return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume aborted. Control is not initialized."));let isAttached=this.__control.getIsAttached();if(this.__state!==Binding.State.Initializing&&this.__state!==Binding.State.Preloading&&this.__state!==Binding.State.Initialized&&this.__state!==Binding.State.Suspended&&this.__state!==Binding.State.Error||!this.__symbol)return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+'] __resume aborted because binding is neither in state "Initializing", "Initialized" or "Suspended". Current state is '+this.__state));if(this.__state===Binding.State.Initialized&&!isAttached)return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+'] __resume aborted because binding is already in state "Initialized" and control is not attached to dom.'));if(isAttached)this.__stateOld=this.__state,this.__state=Binding.State.Resuming,this.__procWatchState(),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+'] __resume switches state to "Resuming".');else if(!TcHmi.System.isPreloaded&&this.__preload&&(this.__stateOld=this.__state,this.__state=Binding.State.Preloading,this.__procWatchState(),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+'] __resume switches state to "Preloading".'),this.__partial&&"TcHmi.Controls.System.TcHmiUserControl"===this.__partial.getType())){const host=this.__partial.getParent();if(host){let hostId=host.getId();this.__resumeLock=!0;const waitForPreloadingBindings=host=>{if(!(TcHmi.System.Services.bindingManager.getPreloadingBindingsByControl(host).size>0))return this.__resumeLock=!1,this.__resumeStage=1,void this.__resume(forcePreload);this.__destroyHostPreloadingBindingsWatch=TcHmi.System.Services.bindingManager.watchPreloadingBindingsByControl(host,(data=>{if(0===data.result.size)return data.destroy?.(),this.__destroyHostPreloadingBindingsWatch&&(this.__destroyHostPreloadingBindingsWatch=null),this.__resumeLock=!1,this.__resumeStage=1,void this.__resume(forcePreload)}))};return host.getIsInitialized()?void waitForPreloadingBindings(host):void TcHmi.EventProvider.register(hostId+".System.onInitialized",(()=>{waitForPreloadingBindings(host)}))}}this.__resumeStage=1}if(1===this.__resumeStage){if(this.__resumeStage=0,!this.__attr?.allowEarlySymbolReferenceInjection&&processSymbolReference())return;if(this.__state===Binding.State.Preloading)return void(this.__symbol.isProcessedAsync()?this.__symbol.readEx({forceParallel:!0,forceReadWriteGroup:1},this.__onReadCallback()):queueMicrotask((()=>{this.__symbol?.readEx({forceParallel:!0,forceReadWriteGroup:1},this.__onReadCallback())})));if(this.__state===Binding.State.Resuming){if(this.__propertyName){const expr=this.__symbol.getExpression();let bindingMode=expr.getOptions().BindingMode,attrType=TcHmi.System.Services.controlManager.getAttributeTypeByPropertyName(this.__control,this.__propertyName);if("TwoWay"===bindingMode||!bindingMode&&attrType===System.ControlAttributeType.UserControlParameter||!bindingMode&&this.__attr&&"TwoWay"===this.__attr.defaultBindingMode){let bindingEvents=expr.getOptions().BindingEvents;if(bindingEvents)for(let i=0,ii=bindingEvents.length;i<ii;i++){let bindingEvent=bindingEvents[i];this.__onBindingEventDestroyCallbacks.push(TcHmi.EventProvider.register(this.__control.getId()+"."+bindingEvent,this.__onBindingEvent()))}else this.__onPropertyChangedDestroyCallback=TcHmi.EventProvider.register(this.__control.getId()+".onPropertyChanged<"+this.__propertyName+">",this.__onPropertyChanged())}this.__watchCallback=this.__onWatchCallback(),this.__destroyWatch=this.__symbol.watch(this.__watchCallback)}return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume finished."))}TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume finished.")}},this.__suspend=()=>{if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __suspend called."),this.__destroyWatch&&(this.__destroyWatch(),this.__destroyWatch=null),this.__watchCallback=null,null!==this.__onPropertyChangedDestroyCallback&&(this.__onPropertyChangedDestroyCallback(),this.__onPropertyChangedDestroyCallback=null),this.__onBindingEventDestroyCallbacks)for(;this.__onBindingEventDestroyCallbacks.length>0;){let onBindingEventDestroyCallback=this.__onBindingEventDestroyCallbacks.shift();onBindingEventDestroyCallback?.(),onBindingEventDestroyCallback=void 0}this.__stateOld=this.__state,this.__state=Binding.State.Suspended,this.__procWatchState(),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __suspend finished.")},this.__state=Binding.State.Invalid,this.__onInitializedDestroyCallback=null,this.__onControlAttachedDestroyCallback=null,this.__onControlDetachedDestroyCallback=null,this.__onBindingEventDestroyCallbacks=[],this.__onPropertyChangedDestroyCallback=null,this.__watchCallback=null,TCHMI_CONSOLE_LOG_LEVEL>=4&&(this.__diagGUID=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Binding, ObjectScopeDiagGUID="+this.__diagGUID+"] constructor called with:",{expression:expression,propertyName:propertyName,control:control}),!expression){let message='Invalid value: "'+expression+'" for parameter: "expression".';throw TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, ObjectScopeDiagGUID="+this.__diagGUID+"] constructor failed with: "+message),new Error(message)}if(!propertyName){let message='Invalid value: "'+propertyName+'" for parameter: "propertyName".';throw TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, ObjectScopeDiagGUID="+this.__diagGUID+"] constructor failed with: "+message),new Error(message)}if(!control)throw TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Binding, ObjectScopeDiagGUID="+this.__diagGUID+'] constructor failed with invalid value "',control,'" for parameter: "control".'),new Error('Invalid value: "'+control+'" for parameter: "control".');this.__expression=expression,this.__propertyName=propertyName,this.__control=control,this.__stateOld=this.__state,this.__state=Binding.State.Initializing,this.__preload=!1,this.__partial=null,this.__symbol=new System.Symbol(expression);let attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(this.__control,this.__propertyName);if(!attr){let message='The attribute property name: "'+this.__propertyName+'" does not exist for control: '+control.getId();throw TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+control?.getId()+", Property="+propertyName+", Symbol="+expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] constructor failed with: "+message),new Error(message)}this.__attr=attr,this.__attrSchema=TcHmi.System.Services.typeManager.getSchema(this.__attr.type);let parent=this.__control.getParent();for(;null!==parent;){let parentType=parent.getType();if(("TcHmi.Controls.System.TcHmiView"===parentType||"TcHmi.Controls.System.TcHmiContent"===parentType||"TcHmi.Controls.System.TcHmiUserControl"===parentType)&&(this.__partial||(this.__partial=parent),"TcHmi.Controls.System.TcHmiView"===parentType||"TcHmi.Controls.System.TcHmiContent"===parentType)){let partialUrl=tchmi_path(parent.getElement()[0].getAttribute("data-tchmi-partial-url"));if(partialUrl&&!0===TcHmi.System.Data.isPreloadBindingPartial.get(partialUrl)&&("TcHmi.Symbol"===this.__attrSchema?.frameworkInstanceOf&&!0===this.__attr.allowSymbolReferencePreloading||"TcHmi.Symbol"!==this.__attrSchema?.frameworkInstanceOf)){this.__preload=!0;break}}parent=parent.getParent()}this.__partial?this.__onInitializedDestroyCallback=TcHmi.EventProvider.register(this.__partial.getId()+".System.onInitialized",(()=>{this.__resume()})):this.__onInitializedDestroyCallback=TcHmi.EventProvider.register(this.__control.getId()+".System.onInitialized",(()=>{this.__resume()})),this.__onControlAttachedDestroyCallback=TcHmi.EventProvider.register(this.__control.getId()+".System.onAttached",(()=>{this.__resume()})),this.__onControlDetachedDestroyCallback=TcHmi.EventProvider.register(this.__control.getId()+".System.onDetached",(()=>{this.__suspend()})),this.__stateWatcher=new Set,this.__attr.allowEarlySymbolReferenceInjection&&this.__resume()}destroy(){if(this.__state===Binding.State.Destroyed)return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, ObjectScopeDiagGUID="+this.__diagGUID+"] destroy called and aborted because object is already marked as destroyed."));let diagControlId=this.__control?.getId(),diagPropertyName=this.__propertyName,diagSymbolExpression=this.__symbol?.getExpression().toString();if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+diagControlId+", Property="+diagPropertyName+", Symbol="+diagSymbolExpression+", ObjectScopeDiagGUID="+this.__diagGUID+"] destroy called."),this.__propertyName=null,this.__control=null,this.__destroyRead&&(this.__destroyRead(),this.__destroyRead=null),this.__destroyWatch&&(this.__destroyWatch(),this.__destroyWatch=null),this.__watchCallback=null,this.__symbol&&(this.__symbol.destroy(),this.__symbol=null),this.__destroyHostPreloadingBindingsWatch&&(this.__destroyHostPreloadingBindingsWatch(),this.__destroyHostPreloadingBindingsWatch=null),null!==this.__onPropertyChangedDestroyCallback&&(this.__onPropertyChangedDestroyCallback(),this.__onPropertyChangedDestroyCallback=null),this.__onBindingEventDestroyCallbacks)for(;this.__onBindingEventDestroyCallbacks.length>0;){let onBindingEventDestroyCallback=this.__onBindingEventDestroyCallbacks.shift();onBindingEventDestroyCallback?.(),onBindingEventDestroyCallback=void 0}null!==this.__onInitializedDestroyCallback&&(this.__onInitializedDestroyCallback(),this.__onInitializedDestroyCallback=null),null!==this.__onControlAttachedDestroyCallback&&(this.__onControlAttachedDestroyCallback(),this.__onControlAttachedDestroyCallback=null),null!==this.__onControlDetachedDestroyCallback&&(this.__onControlDetachedDestroyCallback(),this.__onControlDetachedDestroyCallback=null),this.__stateOld=this.__state,this.__state=Binding.State.Destroyed,this.__procWatchState(),this.__stateWatcher.clear(),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+diagControlId+", Property="+diagPropertyName+", Symbol="+diagSymbolExpression+", ObjectScopeDiagGUID="+this.__diagGUID+"] destroy finished.")}getExpression(){return this.__expression}getSymbol(){return this.__symbol}getPropertyName(){return this.__propertyName}getControl(){return this.__control}getState(){return this.__state}getPreload(){return this.__preload}getPartial(){return this.__partial}__onBindingEvent(){return()=>{if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __onBindingEvent called."),this.__state===Binding.State.Ready){if(!this.__lockWatchError&&this.__control&&void 0!==this.__control[this.__attr.propertyGetterName]){let value=this.__control[this.__attr.propertyGetterName].call(this.__control);if(this.__lockWriteToControl&&tchmi_equal(this.__lockWriteToControlValue,value))return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+'] __onBindingEvent aborted because of "__lockWriteToControl".'));this.__writeToSymbol(tchmi_clone_object(value))}}else TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+']  __onBindingEvent because Binding is not in state "Ready".')}}__onPropertyChanged(){return(e,data)=>{if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"]  __onPropertyChanged"),this.__state===Binding.State.Ready)if(data){if(!this.__lockWatchError&&this.__control&&void 0!==this.__control[this.__attr.propertyGetterName]){let value=this.__control[this.__attr.propertyGetterName].call(this.__control);if(this.__lockWriteToControl&&tchmi_equal(this.__lockWriteToControlValue,value))return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+']  __onPropertyChanged aborted because of "__lockWriteToControl".'));this.__writeToSymbol(tchmi_clone_object(value),data.dirtyPaths)}}else TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+']  __onPropertyChanged aborted because "data" is not defined.');else TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+']  __onPropertyChanged aborted because Binding is not in state "Ready".')}}__onWatchCallback(){return data=>{let guid="";if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(guid=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol=",this.__symbol?.getExpression().toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback called with:",{data:data}),null!==this.__pendingForceReadRequestId&&(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback release pending forced read request with id: "+this.__pendingForceReadRequestId),TcHmi.Server.releaseRequest(this.__pendingForceReadRequestId),this.__pendingForceReadRequestId=null),this.__state!==Binding.State.Ready&&this.__state!==Binding.State.Resuming&&this.__state!==Binding.State.Error)return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+'] __onWatchCallback aborted because state is neither "Ready", "Resuming" or "Error".'));if(!this.__symbol)return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback aborted because symbol object is not defined."));const expr=this.__symbol.getExpression();if(expr.getType()===TcHmi.SymbolType.Server&&this.__lockLastWriteError)TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+'] __onWatchCallback aborted because of "__lockLastWriteError".');else{if(expr.getType()===TcHmi.SymbolType.Server&&this.__pendingWriteCount>0)return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+'] __onWatchCallback aborted because "__pendingWriteCount > 0". "__pendingWriteCount: '+this.__pendingWriteCount),void(this.__forwardWriteToSymbolResponse=!0);if(expr&&data.error===TcHmi.Errors.NONE)if(this.__state!==Binding.State.Resuming&&this.__state!==Binding.State.Error||(this.__stateOld=this.__state,this.__state=Binding.State.Ready,this.__procWatchState()),this.__lockWatchError=!1,!TCHMI_DESIGNER&&this.__latestWrite&&expr.getType()===TcHmi.SymbolType.Server)if(data.processedStart&&data.processedEnd)if(this.__latestWriteProcessedStart&&this.__latestWriteProcessedEnd){let symbolName=expr.getName();1===Binding.__compareTiming(data.processedStart,this.__latestWriteProcessedEnd)?(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback calls __writeToControl because watch tick data is newer than last server write."),this.__writeToControl(data.value,data.dirtyPaths)):1===Binding.__compareTiming(this.__latestWriteProcessedStart,data.processedEnd)?TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback aborted because server read has ended before last server write has started. Data is outdated."):symbolName?(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback forces read from server because last write and watch callback were processed at roughly the same time."),this.__pendingForceReadRequestId=TcHmi.Server.request({requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage"],symbol:symbolName}]},(data=>{if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol=",this.__symbol?.getExpression().toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback forced read finished with:",{data:data}),this.__pendingForceReadRequestId=null,TCHMI_CONSOLE_LOG_LEVEL>=1&&data.error!==TcHmi.Errors.NONE){let message="[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+"] ";return data.details?message+=TcHmi.Log.buildMessage(data.details):message+=TcHmi.Log.buildMessage({code:data.error,message:TcHmi.Errors[data.error]}),void TcHmi.Log.error(message)}let response=data.response;if(void 0===response)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+"] "+TcHmi.Log.buildMessage({code:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_MISSING],reason:"Missing response from server.",domain:"TcHmi.System.Binding"})));if(response&&response.error)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+"] "+TcHmi.Log.buildMessage({code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],reason:"Error in response from server with id: "+response.id,domain:"TcHmi.System.Binding",errors:[response.error]})));let command,commands=response.commands;if(!commands)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+"] Server responds with error: "+TcHmi.Log.buildMessage({code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:"Missing commands in response from server with id: "+response.id,domain:"TcHmi.System.Symbol"})));for(let i=0,ii=commands.length;i<ii;i++){let command2=commands[i];if(command2&&command2.symbol===symbolName){command=command2;break}}if(!command)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+"] Server responds with error: "+TcHmi.Log.buildMessage({code:TcHmi.Errors.E_SERVER_COMMAND_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_MISSING],reason:'Missing command for symbol: "'+symbolName+'" in response from server with id: '+response.id,domain:"TcHmi.System.Symbol"})));if(command.error)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+"] Server responds with error: "+TcHmi.Log.buildMessage({code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:'Error in command for symbol: "'+symbolName+'" in response from server with id: '+response.id,domain:"TcHmi.System.Symbol",errors:[command.error]})));if(void 0===command.readValue)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+"] Server responds with error: "+TcHmi.Log.buildMessage({code:TcHmi.Errors.E_SERVER_READVALUE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_READVALUE_MISSING],reason:'Missing property: "readValue" in command for symbol: "'+symbolName+'" in response from server with id: '+response.id,domain:"TcHmi.System.Symbol"})));let value=command.readValue;this.__lockWriteToControl&&tchmi_equal(this.__lockWriteToControlValue,value)?TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+'] __onWatchCallback aborted because of "__lockWriteToControl".'):(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback calls __writeToControl with forced read data."),this.__writeToControl(value))}))):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback aborted Symbol Expression is not valid.")}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+'] Missing property "processedStart" or "processedEnd" in response.');else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+'] Missing property "processedStart" or "processedEnd" in response.');else{let value=data.value;if(this.__lockWriteToControl&&tchmi_equal(this.__lockWriteToControlValue,value))return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+'] __onWatchCallback aborted because of "__lockWriteToControl".'));this.__writeToControl(value,data.dirtyPaths)}else{this.__lockWatchError=!0;let message="[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+"] ";if(data.details?message+=TcHmi.Log.buildMessage(data.details):message+=TcHmi.Log.buildMessage({code:data.error,message:TcHmi.Errors[data.error]}),TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(message),this.__lockWriteToControl&&tchmi_equal(this.__lockWriteToControlValue,null))return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+'] __onWatchCallback aborted because of "__lockWriteToControl".'));"Reset"===TcHmi.System.config.binding.symbolError&&this.__writeToControl(null),this.__stateOld=this.__state,this.__state=Binding.State.Error,this.__procWatchState()}}}}__onReadCallback(){return data=>{let guid="";if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(guid=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol=",this.__symbol?.getExpression().toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onReadCallback called with:",{data:data}),this.__state===Binding.State.Preloading)if(this.__symbol){if(TCHMI_CONSOLE_LOG_LEVEL>=1&&data.error!==TcHmi.Errors.NONE){let message="[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+"] ";data.details?message+=TcHmi.Log.buildMessage(data.details):message+=TcHmi.Log.buildMessage({code:data.error,message:TcHmi.Errors[data.error]}),TcHmi.Log.error(message)}if(data.error!==TcHmi.Errors.NONE)return"Reset"===TcHmi.System.config.binding.symbolError&&this.__writeToControl(null),this.__stateOld=this.__state,this.__state=Binding.State.Error,void this.__procWatchState();this.__writeToControl(data.value,data.dirtyPaths),this.__stateOld=this.__state,this.__state=Binding.State.Initialized,this.__procWatchState()}else TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onReadCallback aborted because symbol object is not defined.");else TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+'] __onReadCallback aborted because state is not "Reading".')}}__writeToSymbol(value,dirtyPaths){if(null===dirtyPaths&&(dirtyPaths=void 0),void 0===value)return;if(!this.__symbol)return;let guid="";TCHMI_CONSOLE_LOG_LEVEL>=4&&(guid=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol=",this.__symbol?.getExpression().toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"]  __writeToSymbol called with:",{value:value,dirtyPaths:dirtyPaths}),null!==this.__pendingForceReadRequestId&&(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+']  __writeToSymbol release pending forced read request with id: "'+this.__pendingForceReadRequestId),TcHmi.Server.releaseRequest(this.__pendingForceReadRequestId),this.__pendingForceReadRequestId=null,this.__forwardWriteToSymbolResponse=!0),this.__pendingWriteCount++,this.__symbol.writeEx(value,dirtyPaths,(data=>{if(this.__pendingWriteCount--,data.error===TcHmi.Errors.NONE){if(!this.__symbol)return;this.__symbol.getExpression().getType()===TcHmi.SymbolType.Server&&(this.__latestWrite=!0,data.processedStart&&data.processedEnd?(this.__latestWriteProcessedStart=data.processedStart,this.__latestWriteProcessedEnd=data.processedEnd):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+'] Missing property "processedStart" or "processedEnd" in response.'),this.__lockLastWriteError=!0),!this.__lockLastWriteError&&0===this.__pendingWriteCount&&this.__forwardWriteToSymbolResponse?(this.__writeToControl(data.value,dirtyPaths),this.__forwardWriteToSymbolResponse=!1):this.__lockLastWriteError?TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+']  __writeToSymbol aborted because of "__lockLastWriteError".'):this.__pendingWriteCount>0?TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+']  __writeToSymbol aborted because "__pendingWriteCount > 0". __pendingWriteCount: '+this.__pendingWriteCount):this.__forwardWriteToSymbolResponse||TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+']  __writeToSymbol aborted because "__forwardWriteToSymbolResponse === false".'))}else{let message="[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+"] ";data.details?message+=TcHmi.Log.buildMessage(data.details):message+=TcHmi.Log.buildMessage({code:data.error,message:TcHmi.Errors[data.error]}),TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(message)}}))}__writeToControl(value,dirtyPaths){if(null===dirtyPaths&&(dirtyPaths=void 0),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol=",this.__symbol?.getExpression().toString(),", ObjectScopeDiagGUID="+this.__diagGUID+"]  __writeToControl called with:",{value:value,dirtyPaths:dirtyPaths}),void 0===value)return;if(!this.__control)return;let error;this.__lockWriteToControl=!0,this.__lockWriteToControlValue=TcHmi.ValueConverter.toType(tchmi_clone_object(value),this.__attr.type);try{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"]  __writeToControl calling attribute setter."),error=TcHmi.System.Services.controlManager.setControlPropertyByAttribute(this.__control,this.__attr,tchmi_clone_object(value),dirtyPaths),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol=",this.__symbol?.getExpression().toString(),", ObjectScopeDiagGUID="+this.__diagGUID+"]  __writeToControl calling attribute finished with:",{error:error})}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+"] An uncaught exception occurred in setter function of attribute with propertyName="+this.__propertyName+" of control="+this.__control?.getId()+":\n",e)}finally{this.__lockWriteToControl=!1,this.__lockWriteToControlValue=void 0}error&&error.code!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&(error.exception?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+"] "+TcHmi.Log.buildMessage(error),"\n",error.exception):TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+this.__control?.getId()+", Property="+this.__propertyName+", Symbol="+this.__expression+"] "+TcHmi.Log.buildMessage(error)))}__procWatchState(){for(const stateWatcher of this.__stateWatcher.keys())TcHmi.Callback.callSafeEx(stateWatcher.callback,this,{error:TcHmi.Errors.NONE,binding:this,state:this.__state,stateOld:this.__stateOld,destroy:stateWatcher.destroy})}watchState(callback){const destroy=()=>{watcher&&this.__stateWatcher.delete(watcher)},watcher={callback:callback,destroy:destroy};return this.__stateWatcher.add(watcher),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,binding:this,state:this.__state,stateOld:this.__stateOld,destroy:destroy}),destroy}}System.Binding=Binding,function(Binding){let State;!function(State){State[State.Invalid=0]="Invalid",State[State.Error=1]="Error",State[State.Initializing=100]="Initializing",State[State.Resuming=200]="Resuming",State[State.Preloading=300]="Preloading",State[State.Initialized=400]="Initialized",State[State.Ready=500]="Ready",State[State.Suspended=600]="Suspended",State[State.Destroyed=700]="Destroyed"}(State=Binding.State||(Binding.State={}))}(Binding=System.Binding||(System.Binding={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.BindingManager=class{constructor(){this.__bindingsByControl=new WeakMap,this.__bindingsPreloading=new Set,this.__bindingsPreloadingByPartial=new Map,this.__bindingsPreloadingByControl=new Map,this.__watchStateDestroyByBinding=new WeakMap,this.__watcherPreloadingBindings=new Set,this.__watcherPreloadingBindingsByPartial=new Set,this.__watcherPreloadingBindingsByControl=new Set,this.__onBindingWatchState=data=>{let partial=data.binding.getPartial();if(!partial)return;let control=data.binding.getControl();if(!control)return;let proc=(partial,control)=>{if((data.state===System.Binding.State.Initialized||data.state===System.Binding.State.Error)&&data.stateOld===System.Binding.State.Preloading){let bProcPreloading=!1,bProcPreloadingByPartial=!1,bProcPreloadingByControl=!1;this.__bindingsPreloading.has(data.binding)&&(this.__bindingsPreloading.delete(data.binding),bProcPreloading=!0);let bindingsPreloadingByPartial=this.__bindingsPreloadingByPartial.get(partial);bindingsPreloadingByPartial&&(bindingsPreloadingByPartial.delete(data.binding),0===bindingsPreloadingByPartial.size&&this.__bindingsPreloadingByPartial.delete(partial),bProcPreloadingByPartial=!0);let bindingsPreloadingByControl=this.__bindingsPreloadingByControl.get(control);bindingsPreloadingByControl&&(bindingsPreloadingByControl.delete(data.binding),0===bindingsPreloadingByControl.size&&this.__bindingsPreloadingByControl.delete(control),bProcPreloadingByControl=!0),bProcPreloading&&this.__procWatchPreloadingBindings(),bProcPreloadingByPartial&&this.__procWatchPreloadingBindingsByPartial(),bProcPreloadingByControl&&this.__procWatchPreloadingBindingsByControl(),data.destroy?.(),this.__watchStateDestroyByBinding.delete(data.binding)}};if(proc(partial,control),"TcHmi.Controls.System.TcHmiUserControl"===partial.getType()){let parent=partial.getParent();for(;null!==parent;){let parentType=parent.getType();"TcHmi.Controls.System.TcHmiView"!==parentType&&"TcHmi.Controls.System.TcHmiContent"!==parentType||proc(parent,control),parent=parent.getParent()}}}}__procWatchPreloadingBindings(){for(const watcher of this.__watcherPreloadingBindings.keys())TcHmi.Callback.callSafeEx(watcher.callback,this,{error:TcHmi.Errors.NONE,result:this.getPreloadingBindings(),destroy:watcher.destroy})}__procWatchPreloadingBindingsByPartial(){for(const watcher of this.__watcherPreloadingBindingsByPartial.keys())TcHmi.Callback.callSafeEx(watcher.callback,this,{error:TcHmi.Errors.NONE,result:this.getPreloadingBindingsByPartial(watcher.partial),destroy:watcher.destroy})}__procWatchPreloadingBindingsByControl(){for(const watcher of this.__watcherPreloadingBindingsByControl.keys())TcHmi.Callback.callSafeEx(watcher.callback,this,{error:TcHmi.Errors.NONE,result:this.getPreloadingBindingsByControl(watcher.control),destroy:watcher.destroy})}getPreloadingBindings(){return new Set(this.__bindingsPreloading)}getPreloadingBindingsByPartial(partial){return new Set(this.__bindingsPreloadingByPartial.get(partial))}getPreloadingBindingsByControl(control){return new Set(this.__bindingsPreloadingByControl.get(control))}watchPreloadingBindings(callback){const destroy=()=>{watcher&&this.__watcherPreloadingBindings.delete(watcher)},watcher={callback:callback,destroy:destroy};return this.__watcherPreloadingBindings.add(watcher),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:this.getPreloadingBindings(),destroy:destroy}),destroy}watchPreloadingBindingsByPartial(partial,callback){const destroy=()=>{watcher&&this.__watcherPreloadingBindingsByPartial.delete(watcher)},watcher={partial:partial,callback:callback,destroy:destroy};return this.__watcherPreloadingBindingsByPartial.add(watcher),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:this.getPreloadingBindingsByPartial(partial),destroy:destroy}),destroy}watchPreloadingBindingsByControl(control,callback){const destroy=()=>{watcher&&this.__watcherPreloadingBindingsByControl.delete(watcher)},watcher={control:control,callback:callback,destroy:destroy};return this.__watcherPreloadingBindingsByControl.add(watcher),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:this.getPreloadingBindingsByControl(control),destroy:destroy}),destroy}getBinding(propertyName,control){let res=null,controlMap=this.__bindingsByControl.get(control);if(void 0===controlMap)return res;if(!TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName))return res;let b=controlMap.get(propertyName);return void 0===b||(res=b),res}getBindingsByControl(control){return this.__bindingsByControl.get(control)}createBinding(expression,propertyName,control){this.removeBinding(propertyName,control,!1);let controlMap=this.__bindingsByControl.get(control);void 0===controlMap&&(controlMap=new Map,this.__bindingsByControl.set(control,controlMap));let b=new System.Binding(expression,propertyName,control);if(b.getPreload()){this.__bindingsPreloading.add(b);let bindingsPreloadingByPartial,partial=b.getPartial();partial&&(bindingsPreloadingByPartial=this.__bindingsPreloadingByPartial.get(partial),bindingsPreloadingByPartial||(bindingsPreloadingByPartial=new Set,this.__bindingsPreloadingByPartial.set(partial,bindingsPreloadingByPartial)),bindingsPreloadingByPartial.add(b));let bindingsPreloadingByControl=this.__bindingsPreloadingByControl.get(control);bindingsPreloadingByControl||(bindingsPreloadingByControl=new Set,this.__bindingsPreloadingByControl.set(control,bindingsPreloadingByControl)),bindingsPreloadingByControl.add(b),this.__procWatchPreloadingBindings(),this.__procWatchPreloadingBindingsByPartial(),this.__procWatchPreloadingBindingsByControl();let destroyWatch=b.watchState(this.__onBindingWatchState);this.__watchStateDestroyByBinding.set(b,destroyWatch)}return controlMap.set(propertyName,b),b.__resume(),b}removeBinding(propertyName,control,bResetSetter=!0){let controlMap=this.__bindingsByControl.get(control);if(void 0===controlMap)return;let attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName);if(!attr)return;let b=controlMap.get(propertyName);if(!b)return;controlMap.delete(propertyName),0===controlMap.size&&this.__bindingsByControl.delete(control),b.destroy();let destroyWatchState=this.__watchStateDestroyByBinding.get(b);destroyWatchState&&(destroyWatchState(),destroyWatchState=void 0);let partial=b.getPartial();if(partial){let bindingsPreloadingByPartial=this.__bindingsPreloadingByPartial.get(partial);bindingsPreloadingByPartial&&(bindingsPreloadingByPartial.delete(b),0===bindingsPreloadingByPartial.size&&this.__bindingsPreloadingByPartial.delete(partial),this.__procWatchPreloadingBindingsByPartial())}let bindingsPreloadingByControl=this.__bindingsPreloadingByControl.get(control);if(bindingsPreloadingByControl&&(bindingsPreloadingByControl.delete(b),0===bindingsPreloadingByControl.size&&this.__bindingsPreloadingByControl.delete(control),this.__procWatchPreloadingBindingsByControl()),this.__bindingsPreloading.has(b)&&(this.__bindingsPreloading.delete(b),this.__procWatchPreloadingBindings()),bResetSetter){let error;try{error=TcHmi.System.Services.controlManager.setControlPropertyByAttribute(control,attr,null)}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.BindingManager] An uncaught exception occurred in setter function of attribute with propertyName="+propertyName+" of control="+control?.getId()+":\n",e)}error&&error.code!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.BindingManager] "+TcHmi.Log.buildMessage(error))}}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){class ControlManager{constructor(){if(this.__controlsWeak=new WeakSet,this.__controls=new Map,this.__controlsGeoMap=new Map,this.__controlsPresavedGeoMap=new WeakMap,this.__controlsToRecheckAfterDesignerInteraction=new Set,this.__iframesSet=new WeakSet,this.__recheckControlsAfterInteraction=()=>{this.checkControlGeometry({delayUserEvents:!1,force:!0,geos:this.__controlsToRecheckAfterDesignerInteraction}),this.__controlsToRecheckAfterDesignerInteraction.clear()},this.__usercontrolAttrDescrByPropertyName=new Map,this.__usercontrolAttrDescrBySetterName=new Map,this.__usercontrolAttrDescrByGetterName=new Map,this.resolveUcAttributes=()=>{this.__usercontrolAttrDescrByPropertyName.clear(),this.__usercontrolAttrDescrBySetterName.clear(),this.__usercontrolAttrDescrByGetterName.clear(),TcHmi.System.Data.Caches.partialCompositeConfigCache.forEach(((config,ucJsonPath)=>{if(config&&config.parameters){let UCdescrByPropertyName=new Map;this.__usercontrolAttrDescrByPropertyName.set(ucJsonPath,UCdescrByPropertyName);let UCdescrBySetterName=new Map;this.__usercontrolAttrDescrBySetterName.set(ucJsonPath,UCdescrBySetterName);let UCdescrByGetterName=new Map;this.__usercontrolAttrDescrByGetterName.set(ucJsonPath,UCdescrByGetterName);const parameters=config.parameters;for(let i=0,ii=parameters.length;i<ii;i++)UCdescrByPropertyName.set(parameters[i].propertyName,parameters[i]),parameters[i].propertySetterName&&UCdescrBySetterName.set(parameters[i].propertySetterName,parameters[i]),parameters[i].propertyGetterName&&UCdescrByGetterName.set(parameters[i].propertyGetterName,parameters[i])}}))},this.__onAttributeMutation=(mutations,observer)=>{let geos=new Map;for(const mutation of mutations){const node=mutation.target;if(node.nodeType===Node.ELEMENT_NODE){if(node.id){const geo=this.__controlsGeoMap.get(node.id);geo&&!geos.has(node.id)&&(geo.isDirty=!0,geos.set(node.id,geo))}const controlElement=node.closest("div[id][data-tchmi-type]");if(controlElement){if(!TcHmi.Controls.get(controlElement.id)?.getIsAttached())continue}else if(!node.isConnected)continue;const cnodes=node.querySelectorAll("div[id][data-tchmi-type]");for(const childNode of cnodes){let childGeo=this.__controlsGeoMap.get(childNode.id);childGeo&&!geos.has(childNode.id)&&(childGeo.isDirty=!0,geos.set(childNode.id,childGeo))}}}geos.size&&this.checkControlGeometry({geos:geos})},this.__forceDetachList=[],this.__delayedDomMutations=new Set,this.__delayedDomMutationTimeoutId=0,this.__onDomMutation=mutations=>{for(let mutation of mutations)this.__delayedDomMutations.add(mutation);let ControlManager___onDomMutation=()=>{if(this.__delayedDomMutationTimeoutId=0,0===this.__delayedDomMutations.size)return;let domChanged=!1;const ctrlsAttachedSet=new Set,ctrlsDetachedSet=new Set,ctrlsAttached=[],ctrlsDetached=[];let task,ctrlsDelayedMoved=[],ctrlsDelayedResized=[];task=TcHmi.System.config.disableLoadingOptimization?new TcHmi.TimedAsyncTask(1/0):new TcHmi.TimedAsyncTask(1e4);const publishGeometry=ctrl=>{if(!ctrl)return;if(ctrl.getElement().length<1)return;const ctrlName=ctrl.getId();let geo={ctrl:ctrl,layoutData:{moved:!1,movedLocal:!1,resized:!1,bounds:{leftGlobal:null,topGlobal:null,offsetLeft:null,offsetTop:null,width:null,height:null},computedStyles:{left:"",top:"",right:"",bottom:"",width:"",height:""}},isDirty:!0};if(ctrl.__getKeepAlive()){let geoOld=this.__controlsPresavedGeoMap.get(ctrl);geoOld&&(geo=geoOld,geo.isDirty=!0)}this.__controlsGeoMap.set(ctrlName,geo);let delayedEvents=this.checkControlGeometry({geos:geo,delayUserEvents:!0});ctrlsDelayedMoved=ctrlsDelayedMoved.concat(delayedEvents.skippedMovedEventList),ctrlsDelayedResized=ctrlsDelayedResized.concat(delayedEvents.skippedResizedEventList)},detach=(ctrl,force)=>{if(!ctrl)return;const ctrlName=ctrl.getId();let geo=this.__controlsGeoMap.get(ctrlName);if(!geo)return;if(geo.ctrl.__getKeepAlive()&&this.__controlsPresavedGeoMap.set(geo.ctrl,geo),this.__controlsGeoMap.delete(ctrlName),!geo.ctrl)return;let inDom,ctrlElem=ctrl.getElement();if(!(ctrlElem.length<1)&&(inDom=void 0!==ctrlElem[0].isConnected?ctrlElem[0].isConnected:!!document.getElementById(ctrlName),!0===force&&(inDom=!1),!1===inDom&&!0===ctrl.getIsAttached())){ctrl.__setLifeCycleState(40),TcHmi.EventProvider.raise("System.onPrevControlDetached",ctrl),TcHmi.EventProvider.raise(ctrlName+".System.onPrevDetached",ctrl);try{ctrl.__detach()}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ControlManager] Control __detach of "+ctrl.getId()+" failed with exception:\n",e)}ctrlsDetached.push(ctrl),domChanged=!0}},attach=ctrl=>{if(!ctrl)return;let ctrlElem=ctrl.getElement();if(ctrlElem.length<1)return;const ctrlName=ctrl.getId();let inDom;if(inDom=void 0!==ctrlElem[0].isConnected?ctrlElem[0].isConnected:!!document.getElementById(ctrlName),!0===inDom&&!1===ctrl.getIsAttached()){ctrl.__setLifeCycleState(30),TcHmi.EventProvider.raise("System.onPrevControlAttached",ctrl),TcHmi.EventProvider.raise(ctrlName+".System.onPrevAttached",ctrl);try{ctrl.__attach()}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ControlManager] Control __attach of "+ctrlName+" failed with exception:\n",e)}ctrlsAttached.push(ctrl),domChanged=!0}},saveNewState=(controlId,newStateAttached)=>{newStateAttached?(ctrlsDetachedSet.delete(controlId),ctrlsAttachedSet.add(controlId)):newStateAttached||(ctrlsDetachedSet.add(controlId),ctrlsAttachedSet.delete(controlId))},procIFrameAdded=node=>{this.__iframesSet.has(node)||(this.__iframesSet.add(node),TcHmi.EventProvider.raise("System.onIFrameElementAdded",node))},procIFrameRemoved=node=>{this.__iframesSet.has(node)&&(this.__iframesSet.delete(node),TcHmi.EventProvider.raise("System.onIFrameElementRemoved",node))};for(const mutation of this.__delayedDomMutations){this.__delayedDomMutations.delete(mutation);for(const removedNode of mutation.removedNodes){const node=removedNode;if(node.nodeType!==Node.ELEMENT_NODE)continue;const controlChildElements=node.querySelectorAll("div[id][data-tchmi-type]");for(const controlChildElem of controlChildElements)saveNewState(controlChildElem.id,!1);node.id&&node.hasAttribute("data-tchmi-type")&&saveNewState(node.id,!1);const iframeNodeChilds=node.querySelectorAll("iframe");for(const childIframe of iframeNodeChilds)procIFrameRemoved(childIframe);node instanceof HTMLIFrameElement&&procIFrameRemoved(node)}for(const addedNode of mutation.addedNodes){const node=addedNode;if(node.nodeType!==Node.ELEMENT_NODE)continue;node.id&&node.hasAttribute("data-tchmi-type")&&saveNewState(node.id,!0),this.__attributeMutationObserver.observe(node,{attributes:!0,subtree:!0});const controlChildElements=node.querySelectorAll("div[id][data-tchmi-type]");for(const controlChildElem of controlChildElements)saveNewState(controlChildElem.id,!0);const iframeNodeChilds=node.querySelectorAll("iframe");for(const childIframe of iframeNodeChilds)procIFrameAdded(childIframe);node instanceof HTMLIFrameElement&&procIFrameAdded(node)}}(done=>{let ctrlsDetachedForced=Array.from(this.__forceDetachList);this.__forceDetachList=[];let next=()=>{if(0===ctrlsDetachedForced.length)return void done();let ctrl=ctrlsDetachedForced.shift();task.do((()=>{detach(ctrl,!0),next()}))};next()})((()=>{(done=>{let ctrlsDetached=Array.from(ctrlsDetachedSet),next=()=>{if(0===ctrlsDetached.length)return void done();let ctrlName=ctrlsDetached.shift();task.do((()=>{detach(TcHmi.Controls.get(ctrlName),!1),next()}))};next()})((()=>{for(const ctrlName of ctrlsAttachedSet)publishGeometry(TcHmi.Controls.get(ctrlName));(done=>{let ctrlsAttached=Array.from(ctrlsAttachedSet),next=()=>{if(0===ctrlsAttached.length)return void done();let ctrlName=ctrlsAttached.shift();task.do((()=>{attach(TcHmi.Controls.get(ctrlName)),next()}))};next()})((()=>{ctrlsDelayedResized.length&&TcHmi.EventProvider.raise("System.onControlsResized",ctrlsDelayedResized),ctrlsDelayedMoved.length&&TcHmi.EventProvider.raise("System.onControlsMoved",ctrlsDelayedMoved);for(const ctrl of ctrlsDelayedMoved){const ctrlId=ctrl.getId();TcHmi.EventProvider.raise(ctrlId+".onMoved",ctrl,{movedLocal:this.__controlsGeoMap.get(ctrlId)?.layoutData.movedLocal})}for(const ctrl of ctrlsDelayedResized)TcHmi.EventProvider.raise(ctrl.getId()+".onResized",ctrl);ctrlsDelayedResized=[],ctrlsDelayedMoved=[],domChanged&&this.checkControlGeometry(),0!==ctrlsDetached.length&&TcHmi.EventProvider.raise("System.onPrevControlsDetached",ctrlsDetached),0!==ctrlsAttached.length&&TcHmi.EventProvider.raise("System.onPrevControlsAttached",ctrlsAttached)}))}))}))};this.__delayedDomMutationTimeoutId||(this.__delayedDomMutationTimeoutId=setTimeout(ControlManager___onDomMutation))},"function"==typeof Proxy){let __this=this;TcHmi.control=new Proxy(TcHmi.control,{get:function(target,name){return __this.__controls.get(name)},ownKeys:function(target){return Array.from(__this.__controls.keys())},getOwnPropertyDescriptor:function(target,key){return{enumerable:!0,configurable:!0}}})}this.__domMutationObserver=new MutationObserver(this.__onDomMutation),this.__domMutationObserver.observe(document.body,{childList:!0,subtree:!0}),this.__attributeMutationObserver=new MutationObserver(this.__onAttributeMutation);let checkControlGeometryAnimationFrame=0;const checkControlParam={force:!1},throttledControlSizeCheck=evt=>{if(!(evt instanceof TransitionEvent)||"opacity"!==evt.propertyName&&!evt.propertyName.startsWith("background")){if("scroll"!==evt.type||evt.target===document||checkControlParam.force)checkControlParam.force=!0,checkControlParam.geos=void 0;else{checkControlParam.geos||(checkControlParam.geos=new Map);const cnodes=evt.target.querySelectorAll("div[id][data-tchmi-type]");for(const childNode of cnodes){let childGeo=this.__controlsGeoMap.get(childNode.id);childGeo&&!checkControlParam.geos.has(childNode.id)&&(childGeo.isDirty=!0,checkControlParam.geos.set(childNode.id,childGeo))}}checkControlGeometryAnimationFrame||(checkControlGeometryAnimationFrame=window.requestAnimationFrame((()=>{checkControlGeometryAnimationFrame=0,this.checkControlGeometry(checkControlParam),checkControlParam.force=!1,checkControlParam.geos=void 0})))}};document.addEventListener("transitionend",throttledControlSizeCheck,{capture:!1});document.addEventListener("scroll",throttledControlSizeCheck,{capture:!0,passive:!0}),window.addEventListener("resize",throttledControlSizeCheck),TcHmi.EventProvider.register("System.onUserControlConfigCreated",this.resolveUcAttributes),TcHmi.EventProvider.register("System.onUserControlConfigChanged",this.resolveUcAttributes),TcHmi.EventProvider.register("System.onUserControlConfigRemoved",this.resolveUcAttributes),TcHmi.EventProvider.register("System.onControlSizeParameterChanged",this.__recheckControlsAfterInteraction),TcHmi.EventProvider.register("System.onControlPositionParameterChanged",this.__recheckControlsAfterInteraction)}forceDetach(ctrl){ctrl&&this.__forceDetachList.push(ctrl)}checkControlGeometry(options){const geos=options?.geos??this.__controlsGeoMap,delayUserEvents=options?.delayUserEvents??!1;let force=options?.force??!1;if(TCHMI_DESIGNER&&(!0===TcHmi.System.Services.Engineering.designerModeManager.controlResizeManager?.getControlResizing()||!0===TcHmi.System.Services.Engineering.designerModeManager.controlMoveManager?.getControlMoveActive())){if(geos instanceof Map||geos instanceof Set)for(const geo of geos.values())this.__controlsToRecheckAfterDesignerInteraction.add(geo);else this.__controlsToRecheckAfterDesignerInteraction.add(geos);return{skippedResizedEventList:[],skippedMovedEventList:[]}}let resized=[],moved=[],skippedMoved=[],skippedResized=[];const parentSizeCache=new Map,parentCellSizeCache=new Map,checkOne=geo=>{if(!force&&!geo.isDirty)return;let gctrl=geo.ctrl;if(!gctrl)return;if(gctrl.getIsDestroyed())return;let collapseCheckControl=gctrl;for(;collapseCheckControl;){if("Collapsed"===collapseCheckControl.getVisibility())return void(geo.isDirty=!0);collapseCheckControl=collapseCheckControl.getParent()}let gElem=gctrl.getElement()[0],boundingRect=gElem.getBoundingClientRect();geo.layoutData.computedStyles=TcHmi.StyleProvider.getComputedElementStyle(gElem,["left","top","right","bottom","width","height"]);let offsetLeft=gElem.offsetLeft,offsetTop=gElem.offsetTop,parentCtrl=gctrl.getParent();if(parentCtrl)if(TcHmi.System.Services.controlManager.getDescriptionTypes(parentCtrl.getType()).includes("TcHmi.Controls.System.TcHmiGrid")){const gridElem=gctrl.getElement()[0].parentElement.parentElement;let computedNumbers;if(parentCellSizeCache.has(gridElem))computedNumbers=parentCellSizeCache.get(gridElem);else{const computedGridCellStyle=TcHmi.StyleProvider.getComputedElementStyle(gridElem,["border-left-width","padding-left","border-top-width","padding-top"]);computedNumbers={"border-left-width":parseFloat(computedGridCellStyle["border-left-width"]),"padding-left":parseFloat(computedGridCellStyle["padding-left"]),"border-top-width":parseFloat(computedGridCellStyle["border-top-width"]),"padding-top":parseFloat(computedGridCellStyle["padding-top"])},parentCellSizeCache.set(gridElem,computedNumbers)}offsetLeft+=computedNumbers["border-left-width"]+computedNumbers["padding-left"],offsetTop+=computedNumbers["border-top-width"]+computedNumbers["padding-top"]}else{let computedNumbers;const elementToCheck=parentCtrl.getElement()[0];if(parentSizeCache.has(elementToCheck))computedNumbers=parentSizeCache.get(elementToCheck);else{const computedStyle=TcHmi.StyleProvider.getComputedElementStyle(elementToCheck,["border-left-width","border-top-width"]);computedNumbers={"border-left-width":parseFloat(computedStyle["border-left-width"]),"border-top-width":parseFloat(computedStyle["border-top-width"])},parentSizeCache.set(elementToCheck,computedNumbers)}offsetLeft+=computedNumbers["border-left-width"],offsetTop+=computedNumbers["border-top-width"]}let inject=!1;this.__checkResize(geo.layoutData,boundingRect.width,boundingRect.height)&&(geo.layoutData.resized=!0,resized.push(geo),inject=!0);let eMoved=this.__checkMoved(geo.layoutData,boundingRect.top,boundingRect.left,offsetTop,offsetLeft);0!==eMoved&&(geo.layoutData.moved=!0,geo.layoutData.movedLocal=1===eMoved,moved.push(geo),inject=!0),inject&&gctrl.__injectRenderedDimensions(geo.layoutData),geo.isDirty=!1};geos instanceof Map||geos instanceof Set?geos.forEach(checkOne):checkOne(geos);for(let i=0,ii=resized.length;i<ii;i++){let rgeo=resized[i];TcHmi.EventProvider.raise(rgeo.ctrl.getId()+".System.onPrevResized",rgeo),delayUserEvents?skippedResized.push(rgeo.ctrl):(TcHmi.EventProvider.raise(rgeo.ctrl.getId()+".onResized",rgeo.ctrl),TcHmi.EventProvider.raise("System.onControlsResized",[rgeo.ctrl]))}for(let i=0,ii=moved.length;i<ii;i++){let mgeo=moved[i];TcHmi.EventProvider.raise(mgeo.ctrl.getId()+".System.onPrevMoved",mgeo),delayUserEvents?skippedMoved.push(mgeo.ctrl):(TcHmi.EventProvider.raise(mgeo.ctrl.getId()+".onMoved",mgeo.ctrl,{movedLocal:mgeo.layoutData.movedLocal}),TcHmi.EventProvider.raise("System.onControlsMoved",[mgeo.ctrl]))}return{skippedResizedEventList:skippedResized,skippedMovedEventList:skippedMoved}}checkControlGeometryByControl(control){const geo=this.__controlsGeoMap.get(control.getId());geo&&this.checkControlGeometry({geos:geo})}__checkResize(geo,width,height){let bResized=!1;return width=Math.round(width),height=Math.round(height),null===geo.bounds.width&&null===geo.bounds.height?(geo.bounds.width=width,geo.bounds.height=height,bResized=!0):geo.bounds.width===width&&geo.bounds.height===height||(geo.bounds.width=width,geo.bounds.height=height,bResized=!0),bResized}__checkMoved(geo,documentTop,documentLeft,offsetTop,offsetLeft){let moved=0;return null===geo.bounds.topGlobal&&null===geo.bounds.leftGlobal||geo.bounds.offsetTop!==offsetTop||geo.bounds.offsetLeft!==offsetLeft?(geo.bounds.topGlobal=documentTop,geo.bounds.leftGlobal=documentLeft,geo.bounds.offsetTop=offsetTop,geo.bounds.offsetLeft=offsetLeft,moved=1):geo.bounds.topGlobal===documentTop&&geo.bounds.leftGlobal===documentLeft||(geo.bounds.topGlobal=documentTop,geo.bounds.leftGlobal=documentLeft,geo.bounds.offsetTop=offsetTop,geo.bounds.offsetLeft=offsetLeft,moved=2),moved}getControlsCache(){return this.__controls}static __procConstructor(module,element,pcElement,attrs){if(module.reg&&module.reg.ctrlConstructor)try{if(!module.reg.nativeEs6Control&&module.reg.nearestEs6Constructor){let nativeES6control=Reflect.construct(module.reg.nearestEs6Constructor,[element,pcElement,attrs],module.reg.ctrlConstructor);return module.reg.ctrlConstructor.apply(nativeES6control,[element,pcElement,attrs]),nativeES6control}return new module.reg.ctrlConstructor(element,pcElement,attrs)}catch(e){return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx('[Source=Framework, Module=TcHmi.System.ControlManager] Constructor of control of type: "'+element.attr("data-tchmi-type")+'" and with id: "'+element.attr("id")+'" has thrown an exception:\n',e))}}static __procPrevinit(co){try{return co.__previnit(),!0}catch(e){try{TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx('[Source=Framework, Module=TcHmi.System.ControlManager] Function: "__previnit" of control of type: "'+co.getType()+'" and with id: "'+co.getId()+'" has thrown an exception:\n',e),co.destroy()}catch(e2){}return!1}}static __procInit(co){try{return co.__init(),!0}catch(e){try{TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx('[Source=Framework, Module=TcHmi.System.ControlManager] Function: "__init" of control of type: "'+co.getType()+'" and with id: "'+co.getId()+'" has thrown an exception:\n',e),co.destroy()}catch(e2){}return!1}}setControlProperty(control,propertyName,valueNew,dirtyPaths){let attribute=this.getAttributeByPropertyName(control,propertyName);if(!attribute){let reason="";return propertyName&&(reason=`Missing attribute description of attribute property: ${propertyName} for control type: ${control.getType()}.`),{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:reason,domain:"TcHmi.System.ControlManager"}}return attribute.readOnly?{code:TcHmi.Errors.E_SYMBOL_READONLY,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_READONLY],reason:`Property: ${propertyName} of control type: ${control.getType()} is readonly.`,domain:"TcHmi.System.ControlManager"}:attribute.propertySetterName?this.setControlPropertyByAttribute(control,attribute,valueNew,dirtyPaths):{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION],reason:`Missing propertySetterName in configuration of attribute property: ${propertyName} of control type: ${control.getType()}.`,domain:"TcHmi.System.ControlManager"}}setControlPropertyByAttribute(control,attribute,valueNew,dirtyPaths){let attributeSetter=control[attribute.propertySetterName];if("function"!=typeof attributeSetter)return{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:`Missing implementation of setter function: ${attribute.propertySetterName} for attribute property: ${attribute.propertyName} of control type: ${control.getType()}.`,domain:"TcHmi.System.ControlManager"};let watchNeeded=!1,prepValue={error:TcHmi.Errors.NONE,value:valueNew};if(null===valueNew){const themeValue=System.Services.themeManager.getDefaultPropertyValue(control,attribute.propertyName);"tchmi:framework#/definitions/Path"===attribute.type&&"string"==typeof themeValue.value&&themeValue.value.length>0?prepValue.value=TcHmi.Theme.Resources.resolveBasePath(control,themeValue)+themeValue.value:prepValue.value=themeValue.value,watchNeeded=!0}if(prepValue=TcHmi.ValueConverter.toTypeEx(prepValue.value,attribute.type),null===prepValue.value&&(null!==prepValue.value||null!==valueNew))return this.setControlPropertyByAttribute(control,attribute,null),{code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],reason:`Unable to convert value of type: ${typeof valueNew} to type: ${attribute.type} for attribute property: ${attribute.propertyName} of control of type: ${control.getType()} with id: ${control.getId()}.`,domain:"TcHmi.System.ControlManager",errors:prepValue.details?[prepValue.details]:void 0};try{attributeSetter.call(control,prepValue.value,dirtyPaths)}catch(e){return{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:`An uncaught exception occurred in setter function ${attribute.propertySetterName} of attribute property ${attribute.propertyName} of control of type ${control.getType()} with id ${control.getId()}`,exception:e,domain:"TcHmi.System.ControlManager"}}return watchNeeded&&"None"!==attribute.themeable?System.Services.themeManager.watchAttributeDefaults(control,attribute.propertyName):System.Services.themeManager.unwatchAttributeDefaults(control,attribute.propertyName),{code:TcHmi.Errors.NONE,message:TcHmi.Errors[TcHmi.Errors.NONE],domain:"TcHmi.System.ControlManager"}}destruct(control){const controlId=control.getId();this.__controlsGeoMap.has(controlId)&&this.__controlsGeoMap.delete(controlId),this.__controlsPresavedGeoMap.has(control)&&this.__controlsPresavedGeoMap.delete(control),this.__controls.has(controlId)?(this.__controls.delete(controlId),"function"!=typeof Proxy&&delete TcHmi.control[controlId]):TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.System.ControlManager] Unable to destroy control with id="+controlId+" because its already destroyed!")}compile(elem,parent,options){const controlType=elem.getAttribute("data-tchmi-type");if(!controlType)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Failed to compile control. Missing required attribute=data-tchmi-type in html="+elem.outerHTML+"."));const controlId=elem.id;if(!controlId)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Failed to compile control. Missing required attribute=id in html="+elem.outerHTML+"."));let module=TcHmi.System.Data.Modules.controls.map.get(controlType);if(!module)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Failed to compile control. Missing meta data for control type: "+controlType));if(module.error!==TcHmi.Errors.NONE||!module.reg){if(TCHMI_CONSOLE_LOG_LEVEL>=1){let message="[Source=Framework, Module=TcHmi.System.ControlManager] "+TcHmi.Log.buildMessage(module.errorDetails);TcHmi.Log.error(message)}return}if(module.reg.error!==TcHmi.Errors.NONE){if(TCHMI_CONSOLE_LOG_LEVEL>=1){let message="[Source=Framework, Module=TcHmi.System.ControlManager] "+TcHmi.Log.buildMessage(module.reg.errorDetails);TcHmi.Log.error(message)}return}TCHMI_DESIGNER&&options&&!0===options.designerIgnore&&elem.setAttribute("data-tchmi-designer-ignore","");let pcElement=$(elem.cloneNode(!0));if(TCHMI_DESIGNER&&(!options||options&&!options.designerIgnore)){let purl=null;if("TcHmi.Controls.System.TcHmiUserControl"===controlType)purl=tchmi_path(elem.getAttribute("data-tchmi-partial-url"));else{let rootUc=null;if(parent){let temp=parent;for(;temp;){if("TcHmi.Controls.System.TcHmiUserControl"===temp.getType()){rootUc=temp;break}temp=temp.getParent()}}rootUc&&(purl=tchmi_path(rootUc.getElement()[0].getAttribute("data-tchmi-partial-url")))}if(purl&&purl===tchmi_path(TCHMI_TARGET_PARTIAL)){let markup=elem.outerHTML;let exprsPartialParam=new TcHmi.System.SymbolExpressionParser(markup).resolveExpressionsBySymbolType(TcHmi.SymbolType.PartialParam);if(exprsPartialParam){for(let i=0,ii=exprsPartialParam.length;i<ii;i++){let expr=exprsPartialParam[i];const content=expr.getContent();content&&(markup=markup.replace(new RegExp(tchmi_escape_regex(`${expr.toString()}`),"g"),`%pp%TCHMI_TARGET_DESIGNER_PARTIALPARAM::${content}%/pp%`))}let tempDiv=document.createElement("div");tempDiv.innerHTML=markup,elem=tempDiv.firstElementChild}}}let attrs=TcHmi.System.resolveAttributesFromControlElement(elem);if(!TCHMI_ENGINEERING&&attrs.error!==TcHmi.Errors.NONE){let message='[Source=Framework, Module=TcHmi.System.ControlManager] Error while parsing attributes of control: "'+controlId+'". Details: '+TcHmi.Log.buildMessage(attrs.details);TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(message)}if(elem.textContent="",options?.overrideAttr)for(const[name,value]of Object.entries(options.overrideAttr)){if(void 0===value)continue;const descr=this.getDescriptionAttributeByName(controlType,name);if(attrs.value[name]={name:name,value:tchmi_clone_object(value),type:System.ControlAttributeType.General,valueType:"object"==typeof value?System.ControlAttributeValueType.Complex:System.ControlAttributeValueType.Simple,descr:descr},descr)attrs.value[name].type=System.ControlAttributeType.Control;else{const targetUserControl=attrs.value["data-tchmi-target-user-control"]?.value??options.overrideAttr["data-tchmi-target-user-control"]??void 0,targetUserControlConfig=targetUserControl?TcHmi.System.Data.Caches.partialCompositeConfigCache.get(tchmi_path(targetUserControl.replace(".usercontrol",".usercontrol.json"))):void 0;if(targetUserControlConfig&&targetUserControlConfig.parameters){let lowerCaseName=name.toLowerCase();for(const paramDescription of targetUserControlConfig.parameters)if(paramDescription.name.toLowerCase()===lowerCaseName){attrs.value[name].descr=paramDescription,attrs.value[name].descr&&(attrs.value[name].type=System.ControlAttributeType.UserControlParameter);break}}}attrs.value[name].descr||"object"==typeof value||elem.setAttribute(name,value)}let existingCo=this.__controls.get(controlId);if(void 0!==existingCo){const existingControlPartialUrl=existingCo.getElement().attr("data-tchmi-partial-url");return void(!TcHmi.System.isInitialized&&existingControlPartialUrl&&existingControlPartialUrl===elem.getAttribute("data-tchmi-partial-url")||TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi.System.ControlManager] Failed to create instance of control. The id: "'+controlId+'" does already exist.'))}let co=ControlManager.__procConstructor(module,$(elem),pcElement,attrs.value);if(void 0===co)return;if(this.__controlsWeak.add(co),parent||co.__setParent(null),this.__controls.set(controlId,co),"function"!=typeof Proxy&&(TcHmi.control[controlId]=co),parent){let pos=options?options.pos:void 0;parent.__addChild(co,pos)}if(module.descriptionExpanded?.inheritedTemplate){let template=TcHmi.System.Data.Caches.templateMarkupCache.get(module.descriptionExpanded.inheritedTemplate);if(void 0!==template){let tempDiv=document.createElement("div");tempDiv.innerHTML=template.replace(/{Id}/g,controlId);let templateElem=tempDiv.firstElementChild;if(templateElem){let __this=this,recCompTemplate=function(e){let eChildren=e.children;for(let i=0,ii=eChildren.length;i<ii;i++){let eChild=eChildren[i];if(eChild.hasAttribute("data-tchmi-type")){let cco=__this.compile(eChild,co,{designerIgnore:!0});co.__addChild(cco)}else eChild.hasChildNodes()&&recCompTemplate(eChild)}};recCompTemplate(templateElem),elem.appendChild(templateElem)}}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi.System.ControlManager] Template markup for control type: "'+co.getType()+'" is not available.')}if(!0!==ControlManager.__procPrevinit(co))return this.__controls.delete(controlId),void("function"!=typeof Proxy&&delete TcHmi.control[controlId]);const settedProperties=new Set,destroySettedPropertyWatch=TcHmi.EventProvider.register(controlId+".onPropertyChanged",((e,data)=>{data.propertyName&&settedProperties.add(data.propertyName)}));for(let htmlAttrName in attrs.value){let controlAttribute=attrs.value[htmlAttrName];if(void 0===controlAttribute.descr||null===controlAttribute.descr)continue;if(settedProperties.add(controlAttribute.descr.propertyName),"data-tchmi-trigger"===htmlAttrName)continue;let isSymbolExpression=TcHmi.Symbol.isSymbolExpression(controlAttribute.value),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(controlAttribute.value);if(!0===controlAttribute.descr.readOnly);else if(isSymbolExpression&&!isSymbolExpressionEscaped){let controlAttributeSchema=TcHmi.System.Services.typeManager.getSchema(controlAttribute.descr.type);"TcHmi.Symbol"!==controlAttributeSchema?.frameworkInstanceOf&&this.setControlPropertyByAttribute(co,controlAttribute.descr,null),TcHmi.System.Services.bindingManager.createBinding(controlAttribute.value,controlAttribute.descr.propertyName,co)}else{let prepValue=controlAttribute.value;isSymbolExpressionEscaped&&(prepValue=TcHmi.Symbol.escapeSymbolExpression(prepValue));let error=this.setControlPropertyByAttribute(co,controlAttribute.descr,prepValue);error&&error.code!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&(error.exception?TcHmi.Log.errorEx('[Source=Framework, Module=TcHmi.System.ControlManager] Failed to set property: "'+controlAttribute.descr.propertyName+'" of control: "'+controlId+'". '+TcHmi.Log.buildMessage(error),"\nException:",error.exception):TcHmi.Log.errorEx('[Source=Framework, Module=TcHmi.System.ControlManager] Failed to set property: "'+controlAttribute.descr.propertyName+'" of control: "'+controlId+'". '+TcHmi.Log.buildMessage(error)))}}destroySettedPropertyWatch(),TcHmi.Engineering.ErrorPane.remove(controlId+".requiredAttributeMissing");const descriptionAttributes=this.getDescriptionAttributes(controlType)??[];for(let possibleControlAttr of descriptionAttributes){if(possibleControlAttr.readOnly)continue;if(settedProperties.has(possibleControlAttr.propertyName))continue;if(possibleControlAttr.requiredOnCompile)return TcHmi.Engineering.ErrorPane.add(controlId+".requiredAttributeMissing","Error compiling control id="+controlId+" type="+co.getType()+". Attribute "+possibleControlAttr.propertyName+" is required but has not been set in HTML.",TcHmi.Engineering.ErrorPane.MessageType.Error),this.__controls.delete(controlId),void("function"!=typeof Proxy&&delete TcHmi.control[controlId]);let error=this.setControlPropertyByAttribute(co,possibleControlAttr,null);error&&error.code!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&(error.exception?TcHmi.Log.errorEx('[Source=Framework, Module=TcHmi.System.ControlManager] Failed to set property: "'+possibleControlAttr.propertyName+'" of control: "'+controlId+'". '+TcHmi.Log.buildMessage(error),"\nException:",error.exception):TcHmi.Log.errorEx('[Source=Framework, Module=TcHmi.System.ControlManager] Failed to set property: "'+possibleControlAttr.propertyName+'" of control: "'+controlId+'". '+TcHmi.Log.buildMessage(error)))}System.Services.themeManager.startAttributeSetterWatcher(co);let controlAttributeTrigger=attrs.value["data-tchmi-trigger"];if(null!=controlAttributeTrigger&&void 0!==controlAttributeTrigger.descr&&null!==controlAttributeTrigger.descr){let isSymbolExpression=TcHmi.Symbol.isSymbolExpression(controlAttributeTrigger.value),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(controlAttributeTrigger.value);if(!0===controlAttributeTrigger.descr.readOnly);else if(isSymbolExpression&&!isSymbolExpressionEscaped)TcHmi.System.Services.bindingManager.createBinding(controlAttributeTrigger.value,controlAttributeTrigger.descr.propertyName,co);else{let prepValue=controlAttributeTrigger.value;isSymbolExpressionEscaped&&(prepValue=TcHmi.Symbol.escapeSymbolExpression(prepValue));let error=this.setControlPropertyByAttribute(co,controlAttributeTrigger.descr,prepValue);error&&error.code!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&(error.exception?TcHmi.Log.errorEx('[Source=Framework, Module=TcHmi.System.ControlManager] Failed to set property: "Trigger" of control: "'+controlId+'". '+TcHmi.Log.buildMessage(error),"\nException:",error.exception):TcHmi.Log.errorEx('[Source=Framework, Module=TcHmi.System.ControlManager] Failed to set property: "Trigger" of control: "'+controlId+'". '+TcHmi.Log.buildMessage(error)))}}return co.__setLifeCycleState(15),!0!==ControlManager.__procInit(co)?(this.__controls.delete(controlId),void("function"!=typeof Proxy&&delete TcHmi.control[controlId])):co}__resolveDescriptionTypes(module){if(!module.descriptionExpanded||!module.description)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Internal error. DescriptionExpanded or Description not found."));module.descriptionExpanded.inheritedTypes=[];let base=module.descriptionExpanded.base;if(null!=base){let baseModule=TcHmi.System.Data.Modules.controls.map.get(base);if(!baseModule)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Resolving description types of control "+module.description.name+' failed: Base control "'+base+'" not found.'));if(baseModule.error!==TcHmi.Errors.NONE)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Resolving description types of control "+module.description.name+' failed: Base control module "'+base+'" contains errors: '+TcHmi.Log.buildMessage(baseModule.errorDetails)));this.__resolveDescriptionTypes(baseModule);let baseInhertedTypes=this.getDescriptionTypes(base);for(let i=0,ii=baseInhertedTypes.length;i<ii;i++){let bitype=baseInhertedTypes[i];module.descriptionExpanded.inheritedTypes.includes(bitype)||module.descriptionExpanded.inheritedTypes.push(bitype);let bitypeLegacy=System.mapControlNamesFromPackageManifestApi1ToApi0.get(bitype);bitypeLegacy&&(module.descriptionExpanded.inheritedTypes.includes(bitypeLegacy)||module.descriptionExpanded.inheritedTypes.push(bitypeLegacy))}}let type=TcHmi.System.resolveQualifiedName(module.description.name,module.description.namespace);module.descriptionExpanded.inheritedTypes.push(type);let legacyType=System.mapControlNamesFromPackageManifestApi1ToApi0.get(type);legacyType&&module.descriptionExpanded.inheritedTypes.push(legacyType)}__resolveDescriptionInheritance(module){if(!module.descriptionExpanded||!module.description)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Internal error. DescriptionExpanded or Description not found."));let baseAttrs=[],baseAccess=[],baseFunctions=[],baseEvents=[],baseLanguages={};module.descriptionExpanded.inheritedAttributes=[],module.descriptionExpanded.inheritedAttributesNameMap=new Map,module.descriptionExpanded.inheritedAttributesPropertyNameMap=new Map,module.descriptionExpanded.inheritedAttributesPropertyGetterNameMap=new Map,module.descriptionExpanded.inheritedAttributesPropertySetterNameMap=new Map,module.descriptionExpanded.inheritedAccess=[],module.descriptionExpanded.inheritedFunctions=[],module.descriptionExpanded.inheritedEvents=[],module.descriptionExpanded.inheritedLanguages={};let base=module.descriptionExpanded.base;if(null!=base){let baseModule=TcHmi.System.Data.Modules.controls.map.get(base);if(!baseModule)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Resolving description inheritance of control "+module.description.name+' failed: Base control "'+base+'" not found.'));if(baseModule.error!==TcHmi.Errors.NONE||!baseModule.descriptionExpanded)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Resolving description inheritance of control "+module.description.name+' failed: Base control module "'+base+'" contains errors: '+TcHmi.Log.buildMessage(baseModule.errorDetails)));this.__resolveDescriptionInheritance(baseModule);let baseInheritedAttributes=baseModule.descriptionExpanded.inheritedAttributes;if(void 0!==baseInheritedAttributes)for(let i=0,ii=baseInheritedAttributes.length;i<ii;i++)!1!==baseInheritedAttributes[i].heritable&&baseAttrs.push(baseInheritedAttributes[i]);let baseInheritedAccess=baseModule.descriptionExpanded.inheritedAccess;void 0!==baseInheritedAccess&&0!==baseInheritedAccess.length&&(baseAccess=baseAccess.concat(baseInheritedAccess));let baseInheritedFunctions=baseModule.descriptionExpanded.inheritedFunctions;void 0!==baseInheritedFunctions&&0!==baseInheritedFunctions.length&&(baseFunctions=baseFunctions.concat(baseInheritedFunctions));let baseInheritedEvents=baseModule.descriptionExpanded.inheritedEvents;void 0!==baseInheritedEvents&&0!==baseInheritedEvents.length&&(baseEvents=baseEvents.concat(baseInheritedEvents));let baseInheritedLanguages=baseModule.descriptionExpanded.inheritedLanguages;if(null!=baseInheritedLanguages)for(let key in baseInheritedLanguages)baseLanguages[key]=baseInheritedLanguages[key]}let attributes=tchmi_clone_object(module.descriptionExpanded.attributes);null==attributes&&(attributes=[]);for(let i=0,ii=baseAttrs.length;i<ii;i++){let bOverwriteExists=!1;for(let j=0,jj=attributes.length;j<jj;j++)if(attributes[j].name.toLowerCase()===baseAttrs[i].name.toLowerCase()){bOverwriteExists=!0;break}!1===bOverwriteExists&&module.descriptionExpanded.inheritedAttributes.push(baseAttrs[i])}module.descriptionExpanded.inheritedAttributes=module.descriptionExpanded.inheritedAttributes.concat(attributes);for(let k=0,kk=module.descriptionExpanded.inheritedAttributes.length;k<kk;k++){let attr=module.descriptionExpanded.inheritedAttributes[k];module.descriptionExpanded.inheritedAttributesNameMap.set(attr.name.toLowerCase(),attr),attr.propertyName?module.descriptionExpanded.inheritedAttributesPropertyNameMap.set(attr.propertyName.toLowerCase(),attr):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi.System.ControlManager] Description.json of control type "'+module.descriptionExpanded.displayName+'" attribute "'+attr.name+'" has no propertyName entry. Handling this attribute will not work.'),attr.propertyGetterName?module.descriptionExpanded.inheritedAttributesPropertyGetterNameMap.set(attr.propertyGetterName.toLowerCase(),attr):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi.System.ControlManager] Description.json of control type "'+module.descriptionExpanded.displayName+'" attribute "'+attr.name+'" has no propertyGetterName entry. Handling this attribute will not work.'),attr.propertySetterName?module.descriptionExpanded.inheritedAttributesPropertySetterNameMap.set(attr.propertySetterName.toLowerCase(),attr):attr.readOnly||TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi.System.ControlManager] Description.json of control type "'+module.descriptionExpanded.displayName+'" attribute "'+attr.name+'" has no propertySetterName entry. Handling this attribute will not work.')}let access=module.descriptionExpanded.access;null==access&&(access=[]);for(let i=0,ii=baseAccess.length;i<ii;i++){let bOverwriteExists=!1;for(let j=0,jj=access.length;j<jj;j++)if(access[j].name===baseAccess[i].name){bOverwriteExists=!0;break}!1===bOverwriteExists&&module.descriptionExpanded.inheritedAccess.push(baseAccess[i])}0!==access.length&&(module.descriptionExpanded.inheritedAccess=module.descriptionExpanded.inheritedAccess.concat(access));let functions=module.descriptionExpanded.functions;null==functions&&(functions=[]);for(let i=0,ii=baseFunctions.length;i<ii;i++){let bOverwriteExists=!1;for(let j=0,jj=functions.length;j<jj;j++)if(functions[j].name===baseFunctions[i].name){bOverwriteExists=!0;break}!1===bOverwriteExists&&module.descriptionExpanded.inheritedFunctions.push(baseFunctions[i])}0!==functions.length&&(module.descriptionExpanded.inheritedFunctions=module.descriptionExpanded.inheritedFunctions.concat(functions));let events=module.descriptionExpanded.events;null==events&&(events=[]);for(let i=0,ii=baseEvents.length;i<ii;i++){let bOverwriteExists=!1;for(let j=0,jj=events.length;j<jj;j++)if(events[j].name===baseEvents[i].name){bOverwriteExists=!0;break}!1===bOverwriteExists&&module.descriptionExpanded.inheritedEvents.push(baseEvents[i])}0!==events.length&&(module.descriptionExpanded.inheritedEvents=module.descriptionExpanded.inheritedEvents.concat(events));let languages=module.descriptionExpanded.languages;null==languages&&(languages={});for(let keyBase in baseLanguages){let bOverwriteExists=!1;for(let keyCurrent in languages)if(keyCurrent===keyBase){bOverwriteExists=!0;break}!1===bOverwriteExists&&(module.descriptionExpanded.inheritedLanguages[keyBase]=baseLanguages[keyBase])}if(0!==events.length)for(let key in languages)module.descriptionExpanded.inheritedLanguages[key]=languages[key]}__resolveInheritanceHierarchy(module){if(!module||module.error!==TcHmi.Errors.NONE||!module.descriptionExpanded)return null;const newEntry={controlType:TcHmi.System.resolveQualifiedName(module.descriptionExpanded.name,module.descriptionExpanded.namespace),children:[]};if(module.descriptionExpanded.base){let findInheritanceBaseObj=(controlType,level)=>{if(!level){if(!module.descriptionExpanded)return null;let baseModule=TcHmi.System.Data.Modules.controls.map.get(module.descriptionExpanded.base);return this.__resolveInheritanceHierarchy(baseModule)}if(controlType===level.controlType)return level;for(let iterator=0;iterator<level.children.length;iterator++){let childEntry=level.children[iterator],subtreeHit=findInheritanceBaseObj(controlType,childEntry);if(subtreeHit)return subtreeHit}return null},inheritanceBaseObj=findInheritanceBaseObj(module.descriptionExpanded.base,this.__inheritanceHierarchyTree);if(inheritanceBaseObj){for(let iterator=0;iterator<inheritanceBaseObj.children.length;iterator++){let childEntry=inheritanceBaseObj.children[iterator];if(childEntry.controlType===TcHmi.System.resolveQualifiedName(module.descriptionExpanded.name,module.descriptionExpanded.namespace))return childEntry}inheritanceBaseObj.children.push(newEntry)}else{let baseModule=TcHmi.System.Data.Modules.controls.map.get(module.descriptionExpanded.base),inheritanceNewBaseObj=this.__resolveInheritanceHierarchy(baseModule);if(!inheritanceNewBaseObj)return null;inheritanceNewBaseObj.children.push(newEntry)}}else{if(this.__inheritanceHierarchyTree)return this.__inheritanceHierarchyTree;this.__inheritanceHierarchyTree=newEntry}return newEntry}__resolveTemplateInheritation(module){if(!(module&&module.descriptionExpanded&&module.manifestData&&module.package))return;let resolve=function(type){let module=TcHmi.System.Data.Modules.controls.map.get(type);if(module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded&&module.manifestData&&module.package)return module.descriptionExpanded.template?tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+module.descriptionExpanded.template):resolve(module.descriptionExpanded.base)};if(module.descriptionExpanded.template){let templateKey=tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+module.descriptionExpanded.template);module.descriptionExpanded.inheritedTemplate=templateKey}else module.descriptionExpanded.inheritedTemplate=resolve(module.descriptionExpanded.base)}__validateDescriptionAttributes(module){if(module&&module.description)for(const attribute of module.description.attributes){const res=TcHmi.System.Services.typeManager.getSchemaEx(attribute.type);res.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Attribute "+attribute.propertyName+" of control "+System.resolveQualifiedName(module.description?.name??"",module.description?.namespace)+" uses invalid data type "+attribute.type+": "+TcHmi.Log.buildMessage(res.details))}}resolveDescriptionInheritation(){try{const modulesSorted=Array.from(TcHmi.System.Data.Modules.controls.array);modulesSorted.sort(((a,b)=>a.descriptionExpanded?.base===b.descriptionExpanded?.name?1:b.descriptionExpanded?.base===a.descriptionExpanded?.name?-1:0));for(const module of modulesSorted)module&&module.descriptionExpanded&&!module.descriptionExpanded.inheritationResolved&&(this.__resolveDescriptionTypes(module),this.__resolveDescriptionInheritance(module),this.__resolveInheritanceHierarchy(module),this.__resolveTemplateInheritation(module),module.descriptionExpanded.inheritationResolved=!0)}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ControlManager] resolveDescriptionInheritation failed with exception:\n",e)}}getInheritanceTree(){return this.__inheritanceHierarchyTree}getDescription(type){if(!type)return null;let module=TcHmi.System.Data.Modules.controls.map.get(type);return module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded?module.descriptionExpanded:null}getDescriptionTypes(type){if(!type)return[];let module=TcHmi.System.Data.Modules.controls.map.get(type);return module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded&&module.descriptionExpanded.inheritedTypes?module.descriptionExpanded.inheritedTypes:[]}isRegisteredDescriptionType(type){return!!type&&TcHmi.System.Data.Modules.controls.map.has(type)}getDescriptionPath(type){if(!type)return null;let module=TcHmi.System.Data.Modules.controls.map.get(type);return module&&module.error===TcHmi.Errors.NONE&&module.package&&module.manifestData?tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+module.manifestData.descriptionFile):null}getDescriptionAttributes(type){if(!type)return null;let module=TcHmi.System.Data.Modules.controls.map.get(type);return module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded&&module.descriptionExpanded.inheritedAttributes?module.descriptionExpanded.inheritedAttributes:null}getDescriptionAccess(type){if(!type)return null;let module=TcHmi.System.Data.Modules.controls.map.get(type);return module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded&&module.descriptionExpanded.inheritedAccess?module.descriptionExpanded.inheritedAccess:null}getDescriptionAttributeByName(type,name){if(!type||!name)return null;const lowerName=name.toLowerCase();let module=TcHmi.System.Data.Modules.controls.map.get(type);if(module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded){let res=module.descriptionExpanded.inheritedAttributesNameMap.get(lowerName);return res||null}return null}getDescriptionAttributeByPropertyName(type,propertyName){if(!type||!propertyName)return null;const lowerName=propertyName.toLowerCase();let module=TcHmi.System.Data.Modules.controls.map.get(type);if(module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded){let res=module.descriptionExpanded.inheritedAttributesPropertyNameMap.get(lowerName);return res||null}return null}getUserControlConfigAttributeByPropertyName(ucConfigUrl,propertyName){let UCEntry=this.__usercontrolAttrDescrByPropertyName.get(ucConfigUrl);if(!UCEntry)return null;let res=UCEntry.get(propertyName);return res||null}getDescriptionAttributeByPropertySetterName(type,propertySetterName){if(!type||!propertySetterName)return null;const lowerName=propertySetterName.toLowerCase();let module=TcHmi.System.Data.Modules.controls.map.get(type);if(module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded){let res=module.descriptionExpanded.inheritedAttributesPropertySetterNameMap.get(lowerName);return res||null}return null}getDescriptionAttributeByPropertyGetterName(type,propertyGetterName){if(!type||!propertyGetterName)return null;const lowerName=propertyGetterName.toLowerCase();let module=TcHmi.System.Data.Modules.controls.map.get(type);if(module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded){let res=module.descriptionExpanded.inheritedAttributesPropertyGetterNameMap.get(lowerName);return res||null}return null}getDescriptionLanguages(type){if(!type)return null;let module=TcHmi.System.Data.Modules.controls.map.get(type);if(module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded){let res=module.descriptionExpanded.inheritedLanguages;return res||null}return null}getAttributeByPropertyName(control,propertyName){if(!propertyName)return null;let type=control.getType(),attr=this.getDescriptionAttributeByPropertyName(type,propertyName);if(attr)return attr;if("TcHmi.Controls.System.TcHmiUserControlHost"===type){const targetUserControl=control.getTargetUserControl();if(targetUserControl){let ucConfigUrl=tchmi_path(targetUserControl.replace(".usercontrol",".usercontrol.json"));if(attr=this.getUserControlConfigAttributeByPropertyName(ucConfigUrl,propertyName),attr)return attr}}return null}getAttributeTypeByPropertyName(control,propertyName){if(!control)return System.ControlAttributeType.Invalid;let type=control.getType(),attr=this.getDescriptionAttributeByPropertyName(type,propertyName);if(attr)return System.ControlAttributeType.Control;if("TcHmi.Controls.System.TcHmiUserControlHost"===type){const targetUserControl=control.getTargetUserControl();if(targetUserControl){const ucConfigUrl=tchmi_path(targetUserControl.replace(".usercontrol",".usercontrol.json"));if(attr=this.getUserControlConfigAttributeByPropertyName(ucConfigUrl,propertyName),attr)return System.ControlAttributeType.UserControlParameter}}return System.ControlAttributeType.Invalid}getAttributeByPropertySetterName(control,propertySetterName){if(!control)return null;let type=control.getType(),attr=TcHmi.System.Services.controlManager.getDescriptionAttributeByPropertySetterName(type,propertySetterName);if(attr)return attr;if("TcHmi.Controls.System.TcHmiUserControlHost"===type){const targetUserControl=control.getTargetUserControl();if(targetUserControl){let ucConfigUrl=tchmi_path(targetUserControl.replace(".usercontrol",".usercontrol.json")),UCEntry=this.__usercontrolAttrDescrBySetterName.get(ucConfigUrl);if(UCEntry){let UCattr=UCEntry.get(propertySetterName);if(UCattr)return UCattr}}}return null}getAttributeByPropertyGetterName(control,propertyGetterName){if(!control)return null;let type=control.getType(),attr=TcHmi.System.Services.controlManager.getDescriptionAttributeByPropertyGetterName(type,propertyGetterName);if(attr)return attr;if("TcHmi.Controls.System.TcHmiUserControlHost"===type){const targetUserControl=control.getTargetUserControl();if(targetUserControl){let ucConfigUrl=tchmi_path(targetUserControl.replace(".usercontrol",".usercontrol.json")),UCEntry=this.__usercontrolAttrDescrByGetterName.get(ucConfigUrl);if(UCEntry){let UCattr=UCEntry.get(propertyGetterName);if(UCattr)return UCattr}}}return null}getDescriptionAccessByName(type,name){let res=null,access=this.getDescriptionAccess(type);if(access)for(const acc of access)if(acc.name===name){res=acc;break}return res}}System.ControlManager=ControlManager}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Diagnostics){class Server{static start(lazy=!1){lazy&&!TCHMI_DIAGNOSTICS_SERVER||(lazy||(TCHMI_DIAGNOSTICS_SERVER=!0),Server.__data={requestsHistory:new Map,requestsCache:new Map,requestsQueue:new Map,requestsQueuePendingRequest:null,dumps:{lastDumpDate:null,lastDumpTimestamp:0,data:[]}})}static stop(){TCHMI_DIAGNOSTICS_SERVER=!1}static requestRegistered(request){if(!TCHMI_DIAGNOSTICS_SERVER)return;if(!Server.__data)return;let requestDiag={message:request.message,timestampRegistered:performance.now()};if(Server.__data.requestsCache.set(request,requestDiag),Server.__data.requestsHistory.size>=TCHMI_DIAGNOSTICS_SERVER_REQUEST_HISTORY_MAX_BUFFER){const[requestHistory]=Server.__data.requestsHistory.keys();Server.__data.requestsHistory.delete(requestHistory)}Server.__data.requestsHistory.set(request,requestDiag)}static requestQueued(request){if(!TCHMI_DIAGNOSTICS_SERVER)return;let requestDiag=Server.__data?.requestsCache.get(request);requestDiag&&(requestDiag.timestampQueued=performance.now(),Server.__data?.requestsQueue.set(request,requestDiag))}static requestSent(request){if(TCHMI_DIAGNOSTICS_SERVER&&Server.__data){let requestDiag=Server.__data.requestsCache.get(request);requestDiag&&(requestDiag.timestampSent=performance.now(),request.queuePending&&(Server.__data.requestsQueuePendingRequest&&(Server.__data.requestsQueuePendingRequest.requestDiag.timestampQueuePendingEnd=performance.now()),Server.__data.requestsQueuePendingRequest={request:request,requestDiag:requestDiag},requestDiag.timestampQueuePendingBegin=performance.now()))}}static requestReceived(request,response){if(!TCHMI_DIAGNOSTICS_SERVER)return;let requestDiag=Server.__data?.requestsCache.get(request);if(requestDiag){let now=performance.now();if(requestDiag.timestampReceived||(requestDiag.timestampReceived=now),TCHMI_DIAGNOSTICS_SERVER_REQUEST_RESPONSE_HISTORY_MAX_BUFFER>0)if(requestDiag.responseFirst){requestDiag.responsesLast||(requestDiag.responsesLast=[]),requestDiag.responsesLast.length>=TCHMI_DIAGNOSTICS_SERVER_REQUEST_RESPONSE_HISTORY_MAX_BUFFER&&requestDiag.responsesLast.shift();let record={timestampReceived:now};TCHMI_DIAGNOSTICS_SERVER_REQUEST_RESPONSE_HISTORY_MESSAGES&&(record.message=response),requestDiag.responsesLast.push(record)}else requestDiag.responseFirst={timestampReceived:now},TCHMI_DIAGNOSTICS_SERVER_REQUEST_RESPONSE_HISTORY_MESSAGES&&(requestDiag.responseFirst.message=response)}}static requestUnqueued(request){if(TCHMI_DIAGNOSTICS_SERVER&&Server.__data){let requestDiag=Server.__data.requestsQueue.get(request);requestDiag&&(requestDiag.timestampUnqueued=performance.now(),Server.__data.requestsQueue.delete(request))}}static requestPendingDone(request){TCHMI_DIAGNOSTICS_SERVER&&Server.__data&&!request.queuePending&&Server.__data.requestsQueuePendingRequest&&Server.__data.requestsQueuePendingRequest.request===request&&(Server.__data.requestsQueuePendingRequest.requestDiag.timestampQueuePendingEnd=performance.now(),Server.__data.requestsQueuePendingRequest=null)}static requestUnregistered(request){if(!TCHMI_DIAGNOSTICS_SERVER)return;let requestDiag=Server.__data?.requestsCache.get(request);requestDiag&&(requestDiag.timestampUnregistered=performance.now()),Server.__data?.requestsCache.delete(request)}static clear(){TCHMI_DIAGNOSTICS_SERVER||delete Server.__data}static reset(){TCHMI_DIAGNOSTICS_SERVER||(Server.__data={requestsHistory:new Map,requestsCache:new Map,requestsQueue:new Map,requestsQueuePendingRequest:null,dumps:{lastDumpDate:null,lastDumpTimestamp:0,data:[]}})}static evalTimes(requestDiag){performance.now();requestDiag.timestampUnregistered&&requestDiag.timestampRegistered&&(requestDiag.timeRegistered=requestDiag.timestampUnregistered-requestDiag.timestampRegistered),requestDiag.timestampUnqueued&&requestDiag.timestampQueued&&(requestDiag.timeInQueue=requestDiag.timestampUnqueued-requestDiag.timestampQueued),requestDiag.timestampReceived&&requestDiag.timestampSent&&(requestDiag.timeServer=requestDiag.timestampReceived-requestDiag.timestampSent),requestDiag.timestampQueuePendingBegin&&requestDiag.timestampQueuePendingEnd&&(requestDiag.timeQueuePending=requestDiag.timestampQueuePendingEnd-requestDiag.timestampQueuePendingBegin)}static dump(){if(!TCHMI_DIAGNOSTICS_SERVER)throw new Error("TcHmi.System.Diagnostics.Server is not active. Either define 'TCHMI_DIAGNOSTICS_SERVER = true;' or call 'TcHmi.System.Diagnostics.Server.start()' before calling this function.");if(!Server.__data)return;let requestsHistoryDiag=[];Server.__data.requestsHistory.forEach((requestDiag=>{let clone=tchmi_clone_object(requestDiag);Server.evalTimes(clone),requestsHistoryDiag.push(clone)}));let requestsCacheDiag=[];Server.__data.requestsCache.forEach((requestDiag=>{let clone=tchmi_clone_object(requestDiag);Server.evalTimes(clone),requestsCacheDiag.push(clone)}));let requestsQueueDiag=[];Server.__data.requestsQueue.forEach((requestDiag=>{let clone=tchmi_clone_object(requestDiag);Server.evalTimes(clone),requestsQueueDiag.push(clone)}));let requestsQueuePendingRequestDiag=tchmi_clone_object(Server.__data.requestsQueuePendingRequest?.requestDiag)??null;requestsQueuePendingRequestDiag&&Server.evalTimes(requestsQueuePendingRequestDiag),Server.__data.dumps.lastDumpDate=(new Date).toISOString(),Server.__data.dumps.lastDumpTimestamp=performance.now(),Server.__data.dumps.data.push({requestsHistory:requestsHistoryDiag,requestsCache:requestsCacheDiag,requestsQueue:requestsQueueDiag,requestsQueuePendingRequest:requestsQueuePendingRequestDiag})}static cyclicDump(interval){if(!TCHMI_DIAGNOSTICS_SERVER)throw new Error("TcHmi.System.Diagnostics.Server is not active. Either define 'TCHMI_DIAGNOSTICS_SERVER = true;' or call 'TcHmi.System.Diagnostics.Server.start()' before calling this function.");if("number"!=typeof interval)throw new Error("Argument 'interval must be defined and of type 'number'.");Server.__cyclicDumpInterval>0&&clearInterval(Server.__cyclicDumpInterval),Server.__cyclicDumpInterval=setInterval((()=>{Server.dump()}),interval)}static cyclicDumpAbort(){if(!TCHMI_DIAGNOSTICS_SERVER)throw new Error("TcHmi.System.Diagnostics.Server is not active. Either define 'TCHMI_DIAGNOSTICS_SERVER = true;' or call 'TcHmi.System.Diagnostics.Server.start()' before calling this function.");Server.__cyclicDumpInterval>0&&(clearInterval(Server.__cyclicDumpInterval),Server.__cyclicDumpInterval=0)}static download(){if(!Server.__data)return;const downloaderAElement=document.createElement("a");downloaderAElement.download="TcHmi.System.Diagnostics.Server_"+(new Date).toISOString()+".json",downloaderAElement.href="data:application/json;charset=utf8,"+encodeURI(JSON.stringify(Server.__data.dumps)),downloaderAElement.style.display="none",document.body.appendChild(downloaderAElement),downloaderAElement.click(),downloaderAElement.remove()}static print(){if(!Server.__data||!Server.__data.dumps||!Server.__data.dumps.data)return;let po={lastDumpDate:Server.__data.dumps.lastDumpDate,lastDumpTimestamp:Server.__data.dumps.lastDumpTimestamp,data:[]};Server.__data.dumps.data.forEach((dump=>{let historyRequestsByTime=[],historyRequestsByServerTime=[],historyRequestsByQueueTime=[],historyRequestsByQueuePendingTime=[],historyRequestsSubscriptionResponseTimes=[];dump.requestsHistory.forEach((request=>{if(void 0!==request.timeRegistered&&historyRequestsByTime.push(request),void 0!==request.timeServer&&historyRequestsByServerTime.push(request),void 0!==request.timeInQueue&&historyRequestsByQueueTime.push(request),void 0!==request.timeQueuePending&&historyRequestsByQueuePendingTime.push(request),"Subscription"===request.message?.requestType){let responseTimes=[];if(request.responsesLast){let responseTimestampRecievedLast=0;for(let i=0;i<request.responsesLast.length;i++){let response=request.responsesLast[i],responseTimestampRecieved=response.timestampReceived;if(responseTimestampRecievedLast&&responseTimestampRecieved){let time=responseTimestampRecieved-responseTimestampRecievedLast;responseTimes.push(time)}responseTimestampRecievedLast=response.timestampReceived}}responseTimes.length>0&&historyRequestsSubscriptionResponseTimes.push({request:request,responseTimes:responseTimes})}})),historyRequestsByTime.sort(((a,b)=>a.timeRegistered<b.timeRegistered?1:a.timeRegistered>b.timeRegistered?-1:0)),historyRequestsByServerTime.sort(((a,b)=>a.timeServer<b.timeServer?1:a.timeServer>b.timeServer?-1:0)),historyRequestsByQueueTime.sort(((a,b)=>a.timeInQueue<b.timeInQueue?1:a.timeInQueue>b.timeInQueue?-1:0)),historyRequestsByQueuePendingTime.sort(((a,b)=>a.timeQueuePending<b.timeQueuePending?1:a.timeQueuePending>b.timeQueuePending?-1:0));let cacheRequestsByTime=[],cacheRequestsByServerTime=[],cacheRequestsByQueueTime=[],cacheRequestsByQueuePendingTime=[],cacheRequestsSubscriptionResponseTimes=[];dump.requestsCache.forEach((request=>{if(void 0!==request.timeRegistered&&cacheRequestsByTime.push(request),void 0!==request.timeServer&&cacheRequestsByServerTime.push(request),void 0!==request.timeInQueue&&cacheRequestsByQueueTime.push(request),void 0!==request.timeQueuePending&&cacheRequestsByQueuePendingTime.push(request),"Subscription"===request.message?.requestType){let responseTimes=[];if(request.responsesLast){let responseTimestampRecievedLast=0;for(let i=0;i<request.responsesLast.length;i++){let response=request.responsesLast[i],responseTimestampRecieved=response.timestampReceived;if(responseTimestampRecievedLast&&responseTimestampRecieved){let time=responseTimestampRecieved-responseTimestampRecievedLast;responseTimes.push(time)}responseTimestampRecievedLast=response.timestampReceived}}responseTimes.length>0&&cacheRequestsSubscriptionResponseTimes.push({request:request,responseTimes:responseTimes})}})),cacheRequestsByTime.sort(((a,b)=>a.timeRegistered<b.timeRegistered?1:a.timeRegistered>b.timeRegistered?-1:0)),cacheRequestsByServerTime.sort(((a,b)=>a.timeServer<b.timeServer?1:a.timeServer>b.timeServer?-1:0)),cacheRequestsByQueueTime.sort(((a,b)=>a.timeInQueue<b.timeInQueue?1:a.timeInQueue>b.timeInQueue?-1:0)),cacheRequestsByQueuePendingTime.sort(((a,b)=>a.timeQueuePending<b.timeQueuePending?1:a.timeQueuePending>b.timeQueuePending?-1:0));let clone=tchmi_clone_object(dump);clone&&(clone.eval={requestsHistory:{requestsByTime:historyRequestsByTime,requestsByServerTime:historyRequestsByServerTime,requestsByQueueTime:historyRequestsByQueueTime,requestsByQueuePendingTime:historyRequestsByQueuePendingTime,subscriptionResponseTimes:historyRequestsSubscriptionResponseTimes},requestsCache:{requestsByTime:cacheRequestsByTime,requestsByServerTime:cacheRequestsByServerTime,requestsByQueueTime:cacheRequestsByQueueTime,requestsByQueuePendingTime:cacheRequestsByQueuePendingTime,subscriptionResponseTimes:cacheRequestsSubscriptionResponseTimes}},po.data.push(clone))})),console.log("TcHmi.System.Diagnostics.Server:",po)}}Server.__cyclicDumpInterval=0,Diagnostics.Server=Server}(System.Diagnostics||(System.Diagnostics={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.DialogManager=class{constructor(){this.__currentDialogType=0,this.__currentHtmlContent=null,this.__currentForceable=!1,this.__currentPreserve=!1,this.__dialogOwner=null;let tempDivOverlayDialogContainer=document.createElement("div");tempDivOverlayDialogContainer.innerHTML='<div id="tchmi-overlaysystemdialog-container" class="tchmi-box"><div id="tchmi-overlaysystemdialog-background" class="tchmi-box"></div><div class="tchmi-overlaysystemdialog-message tchmi-box"></div><input id="tchmi-overlaysystemdialog-dismissbutton" type="button" value="Close" style="display:none;"></input></div>',this.__elementOverlayDialogContainer=tempDivOverlayDialogContainer.firstElementChild;const interceptInteraction=function(evt){evt.stopPropagation()};let backgroundElement=this.__elementOverlayDialogContainer.querySelector("#tchmi-overlaysystemdialog-background");if(!backgroundElement)throw new SyntaxError("Internal error. Did not find tchmi-overlaysystemdialog-background element.");let eventOptions={passive:!1,capture:!1};backgroundElement.addEventListener("mousedown",interceptInteraction,eventOptions),backgroundElement.addEventListener("click",interceptInteraction,eventOptions),backgroundElement.addEventListener("mouseup",interceptInteraction,eventOptions),backgroundElement.addEventListener("touchstart",interceptInteraction,eventOptions),backgroundElement.addEventListener("touchend",interceptInteraction,eventOptions);let tempDivWatermarkDialogContainer=document.createElement("div");tempDivWatermarkDialogContainer.innerHTML='<div id="tchmi-watermarksystemdialog-container" class="tchmi-box"><div id="tchmi-watermarksystemdialog-background" class="tchmi-box"></div><div class="tchmi-watermarksystemdialog-message tchmi-box"></div></div>',this.__elementWatermarkDialogContainer=tempDivWatermarkDialogContainer.firstElementChild}showDialog(dialogOwner,bVisibility,dialogType=TcHmi.DialogManager.DialogType.Overlay,options){if(null!==dialogOwner&&!(null===this.__dialogOwner||!0===this.__currentForceable||options&&!0===options.force||this.__dialogOwner===dialogOwner))return!1;if(this.__currentForceable=options?.forceable??!1,this.__dialogOwner=dialogOwner,!0===bVisibility)if(this.__currentDialogType=dialogType,dialogType===TcHmi.DialogManager.DialogType.Overlay){const elementDissmissButton=this.__elementOverlayDialogContainer.querySelector("#tchmi-overlaysystemdialog-dismissbutton");options&&!0===options.cancelable?(elementDissmissButton.addEventListener("click",(()=>{TcHmi.System.Services.dialogManager.showDialog(null,!1)})),elementDissmissButton.style.display=""):elementDissmissButton.style.display="none",this.__elementWatermarkDialogContainer.parentElement&&this.__elementWatermarkDialogContainer.parentElement.removeChild(this.__elementWatermarkDialogContainer),document.body&&!document.body.contains(this.__elementOverlayDialogContainer)&&document.body.appendChild(this.__elementOverlayDialogContainer)}else dialogType===TcHmi.DialogManager.DialogType.Watermark&&(this.__elementOverlayDialogContainer.parentElement&&this.__elementOverlayDialogContainer.parentElement.removeChild(this.__elementOverlayDialogContainer),document.body&&!document.body.contains(this.__elementWatermarkDialogContainer)&&document.body.appendChild(this.__elementWatermarkDialogContainer));else!1===bVisibility&&(this.__elementOverlayDialogContainer.parentElement&&this.__elementOverlayDialogContainer.parentElement.removeChild(this.__elementOverlayDialogContainer),this.__elementWatermarkDialogContainer.parentElement&&this.__elementWatermarkDialogContainer.parentElement.removeChild(this.__elementWatermarkDialogContainer),this.__dialogOwner=null);return!0}updateText(dialogOwner,newHtmlContent,severity=TcHmi.DialogManager.DialogSeverity.Info){return this.updateTextEx(dialogOwner,newHtmlContent,{dialogType:TcHmi.DialogManager.DialogType.Overlay,severity:severity})}updateTextEx(dialogOwner,newHtmlContent,options){if(null!==dialogOwner&&null!==this.__dialogOwner&&this.__dialogOwner!==dialogOwner)return!1;if(this.__dialogOwner=dialogOwner,newHtmlContent===this.__currentHtmlContent)return!1;this.__currentHtmlContent=newHtmlContent;const dialogType=options?.dialogType??TcHmi.DialogManager.DialogType.Overlay,severity=options?.severity??TcHmi.DialogManager.DialogSeverity.Info;if(newHtmlContent&&options&&options.buttonReload&&(newHtmlContent+='<br/>\n<br/>\n<input type="submit" value="'+(TcHmi.System.Services.localization?.getText("Reload",{level:TcHmi.Locale.Level.Engineering})??"Reload")+'" style="padding:10px;" onclick="window.location.reload()">'),dialogType===TcHmi.DialogManager.DialogType.Overlay){let elementMessage=this.__elementOverlayDialogContainer.querySelector(".tchmi-overlaysystemdialog-message");elementMessage&&(elementMessage.innerHTML=newHtmlContent),elementMessage.style.display=newHtmlContent?"":"none",this.__elementOverlayDialogContainer.classList.toggle("tchmi-overlaysystemdialog-error",severity===TcHmi.DialogManager.DialogSeverity.Error),this.__elementOverlayDialogContainer.classList.toggle("tchmi-overlaysystemdialog-warning",severity===TcHmi.DialogManager.DialogSeverity.Warning),this.__elementOverlayDialogContainer.classList.toggle("tchmi-overlaysystemdialog-info",severity===TcHmi.DialogManager.DialogSeverity.Info)}else if(dialogType===TcHmi.DialogManager.DialogType.Watermark){let elementMessage=this.__elementWatermarkDialogContainer.querySelector(".tchmi-watermarksystemdialog-message");elementMessage&&(elementMessage.innerHTML=newHtmlContent),elementMessage.style.display=newHtmlContent?"":"none"}return!0}getDialogOwner(){return this.__dialogOwner}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.SplashScreen=class{constructor(){this.__isVisibile=!1;let tempDivSplashScreenContainer=document.createElement("div");tempDivSplashScreenContainer.innerHTML='<div id="tchmi-splash-container">   <div class="tchmi-splash-content-container">       <div class="tchmi-splash-stage-progress-container"><div class="tchmi-splash-stage-progress"></div></div>       <div class="tchmi-splash-stage-info">Loading...</div>       <div class="tchmi-splash-version-info">Version: ?.?.?.?</div>   </div></div>',this.__elementSplashScreenContainer=tempDivSplashScreenContainer.firstElementChild,this.__elementSplashScreenContainer?(this.__elementSplashScreenContainer.remove(),this.__elementSplashProgress=this.__elementSplashScreenContainer.querySelector(".tchmi-splash-stage-progress"),this.__elementSplashInfo=this.__elementSplashScreenContainer.querySelector(".tchmi-splash-stage-info"),this.__elementVersionInfo=this.__elementSplashScreenContainer.querySelector(".tchmi-splash-version-info")):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.SplashScreen] Internal error. Did not find tchmi-splash-container element.")}isVisible(){return this.__isVisibile}updateVersionInfo(message){this.__elementVersionInfo&&(this.__elementVersionInfo.innerText=message)}updateStageInfo(message){this.__elementSplashInfo&&(this.__elementSplashInfo.innerText=message)}updateStageProgress(progress){this.__elementSplashProgress&&(this.__elementSplashProgress.style.width=progress.toString()+"%")}show(){this.__isVisibile||TcHmi.System.isInitialized||document.body&&this.__elementSplashScreenContainer&&!document.body.contains(this.__elementSplashScreenContainer)&&(this.__elementSplashScreenContainer.parentElement&&this.__elementSplashScreenContainer.parentElement.removeChild(this.__elementSplashScreenContainer),document.body.appendChild(this.__elementSplashScreenContainer),this.__isVisibile=!0,TcHmi.EventProvider.raise("System.onSplashScreenShow"))}hide(){this.__isVisibile&&(this.__elementSplashScreenContainer?.parentElement&&this.__elementSplashScreenContainer.parentElement.removeChild(this.__elementSplashScreenContainer),this.__isVisibile=!1,TcHmi.EventProvider.raise("System.onSplashScreenHide"))}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){class Filter{constructor(logic){this.__comparisons=[],this.__subfilters=[],this.__parent=null,this.__logic=logic}static parse(data,schema){if(void 0===data)throw new Error("Filter must not be undefined");if(schema&&("array"!==schema.type||!schema.items))throw new Error("Filter schema must describe an array.");if(!data||0===data.length)return new Filter("AND");if(!Array.isArray(data))throw new Error("Filter must be an array.");if(1===data.length){let item=data[0];if(TcHmi.isComparison(item)){let result=new Filter("AND");return schema&&(item=this.__parseComparison(item,schema)),result.__comparisons.push(item),result}if(Array.isArray(item))return this.parse(item,schema);throw new Error("Invalid filter. Expected comparison or nested filter at position 0.")}let first=data[0],second=data[1];if(!TcHmi.isLogicOperator(second))throw new Error("Invalid filter. Expected logic operator at position 1.");let addExpressionToTree=(tree,expression,positionInArray)=>{if(TcHmi.isComparison(expression))schema&&(expression=this.__parseComparison(expression,schema)),tree.__comparisons.push(expression);else{if(!Array.isArray(expression))throw new Error(`Invalid filter. Expected comparison or nested filter at position ${positionInArray}.`);tree.__subfilters.push(this.parse(expression,schema))}},root=new Filter(second.logic);addExpressionToTree(root,first,0);let current=root,currentExpression=null,expecting="comparison";for(let i=2,ii=data.length;i<ii;i++)switch(expecting){case"comparison":currentExpression=data[i],expecting="logic";break;case"logic":let logicOperator=data[i];if(!TcHmi.isLogicOperator(logicOperator))throw new Error(`Invalid filter. Expected logic operator at position ${i}.`);let logic=logicOperator.logic;if(logic===current.__logic)addExpressionToTree(current,currentExpression,i-1);else if("OR"===logic)if(addExpressionToTree(current,currentExpression,i-1),current.__parent&&current.__parent.__logic===logic)current=current.__parent;else{let orTree=new Filter(logic);orTree.__subfilters.push(current),orTree.__parent=current.__parent,current.__parent=orTree,null===orTree.__parent&&(root=orTree),current=orTree}else if("AND"===logic){let andTree=new Filter(logic);addExpressionToTree(andTree,currentExpression,i-1),andTree.__parent=current,current.__subfilters.push(andTree),current=andTree}expecting="comparison"}if("comparison"===expecting)throw new Error("Filter must not end with a logic operator.");return addExpressionToTree(current,currentExpression,data.length-1),root}test(candidate,key=""){for(let i=0,ii=this.__comparisons.length;i<ii;i++){let result=this.__resolveComparison(this.__comparisons[i],candidate,key);if(result&&"OR"===this.__logic)return!0;if(!result&&"AND"===this.__logic)return!1}for(let i=0,ii=this.__subfilters.length;i<ii;i++){let result=this.__subfilters[i].test(candidate,key);if(result&&"OR"===this.__logic)return!0;if(!result&&"AND"===this.__logic)return!1}return"AND"===this.__logic}static __parseComparison(comparison,schema){comparison=tchmi_clone_object(comparison);let findSchema=subschema=>{if(subschema.oneOf)for(let i=0,ii=subschema.oneOf.length;i<ii;i++){let res=findSchema(subschema.oneOf[i]);if(res)return res}else if(subschema.anyOf)for(let i=0,ii=subschema.anyOf.length;i<ii;i++){let res=findSchema(subschema.anyOf[i]);if(res)return res}else if("object"===subschema.type&&subschema.properties){if(subschema.properties.path){if("string"!==subschema.properties.path.type)return null;if(subschema.required?.includes("path")){if(!comparison.path)return null;if(subschema.properties.path.enum&&!subschema.properties.path.enum.includes(comparison.path))return null}}return subschema.properties.comparator&&subschema.properties.comparator.enum&&subschema.properties.comparator.enum.includes(comparison.comparator)&&(subschema.properties.value&&subschema.properties.value.type===typeof comparison.value)?subschema:null}return null},comparisonSchema=null;if(Array.isArray(schema.items))for(let i=0,ii=schema.items.length;i<ii;i++){let res=findSchema(schema.items[i]);if(res){comparisonSchema=res;break}}else schema.items&&(comparisonSchema=findSchema(schema.items));if(comparisonSchema&&comparisonSchema.properties&&"date-time"===comparisonSchema.properties.value.format&&"string"==typeof comparison.value){let date=new Date(comparison.value);if(isNaN(date.getTime()))throw new Error(`Filter contains an invalid date: "${comparison.value}".`);comparison.value=new Date(comparison.value)}return comparison}__resolveComparison(comparison,datum,key){let left,right;try{[left,right]=this.__getValues(comparison,datum,key)}catch(error){return!1}if(void 0===left)return!1;switch(comparison.comparator){case"==":return this.__resolveEquals(left,right);case"!=":return this.__resolveEqualsNot(left,right);case"<":return this.__resolveLessThan(left,right);case">":return this.__resolveGreaterThan(left,right);case"<=":return this.__resolveLessThanOrEquals(left,right);case">=":return this.__resolveGreaterThanOrEquals(left,right);case"contains":return this.__resolveContains(left,right);case"contains not":return this.__resolveContainsNot(left,right);case"== [ignore case]":return this.__resolveEqualsIgnoreCase(left,right);case"!= [ignore case]":return this.__resolveEqualsNotIgnoreCase(left,right);case"contains [ignore case]":return this.__resolveContainsIgnoreCase(left,right);case"contains not [ignore case]":return this.__resolveContainsNotIgnoreCase(left,right)}}__resolveEquals(left,right){return"number"==typeof left&&"number"==typeof right?left===right||Math.abs(left-right)<=Filter.__floatEpsilon:left===right}__resolveEqualsNot(left,right){return!this.__resolveEquals(left,right)}__resolveLessThan(left,right){if("number"==typeof left&&"number"==typeof right)return right-left>Filter.__floatEpsilon;throw new Error(`Cannot compare ${typeof left} with ${typeof right} using <.`)}__resolveGreaterThan(left,right){if("number"==typeof left&&"number"==typeof right)return left-right>Filter.__floatEpsilon;throw new Error(`Cannot compare ${typeof left} with ${typeof right} using >.`)}__resolveLessThanOrEquals(left,right){return!this.__resolveGreaterThan(left,right)}__resolveGreaterThanOrEquals(left,right){return!this.__resolveLessThan(left,right)}__resolveContains(left,right){if("string"==typeof left&&"string"==typeof right)return left.includes(right);if("object"==typeof left&&null!==left){const items=Array.isArray(left)?left:Object.keys(left);for(const item of items)if(this.__resolveEquals(...this.__convert(item,right)))return!0;return!1}throw new Error(`Cannot compare ${typeof left} with ${typeof right} using contains.`)}__resolveContainsNot(left,right){return!this.__resolveContains(left,right)}__resolveEqualsIgnoreCase(left,right){if("string"==typeof left&&"string"==typeof right)return left.toLowerCase()===right.toLowerCase();throw new Error(`Cannot compare ${typeof left} with ${typeof right} using == [ignore case].`)}__resolveEqualsNotIgnoreCase(left,right){return!this.__resolveEqualsIgnoreCase(left,right)}__resolveContainsIgnoreCase(left,right){if("string"==typeof left&&"string"==typeof right)return left.toLowerCase().includes(right.toLowerCase());throw new Error(`Cannot compare ${typeof left} with ${typeof right} using contains [ignore case].`)}__resolveContainsNotIgnoreCase(left,right){return!this.__resolveContainsIgnoreCase(left,right)}__getValues(comparison,datum,key){const[left,right]=this.__convert(this.__followPath(comparison,datum,key),comparison.value,comparison);return[left,right]}__followPath(comparison,datum,key){let left=datum;if(comparison.path&&"{value}"!==comparison.path)if("{key}"===comparison.path)left=key;else{let propertyPath=TcHmi.ObjectPath.toPathTokens(comparison.path);for(let i=0,ii=propertyPath.length;i<ii;i++){let token=propertyPath[i],isArrayToken=!1;if(token.match(/\[.*\]/)&&(token=token.slice(1,-1),isArrayToken=!0),Array.isArray(left)&&isArrayToken){let index=parseInt(token,10);left=left[isNaN(index)?token:index.toString()]}else{if(null===left)throw new Error(`Could not read property ${token} of null`);if("object"!=typeof left)throw new Error(`Could not read property ${token} of type ${typeof left}`);left=left[token]}}}return left}__convert(left,right,comparison){let cache=!1;if(typeof right!=typeof left)if("string"==typeof right){const isoDateTimeRegex=/^[1-2]\d{3}(-?)[0-1]\d\1[0-3]\d(?:T[0-2]\d(?:(:?)[0-5]\d(?:\2[0-5]\d)?)?(?:[.,]\d+)?(?:Z|[+-][0-1]\d(?::?[0-5]\d)?)?)?$/;switch(typeof left){case"boolean":"true"===right.toLowerCase()?(right=!0,cache=!0):"false"===right.toLowerCase()&&(right=!1,cache=!0);break;case"number":if(/^[+-]?\d*\.?\d+(?:[eE][+-]?\d+)?$/.test(right)){let converted=parseFloat(right);Number.isNaN(converted)||(right=converted,cache=!0)}break;case"object":if(left instanceof Date&&isoDateTimeRegex.test(right)){let converted=new Date(right);Number.isNaN(converted.getTime())||(right=converted,cache=!0)}else null===left&&("null"===right.toLowerCase()?(right=null,cache=!0):isoDateTimeRegex.test(right)&&0===new Date(right).getTime()&&(right=null))}}else void 0!==comparison?.originalValue&&typeof left==typeof comparison.originalValue&&(right=comparison.originalValue);else right instanceof Date&&0===right.getTime()&&null===left&&(right=null);return cache&&comparison&&(comparison.originalValue=comparison.value,comparison.value=right),left instanceof Date&&right instanceof Date&&(left=left.getTime(),right=right.getTime()),[left,right]}}Filter.__floatEpsilon=Math.pow(2,-23),System.Filter=Filter}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.KeyboardManager=class{constructor(){this.__eventsRegistered=!1,this.refreshConfig()}refreshConfig(){if(!TcHmi.System.config.systemKeyboard?.providerName)return void this.close();if(this.__activeProvider?.refreshConfig(),this.__eventsRegistered)return;let focusOutAnimationFrameId=0;const passiveEventOptions={passive:!0,capture:!1},handleFinalInteraction=evt=>{const activeElement=evt.target&&void 0!==evt.target.ownerDocument?evt.target.ownerDocument.activeElement:document.activeElement;activeElement&&activeElement!==evt.target||this.close()},handleFocusIn=evt=>{if(!TcHmi.System.config.systemKeyboard?.providerName)return;const eventTarget=evt.target;if("TEXTAREA"!==eventTarget.tagName.toUpperCase()&&"INPUT"!==eventTarget.tagName.toUpperCase())return;if("INPUT"===eventTarget.tagName.toUpperCase()&&["button","checkbox","file","image","radio","reset","submit"].includes(eventTarget.type))return;const requestedInputMode=eventTarget.getAttribute("data-tchmi-input-mode");if("skip"!==requestedInputMode)if("none"!==requestedInputMode){focusOutAnimationFrameId&&(cancelAnimationFrame(focusOutAnimationFrameId),focusOutAnimationFrameId=0);try{const registeredKeyboard=TcHmi.UiProvider.getPreferredProvider("keyboard");if(registeredKeyboard){const refocus=!!this.__activeProvider;this.__activeProvider=registeredKeyboard;const result=this.__activeProvider.open(eventTarget);result&&result.code!==TcHmi.Errors.NONE||TcHmi.EventProvider.raise("onSystemKeyboardOpened",{refocus:refocus,textElement:eventTarget}),eventTarget.addEventListener("focusout",handleFocusOut,{once:!0})}}catch(ex){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Keyboard] Could not open keyboard.",ex)}}else this.close()},handleFocusOut=()=>{focusOutAnimationFrameId=requestAnimationFrame((()=>{this.__activeProvider?.hasActiveUserInteraction&&!this.__activeProvider.hasActiveUserInteraction()&&this.__activeProvider?.close(),focusOutAnimationFrameId=0}))};document.addEventListener("focusin",handleFocusIn,passiveEventOptions),document.addEventListener("indirectinputfinished",handleFinalInteraction),document.addEventListener("indirectinputcanceled",handleFinalInteraction);const handleIframeLoad=evt=>{const iframe=evt.target;iframe.contentDocument?.addEventListener("focusin",handleFocusIn),iframe.contentDocument?.addEventListener("indirectinputfinished",handleFinalInteraction),iframe.contentDocument?.addEventListener("indirectinputcanceled",handleFinalInteraction)},armIframeEvents=iframe=>{iframe.addEventListener("load",handleIframeLoad,passiveEventOptions),iframe.contentDocument&&"loading"!==iframe.contentDocument.readyState&&(iframe.contentDocument.addEventListener("focusin",handleFocusIn),iframe.contentDocument.addEventListener("indirectinputfinished",handleFinalInteraction),iframe.contentDocument.addEventListener("indirectinputcanceled",handleFinalInteraction))};TcHmi.EventProvider.register("System.onIFrameElementAdded",((evt,iframe)=>{armIframeEvents(iframe)})),TcHmi.EventProvider.register("System.onIFrameElementRemoved",((evt,iframe)=>{iframe.contentDocument?.removeEventListener("focusin",handleFocusIn),iframe.contentDocument?.removeEventListener("indirectinputfinished",handleFinalInteraction),iframe.contentDocument?.removeEventListener("indirectinputcanceled",handleFinalInteraction),iframe.removeEventListener("load",handleIframeLoad,passiveEventOptions)}));for(const iframe of document.querySelectorAll("iframe"))armIframeEvents(iframe);this.__eventsRegistered=!0}close(){if(this.__activeProvider){const result=this.__activeProvider.close();this.__activeProvider=void 0,result&&result.code!==TcHmi.Errors.NONE||TcHmi.EventProvider.raise("onSystemKeyboardClosed")}}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.FunctionExpression=class{constructor(functionExpression,options){this.__isDestroyed=!1,this.__functionCallExpressions=[],this.__symbolExpressions=[],this.__symbolExpressionsMetaData=new Map,this.__symbolWatchMap=new Map,this.__callbacks=[],this.__currentWatch={ctx:void 0,isInitialized:!1,isReady:!1,needsExecution:!0,hasPendingExecution:!1},this.__expression=functionExpression,this.__enableWatchMode=options?.enableWatchMode??!1,this.__forcedSymbolOptions=options?.forcedSymbolOptions??null;try{this.__originalAst=acorn.parse(functionExpression,{plugins:{symbolExpression:{onSymbol:this.__symbolExpressions,onCallExpression:callExpression=>{let functionName=this.__resolveCallExpressionName(callExpression.callee);const module=TcHmi.System.Data.Modules.functions.map.get(functionName);if(module)if(module.error===TcHmi.Errors.NONE){let fnDescr=module.description,argoffset=0;if(!fnDescr){let error={code:TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION],reason:'Target function expression: "'+this.__expression+'", Missing description file (*.function.json) for function with registered name: "'+functionName+'".',domain:"TcHmi.System.FunctionExpression"};this.__error?this.__error.errors?this.__error.errors.push(error):this.__error.errors=[error]:this.__error={code:TcHmi.Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR],reason:'Target function expression: "'+this.__expression+'", At least one error occurred while parsing the function expression.',domain:"TcHmi.System.FunctionExpression",errors:[error]}}if(fnDescr&&!fnDescr.function){let error={code:TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION],reason:'Target function expression: "'+this.__expression+'", Invalid description file(*.function.json) for function with registered name: "'+functionName+'".Missing  property: "function".',domain:"TcHmi.System.FunctionExpression"};this.__error?this.__error.errors?this.__error.errors.push(error):this.__error.errors=[error]:this.__error={code:TcHmi.Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR],reason:'Target function expression: "'+this.__expression+'", At least one error occurred while parsing the function expression.',domain:"TcHmi.System.FunctionExpression",errors:[error]}}if(fnDescr&&fnDescr.function&&!0===fnDescr.function.injectContextObject&&argoffset++,fnDescr&&fnDescr.function&&void 0!==callExpression.arguments&&null!==callExpression.arguments)for(let i=0,ii=callExpression.arguments.length;i<ii;i++)if("SymbolExpression"===callExpression.arguments[i].type&&fnDescr&&fnDescr.function&&fnDescr.function.arguments){let descr;if(i+argoffset<fnDescr.function.arguments.length?descr=fnDescr.function.arguments[i+argoffset]:(descr=fnDescr.function.arguments[fnDescr.function.arguments.length-1],!0!==descr.restParameter&&(descr=void 0)),descr){let typeSchema=TcHmi.System.Services.typeManager.getSchema(descr.type);if(typeSchema&&"TcHmi.Symbol"===typeSchema.frameworkInstanceOf){let expr=callExpression.arguments[i];this.__symbolExpressionsMetaData.set(expr,{options:{passAsSymbol:!0,allowSymbolReferenceWatchDelegation:descr.allowSymbolReferenceWatchDelegation??!1}})}}}this.__functionCallExpressions.push(callExpression)}else this.__error||(this.__error={code:TcHmi.Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR],reason:'Target function expression: "'+this.__expression+'", At least one error occurred while parsing the function expression.',domain:"TcHmi.System.FunctionExpression"}),module.errorDetails&&(this.__error.errors?this.__error.errors.push(module.errorDetails):this.__error.errors=[module.errorDetails])}}}})}catch(e){let error={code:TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION],reason:'An uncaught exception occurred in target function expression "'+this.__expression+'".',exception:e,domain:"TcHmi.System.FunctionExpression"};this.__error?this.__error.errors?this.__error.errors.push(error):this.__error.errors=[error]:this.__error={code:TcHmi.Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR],reason:'Target function expression: "'+this.__expression+'", At least one error occurred while parsing the function expression.',domain:"TcHmi.System.FunctionExpression",errors:[error]}}this.__enableWatchMode&&!this.__error&&this.__fillSymbolWatchMap()}__resolveCallExpressionName(expression){let res="";return"MemberExpression"===expression.type?(res+=this.__resolveCallExpressionName(expression.object),res+=".",res+=this.__resolveCallExpressionName(expression.property)):"Identifier"===expression.type&&(res+=expression.name),res}__fillSymbolWatchMap(){let pushSymbolExpression=symbolExpression=>{let metaData=this.__symbolExpressionsMetaData.get(symbolExpression);metaData?.options.allowSymbolReferenceWatchDelegation||this.__symbolWatchMap.has(symbolExpression.expression)||this.__symbolWatchMap.set(symbolExpression.expression,{symbol:new System.Symbol(symbolExpression.expression),ready:!1,error:TcHmi.Errors.NONE})};for(let i=0,ii=this.__symbolExpressions.length;i<ii;i++)pushSymbolExpression(this.__symbolExpressions[i])}__doWatchExecute(){if(this.__currentWatch.hasPendingExecution)return;if(!this.__currentWatch.isReady){let ready=!0;for(const watchObj of this.__symbolWatchMap.values())if(watchObj&&!1===watchObj.ready){ready=!1;break}if(!ready)return;this.__currentWatch.isReady=!0}let allowSymbolReferenceWatchDelegation=!1;for(const metaData of this.__symbolExpressionsMetaData.values())if(metaData.options.allowSymbolReferenceWatchDelegation){allowSymbolReferenceWatchDelegation=!0;break}if(this.__currentWatch.ctx&&this.__currentWatch.ctx.destroy&&this.__currentWatch.ctx.destroy(),this.__currentWatch.needsExecution){this.__currentWatch.hasPendingExecution=!0,this.__currentWatch.needsExecution=!1;let __this=this,bContextLock=!1,ctx={success:function(result){if(allowSymbolReferenceWatchDelegation)bContextLock=!1;else{if(bContextLock)return;bContextLock=!0}__this.__currentWatch.result=result,__this.__currentWatch.hasPendingExecution=!1;let callbackList=[];for(let i=0,ii=__this.__callbacks.length;i<ii;i++)callbackList.push(__this.__callbacks[i]);for(let co of callbackList)__this.__callbacks.includes(co)&&TcHmi.Callback.callSafeEx(co.callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(result),destroy:co.destroy})},error:function(error,details){if(bContextLock)return;bContextLock=!0,__this.__currentWatch.hasPendingExecution=!1;let callbackList=[];for(let i=0,ii=__this.__callbacks.length;i<ii;i++)callbackList.push(__this.__callbacks[i]);for(let co of callbackList)__this.__callbacks.includes(co)&&TcHmi.Callback.callSafeEx(co.callback,__this,{error:error,details:details,destroy:co.destroy})},delegatedWatch:allowSymbolReferenceWatchDelegation};__this.__currentWatch.ctx=ctx,__this.execute(ctx)}else if(this.__error){let callbackList=[];for(let i=0,ii=this.__callbacks.length;i<ii;i++)callbackList.push(this.__callbacks[i]);for(let co of callbackList)this.__callbacks.includes(co)&&TcHmi.Callback.callSafeEx(co.callback,this,{error:this.__error.code,details:this.__error,destroy:co.destroy})}else{let callbackList=[];for(let i=0,ii=this.__callbacks.length;i<ii;i++)callbackList.push(this.__callbacks[i]);for(let co of callbackList)this.__callbacks.includes(co)&&TcHmi.Callback.callSafeEx(co.callback,this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(this.__currentWatch.result),destroy:co.destroy})}}__doWatch(){if(!this.__currentWatch.isInitialized){for(let watchObj of this.__symbolWatchMap.values())watchObj.destroy=watchObj.symbol.watchEx(this.__forcedSymbolOptions,this.__onSymbolWatch());this.__currentWatch.isInitialized=!0}this.__doWatchExecute()}__onSymbolWatch(){let __this=this;return function(data){let expr=this.getExpression();if(!expr)return;let watchObj=__this.__symbolWatchMap.get(expr.toString());watchObj&&(data.error===TcHmi.Errors.NONE?(watchObj.value=data.value,watchObj.error=null,watchObj.details=void 0,watchObj.ready=!0):(watchObj.value=null,watchObj.error=data.error,watchObj.details=data.details,watchObj.ready=!0),__this.__currentWatch.needsExecution=!0,__this.__doWatchExecute())}}execute(ctx,skipCallbackWithSyncValue=!1){if(this.__error)return ctx.error(this.__error.code,this.__error),{error:TcHmi.Errors.NONE};let resultsSymbolExpressions=[],resultsFunctionCallExpressions=[];if(TCHMI_DESIGNER){let abort=!1;if(this.__symbolExpressions)for(let i=0,ii=this.__symbolExpressions.length;i<ii;i++){let expr=new TcHmi.SymbolExpression(this.__symbolExpressions[i].expression);if(!expr||expr.getType()===TcHmi.SymbolType.Invalid){abort=!0;break}if(expr.getType()===TcHmi.SymbolType.Server){abort=!0;break}}if(abort)return ctx.success(null),{error:TcHmi.Errors.NONE}}let syncResultValue,subCtx1,subCtx2,subCtx3,destroySubCtx2,syncResultSet=!1,executeReturned=!1;ctx.destroy=()=>{destroySubCtx2&&(destroySubCtx2(),destroySubCtx2=void 0)};const resolveExpression=ctx=>{let result,expressionTokens=this.__expression.split("");for(let i=0,ii=this.__symbolExpressions.length;i<ii;i++){let expr=this.__symbolExpressions[i];if(expr&&!expr.handled){let fill=[];for(let j=0,jj=expr.end-expr.start;j<jj;j++)fill.push("");expressionTokens.splice(expr.start,expr.end-expr.start,...fill),expressionTokens[expr.start]="resSE["+i+"]"}}for(let i=0,ii=this.__functionCallExpressions.length;i<ii;i++){let expr=this.__functionCallExpressions[i];if(expr&&!expr.handled){let fill=[];for(let j=0,jj=expr.end-expr.start;j<jj;j++)fill.push("");expressionTokens.splice(expr.start,expr.end-expr.start,...fill),expressionTokens[expr.start]="resFCE["+i+"]"}}try{let s="";for(let j=0,jj=expressionTokens.length;j<jj;j++)s+=expressionTokens[j];s+="\n//# sourceURL=TcHmi_System_FunctionExpression_resolveExpression_Results_Eval",result=gIsolatedEval_TcHmi_System_FunctionExpression_Results(s,resultsSymbolExpressions,resultsFunctionCallExpressions)}catch(e){return void ctx.error(TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION,{code:TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION],reason:'Target function expression "'+this.__expression+'" throwed the Exception: "'+e+'"',domain:"TcHmi.System.FunctionExpression"})}ctx.success(result)},resolveFunctionCallExpressions=ctx=>{let destroyFunctionWatchesFromSubCtx=new Map;ctx.destroy=()=>{destroyFunctionWatchesFromSubCtx.forEach(((destroy,fce)=>{destroy&&destroy()})),destroyFunctionWatchesFromSubCtx.clear()};const resolveFunctionCallExpression=(ctx,callExpression)=>{if(!callExpression)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression,domain:"TcHmi.System.FunctionExpression"});let subCtx,name=this.__resolveCallExpressionName(callExpression.callee),args=[],module=TcHmi.System.Data.Modules.functions.map.get(name);if(!module)return void ctx.error(TcHmi.Errors.E_MODULE_MISSING,{code:TcHmi.Errors.E_MODULE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_MODULE_MISSING],reason:this.__expression,domain:"TcHmi.System.FunctionExpression"});if(module.error!==TcHmi.Errors.NONE)return void ctx.error(TcHmi.Errors.E_MODULE_ERROR,{code:TcHmi.Errors.E_MODULE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_MODULE_ERROR],reason:this.__expression,domain:"TcHmi.System.FunctionExpression",errors:module.errorDetails?[module.errorDetails]:void 0});if(!module.description)return void ctx.error(TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_DESCRIPTION,{code:TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_DESCRIPTION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_DESCRIPTION],reason:this.__expression,domain:"TcHmi.System.FunctionExpression"});if(!module.reg||!module.reg.func)return void ctx.error(TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE,{code:TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE],reason:this.__expression,domain:"TcHmi.System.FunctionExpression"});let res,argoffset=0;if("Asynchronous"===module.description.function.waitMode){if(!0!==module.description.function.injectContextObject)return void ctx.error(TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,{code:TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION],reason:'Target function expression: "'+this.__expression+'", Invalid configuration for hmi function with name='+name+". Setting waitMode=Asynchronous and injectContextObject="+module.description.function.injectContextObject+" is an invalid function configuration. Please define a context object if you want to use waitMode=Asynchronous.",domain:"TcHmi.System.FunctionExpression"});{let bContextLock=!1;subCtx={success:function(result){if(ctx.delegatedWatch)bContextLock=!1;else{if(bContextLock)return;bContextLock=!0}ctx.success(result)},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))},...ctx&&ctx.args?{args:ctx.args}:{},...ctx&&ctx.delegatedWatch?{delegatedWatch:ctx.delegatedWatch}:{}},args.unshift(subCtx),argoffset++}}else!0===module.description.function.injectContextObject&&(subCtx={...ctx&&ctx.args?{args:ctx.args}:{},...ctx&&ctx.delegatedWatch?{delegatedWatch:ctx.delegatedWatch}:{}},args.unshift(subCtx),argoffset++);for(let i=0,ii=callExpression.arguments.length;i<ii;i++){let descr=null;if(module&&module.error===TcHmi.Errors.NONE)if(i+argoffset<module.description.function.arguments.length)descr=module.description.function.arguments[i+argoffset];else if(descr=module.description.function.arguments[module.description.function.arguments.length-1],!0!==descr.restParameter)return void ctx.error(TcHmi.Errors.E_FUNCTION_RESTPARAMETER_DEFINITION_MISSING,{code:TcHmi.Errors.E_FUNCTION_RESTPARAMETER_DEFINITION_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_RESTPARAMETER_DEFINITION_MISSING],domain:"TcHmi.System.FunctionExpression"});if(!descr)return void ctx.error(TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,{code:TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION],domain:"TcHmi.System.FunctionExpression"});let typeSchema=TcHmi.System.Services.typeManager.getSchema(descr.type);if(!typeSchema)return void ctx.error(TcHmi.Errors.E_UNKNOWN_TYPE,{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],domain:"TcHmi.System.FunctionExpression"});let ceArgType=callExpression.arguments[i].type,ceArgStart=callExpression.arguments[i].start,ceArgEnd=callExpression.arguments[i].end,expression=this.__expression.substr(ceArgStart,ceArgEnd-ceArgStart),isSymbolExpression=TcHmi.Symbol.isSymbolExpression(expression),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(expression);if(isSymbolExpression&&!isSymbolExpressionEscaped){let value;for(let j=0,jj=this.__symbolExpressions.length;j<jj;j++){let expr=this.__symbolExpressions[j],exprStart=expr.start,exprEnd=expr.end;if(exprStart>=ceArgStart&&exprEnd<=ceArgEnd){value=resultsSymbolExpressions[j],expr.handled=!0;break}}if("TcHmi.Symbol"===typeSchema.frameworkInstanceOf){if(!(value instanceof TcHmi.Symbol))return void ctx.error(TcHmi.Errors.E_TYPE_INVALID,{code:TcHmi.Errors.E_TYPE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_TYPE_INVALID],domain:"TcHmi.System.FunctionExpression"});args[i+argoffset]=value}else{let cvalue=TcHmi.ValueConverter.toSchemaType(value,typeSchema);if(null===cvalue&&null!==value)return void ctx.error(TcHmi.Errors.E_TYPE_INVALID,{code:TcHmi.Errors.E_TYPE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_TYPE_INVALID],reason:'Target function expression: "'+this.__expression+'", Unable to cast value: "'+value+'" of type: "'+typeof value+'" for parameter: "'+descr.name+'" of function: "'+TcHmi.System.resolveQualifiedName(module.description.function.name,module.description.function.namespace)+'" to type "'+descr.type+'".',domain:"TcHmi.System.FunctionExpression"});args[i+argoffset]=cvalue}}else{let prepExpression=expression;isSymbolExpressionEscaped&&(prepExpression=TcHmi.Symbol.escapeSymbolExpression(prepExpression));let value,expressionTokens=prepExpression.split("");for(let j=0,jj=this.__symbolExpressions.length;j<jj;j++){let expr=this.__symbolExpressions[j],exprStart=expr.start,exprEnd=expr.end,exprStartFixed=exprStart-ceArgStart,exprEndFixed=exprStartFixed+(exprEnd-exprStart),resultsSymbolExpression=resultsSymbolExpressions[j];if(exprStart>=ceArgStart&&exprEnd<=ceArgEnd){for(let k=exprStartFixed,kk=exprEndFixed;k<kk;k++)expressionTokens[k]="";expressionTokens[exprStartFixed]="string"==typeof resultsSymbolExpression?`'${resultsSymbolExpression}'`:resultsSymbolExpression,expr.handled=!0}}for(let j=0,jj=this.__functionCallExpressions.length;j<jj;j++){let expr=this.__functionCallExpressions[j],exprStart=expr.start,exprEnd=expr.end,exprStartFixed=exprStart-ceArgStart,exprEndFixed=exprStartFixed+(exprEnd-exprStart),resultsFunctionCallExpression=resultsFunctionCallExpressions[j];if(exprStart>=ceArgStart&&exprEnd<=ceArgEnd){for(let k=exprStartFixed,kk=exprEndFixed;k<kk;k++)expressionTokens[k]="";expressionTokens[exprStartFixed]="string"==typeof resultsFunctionCallExpression?`'${resultsFunctionCallExpression}'`:resultsFunctionCallExpression,expr.handled=!0}}let s="";for(let j=0,jj=expressionTokens.length;j<jj;j++)s+=expressionTokens[j];"ObjectExpression"===ceArgType&&(s="("+s+")"),s+="\n//# sourceURL=TcHmi_System_FunctionExpression_resolveExpression_Eval";try{value=gIsolatedEval_TcHmi_System_FunctionExpression(s)}catch(e){return void ctx.error(TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION,{code:TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION],reason:"An uncaught exception occurred in the processing of "+this.__expression.toString(),exception:e,domain:"TcHmi.System.FunctionExpression"})}let cvalue=TcHmi.ValueConverter.toSchemaType(value,typeSchema);if(null===cvalue&&null!==value)return void ctx.error(TcHmi.Errors.E_TYPE_INVALID,{code:TcHmi.Errors.E_TYPE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_TYPE_INVALID],reason:'Target function expression: "'+this.__expression+'", Unable to cast value: "'+value+'" of type: "'+typeof value+'" for parameter: "'+descr.name+'" of function: "'+module.description.function.name+'" to type: "'+descr.type+'".',domain:"TcHmi.System.FunctionExpression"});args[i+argoffset]=cvalue}}try{res=module.reg.func(...args)}catch(e){return void ctx.error(TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION,{code:TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION],reason:"An uncaught exception occurred in the processing of "+this.__expression.toString(),exception:e,domain:"TcHmi.System.FunctionExpression"})}subCtx?.destroy&&(ctx.destroy=subCtx.destroy),"Asynchronous"===module.description.function.waitMode||ctx.success(res)};let next=i=>{let bContextLock=!1,subCtx={success:result=>{if(ctx.delegatedWatch)bContextLock=!1;else{if(bContextLock)return;bContextLock=!0}resultsFunctionCallExpressions[i]=result,i+1<this.__functionCallExpressions.length?next(i+1):ctx.success()},error:(error,details)=>{bContextLock||(bContextLock=!0,ctx.error(error,details))},...ctx&&ctx.args?{args:ctx.args}:{},...ctx&&ctx.delegatedWatch?{delegatedWatch:ctx.delegatedWatch}:{}},fce=this.__functionCallExpressions[i],fceDestroy=destroyFunctionWatchesFromSubCtx.get(fce);fceDestroy&&(fceDestroy(),fceDestroy=void 0,destroyFunctionWatchesFromSubCtx.delete(fce)),resolveFunctionCallExpression(subCtx,fce),subCtx.destroy&&destroyFunctionWatchesFromSubCtx.set(fce,subCtx.destroy)};this.__functionCallExpressions.length>0?next(0):ctx.success()};let bContextLock=!1;return subCtx1={success:function(result1){if(ctx.delegatedWatch)bContextLock=!1;else{if(bContextLock)return;bContextLock=!0}let bContextLock2=!1;subCtx2={success:function(result2){if(ctx.delegatedWatch)bContextLock2=!1;else{if(bContextLock2)return;bContextLock2=!0}let bContextLock3=!1;subCtx3={success:function(result3){if(ctx.delegatedWatch)bContextLock3=!1;else{if(bContextLock3)return;bContextLock3=!0}if(!executeReturned&&skipCallbackWithSyncValue)return syncResultValue=result3,void(syncResultSet=!0);ctx.success(result3)},error:function(error,details){bContextLock3||(bContextLock3=!0,ctx.error(error,details))},...ctx&&ctx.args?{args:ctx.args}:{},...ctx&&ctx.delegatedWatch?{delegatedWatch:ctx.delegatedWatch}:{}},resolveExpression(subCtx3)},error:function(error,details){bContextLock2||(bContextLock2=!0,ctx.error(error,details))},...ctx&&ctx.args?{args:ctx.args}:{},...ctx&&ctx.delegatedWatch?{delegatedWatch:ctx.delegatedWatch}:{}},destroySubCtx2&&(destroySubCtx2(),destroySubCtx2=void 0),resolveFunctionCallExpressions(subCtx2),destroySubCtx2=subCtx2.destroy},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))},...ctx&&ctx.args?{args:ctx.args}:{},...ctx&&ctx.delegatedWatch?{delegatedWatch:ctx.delegatedWatch}:{}},(ctx=>{const resolveSymbolExpression=(ctx,symbolExpression)=>{if(!symbolExpression)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression,domain:"TcHmi.System.FunctionExpression"});let metaData=this.__symbolExpressionsMetaData.get(symbolExpression);if(!metaData?.options.passAsSymbol){if(!0===this.__enableWatchMode){let watchObj=this.__symbolWatchMap.get(symbolExpression.expression);return watchObj?watchObj.error?void ctx.error(watchObj.error,watchObj.details):void ctx.success(tchmi_clone_object(watchObj.value)):void ctx.error(TcHmi.Errors.ERROR,{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Internal Error: Did not find "+this.__expression+" in __symbolWatchMap",domain:"TcHmi.System.FunctionExpression"})}{let symbol=new TcHmi.System.Symbol({expression:symbolExpression.expression});return void symbol.readEx(this.__forcedSymbolOptions,(data=>{data.error?ctx.error(data.error,data.details):ctx.success(data.value),symbol?.destroy(),symbol=null}))}}{let ref=new TcHmi.Symbol(symbolExpression.expression);ctx.success(ref)}};let next=i=>{let symbolExpression=this.__symbolExpressions[i],bContextLock=!1;resolveSymbolExpression({success:result=>{bContextLock||(bContextLock=!0,resultsSymbolExpressions[i]=result,i+1<this.__symbolExpressions.length?next(i+1):ctx.success())},error:(error,details)=>{bContextLock||(bContextLock=!0,ctx.error(error,details))}},symbolExpression)};this.__symbolExpressions.length>0?next(0):ctx.success()})(subCtx1),executeReturned=!0,syncResultSet&&skipCallbackWithSyncValue?{value:syncResultValue,error:TcHmi.Errors.E_FUNCTION_HANDLED_VIA_RETURN_VALUE}:{error:TcHmi.Errors.NONE}}watch(callback){if(!0===this.__isDestroyed)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,destroy:function(){},details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Function Expression already destroyed",domain:"TcHmi.System.FunctionExpression"}}),function(){};if(!1===this.__enableWatchMode)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,destroy:function(){},details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Function Expression has no watch mode",domain:"TcHmi.System.FunctionExpression"}}),function(){};let destroy=()=>{let index=this.__callbacks.indexOf(co);-1!==index&&this.__callbacks.splice(index,1)},co={callback:callback,destroy:destroy};return this.__callbacks.push(co),this.__doWatch(),destroy}__resolveProcessedWaitMode(){let res="Synchronous";if(this.__processedWaitMode)return res=this.__processedWaitMode,res;if(this.__isDestroyed)throw new Error("Object was already destroyed.");if("Synchronous"===res)for(let i=0,ii=this.__symbolExpressions.length;i<ii;i++){let symbolExpression=this.__symbolExpressions[i],expr=new TcHmi.SymbolExpression(symbolExpression.expression),type=expr.getType();if(type===TcHmi.SymbolType.Server){res="Asynchronous";break}if(type===TcHmi.SymbolType.Function){const content=expr.getContent();if(!content)continue;let func=new TcHmi.System.FunctionExpression(content);if(func.isProcessedAsync()){res="Asynchronous",func.destroy();break}func.destroy()}}return this.__processedWaitMode=res,res}isProcessedAsync(){return"Asynchronous"===this.__resolveProcessedWaitMode()}destroy(){!0!==this.__isDestroyed&&(!0===this.__enableWatchMode&&(this.__symbolWatchMap.forEach(((watchObj,key)=>{watchObj.destroy&&watchObj.destroy(),watchObj.symbol.destroy()})),this.__symbolWatchMap.clear()),this.__currentWatch.ctx&&(this.__currentWatch.ctx.destroy&&(this.__currentWatch.ctx.destroy(),this.__currentWatch.ctx.destroy=void 0),this.__currentWatch.ctx=void 0),this.__isDestroyed=!0)}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.StyleManager=class{constructor(){this.__styleOverwriteCache=new Map,this.__legacyEventsRegistered=!1}__onPrevControlsAttached(){return(event,ctrls)=>{this.__styleOverwriteCache.size&&this.writeStylesFromCache(ctrls)}}__onPrevControlsDetached(){return(event,ctrls)=>{this.__styleOverwriteCache.size&&this.removeStylesFromDom(ctrls)}}__onControlDestroyed(){return(event,control)=>{if(!control)return;let styleCacheEntry=this.__styleOverwriteCache.get(control);if(styleCacheEntry){const styleElem=styleCacheEntry[0].elementInHead;null!==styleElem&&document.head.removeChild(styleElem),this.__styleOverwriteCache.delete(control)}}}__getElementStyle(element,propertyName,computedStyle=!1){let htmlSvgElement,elemStyleDef,res={};if(!element||"object"!=typeof element)return res;if(void 0!==element.length){if(!element[0])return res;htmlSvgElement=element[0]}else htmlSvgElement=element;if(elemStyleDef=computedStyle?window.getComputedStyle(htmlSvgElement):htmlSvgElement.style,elemStyleDef&&elemStyleDef.getPropertyValue)if(null!=propertyName){if("string"==typeof propertyName){let value=elemStyleDef.getPropertyValue(propertyName);value&&(res[propertyName]=value)}else if(Array.isArray(propertyName))for(let propertyArrayCounter=0;propertyArrayCounter<propertyName.length;propertyArrayCounter++){let singlePropery=propertyName[propertyArrayCounter],singleValue=elemStyleDef.getPropertyValue(singlePropery);singleValue&&(res[singlePropery]=singleValue)}}else if(void 0!==elemStyleDef.length&&0!==elemStyleDef.length)for(let allStyleCounter=0;allStyleCounter<elemStyleDef.length;allStyleCounter++){let styleName=elemStyleDef[allStyleCounter];res[styleName]=elemStyleDef.getPropertyValue(styleName)}return res}__setSimpleElementStyle(element,property,value=null){let htmlSvgElements;if(element&&"object"==typeof element){if(void 0!==element.length){if(!element[0])return;htmlSvgElements=element}else htmlSvgElements=[element];for(let elemenCounter=0,elemLength=htmlSvgElements.length;elemenCounter<elemLength;elemenCounter++){const elemStyleDef=htmlSvgElements[elemenCounter].style;if(elemStyleDef&&elemStyleDef.removeProperty&&elemStyleDef.setProperty){if("string"==typeof property)if("string"==typeof value&&""!==value)elemStyleDef.setProperty(property,value);else if(Array.isArray(value))for(let propertyArrayCounter=0;propertyArrayCounter<value.length;propertyArrayCounter++)elemStyleDef.setProperty(property,value[propertyArrayCounter]);else elemStyleDef.removeProperty(property);else if(null!==property)for(const key in property)if(property.hasOwnProperty(key)){const keyProperty=property[key];if("string"==typeof keyProperty&&""!==keyProperty)elemStyleDef.setProperty(key,keyProperty);else if(Array.isArray(keyProperty))for(let propertyArrCounter=0;propertyArrCounter<keyProperty.length;propertyArrCounter++)elemStyleDef.setProperty(key,keyProperty[propertyArrCounter]);else elemStyleDef.removeProperty(key)}}else htmlSvgElements[elemenCounter].nodeType===Node.ELEMENT_NODE?htmlSvgElements[elemenCounter].id?TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.StyleManager] Internal error: Element with the id "+htmlSvgElements[elemenCounter].id+" has no CSSStyleDeclaration in this browser."):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.StyleManager] Internal error: Element of type "+htmlSvgElements[elemenCounter].nodeName+" has no CSSStyleDeclaration in this browser."):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.StyleManager] Internal error: Setting style for Elements of type "+htmlSvgElements[elemenCounter].nodeName+" not supported.")}}}writeStylesFromCache(ctrls){let df=document.createDocumentFragment();for(let i=0,ii=ctrls.length;i<ii;i++){let control=ctrls[i],styleCacheEntry=this.__styleOverwriteCache.get(control);if(styleCacheEntry)for(let i=0;i<styleCacheEntry.length;i++){if(!styleCacheEntry[i].strCss)continue;let styleElement=document.createElement("style");styleElement.type="text/css",styleElement.className=styleCacheEntry[i].strClass,styleElement.appendChild(document.createTextNode(styleCacheEntry[i].strCss)),df.appendChild(styleElement),styleCacheEntry[i].elementInHead=styleElement}}df.childElementCount&&document.head.appendChild(df)}removeStylesFromDom(ctrls){for(let i=0,ii=ctrls.length;i<ii;i++){let control=ctrls[i],styleCacheEntry=this.__styleOverwriteCache.get(control);if(!styleCacheEntry)continue;let themeOverwrite=styleCacheEntry[0].elementInHead;null!==themeOverwrite&&(document.head.removeChild(themeOverwrite),styleCacheEntry[0].elementInHead=null)}}getExistingStyleOverwrites(controlName){const ctrl=TcHmi.Controls.get(controlName);if(!ctrl)return{};let cssText="";const styleElement=this.__styleOverwriteCache.get(ctrl)||[{strClass:"",strCss:""}];for(let i=0;i<styleElement.length;i++)styleElement[i].strClass.includes("overwrite")&&(cssText+=styleElement[i].strCss);return this.__deserializeCss(cssText)}__deserializeCss(cssText){let result={},index=0,charsetIndex=(cssText=this.__removeComments(cssText.trim())).indexOf("@charset",index);for(;-1!==charsetIndex;){let charsetString=this.__splitOutsideOfBraces(cssText.substring(charsetIndex),";")[0];void 0===result["@-rules"]&&(result["@-rules"]=[]),result["@-rules"].push(charsetString),index=charsetIndex+charsetString.length+1,charsetIndex=cssText.indexOf("@charset",index)}let importIndex=cssText.indexOf("@import",index);for(;-1!==importIndex;){let importString=this.__splitOutsideOfBraces(cssText.substring(importIndex),";")[0];void 0===result["@-rules"]&&(result["@-rules"]=[]),result["@-rules"].push(importString),index=importIndex+importString.length+1,importIndex=cssText.indexOf("@import",index)}let namespaceIndex=cssText.indexOf("@namespace",index);for(;-1!==namespaceIndex;){let namespaceString=this.__splitOutsideOfBraces(cssText.substring(namespaceIndex),";")[0];void 0===result["@-rules"]&&(result["@-rules"]=[]),result["@-rules"].push(namespaceString),index=namespaceIndex+namespaceString.length+1,namespaceIndex=cssText.indexOf("@namespace",index)}function mergeDuplicateSelectors(existingStyles,declarations){for(let property in declarations)if(declarations.hasOwnProperty(property)){let decl=declarations[property];if(void 0===existingStyles[property])existingStyles[property]=decl;else for(let i=0,ii=decl.length;i<ii;i++)existingStyles[property].includes(decl[i])||existingStyles[property].push(decl[i])}return existingStyles}for(;index<cssText.length;){let openBraceIndex=cssText.indexOf("{",index),closeBraceIndex=this.__findMatchingBrace(cssText,openBraceIndex),selector=cssText.substring(index,openBraceIndex).trim(),declarationBlock=cssText.substring(openBraceIndex+1,closeBraceIndex);if(selector.startsWith("@")){let atRuleSets=this.__deserializeCss(declarationBlock);if(void 0===result[selector])result[selector]=atRuleSets;else for(let atSelector in atRuleSets)atRuleSets.hasOwnProperty(atSelector)&&(void 0===result[selector][atSelector]?result[selector][atSelector]=atRuleSets[atSelector]:result[selector][atSelector]=mergeDuplicateSelectors(result[selector][atSelector],atRuleSets[atSelector]))}else{let declarations=this.__getDeclarations(declarationBlock);void 0===result[selector]?result[selector]=declarations:result[selector]=mergeDuplicateSelectors(result[selector],declarations)}index=closeBraceIndex+1}return result}__getDeclarations(declarationBlock){let result={},declarations=this.__splitOutsideOfBraces(declarationBlock,";");for(let i=0,ii=declarations.length;i<ii;i++){let splitIndex=declarations[i].indexOf(":");if(splitIndex>-1){let property=declarations[i].substring(0,splitIndex).trim().toLowerCase(),value=declarations[i].substring(splitIndex+1).trim();void 0===result[property]?result[property]=[value]:result[property].includes(value)||result[property].push(value)}}return result}__removeComments(cssText){if(!cssText.includes("/*"))return cssText;let result="",inComment=!1;function addToResult(s){inComment||(result+=s)}for(let i=0,ii=cssText.length;i<ii;i++){let char=cssText.charAt(i);switch(char){case"/":i+1<ii&&"*"===cssText.charAt(i+1)&&(inComment=!0,i++),addToResult(char);break;case"*":addToResult(char),i+1<ii&&"/"===cssText.charAt(i+1)&&(inComment=!1,i++);break;case'"':case"'":const closeQuoteIndex=this.__findMatchingQuote(cssText,i);closeQuoteIndex>i&&(addToResult(cssText.substring(i,closeQuoteIndex+1)),i=closeQuoteIndex);break;default:addToResult(char)}}return result}__getExistingStyleOverwritesForSelector(existingStyleOverwrites,selector){let rulesets=existingStyleOverwrites;return rulesets[selector]||(rulesets[selector]={}),rulesets[selector]}getStyle(controlName,selector,propertyName){if(!selector){const tco=TcHmi.Controls.get(controlName);if(void 0!==tco&&0!==tco.getElement().length){if(null==propertyName)return;return[TcHmi.StyleProvider.getSimpleElementStyle(tco.getElement(),propertyName)[propertyName]]}}selector=this.expandSelector(selector,controlName);let existingStyles=this.getExistingStyleOverwrites(controlName),existingStylesForSelector=this.__getExistingStyleOverwritesForSelector(existingStyles,selector);if(void 0!==existingStylesForSelector)return null!=propertyName?existingStylesForSelector[propertyName]:existingStylesForSelector}writeStyles(controlName,styles){let cssText=this.__serializeCss(styles),control=TcHmi.Controls.get(controlName);if(!control)return;let cacheEntry=this.__styleOverwriteCache.get(control);if(void 0===cacheEntry)cacheEntry=[{strClass:`tchmi-theme overwrite ${controlName}`,strCss:cssText,elementInHead:null}],this.__styleOverwriteCache.set(control,cacheEntry),this.__legacyEventsRegistered||(TcHmi.EventProvider.register("System.onPrevControlsAttached",this.__onPrevControlsAttached()),TcHmi.EventProvider.register("System.onPrevControlsDetached",this.__onPrevControlsDetached()),TcHmi.EventProvider.register("onControlDestroyed",this.__onControlDestroyed()),this.__legacyEventsRegistered=!0);else{let styleUpdated=!1;for(let i=0;i<cacheEntry.length;i++)if(cacheEntry[i].strClass.includes("overwrite")){cacheEntry[i].strCss=cssText,styleUpdated=!0;break}styleUpdated||cacheEntry.push({strClass:`tchmi-theme overwrite ${controlName}`,strCss:cssText,elementInHead:null})}for(let i=0;i<cacheEntry.length;i++)if(cacheEntry[i].strClass.includes("overwrite"))if(null===cacheEntry[i].elementInHead){if(!control||!control.getIsAttached()||!cacheEntry[i].strClass)continue;let styleElement=document.createElement("style");styleElement.className=cacheEntry[i].strClass,styleElement.appendChild(document.createTextNode(cacheEntry[i].strCss)),document.head.appendChild(styleElement),cacheEntry[i].elementInHead=styleElement}else cacheEntry[i].elementInHead.innerHTML=cacheEntry[i].strCss}__serializeCss(styles){let cssText="";function writeDeclarations(selector,declarations,indent=""){cssText+=indent+selector+" {\n";for(let property in declarations){const decl=declarations[property];if(declarations.hasOwnProperty(property)&&null!=decl&&"@-rules"!==property)if(selector.startsWith("@"))writeDeclarations(property,decl,indent+"\t");else for(let i=0,ii=decl.length;i<ii;i++)void 0!==decl[i]&&null!==decl[i]&&""!==decl[i]&&(cssText+=indent+"\t"+property+": "+decl[i]+";\n")}cssText+=indent+"}\n\n"}if(void 0!==styles["@-rules"])for(let i=0,ii=styles["@-rules"].length;i<ii;i++)cssText+=styles["@rules"][i]+";\n";cssText+="\n";for(let selector in styles)styles.hasOwnProperty(selector)&&void 0!==styles[selector]&&null!==styles[selector]&&"@-rules"!==selector&&0!==Object.keys(styles[selector]).length&&writeDeclarations(selector,styles[selector]);return cssText=cssText.trim(),cssText}expandSelector(selector,prefix){(prefix=tchmi_css_escape_selector(prefix)).startsWith(".")||prefix.startsWith("#")||(prefix=`#${prefix}`);let selectorParts=this.__splitOutsideOfBraces(selector,",",["(","["]);for(let i=0,ii=selectorParts.length;i<ii;i++)selectorParts[i].includes(prefix)||(selectorParts[i].includes("%id%")?selectorParts[i]=selectorParts[i].replace("%id%",prefix):selectorParts[i]=prefix+" "+selectorParts[i]);return selectorParts.join(", ").trim()}__splitOutsideOfBraces(value,token,openingBraceChars=["("]){let startindex=0,res=[];for(let i=0,ii=value.length;i<ii;i++){let char=value.charAt(i);if(openingBraceChars.includes(char)){let closingBraceIndex=this.__findMatchingBrace(value,i);closingBraceIndex>i&&(i=closingBraceIndex)}else if('"'===char||"'"===char){let closingQuoteIndex=this.__findMatchingQuote(value,i);closingQuoteIndex>i&&(i=closingQuoteIndex)}else char===token&&(i>startindex&&res.push(value.substring(startindex,i).trim()),startindex=i+1)}return(0===value.length||startindex<value.length)&&res.push(value.substring(startindex).trim()),res}__findMatchingBrace(value,openBraceIndex){let openingBrace=value.charAt(openBraceIndex),closingBrace="";switch(openingBrace){case"(":closingBrace=")";break;case"{":closingBrace="}";break;case"[":closingBrace="]";break;case"<":closingBrace=">";break;default:return-1}let braceCounter=0;for(let i=openBraceIndex+1,ii=value.length;i<ii;i++)switch(value.charAt(i)){case openingBrace:braceCounter++;break;case closingBrace:if(0===braceCounter)return i;braceCounter--;break;case'"':case"'":const closingQuoteIndex=this.__findMatchingQuote(value,i);closingQuoteIndex>0&&(i=closingQuoteIndex)}return-1}__findMatchingQuote(value,openQuoteIndex){let quoteChar=value.charAt(openQuoteIndex);for(let i=openQuoteIndex+1,ii=value.length;i<ii;i++)switch(value.charAt(i)){case"\\":i++;break;case quoteChar:return i}return-1}processGenericStyle(controlName,selector,property,value=null){if(!selector){const tco=TcHmi.Controls.get(controlName);if(void 0!==tco&&0!==tco.getElement().length){if(null==property)return;return void TcHmi.StyleProvider.setSimpleElementStyle(tco.getElement(),property,value)}}selector=this.expandSelector(selector,controlName);let existingStyles=this.getExistingStyleOverwrites(controlName),existingStylesForSelector=this.__getExistingStyleOverwritesForSelector(existingStyles,selector);if("string"==typeof property)"string"==typeof value?""===value?delete existingStylesForSelector[property]:existingStylesForSelector[property]=[value]:null===value?delete existingStylesForSelector[property]:existingStylesForSelector[property]=value;else if(null!=property)for(const key in property)if(property.hasOwnProperty(key)){const keyProperty=property[key];"string"==typeof keyProperty?""===keyProperty?delete existingStylesForSelector[key]:existingStylesForSelector[key]=[keyProperty]:null===keyProperty?delete existingStylesForSelector[key]:existingStylesForSelector[key]=keyProperty}this.writeStyles(controlName,existingStyles)}processBackground(element,valueNew){let styles={};if(valueNew){let hasImage=!1,hasGradient=!1,insertImage=()=>{let imageString=null,gradientString=null,existingStyle=TcHmi.StyleProvider.getSimpleElementStyle(element,"background-image")["background-image"],existingImages=[];if(void 0!==existingStyle&&(existingImages=this.__splitOutsideOfBraces(existingStyle,",")),void 0!==valueNew.image?imageString=null!==valueNew.image&&""!==valueNew.image?`url("${tchmi_path(valueNew.image)}")`:null:existingImages.length>0&&existingImages[0].startsWith("url(")&&(imageString=existingImages[0]),void 0!==valueNew.color)gradientString=null!==valueNew.color?TcHmi.isLinearGradientColor(valueNew.color)?TcHmi.StyleProvider.resolveLinearGradientColorAsCssValue(valueNew.color):"none":null;else if(existingImages.length>0){let existingGradient=existingImages.length>1?existingImages[1]:existingImages[0];(existingGradient.startsWith("linear-gradient(")||existingGradient.startsWith("radial-gradient("))&&(gradientString=existingGradient)}if(hasImage=null!==imageString,hasGradient=null!==gradientString&&"none"!==gradientString,null===imageString&&null===gradientString)existingImages.length>0&&(styles["background-image"]=null);else{let images=[];hasImage&&images.push(imageString),(hasGradient||"none"===gradientString&&!hasImage&&null!==styles["background-color"])&&images.push(gradientString),styles["background-image"]=images.length>0?images:null}},insertSize=()=>{if(hasImage){let width="auto",height="auto";if(void 0!==valueNew.imageWidth&&null!==valueNew.imageWidth&&(width=valueNew.imageWidth+(valueNew.imageWidthUnit||"px")),void 0!==valueNew.imageHeight&&null!==valueNew.imageHeight&&(height=valueNew.imageHeight+(valueNew.imageHeightUnit||"px")),void 0!==valueNew.imagePadding&&null!==valueNew.imagePadding){if("%"===valueNew.imageWidthUnit&&valueNew.imageWidth){let widthSubtractor="";valueNew.imagePadding.left>0&&(widthSubtractor+=" - "+valueNew.imagePadding.left*(valueNew.imageWidth?valueNew.imageWidth/100:1)+(valueNew.imagePadding.leftUnit||"px")),valueNew.imagePadding.right>0&&(widthSubtractor+=" - "+valueNew.imagePadding.right*(valueNew.imageWidth?valueNew.imageWidth/100:1)+(valueNew.imagePadding.rightUnit||"px")),""!==widthSubtractor&&(width=`calc(${width}${widthSubtractor})`)}if("%"===valueNew.imageHeightUnit&&valueNew.imageHeight){let heightSubtractor="";valueNew.imagePadding.top>0&&(heightSubtractor+=" - "+valueNew.imagePadding.top*(valueNew.imageHeight?valueNew.imageHeight/100:1)+(valueNew.imagePadding.topUnit||"px")),valueNew.imagePadding.bottom>0&&(heightSubtractor+=" - "+valueNew.imagePadding.bottom*(valueNew.imageHeight?valueNew.imageHeight/100:1)+(valueNew.imagePadding.bottomUnit||"px")),""!==heightSubtractor&&(height=`calc(${height}${heightSubtractor})`)}}styles["background-size"]=[width+" "+height],hasGradient&&styles["background-size"].push("auto auto")}else styles["background-size"]=null},insertPosition=()=>{if(hasImage){let posX="50%",posY="50%";switch(valueNew.imageHorizontalAlignment){case"Left":posX="0%";break;case"Center":posX="50%";break;case"Right":posX="100%"}switch(valueNew.imageVerticalAlignment){case"Top":posY="0%";break;case"Center":posY="50%";break;case"Bottom":posY="100%"}if(void 0!==valueNew.imagePadding&&null!==valueNew.imagePadding){let posXModifier="";valueNew.imagePadding.left>0&&"Right"!==valueNew.imageHorizontalAlignment&&(posXModifier+=" + "+valueNew.imagePadding.left*("Center"===valueNew.imageHorizontalAlignment?.5:1)+(valueNew.imagePadding.leftUnit||"px")),valueNew.imagePadding.right>0&&"Left"!==valueNew.imageHorizontalAlignment&&(posXModifier+=" - "+valueNew.imagePadding.right*("Center"===valueNew.imageHorizontalAlignment?.5:1)+(valueNew.imagePadding.rightUnit||"px")),""!==posXModifier&&(posX=`calc(${posX}${posXModifier})`);let posYModifier="";valueNew.imagePadding.top>0&&"Bottom"!==valueNew.imageVerticalAlignment&&(posYModifier+=" + "+valueNew.imagePadding.top*("Center"===valueNew.imageVerticalAlignment?.5:1)+(valueNew.imagePadding.topUnit||"px")),valueNew.imagePadding.bottom>0&&"Top"!==valueNew.imageVerticalAlignment&&(posYModifier+=" - "+valueNew.imagePadding.bottom*("Center"===valueNew.imageVerticalAlignment?.5:1)+(valueNew.imagePadding.bottomUnit||"px")),""!==posYModifier&&(posY=`calc(${posY}${posYModifier})`)}styles["background-position"]=[posX+" "+posY],hasGradient&&styles["background-position"].push("50% 50%")}else styles["background-position"]=null},insertCssImageProp=(name,value)=>{hasImage?(styles[name]=[value],hasGradient&&styles[name].push(value)):styles[name]=null};(()=>{if(void 0!==valueNew.color)if(TcHmi.isSolidColor(valueNew.color)){let resolvedColor=TcHmi.StyleProvider.resolveSolidColorAsCssValue(valueNew.color);styles["background-color"]=null!==resolvedColor?[resolvedColor]:null}else styles["background-color"]=null})(),insertImage(),insertSize(),insertPosition(),insertCssImageProp("background-repeat","no-repeat"),insertCssImageProp("background-attachment","scroll"),insertCssImageProp("background-clip","border-box"),insertCssImageProp("background-origin","padding-box")}else{let names=["color","image","size","position","repeat","origin","clip","attachment"];for(let i=0,ii=names.length;i<ii;i++)styles["background-"+names[i]]=null}let stylesToWrite={};for(let key in styles)if(styles.hasOwnProperty(key)){const style=styles[key];stylesToWrite[key]=style?style.join(", "):null}TcHmi.StyleProvider.setSimpleElementStyle(element,stylesToWrite)}processFillColor(element,valueNew){let SvgElements;if(element&&"object"==typeof element){if(void 0!==element.length){if(!element[0])return;SvgElements=element}else SvgElements=[element];for(let elemenCounter=0,elemLength=SvgElements.length;elemenCounter<elemLength;elemenCounter++){const SvgElement=SvgElements[elemenCounter];if(!(SvgElement instanceof SvgElement.ownerDocument.defaultView.SVGElement))continue;let defsParent=SvgElement.ownerSVGElement||SvgElement,defs=defsParent.querySelector("defs");if(defs){let oldId="",oldFill=TcHmi.StyleProvider.getSimpleElementStyle(SvgElement,"fill").fill;if(oldFill){oldId=oldFill.replace(/url\('?"?\#|'?"?\)/g,"");let currentGradientList=defs.querySelectorAll("linearGradient.tchmi-styleprovider-linear-gradient");for(let iterator=0;iterator<currentGradientList.length;iterator++){let currentGradient=currentGradientList[iterator];if(oldId===currentGradient.id){currentGradient.parentElement.removeChild(currentGradient);break}}}}else TcHmi.isLinearGradientColor(valueNew)&&(defs=SvgElement.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),defsParent.insertBefore(defs,defsParent.firstElementChild));if(valueNew){if(TcHmi.isSolidColor(valueNew))SvgElement.style.fill=TcHmi.StyleProvider.resolveSolidColorAsCssValue(valueNew);else if(TcHmi.isLinearGradientColor(valueNew)){let gradientColor=valueNew,gradient=SvgElement.ownerDocument.createElementNS("http://www.w3.org/2000/svg","linearGradient");gradient.setAttribute("x1","0"),gradient.setAttribute("y1","1"),gradient.setAttribute("x2","0"),gradient.setAttribute("y2","0"),gradient.classList.add("tchmi-styleprovider-linear-gradient"),gradient.id="tchmi-styleprovider-"+tchmi_create_guid(),gradient.setAttribute("gradientTransform","rotate("+gradientColor.angle+", 0.5, 0.5)");for(let i=0,ii=gradientColor.stopPoints.length;i<ii;i++){let stopPoint=gradientColor.stopPoints[i];if(void 0===stopPoint.stop||null===stopPoint.stop)if(0===i)stopPoint.stop="0%";else if(i===ii-1)stopPoint.stop="100%";else{let previous=0;gradientColor.stopPoints[i-1].stop&&(previous=parseFloat(gradientColor.stopPoints[i-1].stop));let j,next=null;for(j=i+1;j<gradientColor.stopPoints.length;j++){let localStop=gradientColor.stopPoints[j].stop;if(null!=localStop){next=parseFloat(localStop);break}}null===next&&(next=100,j--);let unit="";gradientColor.stopPoints[i-1].stop&&(unit=gradientColor.stopPoints[i-1].stop.replace(/[0-9\.]/g,"")),stopPoint.stop=previous+(next-previous)/(j-i)+unit}let stop=document.createElementNS("http://www.w3.org/2000/svg","stop");stop.setAttribute("offset",stopPoint.stop),stop.setAttribute("stop-color",stopPoint.color),gradient.appendChild(stop)}defs?.appendChild(gradient),SvgElement.style.fill="url(#"+gradient.id+")"}}else SvgElement.style.fill=""}}}processStrokeColor(element,valueNew){TcHmi.isSolidColor(valueNew)?TcHmi.StyleProvider.setSimpleElementStyle(element,"stroke",TcHmi.StyleProvider.resolveSolidColorAsCssValue(valueNew)):TcHmi.StyleProvider.setSimpleElementStyle(element,"stroke",null)}processTextColor(element,valueNew){TcHmi.isSolidColor(valueNew)?TcHmi.StyleProvider.setSimpleElementStyle(element,"color",TcHmi.StyleProvider.resolveSolidColorAsCssValue(valueNew)):TcHmi.StyleProvider.setSimpleElementStyle(element,"color",null)}processBorderColor(element,valueNew){let styles={};if(TcHmi.isSolidColor(valueNew))styles["border-color"]=TcHmi.StyleProvider.resolveSolidColorAsCssValue(valueNew),styles["border-image-source"]=null,styles["border-image-slice"]=null;else if(TcHmi.isLinearGradientColor(valueNew))styles["border-image-source"]=TcHmi.StyleProvider.resolveLinearGradientColorAsCssValue(valueNew),styles["border-image-slice"]="1",styles["border-color"]=null;else{let names=["color","image","image-source","image-slice"];for(let i=0,ii=names.length;i<ii;i++)styles["border-"+names[i]]=null}TcHmi.StyleProvider.setSimpleElementStyle(element,styles)}processBorderWidth(element,valueNew){const sides=["top","right","bottom","left"];let newCss={};for(let i=0,ii=sides.length;i<ii;i++)if(valueNew){let value=valueNew[sides[i]];newCss["border-"+sides[i]+"-width"]=null==value?"":value+"px"}else newCss["border-"+sides[i]+"-width"]="";TcHmi.StyleProvider.setSimpleElementStyle(element,newCss)}processBorderRadius(element,valueNew){const sides=["topLeft","topRight","bottomRight","bottomLeft"],cssSides=["top-left","top-right","bottom-right","bottom-left"];let newCss={};for(let i=0,ii=sides.length;i<ii;i++)if(valueNew){let value=valueNew[sides[i]],unit=valueNew[sides[i]+"Unit"];unit=unit||"px",newCss[`border-${cssSides[i]}-radius`]=null==value?"":value+unit}else newCss[`border-${cssSides[i]}-radius`]="";TcHmi.StyleProvider.setSimpleElementStyle(element,newCss)}processBorderStyle(element,valueNew){const sides=["top","right","bottom","left"];let newCss={};for(let i=0,ii=sides.length;i<ii;i++)if(valueNew){let value,originalValue=valueNew[sides[i]];switch(originalValue){case"Solid":case"Dotted":case"Dashed":case"None":value=originalValue.toLowerCase();break;default:value=""}newCss[`border-${sides[i]}-style`]=value}else newCss[`border-${sides[i]}-style`]="";TcHmi.StyleProvider.setSimpleElementStyle(element,newCss)}processBoxShadow(element,valueNew){if(valueNew)if(0===valueNew.length)TcHmi.StyleProvider.setSimpleElementStyle(element,"box-shadow","none");else{let shadows=[];for(let i=0,ii=valueNew.length;i<ii;i++){let shadow="";valueNew[i].inset&&(shadow+="inset "),valueNew[i].offsetX?shadow+=valueNew[i].offsetX+(valueNew[i].offsetXUnit||"px")+" ":shadow+="0px ",valueNew[i].offsetY?shadow+=valueNew[i].offsetY+(valueNew[i].offsetYUnit||"px")+" ":shadow+="0px ",valueNew[i].blur?shadow+=valueNew[i].blur+(valueNew[i].blurUnit||"px")+" ":shadow+="0px ",valueNew[i].spread?shadow+=valueNew[i].spread+(valueNew[i].spreadUnit||"px")+" ":shadow+="0px ",TcHmi.isSolidColor(valueNew[i].color)?shadow+=TcHmi.StyleProvider.resolveSolidColorAsCssValue(valueNew[i].color):shadow+="transparent",shadows.push(shadow)}TcHmi.StyleProvider.setSimpleElementStyle(element,"box-shadow",shadows.join(", "))}else TcHmi.StyleProvider.setSimpleElementStyle(element,"box-shadow",null)}processFontFamily(element,valueNew){TcHmi.StyleProvider.setSimpleElementStyle(element,"font-family",valueNew)}processFontSize(element,valueNew,unitNew){null==valueNew?TcHmi.StyleProvider.setSimpleElementStyle(element,"font-size",null):TcHmi.StyleProvider.setSimpleElementStyle(element,"font-size",valueNew+unitNew)}processFontStyle(element,valueNew){let value;switch(valueNew){case"Normal":case"Italic":case"Oblique":value=valueNew.toLowerCase();break;default:value=null}TcHmi.StyleProvider.setSimpleElementStyle(element,"font-style",value)}processFontWeight(element,valueNew){let value;switch(valueNew){case"Normal":case"Bold":value=valueNew.toLowerCase();break;default:value=null}TcHmi.StyleProvider.setSimpleElementStyle(element,"font-weight",value)}processVisibility(element,valueNew){let newCss={};switch(valueNew){case"Collapsed":newCss.display="none",newCss.visibility="";break;case"Hidden":newCss.display="",newCss.visibility="hidden";break;default:newCss.display="",newCss.visibility=""}TcHmi.StyleProvider.setSimpleElementStyle(element,newCss)}processContentHorizontalAlignment(element,valueNew){let newCss={};switch(valueNew){case"Center":newCss.display="flex",newCss["justify-content"]="center";break;case"Right":newCss.display="flex",newCss["justify-content"]="flex-end";break;case"Left":newCss.display="flex",newCss["justify-content"]="flex-start";break;default:newCss.display="",newCss["justify-content"]=""}TcHmi.StyleProvider.setSimpleElementStyle(element,newCss)}processContentVerticalAlignment(element,valueNew){let newCss={};switch(valueNew){case"Center":newCss.display="flex",newCss["align-items"]="center";break;case"Bottom":newCss.display="flex",newCss["align-items"]="flex-end";break;case"Top":newCss.display="flex",newCss["align-items"]="flex-start";break;default:newCss.display="",newCss["align-items"]=""}TcHmi.StyleProvider.setSimpleElementStyle(element,newCss)}processContentPadding(element,valueNew){const sides=["top","right","bottom","left"];let newCss={};for(let i=0,ii=sides.length;i<ii;i++){const valueToWrite=valueNew?.[sides[i]];if(valueToWrite){let value=valueToWrite,unit=valueNew?.[sides[i]+"Unit"]??"px";newCss[`padding-${sides[i]}`]=null==value?"":value+unit}else newCss[`padding-${sides[i]}`]=""}TcHmi.StyleProvider.setSimpleElementStyle(element,newCss)}processTransform(element,valueNew,order){let newCss={};if(void 0===order&&(newCss={"transform-origin":"","-webkit-transform-origin":"",perspective:"","-webkit-perspective":"","perspective-origin":"","-webkit-perspective-origin":""}),valueNew){let newTransforms;newTransforms=Array.isArray(valueNew)?valueNew:[valueNew];let newTransformStrings=[];for(let i=0,ii=newTransforms.length;i<ii;i++){let transformString="",newTransform=newTransforms[i];switch(newTransform.transformType){case"Translate":newTransform.x=newTransform.x||0,newTransform.xUnit=newTransform.xUnit||"px",newTransform.y=newTransform.y||0,newTransform.yUnit=newTransform.yUnit||"px",newTransform.z=newTransform.z||0,newTransform.zUnit=newTransform.zUnit||"px",transformString="translate3d("+newTransform.x+newTransform.xUnit+", "+newTransform.y+newTransform.yUnit+", "+newTransform.z+newTransform.zUnit+")";break;case"Rotate":transformString=void 0===newTransform.vector?"rotate(":`rotate3d(${newTransform.vector.x}, ${newTransform.vector.y}, ${newTransform.vector.z}, `,transformString+=newTransform.angle+(void 0!==newTransform.angleUnit?newTransform.angleUnit:"deg"),transformString+=")";break;case"Scale":transformString="scale3d(",transformString+=(void 0!==newTransform.x?newTransform.x:1)+", ",transformString+=(void 0!==newTransform.y?newTransform.y:1)+", ",transformString+=void 0!==newTransform.z?newTransform.z:1,transformString+=")";break;case"Skew":const angles=[newTransform.xAngle??0,newTransform.yAngle??0],angleUnits=[newTransform.xAngleUnit,newTransform.xAngleUnit];for(let j=0,jj=angles.length;j<jj;j++)switch(angleUnits[j]){case"grad":angles[j]=angles[j]*(Math.PI/200);break;case"turn":angles[j]=angles[j]*(Math.PI/.5);break;case"rad":break;default:angles[j]=angles[j]*(Math.PI/180)}transformString=`matrix(1, ${Math.tan(angles[1])}, ${Math.tan(angles[0])}, 1, 0, 0)`;break;case"Origin":void 0===newTransform.x&&(newTransform.x=50,newTransform.xUnit="%"),void 0===newTransform.y&&(newTransform.y=50,newTransform.yUnit="%"),void 0===newTransform.z&&(newTransform.z=0,newTransform.zUnit=void 0),newCss["-webkit-transform-origin"]=newTransform.x+(void 0!==newTransform.xUnit?newTransform.xUnit:"px")+" "+newTransform.y+(void 0!==newTransform.yUnit?newTransform.yUnit:"px")+" "+newTransform.z+(void 0!==newTransform.zUnit?newTransform.zUnit:"px"),newCss["transform-origin"]=newCss["-webkit-transform-origin"];break;case"Perspective":newCss["-webkit-perspective"]=newTransform.distance+(void 0!==newTransform.distanceUnit?newTransform.distanceUnit:"px"),newCss.perspective=newCss["-webkit-perspective"],void 0!==newTransform.origin&&(void 0===newTransform.origin.x&&(newTransform.origin.x=50,newTransform.origin.xUnit="%"),void 0===newTransform.origin.y&&(newTransform.origin.y=50,newTransform.origin.yUnit="%"),newCss["-webkit-perspective-origin"]=newTransform.origin.x+(void 0!==newTransform.origin.xUnit?newTransform.origin.xUnit:"px")+" "+newTransform.origin.y+(void 0!==newTransform.origin.yUnit?newTransform.origin.yUnit:"px"),newCss["perspective-origin"]=newCss["-webkit-perspective-origin"])}newTransformStrings.push(transformString)}newCss["-webkit-transform"]=newTransformStrings.join(" "),newCss.transform=newCss["-webkit-transform"]}else newCss["-webkit-transform"]="",newCss.transform="";TcHmi.StyleProvider.setSimpleElementStyle(element,newCss)}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Type){class SharedCache{}SharedCache.Raw=new Map,SharedCache.Resolved=new Map,Type.SharedCache=SharedCache;Type.TypeManager=class{constructor(){this.__error=TcHmi.Errors.NONE,this.__watching=!1,this.__subscrCommands=[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"GetDefinitions",writeValue:{resolve:"None",type:"general"}},{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"GetDefinitions",writeValue:{resolve:"None",type:"framework"}},{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"GetDefinitions",writeValue:{resolve:"None",type:"server"}},{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"GetDefinitions",writeValue:{resolve:"None",type:"project"}}],this.__hasCalledInitCallbackOnce=!1,this.__typesInitializing=new Set(["general","server","framework","project"]),TcHmi.EventProvider.register("onWebSocketOpened",this.__onWebSocketOpened()),TcHmi.EventProvider.register("onWebSocketClosed",this.__onWebSocketClosed())}__onWebSocketOpened(){let __this=this;return function(event,data){!0===__this.__hasCalledInitCallbackOnce&&__this.__error!==TcHmi.Errors.NONE&&(__this.__error=TcHmi.Errors.NONE,__this.doWatchSchemaDefinitions())}}__onWebSocketClosed(){let __this=this;return function(event,data){__this.__error=TcHmi.Errors.E_WEBSOCKET_NOT_READY}}__cacheRawSchemaDefinitions(rv,source){void 0!==rv.definitions&&SharedCache.Raw.set(source,rv)}__processGetDefinitionsResponse(data){if(this.__error!==TcHmi.Errors.NONE)return{code:this.__error,message:TcHmi.Errors[this.__error],domain:"TcHmi.System.Type.TypeManager"};if(!data)return{code:TcHmi.Errors.ERROR,reason:"Failed to resolve types due to invalid response. Missing data.",domain:"TcHmi.System.Type.TypeManager"};if(data.error!==TcHmi.Errors.NONE)return data.details?data.details:{code:data.error};let response=data.response;if(!response)return{code:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_MISSING],reason:"Missing response from server.",domain:"TcHmi.System.Type.TypeManager"};if(response.error)return{code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,reason:"Error in response from server with id: "+response.id,domain:"TcHmi.System.Type.TypeManager",errors:[response.error]};let commands=response.commands;if(!commands)return{code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:"Missing commands in response from server with id: "+response.id,domain:"TcHmi.System.Type.TypeManager"};const bUpdateCase=!this.__typesInitializing.size;let errorDetails=[];for(const command of commands){if(!command)return{code:TcHmi.Errors.E_SERVER_COMMAND_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_MISSING],reason:'Missing command for symbol: "GetDefinitions" in response from server with id: '+response.id,domain:"TcHmi.System.Type.TypeManager"};if(command.error)return{code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,reason:'Error in command for symbol: "GetDefinitions" in response from server with id: '+response.id,domain:"TcHmi.System.Type.TypeManager",errors:[command.error]};let wv=command.writeValue;if(!wv){errorDetails.push({code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,reason:"Failed to resolve type due to invalid response command for symbol="+command.symbol+". Missing writeValue property."});continue}if(!wv.type){errorDetails.push({code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,reason:"Failed to resolve type due to invalid response command for symbol="+command.symbol+". Missing type property in writeValue."});continue}let rv=command.readValue;rv?"project"===wv.type||Object.keys(rv).length?(this.__cacheRawSchemaDefinitions(rv,wv.type),this.__typesInitializing.delete(wv.type)):errorDetails.push({code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,reason:"Failed to resolve types for namespace="+wv.type+" due to invalid response command for symbol="+command.symbol+". Got no types which is an error."}):errorDetails.push({code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,reason:"Failed to resolve types for namespace="+wv.type+" due to invalid response command for symbol="+command.symbol+". Missing readValue property."})}if(this.__typesInitializing.size)return{code:TcHmi.Errors.ERROR,reason:"Failed to resolve type definitions for namespace="+Array.from(this.__typesInitializing).join(", "),domain:"TcHmi.System.Type.TypeManager",errors:errorDetails};if(bUpdateCase){const toResolve=Array.from(SharedCache.Resolved.keys());SharedCache.Resolved.clear();for(const typeId of toResolve){let res=this.getSchemaEx(typeId);res.error===TcHmi.Errors.NONE&&(TcHmi.EventProvider.raise("System.onTypeDefinitionChanged<"+typeId+">",{typeId:typeId,typeSchema:res.schema}),TcHmi.EventProvider.raise("System.onTypeDefinitionChanged",{typeId:typeId,typeSchema:res.schema}))}}return{code:TcHmi.Errors.NONE}}doWatchSchemaDefinitions(callback){if(this.__watching)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,reason:"Multiple calls to watch for type definition change detected.",domain:"TcHmi.System.Type.TypeManager"}});if(!1===TcHmi.Server.isWebsocketReady())return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,reason:"Websocket connection not ready.",domain:"TcHmi.System.Type.TypeManager"}});let __this=this,interval=5e3;return TCHMI_ENGINEERING&&(interval=1e3),this.__watching=!0,TcHmi.Server.subscribeEx(this.__subscrCommands,interval,{timeout:TcHmi.System.config.tcHmiServer.websocketSystemTimeout},(function(data){let error=__this.__processGetDefinitionsResponse(data);__this.__hasCalledInitCallbackOnce||(TcHmi.Callback.callSafeEx(callback,__this,{error:error.code,details:error}),__this.__hasCalledInitCallbackOnce=!0)}))}doForceSchemaDefinitions(callback){let __this=this;TcHmi.Server.requestEx({requestType:"ReadWrite",commands:this.__subscrCommands},{timeout:TcHmi.System.config.tcHmiServer.websocketSystemTimeout},(function(data){let error=__this.__processGetDefinitionsResponse(data);TcHmi.Callback.callSafeEx(callback,__this,{error:error.code,details:error})}))}getSchema(id){let res=this.getSchemaEx(id);return res.error===TcHmi.Errors.NONE&&res.schema?res.schema:null}getSchemaEx(id){let res;try{res=Schema.Helper.__resolveRawSchemaDefinition(id,null,new Map)}catch(e){res={error:TcHmi.Errors.E_EXCEPTION,details:{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:"An uncaught exception occurred in the resolving datatype schema",exception:e,domain:"TcHmi.System.Type.TypeManager"}}}return res}};class Schema{static resolveRefs(schema,source){return source||(source=null),Schema.Helper.__resolveRawSchema(schema,source,new Map).schema}static resolveType(schema){if(schema.convert)return;let schemaType=schema.type;if(!schemaType){let schemaOf=schema.oneOf;if(schemaOf||(schemaOf=schema.anyOf),schemaOf){schemaType=[];for(const s of schemaOf)if(!s.convert){let type2=Schema.resolveType(s);if(Array.isArray(type2))for(const subType2 of type2)schemaType.includes(subType2)||schemaType.push(subType2);else type2&&!schemaType.includes(type2)&&schemaType.push(type2)}0===schemaType.length?schemaType=void 0:1===schemaType.length&&(schemaType=schemaType[0])}else schemaType=["string","number","object","boolean","integer","array","null"]}return schemaType}static resolveTypeConversionRuleSchemas(schema){let res=new Map;if(schema.type&&"string"==typeof schema.type)schema.convert&&res.set(schema.type,schema);else if(schema.type&&Array.isArray(schema.type)){if(schema.convert)for(let i=0,ii=schema.type.length;i<ii;i++)res.set(schema.type[i],schema)}else{let schemaOf=schema.oneOf;if(schemaOf||(schemaOf=schema.anyOf),schemaOf)for(let i=0,ii=schemaOf.length;i<ii;i++){let ruleSchemas=Schema.resolveTypeConversionRuleSchemas(schemaOf[i]);ruleSchemas&&ruleSchemas.forEach(((value,key)=>{res.set(key,value)}))}else{let schemaType=["string","number","object","boolean","integer","array","null"];if(schema.convert)for(let i=0,ii=schemaType.length;i<ii;i++)res.set(schemaType[i],schema)}}return res}static resolveDefault(schema){if(!schema)return null;let targetType,ruleSchemas=Schema.resolveTypeConversionRuleSchemas(schema);if(schema.default)return tchmi_clone_object(TcHmi.ValueConverter.toSchemaType(schema.default,schema));if(schema.type)if(Array.isArray(schema.type)){let firstType=schema.type[0];firstType&&(targetType=firstType)}else targetType=schema.type;if(targetType&&ruleSchemas){let targetRuleSchema=ruleSchemas.get(targetType);targetRuleSchema&&targetRuleSchema.convert&&(targetType=targetRuleSchema.convert)}switch(targetType){case"object":{let res={};const properties=schema.properties;if(properties)for(const[property,propertySchema]of Object.entries(properties))res[property]=Schema.resolveDefault(propertySchema);return res}case"array":{let res=[];const items=schema.items;if(items&&schema.minItems){let itemSchema;itemSchema=Array.isArray(items)?items[0]:items;const value=Schema.resolveDefault(itemSchema);for(let i=0;i<schema.minItems;i++)res.push(0===i?value:tchmi_clone_object(value))}return res}case"string":return"";case"integer":case"number":return 0;case"boolean":return!1}return schema.oneOf?Schema.resolveDefault(schema.oneOf[0]):schema.anyOf?Schema.resolveDefault(schema.anyOf[0]):null}}Type.Schema=Schema,function(Schema){class Helper{static __resolveRefIdParts(id){if(id.startsWith("tchmi:")){let sharpIndex=id.indexOf("#");if(-1===sharpIndex)return{error:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,details:{code:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID_REF_ID],reason:'Reference id: "'+id+'" is not valid. Missing "#".',domain:"TcHmi.System.Type.TypeManager"}};let source=id.substr(6,sharpIndex-6);if(!source)return{error:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,details:{code:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID_REF_ID],reason:'Reference id: "'+id+'" is not valid. Missing name of schema source between "tchmi:" and "#".',domain:"TcHmi.System.Type.TypeManager"}};let path=id.substr(sharpIndex+2,id.length-sharpIndex+2),pathTokens=path.split("/");return{error:TcHmi.Errors.NONE,parts:{isRelative:!1,source:source,path:path,pathTokens:pathTokens}}}if(id.startsWith("#")){let sharpIndex=id.indexOf("#");if(-1===sharpIndex)return{error:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,details:{code:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID_REF_ID],reason:'Reference id: "'+id+'" is not valid. Missing "#".',domain:"TcHmi.System.Type.TypeManager"}};let path=id.substr(sharpIndex+2,id.length-sharpIndex+2),pathTokens=path.split("/");return{error:TcHmi.Errors.NONE,parts:{isRelative:!0,path:path,pathTokens:pathTokens}}}return{error:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,details:{code:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID_REF_ID],reason:'Reference id: "'+id+'" is not valid.',domain:"TcHmi.System.Type.TypeManager"}}}static __resolveRawSchemaDefinitionPart(partSchema,sourceOrRootSchema,path,$refPath){let source,rootSchema;"string"==typeof sourceOrRootSchema?source=sourceOrRootSchema:"object"==typeof sourceOrRootSchema&&(rootSchema=sourceOrRootSchema),source?$refPath.set("tchmi:"+source+"#"+path,null):$refPath.set("#"+path,null);for(const[key,prop]of Object.entries(partSchema)){if("$ref"===key&&"string"==typeof prop){let resolvedSchema,bAbort=!1;if($refPath.has(prop))bAbort=!0;else if(prop.startsWith("#")){let propPathSanitized;propPathSanitized=source?"tchmi:"+source+prop:prop,$refPath.has(propPathSanitized)&&(bAbort=!0)}if(bAbort)return resolvedSchema=partSchema,{error:TcHmi.Errors.NONE,part:resolvedSchema};let newBaseId=null;const propURIDecoded=decodeURIComponent(prop);if(SharedCache.Resolved.has(prop)?(resolvedSchema=SharedCache.Resolved.get(prop),newBaseId=prop):SharedCache.Resolved.has(propURIDecoded)&&(resolvedSchema=SharedCache.Resolved.get(propURIDecoded),newBaseId=propURIDecoded),!resolvedSchema){let $refPathNew=new Map;$refPath.forEach(((value,key)=>{$refPathNew.set(key,value)}));let res=this.__resolveRawSchemaDefinition(prop,source||rootSchema,$refPathNew);if(res&&res.error===TcHmi.Errors.NONE)newBaseId=prop,resolvedSchema=res.schema;else{let resDecoded=this.__resolveRawSchemaDefinition(propURIDecoded,source,$refPathNew);if(!resDecoded||resDecoded.error!==TcHmi.Errors.NONE)return resDecoded;newBaseId=propURIDecoded,resolvedSchema=resDecoded.schema}}let clone=tchmi_clone_object(resolvedSchema),newIdPartsRes=Helper.__resolveRefIdParts(newBaseId);if(newIdPartsRes.error!==TcHmi.Errors.NONE)return{error:newIdPartsRes.error,details:newIdPartsRes.details};let idURIEncoded,newIdParts=newIdPartsRes.parts;idURIEncoded=newIdParts.source?"tchmi:"+newIdParts.source+"#":"#";for(let token of newIdParts.pathTokens)idURIEncoded+="/"+encodeURIComponent(token);return clone.id=idURIEncoded,{error:TcHmi.Errors.NONE,part:clone}}if("allOf"===key&&Array.isArray(prop)){let resolvedSchema={};const merge=(o1,o2)=>{let keys=Object.keys(o2);for(let i=0,ii=keys.length;i<ii;i++){let key=keys[i];o1[key]&&"object"==typeof o1[key]?merge(o1[key],o2[key]):o1[key]=o2[key]}};for(let i=0,ii=prop.length;i<ii;i++){let entry=prop[i],$refPathNew=new Map;$refPath.forEach(((value,key)=>{$refPathNew.set(key,value)}));let newPath=path+"/allOf/"+i;source?$refPathNew.set("tchmi:"+source+"#"+path,null):$refPathNew.set("#"+path,null);let res=this.__resolveRawSchemaDefinitionPart(entry,source||rootSchema,newPath,$refPathNew);if(res.error!==TcHmi.Errors.NONE||!res.part)return res;merge(resolvedSchema,res.part)}return{error:TcHmi.Errors.NONE,part:resolvedSchema}}if(null!==prop&&"object"==typeof prop){let $refPathNew=new Map;$refPath.forEach(((value,key)=>{$refPathNew.set(key,value)}));let newPath=path+"/"+key;source?$refPathNew.set("tchmi:"+source+"#"+path,null):$refPathNew.set("#"+path,null);let res=this.__resolveRawSchemaDefinitionPart(prop,source||rootSchema,newPath,$refPathNew);if(res.error!==TcHmi.Errors.NONE)return res;partSchema[key]=res.part}}return{error:TcHmi.Errors.NONE,part:partSchema}}static __resolveRawSchemaDefinition(id,sourceOrDefinitionsSchema,$refPath){let schema=SharedCache.Resolved.get(id);if(schema)return{error:TcHmi.Errors.NONE,schema:schema};let res=Helper.__resolveRefIdParts(id);if(res.error!==TcHmi.Errors.NONE)return{error:res.error,details:res.details};let parts=res.parts;if(parts.isRelative){if(parts.isRelative&&sourceOrDefinitionsSchema){let definitions;if("string"==typeof sourceOrDefinitionsSchema?definitions=SharedCache.Raw.get(sourceOrDefinitionsSchema):"object"==typeof sourceOrDefinitionsSchema&&(definitions=sourceOrDefinitionsSchema),!definitions)return{error:TcHmi.Errors.E_SCHEMA_UNKNOWN_SOURCE,details:{code:TcHmi.Errors.E_SCHEMA_UNKNOWN_SOURCE,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_UNKNOWN_SOURCE],reason:"Can not find definitions targeted within ref: "+id,domain:"TcHmi.System.Type.TypeManager"}};let rawSchemaByPath=definitions;for(let i=0;i<parts.pathTokens.length&&rawSchemaByPath;i++){rawSchemaByPath=rawSchemaByPath[parts.pathTokens[i]]}if(!rawSchemaByPath)return{error:TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION,details:{code:TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION],reason:"string"==typeof sourceOrDefinitionsSchema?'Can not find definition for path: "'+parts.path+'" in source: "'+sourceOrDefinitionsSchema+'" targeted within ref: '+id:'Can not find definition for path: "'+parts.path+'" targeted within ref: '+id,domain:"TcHmi.System.Type.TypeManager"}};let newIdPartsRes=Helper.__resolveRefIdParts(id);if(newIdPartsRes.error!==TcHmi.Errors.NONE)return{error:newIdPartsRes.error,details:newIdPartsRes.details};let newIdURIEncoded,newIdParts=newIdPartsRes.parts;newIdURIEncoded=parts.source?"tchmi:"+parts.source+"#":"#";for(let token of newIdParts.pathTokens)newIdURIEncoded+="/"+encodeURIComponent(token);let rawSchemaByPathClone=tchmi_clone_object(rawSchemaByPath);rawSchemaByPathClone.id=newIdURIEncoded;let $refPathNew=new Map;$refPath.forEach(((value,key)=>{$refPathNew.set(key,value)})),$refPathNew.set(id,null);let resolvePartResult=Helper.__resolveRawSchemaDefinitionPart(rawSchemaByPathClone,parts.source,"/"+parts.path,$refPathNew);if(resolvePartResult.error!==TcHmi.Errors.NONE){let res={error:TcHmi.Errors.E_SCHEMA_NOT_RESOLVED,details:{code:TcHmi.Errors.E_SCHEMA_NOT_RESOLVED,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_NOT_RESOLVED],reason:'Failed to resolve schema for path: "'+parts.path+'" in source: "'+parts.source+'" like targeted within ref: '+id,domain:"TcHmi.System.Type.TypeManager"}};return resolvePartResult.details&&res.details&&(res.details.errors=[resolvePartResult.details]),res}return resolvePartResult.part?{error:TcHmi.Errors.NONE,schema:resolvePartResult.part}:resolvePartResult}return{error:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,details:{code:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID_REF_ID],reason:'Reference id: "'+id+'" is not valid.',domain:"TcHmi.System.Type.TypeManager"}}}{if(!parts.source)return{error:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,details:{code:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID_REF_ID],reason:'Reference id: "'+id+'" is not valid. Missing name of source between "tchmi:" and "#".',domain:"TcHmi.System.Type.TypeManager"}};let source=SharedCache.Raw.get(parts.source);if(!source)return{error:TcHmi.Errors.E_SCHEMA_UNKNOWN_SOURCE,details:{code:TcHmi.Errors.E_SCHEMA_UNKNOWN_SOURCE,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_UNKNOWN_SOURCE],reason:'Can not find source: "'+parts.source+'" like targeted within ref: '+id,domain:"TcHmi.System.Type.TypeManager"}};let rawSchemaByPath=source;for(let i=0;i<parts.pathTokens.length&&rawSchemaByPath;i++){rawSchemaByPath=rawSchemaByPath[parts.pathTokens[i]]}if(!rawSchemaByPath)return{error:TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION,details:{code:TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION],reason:'Can not find definition for path: "'+parts.path+'" in source: "'+parts.source+'" like targeted within ref: '+id,domain:"TcHmi.System.Type.TypeManager"}};let rawSchemaByPathClone=tchmi_clone_object(rawSchemaByPath),$refPathNew=new Map;$refPath.forEach(((value,key)=>{$refPathNew.set(key,value)})),$refPathNew.set(id,null);let newIdURIEncoded,resolvePartResult=Helper.__resolveRawSchemaDefinitionPart(rawSchemaByPathClone,parts.source,"/"+parts.path,$refPathNew);if(resolvePartResult.error!==TcHmi.Errors.NONE){let res={error:TcHmi.Errors.E_SCHEMA_NOT_RESOLVED,details:{code:TcHmi.Errors.E_SCHEMA_NOT_RESOLVED,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_NOT_RESOLVED],reason:'Failed to resolve schema for path: "'+parts.path+'" in source: "'+parts.source+'" like targeted within ref: '+id,domain:"TcHmi.System.Type.TypeManager"}};return resolvePartResult.details&&res.details&&(res.details.errors=[resolvePartResult.details]),res}if(!resolvePartResult.part)return resolvePartResult;newIdURIEncoded=parts.source?"tchmi:"+parts.source+"#":"#";for(let token of parts.pathTokens)newIdURIEncoded+="/"+encodeURIComponent(token);return resolvePartResult.part.id=newIdURIEncoded,SharedCache.Resolved.set(id,resolvePartResult.part),{error:TcHmi.Errors.NONE,schema:resolvePartResult.part}}}static __resolveRawSchema(schema,source,$refPath){let schemaClone=tchmi_clone_object(schema),$refPathNew=new Map;$refPath.forEach(((value,key)=>{$refPathNew.set(key,value)}));let resolvePartResult=Helper.__resolveRawSchemaDefinitionPart(schemaClone,source||schema,"",$refPathNew);return resolvePartResult.error!==TcHmi.Errors.NONE?resolvePartResult:resolvePartResult.part?(source&&resolvePartResult.part&&resolvePartResult.part.id&&!resolvePartResult.part.id.includes("tchmi:")&&(resolvePartResult.part.id="tchmi:"+source+resolvePartResult.part.id),{error:TcHmi.Errors.NONE,schema:resolvePartResult.part}):resolvePartResult}}Schema.Helper=Helper}(Schema=Type.Schema||(Type.Schema={}))}(System.Type||(System.Type={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){let SymbolState;!function(SymbolState){SymbolState[SymbolState.Invalid=0]="Invalid",SymbolState[SymbolState.Ready=10]="Ready",SymbolState[SymbolState.Destroyed=20]="Destroyed"}(SymbolState=System.SymbolState||(System.SymbolState={}));class Symbol{constructor(p){let expression;if(this.__diagGUID="",this.__state=SymbolState.Invalid,this.__schema=null,this.__destroyTypeDefinitionChanged=null,TCHMI_CONSOLE_LOG_LEVEL>=4&&(this.__diagGUID=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, ObjectScopeDiagGUID="+this.__diagGUID+"] constructor called with:",p),this.__referenceDelegation={},"string"==typeof p?expression=p:(expression=p.expression,p.ctx&&(this.__ctx=p.ctx)),System.isParameterTypeInvalid(expression,"expression",{type:"string",required:"valueNeeded"}))throw new SyntaxError("Parameter expression: '"+expression+"' is not a valid symbol expression.");if(this.__expression=new TcHmi.SymbolExpression(expression),this.__expression.getType()===TcHmi.SymbolType.Invalid){let message="Parameter expression: '"+expression+"' is not a valid symbol expression.";throw TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] constructor failed with: "+message),new SyntaxError(message)}this.__state=SymbolState.Ready}static resolveServerSymbolSchemaCache(callback){let __this=this;TcHmi.Server.requestEx({requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage"],symbol:"ListSymbols"}]},null,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error!==TcHmi.Errors.NONE)TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details});else if(data.results&&data.results.length){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,__this,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR]}})},success:data=>{let rv=data.results[0].value;if(rv){for(let symbol in rv){let SCHEMA=rv[symbol].SCHEMA;if(SCHEMA){let res=TcHmi.System.Type.Schema.Helper.__resolveRawSchema(SCHEMA,null,new Map);__this.__SERVER_SYMBOL_SCHEMA_CACHE[symbol]=res}}TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})}else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_READVALUE_MISSING,details:{code:TcHmi.Errors.E_SERVER_READVALUE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_READVALUE_MISSING],reason:"ListSymbols has no valid content.",domain:"TcHmi.System.Symbol"}})}}))}__onTypeDefinitionChanged(){let __this=this;return function(e,data){__this.__schema=null;let rootSchema=TcHmi.System.Services.typeManager?.getSchema(data.typeId);rootSchema&&__this.resolveSubSchema(rootSchema,__this.__expression.getPathTokens(),(function(data){data.error===TcHmi.Errors.NONE&&data.schema&&(__this.__schema=tchmi_clone_object(data.schema))}))}}getExpression(){return this.__expression}getState(){return this.__state}getReferenceDelegation(){return this.__referenceDelegation}isDestroyed(){return this.__state===SymbolState.Destroyed}isReady(){return this.__state===SymbolState.Ready}isProcessedAsync(){const symbolType=this.__expression.getType();if(symbolType===TcHmi.SymbolType.Server)return!0;if(symbolType===TcHmi.SymbolType.Function){const content=this.__expression.getContent();if(!content)return!1;const fnc=new System.FunctionExpression(content),result=fnc.isProcessedAsync();return fnc.destroy(),result}return!1}destroy(){if(this.isDestroyed())return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, ObjectScopeDiagGUID="+this.__diagGUID+"] destroy called and aborted because object is already marked as destroyed."));let diagExpression=this.__expression.toString();TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+diagExpression+", ObjectScopeDiagGUID="+this.__diagGUID+"] destroy called."),this.__destroyTypeDefinitionChanged&&(this.__destroyTypeDefinitionChanged(),this.__destroyTypeDefinitionChanged=null),this.__state=SymbolState.Destroyed,TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+diagExpression+", ObjectScopeDiagGUID="+this.__diagGUID+"] destroy finished.")}__readSubValue(obj,pathTokens,pathEntryPoint,callback){if(!obj||"object"!=typeof obj)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": Failed to read value by path because current value is not a valid object. Are all default values and written values valid for this schema?",domain:"TcHmi.System.Symbol"}});let p=obj,pTokens=tchmi_clone_object(pathTokens),pathDone="",pToken=pTokens.shift();for(;;){let isArrayToken=!1;pToken&&pToken.startsWith("[")&&pToken.endsWith("]")&&(isArrayToken=!0,pToken=pToken.replace("[","").replace("]",""));let isControlInstance=!1,attr=null;if(!pToken)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': Failed to read value by path because the token: "'+pToken+'" does not exist below path: "'+(pathEntryPoint?pathEntryPoint+(pathDone.length>0?"::"+pathDone:""):pathDone)+'" in current value.',domain:"TcHmi.System.Symbol"}});if(!(void 0!==p[pToken]||p instanceof TcHmi.Controls.System.baseTcHmiControl))return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': Failed to read value by path because the token: "'+pToken+'" does not exist below path: "'+(pathEntryPoint?pathEntryPoint+(pathDone.length>0?"::"+pathDone:""):pathDone)+'" in current value.',domain:"TcHmi.System.Symbol"}});if(p instanceof TcHmi.Controls.System.baseTcHmiControl){if(attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(p,pToken),null==attr||!attr.propertyGetterName||void 0===p[attr.propertyGetterName])return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': Failed to read value by path because the token: "'+pToken+'" does not exist below path: "'+(pathEntryPoint?pathEntryPoint+(pathDone.length>0?"::"+pathDone:""):pathDone)+'" in current value.',domain:"TcHmi.System.Symbol"}});isControlInstance=!0}if(!(pTokens.length>0))break;if(isControlInstance)try{p=tchmi_clone_object(p[attr.propertyGetterName].call(p))}catch(e){return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_EXCEPTION,details:{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:this.__expression.toString()+': Failed to read path "'+pToken+'"below path: "'+(pathEntryPoint?pathEntryPoint+(pathDone.length>0?"::"+pathDone:""):pathDone)+'" in current value because of exception: "'+String(e)+'"',domain:"TcHmi.System.Symbol",exception:e}})}else p=p[pToken];pathDone+=isArrayToken?"["+pToken+"]":pathDone.length>0?"::"+pToken:pToken,pToken=pTokens.shift()}let res,isControlInstance=!1,attr=null;if(pToken)if(void 0!==p[pToken]||p instanceof TcHmi.Controls.System.baseTcHmiControl){if(p instanceof TcHmi.Controls.System.baseTcHmiControl){if(attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(p,pToken),null==attr||!attr.propertyGetterName||void 0===p[attr.propertyGetterName])return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': Failed to read value by path because the token: "'+pToken+'" does not exist below path: "'+(pathEntryPoint?pathEntryPoint+(pathDone.length>0?"::"+pathDone:""):pathDone)+'" in current value.',domain:"TcHmi.System.Symbol"}});isControlInstance=!0}if(isControlInstance)try{res=tchmi_clone_object(p[attr.propertyGetterName].call(p))}catch(e){return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_EXCEPTION,details:{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:this.__expression.toString()+': Failed to read path "'+pToken+'"below path: "'+(pathEntryPoint?pathEntryPoint+(pathDone.length>0?"::"+pathDone:""):pathDone)+'" in current value because of exception: "'+String(e)+'"',domain:"TcHmi.System.Symbol",exception:e}})}else res=p[pToken];TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:res})}else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': Failed to read value by path because the token: "'+pToken+'" does not exist below path: "'+(pathEntryPoint?pathEntryPoint+(pathDone.length>0?"::"+pathDone:""):pathDone)+'" in current value.',domain:"TcHmi.System.Symbol"}});else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': Failed to read value by path because the token: "'+pToken+'" does not exist below path: "'+(pathEntryPoint?pathEntryPoint+(pathDone.length>0?"::"+pathDone:""):pathDone)+'" in current value.',domain:"TcHmi.System.Symbol"}})}__writeSubValue(obj,value,pathTokens,pathEntryPoint,callback){if(!obj||"object"!=typeof obj)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": Failed to read value by path because current value is not a valid object. Are all default values and written values valid for this schema?",domain:"TcHmi.System.Symbol"}});let p=obj,pTokens=tchmi_clone_object(pathTokens),pathDone="",pToken=pTokens.shift();for(;;){let isArrayToken=!1;pToken&&pToken.startsWith("[")&&pToken.endsWith("]")&&(isArrayToken=!0,pToken=pToken.replace("[","").replace("]",""));let isControlInstance=!1,attr=null;if(!pToken)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': Failed to write value by path because the token: "'+pToken+'" does not exist below path: "'+(pathEntryPoint?pathEntryPoint+(pathDone.length>0?"::"+pathDone:""):pathDone)+'" in current value.',domain:"TcHmi.System.Symbol"}});if(!(void 0!==p[pToken]||p instanceof TcHmi.Controls.System.baseTcHmiControl))return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': Failed to write value by path because the token: "'+pToken+'" does not exist below path: "'+(pathEntryPoint?pathEntryPoint+(pathDone.length>0?"::"+pathDone:""):pathDone)+'" in current value.',domain:"TcHmi.System.Symbol"}});if(p instanceof TcHmi.Controls.System.baseTcHmiControl){if(attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(p,pToken),null==attr||!attr.propertyGetterName||void 0===p[attr.propertyGetterName])return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': Failed to write value by path because the token: "'+pToken+'" does not exist below path: "'+(pathEntryPoint?pathEntryPoint+(pathDone.length>0?"::"+pathDone:""):pathDone)+'" in current value.',domain:"TcHmi.System.Symbol"}});isControlInstance=!0}if(!(pTokens.length>0))break;if(isControlInstance)try{p=tchmi_clone_object(p[attr.propertyGetterName].call(p))}catch(e){return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_EXCEPTION,details:{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:this.__expression.toString()+': Failed to write value by path "'+pToken+'"below path: "'+(pathEntryPoint?pathEntryPoint+(pathDone.length>0?"::"+pathDone:""):pathDone)+'" in current value because of exception: "'+String(e)+'"',domain:"TcHmi.System.Symbol",exception:e}})}else p=p[pToken];pathDone+=isArrayToken?"["+pToken+"]":pathDone.length>0?"::"+pToken:pToken,pToken=pTokens.shift()}let isControlInstance=!1,attr=null;if(pToken)if(void 0!==p[pToken]||p instanceof TcHmi.Controls.System.baseTcHmiControl){if(p instanceof TcHmi.Controls.System.baseTcHmiControl){if(attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(p,pToken),null==attr||!attr.propertySetterName||void 0===p[attr.propertySetterName])return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': Failed to write value by path because the token: "'+pToken+'" does not exist below path: "'+(pathEntryPoint?pathEntryPoint+(pathDone.length>0?"::"+pathDone:""):pathDone)+'" in current value.',domain:"TcHmi.System.Symbol"}});isControlInstance=!0}if(isControlInstance)try{p[attr.propertySetterName].call(p,value)}catch(e){return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_EXCEPTION,details:{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:this.__expression.toString()+': Failed to write value by path "'+pToken+'"below path: "'+(pathEntryPoint?pathEntryPoint+(pathDone.length>0?"::"+pathDone:""):pathDone)+'" in current value because of exception: "'+String(e)+'"',domain:"TcHmi.System.Symbol",exception:e}})}else p[pToken]=value;TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': Failed to write value by path because the token: "'+pToken+'" does not exist below path: "'+(pathEntryPoint?pathEntryPoint+(pathDone.length>0?"::"+pathDone:""):pathDone)+'" in current value.',domain:"TcHmi.System.Symbol"}});else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': Failed to write value by path because the token: "'+pToken+'" does not exist below path: "'+(pathEntryPoint?pathEntryPoint+(pathDone.length>0?"::"+pathDone:""):pathDone)+'" in current value.',domain:"TcHmi.System.Symbol"}})}resolveSubSchema(schema,pathTokens,callback){let res=schema,pathDone="";if(!pathTokens||0===pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,schema:res});if(null==res||"object"!=typeof res)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SCHEMA_INVALID,details:{code:TcHmi.Errors.E_SCHEMA_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID],reason:this.__expression.toString()+": Failed to read schema because there is no valid schema.",domain:"TcHmi.System.Symbol"}});let pTokens=tchmi_clone_object(pathTokens);for(;pTokens.length>0;){let schemaOf=null;if(res&&res.anyOf?schemaOf=res.anyOf:res&&res.oneOf&&(schemaOf=res.oneOf),schemaOf){let bHit=!1;for(let schema of schemaOf)if(this.resolveSubSchema(schema,pTokens,(data=>{data.error===TcHmi.Errors.NONE&&data.schema&&(res=data.schema,bHit=!0)})),bHit&&res)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,schema:res});if(!bHit)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SCHEMA_INVALID_PATH,details:{code:TcHmi.Errors.E_SCHEMA_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID_PATH],reason:this.__expression.toString()+': Failed to read schema by path because path: "'+new TcHmi.ObjectPath(pTokens).toString()+'" can not be resolved from any anyOf/oneOf schema below path: "'+pathDone+'" in schema with id: '+schema.id,domain:"TcHmi.System.Symbol"}})}let pToken=pTokens.shift();if(res&&"TcHmi.Controls.System.TcHmiControl"===res.frameworkInstanceOf){if(!TcHmi.System.Services.controlManager)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:this.__expression.toString()+": Failed to resolve subschema. System not ready.",domain:"TcHmi.System.Symbol"}});if(res.frameworkUserControlConfig){let attr=TcHmi.System.Services.controlManager.getUserControlConfigAttributeByPropertyName(res.frameworkUserControlConfig,pToken);if(!attr){res=null;break}if(res=TcHmi.Type.getSchema(attr.type),0===pTokens.length)break}else{let attr=TcHmi.System.Services.controlManager.getDescriptionAttributeByPropertyName(res.frameworkControlType,pToken);if(!attr){res=null;break}if(res=TcHmi.Type.getSchema(attr.type),0===pTokens.length)break}}if(res&&"TcHmi.Controls.System.TcHmiControl"===res.frameworkInstanceOf)continue;let pTokenTokens=[],chars=pToken.split(""),idx=0;for(;chars.length>0;){let c=chars.shift();"["===c&&void 0!==pTokenTokens[idx]&&pTokenTokens[idx].length>0&&idx++,void 0===pTokenTokens[idx]&&(pTokenTokens[idx]=""),pTokenTokens[idx]=pTokenTokens[idx]+c,"]"===c&&idx++}let bHit=!1;for(;pTokenTokens.length>0;){let pTokenToken=pTokenTokens.shift();if(pTokenToken.match(/\[*.\]/g)){if(res&&void 0!==res.items&&"object"==typeof res.items&&!Array.isArray(res.items)){res=res.items,bHit=!0,pathDone+="["+pToken+"]";continue}}else if(res&&void 0!==res.properties&&"object"==typeof res.properties&&!1===Array.isArray(res.properties)){if(void 0!==res.properties[pTokenToken]){res=res.properties[pTokenToken],bHit=!0,pathDone+="::"+pToken;continue}}else{if(res&&!0===res.additionalProperties&&!res.patternProperties){res=TcHmi.Type.getSchema("tchmi:general#/definitions/Any"),bHit=!0,pathDone+="::"+pToken;continue}if(res&&res.patternProperties&&"object"==typeof res.patternProperties&&!1===Array.isArray(res.patternProperties))for(let pattern in res.patternProperties)if(pToken.match(pattern)){let patternSchema=res.patternProperties[pattern];if(patternSchema&&"object"==typeof patternSchema){res=patternSchema,bHit=!0,pathDone+="::"+pToken;continue}}if(res&&"object"==typeof res.additionalProperties&&!1===Array.isArray(res.additionalProperties)){res=res.additionalProperties,bHit=!0,pathDone+="::"+pToken;continue}}}if(!1===bHit)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SCHEMA_INVALID_PATH,details:{code:TcHmi.Errors.E_SCHEMA_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID_PATH],reason:this.__expression.toString()+': Failed to read schema by path because token: "'+pToken+'" does not exist below path: "'+pathDone+'" in schema with id: '+schema.id,domain:"TcHmi.System.Symbol"}});if(res&&res.$ref){let ref=TcHmi.Type.getSchema(res.$ref);ref&&(res=ref)}}null!=res&&"object"==typeof res?TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,schema:res}):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SCHEMA_INVALID,details:{code:TcHmi.Errors.E_SCHEMA_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID],reason:this.__expression.toString()+': Failed to read schema by path because there is no valid schema below path: "'+pathDone+'" in schema with id: '+schema.id,domain:"TcHmi.System.Symbol"}})}resolveSanitizedPath(tokens){let res="";for(let i=0,ii=tokens.length;i<ii;i++){let token=tokens[i];token.startsWith("[")?res+=token:res+="::"+token}return res}resolveSchema(callback){let __this=this;if(null!==this.__schema)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,schema:this.__schema});let t=this.__expression.getType();if(t===TcHmi.SymbolType.Server){const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:__this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let schema,resolveError,resolveErrorDetails,resolve=()=>{let schemaCacheEntry=Symbol.__SERVER_SYMBOL_SCHEMA_CACHE[name];if(schemaCacheEntry)return schemaCacheEntry.error===TcHmi.Errors.NONE?void(schema=schemaCacheEntry.schema):(resolveError=schemaCacheEntry.error,void(resolveErrorDetails=schemaCacheEntry.details));{let baseName,basePathTokens=null,expressionMatch=__this.__expression.toString().match(TcHmi.SymbolExpression.RegExpExpression);if(null!=expressionMatch&&3===expressionMatch.length){let expressionTokens=expressionMatch[2].match(TcHmi.SymbolExpression.RegExpExpressionGroupByPipe);if(null!=expressionTokens&&expressionTokens.length>0){let firstBracketPos=expressionTokens[0].indexOf("["),firstColonPos=expressionTokens[0].indexOf("::"),splitPos=-1;if(splitPos=-1===firstBracketPos?firstColonPos:-1===firstColonPos||firstBracketPos<firstColonPos?firstBracketPos:firstColonPos,-1!==splitPos){baseName=expressionTokens[0].substring(0,splitPos);const basePath=expressionTokens[0].substring(splitPos);basePathTokens=TcHmi.ObjectPath.toPathTokens(basePath)}else baseName=expressionTokens[0]}}let baseSchemaCacheEntry=baseName?Symbol.__SERVER_SYMBOL_SCHEMA_CACHE[baseName]:void 0;if(baseSchemaCacheEntry){if(baseSchemaCacheEntry.error!==TcHmi.Errors.NONE||!baseSchemaCacheEntry.schema)return resolveError=baseSchemaCacheEntry.error,void(resolveErrorDetails=baseSchemaCacheEntry.details);{let baseSchema=baseSchemaCacheEntry.schema;baseSchema&&__this.resolveSubSchema(baseSchema,basePathTokens,(function(data){data&&data.error===TcHmi.Errors.NONE?schema=data.schema:(resolveError=data.error,resolveErrorDetails=data.details)}))}}}},finish=()=>schema?(this.__schema=schema,this.__destroyTypeDefinitionChanged&&(this.__destroyTypeDefinitionChanged(),this.__destroyTypeDefinitionChanged=null),this.__schema.id&&(this.__destroyTypeDefinitionChanged=TcHmi.EventProvider.register("System.onTypeDefinitionChanged<"+this.__schema.id+">",this.__onTypeDefinitionChanged())),void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,schema:schema})):void 0!==resolveError&&resolveError!==TcHmi.Errors.NONE?(__this.__destroyTypeDefinitionChanged&&(__this.__destroyTypeDefinitionChanged(),__this.__destroyTypeDefinitionChanged=null),void TcHmi.Callback.callSafeEx(callback,__this,{error:resolveError,details:resolveErrorDetails})):(__this.__destroyTypeDefinitionChanged&&(__this.__destroyTypeDefinitionChanged(),__this.__destroyTypeDefinitionChanged=null),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION,details:{code:TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION],reason:__this.__expression.toString()+": Unknown schema definition. Either the symbol or a parent is not mapped or there is no schema defined for the symbol.",domain:"TcHmi.System.Symbol"}}));resolve(),schema?finish():Symbol.resolveServerSymbolSchemaCache((data=>{resolve(),finish()}))}else if(t===TcHmi.SymbolType.Internal){const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:__this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});if(!TcHmi.System.Services.internalSymbolManager)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,reason:__this.__expression.toString()+": Parser was unable to resolve the name of the symbol. System not ready.",domain:"TcHmi.System.Symbol"}});let pathTokens=this.__expression.getPathTokens();TcHmi.System.Services.internalSymbolManager.getType(name,(function(data){if(data.error===TcHmi.Errors.NONE&&data.type){if(!TcHmi.System.Services.typeManager)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:__this.__expression.toString()+": Failed to resolve schema. System not ready.",domain:"TcHmi.System.Symbol"}});let rootSchemaType=data.type,rootSchemaResult=TcHmi.System.Services.typeManager.getSchemaEx(rootSchemaType);if(rootSchemaResult.error!==TcHmi.Errors.NONE){let res={error:TcHmi.Errors.E_SCHEMA_NOT_RESOLVED,details:{code:TcHmi.Errors.E_SCHEMA_NOT_RESOLVED,reason:__this.__expression.toString()+": Failed to resolve root schema: "+rootSchemaType,domain:"TcHmi.System.Symbol"}};return rootSchemaResult.details&&res.details&&(res.details.errors=[rootSchemaResult.details]),void TcHmi.Callback.callSafeEx(callback,__this,res)}let rootSchema=rootSchemaResult.schema;return rootSchema?void __this.resolveSubSchema(rootSchema,pathTokens,(function(data){if(data.error===TcHmi.Errors.NONE){let schema=tchmi_clone_object(data.schema);return schema?(__this.__schema=schema,__this.__destroyTypeDefinitionChanged&&(__this.__destroyTypeDefinitionChanged(),__this.__destroyTypeDefinitionChanged=null),__this.__destroyTypeDefinitionChanged=TcHmi.EventProvider.register("System.onTypeDefinitionChanged<"+rootSchemaType+">",__this.__onTypeDefinitionChanged()),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,schema:__this.__schema})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown type",domain:"TcHmi.System.Symbol"}})}TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown type",domain:"TcHmi.System.Symbol"}})}TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Error resolving type",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0}})}))}else{if(t===TcHmi.SymbolType.LocalizedText){if(!TcHmi.System.Services.typeManager)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:__this.__expression.toString()+": Failed to resolve schema. System not ready.",domain:"TcHmi.System.Symbol"}});let schemaResult=TcHmi.System.Services.typeManager.getSchemaEx("tchmi:general#/definitions/String");if(schemaResult.error!==TcHmi.Errors.NONE){let res={error:TcHmi.Errors.E_SCHEMA_NOT_RESOLVED,details:{code:TcHmi.Errors.E_SCHEMA_NOT_RESOLVED,reason:__this.__expression.toString()+': Failed to resolve schema: "tchmi:general#/definitions/String".',domain:"TcHmi.System.Symbol"}};return schemaResult.details&&res.details&&(res.details.errors=[schemaResult.details]),void TcHmi.Callback.callSafeEx(callback,__this,res)}let schema=schemaResult.schema;return schema?(this.__schema=schema,void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,schema:this.__schema})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown type",domain:"TcHmi.System.Symbol"}})}if(t===TcHmi.SymbolType.Function)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_NOT_SUPPORTED,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:__this.__expression.toString()+": Resolving Schema for function expressions is not supported",domain:"TcHmi.System.Symbol"}});if(t===TcHmi.SymbolType.Control){if(!TcHmi.System.Services.controlManager||!TcHmi.System.Services.typeManager)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:__this.__expression.toString()+": Failed to resolve schema. System not ready.",domain:"TcHmi.System.Symbol"}});const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:__this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let pathTokens=this.__expression.getPathTokens(),control=TcHmi.Controls.get(name);if(!control)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND],reason:__this.__expression.toString()+": Can not find control instance with id: "+name,domain:"TcHmi.System.Symbol"}});let propertyName=null;if(pathTokens&&pathTokens.length>0){let pathTokensPrepared=tchmi_clone_object(pathTokens);propertyName=pathTokensPrepared.shift();const attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName);if(null==attr)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:__this.__expression.toString()+": Resolving Schema for expression failed. Control attribute was not found.",domain:"TcHmi.System.Symbol"}});{let rootSchemaResult=TcHmi.System.Services.typeManager.getSchemaEx(attr.type);if(rootSchemaResult.error!==TcHmi.Errors.NONE){let res={error:TcHmi.Errors.E_SCHEMA_NOT_RESOLVED,details:{code:TcHmi.Errors.E_SCHEMA_NOT_RESOLVED,reason:__this.__expression.toString()+": Failed to resolve root schema: "+attr.type,domain:"TcHmi.System.Symbol"}};return rootSchemaResult.details&&res.details&&(res.details.errors=[rootSchemaResult.details]),void TcHmi.Callback.callSafeEx(callback,__this,res)}let rootSchema=rootSchemaResult.schema;return rootSchema?void __this.resolveSubSchema(rootSchema,pathTokensPrepared,(function(data){if(data.error===TcHmi.Errors.NONE){let schema=tchmi_clone_object(data.schema);return schema?(__this.__schema=schema,__this.__destroyTypeDefinitionChanged&&(__this.__destroyTypeDefinitionChanged(),__this.__destroyTypeDefinitionChanged=null),__this.__destroyTypeDefinitionChanged=TcHmi.EventProvider.register("System.onTypeDefinitionChanged<"+attr.type+">",__this.__onTypeDefinitionChanged()),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,schema:__this.__schema})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Resolving subschema failed",domain:"TcHmi.System.Symbol"}})}TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown type",domain:"TcHmi.System.Symbol"}})}}return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_NOT_SUPPORTED,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:__this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}})}if(t===TcHmi.SymbolType.PartialParam){if(!TcHmi.System.Services.controlManager||!TcHmi.System.Services.typeManager)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:__this.__expression.toString()+": Failed to resolve schema. System not ready.",domain:"TcHmi.System.Symbol"}});const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:__this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let propertyName,designerParam,pathTokens=tchmi_clone_object(this.__expression.getPathTokens()),searchAttr=null;if(!pathTokens)return void("TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:__this.__expression.toString()+" is not a valid PartialParameter. Expected: UserControlHost::Parameter",domain:"TcHmi.System.Symbol"}}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:__this.__expression.toString()+" is not a valid PartialParameter. Expected: TCHMI_TARGET_DESIGNER_PARTIALPARAM::Parameter",domain:"TcHmi.System.Symbol"}}));if(propertyName=pathTokens.shift(),"TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name){let control=TcHmi.Controls.get(name);if(!control)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND],reason:__this.__expression.toString()+": Can not find control instance with id: "+name,domain:"TcHmi.System.Symbol"}});searchAttr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName)}else{if(designerParam=propertyName?TcHmi.System.Services.Engineering.designerModeManager.userControlParameterManager?.get(propertyName):void 0,!designerParam)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:__this.__expression.toString()+": Unknown template parameter "+propertyName,domain:"TcHmi.System.Symbol"}});searchAttr=designerParam.descr}if(null==searchAttr)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:__this.__expression.toString()+": Can not find property: "+propertyName+".",domain:"TcHmi.System.Symbol"}});const attr=searchAttr;let rootSchemaResult=TcHmi.System.Services.typeManager.getSchemaEx(attr.type);if(rootSchemaResult.error!==TcHmi.Errors.NONE){let res={error:TcHmi.Errors.E_SCHEMA_NOT_RESOLVED,details:{code:TcHmi.Errors.E_SCHEMA_NOT_RESOLVED,reason:__this.__expression.toString()+": Failed to resolve root schema: "+attr.type,domain:"TcHmi.System.Symbol"}};return rootSchemaResult.details&&res.details&&(res.details.errors=[rootSchemaResult.details]),void TcHmi.Callback.callSafeEx(callback,__this,res)}let rootSchema=rootSchemaResult.schema;return rootSchema?void __this.resolveSubSchema(rootSchema,pathTokens,(function(data){if(data.error===TcHmi.Errors.NONE){let schema=tchmi_clone_object(data.schema);return schema?(__this.__schema=schema,__this.__destroyTypeDefinitionChanged&&(__this.__destroyTypeDefinitionChanged(),__this.__destroyTypeDefinitionChanged=null),__this.__destroyTypeDefinitionChanged=TcHmi.EventProvider.register("System.onTypeDefinitionChanged<"+attr.type+">",__this.__onTypeDefinitionChanged()),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,schema:__this.__schema})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown type",domain:"TcHmi.System.Symbol"}})}TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown type",domain:"TcHmi.System.Symbol"}})}if(t===TcHmi.SymbolType.TemplateParam){if(!TcHmi.System.Services.templateParamSymbolManager||!TcHmi.System.Services.typeManager)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:__this.__expression.toString()+": Failed to resolve schema. System not ready.",domain:"TcHmi.System.Symbol"}});const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:__this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});const pathTokens=this.__expression.getPathTokens(),entry=TcHmi.System.Services.templateParamSymbolManager.get(name);if(!entry||!entry.type)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:__this.__expression.toString()+": Unknown template parameter "+name,domain:"TcHmi.System.Symbol"}});let rootSchemaResult=TcHmi.System.Services.typeManager.getSchemaEx(entry.type);if(rootSchemaResult.error!==TcHmi.Errors.NONE){let res={error:TcHmi.Errors.E_SCHEMA_NOT_RESOLVED,details:{code:TcHmi.Errors.E_SCHEMA_NOT_RESOLVED,reason:__this.__expression.toString()+": Failed to resolve root schema: "+entry.type,domain:"TcHmi.System.Symbol"}};return rootSchemaResult.details&&res.details&&(res.details.errors=[rootSchemaResult.details]),void TcHmi.Callback.callSafeEx(callback,__this,res)}let rootSchema=rootSchemaResult.schema;return rootSchema?void __this.resolveSubSchema(rootSchema,pathTokens,(function(data){if(data.error===TcHmi.Errors.NONE){let schema=tchmi_clone_object(data.schema);return schema?(__this.__schema=schema,__this.__destroyTypeDefinitionChanged&&(__this.__destroyTypeDefinitionChanged(),__this.__destroyTypeDefinitionChanged=null),__this.__destroyTypeDefinitionChanged=TcHmi.EventProvider.register("System.onTypeDefinitionChanged<"+entry.type+">",__this.__onTypeDefinitionChanged()),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,schema:__this.__schema})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown type",domain:"TcHmi.System.Symbol"}})}TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown symbol type",domain:"TcHmi.System.Symbol"}})}if(t===TcHmi.SymbolType.Context)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_NOT_SUPPORTED,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:__this.__expression.toString()+": Not yet implemented",domain:"TcHmi.System.Symbol"}});if(t!==TcHmi.SymbolType.ThemedResource)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_NOT_SUPPORTED,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:__this.__expression.toString()+": Unknown symbol type",domain:"TcHmi.System.Symbol"}});{let name,pathTokens=tchmi_clone_object(this.__expression.getPathTokens()),namespaceTokens=["Application"];if(pathTokens&&0!==pathTokens.length){let namespaceToken=this.__expression.getName();if(!namespaceToken)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});if(namespaceTokens[0]=namespaceToken,namespaceTokens[0].startsWith("Application")){if(!pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": 'Application' themed symbol expressions must be in the form: 'Application::[Key]' or 'Key'.",domain:"TcHmi.System.Symbol"}});name=pathTokens.shift()}else{if(!namespaceTokens[0].startsWith("Control"))return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": Path tokens are allowed only if the themed resource symbol expression starts with the following token: 'Control'.",domain:"TcHmi.System.Symbol"}});if(pathTokens.length<2)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": 'Control' themed symbol expressions must be in the form: 'Control::[Control-Type]::[Key]'.",domain:"TcHmi.System.Symbol"}});namespaceTokens[1]=pathTokens.shift(),name=pathTokens.shift()}}else name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name and namespace of the symbol.",domain:"TcHmi.System.Symbol"}});TcHmi.System.Services.themeManager.getThemedResourceType(name,namespaceTokens,(function(data){if(data.error===TcHmi.Errors.NONE&&data.type){let rootSchemaType=data.type,rootSchemaResult=TcHmi.System.Services.typeManager.getSchemaEx(rootSchemaType);if(rootSchemaResult.error!==TcHmi.Errors.NONE){let res={error:TcHmi.Errors.E_SCHEMA_NOT_RESOLVED,details:{code:TcHmi.Errors.E_SCHEMA_NOT_RESOLVED,reason:__this.__expression.toString()+": Failed to resolve root schema: '"+rootSchemaType+"'.",domain:"TcHmi.System.Symbol"}};return rootSchemaResult.details&&res.details&&(res.details.errors=[rootSchemaResult.details]),void TcHmi.Callback.callSafeEx(callback,__this,res)}let rootSchema=rootSchemaResult.schema;return rootSchema?void __this.resolveSubSchema(rootSchema,pathTokens,(function(data){if(data.error===TcHmi.Errors.NONE){let schema=tchmi_clone_object(data.schema);return schema?(__this.__schema=schema,__this.__destroyTypeDefinitionChanged&&(__this.__destroyTypeDefinitionChanged(),__this.__destroyTypeDefinitionChanged=null),__this.__destroyTypeDefinitionChanged=TcHmi.EventProvider.register("System.onTypeDefinitionChanged<"+rootSchemaType+">",__this.__onTypeDefinitionChanged()),void TcHmi.Callback.callSafe(callback,__this,{error:TcHmi.Errors.NONE,schema:__this.__schema})):void TcHmi.Callback.callSafe(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString(),domain:"TcHmi.System.Symbol"}})}TcHmi.Callback.callSafe(callback,__this,{error:data.error,details:data.details})})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown type",domain:"TcHmi.System.Symbol"}})}TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Error resolving type",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0}})}))}}}resolveAttributes(callback){this.resolveSchema((data=>{data.error===TcHmi.Errors.NONE?data.schema&&data.schema.attributes?TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,attributes:tchmi_clone_object(data.schema.attributes)}):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,attributes:{}}):TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})}))}resolveAttribute(name,callback){this.resolveAttributes((data=>{data.error===TcHmi.Errors.NONE?data.attributes&&void 0!==data.attributes[name]?TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,name:name,value:tchmi_clone_object(data.attributes[name])}):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN_ATTRIBUTE,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN_ATTRIBUTE,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN_ATTRIBUTE],reason:this.__expression.toString()+": Failed to resolve attributes",domain:"TcHmi.System.Symbol"}}):TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})}))}read(callback){return this.readEx(null,callback)}readEx(options,callback){let diagGUID="";TCHMI_CONSOLE_LOG_LEVEL>=4&&(diagGUID=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read called.");let destroy=null,t=this.__expression.getType();if(t===TcHmi.SymbolType.Server)destroy=this.__readSymbolTypeServer(options,(data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",{data:data}),TcHmi.Callback.callSafeEx(callback,this,data)}));else if(t===TcHmi.SymbolType.Internal)this.__readSymbolTypeInternal(options,(data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",{data:data}),TcHmi.Callback.callSafeEx(callback,this,data)}));else if(t===TcHmi.SymbolType.LocalizedText)this.__readSymbolTypeLocalizedText(options,(data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",{data:data}),TcHmi.Callback.callSafeEx(callback,this,data)}));else if(t===TcHmi.SymbolType.Function)this.__readSymbolTypeFunction(options,(data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",{data:data}),TcHmi.Callback.callSafeEx(callback,this,data)}));else if(t===TcHmi.SymbolType.Control)this.__readSymbolTypeControl(options,(data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",{data:data}),TcHmi.Callback.callSafeEx(callback,this,data)}));else if(t===TcHmi.SymbolType.PartialParam)this.__readSymbolTypePartialParam(options,(data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",{data:data}),TcHmi.Callback.callSafeEx(callback,this,data)}));else if(t===TcHmi.SymbolType.TemplateParam)this.__readSymbolTypeTemplateParam(options,(data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",{data:data}),TcHmi.Callback.callSafeEx(callback,this,data)}));else if(t===TcHmi.SymbolType.Context)this.__readSymbolTypeContext(options,(data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",{data:data}),TcHmi.Callback.callSafeEx(callback,this,data)}));else if(t===TcHmi.SymbolType.ThemedResource)this.__readSymbolTypeThemedResource((data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression?.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",{data:data}),TcHmi.Callback.callSafe(callback,this,data)}));else{let res={error:TcHmi.Errors.E_NOT_SUPPORTED,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:this.__expression.toString()+": Failed to read from unsupported symbol type",domain:"TcHmi.System.Symbol"}};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",res),TcHmi.Callback.callSafeEx(callback,this,res)}return()=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read destroy called."),destroy&&destroy()}}__readSymbolTypeServer(options,callback){let __this=this,symbol=this.__expression.getName();if(!symbol)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}}),()=>{};if(TCHMI_DESIGNER)return this.resolveSchema((data=>{if(data.error===TcHmi.Errors.NONE&&data.schema){let value=TcHmi.Type.Schema.resolveDefault(data.schema);TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:value})}else TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})})),()=>{};{let parallel,readWriteGroup,message={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage"],symbol:symbol}]},timeout=this.__expression.getOptions().Timeout;parallel=options&&void 0!==options.forceParallel?options.forceParallel:__this.__expression.getOptions().Parallel??!1,readWriteGroup=options&&void 0!==options.forceReadWriteGroup?options.forceReadWriteGroup:__this.__expression.getOptions().ReadWriteGroup??void 0;let requestId=TcHmi.Server.requestEx(message,{timeout:timeout,parallel:parallel,groupId:readWriteGroup},(function(e){if(e.error!==TcHmi.Errors.NONE)return void TcHmi.Callback.callSafeEx(callback,__this,{error:e.error,details:e.details});let response=e.response;if(void 0===response)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_INVALID_RESPONSE,details:{code:TcHmi.Errors.E_SERVER_INVALID_RESPONSE,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_INVALID_RESPONSE],reason:__this.__expression.toString()+": Missing response from server.",domain:"TcHmi.System.Symbol"},response:response});if(response&&response.error&&response.error)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],reason:__this.__expression.toString()+": Error in response from server with id: "+response.id,domain:"TcHmi.System.Symbol",errors:[response.error]},response:response});let commands=response.commands;if(!commands)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,details:{code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:__this.__expression.toString()+": Missing commands in response from server with id: "+response.id,domain:"TcHmi.System.Symbol"},response:response});let command=commands[0];if(e.responseCommandIndices&&(command=commands[e.responseCommandIndices[0]]),command)return command.error?void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_COMMAND_ERROR,details:{code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:__this.__expression.toString()+': Error in command for symbol: "'+symbol+'" in response from server with id: '+response.id,domain:"TcHmi.System.Symbol",errors:[command.error]},value:command.readValue,response:response}):void __this.resolveSchema((data=>{if(data.error===TcHmi.Errors.NONE){let prepValue=TcHmi.ValueConverter.toSchemaType(command.readValue,data.schema);if(null===prepValue&&null!==command.readValue){let reason,value=command.readValue,schema=data.schema;reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+': Value of type: "Instance of '+value.constructor+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":"object"==typeof value?__this.__expression.toString()+': Value: "'+JSON.stringify(value)+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":__this.__expression.toString()+': Value: "'+value+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".",TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"},value:command.readValue,response:response})}else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:prepValue,response:response})}else TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Resolving schema failed.",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},value:command.readValue,response:response})}));TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_COMMAND_MISSING,details:{code:TcHmi.Errors.E_SERVER_COMMAND_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_MISSING],reason:__this.__expression.toString()+': Missing command for symbol: "'+symbol+'" in response from server with id: '+response.id,domain:"TcHmi.System.Symbol"},response:response})}));return()=>{TcHmi.Server.releaseRequest(requestId)}}}__readSymbolTypeInternal(options,callback){if(!TcHmi.System.Services.internalSymbolManager)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:this.__expression.toString()+": Failed to read. System not ready.",domain:"TcHmi.System.Symbol"}});const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let __this=this;TcHmi.System.Services.internalSymbolManager.read(name,(function(data){if(data.error===TcHmi.Errors.NONE){let pathTokens=__this.__expression.getPathTokens();return pathTokens&&pathTokens.length>0?void __this.__readSubValue(data.value,pathTokens,name,(function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value)}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value)})}TcHmi.Callback.callSafeEx(callback,__this,{error:data.error})}))}__readSymbolTypeLocalizedText(options,callback){if(!TcHmi.System.Services.localizationManager)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:this.__expression.toString()+": Failed to read. System not ready.",domain:"TcHmi.System.Symbol"}});let name,localizationNamespace="TcHmi.System.Localization.Application",pathTokens=tchmi_clone_object(this.__expression.getPathTokens());if(pathTokens&&0!==pathTokens.length){let namespaceToken=this.__expression.getName();if(!namespaceToken)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});if(namespaceToken.startsWith("Control")){if(2!==pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': "Control" localization symbol expressions must be in the form: Control::[Control-Type]::[Key]',domain:"TcHmi.System.Symbol"}});localizationNamespace="TcHmi.System.Localization.Control<"+pathTokens.shift()+">",name=pathTokens.shift()}else if(namespaceToken.startsWith("Function")){if(2!==pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': "Function" localization symbol expressions must be in the form: Function::[Function-Name]::[Key]',domain:"TcHmi.System.Symbol"}});localizationNamespace="TcHmi.System.Localization.Function<"+pathTokens.shift()+">",name=pathTokens.shift()}else if(namespaceToken.startsWith("Framework")){if(1!==pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': "Framework" localization symbol expressions must be in the form: Framework::[Key]',domain:"TcHmi.System.Symbol"}});localizationNamespace="TcHmi.System.Localization.Framework",name=pathTokens.shift()}else{if(!namespaceToken.startsWith("Application"))return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': Path tokens are allowed only if the localization symbol expression starts with one of the following tokens: "Application", "Control", "Function" or "Framework".',domain:"TcHmi.System.Symbol"}});if(1!==pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': Explicit "Application" localization symbol expressions must be in the form: Application::[Key]',domain:"TcHmi.System.Symbol"}});localizationNamespace="TcHmi.System.Localization.Application",name=pathTokens.shift()}}else name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name and namespace of the symbol.",domain:"TcHmi.System.Symbol"}});let text=TcHmi.System.Services.localizationManager.getText(localizationNamespace,name);if(null!=text)try{return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:text})}catch(e){return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_EXCEPTION,details:{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:this.__expression.toString()+": An uncaught exception occurred in the callback for the read operation",exception:e,domain:"TcHmi.System.Symbol"}})}else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:this.__expression.toString()+": Failed to resolve localized text for this expression.",domain:"TcHmi.System.Symbol"}})}__readSymbolTypeFunction(options,callback){let __this=this;const content=this.__expression.getContent();if(!content)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the content of the symbol.",domain:"TcHmi.System.Symbol"}});let func=new System.FunctionExpression(content,{forcedSymbolOptions:options}),bContextLock=!1;func.execute({success:function(result){bContextLock||(bContextLock=!0,TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:result}),func.destroy())},error:function(error,details){bContextLock||(bContextLock=!0,TcHmi.Callback.callSafeEx(callback,__this,{error:error,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": could not read function value",domain:"TcHmi.System.Symbol",errors:details?[details]:void 0}}),func.destroy())}})}__readSymbolTypeControl(options,callback){if(!TcHmi.System.Services.controlManager)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:this.__expression.toString()+": Failed to read. System not ready.",domain:"TcHmi.System.Symbol"}});let __this=this;const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let pathTokens=tchmi_clone_object(this.__expression.getPathTokens()),control=TcHmi.Controls.get(name);if(control){if(null!==pathTokens){let propertyName;pathTokens&&pathTokens.length>0&&(propertyName=pathTokens.shift());let attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName);if(null==attr)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:this.__expression.toString()+": Can not find control attribute with propertyName: "+propertyName,domain:"TcHmi.System.Symbol"}});let res=tchmi_clone_object(control[attr.propertyGetterName].call(control));if(pathTokens&&pathTokens.length>0){let rootSchema=TcHmi.Type.getSchema(attr.type);if(rootSchema&&rootSchema.frameworkInstanceOf&&"TcHmi.Controls.System.TcHmiControl"===rootSchema.frameworkInstanceOf){if(!(res instanceof TcHmi.Controls.System.baseTcHmiControl))return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:__this.__expression.toString()+": Missing control instance for attribute: "+propertyName,domain:"TcHmi.System.Symbol"}});let controlId=res.getId(),subSymbol=new TcHmi.System.Symbol("%ctrl%"+controlId+this.resolveSanitizedPath(pathTokens)+"%/ctrl%");return void subSymbol.read((function(dataSubSymbol){if(dataSubSymbol.error!==TcHmi.Errors.NONE)return TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,details:{code:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR],reason:this.__expression.toString()+": Error reading subsymbol "+subSymbol.getExpression().toString(),domain:"TcHmi.System.Symbol",errors:dataSubSymbol.details?[dataSubSymbol.details]:void 0}}),void subSymbol.destroy();TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(dataSubSymbol.value)}),subSymbol.destroy()}))}return void this.__readSubValue(res,pathTokens,name+"::"+propertyName,(function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value)}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}))}return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:res})}TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:control})}else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND],reason:this.__expression.toString()+': Can not find control instance with id: "'+name+"'.",domain:"TcHmi.System.Symbol"}})}__readSymbolTypePartialParam(options,callback){if(!TcHmi.System.Services.controlManager)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:this.__expression.toString()+": Failed to read. System not ready.",domain:"TcHmi.System.Symbol"}});let __this=this;const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let res,propertyName,designerParam,pathTokens=tchmi_clone_object(this.__expression.getPathTokens()),attr=null;if(pathTokens)if(propertyName=pathTokens.shift(),propertyName){if("TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name){let control=TcHmi.Controls.get(name);if(!control)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND],reason:this.__expression.toString()+": Can not find control instance with id: "+name,domain:"TcHmi.System.Symbol"}});if(attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName),null==attr)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:this.__expression.toString()+": Can not find control attribute with propertyName: "+propertyName,domain:"TcHmi.System.Symbol"}});try{res=control[attr.propertyGetterName].call(control)}catch(e){return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_EXCEPTION,details:{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:this.__expression.toString()+": An uncaught exception occurred in the callback for the read operation",exception:e,domain:"TcHmi.System.Symbol"}})}}else{if(designerParam=TcHmi.System.Services.Engineering.designerModeManager.userControlParameterManager?.get(propertyName),!designerParam)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:this.__expression.toString()+": Unknown template parameter "+propertyName,domain:"TcHmi.System.Symbol"}});if(attr=designerParam.descr,!attr)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:this.__expression.toString()+": Can not find control attribute with propertyName: "+name,domain:"TcHmi.System.Symbol"}});res=designerParam.value}if(pathTokens&&pathTokens.length>0){let rootSchema=TcHmi.Type.getSchema(attr.type);if(rootSchema&&rootSchema.frameworkInstanceOf&&"TcHmi.Controls.System.TcHmiControl"===rootSchema.frameworkInstanceOf){if(res||"TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name){if(!res)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:__this.__expression.toString()+": Missing control instance for parameter: "+propertyName,domain:"TcHmi.System.Symbol"}});{if(!(res instanceof TcHmi.Controls.System.baseTcHmiControl))return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:__this.__expression.toString()+": Missing control instance for parameter: "+propertyName,domain:"TcHmi.System.Symbol"}});let controlId=res.getId(),subSymbol=new TcHmi.System.Symbol("%ctrl%"+controlId+this.resolveSanitizedPath(pathTokens)+"%/ctrl%");subSymbol.read((function(dataSubSymbol){if(dataSubSymbol&&dataSubSymbol.error!==TcHmi.Errors.NONE)return TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,details:{code:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR],reason:this.__expression.toString()+": Failed to read subsymbol "+subSymbol.getExpression().toString(),domain:"TcHmi.System.Symbol",errors:dataSubSymbol.details?[dataSubSymbol.details]:void 0}}),void subSymbol.destroy();TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(dataSubSymbol.value)}),subSymbol.destroy()}))}}else this.resolveSchema((data=>{if(data.error===TcHmi.Errors.NONE&&data.schema){let defaultValue=System.Type.Schema.resolveDefault(data.schema),res={error:TcHmi.Errors.NONE,value:defaultValue};TcHmi.Callback.callSafeEx(callback,__this,res)}else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,details:{code:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA],reason:__this.__expression.toString()+": Missing schema of the symbol.",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0}})}));return}this.__readSubValue(res,pathTokens,name+"::"+propertyName,(function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value)}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}))}else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(res)})}else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+" has no valid control property",domain:"TcHmi.System.Symbol"}});else"TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:__this.__expression.toString()+" is not a valid PartialParameter. Expected: UserControlHost::Parameter",domain:"TcHmi.System.Symbol"}}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:__this.__expression.toString()+" is not a valid PartialParameter. Expected: TCHMI_TARGET_DESIGNER_PARTIALPARAM::Parameter",domain:"TcHmi.System.Symbol"}})}__readSymbolTypeTemplateParam(options,callback){if(!TcHmi.System.Services.templateParamSymbolManager)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:this.__expression.toString()+": Failed to read. System not ready.",domain:"TcHmi.System.Symbol"}});let __this=this;const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let path=this.__expression.getPath(),pathTokens=this.__expression.getPathTokens(),entry=TcHmi.System.Services.templateParamSymbolManager.get(name);if(entry&&entry.type){if(!(entry.value instanceof TcHmi.SymbolExpression))return pathTokens&&pathTokens.length>0?void __this.__readSubValue(entry.value,pathTokens,name,(function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value)}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(entry.value)});{let entrySymbolExpression=entry.value,entrySymbolTag=entrySymbolExpression.getTag(),entrySymbolName=entrySymbolExpression.getName(),entrySymbolPath=entrySymbolExpression.getPath(),entrySymbolExpressionNewString="%"+entrySymbolTag+"%"+entrySymbolName;null!==entrySymbolPath&&(entrySymbolExpressionNewString+=entrySymbolPath),path&&pathTokens&&pathTokens.length>0&&(entrySymbolExpressionNewString+=path),entrySymbolExpressionNewString+="%/"+entrySymbolTag+"%";let entrySymbolNew=new TcHmi.System.Symbol(entrySymbolExpressionNewString);entrySymbolNew.read((function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value)}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details}),entrySymbolNew?.destroy(),entrySymbolNew=null}))}}else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:this.__expression.toString()+": Unknown template parameter "+name,domain:"TcHmi.System.Symbol"}})}__readSymbolTypeContext(options,callback){let __this=this;if(!this.__ctx)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Context is not defined.",domain:"TcHmi.System.Symbol"}});this.__expression.getPath();let pathTokens=this.__expression.getPathTokens();return pathTokens&&pathTokens.length>0?void __this.__readSubValue(this.__ctx,pathTokens,null,(function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value)}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})})):void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString(),domain:"TcHmi.System.Symbol"}})}__readSymbolTypeThemedResource(callback){let name,pathTokens=tchmi_clone_object(this.__expression.getPathTokens()),namespaceTokens=["Application"];if(pathTokens&&0!==pathTokens.length){let namespaceToken=this.__expression.getName();if(!namespaceToken)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});if(namespaceTokens[0]=namespaceToken,namespaceTokens[0].startsWith("Application")){if(!pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": 'Application' themed symbol expressions must be in the form: 'Application::[Key]' or 'Key'.",domain:"TcHmi.System.Symbol"}});name=pathTokens.shift()}else if(namespaceTokens[0].startsWith("Control")){if(pathTokens.length<2)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": 'Control' themed symbol expressions must be in the form: 'Control::[Control-Type]::[Key]'.",domain:"TcHmi.System.Symbol"}});namespaceTokens[1]=pathTokens.shift(),name=pathTokens.shift()}else namespaceTokens[0]="Application",name=this.__expression.getName()}else name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name and namespace of the symbol.",domain:"TcHmi.System.Symbol"}});let themedResource=System.Services.themeManager.getThemedResource(name,namespaceTokens);if(void 0!==themedResource)return pathTokens&&pathTokens.length>0?void this.__readSubValue(themedResource,pathTokens,name,(data=>{data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value)}):TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})})):void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(themedResource)});TcHmi.Callback.callSafe(callback,this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:this.__expression.toString(),domain:"TcHmi.System.Symbol"}})}write(value,callback){let destroy=this.writeEx(value,void 0,callback);return()=>{destroy&&destroy()}}writeEx(value,dirtyPaths,callback){return this.writeEx2(value,null,dirtyPaths,callback)}writeEx2(value,options,dirtyPaths,callback){null===dirtyPaths&&(dirtyPaths=void 0);let diagGUID="";TCHMI_CONSOLE_LOG_LEVEL>=4&&(diagGUID=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx called with:",{value:value,dirtyPaths:dirtyPaths});let destroy=null;switch(this.__expression.getType()){case TcHmi.SymbolType.Server:destroy=this.__writeSymbolTypeServer(value,options,dirtyPaths,((data,meta)=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",{data:data}),meta&&meta.equal&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished without error because of data equality."),TcHmi.Callback.callSafeEx(callback,this,data)}));break;case TcHmi.SymbolType.Internal:this.__writeSymbolTypeInternal(value,options,dirtyPaths,((data,meta)=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",{data:data}),meta&&meta.equal&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished without error because of data equality."),TcHmi.Callback.callSafeEx(callback,this,data)}));break;case TcHmi.SymbolType.LocalizedText:{let res={error:TcHmi.Errors.E_SYMBOL_READONLY,details:{code:TcHmi.Errors.E_SYMBOL_READONLY,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_READONLY],reason:this.__expression.toString()+": LocalizedText symbols are readonly.",domain:"TcHmi.System.Symbol"}};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",res),TcHmi.Callback.callSafeEx(callback,this,res)}break;case TcHmi.SymbolType.Function:{let res={error:TcHmi.Errors.E_SYMBOL_READONLY,details:{code:TcHmi.Errors.E_SYMBOL_READONLY,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_READONLY],reason:this.__expression.toString()+": Function symbols are readonly.",domain:"TcHmi.System.Symbol"}};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",res),TcHmi.Callback.callSafeEx(callback,this,res)}break;case TcHmi.SymbolType.Control:this.__writeSymbolTypeControl(value,options,dirtyPaths,((data,meta)=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",{data:data}),meta&&meta.equal&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished without error because of data equality."),TcHmi.Callback.callSafeEx(callback,this,data)}));break;case TcHmi.SymbolType.PartialParam:this.__writeSymbolTypePartialParam(value,options,dirtyPaths,((data,meta)=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",{data:data}),meta&&meta.equal&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished without error because of data equality."),TcHmi.Callback.callSafeEx(callback,this,data)}));break;case TcHmi.SymbolType.TemplateParam:this.__writeSymbolTypeTemplateParam(value,options,dirtyPaths,((data,meta)=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",{data:data}),meta&&meta.equal&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished without error because of data equality."),TcHmi.Callback.callSafeEx(callback,this,data)}));break;case TcHmi.SymbolType.ThemedResource:{let res={error:TcHmi.Errors.E_SYMBOL_READONLY,details:{code:TcHmi.Errors.E_SYMBOL_READONLY,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_READONLY],reason:this.__expression.toString()+": Themed resource symbols are readonly.",domain:"TcHmi.System.Symbol"}};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression?.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",res),TcHmi.Callback.callSafe(callback,this,res)}break;case TcHmi.SymbolType.Context:{let res={error:TcHmi.Errors.E_SYMBOL_READONLY,details:{code:TcHmi.Errors.E_SYMBOL_READONLY,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_READONLY],reason:this.__expression.toString()+": Context symbols are readonly.",domain:"TcHmi.System.Symbol"}};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",res),TcHmi.Callback.callSafeEx(callback,this,res)}break;default:{let res={error:TcHmi.Errors.E_NOT_SUPPORTED,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:this.__expression.toString()+": Failed to write unsupported symbol type",domain:"TcHmi.System.Symbol"}};TcHmi.Callback.callSafeEx(callback,this,res)}}return()=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx destroy called."),destroy&&destroy()}}__writeSymbolTypeServer(value,options,dirtyPaths,callback){null===dirtyPaths&&(dirtyPaths=void 0);let __this=this;const name=this.__expression.getName();if(!name)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}}),()=>{};if(TCHMI_DESIGNER)return this.resolveSchema((data=>{if(data.error===TcHmi.Errors.NONE&&data.schema){let value=TcHmi.Type.Schema.resolveDefault(data.schema);TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:value})}else TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})})),()=>{};{let newValue=tchmi_clone_object(value),destroyed=!1,requestId=null;return this.resolveSchema((function(dataResolveSchema){if(destroyed)return;if(__this.__state!==SymbolState.Ready)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_STATE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_STATE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_STATE_INVALID],reason:"Symbol is not ready",domain:"TcHmi.System.Symbol",errors:dataResolveSchema.details?[dataResolveSchema.details]:void 0}});if(dataResolveSchema.error!==TcHmi.Errors.NONE||!__this.__schema)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,details:{code:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA],reason:__this.__expression.toString()+": Failed to resolve schema definition.",domain:"TcHmi.System.Symbol",errors:dataResolveSchema.details?[dataResolveSchema.details]:void 0}});let errorDetails,message={requestType:"ReadWrite",commands:[]},error=TcHmi.Errors.NONE,schema=__this.__schema;if(dirtyPaths&&dirtyPaths.length>0)for(let i=0,ii=dirtyPaths.length;i<ii;i++){let subschema,subschemaErrorDetails,subvalue,path=dirtyPaths[i],pathTokens=TcHmi.ObjectPath.toPathTokens(path),subschemaError=TcHmi.Errors.NONE;__this.resolveSubSchema(schema,pathTokens,(function(data){data.error===TcHmi.Errors.NONE?subschema=tchmi_clone_object(data.schema):(subschemaError=data.error,subschemaErrorDetails=data.details)}));let subvalueErrorDetails,subvalueError=TcHmi.Errors.NONE;if(__this.__readSubValue(newValue,pathTokens,name,(function(data){data.error===TcHmi.Errors.NONE?subvalue=tchmi_clone_object(data.value):(subvalueError=data.error,subvalueErrorDetails=data.details)})),subschemaError===TcHmi.Errors.NONE&&subvalueError===TcHmi.Errors.NONE){let prepValue=TcHmi.ValueConverter.toSchemaType(subvalue,subschema,{convertDirection:TcHmi.ValueConverter.ConvertDirection.Backward});if(null===prepValue&&null!==subvalue){let reason,value=subvalue,schema=subschema;reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+': Value of type: "Instance of '+value.constructor+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":"object"==typeof value?__this.__expression.toString()+': Value: "'+JSON.stringify(value)+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":__this.__expression.toString()+': Value: "'+value+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".",error=TcHmi.Errors.E_SYMBOL_VALUE_INVALID,errorDetails||(errorDetails={code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"})}else message.commands.push({commandOptions:["SendErrorMessage"],symbol:name+path,writeValue:prepValue})}else error=TcHmi.Errors.ERROR,errorDetails||(errorDetails={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": Sub schema or sub value error.",domain:"TcHmi.System.Symbol"}),subschemaError!==TcHmi.Errors.NONE&&(errorDetails.errors||(errorDetails.errors=[]),subschemaErrorDetails?errorDetails.errors.push(subschemaErrorDetails):errorDetails.errors.push({code:subschemaError,message:TcHmi.Errors[subschemaError],reason:__this.__expression.toString()+": Sub schema error.",domain:"TcHmi.System.Symbol"})),subvalueError!==TcHmi.Errors.NONE&&(errorDetails.errors||(errorDetails.errors=[]),subvalueErrorDetails?errorDetails.errors.push(subvalueErrorDetails):errorDetails.errors.push({code:subvalueError,message:TcHmi.Errors[subvalueError],reason:__this.__expression.toString()+": Sub value error.",domain:"TcHmi.System.Symbol"}))}else{let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema,{convertDirection:TcHmi.ValueConverter.ConvertDirection.Backward,resolveFunctionWriteValue:!0});if(null===prepValue&&null!==newValue){let reason,value=newValue;reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+': Value of type: "Instance of '+value.constructor+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":"object"==typeof value?__this.__expression.toString()+': Value: "'+JSON.stringify(value)+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":__this.__expression.toString()+': Value: "'+value+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".",error=TcHmi.Errors.E_SYMBOL_VALUE_INVALID,errorDetails||(errorDetails={code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"})}else message.commands.push({commandOptions:["SendErrorMessage"],symbol:name,writeValue:prepValue})}if(error!==TcHmi.Errors.NONE)return void TcHmi.Callback.callSafeEx(callback,__this,{error:error,details:errorDetails});let parallel,readWriteGroup,timeout=__this.__expression.getOptions().Timeout;parallel=options&&void 0!==options.forceParallel?options.forceParallel:__this.__expression.getOptions().Parallel??!1,readWriteGroup=options&&void 0!==options.forceReadWriteGroup?options.forceReadWriteGroup:__this.__expression.getOptions().ReadWriteGroup??void 0,requestId=TcHmi.Server.requestEx(message,{timeout:timeout,parallel:parallel,groupId:readWriteGroup},(function(dataRequest){if(dataRequest.error!==TcHmi.Errors.NONE)return void TcHmi.Callback.callSafeEx(callback,__this,{error:dataRequest.error,details:dataRequest.details});let response=dataRequest.response;if(!response)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_MISSING],reason:__this.__expression.toString()+": Missing response from server.",domain:"TcHmi.System.Symbol"}});if(response&&response.error&&response.error)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],reason:__this.__expression.toString()+": Error in response from server with id: "+response.id,domain:"TcHmi.System.Symbol",errors:[response.error]},response:response});let commands=response.commands;if(commands){if(dirtyPaths&&dirtyPaths.length>0){let processedStart,processedEnd,errors=[];for(let i=0,ii=commands.length;i<ii;i++){let command=commands[i];if(command.error){errors.push({code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:__this.__expression.toString()+": Error in command for symbol: "+name+'" in response from server with id: '+response.id,domain:"TcHmi.System.Symbol",errors:[command.error]});continue}(!processedStart||command.processedStart&&-1===System.compareISO8601ServerCommandDateTimeStrings(command.processedStart,processedStart))&&(processedStart=command.processedStart),(!processedEnd||command.processedEnd&&1===System.compareISO8601ServerCommandDateTimeStrings(command.processedEnd,processedEnd))&&(processedEnd=command.processedEnd);let path=command.symbol.replace(name,""),pathTokens=TcHmi.ObjectPath.toPathTokens(path);__this.__writeSubValue(newValue,command.readValue,pathTokens,name,(function(data){data.error===TcHmi.Errors.NONE||(data.details?errors.push(data.details):errors.push({code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Error in writing a subvalue for symbol: "+name,domain:"TcHmi.System.Symbol"}))}))}return errors.length>0?void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+': Error while processing command for symbol: "'+name+'" in response from server with id: '+response.id,domain:"TcHmi.System.Symbol",errors:errors},response:response}):processedStart&&processedEnd?void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:newValue,processedStart:processedStart,processedEnd:processedEnd,response:response}):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:newValue,response:response})}{let command=commands[0];return command?command.error?void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_COMMAND_ERROR,details:{code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:__this.__expression.toString()+': Error in command for symbol: "'+name+'" in response from server with id: '+response.id,domain:"TcHmi.System.Symbol",errors:[command.error]},response:response}):void(command.processedStart&&command.processedEnd?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:command.readValue,processedStart:command.processedStart,processedEnd:command.processedEnd,response:response}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:command.readValue,response:response})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_COMMAND_MISSING,details:{code:TcHmi.Errors.E_SERVER_COMMAND_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_MISSING],reason:__this.__expression.toString()+': Missing command for symbol: "'+name+'" in response from server with id: '+response.id,domain:"TcHmi.System.Symbol"},response:response})}}TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,details:{code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:__this.__expression.toString()+": Missing commands in response from server with id: "+response.id,domain:"TcHmi.System.Symbol"},response:response})}))})),()=>{destroyed=!0,null!=requestId&&TcHmi.Server.releaseRequest(requestId)}}}__writeSymbolTypeInternal(value,options,dirtyPaths,callback){null===dirtyPaths&&(dirtyPaths=void 0);let __this=this;const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});const path=this.__expression.getPath(),pathTokens=this.__expression.getPathTokens();this.resolveSchema((function(dataResolveSchema){if(dataResolveSchema&&dataResolveSchema.error!==TcHmi.Errors.NONE)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,details:{code:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA],reason:__this.__expression.toString()+": Failed to resolve schema definition",domain:"TcHmi.System.Symbol",errors:dataResolveSchema.details?[dataResolveSchema.details]:void 0}});let schema=__this.__schema,newValue=tchmi_clone_object(value),dirtyPathsNew=[];if(!(path&&pathTokens&&pathTokens.length>0)){let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema);if(null===prepValue&&null!==newValue){let reason,value=newValue;return reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+': Value of type: "Instance of '+value.constructor+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":"object"==typeof value?__this.__expression.toString()+': Value: "'+JSON.stringify(value)+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":__this.__expression.toString()+': Value: "'+value+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".",void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"}})}return TcHmi.System.Services.internalSymbolManager?void TcHmi.System.Services.internalSymbolManager.write(name,prepValue,void 0,(function(data){TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:__this.__expression.toString()+": Failed to write value. System not ready.",domain:"TcHmi.System.Symbol"}})}if(dirtyPaths&&dirtyPaths.length>0)for(let i=0,ii=dirtyPaths.length;i<ii;i++)dirtyPathsNew.push(path+dirtyPaths[i]);else dirtyPathsNew.push(path);TcHmi.System.Services.internalSymbolManager?TcHmi.System.Services.internalSymbolManager.read(name,(function(dataRead){if(dataRead.error===TcHmi.Errors.NONE){let currentSubValue,currentSubValueErrorDetails,currentCloneValue=tchmi_clone_object(dataRead.value),currentSubValueError=TcHmi.Errors.NONE;if(__this.__readSubValue(currentCloneValue,pathTokens,name,(function(data){data.error===TcHmi.Errors.NONE?currentSubValue=tchmi_clone_object(data.value):(currentSubValueError=data.error,currentSubValueErrorDetails=data.details?data.details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Error in reading a subvalue for symbol: "+name,domain:"TcHmi.System.Symbol"})})),currentSubValueError)return void TcHmi.Callback.callSafeEx(callback,__this,{error:currentSubValueError,details:currentSubValueErrorDetails});let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema);if(null===prepValue&&null!==newValue){let reason,value=newValue;return reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+': Value of type: "Instance of '+value.constructor+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":"object"==typeof value?__this.__expression.toString()+': Value: "'+JSON.stringify(value)+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":__this.__expression.toString()+': Value: "'+value+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".",void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"}})}if(tchmi_equal(currentSubValue,prepValue))return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE},{equal:!0});__this.__writeSubValue(currentCloneValue,prepValue,pathTokens,name,(function(data){if(data.error===TcHmi.Errors.NONE){if(!TcHmi.System.Services.internalSymbolManager)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:this.__expression.toString()+": Failed to write value. System not ready.",domain:"TcHmi.System.Symbol"}});TcHmi.System.Services.internalSymbolManager.write(name,currentCloneValue,void 0,(function(dataWrite){TcHmi.Callback.callSafeEx(callback,__this,{error:dataWrite.error,details:dataWrite.details})}))}else TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}))}else TcHmi.Callback.callSafeEx(callback,__this,{error:dataRead.error})})):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:__this.__expression.toString()+": Failed to write value. System not ready.",domain:"TcHmi.System.Symbol"}})}))}__writeSymbolTypeControl(value,options,dirtyPaths,callback){if(!TcHmi.System.Services.controlManager)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:this.__expression.toString()+": Failed to write value. System not ready.",domain:"TcHmi.System.Symbol"}});null===dirtyPaths&&(dirtyPaths=void 0);let __this=this;const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let pathTokens=tchmi_clone_object(this.__expression.getPathTokens());const control=TcHmi.Controls.get(name);if(control)if(null!==pathTokens){let propertyName;pathTokens&&pathTokens.length>0&&(propertyName=pathTokens.shift());const attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName);if(null==attr)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:__this.__expression.toString()+': Can not find attribute with property name: "'+propertyName+'" in control: '+control.getId(),domain:"TcHmi.System.Symbol"}});if(attr.readOnly&&0===pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_READONLY,details:{code:TcHmi.Errors.E_SYMBOL_READONLY,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_READONLY],reason:__this.__expression.toString()+': Writing to readonly symbol is not allowed. Symbol is readonly because attribute with property name: "'+propertyName+'" in control: "'+control.getId()+'" is readonly.',domain:"TcHmi.System.Symbol"}});this.resolveSchema((function(dataResolveSchema){if(!TcHmi.System.Services.controlManager)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:__this.__expression.toString()+": Failed to write value. System not ready.",domain:"TcHmi.System.Symbol"}});if(dataResolveSchema&&dataResolveSchema.error!==TcHmi.Errors.NONE)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,details:{code:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA],reason:__this.__expression.toString()+": Failed to resolve schema definition",domain:"TcHmi.System.Symbol",errors:dataResolveSchema.details?[dataResolveSchema.details]:void 0}});let currentValue,schema=__this.__schema,newValue=tchmi_clone_object(value);try{currentValue=control[attr.propertyGetterName].call(control)}catch(e){return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_EXCEPTION,details:{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:__this.__expression.toString()+": An uncaught exception occurred in the getter call for preparation of the write operation",exception:e,domain:"TcHmi.System.Symbol"}})}let currentCloneValue=tchmi_clone_object(currentValue);if(!attr.readOnly||__tchmi_is_instanced_object(currentCloneValue)){if(pathTokens&&pathTokens.length>0){let rootSchema=TcHmi.Type.getSchema(attr.type);if(rootSchema&&rootSchema.frameworkInstanceOf&&"TcHmi.Controls.System.TcHmiControl"===rootSchema.frameworkInstanceOf){if(!(currentCloneValue instanceof TcHmi.Controls.System.baseTcHmiControl))return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:__this.__expression.toString()+": Missing control instance for parameter: "+attr.propertyName,domain:"TcHmi.System.Symbol"}});{let controlId=currentCloneValue.getId(),subSymbol=new TcHmi.System.Symbol("%ctrl%"+controlId+__this.resolveSanitizedPath(pathTokens)+"%/ctrl%");subSymbol.writeEx(value,dirtyPaths,(function(dataSubSymbol){if(dataSubSymbol.error!==TcHmi.Errors.NONE)return TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,details:{code:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR],reason:this.__expression.toString()+": Failed to write subsymbol "+subSymbol.getExpression().toString(),domain:"TcHmi.System.Symbol",errors:dataSubSymbol.details?[dataSubSymbol.details]:void 0}}),void subSymbol.destroy();TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE}),subSymbol.destroy()}))}return}{let dirtyPathsNew=[];if(dirtyPaths&&dirtyPaths.length>0)for(let i=0,ii=dirtyPaths.length;i<ii;i++)dirtyPathsNew.push(__this.resolveSanitizedPath(pathTokens)+dirtyPaths[i]);else dirtyPathsNew.push(__this.resolveSanitizedPath(pathTokens));let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema);if(null===prepValue&&null!==newValue){let reason,value=newValue;return reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+': Value of type: "Instance of '+value.constructor+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":"object"==typeof value?__this.__expression.toString()+': Value: "'+JSON.stringify(value)+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":__this.__expression.toString()+': Value: "'+value+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".",void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"}})}return void __this.__writeSubValue(currentCloneValue,prepValue,pathTokens,name+"::"+propertyName,(function(data){if(TcHmi.System.Services.controlManager)if(data.error===TcHmi.Errors.NONE){let error=TcHmi.System.Services.controlManager.setControlPropertyByAttribute(control,attr,currentCloneValue,dirtyPathsNew);error&&error.code!==TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:error.code,details:error}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})}else TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details});else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:this.__expression.toString()+": Failed to write value. System not ready.",domain:"TcHmi.System.Symbol"}})}))}}{let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema);if(null===prepValue&&null!==newValue){let reason,value=newValue;return reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+': Value of type: "Instance of '+value.constructor+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":"object"==typeof value?__this.__expression.toString()+': Value: "'+JSON.stringify(value)+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":__this.__expression.toString()+': Value: "'+value+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".",void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"}})}let error=TcHmi.System.Services.controlManager.setControlPropertyByAttribute(control,attr,tchmi_clone_object(prepValue));return void(error&&error.code!==TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:error.code,details:error}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE}))}}TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_READONLY,details:{code:TcHmi.Errors.E_SYMBOL_READONLY,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_READONLY],reason:__this.__expression.toString()+': Writing to readonly symbol is not allowed. Symbol is readonly because attribute with property name: "'+propertyName+'" in control: "'+control.getId()+'" is readonly.',domain:"TcHmi.System.Symbol"}})}))}else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_NOT_ALLOWED,details:{code:TcHmi.Errors.E_NOT_ALLOWED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_ALLOWED],reason:__this.__expression.toString()+": Writing on control instance symbol is not allowed.",domain:"TcHmi.System.Symbol"}});else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND],reason:__this.__expression.toString()+': Can not find control instance with id: "'+name+"'.",domain:"TcHmi.System.Symbol"}})}__writeSymbolTypePartialParam(value,options,dirtyPaths,callback){if(!TcHmi.System.Services.controlManager)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:this.__expression.toString()+": Failed to write value. System not ready.",domain:"TcHmi.System.Symbol"}});null===dirtyPaths&&(dirtyPaths=void 0);let __this=this;const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let searchPropertyName,pathTokens=tchmi_clone_object(this.__expression.getPathTokens()),searchAttr=null;if(!pathTokens)return void("TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:__this.__expression.toString()+" is not a valid PartialParameter. Expected: UserControlHost::Parameter",domain:"TcHmi.System.Symbol"}}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:__this.__expression.toString()+" is not a valid PartialParameter. Expected: TCHMI_TARGET_DESIGNER_PARTIALPARAM::Parameter",domain:"TcHmi.System.Symbol"}}));if(searchPropertyName=pathTokens.shift(),!searchPropertyName)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+" has no valid control property",domain:"TcHmi.System.Symbol"}});const propertyName=searchPropertyName;let designerParam,control;if("TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name){if(control=TcHmi.Controls.get(name),!control)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND],reason:this.__expression.toString()+": Can not find control instance with id: "+name,domain:"TcHmi.System.Symbol"}});searchAttr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName)}else{if(designerParam=TcHmi.System.Services.Engineering.designerModeManager.userControlParameterManager?.get(propertyName),!designerParam)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:__this.__expression.toString()+": Unknown template parameter "+propertyName,domain:"TcHmi.System.Symbol"}});searchAttr=designerParam.descr}if(!searchAttr)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:this.__expression.toString()+": Can not find control attribute with propertyName: "+name,domain:"TcHmi.System.Symbol"}});const attr=searchAttr;this.resolveSchema((function(dataResolveSchema){if(!TcHmi.System.Services.controlManager)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:__this.__expression.toString()+": Failed to write value. System not ready.",domain:"TcHmi.System.Symbol"}});if(dataResolveSchema&&dataResolveSchema.error!==TcHmi.Errors.NONE)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,details:{code:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA],reason:__this.__expression.toString()+": Failed to resolve schema definition.",domain:"TcHmi.System.Symbol",errors:dataResolveSchema.details?[dataResolveSchema.details]:void 0}});let currentValue,schema=__this.__schema,newValue=tchmi_clone_object(value);if(control)try{currentValue=control[attr.propertyGetterName].call(control)}catch(e){return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_EXCEPTION,details:{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:__this.__expression.toString()+": An uncaught exception occurred in the getter call for preparation of the write operation",exception:e,domain:"TcHmi.System.Symbol"}})}else{if(!designerParam)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("Internal Error: Invalid code path. Found no control and no designer parameter."),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": Internal Error: Invalid code path. Found no control and no designer parameter.",domain:"TcHmi.System.Symbol"}});currentValue=designerParam.value}let currentCloneValue=tchmi_clone_object(currentValue);if(pathTokens&&pathTokens.length>0){let rootSchema=TcHmi.Type.getSchema(attr.type);if(rootSchema&&rootSchema.frameworkInstanceOf&&"TcHmi.Controls.System.TcHmiControl"===rootSchema.frameworkInstanceOf){if(!(currentCloneValue instanceof TcHmi.Controls.System.baseTcHmiControl))return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:__this.__expression.toString()+": Missing control instance for parameter: "+propertyName,domain:"TcHmi.System.Symbol"}});{let controlId=currentCloneValue.getId(),subSymbol=new TcHmi.System.Symbol("%ctrl%"+controlId+__this.resolveSanitizedPath(pathTokens)+"%/ctrl%");subSymbol.writeEx(value,dirtyPaths,(function(dataSubSymbol){if(dataSubSymbol&&dataSubSymbol.error!==TcHmi.Errors.NONE)return TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,details:{code:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR],reason:__this.__expression.toString()+": Failed to write to subsymbol "+subSymbol.getExpression().toString(),domain:"TcHmi.System.Symbol",errors:dataSubSymbol.details?[dataSubSymbol.details]:void 0}}),void subSymbol.destroy();TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE}),subSymbol.destroy()}))}return}{let currentSubValue,dirtyPathsNew=[];if(dirtyPaths&&dirtyPaths.length>0)for(let i=0,ii=dirtyPaths.length;i<ii;i++)dirtyPathsNew.push(__this.resolveSanitizedPath(pathTokens)+dirtyPaths[i]);else dirtyPathsNew.push(__this.resolveSanitizedPath(pathTokens));let currentSubValueErrorDetails,currentSubValueError=TcHmi.Errors.NONE;if(__this.__readSubValue(currentCloneValue,pathTokens,name+"::"+propertyName,(function(data){data.error===TcHmi.Errors.NONE?currentSubValue=tchmi_clone_object(data.value):(currentSubValueError=data.error,currentSubValueErrorDetails=data.details?data.details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Error in reading a subvalue for symbol: "+name,domain:"TcHmi.System.Symbol"})})),currentSubValueError)return void TcHmi.Callback.callSafeEx(callback,__this,{error:currentSubValueError,details:currentSubValueErrorDetails});let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema);if(null===prepValue&&null!==newValue){let reason,value=newValue;return reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+': Value of type: "Instance of '+value.constructor+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":"object"==typeof value?__this.__expression.toString()+': Value: "'+JSON.stringify(value)+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":__this.__expression.toString()+': Value: "'+value+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".",void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"}})}return tchmi_equal(currentSubValue,prepValue)?void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE},{equal:!0}):void __this.__writeSubValue(currentCloneValue,prepValue,pathTokens,name+"::"+propertyName,(function(data){if(data.error===TcHmi.Errors.NONE){if(!TcHmi.System.Services.controlManager)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:__this.__expression.toString()+": Failed to write value. System not ready.",domain:"TcHmi.System.Symbol"}});if(control){let error=TcHmi.System.Services.controlManager.setControlPropertyByAttribute(control,attr,currentCloneValue,dirtyPathsNew);error&&error.code!==TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:error.code,details:error}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})}else{if(!designerParam)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("Internal Error: Invalid code path. Found no control and no designer parameter."),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": Internal Error: Invalid code path. Found no control and no designer parameter.",domain:"TcHmi.System.Symbol"}});designerParam.value=currentCloneValue,TcHmi.EventProvider.raise("System.onDesignerUserControlParameterChanged<"+propertyName+">"),TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})}}else TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}))}}{let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema);if(null===prepValue&&null!==newValue){let reason,value=newValue;return reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+': Value of type: "Instance of '+value.constructor+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":"object"==typeof value?__this.__expression.toString()+': Value: "'+JSON.stringify(value)+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":__this.__expression.toString()+': Value: "'+value+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".",void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"}})}if(tchmi_equal(currentCloneValue,prepValue))return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE},{equal:!0});if(control){let error=TcHmi.System.Services.controlManager.setControlPropertyByAttribute(control,attr,prepValue);error&&error.code!==TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:error.code,details:error}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})}else{if(!designerParam)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("Internal Error: Invalid code path. Found no control and no designer parameter."),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": Internal Error: Invalid code path. Found no control and no designer parameter.",domain:"TcHmi.System.Symbol"}});designerParam.value=currentCloneValue,TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})}return}}))}__writeSymbolTypeTemplateParam(value,options,dirtyPaths,callback){if(!TcHmi.System.Services.templateParamSymbolManager)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:this.__expression.toString()+": Failed to write value. System not ready.",domain:"TcHmi.System.Symbol"}});null===dirtyPaths&&(dirtyPaths=void 0);let __this=this;const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});const path=this.__expression.getPath(),pathTokens=this.__expression.getPathTokens(),entry=TcHmi.System.Services.templateParamSymbolManager.get(name);if(entry&&entry.type)if(entry.value instanceof TcHmi.SymbolExpression){let entrySymbolExpression=entry.value,entrySymbolTag=entrySymbolExpression.getTag(),entrySymbolName=entrySymbolExpression.getName(),entrySymbolPath=entrySymbolExpression.getPath(),entrySymbolExpressionNewString="%"+entrySymbolTag+"%"+entrySymbolName;null!==entrySymbolPath&&(entrySymbolExpressionNewString+=entrySymbolPath),path&&pathTokens&&pathTokens.length>0&&(entrySymbolExpressionNewString+=path),entrySymbolExpressionNewString+="%/"+entrySymbolTag+"%";let entrySymbolNew=new TcHmi.System.Symbol(entrySymbolExpressionNewString);entrySymbolNew.writeEx(value,dirtyPaths,(function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details}),entrySymbolNew?.destroy(),entrySymbolNew=null}))}else this.resolveSchema((function(dataResolveSchema){if(dataResolveSchema&&dataResolveSchema.error!==TcHmi.Errors.NONE)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,details:{code:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA],reason:__this.__expression.toString()+": Failed to resolve schema definition.",domain:"TcHmi.System.Symbol",errors:dataResolveSchema.details?[dataResolveSchema.details]:void 0}});let schema=__this.__schema,newValue=tchmi_clone_object(value),currentValue=tchmi_clone_object(entry.value),currentCloneValue=tchmi_clone_object(currentValue);if(path&&pathTokens&&pathTokens.length>0){let currentSubValue,dirtyPathsNew=[];if(dirtyPaths&&dirtyPaths.length>0)for(let i=0,ii=dirtyPaths.length;i<ii;i++)dirtyPathsNew.push(path+dirtyPaths[i]);else dirtyPathsNew.push(path);let currentSubValueErrorDetails,currentSubValueError=TcHmi.Errors.NONE;if(__this.__readSubValue(currentCloneValue,pathTokens,name,(function(data){data.error===TcHmi.Errors.NONE?currentSubValue=tchmi_clone_object(data.value):(currentSubValueError=data.error,currentSubValueErrorDetails=data.details?data.details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Error in reading a subvalue for symbol: "+name,domain:"TcHmi.System.Symbol"})})),currentSubValueError)return void TcHmi.Callback.callSafeEx(callback,__this,{error:currentSubValueError,details:currentSubValueErrorDetails});let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema);if(null===prepValue&&null!==newValue){let reason,value=newValue;return reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+': Value of type: "Instance of '+value.constructor+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":"object"==typeof value?__this.__expression.toString()+': Value: "'+JSON.stringify(value)+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":__this.__expression.toString()+': Value: "'+value+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".",void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"}})}return tchmi_equal(currentSubValue,prepValue)?void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE},{equal:!0}):void __this.__writeSubValue(currentCloneValue,prepValue,pathTokens,name,(function(data){data.error===TcHmi.Errors.NONE?(entry.value=currentCloneValue,TcHmi.System.Callback.callSafeCallbacks1Param(entry.callbacks,__this,dirtyPathsNew&&dirtyPathsNew.length>0?{error:TcHmi.Errors.NONE,value:tchmi_clone_object(entry.value),dirtyPaths:dirtyPathsNew}:{error:TcHmi.Errors.NONE,value:tchmi_clone_object(entry.value)}),TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}))}{let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema);if(null===prepValue&&null!==newValue){let reason,value=newValue;return reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+': Value of type: "Instance of '+value.constructor+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":"object"==typeof value?__this.__expression.toString()+': Value: "'+JSON.stringify(value)+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":__this.__expression.toString()+': Value: "'+value+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".",void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"}})}return tchmi_equal(currentCloneValue,prepValue)?void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE},{equal:!0}):(entry.value=prepValue,TcHmi.System.Callback.callSafeCallbacks1Param(entry.callbacks,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(entry.value)}),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE}))}}));else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:__this.__expression.toString()+": Unknown template parameter "+name,domain:"TcHmi.System.Symbol"}})}watch(callback){return this.watchEx(null,callback)}watchEx(options,callback){let diagGUID="";TCHMI_CONSOLE_LOG_LEVEL>=4&&(diagGUID=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch called.");let destroySubWatch,functionExpression,entrySymbolNew,__this=this,destroyOnPropertyChanged=null,destroyOnControlInitialized=null,destroyOnControlDestroyed=null,destroyDesignerSymbolDataSourceChanged=null,t=this.__expression.getType(),destroy=function(){switch(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+__this.__expression.toString()+", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch destroy called."),t){case TcHmi.SymbolType.Server:case TcHmi.SymbolType.Internal:case TcHmi.SymbolType.LocalizedText:case TcHmi.SymbolType.ThemedResource:destroySubWatch&&(destroySubWatch(),destroySubWatch=null);break;case TcHmi.SymbolType.Function:destroySubWatch&&(destroySubWatch(),destroySubWatch=null),functionExpression&&(functionExpression.destroy(),functionExpression=null);break;case TcHmi.SymbolType.Control:null!==destroyOnControlInitialized&&(destroyOnControlInitialized(),destroyOnControlInitialized=null),null!==destroyOnControlDestroyed&&(destroyOnControlDestroyed(),destroyOnControlDestroyed=null),null!==destroyOnPropertyChanged&&(destroyOnPropertyChanged(),destroyOnPropertyChanged=null);break;case TcHmi.SymbolType.PartialParam:null!==destroyOnPropertyChanged&&(destroyOnPropertyChanged(),destroyOnPropertyChanged=null),null!==destroyDesignerSymbolDataSourceChanged&&(destroyDesignerSymbolDataSourceChanged(),destroyDesignerSymbolDataSourceChanged=null);break;case TcHmi.SymbolType.TemplateParam:let name=__this.__expression.getName();if(name&&System.Services.templateParamSymbolManager){let entry=System.Services.templateParamSymbolManager.get(name);entry&&entry.value instanceof TcHmi.SymbolExpression&&(System.Services.templateParamSymbolManager.keepAlive(name)||System.Services.templateParamSymbolManager.remove(name))}destroySubWatch&&(destroySubWatch(),destroySubWatch=null),entrySymbolNew&&(entrySymbolNew.destroy(),entrySymbolNew=null);case TcHmi.SymbolType.Context:}};if(t===TcHmi.SymbolType.Server){if(!TcHmi.System.Services.serverManager)return TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:__this.__expression.toString()+": Failed to watch. System not ready.",domain:"TcHmi.System.Symbol"}}),destroy;TCHMI_DESIGNER?this.read((data=>{data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:data.value,destroy:destroy}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details,destroy:destroy})})):destroySubWatch=TcHmi.System.Services.serverManager.watch(this.__expression,options,(dataWatch=>{if(destroySubWatch||(destroySubWatch=dataWatch.destroy),dataWatch.error!==TcHmi.Errors.NONE){let res={error:dataWatch.error,details:{code:dataWatch.error,message:TcHmi.Errors[dataWatch.error],reason:__this.__expression.toString()+": Failed to watch",domain:"TcHmi.System.Symbol",errors:dataWatch.details?[dataWatch.details]:void 0},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}this.resolveSchema((dataSchema=>{if(dataSchema.error===TcHmi.Errors.NONE){let prepValue=TcHmi.ValueConverter.toSchemaType(dataWatch.value,dataSchema.schema);if(null===prepValue&&null!==dataWatch.value){let reason,value=dataWatch.value,schema=dataSchema.schema;reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+': Value of type: "Instance of '+value.constructor+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":"object"==typeof value?__this.__expression.toString()+': Value: "'+JSON.stringify(value)+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".":__this.__expression.toString()+': Value: "'+value+'" of type: "'+typeof value+'" '+(schema?"can not be converted to type schema: "+(schema.id?'"'+schema.id+'": ':"")+'"'+JSON.stringify(schema)+'"':"can not be converted because type schema is missing")+".";let res={error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"},destroy:destroy,value:dataWatch.value};return dataWatch.response&&(res.response=dataWatch.response),dataWatch.processedStart&&dataWatch.processedEnd&&(res.processedStart=dataWatch.processedStart,res.processedEnd=dataWatch.processedEnd),void TcHmi.Callback.callSafeEx(callback,__this,res)}{let res={error:TcHmi.Errors.NONE,value:prepValue,destroy:destroy};return dataWatch.response&&(res.response=dataWatch.response),dataWatch.processedStart&&dataWatch.processedEnd&&(res.processedStart=dataWatch.processedStart,res.processedEnd=dataWatch.processedEnd),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}{let res={error:dataSchema.error,details:{code:dataSchema.error,message:TcHmi.Errors[dataSchema.error],reason:__this.__expression.toString()+": Resolving schema failed.",domain:"TcHmi.System.Symbol",errors:dataSchema.details?[dataSchema.details]:void 0},destroy:destroy};return void 0!==dataWatch.value&&(res.value=dataWatch.value),dataWatch.response&&(res.response=dataWatch.response),dataWatch.processedStart&&dataWatch.processedEnd&&(res.processedStart=dataWatch.processedStart,res.processedEnd=dataWatch.processedEnd),void TcHmi.Callback.callSafeEx(callback,__this,res)}}))}))}else if(t===TcHmi.SymbolType.Internal){if(!TcHmi.System.Services.internalSymbolManager)return TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:__this.__expression.toString()+": Failed to watch. System not ready.",domain:"TcHmi.System.Symbol"}}),destroy;const name=this.__expression.getName();if(!name)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}}),destroy;destroySubWatch=TcHmi.System.Services.internalSymbolManager.watch(name,(function(data){if(destroySubWatch||(destroySubWatch=data.destroy),data.error===TcHmi.Errors.NONE){let pathTokens=__this.__expression.getPathTokens();if(pathTokens&&pathTokens.length>0){let doWork=!1,dirtyPaths=data.dirtyPaths,dirtyPathsNew=[];if(dirtyPaths){let pathSanitized=__this.resolveSanitizedPath(pathTokens);for(let i=0,ii=dirtyPaths.length;i<ii;i++){let dirtyPath=dirtyPaths[i];dirtyPath.startsWith(pathSanitized)?(doWork=!0,dirtyPath!==pathSanitized&&dirtyPathsNew.push(dirtyPath.replace(pathSanitized,""))):pathSanitized.startsWith(dirtyPath)&&(doWork=!0)}}else doWork=!0;return void(doWork&&__this.__readSubValue(data.value,pathTokens,name,(function(data){if(data.error===TcHmi.Errors.NONE){let res=dirtyPathsNew&&dirtyPathsNew.length>0?{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),dirtyPaths:dirtyPathsNew,destroy:destroy}:{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}else{let res={error:data.error,details:data.details,destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}})))}{let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}{let res={error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Failed to watch",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}))}else if(t===TcHmi.SymbolType.LocalizedText){if(!TcHmi.System.Services.localizationManager)return TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:__this.__expression.toString()+": Failed to watch. System not ready.",domain:"TcHmi.System.Symbol"}}),destroy;let name,localizationNamespace="TcHmi.System.Localization.Application",pathTokens=tchmi_clone_object(this.__expression.getPathTokens());if(pathTokens&&0!==pathTokens.length){let namespaceToken=this.__expression.getName();if(namespaceToken)if(namespaceToken.startsWith("Control")){if(2!==pathTokens.length)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': "Control" localization symbol expressions must be in the form: Control::[Control-Type]::[Key]',domain:"TcHmi.System.Symbol"},destroy:destroy}),destroy;localizationNamespace="TcHmi.System.Localization.Control<"+pathTokens.shift()+">",name=pathTokens.shift()}else if(namespaceToken.startsWith("Function")){if(2!==pathTokens.length)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': "Function" localization symbol expressions must be in the form: Function::[Function-Name]::[Key]',domain:"TcHmi.System.Symbol"},destroy:destroy}),destroy;localizationNamespace="TcHmi.System.Localization.Function<"+pathTokens.shift()+">",name=pathTokens.shift()}else if(namespaceToken.startsWith("Framework")){if(1!==pathTokens.length)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': "Framework" localization symbol expressions must be in the form: Framework::[Key]',domain:"TcHmi.System.Symbol"},destroy:destroy}),destroy;localizationNamespace="TcHmi.System.Localization.Framework",name=pathTokens.shift()}else{if(!namespaceToken.startsWith("Application"))return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': Path tokens are allowed only if the localization symbol expression starts with one of the following tokens: "Application", "Control", "Function" or "Framework".',domain:"TcHmi.System.Symbol"},destroy:destroy}),destroy;if(1!==pathTokens.length)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+': Explicit "Application" localization symbol expressions must be in the form: Application::[Key]',domain:"TcHmi.System.Symbol"},destroy:destroy}),destroy;localizationNamespace="TcHmi.System.Localization.Application",name=pathTokens.shift()}else;}else name=this.__expression.getName();if(!name)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Could not parse name and namespace.",domain:"TcHmi.System.Symbol"}}),destroy;destroySubWatch=TcHmi.System.Services.localizationManager.watchText(localizationNamespace,name,{level:TcHmi.Locale.Level.Application},(function(data){if(destroySubWatch||(destroySubWatch=data.destroy),data.error===TcHmi.Errors.NONE){let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.text),destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}else{let res={error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Failed to watch expression",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}}))}else if(t===TcHmi.SymbolType.Function){const content=this.__expression.getContent();if(!content)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the content of the symbol.",domain:"TcHmi.System.Symbol"}}),destroy;functionExpression=new TcHmi.System.FunctionExpression(content,{enableWatchMode:!0,forcedSymbolOptions:options}),destroySubWatch=functionExpression.watch((function(data){if(destroySubWatch||(destroySubWatch=data.destroy),data.error===TcHmi.Errors.NONE){let pathTokens=__this.__expression.getPathTokens();if(pathTokens&&pathTokens.length>0){let res={error:TcHmi.Errors.E_NOT_SUPPORTED,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:__this.__expression.toString()+': Reading by path is not supported on symbols of type "Function".',domain:"TcHmi.System.Symbol"},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}{let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}{let res={error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Failed to watch",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}))}else{if(t===TcHmi.SymbolType.Control){if(!TcHmi.System.Services.controlManager)return TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:__this.__expression.toString()+": Failed to watch. System not ready.",domain:"TcHmi.System.Symbol"}}),destroy;let name=__this.__expression.getName();if(!name){let res={error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:__this.__expression.toString()+": Expression does not contain a valid name token.",domain:"TcHmi.System.Symbol"},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res),destroy}let control=TcHmi.Controls.get(name),controlWasAvailable=!1;control&&(controlWasAvailable=!0);let proc=()=>{let propertyName,pathTokens=tchmi_clone_object(__this.__expression.getPathTokens()),pathSanitized="";if(!control){if(controlWasAvailable)return;{let res={error:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND],reason:__this.__expression.toString()+": Can not find control instance with name: "+name,domain:"TcHmi.System.Symbol"},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}if(pathTokens&&pathTokens.length>0&&(propertyName=pathTokens.shift(),pathTokens.length>0&&(pathSanitized=__this.resolveSanitizedPath(pathTokens))),propertyName){let attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName);if(!attr){let res={error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:__this.__expression.toString()+': Can not find attribute definition for property: "'+propertyName+'" of control: "'+name+'" of type: '+control.getType(),domain:"TcHmi.System.Symbol"},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}if(!attr.propertyGetterName){let res={error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION],reason:__this.__expression.toString()+': Can not find valid "propertyGetterName" in attribute definition for property: "'+propertyName+'" of control: "'+name+'" of type: "'+control.getType()+'". Please check Description.json',domain:"TcHmi.System.Symbol"},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}destroyOnPropertyChanged=TcHmi.EventProvider.register(name+".onPropertyChanged<"+attr.propertyName+">",(function(e,data){if(!data)return;let doWork=!1,dirtyPaths=data.dirtyPaths,dirtyPathsNew=[];if(pathSanitized&&dirtyPaths&&dirtyPaths.length>0)for(let j=0,jj=dirtyPaths.length;j<jj;j++){let dirtyPath=dirtyPaths[j];dirtyPath.startsWith(pathSanitized)?(doWork=!0,dirtyPath!==pathSanitized&&dirtyPathsNew.push(dirtyPath.replace(pathSanitized,""))):pathSanitized.startsWith(dirtyPath)&&(doWork=!0)}else doWork=!0;doWork&&__this.read((function(data){if(data.error===TcHmi.Errors.NONE){let res=dirtyPathsNew&&dirtyPathsNew.length>0?{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),dirtyPaths:dirtyPathsNew,destroy:destroy}:{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}{let res={error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": Failed to read",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}))}))}this.read((function(data){if(data.error===TcHmi.Errors.NONE){let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}{let res={error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": Failed to read",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}))};return destroyOnControlInitialized=TcHmi.EventProvider.register(name+".onInitialized",((e,data)=>{control=data,control&&(controlWasAvailable=!0),proc()})),destroyOnControlDestroyed=TcHmi.EventProvider.register(name+".onDestroyed",((e,data)=>{control=void 0,proc()})),proc(),destroy}if(t===TcHmi.SymbolType.PartialParam){if(!TcHmi.System.Services.controlManager)return TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:__this.__expression.toString()+": Failed to watch. System not ready.",domain:"TcHmi.System.Symbol"}}),destroy;const name=this.__expression.getName();if(!name)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}}),destroy;let propertyName,designerParam,control,pathTokens=tchmi_clone_object(this.__expression.getPathTokens()),attr=null,pathSanitized="";if(!pathTokens){let res={error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the token of the symbol.",domain:"TcHmi.System.Symbol"},destroy:destroy};return res.details.reason+="TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name?" is not a valid PartialParameter. Expected: UserControlHost::Parameter":" is not a valid PartialParameter. Expected: TCHMI_TARGET_DESIGNER_PARTIALPARAM::Parameter",TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res),destroy}if(propertyName=pathTokens.shift(),pathTokens.length>0&&(pathSanitized=__this.resolveSanitizedPath(pathTokens)),!propertyName)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+" has no valid control property",domain:"TcHmi.System.Symbol"}}),destroy;if("TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name){if(control=TcHmi.Controls.get(name),!control){let res={error:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND],reason:__this.__expression.toString()+": Can not find control instance with id: "+name,domain:"TcHmi.System.Symbol"},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res),destroy}if(attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName),!attr){let res={error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:__this.__expression.toString()+': Can not find attribute definition for property: "'+propertyName+'" of control: "'+name+'" of type: '+control.getType(),domain:"TcHmi.System.Symbol"},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res),destroy}if(!attr.propertyGetterName){let res={error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION],reason:__this.__expression.toString()+': Can not find valid "propertyGetterName" in attribute definition for property: "'+propertyName+'" of control: "'+name+'" of type: "'+control.getType()+'". Please check Description.json.',domain:"TcHmi.System.Symbol"},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res),destroy}destroyOnPropertyChanged=TcHmi.EventProvider.register(name+".onPropertyChanged<"+attr.propertyName+">",(function(e,data){if(!data)return;let doWork=!1,dirtyPaths=data.dirtyPaths,dirtyPathsNew=[];if(pathSanitized&&dirtyPaths&&dirtyPaths.length>0)for(let j=0,jj=dirtyPaths.length;j<jj;j++){let dirtyPath=dirtyPaths[j];dirtyPath.startsWith(pathSanitized)?(doWork=!0,dirtyPath!==pathSanitized&&dirtyPathsNew.push(dirtyPath.replace(pathSanitized,""))):pathSanitized.startsWith(dirtyPath)&&(doWork=!0)}else doWork=!0;doWork&&__this.read((function(data){if(data.error!==TcHmi.Errors.NONE){let res={error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Failed to write",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}{let res=dirtyPathsNew&&dirtyPathsNew.length>0?{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),dirtyPaths:dirtyPathsNew,destroy:destroy}:{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}}))}))}else{if(destroyDesignerSymbolDataSourceChanged=TcHmi.EventProvider.register("System.onDesignerUserControlParameterChanged<"+propertyName+">",(function(e){__this.read((function(data){if(data.error===TcHmi.Errors.NONE){let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}{let res={error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Failed to read",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}))})),designerParam=TcHmi.System.Services.Engineering.designerModeManager.userControlParameterManager?.get(propertyName),!designerParam)return TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:__this.__expression.toString()+": Unknown template parameter "+propertyName,domain:"TcHmi.System.Symbol"},destroy:destroy}),destroy;if(attr=designerParam.descr,!attr)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:this.__expression.toString()+": Can not find control attribute with propertyName: "+name,domain:"TcHmi.System.Symbol"},destroy:destroy}),destroy}let isControlSubValue=!1;if(pathTokens&&pathTokens.length>0){let rootSchema=TcHmi.Type.getSchema(attr.type);if(rootSchema&&rootSchema.frameworkInstanceOf&&"TcHmi.Controls.System.TcHmiControl"===rootSchema.frameworkInstanceOf){isControlSubValue=!0;let resControl=null;if(control)resControl=control[attr.propertyGetterName].call(control);else{if(!designerParam)throw new Error("Invalid code path. Found no control and no designer parameter.");resControl=designerParam.value}if(resControl&&resControl instanceof TcHmi.Controls.System.baseTcHmiControl){let resControlId=resControl.getId(),subSymbol=new TcHmi.System.Symbol("%ctrl%"+resControlId+this.resolveSanitizedPath(pathTokens)+"%/ctrl%");subSymbol.watch((function(dataSubSymbol){if(dataSubSymbol.error!==TcHmi.Errors.NONE){let res={error:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,details:{code:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR],reason:__this.__expression.toString()+": Failed to watch subsymbol "+subSymbol.getExpression().toString(),domain:"TcHmi.System.Symbol",errors:dataSubSymbol.details?[dataSubSymbol.details]:void 0},destroy:()=>{destroy(),subSymbol.destroy()}};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(dataSubSymbol.value),destroy:()=>{destroy(),subSymbol.destroy()}};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}))}else if("TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name){let res={error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:__this.__expression.toString()+": Missing control instance for parameter: "+propertyName,domain:"TcHmi.System.Symbol"},destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}else this.resolveSchema((data=>{if(data.error===TcHmi.Errors.NONE&&data.schema){let defaultValue=System.Type.Schema.resolveDefault(data.schema),res={error:TcHmi.Errors.NONE,value:defaultValue,destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,details:{code:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA],reason:__this.__expression.toString()+": Failed to resolve schema definition.",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy})}))}}isControlSubValue||this.read((function(data){if(data.error===TcHmi.Errors.NONE){let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}else{let res={error:data.error,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": Failed to read",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}}))}else if(t===TcHmi.SymbolType.TemplateParam){if(!TcHmi.System.Services.templateParamSymbolManager)return TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:__this.__expression.toString()+": Failed to watch. System not ready.",domain:"TcHmi.System.Symbol"}}),destroy;const name=this.__expression.getName();if(!name)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}}),destroy;let path=this.__expression.getPath(),pathTokens=this.__expression.getPathTokens(),entry=TcHmi.System.Services.templateParamSymbolManager.get(name);if(!entry||!entry.type)return TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:__this.__expression.toString()+": Unknown template parameter "+name,domain:"TcHmi.System.Symbol"}}),destroy;if(entry.value instanceof TcHmi.SymbolExpression){entry.callbacks.push(callback);let entrySymbolExpression=entry.value,entrySymbolTag=entrySymbolExpression.getTag(),entrySymbolName=entrySymbolExpression.getName(),entrySymbolPath=entrySymbolExpression.getPath(),entrySymbolExpressionNewString="%"+entrySymbolTag+"%"+entrySymbolName;null!==entrySymbolPath&&(entrySymbolExpressionNewString+=entrySymbolPath),path&&pathTokens&&pathTokens.length>0&&(entrySymbolExpressionNewString+=path),entrySymbolExpressionNewString+="%/"+entrySymbolTag+"%",entrySymbolNew=new TcHmi.System.Symbol(entrySymbolExpressionNewString),destroySubWatch=entrySymbolNew.watch((function(data){destroySubWatch||(destroySubWatch=data.destroy),data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:()=>{destroy(),entrySymbolNew?.destroy()}}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Failed to watch subsymbol "+entrySymbolNew?.getExpression.toString(),domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:()=>{destroy(),entrySymbolNew?.destroy()}})})),this.read((function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Failed to read",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy})}))}else{let res={error:TcHmi.Errors.E_SYMBOL_INVALID_DATA_PROVIDER_ENTRY,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_DATA_PROVIDER_ENTRY,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_DATA_PROVIDER_ENTRY],reason:__this.__expression.toString(),domain:"TcHmi.System.Symbol"},destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}}else if(t===TcHmi.SymbolType.Context){let res={error:TcHmi.Errors.E_NOT_SUPPORTED,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:__this.__expression.toString()+": SymbolType: '"+t+"' does not support watching.",domain:"TcHmi.System.Symbol"},destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}else if(t===TcHmi.SymbolType.ThemedResource){let name,pathTokens=tchmi_clone_object(this.__expression.getPathTokens()),namespaceTokens=["Application"];if(pathTokens&&0!==pathTokens.length){let namespaceToken=this.__expression.getName();if(!namespaceToken)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}}),destroy;if(namespaceTokens[0]=namespaceToken,namespaceTokens[0].startsWith("Application")){if(!pathTokens.length)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": 'Application' themed symbol expressions must be in the form: 'Application::[Key]' or 'Key'.",domain:"TcHmi.System.Symbol"}}),destroy;name=pathTokens.shift()}else if(namespaceTokens[0].startsWith("Control")){if(pathTokens.length<2)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": 'Control' themed symbol expressions must be in the form: 'Control::[Control-Type]::[Key]'.",domain:"TcHmi.System.Symbol"}}),destroy;namespaceTokens[1]=pathTokens.shift(),name=pathTokens.shift()}else namespaceTokens[0]="Application",name=this.__expression.getName()}else name=this.__expression.getName();if(!name)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name and namespace of the symbol.",domain:"TcHmi.System.Symbol"}}),destroy;destroySubWatch=TcHmi.System.Services.themeManager.watchThemedResource(name,namespaceTokens,(function(data){if(destroySubWatch||(destroySubWatch=data.destroy),data.error===TcHmi.Errors.NONE){if(pathTokens&&pathTokens.length>0){let doWork=!1,dirtyPaths=data.dirtyPaths,dirtyPathsNew=[];if(dirtyPaths){let pathSanitized=__this.resolveSanitizedPath(pathTokens);for(let i=0,ii=dirtyPaths.length;i<ii;i++){let dirtyPath=dirtyPaths[i];dirtyPath.startsWith(pathSanitized)?(doWork=!0,dirtyPath!==pathSanitized&&dirtyPathsNew.push(dirtyPath.replace(pathSanitized,""))):pathSanitized.startsWith(dirtyPath)&&(doWork=!0)}}else doWork=!0;return void(doWork&&__this.__readSubValue(data.value,pathTokens,name,(function(data){if(data.error===TcHmi.Errors.NONE){let res=dirtyPathsNew&&dirtyPathsNew.length>0?{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),dirtyPaths:dirtyPathsNew,destroy:destroy}:{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}else{let res={error:data.error,details:data.details,destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}})))}{let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafe(callback,__this,res)}}{let res={error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString(),domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafe(callback,__this,res)}}))}else{let res={error:TcHmi.Errors.E_NOT_SUPPORTED,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:__this.__expression.toString()+': SymbolType: "'+t+'" does not support watching.',domain:"TcHmi.System.Symbol"},destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}}return destroy}static isServerSymbol(checkSymbol){return!!checkSymbol.getExpression()&&checkSymbol.getExpression().getType()===TcHmi.SymbolType.Server}static isInternalSymbol(checkSymbol){return!!checkSymbol.getExpression()&&checkSymbol.getExpression().getType()===TcHmi.SymbolType.Internal}static isLocalizedTextSymbol(checkSymbol){return!!checkSymbol.getExpression()&&checkSymbol.getExpression().getType()===TcHmi.SymbolType.LocalizedText}static isPartialParamSymbol(checkSymbol){return!!checkSymbol.getExpression()&&checkSymbol.getExpression().getType()===TcHmi.SymbolType.PartialParam}static isTemplateParamSymbol(checkSymbol){return!!checkSymbol.getExpression()&&checkSymbol.getExpression().getType()===TcHmi.SymbolType.TemplateParam}static isFunctionSymbol(checkSymbol){return!!checkSymbol.getExpression()&&checkSymbol.getExpression().getType()===TcHmi.SymbolType.Function}static isControlSymbol(checkSymbol){return!!checkSymbol.getExpression()&&checkSymbol.getExpression().getType()===TcHmi.SymbolType.Control}static isContextSymbol(checkSymbol){return!!checkSymbol.getExpression()&&checkSymbol.getExpression().getType()===TcHmi.SymbolType.Context}static isThemedSymbol(checkSymbol){return!!checkSymbol.getExpression()&&checkSymbol.getExpression().getType()===TcHmi.SymbolType.ThemedResource}exists(callback){if(Symbol.isFunctionSymbol(this))TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!0});else if(Symbol.isLocalizedTextSymbol(this)){let name,localizationNamespace="TcHmi.System.Localization.Application",pathTokens=tchmi_clone_object(this.__expression.getPathTokens());if(pathTokens&&0!==pathTokens.length){let namespaceToken=this.__expression.getName();if(!namespaceToken)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1});if(namespaceToken.startsWith("Control")){if(2!==pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1});localizationNamespace="TcHmi.System.Localization.Control<"+pathTokens.shift()+">",name=pathTokens.shift()}else if(namespaceToken.startsWith("Function")){if(2!==pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1});localizationNamespace="TcHmi.System.Localization.Function<"+pathTokens.shift()+">",name=pathTokens.shift()}else if(namespaceToken.startsWith("Framework")){if(1!==pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1});localizationNamespace="TcHmi.System.Localization.Framework",name=pathTokens.shift()}else{if(!namespaceToken.startsWith("Application"))return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1});if(1!==pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1});localizationNamespace="TcHmi.System.Localization.Application",name=pathTokens.shift()}}else name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1});let ns=System.Services.localizationManager?.get(localizationNamespace);if(ns){let localization=ns.getLocalization();if(localization&&void 0!==localization[name]&&null!==localization[name])return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!0})}TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1})}else this.read((function(data){if(data.error!==TcHmi.Errors.NONE)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1});if(!Symbol.isServerSymbol(this)||!("response"in data))return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!0});const response=data.response;if(response&&response.commands&&response.commands.length>0){return response.commands[0].error?void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1}):void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!0})}TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1})}))}}Symbol.__SERVER_SYMBOL_SCHEMA_CACHE={},System.Symbol=Symbol}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.SymbolExpressionParser=class{constructor(text){this.__text=text}loadText(text){this.__text=text}__parseExpressionFromString(text,typeString,res){const typeStringlength=typeString.length,textlength=text.length;for(let pos=0;pos<=textlength;pos++){if("%"!==text[pos])continue;let esccount=0,otag="";if(pos+typeStringlength+2<=textlength)if("$"!==text.substr(pos+1,1))otag=text.substr(pos,typeStringlength+2);else{let temppos=pos+1;for(;temppos+2<=textlength&&"$"===text.substr(temppos,1);)esccount++,temppos++;otag=text.substr(pos,typeStringlength+esccount+2)}let exptag="%";for(let i=0,ii=esccount;i<ii;i++)exptag+="$";if(exptag+=typeString+"%",otag===exptag){let ocount=0,ccount=0,subText=text.substr(pos+otag.length,textlength-(pos+otag.length)),subTextlength=textlength-(pos+otag.length);for(let subPos=0;subPos<=subTextlength;subPos++){if("%"!==subText[subPos])continue;let subOTag="";subPos+typeStringlength+2<=subTextlength&&(subOTag=subText.substr(subPos,typeStringlength+2));let subCTag="";if(subPos+typeStringlength+3<=subTextlength&&(subCTag=subText.substr(subPos,typeStringlength+3)),subCTag==="%/"+typeString+"%"){if(ccount===ocount){let e=text.substr(pos,otag.length+subCTag.length+subPos),se=new TcHmi.SymbolExpression(e);se.getType()!==TcHmi.SymbolType.Invalid&&res.push(se);break}ccount++}else subOTag==="%"+typeString+"%"&&ocount++}}}return res}resolveExpressionsBySymbolType(type){let res=[],typeString=null;switch(type){case TcHmi.SymbolType.Internal:typeString="i";break;case TcHmi.SymbolType.Server:typeString="s";break;case TcHmi.SymbolType.LocalizedText:typeString="l";break;case TcHmi.SymbolType.PartialParam:typeString="pp";break;case TcHmi.SymbolType.TemplateParam:typeString="tp";break;case TcHmi.SymbolType.Control:typeString="ctrl";break;case TcHmi.SymbolType.Function:typeString="f";break;case TcHmi.SymbolType.Context:typeString="ctx";break;case TcHmi.SymbolType.ThemedResource:typeString="tr";break;default:return res}return null===typeString?res:this.__text?(res=this.__parseExpressionFromString(this.__text,typeString,res),res.sort((function(a,b){const alength=a.toString().length,blength=b.toString().length;return alength>blength?-1:alength<blength?1:0})),res):res}resolveExpressions(){let res=[];if(null===this.__text||0===this.__text.length)return res;let typeStrings=["i","s","l","pp","tp","ctrl","f","ctx","tr"];for(let i=0,ii=typeStrings.length;i<ii;i++)res=this.__parseExpressionFromString(this.__text,typeStrings[i],res);return res.sort((function(a,b){return a.toString().length>b.toString().length?-1:a.toString().length<b.toString().length?1:0})),res}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){let ScaleMode;!function(ScaleMode){ScaleMode[ScaleMode.None=0]="None",ScaleMode[ScaleMode.ScaleToFit=1]="ScaleToFit",ScaleMode[ScaleMode.ScaleToFitWidth=2]="ScaleToFitWidth",ScaleMode[ScaleMode.ScaleToFitHeight=3]="ScaleToFitHeight",ScaleMode[ScaleMode.ScaleToFill=4]="ScaleToFill"}(ScaleMode=System.ScaleMode||(System.ScaleMode={}));System.ViewManager=class{constructor(){this.__scaleMode=ScaleMode.None,this.__view=null,this.__animationFrameTimeId=0,this.__viewUrl=null,this.__onSystemSplashScreenHideEvent=null,this.__onViewResizedEventDestroyEvent=null,this.__onViewDestroyedEventDestroyEvent=null,this.__pending=!1,window.addEventListener("resize",this.__onWindowResized())}__onWindowResized(){return()=>{this.__scaleMode!==ScaleMode.None&&this.__scale()}}__onViewDestroyed(){let __this=this;return function(evt,tco){__this.__view===tco&&(TcHmi.System.SharedResources.jqBody.children().detach(),null!==__this.__onViewResizedEventDestroyEvent&&(__this.__onViewResizedEventDestroyEvent(),__this.__onViewResizedEventDestroyEvent=null),null!==__this.__onViewDestroyedEventDestroyEvent&&(__this.__onViewDestroyedEventDestroyEvent(),__this.__onViewDestroyedEventDestroyEvent=null),__this.__view=null,__this.__viewUrl=null)}}__onViewResized(){return(evt,tco)=>{this.__scaleMode!==ScaleMode.None&&this.__scale()}}__scale(){this.__animationFrameTimeId||(this.__animationFrameTimeId=window.requestAnimationFrame((()=>{this.__doScaling()})))}__doScaling(){if(this.__animationFrameTimeId=0,!0===TCHMI_DESIGNER)return;if(!this.__view)return;const elem=this.__view.getElement()[0];if(!elem)return;const rendWidth=this.__view.getRenderedWidth(),rendHeight=this.__view.getRenderedHeight();if(rendHeight&&rendWidth)switch(this.__scaleMode){case ScaleMode.ScaleToFit:{let ratioW=(window.visualViewport?.width??window.innerWidth)/rendWidth,ratioH=(window.visualViewport?.height??window.innerHeight)/rendHeight,ratio=ratioW>ratioH?ratioH:ratioW;elem.style.transform=`scale(${ratio})`,elem.style.transformOrigin="0 0"}break;case ScaleMode.ScaleToFitWidth:{let ratio=(window.visualViewport?.width??window.innerWidth)/rendWidth;elem.style.transform=`scale(${ratio})`,elem.style.transformOrigin="0 0"}break;case ScaleMode.ScaleToFitHeight:{let ratio=(window.visualViewport?.height??window.innerHeight)/rendHeight;elem.style.transform=`scale(${ratio})`,elem.style.transformOrigin="0 0"}break;case ScaleMode.ScaleToFill:{let ratioW=(window.visualViewport?.width??window.innerWidth)/rendWidth,ratioH=(window.visualViewport?.height??window.innerHeight)/rendHeight;elem.style.transform=`scale(${ratioW},${ratioH})`,elem.style.transformOrigin="0 0"}break;case ScaleMode.None:elem.style.transform="",elem.style.transformOrigin=""}}setScaleMode(scaleModeStr){let sm=TcHmi.System.ScaleMode.None;switch(scaleModeStr){case"ScaleToFit":sm=TcHmi.System.ScaleMode.ScaleToFit;break;case"ScaleToFitWidth":sm=TcHmi.System.ScaleMode.ScaleToFitWidth;break;case"ScaleToFitHeight":sm=TcHmi.System.ScaleMode.ScaleToFitHeight;break;case"ScaleToFill":sm=TcHmi.System.ScaleMode.ScaleToFill}this.__scaleMode=sm,this.__scale()}getView(){return this.__view}loadView(url,callback=null){if(!0===this.__pending)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Loading "+url+" failed because we have already another load pending.",domain:"TcHmi.System.ViewManager"}});const partialUrl=tchmi_path(url);if(this.__viewUrl===partialUrl)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE});if(this.__pending=!0,void 0!==this.__view&&null!==this.__view&&(TcHmi.System.SharedResources.jqBody.children().detach(),this.__onSystemSplashScreenHideEvent&&(this.__onSystemSplashScreenHideEvent(),this.__onSystemSplashScreenHideEvent=null),null!==this.__onViewResizedEventDestroyEvent&&(this.__onViewResizedEventDestroyEvent(),this.__onViewResizedEventDestroyEvent=null),null!==this.__onViewDestroyedEventDestroyEvent&&(this.__onViewDestroyedEventDestroyEvent(),this.__onViewDestroyedEventDestroyEvent=null),this.__view.destroy(),this.__view=null,this.__viewUrl=null),!partialUrl)return this.__pending=!1,void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE});let __this=this,__proc=function(url,markup,keepAlive){let loadingSpinnerDiv=null;if(!1===TCHMI_DESIGNER&&!TcHmi.System.Services.splashScreen.isVisible()){let loadingSpinnerDivTempDiv=document.createElement("div");loadingSpinnerDivTempDiv.innerHTML='<div class="tchmi-view-loading-spinner-container"><div class="tchmi-view-loading-spinner"><div></div><div></div><div></div><div></div></div></div>',loadingSpinnerDiv=loadingSpinnerDivTempDiv.firstElementChild,loadingSpinnerDiv&&document.body.appendChild(loadingSpinnerDiv)}setTimeout((()=>{let tempDiv=document.createElement("div");tempDiv.innerHTML=markup;const elem=tempDiv.firstElementChild;let errorreason;if(elem?elem.hasAttribute("data-tchmi-type")||(errorreason="First html element is no tchmi control (missing data-tchmi-type attribute)."):errorreason="No valid html elements found.",errorreason||!elem)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Compiling "+url+" failed. "+errorreason,domain:"TcHmi.System.ViewManager"}});elem.remove();let vo=TcHmi.Controls.get(elem.id);if(vo||(url===TCHMI_TARGET_PARTIAL&&elem.setAttribute("data-tchmi-creator-partial-key",TCHMI_TARGET_PARTIAL),elem.setAttribute("data-tchmi-partial-url",url),vo=TcHmi.System.Services.controlManager?.compile(elem)),!vo)return __this.__pending=!1,void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Compiling "+url+" failed.",domain:"TcHmi.System.ViewManager"}});if(keepAlive&&vo.__setKeepAlive(!0),__this.__view=vo,__this.__viewUrl=url,__this.__onViewResizedEventDestroyEvent=TcHmi.EventProvider.register(__this.__view.getId()+".onResized",__this.__onViewResized()),__this.__onViewDestroyedEventDestroyEvent=TcHmi.EventProvider.register(__this.__view.getId()+".onDestroyed",__this.__onViewDestroyed()),TcHmi.System.Services.splashScreen.isVisible()||TcHmi.System.SharedResources.jqBody.children().detach(),!0===TCHMI_ENGINEERING&&!0===TCHMI_DESIGNER&&TcHmi.System.Services.Engineering.designerModeManager.rootControlManager){let vpSimulator=TcHmi.System.Services.Engineering.designerModeManager.rootControlManager.getViewPortSimulator();vpSimulator.empty(),vpSimulator[0].appendChild(__this.__view.getElement()[0]),document.body.appendChild(vpSimulator[0])}else!TcHmi.System.Services.splashScreen.isVisible()&&loadingSpinnerDiv&&loadingSpinnerDiv.remove(),TcHmi.System.Services.splashScreen.isVisible()&&(__this.__view.getElement()[0].style.opacity="0",__this.__onSystemSplashScreenHideEvent=TcHmi.EventProvider.register("System.onSplashScreenHide",(e=>{__this.__onSystemSplashScreenHideEvent&&(__this.__onSystemSplashScreenHideEvent(),__this.__onSystemSplashScreenHideEvent=null),__this.__view&&(__this.__view.getElement()[0].style.opacity="1")}))),document.body.prepend(__this.__view.getElement()[0]);__this.__pending=!1,TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})}))},partialMarkup=TcHmi.System.Data.Caches.partialMarkupCache.get(partialUrl),partialMarkupKeepAlive=!1;if(!0===TcHmi.System.Data.isKeepAlivePartial.get(partialUrl)&&(partialMarkupKeepAlive=!0),partialMarkup)__proc(partialUrl,partialMarkup.markup,partialMarkupKeepAlive);else if(TCHMI_ENGINEERING)TcHmi.System.Services.Engineering.designerModeManager.partialContentManager.requestCurrentPartialContent(partialUrl,(data=>{data.error===TcHmi.Errors.NONE?__proc(partialUrl,data.content,partialMarkupKeepAlive):(__this.__pending=!1,TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Loading "+partialUrl+" failed.",domain:"TcHmi.System.ViewManager",errors:data.details?[data.details]:void 0}}))}));else{let xhr=new XMLHttpRequest;xhr.open("GET",partialUrl+(TCHMI_ENGINEERING?"?preventcache="+Math.random():""));let ViewManager_loadView_getMarkup_success=function(evt){200===xhr.status?(partialMarkupKeepAlive&&TcHmi.System.Data.Caches.partialMarkupCache.set(partialUrl,{markup:xhr.responseText}),__proc(partialUrl,xhr.responseText,partialMarkupKeepAlive)):ViewManager_loadView_getMarkup_error(evt)},ViewManager_loadView_getMarkup_error=function(evt){__this.__pending=!1,TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Loading "+partialUrl+" failed: "+xhr.status+" "+xhr.statusText,domain:"TcHmi.System.ViewManager"}})};xhr.addEventListener("load",ViewManager_loadView_getMarkup_success),xhr.addEventListener("error",ViewManager_loadView_getMarkup_error),xhr.send()}}loadViewObject(view,callback=null){!0!==this.__pending?(this.__pending=!0,void 0!==this.__view&&null!==this.__view&&(TcHmi.System.SharedResources.jqBody.children().detach(),null!==this.__onViewResizedEventDestroyEvent&&(this.__onViewResizedEventDestroyEvent(),this.__onViewResizedEventDestroyEvent=null),null!==this.__onViewDestroyedEventDestroyEvent&&(this.__onViewDestroyedEventDestroyEvent(),this.__onViewDestroyedEventDestroyEvent=null),this.__view.destroy(),this.__view=null,this.__viewUrl=null),this.__view=view,this.__viewUrl=null,this.__onViewResizedEventDestroyEvent=TcHmi.EventProvider.register(this.__view.getId()+".onResized",this.__onViewResized()),this.__onViewDestroyedEventDestroyEvent=TcHmi.EventProvider.register(this.__view.getId()+".onDestroyed",this.__onViewDestroyed()),TcHmi.System.SharedResources.jqBody.children().detach(),TCHMI_DESIGNER&&TcHmi.System.Services.Engineering.designerModeManager.rootControlManager?document.body.append(TcHmi.System.Services.Engineering.designerModeManager.rootControlManager.getBackgroundTarget()[0],TcHmi.System.Services.Engineering.designerModeManager.rootControlManager.getViewPortSimulator().empty()[0].appendChild(this.__view.getElement()[0])):document.body.appendChild(this.__view.getElement()[0]),this.__pending=!1,TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})):"function"==typeof callback&&callback.call(this,{error:TcHmi.Errors.ERROR})}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.TcSpeechManager=class{constructor(){this.__openConnection=!1,this.__restartServerEventListening=()=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Restarting all event listeners in the speech extension for our socket id "+this.__peerData.localSocketId+". (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")"),this.__commandDestroyFnc?.(),this.__commandDestroyFnc=TcHmi.Server.Events.registerConsumer([{path:"domain",comparator:"==",value:this.__currentConfig.domain},{logic:"AND"},{path:"name",comparator:"==",value:"COMMAND_RECEIVED"},{logic:"AND"},{path:"payload::RemoteSocketId",comparator:"==",value:this.__peerData.localSocketId}],{subscription:data=>{if(data.error)return;const evt=data.event;if(TcHmi.Server.Events.isPayload(evt)&&evt.payload)switch(evt.payload.Command.Type){case"LogOnClientCommand":if(TCHMI_CONSOLE_LOG_LEVEL>=evt.payload.Command.Severity)switch(evt.payload.Command.Severity){case 1:TcHmi.Log.errorEx("[Source=TwinCAT Speech Core]",...evt.payload.Command.MessageParts);break;case 2:TcHmi.Log.warnEx("[Source=TwinCAT Speech Core]",...evt.payload.Command.MessageParts);break;case 3:TcHmi.Log.infoEx("[Source=TwinCAT Speech Core]",...evt.payload.Command.MessageParts);break;case 4:TcHmi.Log.debugEx("[Source=TwinCAT Speech Core]",...evt.payload.Command.MessageParts)}break;case"DetectedCommand":if(evt.payload.Command.Confidence&&!isNaN(this.__currentConfig.confidenceThreshold)&&evt.payload.Command.Confidence<this.__currentConfig.confidenceThreshold){if(TCHMI_CONSOLE_LOG_LEVEL>=3){let numFormatter=new Intl.NumberFormat(TcHmi.Server.getCurrentUserConfig().locale,{style:"decimal",maximumFractionDigits:2});TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Detected event",evt.payload.Command.DetectedCommand," skipped because its confidence",numFormatter.format(evt.payload.Command.Confidence),"is below configured threshold",numFormatter.format(this.__currentConfig.confidenceThreshold))}return}let EventProviderParam={Command:evt.payload.Command.DetectedCommand,Confidence:evt.payload.Command.Confidence,Parameter:evt.payload.Command.Parameter};TcHmi.EventProvider.raise("SpeechOnCommand<"+evt.payload.Command.DetectedCommand+">",EventProviderParam),TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Raised event: ","SpeechOnCommand<"+evt.payload.Command.DetectedCommand+">"," with param: ",EventProviderParam);break;case"SpeechSynthesisStatus":TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Received event for ISpeechSynthesisStatus\n",evt.payload.Command);let command=evt.payload.Command,callbackSet=this.__getStatusCallbackQueue.get(evt.payload.Command.Guid);callbackSet?.forEach((callback=>{TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.NONE,guid:command.Guid,state:command.State})}));break;case"Answer":let serverAnswer=evt.payload.Command;TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Read server answer from server event and saving as remoteSdp (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+").",serverAnswer),this.__peerData.remoteSdp=serverAnswer.SDP;let speechServerData={type:"answer",sdp:this.__peerData.remoteSdp};this.__peerConnection.setRemoteDescription(speechServerData).then((()=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Set setRemoteDescription without problems. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")"),this.__peerData.remotePendingIceCandidate.length&&(this.__peerData.remotePendingIceCandidate.forEach((icecandidate=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Adding one remote pending ice candidate. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")",icecandidate),this.__peerConnection.addIceCandidate(icecandidate).then((()=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Added pending ice candidate. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")")})).catch((data=>{TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Adding ice candidate failed",data)}))})),TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Requested adding "+this.__peerData.remotePendingIceCandidate.length+" pending ice candidates. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+") Clearing pending candidates."),this.__peerData.remotePendingIceCandidate=[])})).catch((data=>{TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Setting remote description failed",data)}));break;case"IceCandidates":evt.payload.Command.Candidates.length&&(TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Read "+evt.payload.Command.Candidates.length+" server remote ice from server events."),"have-local-offer"===this.__peerConnection.signalingState?(this.__peerData.remotePendingIceCandidate=this.__peerData.remotePendingIceCandidate.concat(evt.payload.Command.Candidates),TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Saved "+evt.payload.Command.Candidates.length+" ice candidates in a pending cache. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")")):(evt.payload.Command.Candidates.forEach((icecandidate=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Adding one remote ice candidate. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")",icecandidate),this.__peerConnection.addIceCandidate(icecandidate).then((()=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Added remote ice candidate. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")")})).catch((data=>{TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Adding ice candidate failed",data)}))})),TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Added all "+evt.payload.Command.Candidates.length+" remote ice candidates. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")")));break;default:TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Command ",evt.payload.Command,"from remote id "+evt.payload.RemoteSocketId,"is not supported. Ignoring")}}})},this.__peerData={options:{},callback:null,clientState:0,audioElement:document.createElement("audio"),localSocketId:0,localSdp:"",localIceCandidates:[],remoteSocketId:0,remoteSdp:"",remoteVersion:"",remoteIceCandidate:[],remotePendingIceCandidate:[]},this.__globalEventsRegistered=!1,this.__domainWatchRegistered=0,this.__handlingNewIce=data=>{data.candidate?(this.__peerData.localIceCandidates.push(data.candidate),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Got new local ice candidate to transport to the other side (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+"). Will save the candidate for now.")):this.__peerData.remoteSocketId?(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Found no more ice candidates to transport to the other side. Sending now."),this.__sendIceCandidates()):TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Found",this.__peerData.localIceCandidates,"ice candidates to transport to the other side. But remoteSocketId is not known right now. Waiting.")},this.__sendIceCandidates=()=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Sending ice candidates",this.__peerData.localIceCandidates),TcHmi.Server.writeSymbolEx(this.__currentConfig.domain+".Event.Raise",{SpeechApiVersion:1,SocketId:this.__peerData.localSocketId,RemoteSocketId:this.__peerData.remoteSocketId,Command:{Type:"IceCandidates",Candidates:this.__peerData.localIceCandidates}},null,this.__writeValueDebugOutput)},this.__handlingNewTrack=data=>{if(!this.__currentConfig.enableSpeaker)return void(TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Got remote track, but ignoring because our speaker is disabled."));let track=data.track;if(TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Got "+data.streams.length+" (track id: "+track.id+", kind: "+track.kind+", label: "+track.label+", muted: "+track.muted+", readyState: "+track.readyState+") streams from the remote side (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+") Adding first one to our audio element."),data.track.addEventListener("mute",(evt=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] "+evt.type+" on remote track fired.")})),data.track.addEventListener("unmute",(evt=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] "+evt.type+" on remote track fired.")})),this.__peerData.audioElement.readyState===HTMLMediaElement.HAVE_NOTHING&&(this.__peerData.audioElement.pause(),this.__peerData.audioElement=document.createElement("audio"),this.__peerData.options.sinkConstraints?.deviceId&&this.__peerData.audioElement.setSinkId&&this.__peerData.audioElement.setSinkId(this.__peerData.options.sinkConstraints.deviceId).then((()=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Successfully set deviceId to audio element.")})).catch((e=>{TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Failed setting deviceId to audio element:\n",e)}))),this.__peerData.audioElement.srcObject=data.streams[0],this.setVolume(this.__currentConfig.defaultVolume),this.__peerData.audioElement.play().catch((data=>{let tryPlay=()=>{this.__peerData.audioElement.paused&&(this.__peerData.audioElement.play().catch((data=>{TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Activating audio playback for TwinCAT Speech failed even after user interaction",data)})),TcHmi.TopMostLayer.removeEx(container))},container=document.createElement("div");container.style.padding="20px",container.style.margin="20px",container.style.background="white",container.onclick=tryPlay;let confirmButton=document.createElement("button");confirmButton.innerText=TcHmi.System.Services.localization?.getText("OK")??"OK",container.append((TcHmi.System.Services.localization?.getText("Speech_playing_audio_needs_confirmation")??"TwinCAT Speech: Playing audio needs confirmation.")+" ",confirmButton),TcHmi.TopMostLayer.addEx(container,{centerHorizontal:!0,centerVertical:!0,removeCb:tryPlay})})),navigator.mediaSession&&window.MediaMetadata)try{navigator.mediaSession.metadata=new window.MediaMetadata({album:document.title,title:"TwinCAT Speech Output",artist:"TwinCAT Speech "+this.__peerData.remoteVersion}),navigator.mediaSession.setActionHandler?.("play",(()=>{})),navigator.mediaSession.setActionHandler?.("pause",(()=>{})),navigator.mediaSession.setActionHandler?.("stop",(()=>{this.closeConnection()}))}catch(ex){}this.__peerData.clientState=8},this.__handlingNegotiationneeded=data=>{this.__peerData.localIceCandidates=[],TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Got negotiationneeded event. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+"). Recreate Offer."),1!==this.__peerData.clientState&&(this.__peerData.clientState=5,this.__clientSignalingStateMachine())},this.__handlingIceError=data=>{TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Got an ice error",data)},this.closeConnection=(options={},callback)=>{if(TCHMI_DESIGNER){const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:"Speech connectivity is not supported in Designer view."};TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}else if(options?.remoteSocketId&&this.__peerData.remoteSocketId!==options.remoteSocketId){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],domain:"TcHmi.System.TcSpeechManager",reason:"No connection with requested socket ID open."};TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}else!this.__peerConnection||"closed"!==this.__peerConnection.connectionState&&"disconnected"!==this.__peerConnection.connectionState||TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Closing connection."),this.__openConnection=!1,this.__peerData.clientState=9,this.__rebuildPeerConnectionObject(),TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.NONE})},this.__clientSignalingStateMachine=()=>{switch(this.__peerData.clientState){case 2:this.__peerData.clientState=3;case 3:if(200===this.__domainWatchRegistered)return this.__peerData.clientState=4,void this.__clientSignalingStateMachine();if(102===this.__domainWatchRegistered)return void(this.__peerData.clientState=1);this.__domainWatchRegistered=102,this.__peerData.clientState=1,TcHmi.Server.Domains.watch(this.__currentConfig.domain,(data=>{data&&data.error===TcHmi.Errors.NONE&&"Initialized"===data.value?.state?(TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Register own instance and starting RTCPeerConnection."),TcHmi.Server.writeSymbolEx(this.__currentConfig.domain+".Clients.Register",{SpeechApiVersion:1,RemoteSocketId:0,SocketId:0,RegisterDate:(new Date).toISOString(),Version:TcHmi.version.full,AudioSink:this.__currentConfig.enableSpeaker,AudioSource:this.__currentConfig.enableMicrophone,CanOffer:!0,CanAnswer:!1,PotentialLocales:TcHmi.Locale.getRegisteredLocales(),State:"available"},null,TcHmi.Server.__handleServerResponse({error:data=>{this.__peerData.clientState=10,data.error?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Registering client failed: "+TcHmi.Log.buildMessage(data.details),"\n",data.response):data.results?.some((data=>data.error!==TcHmi.Errors.NONE))?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Registering client failed:\n",data.results):TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Registering client failed:\n",data.response);const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.TcSpeechManager",reason:"Registering client failed. Aborting."};TcHmi.Callback.callSafe(this.__peerData.callback,null,{error:errorDetail.code,details:errorDetail})},success:data=>{if(this.__domainWatchRegistered=200,!data.response.commands[0].readValue){this.__peerData.clientState=10,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Registering client failed. Aborting.");const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.TcSpeechManager",reason:"Registering client failed. Aborting."};return void TcHmi.Callback.callSafe(this.__peerData.callback,null,{error:errorDetail.code,details:errorDetail})}let oldId=this.__peerData.localSocketId;this.__peerData.localSocketId=data.response.commands[0].readValue.SocketId,TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Got our Socket Id: "+this.__peerData.localSocketId),this.__globalEventsRegistered||(this.__globalEventsRegistered=!0,TcHmi.EventProvider.register("onLocaleChanged",this.__registerClientConfig),TcHmi.EventProvider.register("onWebSocketOpened",(evt=>{this.__restartServerEventListening()}))),oldId!==this.__peerData.localSocketId&&this.__restartServerEventListening(),9!==this.__peerData.clientState&&10!==this.__peerData.clientState&&(this.__peerData.clientState=4,this.__clientSignalingStateMachine())}})),this.__rebuildPeerConnectionObject()):(this.closeConnection(),this.__commandDestroyFnc?.(),this.__commandDestroyFnc=void 0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx('[Source=Framework, Module=TcHmi.System.TcSpeechManager] Domain: "'+this.__currentConfig?.domain+'" is not available. Please make sure the server extension is loaded and the domain name is correct.',TcHmi.Log.buildMessage(data.value?.error)))}));break;case 4:if(this.__currentConfig.enableMicrophone){if(!navigator.mediaDevices){let reason;reason=window.isSecureContext?"Could not access media devices.":"Could not access media devices. You probably need to access this page via secure HTTPS or localhost.",TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] "+reason),this.__peerData.clientState=10;const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:reason};return void TcHmi.Callback.callSafe(this.__peerData.callback,null,{error:errorDetail.code,details:errorDetail})}this.__peerData.clientState=1;const constraints={audio:this.__peerData.options.sourceConstraints??!0,video:!1};navigator.mediaDevices.getUserMedia(constraints).then((localStream=>{let alltracks=localStream.getTracks();TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Got "+alltracks.length+" audio tracks from the microphone (id: "+localStream.id+") (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+"). Adding all tracks to peerConnection now.");for(const track of alltracks)this.__peerConnection.addTrack(track,localStream),TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Added microphone track to peerConnection with the id: "+track.id+", kind: "+track.kind+", label: "+track.label+", muted: "+track.muted+", readyState: "+track.readyState);TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Saving all tracks to peerConnection successful. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")"),this.__peerData.clientState=5,this.__clientSignalingStateMachine()})).catch((reason=>{switch(this.__peerData.clientState=10,reason.name){case"NotFoundError":TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Capturing audio failed: No microphone was found.");break;case"SecurityError":case"PermissionDeniedError":case"NotAllowedError":TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Capturing audio failed: Denied access to microphone.");break;default:TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Capturing audio failed (",reason.name,"):",reason.message)}})),TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Requested microphone from the browser. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")")}else{let myStream=new AudioContext({}).createMediaStreamDestination().stream;for(const track of myStream.getTracks())this.__peerConnection.addTrack(track,myStream),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] No microphone requested. Thus added silence/empty track to peerConnection with the id: "+track.id+", kind: "+track.kind+", label: "+track.label+", muted: "+track.muted+", readyState: "+track.readyState);this.__peerData.clientState=5,this.__clientSignalingStateMachine()}break;case 5:TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Requesting WebRTC offer from the browser (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")"),this.__peerData.clientState=1,this.__peerConnection.createOffer().then((offer=>(TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Browser created offer. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+") and saving as local description."),this.__peerData.localSdp=offer.sdp,this.__peerData.remoteSdp="","stable"!==this.__peerConnection.signalingState&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] We created an Offer, but peerConnection.signalingState is not in state stable."),this.__peerConnection.setLocalDescription(offer)))).then((()=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Set local description successful. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")"),this.__peerData.clientState=6,this.__clientSignalingStateMachine()})).catch((data=>{TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Creating offer failed",data),this.__peerData.clientState=10,this.__peerData.localSdp="",this.__peerData.remoteSdp=""}));break;case 6:TcHmi.Server.readSymbolEx(this.__currentConfig.domain+".Clients.List",null,TcHmi.Server.__handleServerResponse({error:this.__writeValueDebugOutput,success:data=>{let readValue=data.response.commands[0].readValue;if(!readValue.length)return TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] No registered Speech Clients found! Huh. At least we should have find ourself."),void(this.__peerData.clientState=10);if(TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Registered Speech Clients found. Searching a matching server. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")"),this.__peerData.options?.remoteSocketId){const firstMatch=readValue.find((data=>data.CanAnswer&&data.SocketId===this.__peerData.options.remoteSocketId));if(!firstMatch){this.__peerData.clientState=10,TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] No speech service with the requested id available on this server.");const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:"No speech service with the requested id available on this server."};return void TcHmi.Callback.callSafe(this.__peerData.callback,null,{error:errorDetail.code,details:errorDetail})}this.__peerData.remoteSocketId=firstMatch.SocketId,this.__peerData.remoteVersion=firstMatch.Version}else{const firstMatch=readValue.find((data=>data.CanAnswer));if(!firstMatch){this.__peerData.clientState=10,TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] No speech service available on this server.");const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:"No speech service available on this server."};return void TcHmi.Callback.callSafe(this.__peerData.callback,null,{error:errorDetail.code,details:errorDetail})}this.__peerData.remoteSocketId=firstMatch.SocketId,this.__peerData.remoteVersion=firstMatch.Version}TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Found a matching server with id "+this.__peerData.remoteSocketId+". (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")"),this.__peerData.localIceCandidates.length&&(TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Found cached local ice candidates. Sending now, as we have now the remoteSocketId."),this.__sendIceCandidates()),TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Sending active Commands, as we have now the remoteSocketId."),this.__registerClientConfig(),this.__peerData.clientState=7,this.__clientSignalingStateMachine()}}));break;case 7:TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Sending offer to remoteSocketId "+this.__peerData.remoteSocketId+" of server. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")"),TcHmi.Server.writeSymbolEx(this.__currentConfig.domain+".Event.Raise",{SpeechApiVersion:1,SocketId:this.__peerData.localSocketId,RemoteSocketId:this.__peerData.remoteSocketId,Command:{Type:"Offer",SDP:this.__peerData.localSdp}},null,this.__writeValueDebugOutput)}},this.__eventProviderRegistrations=[],this.__eventProviderRegistrationTimeOut=0,this.__registerClientConfig=()=>{window.clearTimeout(this.__eventProviderRegistrationTimeOut),this.__eventProviderRegistrationTimeOut=0,this.__peerData.remoteSocketId&&TcHmi.Server.writeSymbolEx(this.__currentConfig.domain+".ClientConfigs.Register",{SpeechApiVersion:1,SocketId:this.__peerData.localSocketId,RemoteSocketId:this.__peerData.remoteSocketId,CurrentCommands:this.__eventProviderRegistrations,CurrentLocales:[TcHmi.Locale.get()??"en"]},null,TcHmi.Server.__handleServerResponse({completed:this.__writeValueDebugOutput}))},this.__getStatusCallbackQueue=new Map,this.__writeValueDebugOutput=data=>{data.error?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Writing to server symbol failed: "+TcHmi.Log.buildMessage(data.details),"\n",data.response):data.results?.some((data=>data.error!==TcHmi.Errors.NONE))?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Writing to server symbol failed:\n",data.results):data.response.commands[0].symbol===this.__currentConfig.domain+".Event.Raise"&&data.response.commands[0].writeValue?.Command?.Type?TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Raised Command ",data.response.commands[0].writeValue?.Command?.Type,"to remote socket id "+data.response.commands[0].writeValue?.RemoteSocketId,"with payload",data.response.commands[0].writeValue):TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Written to server symbol: "+data.response.commands[0].symbol,"writevalue: ",data.response.commands[0].writeValue)},this.__currentConfig={enableMicrophone:TcHmi.System.config.tcSpeech?.enableMicrophone??!1,enableSpeaker:TcHmi.System.config.tcSpeech?.enableSpeaker??!1,defaultVolume:TcHmi.System.config.tcSpeech?.defaultVolume??1,confidenceThreshold:TcHmi.System.config.tcSpeech?.confidenceThreshold??.2,domain:TcHmi.System.config.tcSpeech?.domain??"TcHmiSpeech"},TCHMI_DESIGNER||(TcHmi.EventProvider.register("System.EventProvider.onRegisterCallback",((e,data)=>{let name=data.name;name.endsWith(">")&&name.startsWith("SpeechOnCommand<")&&this.__addUsedSpeechTrigger(name)})),TcHmi.EventProvider.register("System.EventProvider.onDestroyedCallback",((e,data)=>{let name=data.name;name.endsWith(">")&&name.startsWith("SpeechOnCommand<")&&this.__removeUsedSpeechTrigger(name)})),TCHMI_DESIGNER||!this.__currentConfig.enableSpeaker&&!this.__currentConfig.enableMicrophone||TcHmi.EventProvider.register("onInitialized",(event=>{event.destroy(),0===this.__peerData.clientState&&this.openConnection()})))}__rebuildPeerConnectionObject(){this.__peerConnection?.close();this.__peerConnection=new RTCPeerConnection({iceCandidatePoolSize:5}),this.__peerConnection.addEventListener("icecandidate",this.__handlingNewIce),this.__peerConnection.addEventListener("icecandidateerror",this.__handlingIceError),this.__peerConnection.addEventListener("track",this.__handlingNewTrack),this.__peerConnection.addEventListener("negotiationneeded",this.__handlingNegotiationneeded),this.__peerConnection.addEventListener("signalingstatechange",(data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] # >"+data.type+" (connection state is: "+data.target.connectionState+", signaling state is: "+data.target.signalingState+")")})),this.__peerConnection.addEventListener("connectionstatechange",(data=>{switch(this.__peerConnection.connectionState){case"disconnected":case"failed":this.__peerData.clientState=10}TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] # >"+data.type+" (connection state is: "+data.target.connectionState+", signaling state is: "+data.target.signalingState+")")}))}openConnection(options={},callback){if(TCHMI_DESIGNER){const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:"Speech connectivity is not supported in Designer view."};TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}else this.closeConnection(),"string"==typeof options.domain&&(this.__currentConfig.domain=options.domain),"boolean"==typeof options.enableSpeaker&&(this.__currentConfig.enableSpeaker=options.enableSpeaker),"boolean"==typeof options.enableMicrophone&&(this.__currentConfig.enableMicrophone=options.enableMicrophone),"number"==typeof options.defaultVolume&&(this.__currentConfig.defaultVolume=options.defaultVolume),"number"==typeof options.confidenceThreshold&&(this.__currentConfig.confidenceThreshold=options.confidenceThreshold),this.__currentConfig.enableSpeaker||this.__currentConfig.enableMicrophone?(this.__openConnection=!0,this.__peerData.callback=callback,this.__peerData.localSdp="",this.__peerData.remoteSdp="",this.__peerData.remoteSocketId=0,this.__peerData.localIceCandidates=[],this.__peerData.options=options,this.__peerData.clientState=2,this.__peerData.options.sinkConstraints?.deviceId&&(this.__peerData.audioElement.setSinkId?this.__peerData.audioElement.setSinkId(this.__peerData.options.sinkConstraints.deviceId).then((()=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Successfully set deviceId to audio element.")})).catch((e=>{TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Failed setting deviceId to audio element:\n",e)})):TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Setting deviceId to audio element not possible in this browser.")),this.__clientSignalingStateMachine()):TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.NONE})}setVolume(newValue){TCHMI_DESIGNER||isNaN(newValue)||(newValue<0?newValue=0:newValue>1&&(newValue=1),this.__peerData.audioElement.volume=newValue)}__addUsedSpeechTrigger(eventname){if(TCHMI_DESIGNER)return;const commandName=eventname.substring(16,eventname.length-1);this.__eventProviderRegistrations.includes(commandName)||(this.__eventProviderRegistrations.push(commandName),this.__eventProviderRegistrationTimeOut&&window.clearTimeout(this.__eventProviderRegistrationTimeOut),this.__eventProviderRegistrationTimeOut=window.setTimeout(this.__registerClientConfig,50))}__removeUsedSpeechTrigger(eventname){if(TCHMI_DESIGNER)return;const commandName=eventname.substring(16,eventname.length-1),idx=this.__eventProviderRegistrations.indexOf(commandName);-1===idx||TcHmi.EventProvider.has(eventname)||(this.__eventProviderRegistrations.splice(idx,1),this.__eventProviderRegistrationTimeOut&&window.clearTimeout(this.__eventProviderRegistrationTimeOut),this.__eventProviderRegistrationTimeOut=window.setTimeout(this.__registerClientConfig,50))}speechSynthesisStart(text,options,callback){if(TCHMI_DESIGNER){const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:"Speech connectivity is not supported in Designer view."};return void TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}if(!text){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],domain:"TcHmi.System.TcSpeechManager",reason:"Text to Synthesis has to be provided."};return void TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}if(!this.__currentConfig.enableSpeaker){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.TcSpeechManager",reason:"The config did not allowed a speaker, so we can not synthesis text."};return void TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}if(!this.__peerData.remoteSocketId){const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:"Connection to Speech has to be up before we can synthesis text."};return void TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}const guid=tchmi_create_guid();let prio=options?.priority??TcHmi.TcSpeech.AudioEntityPriority.Normal;if(null===TcHmi.Server.writeSymbolEx(this.__currentConfig.domain+".Event.Raise",{SpeechApiVersion:1,SocketId:this.__peerData.localSocketId,RemoteSocketId:this.__peerData.remoteSocketId,Command:{Type:"SpeechSynthesisStart",Text:text,Priority:prio,Guid:guid}},null,TcHmi.Server.__handleServerResponse({completed:data=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Requested start of SpeechSynthesis with id "+guid),TcHmi.Callback.callSafe(callback,null,{error:data.error,details:data.details,guid:guid,state:"Queued"})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.System.TcSpeechManager"};TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}}speechSynthesisGetStatus(guid,callback){if(TCHMI_DESIGNER){const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:"Speech connectivity is not supported in Designer view."};return void TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}if(!guid){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],domain:"TcHmi.System.TcSpeechManager",reason:"Guid to get synthesis status has to be provided."};return void TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}if(null===TcHmi.Server.writeSymbolEx(this.__currentConfig.domain+".Event.Raise",{SpeechApiVersion:1,SocketId:this.__peerData.localSocketId,RemoteSocketId:this.__peerData.remoteSocketId,Command:{Type:"SpeechSynthesisGetStatus",Guid:guid}},null,TcHmi.Server.__handleServerResponse({error:data=>{TcHmi.Callback.callSafe(callback,null,{error:data.error,details:data.details,guid:guid})},success:data=>{let guidSet=this.__getStatusCallbackQueue.get(guid);guidSet||(guidSet=new Set,this.__getStatusCallbackQueue.set(guid,guidSet)),guidSet.add(callback)}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.System.TcSpeechManager"};TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}}
/**
             * Stops a given speech synthesis call.
             * @param guid guid for the request. Can be fetched from the callback of speechSynthesisStart
             * @param callback The callback will get the state of the speech synthesis
             * @preserve (Part of the public API)
             */speechSynthesisStop(guid,callback){if(TCHMI_DESIGNER){const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:"Speech connectivity is not supported in Designer view."};return void TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}if(!guid){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],domain:"TcHmi.System.TcSpeechManager",reason:"Guid to stop synthesis has to be provided."};return void TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}if(null!==TcHmi.Server.writeSymbolEx(this.__currentConfig.domain+".Event.Raise",{SpeechApiVersion:1,SocketId:this.__peerData.localSocketId,RemoteSocketId:this.__peerData.remoteSocketId,Command:{Type:"SpeechSynthesisStop",Guid:guid}},null,TcHmi.Server.__handleServerResponse({completed:data=>{TcHmi.Callback.callSafe(callback,null,{error:data.error,details:data.details,guid:guid})}})));else{const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.System.TcSpeechManager"};TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.ThemeManager=class{constructor(){this.__activeTheme="Base",this.__registered_themedValueFiles_fromControl=new Map,this.__registered_styleCheets_fromControl=new Map,this.__control_themeFiles=new Map,this.__project_themeFiles=new Map,this.__resolveControlInheritance=()=>{if(!TcHmi.System.Services.controlManager)return;const resolve=(hierarchyEntry,parent)=>{if(!hierarchyEntry)return;const normalizeThemeFileForCurrrentControl=descr=>{descr.controlTypeValues||(descr.controlTypeValues={});let attrValue=descr.controlTypeValues[hierarchyEntry.controlType];attrValue||(attrValue=descr.controlTypeValues[hierarchyEntry.controlType]={}),attrValue.attributes||(attrValue.attributes={}),attrValue.themedResources||(attrValue.themedResources={})};this.__project_themeFiles.forEach((descr=>{if(descr&&(normalizeThemeFileForCurrrentControl(descr),parent)){const parentAttrValue=descr.controlTypeValues[parent.controlType],controlAttrValue=descr.controlTypeValues[hierarchyEntry.controlType];for(const parentAttrName of Object.keys(parentAttrValue.attributes))void 0===controlAttrValue.attributes[parentAttrName]&&(controlAttrValue.attributes[parentAttrName]=parentAttrValue.attributes[parentAttrName]);for(const parentResourceName of Object.keys(parentAttrValue.themedResources))void 0===controlAttrValue.themedResources[parentResourceName]&&(controlAttrValue.themedResources[parentResourceName]=parentAttrValue.themedResources[parentResourceName])}})),this.__control_themeFiles.forEach((controlTypeMap=>{controlTypeMap.forEach(((descr,controlName)=>{descr&&normalizeThemeFileForCurrrentControl(descr)}));let descr=controlTypeMap.get(hierarchyEntry.controlType);if(descr||(descr={controlTypeValues:{}},descr.controlTypeValues[hierarchyEntry.controlType]={attributes:{},themedResources:{}},controlTypeMap.set(hierarchyEntry.controlType,descr)),parent&&controlTypeMap.has(parent.controlType)){const parentAttrValue=controlTypeMap.get(parent.controlType).controlTypeValues[parent.controlType],controlAttrValue=descr.controlTypeValues[hierarchyEntry.controlType];for(const parentAttrName of Object.keys(parentAttrValue.attributes))void 0===controlAttrValue.attributes[parentAttrName]&&(controlAttrValue.attributes[parentAttrName]=parentAttrValue.attributes[parentAttrName]);for(const parentResourceName of Object.keys(parentAttrValue.themedResources))void 0===controlAttrValue.themedResources[parentResourceName]&&(controlAttrValue.themedResources[parentResourceName]=parentAttrValue.themedResources[parentResourceName])}}));for(let child of hierarchyEntry.children)resolve(child,hierarchyEntry)};resolve(TcHmi.System.Services.controlManager.getInheritanceTree(),void 0)},this.__asyncLoadCount=0,this.retriggerUserControls=()=>{if(!TcHmi.System.Services.controlManager)return;let controlsToTrigger=[];TcHmi.System.Services.controlManager.getControlsCache().forEach(((control,controlName)=>{"TcHmi.Controls.System.TcHmiUserControlHost"===control.getType()&&controlsToTrigger.push(control)})),this.__triggerControlsWithImplicitValues(controlsToTrigger)},this.__watchAttributeDefaults=new Map,this.__destroyOnPropertyChanged=new Map,this.__settingThemeValueInProgress=null,this.__themedResourcesControl=new Map,this.__themedResourcesApplication=new Map,this.__onControlDestroyed=(e,control)=>{this.__watchAttributeDefaults.delete(control);const destroy=this.__destroyOnPropertyChanged.get(control);destroy&&(destroy(),this.__destroyOnPropertyChanged.delete(control))},this.__onControlClassNamesChanged=(e,data)=>{let currentProjectThemeFiles=this.__project_themeFiles.get(this.__activeTheme);if(currentProjectThemeFiles){if(data.oldClassNames)for(let oldClassName of data.oldClassNames)if(currentProjectThemeFiles.controlClassValues&&currentProjectThemeFiles.controlClassValues[oldClassName])return void this.__triggerControlsWithImplicitValues([data.control]);for(let newClassName of data.newClassName)if(currentProjectThemeFiles.controlClassValues&&currentProjectThemeFiles.controlClassValues[newClassName])return void this.__triggerControlsWithImplicitValues([data.control])}},TcHmi.EventProvider.register("System.onControlDestroyed",this.__onControlDestroyed),TcHmi.EventProvider.register("System.onControlClassNamesChanged",this.__onControlClassNamesChanged),TcHmi.EventProvider.register("System.onUserControlConfigCreated",this.retriggerUserControls),TcHmi.EventProvider.register("System.onUserControlConfigChanged",this.retriggerUserControls),TcHmi.EventProvider.register("System.onUserControlConfigRemoved",this.retriggerUserControls),TcHmi.System.config.activeTheme&&this.setTheme(TcHmi.System.config.activeTheme,!1);const fontFaceSet=document.fonts;fontFaceSet&&fontFaceSet.addEventListener&&fontFaceSet.addEventListener("loadingdone",(evt=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] System has loaded another font file. Triggering a onThemeDataChanged."),TcHmi.EventProvider.raise("onThemeDataChanged")}));const updatePixelRatio=(init,evt)=>{window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`).addEventListener("change",updatePixelRatio.bind(null,!1),{once:!0}),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] dpi of the window has changed. Triggering a onThemeDataChanged."),init||TcHmi.EventProvider.raise("onThemeDataChanged")};updatePixelRatio(!0)}__clearProjectThemeUrl(cleanPath){if(cleanPath.endsWith(".theme"))this.__control_themeFiles.clear(),this.__project_themeFiles.clear();else if(cleanPath.endsWith(".css")){let currentLinkElem=document.head.querySelector('link[href="'+cleanPath+'"]');currentLinkElem&&(currentLinkElem.href="")}}getTheme(){return this.__activeTheme}setTheme(valueNew,processTheme){return"string"!=typeof valueNew||""===valueNew?TcHmi.Errors.E_PARAMETER_INVALID:(tchmi_equal(this.__activeTheme,valueNew)||(this.__activeTheme=valueNew,processTheme&&this.processActiveTheme()),TcHmi.Errors.NONE)}registerControlThemeFiles(controlDescr){let ctrlType=TcHmi.System.resolveQualifiedName(controlDescr.name,controlDescr.namespace),themeFiles=controlDescr.themes;if(themeFiles)for(let themeName in themeFiles)for(let arrayIterator=0;arrayIterator<themeFiles[themeName].resources.length;arrayIterator++){const themeFile=themeFiles[themeName].resources[arrayIterator];if(themeFile.name){if("ThemedValues"===themeFile.type){let currentThemeEntry=this.__registered_themedValueFiles_fromControl.get(themeName);currentThemeEntry||(currentThemeEntry=new Map,this.__registered_themedValueFiles_fromControl.set(themeName,currentThemeEntry));let currentCtrlTypeEntry=currentThemeEntry.get(ctrlType);currentCtrlTypeEntry||(currentCtrlTypeEntry=[],currentThemeEntry.set(ctrlType,currentCtrlTypeEntry)),currentCtrlTypeEntry.push(themeFile)}else if("Stylesheet"===themeFile.type){let currentThemeEntry=this.__registered_styleCheets_fromControl.get(themeName);currentThemeEntry||(currentThemeEntry=new Map,this.__registered_styleCheets_fromControl.set(themeName,currentThemeEntry));let currentCtrlTypeEntry=currentThemeEntry.get(ctrlType);currentCtrlTypeEntry||(currentCtrlTypeEntry=[],currentThemeEntry.set(ctrlType,currentCtrlTypeEntry)),currentCtrlTypeEntry.push(themeFile)}}else TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warnEx("[Source=Framework, Module=TcHmi.System.ThemeManager] No file path found for theme entry  ("+themeName+") and control ("+ctrlType+") in Description.json:",themeFile)}}processActiveTheme(callback,options){const activeThemePjctCfg=TcHmi.System.config?.themes[this.__activeTheme];let jsonValueChanged=!1,asyncLoadingHandler=evt=>{evt.target?.removeEventListener("error",asyncLoadingHandler),this.__asyncLoadCount--,this.__asyncLoadCount<=0&&(this.__resolveControlInheritance(),this.__triggerControlsWithImplicitValues(null),this.processThemedResources(),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] System has loaded and parsed all async files. Triggering a control resize check and event onThemeDataChanged."),TcHmi.System.Services.controlManager?.checkControlGeometry(),TcHmi.EventProvider.raise("onThemeDataChanged"),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE}))};TcHmi.Engineering.ErrorPane.remove("ThemeManager_multipleThemes");let foundProjectThemedValue="";for(const projectFile of activeThemePjctCfg?.resources??[]){if("Stylesheet"===projectFile.type)continue;if("ThemedValues"!==projectFile.type){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ThemeManager] Type value of entry invalid in tchmiconfig.json (has to be ThemedValues or Stylesheet).",projectFile);continue}if(!projectFile.name){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ThemeManager] Entry missing name property in tchmiconfig.json.",projectFile);continue}if(foundProjectThemedValue){TcHmi.Engineering.ErrorPane.add("ThemeManager_multipleThemes","Only one ThemedValues entry per theme ("+this.__activeTheme+") allowed in tchmiconfig.json. Only "+foundProjectThemedValue+" will be used.",TcHmi.Engineering.ErrorPane.MessageType.Error);break}foundProjectThemedValue=projectFile.name;let currentProjTheme=this.__project_themeFiles.get(this.__activeTheme);null!==currentProjTheme&&(void 0===currentProjTheme?(this.__project_themeFiles.set(this.__activeTheme,null),((themeName,fileName)=>{let xhr=new XMLHttpRequest;xhr.addEventListener("load",(evt=>{if(200!==xhr.status)this.__project_themeFiles.delete(themeName),TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.System.ThemeManager] Loading "+fileName+" failed: "+xhr.statusText);else{const descr=TcHmi.ValueConverter.toObject(xhr.responseText,null);if(null!==descr){if(descr.controlTypeValues){let temp={};for(let key in descr.controlTypeValues){let newControlType=TcHmi.System.mapControlNamesFromPackageManifestApi0ToApi1.get(key);newControlType&&(temp[newControlType]=descr.controlTypeValues[key])}for(let key in temp)descr.controlTypeValues[key]=temp[key]}this.__project_themeFiles.set(themeName,descr),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] Fetched and parsed "+fileName)}else this.__project_themeFiles.delete(themeName),TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.System.ThemeManager] Failed to parse "+fileName+". Details: "+xhr.responseText)}asyncLoadingHandler(evt)}));const errorHandler=evt=>{this.__project_themeFiles.delete(themeName),0===xhr.status||TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.System.ThemeManager] Failed to load "+fileName),asyncLoadingHandler(evt)};xhr.addEventListener("error",errorHandler),xhr.addEventListener("abort",errorHandler),xhr.addEventListener("timeout",errorHandler),xhr.open("GET",tchmi_path(fileName)),xhr.send(),this.__asyncLoadCount++,TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] Fetching "+fileName+" async.")})(this.__activeTheme,projectFile.name)):jsonValueChanged=!0)}let themeAndBase=[this.__activeTheme];"Base"!==this.__activeTheme&&themeAndBase.push("Base"),this.__registered_themedValueFiles_fromControl.forEach(((controlTypeMap,controlThemedValueThemeName)=>{themeAndBase.includes(controlThemedValueThemeName)&&controlTypeMap.forEach(((registeredList,ctrlType)=>{let module=TcHmi.System.Data.Modules.controls.map.get(ctrlType);if(!module)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ThemeManager] Missing package control module for type: "+ctrlType));if(module&&module.error!==TcHmi.Errors.NONE)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ThemeManager] Can't load package control module for type: \""+ctrlType+'". Error: '+TcHmi.Log.buildMessage(module.errorDetails)));let foundControlThemedValue=!1;for(let controlIterator=0;controlIterator<registeredList.length;controlIterator++){let registered=registeredList[controlIterator],currentControlThemeFiles=this.__control_themeFiles.get(controlThemedValueThemeName);if(currentControlThemeFiles||(currentControlThemeFiles=new Map,this.__control_themeFiles.set(controlThemedValueThemeName,currentControlThemeFiles)),foundControlThemedValue){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ThemeManager] Only one ThemedValues entry per theme ("+controlThemedValueThemeName+") and control ("+ctrlType+") allowed in Description.json.",this.__registered_themedValueFiles_fromControl.get(controlThemedValueThemeName).get(ctrlType));break}foundControlThemedValue=!0;let currentControlThemeFile=currentControlThemeFiles.get(ctrlType);null!==currentControlThemeFile&&(void 0===currentControlThemeFile?(currentControlThemeFiles.set(ctrlType,null),((themeName,ctrlType,fileName)=>{let xhr=new XMLHttpRequest;xhr.addEventListener("load",(evt=>{if(200!==xhr.status)this.__control_themeFiles.get(themeName).delete(ctrlType),TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.System.ThemeManager] Loading "+fileName+" failed: "+xhr.statusText);else{const descr=TcHmi.ValueConverter.toObject(xhr.responseText);if(null!==descr){if(descr.controlTypeValues){let temp={};for(let key in descr.controlTypeValues){let newControlType=TcHmi.System.mapControlNamesFromPackageManifestApi0ToApi1.get(key);newControlType&&(temp[newControlType]=descr.controlTypeValues[key])}for(let key in temp)descr.controlTypeValues[key]=temp[key]}this.__control_themeFiles.get(themeName).set(ctrlType,descr),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] Fetched and parsed "+fileName)}else this.__control_themeFiles.get(themeName).delete(ctrlType),TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.System.ThemeManager] Failed to parse "+fileName+". Details: "+xhr.responseText)}asyncLoadingHandler(evt)}));const errorHandler=evt=>{this.__control_themeFiles.get(themeName).delete(ctrlType),0===xhr.status||TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.System.ThemeManager] Failed to load "+fileName),asyncLoadingHandler(evt)};xhr.addEventListener("error",errorHandler),xhr.addEventListener("abort",errorHandler),xhr.addEventListener("timeout",errorHandler);let module=TcHmi.System.Data.Modules.controls.map.get(ctrlType);module?module&&module.error!==TcHmi.Errors.NONE?TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ThemeManager] Can't load package control module for type: \""+ctrlType+'". Error: '+TcHmi.Log.buildMessage(module.errorDetails)):module.package&&void 0!==module.package.basePath&&module.manifestData&&void 0!==module.manifestData.basePath&&fileName&&(xhr.open("GET",tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+fileName)),xhr.send(),this.__asyncLoadCount++,TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] Fetching "+fileName+" async.")):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ThemeManager] Missing package control module for type: "+ctrlType)})(controlThemedValueThemeName,ctrlType,registered.name)):jsonValueChanged=!0)}}))}));let allCssStyles={package:[],projectGlobal:[],projectTheme:[]};if(TcHmi.System.config.packages.length>0){let processedPackageNames=new Set,sortedQueue=new Set,packagesQueue=new Set,sortDependency=packageInfo=>{let packageObj=TcHmi.System.Data.packages.get(packageInfo.name);if(packageObj){let preconditionFullfilled=!0;for(let i=0;i<packageObj.manifest.modules.length;i++){let moduleData=packageObj.manifest.modules[i];if("Package"===moduleData.type)if(TcHmi.System.Data.packages.has(moduleData.nugetId)){if(!processedPackageNames.has(moduleData.nugetId)){preconditionFullfilled=!1;break}}else;}return preconditionFullfilled?(sortedQueue.has(packageObj)||(sortedQueue.add(packageObj),processedPackageNames.add(packageInfo.name)),void packagesQueue.delete(packageObj)):void packagesQueue.add(packageObj)}};TcHmi.System.config.packages.forEach(sortDependency);let maxSortCount=TcHmi.System.config.packages.length**2;for(;packagesQueue.size;){if(maxSortCount<0){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ThemeManager] Recursion or unsatisfied dependency found in referenced Packages from Properties/tchmiconfig.json");break}packagesQueue.forEach(sortDependency),maxSortCount--}let packageParser=packageInfo=>{let packageObj=TcHmi.System.Data.packages.get(packageInfo.name);if(packageObj){let themeToLoadForPackage="Base";packageObj.manifest.modules.some((module=>"Resource"===module.type&&module.theme===this.__activeTheme))&&(themeToLoadForPackage=this.__activeTheme);for(const moduleData of packageObj.manifest.modules)switch(moduleData.type){case"Package":break;case"Resource":moduleData.path?.endsWith(".css")&&(moduleData.theme?themeToLoadForPackage!==moduleData.theme||activeThemePjctCfg?.replacesThemeForPackageComponents?.includes(packageInfo.name+(moduleData.component?"/"+moduleData.component:""))||allCssStyles.package.push({theme:moduleData.theme,url:tchmi_path(packageInfo.basePath+"/"+moduleData.path)}):allCssStyles.package.push({theme:null,url:tchmi_path(packageInfo.basePath+"/"+moduleData.path)}));break;case"Control":if(options?.ignorePackageModules)break;const cleanPath=tchmi_path(packageInfo.basePath+"/"+moduleData.basePath+"/"+moduleData.descriptionFile);let module=TcHmi.System.Data.Modules.controls.urlMap.get(cleanPath);if(!module?.descriptionExpanded){module?.error!==TcHmi.Errors.E_CONTROL_INVALID_CONFIGURATION&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ThemeManager] Internal Error: Did not find entry "+cleanPath+" in url cache.");break}if(module.descriptionExpanded.dependencyFiles&&module.package&&module?.manifestData?.basePath)for(let dependencyFile of module.descriptionExpanded.dependencyFiles)"Stylesheet"===dependencyFile.type&&allCssStyles.package.push({theme:null,url:tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+dependencyFile.name)});let controlType=TcHmi.System.resolveQualifiedName(module.descriptionExpanded.name,module.descriptionExpanded.namespace);if(activeThemePjctCfg?.replacesThemeForControls?.includes(controlType))break;const legacyControlType=TcHmi.System.mapControlNamesFromPackageManifestApi1ToApi0.get(controlType);if(legacyControlType&&activeThemePjctCfg?.replacesThemeForControls?.includes(legacyControlType))break;let controlCssList=[],controlCssThemeName=this.__activeTheme,currentThemeEntry=this.__registered_styleCheets_fromControl.get(this.__activeTheme),currentCtrlTypeEntry=currentThemeEntry?.get(controlType);if(currentCtrlTypeEntry)controlCssList=currentCtrlTypeEntry;else{if(!this.__registered_styleCheets_fromControl.get("Base")?.has(controlType))break;controlCssList=this.__registered_styleCheets_fromControl.get("Base").get(controlType),controlCssThemeName="Base"}if(module.package&&module.manifestData)for(let controlThemeEntry of controlCssList)allCssStyles.package.push({theme:controlCssThemeName,url:tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+controlThemeEntry.name)})}}};sortedQueue.forEach(packageParser)}if(TcHmi.System.config.dependencyFiles)for(let unthemeProjectIterator=0;unthemeProjectIterator<TcHmi.System.config.dependencyFiles.length;unthemeProjectIterator++){let unthemeProjectFile=TcHmi.System.config.dependencyFiles[unthemeProjectIterator];"Stylesheet"===unthemeProjectFile.type&&allCssStyles.projectGlobal.push({theme:null,url:unthemeProjectFile.name})}for(const projectFile of activeThemePjctCfg?.resources??[])"Stylesheet"===projectFile.type&&(projectFile.name?allCssStyles.projectTheme.push({theme:this.__activeTheme,url:projectFile.name}):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ThemeManager] Entry missing name property in tchmiconfig.json.",projectFile));let linkInserter=(cssStyles,origin)=>{cssStyles.length||cssStyles.push({url:"",theme:null});for(let currentIndex=0;currentIndex<cssStyles.length;currentIndex++){let currentStyle=cssStyles[currentIndex],cleanPath=tchmi_path(currentStyle.url),currentOriginStyles=document.head.querySelectorAll("link[data-tchmi-file-origin="+origin+"]");const currentLinkElem=currentOriginStyles[currentIndex],makeNewElem=()=>{const newLinkElem=document.createElement("link");return newLinkElem.rel="stylesheet",newLinkElem.type="text/css",newLinkElem.href=cleanPath,cleanPath?(newLinkElem.addEventListener("load",asyncLoadingHandler,{once:!0}),newLinkElem.addEventListener("error",asyncLoadingHandler),this.__asyncLoadCount++):newLinkElem.dataset.tchmiReason="internal marker",newLinkElem.dataset.tchmiFileOrigin=origin,currentStyle.theme&&(newLinkElem.dataset.tchmiFromTheme=currentStyle.theme),newLinkElem};if(currentLinkElem){if(currentLinkElem.getAttribute("href")!==cleanPath||(currentLinkElem.dataset.tchmiFromTheme??null)!==currentStyle.theme){const newLinkElem=makeNewElem();currentLinkElem.replaceWith(newLinkElem),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] Replaced CSS style node for "+currentStyle.url+".")}}else{const newLinkElem=makeNewElem();let lastElementSameOrigin=currentOriginStyles.length?currentOriginStyles[currentOriginStyles.length-1]:void 0;lastElementSameOrigin?(lastElementSameOrigin.after(newLinkElem),newLinkElem.after(document.createTextNode("\n"))):(document.head.appendChild(newLinkElem),document.head.appendChild(document.createTextNode("\n"))),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] Added CSS style node for "+currentStyle.url+".")}}let currentOriginStyles=document.head.querySelectorAll("link[data-tchmi-file-origin="+origin+"]");for(let removeCounter=cssStyles.length;removeCounter<currentOriginStyles.length;removeCounter++)currentOriginStyles[removeCounter].remove()};if(linkInserter(allCssStyles.package,"package"),linkInserter(allCssStyles.projectGlobal,"projectGlobal"),linkInserter(allCssStyles.projectTheme,"projectTheme"),TCHMI_DESIGNER){document.documentElement.setAttribute("tchmi-theme-name",this.__activeTheme);let linkElem=document.querySelector('link[href*="StyleEngineering.css"]');linkElem||(linkElem=document.createElement("link"),linkElem.rel="stylesheet",linkElem.type="text/css",linkElem.href=tchmi_path(TcHmi.System.config.basePath+"/StyleEngineering.css")),document.head.appendChild(linkElem)}this.__asyncLoadCount<=0&&(jsonValueChanged&&this.__triggerControlsWithImplicitValues(null),this.processThemedResources(),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] System has loaded and parsed all sync files. Triggering a onThemeDataChanged."),TcHmi.EventProvider.raise("onThemeDataChanged"),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE}))}__triggerControlsWithImplicitValues(controlsToTrigger){let ThemeManager_triggerSingleControl=(attributeList,control)=>{for(const propertyName of attributeList){this.__settingThemeValueInProgress=propertyName;let error=TcHmi.System.Services.controlManager.setControlProperty(control,propertyName,null);this.__settingThemeValueInProgress=null,error&&error.code!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ThemeManager] "+TcHmi.Log.buildMessage(error))}};if(null===controlsToTrigger)for(const[control,attributeList]of this.__watchAttributeDefaults.entries())ThemeManager_triggerSingleControl(attributeList,control);else for(let controlToTrigger of controlsToTrigger){const attributeList=this.__watchAttributeDefaults.get(controlToTrigger);attributeList&&ThemeManager_triggerSingleControl(attributeList,controlToTrigger)}}getDefaultPropertyValue(control,propertyName){const activeThemePjctCfg=TcHmi.System.config?.themes[this.__activeTheme];let res=null,currentProjectThemeFiles=this.__project_themeFiles.get(this.__activeTheme);const controlClasses=control.getClassNames();if(controlClasses&&controlClasses.length>0){for(let controlClass of controlClasses)currentProjectThemeFiles&&currentProjectThemeFiles.controlClassValues&&currentProjectThemeFiles.controlClassValues[controlClass]&&currentProjectThemeFiles.controlClassValues[controlClass].attributes&&void 0!==currentProjectThemeFiles.controlClassValues[controlClass].attributes[propertyName]&&null!==currentProjectThemeFiles.controlClassValues[controlClass].attributes[propertyName]&&(res=currentProjectThemeFiles.controlClassValues[controlClass].attributes[propertyName]);if(null!==res)return{error:TcHmi.Errors.NONE,origin:"project",originThemeName:this.__activeTheme,value:tchmi_clone_object(res)}}const controlType=control.getType(),projectBasedThemeValue=currentProjectThemeFiles?.controlTypeValues?.[controlType]?.attributes?.[propertyName];if(null!=projectBasedThemeValue)return res=projectBasedThemeValue,{error:TcHmi.Errors.NONE,origin:"project",originThemeName:this.__activeTheme,value:tchmi_clone_object(res)};const legacyControlType=TcHmi.System.mapControlNamesFromPackageManifestApi1ToApi0.get(controlType);if(activeThemePjctCfg?.replacesThemeForControls?.includes(controlType));else if(legacyControlType&&activeThemePjctCfg?.replacesThemeForControls?.includes(legacyControlType));else{let themeAndBase=[this.__activeTheme];"Base"!==this.__activeTheme&&themeAndBase.push("Base");for(let themeName of themeAndBase){let currentControlThemeFiles=this.__control_themeFiles.get(themeName),currentControlThemeFile=currentControlThemeFiles?currentControlThemeFiles.get(controlType):void 0;if(currentControlThemeFile&&currentControlThemeFile.controlTypeValues&&currentControlThemeFile.controlTypeValues[controlType]&&currentControlThemeFile.controlTypeValues[controlType].attributes&&void 0!==currentControlThemeFile.controlTypeValues[controlType].attributes[propertyName]&&null!==currentControlThemeFile.controlTypeValues[controlType].attributes[propertyName])return res=currentControlThemeFile.controlTypeValues[controlType].attributes[propertyName],{error:TcHmi.Errors.NONE,origin:"control",originThemeName:themeName,value:tchmi_clone_object(res)}}}let ctrlDescrAttr=TcHmi.System.Services.controlManager?.getDescriptionAttributeByPropertyName(controlType,propertyName);if(ctrlDescrAttr){if(void 0!==ctrlDescrAttr.defaultValueInternal)return res=ctrlDescrAttr.defaultValueInternal,{error:TcHmi.Errors.NONE,origin:"control",originThemeName:this.__activeTheme,value:tchmi_clone_object(res)};{let schema=TcHmi.Type.getSchema(ctrlDescrAttr.type);if(schema)return res=TcHmi.Type.Schema.resolveDefault(schema),{error:TcHmi.Errors.NONE,origin:"control",originThemeName:this.__activeTheme,value:tchmi_clone_object(res)}}}if("TcHmi.Controls.System.TcHmiUserControlHost"===controlType){const targetUserControl=control.getTargetUserControl();if(targetUserControl){let ucConfigUrl=tchmi_path(targetUserControl.replace(".usercontrol",".usercontrol.json")),UCdescrAttr=System.Services.controlManager?.getUserControlConfigAttributeByPropertyName(ucConfigUrl,propertyName);if(UCdescrAttr&&void 0!==UCdescrAttr.defaultValueInternal)return res=UCdescrAttr.defaultValueInternal,{error:TcHmi.Errors.NONE,origin:"control",originThemeName:this.__activeTheme,value:tchmi_clone_object(res)};if(UCdescrAttr){let type=UCdescrAttr.type;if(type){let schema=TcHmi.Type.getSchema(type);if(schema)return res=TcHmi.Type.Schema.resolveDefault(schema),{error:TcHmi.Errors.NONE,origin:"control",originThemeName:this.__activeTheme,value:tchmi_clone_object(res)}}}}}return{error:TcHmi.Errors.NONE,origin:"control",originThemeName:this.__activeTheme,value:null}}getThemeResource(control,resourceName){let res=null,currentProjectThemeFiles=this.__project_themeFiles.get(this.__activeTheme);const controlClasses=control.getClassNames();if(controlClasses&&controlClasses.length>0){for(let controlClass of controlClasses)currentProjectThemeFiles&&currentProjectThemeFiles.controlClassValues&&currentProjectThemeFiles.controlClassValues[controlClass]&&void 0!==currentProjectThemeFiles.controlClassValues[controlClass].themedResources[resourceName]&&null!==currentProjectThemeFiles.controlClassValues[controlClass].themedResources[resourceName]&&(res=currentProjectThemeFiles.controlClassValues[controlClass].themedResources[resourceName]);if(null!==res)return{error:TcHmi.Errors.NONE,origin:"project",originThemeName:this.__activeTheme,value:tchmi_clone_object(res)}}const controlType=control.getType();if(currentProjectThemeFiles&&currentProjectThemeFiles.controlTypeValues&&currentProjectThemeFiles.controlTypeValues[controlType]&&currentProjectThemeFiles.controlTypeValues[controlType].themedResources&&void 0!==currentProjectThemeFiles.controlTypeValues[controlType].themedResources[resourceName]&&null!==currentProjectThemeFiles.controlTypeValues[controlType].themedResources[resourceName])return res=currentProjectThemeFiles.controlTypeValues[controlType].themedResources[resourceName],{error:TcHmi.Errors.NONE,origin:"project",originThemeName:this.__activeTheme,value:tchmi_clone_object(res)};let themeAndBase=[this.__activeTheme];"Base"!==this.__activeTheme&&themeAndBase.push("Base");for(let themeName of themeAndBase){let currentControlThemeFiles=this.__control_themeFiles.get(themeName),currentControlThemeFile=currentControlThemeFiles?currentControlThemeFiles.get(controlType):void 0;if(currentControlThemeFile&&currentControlThemeFile.controlTypeValues&&currentControlThemeFile.controlTypeValues[controlType]&&currentControlThemeFile.controlTypeValues[controlType].themedResources&&void 0!==currentControlThemeFile.controlTypeValues[controlType].themedResources[resourceName]&&null!==currentControlThemeFile.controlTypeValues[controlType].themedResources[resourceName])return res=currentControlThemeFile.controlTypeValues[controlType].themedResources[resourceName],{error:TcHmi.Errors.NONE,origin:"control",originThemeName:themeName,value:tchmi_clone_object(res)}}return{error:TcHmi.Errors.ERROR,origin:"control",originThemeName:this.__activeTheme,value:null}}watchAttributeDefaults(control,propertyName){let attributeList=this.__watchAttributeDefaults.get(control);attributeList||(attributeList=new Set,this.__watchAttributeDefaults.set(control,attributeList)),attributeList.add(propertyName)}startAttributeSetterWatcher(control){this.__watchAttributeDefaults.has(control)&&(this.__destroyOnPropertyChanged.has(control)||this.__destroyOnPropertyChanged.set(control,TcHmi.EventProvider.register(control.getId()+".onPropertyChanged",this.__handleOnPropertyChanged(control))))}unwatchAttributeDefaults(control,propertyName){const attributeList=this.__watchAttributeDefaults.get(control);if(attributeList&&attributeList.delete(propertyName)&&0===attributeList.size){this.__watchAttributeDefaults.delete(control);const destroy=this.__destroyOnPropertyChanged.get(control);destroy&&(destroy(),this.__destroyOnPropertyChanged.delete(control))}}processThemedResources(){let registeredControlThemedResources=new Map,registeredApplicationThemedResources=new Map,currentControlThemeFiles=this.__control_themeFiles.get(this.__activeTheme);currentControlThemeFiles&&currentControlThemeFiles.forEach(((controlThemeFile,ctrlType)=>{if(controlThemeFile?.controlTypeValues){let controlResources=controlThemeFile?.controlTypeValues[ctrlType];if(controlResources?.themedResources){let nameToValueMap=registeredControlThemedResources.get(ctrlType);nameToValueMap||(nameToValueMap=new Map,registeredControlThemedResources.set(ctrlType,nameToValueMap));for(let themedResourceName in controlResources.themedResources){nameToValueMap.get(themedResourceName)||nameToValueMap.set(themedResourceName,controlResources.themedResources[themedResourceName])}}}}));let currentProjectThemeFile=this.__project_themeFiles.get(this.__activeTheme);if(currentProjectThemeFile&&currentProjectThemeFile.controlTypeValues)for(let ctrlType in currentProjectThemeFile.controlTypeValues){let controlResources=currentProjectThemeFile?.controlTypeValues[ctrlType];if(controlResources?.themedResources){let nameToValueMap=registeredControlThemedResources.get(ctrlType);nameToValueMap||(nameToValueMap=new Map,registeredControlThemedResources.set(ctrlType,nameToValueMap));for(let themedResourceName in controlResources.themedResources)nameToValueMap.set(themedResourceName,controlResources.themedResources[themedResourceName])}}if(TcHmi.System.config.symbols.themedResources){const missingNames=[];for(let[resourceName,configResource]of Object.entries(TcHmi.System.config.symbols.themedResources)){let value=configResource.values[this.__activeTheme];void 0===value&&missingNames.push(resourceName),registeredApplicationThemedResources.has(resourceName)||registeredApplicationThemedResources.set(resourceName,value)}missingNames.length&&TcHmi.Log.warnEx("[Source=Framework, Module=TcHmi.System.ThemeManager] Themed Resources with names",missingNames,"have no values defined for theme "+this.__activeTheme+". Symbols with one of these names will not get a valid value. Please add values via HMI config window.")}for(const ctrl of TcHmi.System.Data.Modules.controls.array)if(ctrl?.description?.themedResources?.length){let ctrlType=TcHmi.System.resolveQualifiedName(ctrl.description.name,ctrl.description.namespace);for(let themedResource of ctrl.description.themedResources)if(!registeredControlThemedResources.get(ctrlType)?.has(themedResource.name)&&!TcHmi.System.config.themes[this.__activeTheme]?.replacesThemeForControls?.includes(ctrlType)){let resourceValueBase=this.__control_themeFiles.get("Base")?.get(ctrlType)?.controlTypeValues?.[ctrlType]?.themedResources?.[themedResource.name],nameToValueMap=registeredControlThemedResources.get(ctrlType);nameToValueMap||(nameToValueMap=new Map,registeredControlThemedResources.set(ctrlType,nameToValueMap)),nameToValueMap.set(themedResource.name,resourceValueBase)}}let entriesToProcess=[];registeredControlThemedResources.forEach(((themedResourceMap,namespace)=>{let namespaceResources=this.__themedResourcesControl.get(namespace);namespaceResources||(namespaceResources=new Map,this.__themedResourcesControl.set(namespace,namespaceResources)),themedResourceMap.forEach(((value,resourceName)=>{let themedResource=namespaceResources.get(resourceName);themedResource||(themedResource={value:void 0,callbacks:[]},namespaceResources.set(resourceName,themedResource)),tchmi_equal(themedResource?.value,value)||(themedResource.value=value,entriesToProcess.push(themedResource))}))})),this.__themedResourcesControl.forEach(((controlResources,ctrlType)=>{controlResources.forEach(((themedResource,resourceName)=>{registeredControlThemedResources.get(ctrlType)?.has(resourceName)||void 0===themedResource.value||(themedResource.value=void 0,entriesToProcess.push(themedResource))}))}));let resourcesToRemove=Array.from(this.__themedResourcesApplication.keys());registeredApplicationThemedResources.forEach(((value,resourceName)=>{let themedResource=this.__themedResourcesApplication.get(resourceName);if(themedResource?resourcesToRemove=resourcesToRemove.filter((r=>r!==resourceName)):(themedResource={value:void 0,callbacks:[]},this.__themedResourcesApplication.set(resourceName,themedResource)),!tchmi_equal(themedResource?.value,value)){let dirtyPathsNew=null;themedResource.value&&value&&"object"==typeof themedResource.value&&"object"==typeof value&&(dirtyPathsNew=tchmi_compare_object(themedResource.value,value)),themedResource.value=value,dirtyPathsNew&&dirtyPathsNew.length>0&&(themedResource.dirtyPaths=dirtyPathsNew),entriesToProcess.push(themedResource)}}));for(let resourceToRemove of resourcesToRemove){let themedResource=this.__themedResourcesApplication.get(resourceToRemove);if(themedResource&&(themedResource.value=null,themedResource.callbacks)){let callbackList=[];for(let j=0,jj=themedResource.callbacks.length;j<jj;j++)callbackList[j]=themedResource.callbacks[j];for(let innerCallback of callbackList){if(!themedResource.callbacks.includes(innerCallback))continue;let res={error:TcHmi.Errors.NONE,value:themedResource.value,destroy:innerCallback.destroy};TcHmi.Callback.callSafeEx(innerCallback.callback,this,res)}}}for(let i=0,ii=entriesToProcess.length;i<ii;i++){let entry=entriesToProcess[i],callbackList=[];for(let j=0,jj=entry.callbacks.length;j<jj;j++)callbackList[j]=entry.callbacks[j];for(let innerCallback of callbackList){if(!entry.callbacks.includes(innerCallback))continue;let res={error:TcHmi.Errors.NONE,value:entry.value,destroy:innerCallback.destroy};entry.dirtyPaths&&entry.dirtyPaths.length>0&&(res.dirtyPaths=entry.dirtyPaths),TcHmi.Callback.callSafe(innerCallback.callback,this,res)}}}getThemedResource(name,namespaceTokens){if(0===namespaceTokens.length||1===namespaceTokens.length&&"Application"===namespaceTokens[0]){let themedResource=this.__themedResourcesApplication.get(name);if(themedResource)return themedResource.value}else if(2===namespaceTokens.length&&"Controls"===namespaceTokens[0]){let themedResource=this.__themedResourcesControl.get(namespaceTokens[1])?.get(name);if(themedResource)return themedResource.value}}getThemedResourceType(name,namespaceTokens,callback){let type,themedResource;if(0===namespaceTokens.length||1===namespaceTokens.length&&"Application"===namespaceTokens[0])type=TcHmi.System.config.symbols.themedResources?.[name]?.type,themedResource=this.__themedResourcesApplication.get(name);else if(2===namespaceTokens.length&&"Control"===namespaceTokens[0]){let module=TcHmi.System.Data.Modules.controls.map.get(namespaceTokens[1]);type=module?.description?.themedResources.find((themedResource=>themedResource.name===name))?.type,themedResource=this.__themedResourcesControl.get(namespaceTokens[1])?.get(name)}if(!type||!themedResource){let resourceName=name;return 2===namespaceTokens.length&&"Control"===namespaceTokens[0]&&(resourceName="Control::"+namespaceTokens[1]+"::"+name),void TcHmi.Callback.callSafe(callback,this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:"Themed resource with name="+resourceName+" does not exist.",domain:"TcHmi.System.ThemeManager"}})}TcHmi.Callback.callSafe(callback,this,{error:TcHmi.Errors.NONE,type:type})}watchThemedResource(name,namespaceTokens,callback){let themedResource;if(0===namespaceTokens.length||1===namespaceTokens.length&&"Application"===namespaceTokens[0]?themedResource=this.__themedResourcesApplication.get(name):2===namespaceTokens.length&&"Control"===namespaceTokens[0]&&(themedResource=this.__themedResourcesControl.get(namespaceTokens[1])?.get(name)),!themedResource){let resourceName=name;return 2===namespaceTokens.length&&"Control"===namespaceTokens[0]&&(resourceName="Control::"+namespaceTokens[1]+"::"+name),TcHmi.Callback.callSafe(callback,this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:"Themed resource: '"+resourceName+"' does not exist for theme: '"+this.__activeTheme+"'.",domain:"TcHmi.System.ThemeManager"}}),function(){}}let destroy=function(){if(!themedResource)return;let index=themedResource.callbacks.indexOf(co);-1!==index&&(themedResource.callbacks.splice(index,1),co.callback=null)},co={callback:callback,destroy:destroy};return themedResource.callbacks.push(co),TcHmi.Callback.callSafe(callback,this,{error:TcHmi.Errors.NONE,value:themedResource.value,destroy:destroy}),destroy}__handleOnPropertyChanged(control){return(e,data)=>{this.__settingThemeValueInProgress!==data.propertyName&&this.unwatchAttributeDefaults(control,data.propertyName)}}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.TopMostLayer=class{constructor(){this.__optionsList=new Map,this.__rootContainerDivs=[],this.__detachEventDestroy=null,this.__mousedownHandler=evt=>{const targetElem=evt.target;if(!targetElem?.classList.contains("tchmi-system-topmostlayer-container")&&!targetElem?.classList.contains("tchmi-system-topmostlayer-root-container"))return;this.__masterDiv.addEventListener("mouseup",this.__abortHandler,{capture:!1,once:!0})},this.__abortHandler=evt=>{const targetElem=evt.target;if(!targetElem?.classList.contains("tchmi-system-topmostlayer-container")&&!targetElem?.classList.contains("tchmi-system-topmostlayer-root-container"))return;const reversedCurrentItems=Array.from(this.__masterDiv.children).reverse();for(const rootContainer of reversedCurrentItems){const containerElem=rootContainer.lastElementChild;let nativeElem=containerElem?.lastElementChild;if(nativeElem){const internalOption=this.__optionsList.get(nativeElem);if(void 0===internalOption?.modal||!1!==internalOption?.modal){internalOption&&!1!==internalOption.closeOnBackground&&this.remove(internalOption.origin,internalOption.originalElement,!0);break}}}},this.__checkDetachedControls=(evt,control)=>{for(const[nativeElem,internalOptions]of this.__optionsList)internalOptions.origin===control&&this.remove(control,internalOptions.originalElement,!0)},this.__updateAllChildPosition=evtOrMutations=>{const removedNodesOptions=[];if(evtOrMutations&&Array.isArray(evtOrMutations)){let updateNeeded=!1,styleOfChangedNodes=new Map;for(const mutation of evtOrMutations){let node=mutation.target;if(node instanceof HTMLElement)if("attributes"===mutation.type)"style"===mutation.attributeName?styleOfChangedNodes.has(node)||styleOfChangedNodes.set(node,mutation.oldValue):updateNeeded=!0;else if("childList"===mutation.type){updateNeeded=!0;for(const removedNode of mutation.removedNodes){if(this.__masterDiv.contains(removedNode))continue;const internalOption=this.__optionsList.get(removedNode);if(internalOption&&removedNodesOptions.push(internalOption),removedNode.removeEventListener("load",this.__updateAllChildPosition),removedNode instanceof Element){removedNode.hasAttribute("data-tchmi-type")&&removedNode.classList.remove("tchmi-in-topmostlayer");const subcontrolElements=removedNode.querySelectorAll("div[data-tchmi-type]");for(const element of subcontrolElements)element.classList.remove("tchmi-in-topmostlayer")}}for(const addedNode of mutation.addedNodes)if(this.__masterDiv.contains(addedNode)&&addedNode instanceof Element){addedNode.hasAttribute("data-tchmi-type")&&addedNode.classList.add("tchmi-in-topmostlayer");const subcontrolElements=addedNode.querySelectorAll("div[data-tchmi-type]");for(const element of subcontrolElements){element.classList.add("tchmi-in-topmostlayer");const control=TcHmi.Controls.get(element.id);control&&!control.getParent()&&(control.__processIsEnabled(),control.__processAccessConfig())}}}}if(!1===updateNeeded)for(const[changedNode,initialStyle]of styleOfChangedNodes)if(initialStyle!==changedNode.getAttribute("style")){updateNeeded=!0;break}if(!updateNeeded&&!removedNodesOptions.length)return}let resizeCallbackList=[];const childNodes=this.__masterDiv.children;for(const rootContainerElem of childNodes){if(!(rootContainerElem instanceof HTMLElement))continue;const containerElem=rootContainerElem.firstElementChild,nativeElem=containerElem?.firstElementChild;if(!containerElem||!nativeElem)continue;const internalOption=this.__optionsList.get(nativeElem);if(!internalOption)continue;const centeringRequested=internalOption.centerVertical||internalOption.centerHorizontal;if(centeringRequested||internalOption.resizeCb){let resizedByTML=!1;if(centeringRequested&&nativeElem){const boundingRect=nativeElem.getBoundingClientRect();if(!0===internalOption.centerVertical){const newTop=Math.round(((window.visualViewport?.height??window.innerHeight)-boundingRect.height)/2);nativeElem.style.top!==newTop+"px"&&(nativeElem.style.top=newTop+"px",resizedByTML=!0)}if(!0===internalOption.centerHorizontal){const newLeft=Math.round(((window.visualViewport?.width??window.innerWidth)-boundingRect.width)/2);nativeElem.style.left!==newLeft+"px"&&(nativeElem.style.left=newLeft+"px",resizedByTML=!0)}}!1!==centeringRequested&&!0!==resizedByTML||!internalOption.resizeCb||resizeCallbackList.push({callback:internalOption.resizeCb,thisArg:internalOption.origin,args:{error:TcHmi.Errors.NONE,element:internalOption.originalElement,parentPixelSize:{width:window.visualViewport?.width??window.innerWidth,height:window.visualViewport?.height??window.innerHeight}}})}if(window.visualViewport&&centeringRequested)containerElem.style.top=window.visualViewport.offsetTop+"px",containerElem.style.left=window.visualViewport.offsetLeft+"px",containerElem.style.width=window.visualViewport.width+"px",containerElem.style.height=window.visualViewport.height+"px";else{const rootContainerElemBoundingRect=rootContainerElem.getBoundingClientRect();containerElem.style.top=-rootContainerElemBoundingRect.top+"px",containerElem.style.left=-rootContainerElemBoundingRect.left+"px",containerElem.style.width=window.innerWidth+"px",containerElem.style.height=window.innerHeight+"px"}}for(const resizeCallback of resizeCallbackList)TcHmi.Callback.callSafeEx(resizeCallback.callback,resizeCallback.thisArg,resizeCallback.args);for(const internalOption of removedNodesOptions)this.remove(internalOption.origin,internalOption.originalElement,!0)},this.__dimLastContainer=()=>{let lastDimChild;for(const rootContainerElem of this.__rootContainerDivs){if(!(rootContainerElem.firstElementChild.firstElementChild instanceof HTMLElement))continue;rootContainerElem.classList.remove("tchmi-topmostlayer-non-modal");let internalOption=this.__optionsList.get(rootContainerElem.firstElementChild.firstElementChild);internalOption&&(!1!==internalOption.dimBackground&&(lastDimChild=rootContainerElem),rootContainerElem.classList.remove("tchmi-topmostlayer-background-dim"),!1===internalOption.modal&&rootContainerElem.classList.add("tchmi-topmostlayer-non-modal"))}lastDimChild&&lastDimChild.classList.add("tchmi-topmostlayer-background-dim")},this.__masterDiv=document.createElement("div"),this.__masterDiv.id="tchmi-system-topmostlayer-master",this.__masterDiv.style.zIndex="5000",this.__masterDiv.style.position="absolute",this.__masterDiv.addEventListener("mousedown",this.__mousedownHandler,!1),this.__mutationObserver=new MutationObserver(this.__updateAllChildPosition)}__buildJustAboveList(options,seenNodes){const list=[],nextLevel=[];for(const node of options.elementsAbove){if(seenNodes.has(node))continue;seenNodes.add(node);const aboveOptions=this.__optionsList.get(node);aboveOptions&&(list.push(aboveOptions.rootContainer),nextLevel.push(this.__buildJustAboveList(aboveOptions,seenNodes)))}return list.concat(nextLevel.flat())}add(origin,element,options){if(!element)return!1;const nativeElem=element instanceof HTMLElement?element:element[0];if(!(nativeElem instanceof HTMLElement))return!1;const optionsOld=this.__optionsList.get(nativeElem);if(optionsOld&&!options?.allowMultipleCall)return!1;let rootContainerElem;if(!(options={...optionsOld,...options}).justAbove&&origin instanceof TcHmi.Controls.System.baseTcHmiControl&&(options.justAbove={reference:origin.getElement()[0]}),optionsOld){if(rootContainerElem=nativeElem.parentElement?.parentElement,!rootContainerElem?.classList.contains("tchmi-system-topmostlayer-root-container"))throw new Error("Element is known in topmostlayer but wrong configured. Aborting.")}else{nativeElem.classList.add("tchmi-in-topmostlayer"),rootContainerElem=document.createElement("div"),rootContainerElem.classList.add("tchmi-system-topmostlayer-root-container"),rootContainerElem.style.position="fixed",rootContainerElem.style.width="100%",rootContainerElem.style.height="100%",rootContainerElem.style.top="0px",rootContainerElem.style.left="0px",rootContainerElem.style.overscrollBehavior="contain";const containerElem=document.createElement("div");containerElem.classList.add("tchmi-system-topmostlayer-container"),containerElem.style.position="absolute",window.visualViewport?(containerElem.style.top=window.visualViewport.offsetTop+"px",containerElem.style.left=window.visualViewport.offsetLeft+"px"):(containerElem.style.top="0px",containerElem.style.left="0px"),containerElem.style.bottom="0px",containerElem.style.right="0px",containerElem.style.overscrollBehavior="contain",containerElem.appendChild(nativeElem),rootContainerElem.appendChild(containerElem),this.__mutationObserver.observe(containerElem,{childList:!0,subtree:!0})}this.__rootContainerDivs.includes(rootContainerElem)&&this.__rootContainerDivs.splice(this.__rootContainerDivs.indexOf(rootContainerElem),1);let elementsAbove,justAboveRoot=null,reference=null,wantsToBeBottomMost=!1;if(options.justAbove)if(justAboveRoot=options.justAbove.reference.closest(".tchmi-system-topmostlayer-root-container"),justAboveRoot)this.__rootContainerDivs.splice(this.__rootContainerDivs.indexOf(justAboveRoot)+1,0,rootContainerElem),reference=justAboveRoot.querySelector(".tchmi-in-topmostlayer");else if(wantsToBeBottomMost=!0,options.justAbove.conflictResolution===TcHmi.TopMostLayer.ConflictResolution.Down)this.__rootContainerDivs.unshift(rootContainerElem);else{let index=0;for(const option of this.__optionsList.values())option.wantsToBeBottomMost&&index++;this.__rootContainerDivs.splice(index,0,rootContainerElem)}else this.__rootContainerDivs.push(rootContainerElem);if(optionsOld)elementsAbove=optionsOld.elementsAbove;else{elementsAbove=new Set;for(const[otherElement,otherOptions]of this.__optionsList)otherOptions.justAbove&&(otherOptions.justAboveReference?otherOptions.justAboveReference===nativeElem&&elementsAbove.add(otherElement):nativeElem.contains(otherOptions.justAbove.reference)&&(otherOptions.justAboveReference=nativeElem,elementsAbove.add(otherElement)))}const internalOption={...options,origin:origin,rootContainer:rootContainerElem,styleBackup:{left:nativeElem.style.left,top:nativeElem.style.top,position:nativeElem.style.position},elementsAbove:elementsAbove,wantsToBeBottomMost:wantsToBeBottomMost,originalElement:element};internalOption.justAboveReference&&internalOption.justAboveReference!==reference&&(this.__optionsList.get(internalOption.justAboveReference)?.elementsAbove?.delete(nativeElem),delete internalOption.justAboveReference),reference&&(internalOption.justAboveReference=reference,this.__optionsList.get(reference)?.elementsAbove?.add(nativeElem));const justAboveList=this.__buildJustAboveList(internalOption,new Set([nativeElem]));for(const element of justAboveList){const index=this.__rootContainerDivs.indexOf(element);-1!==index&&this.__rootContainerDivs.splice(index,1)}let index=this.__rootContainerDivs.indexOf(rootContainerElem)+1;this.__rootContainerDivs.splice(index,0,...justAboveList);for(const[index,div]of this.__rootContainerDivs.entries())div.style.zIndex=index.toString();if(rootContainerElem.parentElement!==this.__masterDiv&&this.__masterDiv.appendChild(rootContainerElem),internalOption.centerVertical||internalOption.centerHorizontal){nativeElem.style.position="absolute",this.__mutationObserver.observe(nativeElem,{attributes:!0,attributeOldValue:!0,childList:!0,subtree:!0});const childrenWithLoadEvent=nativeElem.querySelectorAll("iframe,img,picture,embed,input[type=image]");for(const child of childrenWithLoadEvent)child.addEventListener("load",this.__updateAllChildPosition)}if(this.__optionsList.set(nativeElem,internalOption),this.__dimLastContainer(),!this.__masterDiv.parentElement){const passiveEventOptions={passive:!0,capture:!0};window.visualViewport?(window.visualViewport.addEventListener("resize",this.__updateAllChildPosition,passiveEventOptions),window.visualViewport.addEventListener("scroll",this.__updateAllChildPosition,passiveEventOptions)):(window.addEventListener("resize",this.__updateAllChildPosition,passiveEventOptions),window.addEventListener("scroll",this.__updateAllChildPosition,passiveEventOptions)),this.__detachEventDestroy=TcHmi.EventProvider.register("System.onControlDetached",this.__checkDetachedControls),document.body.appendChild(this.__masterDiv)}const subcontrolElements=this.__masterDiv.querySelectorAll("div[data-tchmi-type]");for(const element of subcontrolElements){element.classList.add("tchmi-in-topmostlayer");let control=TcHmi.Controls.get(element.id);control&&!control.getParent()&&(control.__processIsEnabled(),control.__processAccessConfig())}return this.__updateAllChildPosition(),!0}remove(origin,element,cancel){if(!element)return element;const nativeElem=element instanceof HTMLElement?element:element[0];if(!nativeElem)return element;let internalOption=this.__optionsList.get(nativeElem);if(!internalOption)return element;nativeElem.classList.remove("tchmi-in-topmostlayer");let subcontrolElements=nativeElem.querySelectorAll("div[data-tchmi-type]");for(const element of subcontrolElements)element.classList.remove("tchmi-in-topmostlayer");this.__rootContainerDivs.includes(internalOption.rootContainer)&&this.__rootContainerDivs.splice(this.__rootContainerDivs.indexOf(internalOption.rootContainer),1),internalOption.justAboveReference&&this.__optionsList.get(internalOption.justAboveReference)?.elementsAbove?.delete(nativeElem);for(const elementAbove of internalOption.elementsAbove)delete this.__optionsList.get(elementAbove)?.justAboveReference;const justAboveList=this.__buildJustAboveList(internalOption,new Set([nativeElem]));for(const element of justAboveList){const index=this.__rootContainerDivs.indexOf(element);-1!==index&&this.__rootContainerDivs.splice(index,1)}this.__rootContainerDivs.splice(0,0,...justAboveList);for(const[index,div]of this.__rootContainerDivs.entries())div.style.zIndex=index.toString();if(internalOption.rootContainer?.remove(),nativeElem.remove(),!this.__masterDiv.firstElementChild){this.__masterDiv.remove();const passiveEventOptions={passive:!0,capture:!1};window.visualViewport?(window.visualViewport.removeEventListener("resize",this.__updateAllChildPosition,passiveEventOptions),window.visualViewport.removeEventListener("scroll",this.__updateAllChildPosition,passiveEventOptions)):(window.removeEventListener("resize",this.__updateAllChildPosition,passiveEventOptions),window.removeEventListener("scroll",this.__updateAllChildPosition,passiveEventOptions));const nocaptureOnce={capture:!1,once:!0};this.__masterDiv.removeEventListener("mouseup",this.__abortHandler,nocaptureOnce),this.__detachEventDestroy&&(this.__detachEventDestroy(),this.__detachEventDestroy=null),this.__mutationObserver.disconnect()}const cbParam={error:TcHmi.Errors.NONE,element:element,canceled:cancel};if((internalOption.centerVertical||internalOption.centerHorizontal)&&internalOption.styleBackup){nativeElem.style.position=internalOption.styleBackup.position,internalOption.centerHorizontal&&(nativeElem.style.left=internalOption.styleBackup.left),internalOption.centerVertical&&(nativeElem.style.top=internalOption.styleBackup.top);const childrenWithLoadEvent=nativeElem.querySelectorAll("iframe,img,picture,embed,input[type=image]");for(const child of childrenWithLoadEvent)child.removeEventListener("load",this.__updateAllChildPosition)}return this.__optionsList.delete(nativeElem),internalOption.removeCb&&TcHmi.Callback.callSafeEx(internalOption.removeCb,internalOption.origin,cbParam),this.__dimLastContainer(),element}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){Engineering.SyncCmdToFramework=class{constructor(cmd){this.__cmd=cmd,this.__result=TcHmi.Errors.NONE}}}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkRemoveControls extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){if(!1===TCHMI_DESIGNER)return;if(tchmi_path(this.__cmd.targetPartial)!==TCHMI_TARGET_PARTIAL)return;const deletedChildControls=new Set;for(const controlId of this.__cmd.controls){if(deletedChildControls.has(controlId))continue;const tco=TcHmi.Controls.get(controlId);if(!tco){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(`[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkRemoveControls] Failed to remove control "${controlId}": Not found in control cache.\n`);break}const updateParents=ctrl=>{const parentCtrl=ctrl.getParent();if(!parentCtrl)return;const parentPcElem=parentCtrl.getPcElement(),deletedChildInPc=parentPcElem?.[0].querySelector("#"+CSS.escape(controlId));deletedChildInPc?.remove(),updateParents(parentCtrl)};updateParents(tco),TcHmi.Engineering.ErrorPane.remove(controlId+"requiredAttributeTouched");for(const children of tco.getElement()[0].querySelectorAll("div[id][data-tchmi-type]"))deletedChildControls.add(children.id);tco.__getKeepAlive()&&tco.__setKeepAlive(!1),tco.destroy()}new Engineering.SyncCmdToCreatorSyncControls({name:"SyncControls",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",targetPartial:TCHMI_TARGET_PARTIAL,controls:[],replyTo:null}).send()}}Engineering.SyncCmdToFrameworkRemoveControls=SyncCmdToFrameworkRemoveControls}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkControlLocked extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){const preparedTargetPartial=tchmi_path(this.__cmd.targetPartial);!0===TCHMI_DESIGNER&&preparedTargetPartial===TCHMI_TARGET_PARTIAL&&TcHmi.System.Services.Engineering.designerModeManager.setControlLocked(this.__cmd.targetControl,this.__cmd.locked)}}Engineering.SyncCmdToFrameworkControlLocked=SyncCmdToFrameworkControlLocked}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkCreateControls extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd),this.__controlsToSelect=[],this.__createsPending=0}createCallback(){return data=>{if(this.__createsPending--,this.__createsPending<=0&&!0===TCHMI_DESIGNER&&this.__controlsToSelect.length>0){TcHmi.System.Services.Engineering.designerModeManager.unselectEach(!0);for(let i=0,ii=this.__controlsToSelect.length;i<ii;i++){let controlToSelect=this.__controlsToSelect[i];TcHmi.System.Services.Engineering.designerModeManager.select(controlToSelect,!0)}!0===TCHMI_DESIGNER&&TcHmi.System.Services.Engineering.designerModeManager.resyncSelectedControls()}}}run(){if(!1===TCHMI_DESIGNER)return;if(tchmi_path(this.__cmd.targetPartial)!==TCHMI_TARGET_PARTIAL)return;let controls=this.__cmd.controls;if(null!=controls)for(let i=0,ii=controls.length;i<ii;i++){let control=this.__cmd.controls[i];control.controlHtml?(this.__createsPending++,!0===TCHMI_DESIGNER&&!0===control.select&&this.__controlsToSelect.push(control.controlId),TcHmi.System.Services.Engineering.designerModeManager.createControl(this.__cmd.targetPartial,control.targetParentControl,control.domPosition,control.controlHtml,this.createCallback())):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkCreateControls] Failed to decode base64 encoded html content of "+control.controlId),this.__result=TcHmi.Errors.E_PARAMETER_INVALID),control=null}else this.__result=TcHmi.Errors.E_PARAMETER_INVALID}}Engineering.SyncCmdToFrameworkCreateControls=SyncCmdToFrameworkCreateControls}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkCurrentPartialContent extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){if(void 0===this.__cmd.targetPartial||null===this.__cmd.targetPartial)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkCurrentPartialContent] Failed to synchronize partial. Command property targetPartial="+this.__cmd.targetPartial+"."),void(this.__result=TcHmi.Errors.E_PARAMETER_INVALID);let targetPartial=tchmi_path(this.__cmd.targetPartial);const piggyBackObj=TcHmi.ValueConverter.toObject(this.__cmd.piggyBack);if(null!=piggyBackObj&&void 0!==piggyBackObj.requestId&&null!==piggyBackObj.requestId){let request=TcHmi.System.Services.Engineering.designerModeManager.partialContentManager.getRequest(piggyBackObj.requestId);if(request){let callback=request.callback;request.destroy&&request.destroy(),this.__cmd.content?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,targetPartial:targetPartial,content:this.__cmd.content}):TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_PARAMETER_INVALID,targetPartial:targetPartial,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Got no content for targetpartial "+this.__cmd.targetPartial,domain:"TcHmi.System.Engineering.SyncCmdToFrameworkCurrentPartialContent"}})}}else{if(!this.__cmd.content)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkCurrentPartialContent] Failed to synchronize partial="+targetPartial+". Command property content="+this.__cmd.content+"."),void(this.__result=TcHmi.Errors.E_PARAMETER_INVALID);let tempDiv=document.createElement("div");tempDiv.innerHTML=this.__cmd.content;let rawPartialContent=tempDiv.firstElementChild;if(!rawPartialContent||void 0===rawPartialContent.id)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkCurrentPartialContent] Failed to synchronize partial="+targetPartial+". Failed to read attribute=id."),void(this.__result=TcHmi.Errors.E_PARAMETER_INVALID);rawPartialContent.remove();const currentControl=TcHmi.Controls.get(rawPartialContent.id);if(currentControl&&"TcHmi.Controls.System.TcHmiUserControlHost"!==currentControl.getType())try{TcHmi.System.Services.Engineering.designerModeManager.syncControl(targetPartial,rawPartialContent.id,rawPartialContent.outerHTML)}catch(e){return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkCurrentPartialContent] Failed to synchronize partial="+targetPartial+". An uncaught exception occurred:\n",e),void(this.__result=TcHmi.Errors.E_PARAMETER_INVALID)}let type=TcHmi.PartialType.Invalid;try{let partials=[];targetPartial.endsWith(".view")?(partials=System.config.views,type=TcHmi.PartialType.View):targetPartial.endsWith(".content")?(partials=System.config.content,type=TcHmi.PartialType.Content):targetPartial.endsWith(".usercontrol")&&(partials=System.config.userControls,type=TcHmi.PartialType.UserControl);for(const partial of partials)if(partial.url===targetPartial){type!==TcHmi.PartialType.UserControl&&(type!==TcHmi.PartialType.View&&type!==TcHmi.PartialType.Content||!0!==partial.preload)||TcHmi.System.Data.Caches.partialMarkupCache.set(targetPartial,{markup:this.__cmd.content,partialId:rawPartialContent.id});break}}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkCurrentPartialContent] Failed to synchronize partial="+targetPartial+". An uncaught exception occurred:\n",e)}switch(type){case TcHmi.PartialType.View:TcHmi.EventProvider.raise("System.onViewChanged",{url:targetPartial,content:this.__cmd.content});break;case TcHmi.PartialType.Content:TcHmi.EventProvider.raise("System.onContentChanged",{url:targetPartial,content:this.__cmd.content});break;case TcHmi.PartialType.UserControl:TcHmi.EventProvider.raise("System.onUserControlChanged",{url:targetPartial,content:this.__cmd.content});case TcHmi.PartialType.Invalid:}!0===TCHMI_ENGINEERING&&!0===TCHMI_DESIGNER&&TcHmi.System.Services.Engineering.designerModeManager.highlightManager?.processDomVisibility()}}}Engineering.SyncCmdToFrameworkCurrentPartialContent=SyncCmdToFrameworkCurrentPartialContent}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkCurrentPartialEditorLockState extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){if(!0===TCHMI_DESIGNER||!0!==TCHMI_LIVEVIEW)return;tchmi_path(this.__cmd.targetPartial)===TCHMI_TARGET_PARTIAL&&!0===this.__cmd.locked&&System.Services.Engineering.designerModeManager.lock()}}Engineering.SyncCmdToFrameworkCurrentPartialEditorLockState=SyncCmdToFrameworkCurrentPartialEditorLockState}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkCurrentPartialHighlightContainerState extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){if(!0!==TCHMI_DESIGNER)return;tchmi_path(this.__cmd.targetPartial)===TCHMI_TARGET_PARTIAL&&System.Services.Engineering.designerModeManager.highlightManager?.setHighlightContainerVisibility(this.__cmd.state)}}Engineering.SyncCmdToFrameworkCurrentPartialHighlightContainerState=SyncCmdToFrameworkCurrentPartialHighlightContainerState}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkDesignerSettings extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){!1!==TCHMI_DESIGNER&&TcHmi.System.Services.Engineering.designerModeManager.updateSettings(this.__cmd.settings)}}Engineering.SyncCmdToFrameworkDesignerSettings=SyncCmdToFrameworkDesignerSettings}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkDomVisibility extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){const preparedTargetPartial=tchmi_path(this.__cmd.targetPartial);!0===TCHMI_DESIGNER&&preparedTargetPartial===TCHMI_TARGET_PARTIAL&&TcHmi.System.Services.Engineering.designerModeManager.highlightManager?.setCreatorVisibilityAttribute(this.__cmd.targetControl,this.__cmd.visibility)}}Engineering.SyncCmdToFrameworkDomVisibility=SyncCmdToFrameworkDomVisibility}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkInjectResources extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){TcHmi.System.Services.Engineering.designerModeManager.resourceInjectionManager.injectPackageResources(this.__cmd.injectInfo,(data=>{new Engineering.SyncCmdToCreatorInjectedResources({name:"InjectedResources",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",targetPartial:TCHMI_DESIGNER?TCHMI_TARGET_PARTIAL:void 0,piggyBack:this.__cmd.piggyBack,replyTo:null}).send()}))}}Engineering.SyncCmdToFrameworkInjectResources=SyncCmdToFrameworkInjectResources}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkKeyStates extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){if(!1===TCHMI_DESIGNER||!TcHmi.System.Services.Engineering.designerModeManager.interactionManager)return;if(tchmi_path(this.__cmd.targetPartial)!==TCHMI_TARGET_PARTIAL)return;let s=this.__cmd.states;null!=s?(void 0!==s.leftCtrl&&null!==s.leftCtrl&&void 0!==s.leftCtrl.down&&!0===s.leftCtrl.down||void 0!==s.rightCtrl&&null!==s.rightCtrl&&void 0!==s.rightCtrl.down&&!0===s.rightCtrl.down?TcHmi.System.Services.Engineering.designerModeManager.interactionManager.setCtrlModifierKeyState(!0):TcHmi.System.Services.Engineering.designerModeManager.interactionManager.setCtrlModifierKeyState(!1),void 0!==s.leftShift&&null!==s.leftShift&&void 0!==s.leftShift.down&&!0===s.leftShift.down||void 0!==s.rightShift&&null!==s.rightShift&&void 0!==s.rightShift.down&&!0===s.rightShift.down?TcHmi.System.Services.Engineering.designerModeManager.interactionManager.setShiftModifierKeyState(!0):TcHmi.System.Services.Engineering.designerModeManager.interactionManager.setShiftModifierKeyState(!1)):this.__result=TcHmi.Errors.E_PARAMETER_INVALID}}Engineering.SyncCmdToFrameworkKeyStates=SyncCmdToFrameworkKeyStates}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkLogoutClient extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){4!==TcHmi.System.Services.accessManager.getCurrentUserConfig().state||this.__cmd.targetInstance&&this.__cmd.targetInstance!==TCHMI_DYNAMIC_INSTANCE_ID||TcHmi.Server.logout()}}Engineering.SyncCmdToFrameworkLogoutClient=SyncCmdToFrameworkLogoutClient}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkPartialEditorLocked extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){tchmi_path(this.__cmd.targetPartial)===tchmi_path(TCHMI_TARGET_PARTIAL)&&TcHmi.System.Services.Engineering.designerModeManager.lock()}}Engineering.SyncCmdToFrameworkPartialEditorLocked=SyncCmdToFrameworkPartialEditorLocked}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkPartialEditorUnlocked extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){if(TCHMI_DESIGNER){if(tchmi_path(this.__cmd.targetPartial)!==tchmi_path(TCHMI_TARGET_PARTIAL))return;if(void 0!==window.location&&null!==window.location)return void window.location.reload()}}}Engineering.SyncCmdToFrameworkPartialEditorUnlocked=SyncCmdToFrameworkPartialEditorUnlocked}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkRequestDropControlPosition extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){if(!1===TCHMI_DESIGNER||!TcHmi.System.Services.Engineering.designerModeManager.hierarchyManager)return;const preparedTargetPartial=tchmi_path(this.__cmd.targetPartial);if(preparedTargetPartial!==TCHMI_TARGET_PARTIAL)return;if(void 0===this.__cmd.type||null===this.__cmd.type)return void(this.__result=TcHmi.Errors.E_PARAMETER_INVALID);const dropConfig=TcHmi.System.Services.Engineering.designerModeManager.hierarchyManager.getContainerFromPoint({left:this.__cmd.position.left+window.scrollX,top:this.__cmd.position.top+window.scrollY});if(!dropConfig)return void(this.__result=TcHmi.Errors.ERROR);let command={name:"DropControlPosition",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",targetPartial:preparedTargetPartial,controls:[{piggyBack:this.__cmd.piggyBack,targetParentControl:dropConfig.tco.getId(),type:this.__cmd.type,position:{centerX:dropConfig.mousePosXinTarget,centerY:dropConfig.mousePosYinTarget}}],replyTo:null};null===dropConfig.rowIndex||null===dropConfig.columnIndex||0===dropConfig.rowIndex&&0===dropConfig.columnIndex||(command.controls[0].attributes=[{name:"data-tchmi-grid-row-index",value:dropConfig.rowIndex},{name:"data-tchmi-grid-column-index",value:dropConfig.columnIndex}]),new Engineering.SyncCmdToCreatorDropControlPosition(command).send()}}Engineering.SyncCmdToFrameworkRequestDropControlPosition=SyncCmdToFrameworkRequestDropControlPosition}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkScrollPositionChanged extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){const preparedTargetPartial=tchmi_path(this.__cmd.targetPartial);!0===TCHMI_DESIGNER&&preparedTargetPartial===TCHMI_TARGET_PARTIAL&&TcHmi.System.Services.Engineering.designerModeManager?.rootControlManager?.scroll(this.__cmd.position)}}Engineering.SyncCmdToFrameworkScrollPositionChanged=SyncCmdToFrameworkScrollPositionChanged}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkSelectedControls extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){const preparedTargetPartial=tchmi_path(this.__cmd.targetPartial);if(!0===TCHMI_DESIGNER&&preparedTargetPartial===TCHMI_TARGET_PARTIAL){TcHmi.System.Services.Engineering.designerModeManager.unselectEach(!0);let controls=this.__cmd.controls;for(let i=0,ii=controls.length;i<ii;i++){let control=controls[i];TcHmi.System.Services.Engineering.designerModeManager.select(control,!0)}TcHmi.System.Services.Engineering.designerModeManager.resyncSelectedControls()}}}Engineering.SyncCmdToFrameworkSelectedControls=SyncCmdToFrameworkSelectedControls}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkServerAddress extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){const preparedTargetPartial=tchmi_path(this.__cmd.targetPartial);!0===TCHMI_DESIGNER&&preparedTargetPartial===TCHMI_TARGET_PARTIAL&&TcHmi.System.Services.serverManager.setServerAddress(this.__cmd.protocol,this.__cmd.host,this.__cmd.port)}}Engineering.SyncCmdToFrameworkServerAddress=SyncCmdToFrameworkServerAddress}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkSyncControls extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){if(!1===TCHMI_DESIGNER)return;const preparedTargetPartial=tchmi_path(this.__cmd.targetPartial);if(preparedTargetPartial!==TCHMI_TARGET_PARTIAL)return;let bCausedChanges=!1;const controls=this.__cmd.controls;for(let i=0,ii=controls.length;i<ii;i++){const control=controls[i];try{!0===TcHmi.System.Services.Engineering.designerModeManager.syncControl(preparedTargetPartial,control.targetControl,control.controlHtml)&&(bCausedChanges=!0)}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(e),this.__result=TcHmi.Errors.ERROR}}!0===bCausedChanges&&TcHmi.System.Services.Engineering.designerModeManager.highlightManager?.processDomVisibility()}}Engineering.SyncCmdToFrameworkSyncControls=SyncCmdToFrameworkSyncControls}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkTcHmiConfigChanged extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}__refreshBaseConfig(config,configOld){config.scaleMode!==configOld.scaleMode&&TcHmi.System.Services.viewManager.setScaleMode(config.scaleMode),!1===TCHMI_DESIGNER?config.startupView!==configOld.startupView&&TcHmi.System.Services.viewManager.loadView(config.startupView):config.creatorSettings&&config.creatorSettings.viewport&&(config.creatorSettings.viewport.defaultHeight!==configOld.creatorSettings.viewport.defaultHeight||config.creatorSettings.viewport.defaultWidth!==configOld.creatorSettings.viewport.defaultWidth)&&TcHmi.System.Services.Engineering.designerModeManager.rootControlManager?.setCreatorViewPortPosition(TcHmi.System.Services.viewManager.getView()),config.activeTheme!==configOld.activeTheme?TcHmi.System.Services.themeManager.setTheme(config.activeTheme,!0):tchmi_equal(config.themes,configOld.themes)&&tchmi_equal(config.dependencyFiles?.filter((value=>"Stylesheet"===value.type)),configOld.dependencyFiles?.filter((value=>"Stylesheet"===value.type)))||TcHmi.System.Services.themeManager.processActiveTheme(),tchmi_equal(config.trigger,configOld.trigger)||(TcHmi.System.destroyGlobalTrigger&&(TcHmi.System.destroyGlobalTrigger(),TcHmi.System.destroyGlobalTrigger=null),TcHmi.System.destroyGlobalTrigger=TcHmi.System.Services.triggerManager.register(tchmi_clone_object(config.trigger))),TCHMI_ENGINEERING&&TCHMI_LIVEVIEW&&!tchmi_equal(config.tcHmiServer,configOld.tcHmiServer)&&TcHmi.System.Services.serverManager.refreshSubscriptions()}__loadViewPartial(v,callback){let vm=null;if(!0===v.preload&&!0!==TCHMI_DESIGNER){let xhr=new XMLHttpRequest;xhr.open("GET",v.url+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){200===xhr.status?vm=xhr.responseText:TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+v.url+". Details:"+xhr.statusText),TcHmi.Callback.callSafeEx(callback,null,v,vm)})),xhr.addEventListener("error",(function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+v.url+". Details:"+xhr.statusText),TcHmi.Callback.callSafeEx(callback,null,v,vm)})),xhr.send()}}__loadViewPartialCallback(v,vm){if(null==vm)return;let cacheEntry,cleanUrl=tchmi_path(v.url);if(void 0!==v.url&&null!==v.url&&!0===v.preload&&(cacheEntry={markup:vm},TcHmi.System.Data.Caches.partialMarkupCache.set(cleanUrl,cacheEntry)),!0===v.preload&&void 0!==v.url&&null!==v.url&&!0!==TCHMI_DESIGNER){let tempDiv=document.createElement("div");if(tempDiv.innerHTML=vm,tempDiv.firstElementChild){const tco=TcHmi.System.Services.controlManager.compile(tempDiv.firstElementChild);void 0!==tco&&(cacheEntry&&(cacheEntry.partialId=tco.getId()),tco.__setKeepAlive(!0),tco.getElement().attr("data-tchmi-partial-url",v.url))}}TcHmi.EventProvider.raise("System.onViewCreated",{url:cleanUrl})}__refreshViewPartials(views,viewsOld){if(null==views||null==viewsOld)return;let viewsRemoved=[];for(let i=0,ii=viewsOld.length;i<ii;i++){let po=viewsOld[i],bExists=!1;for(let j=0,jj=views.length;j<jj;j++){if(views[j].url===po.url){bExists=!0;break}}!1===bExists&&viewsRemoved.push(po)}let viewsCreated=[];for(let i=0,ii=views.length;i<ii;i++){let p=views[i],bExists=!1;for(let j=0,jj=viewsOld.length;j<jj;j++){let po=viewsOld[j];if(p.url===po.url){bExists=!0;break}}!1===bExists&&viewsCreated.push(p)}for(let i=0,ii=viewsRemoved.length;i<ii;i++){let v=viewsRemoved[i];if(void 0===v.url||null===v.url)continue;let cleanUrl=tchmi_path(v.url);TcHmi.System.Data.Caches.partialMarkupCache.delete(cleanUrl),TcHmi.EventProvider.raise("System.onViewRemoved",{url:cleanUrl})}for(let i=0,ii=viewsCreated.length;i<ii;i++){let v=viewsCreated[i];this.__loadViewPartial(v,this.__loadViewPartialCallback)}}__refreshContentPartials(content,contentOld){if(null==content||null==contentOld)return;let contentRemoved=[];for(let i=0,ii=contentOld.length;i<ii;i++){let po=contentOld[i],bExists=!1;for(let j=0,jj=content.length;j<jj;j++){if(content[j].url===po.url){bExists=!0;break}}!1===bExists&&contentRemoved.push(po)}let contentCreated=[];for(const p of content){TcHmi.System.Data.isLoadSyncContent.set(p.url,!!p.loadSync);let bExists=!1;for(let j=0,jj=contentOld.length;j<jj;j++){let po=contentOld[j];if(p.url===po.url){bExists=!0;break}}!1===bExists&&contentCreated.push(p)}for(let i=0,ii=contentRemoved.length;i<ii;i++){let c=contentRemoved[i];if(void 0===c.url||null===c.url)continue;let cleanUrl=tchmi_path(c.url);TcHmi.System.Data.Caches.partialMarkupCache.delete(cleanUrl),TcHmi.EventProvider.raise("System.onContentRemoved",{url:cleanUrl})}for(let i=0,ii=contentCreated.length;i<ii;i++){let v=contentCreated[i];this.__loadViewPartial(v,this.__loadViewPartialCallback)}}__loadUserControlPartial(uc,callback){let ucm=null,ucc=null,uccUrl=uc.url.replace(".usercontrol",".usercontrol.json"),xhrDescr=new XMLHttpRequest;xhrDescr.open("GET",uc.url+"?preventcache="+Math.random()),xhrDescr.addEventListener("load",(function(evt){if(200===xhrDescr.status){ucm=xhrDescr.responseText;let xhr=new XMLHttpRequest;xhr.open("GET",uccUrl+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){200===xhr.status?ucc=TcHmi.ValueConverter.toObject(xhr.responseText):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+uccUrl+". Details:"+xhr.statusText),TcHmi.Callback.callSafeEx(callback,null,uc,ucm,ucc)})),xhr.addEventListener("error",(function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+uccUrl+". Details:"+xhr.statusText),TcHmi.Callback.callSafeEx(callback,null,uc,ucm,ucc)})),xhr.send()}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+uc.url+", status="+xhrDescr.status),TcHmi.Callback.callSafeEx(callback,null,uc,ucm,ucc)})),xhrDescr.addEventListener("error",(function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+uc.url+", status="+xhrDescr.status),TcHmi.Callback.callSafeEx(callback,null,uc,ucm,ucc)})),xhrDescr.send()}__loadUserControlPartialCallback(uc,ucm,ucc){if(null==ucm)return;let cacheEntry,cleanUcUrl=tchmi_path(uc.url),cleanUcConfigUrl=tchmi_path(uc.url.replace(".usercontrol",".usercontrol.json"));void 0!==uc.url&&null!==uc.url&&(cacheEntry={markup:ucm},TcHmi.System.Data.Caches.partialMarkupCache.set(cleanUcUrl,cacheEntry)),null!=ucc&&void 0!==uc.url&&null!==uc.url&&TcHmi.System.Data.Caches.partialCompositeConfigCache.set(cleanUcConfigUrl,ucc),TcHmi.EventProvider.raise("System.onUserControlCreated",{url:cleanUcUrl}),TcHmi.EventProvider.raise("System.onUserControlConfigCreated",{url:cleanUcConfigUrl})}__refreshUserControlPartials(userControls,userControlsOld){if(null==userControls||null==userControlsOld)return;let userControlsRemoved=[];for(let i=0,ii=userControlsOld.length;i<ii;i++){let po=userControlsOld[i],bExists=!1;for(let j=0,jj=userControls.length;j<jj;j++){userControls[j].url===po.url&&(bExists=!0)}!1===bExists&&userControlsRemoved.push(po)}let userControlsCreated=[];for(let i=0,ii=userControls.length;i<ii;i++){let p=userControls[i],bExists=!1;for(let j=0,jj=userControlsOld.length;j<jj;j++){let po=userControlsOld[j];p.url===po.url&&(bExists=!0)}!1===bExists&&userControlsCreated.push(p)}for(let i=0,ii=userControlsRemoved.length;i<ii;i++){let uc=userControlsRemoved[i];if(void 0===uc.url||null===uc.url)continue;let cleanUcUrl=tchmi_path(uc.url),cleanUcConfigUrl=tchmi_path(uc.url.replace(".usercontrol",".usercontrol.json"));TcHmi.System.Data.Caches.partialMarkupCache.delete(cleanUcUrl),TcHmi.System.Data.Caches.partialCompositeConfigCache.delete(cleanUcConfigUrl),TcHmi.EventProvider.raise("System.onUserControlRemoved",{url:cleanUcUrl}),TcHmi.EventProvider.raise("System.onUserControlConfigRemoved",{url:cleanUcConfigUrl})}for(const uc of userControlsCreated)this.__loadUserControlPartial(uc,this.__loadUserControlPartialCallback)}__refreshSymbols(symbols,symbolsOld){let i=0,ii=0,iSymbols=symbols.internal,iSymbolsOld=symbolsOld.internal,key=null,keyOld=null,bRemove=!1,remove=[],bCreate=!1,create=[],update=[];if(null!=iSymbolsOld&&null!=iSymbols)for(keyOld in iSymbolsOld)if(iSymbolsOld.hasOwnProperty(keyOld)){for(key in bRemove=!0,iSymbols)if(iSymbols.hasOwnProperty(key)){if(keyOld===key){bRemove=!1;break}key=null}!0===bRemove&&remove.push(keyOld),bRemove=!1,keyOld=null}for(i=0,ii=remove.length;i<ii;i++)TcHmi.System.Services.internalSymbolManager.remove(remove[i]);if(null!=iSymbolsOld&&null!=iSymbols)for(key in iSymbols)if(iSymbols.hasOwnProperty(key)){for(keyOld in bCreate=!0,iSymbolsOld)if(iSymbolsOld.hasOwnProperty(keyOld)&&key===keyOld){bCreate=!1,tchmi_equal(iSymbols[key].value,iSymbolsOld[keyOld].value)&&iSymbols[key].persist===iSymbolsOld[keyOld].persist&&iSymbols[key].type===iSymbolsOld[keyOld].type&&iSymbols[key].readonly===iSymbolsOld[keyOld].readonly||update.push({key:key,item:iSymbols[key]});break}!0===bCreate&&create.push({key:key,item:iSymbols[key]})}for(const entry of create)TcHmi.System.Services.internalSymbolManager.add(entry.key,tchmi_clone_object(entry.item));for(const entry of update)TcHmi.System.Services.internalSymbolManager.update(entry.key,tchmi_clone_object(entry.item));tchmi_equal(symbols.themedResources,symbolsOld.themedResources)||TcHmi.System.Services.themeManager.processThemedResources()}__refreshPackages(packages,packagesOld){let i=0,ii=0,j=0,jj=0,bCreate=!1,newPackages=[];if(null!=packages&&null!=packagesOld){for(i=0,ii=packages.length;i<ii;i++){for(bCreate=!0,j=0,jj=packagesOld.length;j<jj;j++)if(packages[i].name===packagesOld[j].name){bCreate=!1;break}!0===bCreate&&newPackages.push(packages[i])}TcHmi.System.Services.Engineering.designerModeManager.resourceInjectionManager.injectPackageResources(tchmi_clone_object(newPackages))}}__refreshUserFunctions(userFunctions,userFunctionsOld){let userFunctionsCreated=[];for(let i=0,ii=userFunctions.length;i<ii;i++){let userFunction=userFunctions[i],bExists=!1;if(userFunctionsOld)for(let j=0,jj=userFunctionsOld.length;j<jj;j++){let userFunctionOld=userFunctionsOld[j];if(tchmi_path(userFunction.url)===tchmi_path(userFunctionOld.url)){bExists=!0;break}}else bExists=!1;!1===bExists&&userFunctionsCreated.push(userFunction)}for(const userFunction of userFunctionsCreated){let url=tchmi_path(userFunction.url.replace(".js",".function.json")),xhr=new XMLHttpRequest;xhr.open("GET",url+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){if(200===xhr.status){let descr=TcHmi.ValueConverter.toObject(xhr.responseText);if(!descr)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while parsing object loaded from "+url));let name=descr.function.name,namespace=descr.function.namespace,qname=TcHmi.System.resolveQualifiedName(name,namespace),registration=TcHmi.System.Data.Registrations.functions.map.get(name),add=function(){if(!registration?.name)return;let name=registration.name,qname=TcHmi.System.resolveQualifiedName(registration.name,registration.namespace),module={error:TcHmi.Errors.NONE,reg:registration,description:descr};TcHmi.System.Data.Modules.functions.map.has(name)?TcHmi.System.Data.Modules.functions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):TcHmi.System.Data.Modules.functions.map.set(name,module),qname!==name&&(TcHmi.System.Data.Modules.functions.map.has(qname)?TcHmi.System.Data.Modules.functions.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):TcHmi.System.Data.Modules.functions.map.set(qname,module))};registration&&registration.error!==TcHmi.Errors.E_NOT_UNIQUE||(registration=TcHmi.System.Data.Registrations.functions.map.get(qname),registration?add():TcHmi.EventProvider.register("System.onFunctionRegistered",(function(e,data){e.destroy(),registration=data,add()})))}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+url+". Details: "+xhr.statusText)})),xhr.addEventListener("error",(function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+url+". Details: "+xhr.statusText)})),xhr.send()}}__refreshDependencyFiles(dependencyFiles,dependencyFilesOld){if(!dependencyFiles||!dependencyFilesOld)return;let dependencyFilesCreated=[];for(let i=0,ii=dependencyFiles.length;i<ii;i++){let dependencyFile=dependencyFiles[i],bExists=!1;if(dependencyFilesOld)for(let j=0,jj=dependencyFilesOld.length;j<jj;j++){let dependencyFileOld=dependencyFilesOld[j];if(tchmi_path(dependencyFile.name)===tchmi_path(dependencyFileOld.name)){bExists=!0;break}}else bExists=!1;!1===bExists&&dependencyFilesCreated.push(dependencyFile)}if(dependencyFilesCreated.length>0){let fragment=document.createDocumentFragment();for(let i=0,ii=dependencyFilesCreated.length;i<ii;i++){let dependencyFile=dependencyFilesCreated[i];"JavaScript"===dependencyFile.type&&function(dependencyFileJs){let script=document.createElement("script");script.src=tchmi_path(dependencyFileJs.name),script.async=!1,script.onload=function(ev){},script.onerror=function(ev){},fragment.appendChild(script)}(dependencyFile)}document.head.appendChild(fragment)}}__refreshLanguageFallback(languageFallback,languageFallbackOld){languageFallback!==languageFallbackOld&&(TcHmi.System.Services.localizationManager.setFallbackLocale(languageFallback),TcHmi.System.Services.localizationManager.resetFallbackLocale())}__refreshLanguage(languages,languagesOld){if(!tchmi_equal(languages,languagesOld)){for(const[key,languageEntry]of Object.entries(languagesOld))if(Array.isArray(languageEntry)){const sanitizedLanguageArray=[];for(const subEntry of languageEntry)sanitizedLanguageArray.push(tchmi_path(subEntry));TcHmi.System.Services.localizationManager.unregisterLocalizationFile("TcHmi.System.Localization.Application",key,sanitizedLanguageArray)}else languageEntry&&TcHmi.System.Services.localizationManager.unregisterLocalizationFile("TcHmi.System.Localization.Application",key,tchmi_path(languageEntry));for(const[key,languageEntry]of Object.entries(languages))if(Array.isArray(languageEntry)){const sanitizedLanguageArray=[];for(const subEntry of languageEntry)sanitizedLanguageArray.push(tchmi_path(subEntry));TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Application",key,sanitizedLanguageArray)}else languageEntry&&TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Application",key,tchmi_path(languageEntry))}}__refreshSystemKeyboard(keyboardDefinition,keyboardDefinitionOld){tchmi_equal(keyboardDefinition,keyboardDefinitionOld)||TcHmi.System.Services.keyboardManager?.refreshConfig()}__doReloadTcHmiConfig(url){let config=null,configOld=TcHmi.System.config,__this=this,xhr=new XMLHttpRequest;xhr.open("GET","Properties/tchmiconfig.json?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){if(200===xhr.status){if(config=TcHmi.ValueConverter.toObject(xhr.responseText),null===config)return;__this.__doRefreshTcHmiConfig(config,configOld)}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+url+". Command will be ignored. Details: "+xhr.statusText)})),xhr.addEventListener("error",(function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+url+". Command will be ignored. Details: "+xhr.statusText)})),xhr.send()}__doRefreshTcHmiConfig(config,configOld){TcHmi.System.config=config,TcHmi.System.config.basePath=configOld.basePath,TcHmi.System.config.tcHmiServer?TcHmi.System.config.tcHmiServer.websocketIntervalTime||(TcHmi.System.config.tcHmiServer.websocketIntervalTime=configOld.tcHmiServer.websocketIntervalTime):TcHmi.System.config.tcHmiServer=configOld.tcHmiServer,this.__refreshBaseConfig(config,configOld),this.__refreshViewPartials(config.views,configOld.views),this.__refreshContentPartials(config.content,configOld.content),this.__refreshUserControlPartials(config.userControls,configOld.userControls),this.__refreshSymbols(config.symbols,configOld.symbols),this.__refreshPackages(config.packages,configOld.packages),this.__refreshUserFunctions(config.userFunctions,configOld.userFunctions),this.__refreshDependencyFiles(config.dependencyFiles,configOld.dependencyFiles),this.__refreshLanguage(config.languages,configOld.languages),this.__refreshLanguageFallback(config.languageFallback,configOld.languageFallback),this.__refreshSystemKeyboard(config.systemKeyboard,configOld.systemKeyboard),tchmi_equal(config,configOld)||TcHmi.EventProvider.raise("onConfigChanged",{configNew:config,configOld:configOld})}__doReloadUserControlConfig(url){let __this=this,xhr=new XMLHttpRequest;xhr.open("GET",url+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){if(200===xhr.status){let data=TcHmi.ValueConverter.toObject(xhr.responseText);data?__this.__doRefreshUserControlConfig(url,data):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while parsing file loaded from "+url)}else TcHmi.EventProvider.raise("System.onUserControlConfigRemoved",{url:url})})),xhr.addEventListener("error",(function(evt){TcHmi.EventProvider.raise("System.onUserControlConfigRemoved",{url:url})})),xhr.send()}__doRefreshUserControlConfig(url,data){TcHmi.System.Data.Caches.partialCompositeConfigCache.set(url,data),TcHmi.EventProvider.raise("System.onUserControlConfigChanged",{url:url})}__doReloadLocalizationFile(url){let __this=this,xhr=new XMLHttpRequest;xhr.open("GET",url+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){if(200===xhr.status){let data=TcHmi.ValueConverter.toObject(xhr.responseText);data?__this.__doRefreshLocalizationFile(url,data):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while parsing file loaded from "+url)}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+url+". Details: "+xhr.statusText)})),xhr.addEventListener("error",(function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+url+". Details: "+xhr.statusText)})),xhr.send()}__doRefreshLocalizationFile(url,data){let locale=data.locale;if(null==locale)return;let currentLocaleData=TcHmi.System.Services.localizationManager.getLocaleData("TcHmi.System.Localization.Application"),currentLocaleFallbackData=TcHmi.System.Services.localizationManager.getLocaleFallbackData("TcHmi.System.Localization.Application");currentLocaleData&&currentLocaleData.locale===locale&&(TcHmi.System.Services.localizationManager.setLocaleData("TcHmi.System.Localization.Application",data,url),currentLocaleData=TcHmi.System.Services.localizationManager.getLocaleData("TcHmi.System.Localization.Application"),TcHmi.System.Services.localizationManager.processLocalizationData("TcHmi.System.Localization.Application",currentLocaleData,currentLocaleFallbackData)),currentLocaleFallbackData&&currentLocaleFallbackData.locale===locale&&(TcHmi.System.Services.localizationManager.setLocaleFallbackData("TcHmi.System.Localization.Application",data,url),currentLocaleFallbackData=TcHmi.System.Services.localizationManager.getLocaleFallbackData("TcHmi.System.Localization.Application"),TcHmi.System.Services.localizationManager.processLocalizationData("TcHmi.System.Localization.Application",currentLocaleData,currentLocaleFallbackData)),TcHmi.System.Services.localizationManager.processPendingEntryWatches(),TcHmi.System.Services.localizationManager.processLocalizationWatches("TcHmi.System.Localization.Application")}__doRefreshThemeFile(url){TcHmi.System.Services.themeManager.__clearProjectThemeUrl(url),TcHmi.System.Services.themeManager.processActiveTheme()}run(){let cmd=this.__cmd,preparedConfigPath=tchmi_path(cmd.configPath);switch(cmd.type){case"TcHmiConfig":this.__doReloadTcHmiConfig(preparedConfigPath);break;case"UserControlConfig":this.__doReloadUserControlConfig(preparedConfigPath);break;case"Localization":this.__doReloadLocalizationFile(preparedConfigPath);break;case"ThemeConfig":this.__doRefreshThemeFile(preparedConfigPath)}}}Engineering.SyncCmdToFrameworkTcHmiConfigChanged=SyncCmdToFrameworkTcHmiConfigChanged}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToFrameworkZoom extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){const preparedTargetPartial=tchmi_path(this.__cmd.targetPartial);!0===TCHMI_DESIGNER&&preparedTargetPartial===TCHMI_TARGET_PARTIAL&&TcHmi.System.Services.Engineering.designerModeManager.rootControlManager?.setCreatorZoom(this.__cmd.factor)}}Engineering.SyncCmdToFrameworkZoom=SyncCmdToFrameworkZoom}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){Engineering.SyncCmdToCreator=class{constructor(cmd){this.__cmd=cmd}send(){TcHmi.System.Services.Engineering.designerModeComManager.sendCommand(this.__cmd)}}}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToCreatorControlDoubleClick extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorControlDoubleClick=SyncCmdToCreatorControlDoubleClick}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToCreatorCopyMoveControls extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorCopyMoveControls=SyncCmdToCreatorCopyMoveControls}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToCreatorHierarchyMoveControls extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorHierarchyMoveControls=SyncCmdToCreatorHierarchyMoveControls}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToCreatorMessages extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorMessages=SyncCmdToCreatorMessages}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToCreatorDropControlPosition extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorDropControlPosition=SyncCmdToCreatorDropControlPosition}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToCreatorRegisterSyncView extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorRegisterSyncView=SyncCmdToCreatorRegisterSyncView}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToCreatorRequestCurrentPartialContent extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorRequestCurrentPartialContent=SyncCmdToCreatorRequestCurrentPartialContent}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToCreatorRequestRequiredViewPortSize extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorRequestRequiredViewPortSize=SyncCmdToCreatorRequestRequiredViewPortSize}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToCreatorSyncControls extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorSyncControls=SyncCmdToCreatorSyncControls}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToCreatorSelectedControls extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorSelectedControls=SyncCmdToCreatorSelectedControls}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class SyncCmdToCreatorInjectedResources extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorInjectedResources=SyncCmdToCreatorInjectedResources}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){Engineering.ErrorPane=class{constructor(){this.__messages={}}add(name,content,type){if(!1===TCHMI_ENGINEERING||!1===TCHMI_DESIGNER)return;this.remove(name);let guid=tchmi_create_guid(),message={identifier:guid,type:type,content:content},m={append:!0,identifier:guid,targetPartial:TCHMI_TARGET_PARTIAL,targetInstance:TCHMI_DYNAMIC_INSTANCE_ID,type:type,content:content,line:null,position:null,unixTimestamp:Math.round(Date.now()/1e3)};this.__messages[name]=message,new Engineering.SyncCmdToCreatorMessages({name:"Messages",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",messages:[m],replyTo:null}).send()}remove(name){if(!1===TCHMI_ENGINEERING||!1===TCHMI_DESIGNER)return;let message=this.__messages[name];if(!message)return;let m={remove:!0,identifier:message.identifier};new Engineering.SyncCmdToCreatorMessages({name:"Messages",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",messages:[m],replyTo:null}).send(),delete this.__messages[name]}}}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){class DesignerModeComManager{constructor(){this.__websocket=void 0,this.__websocketWasClosedUnexpected=!1,this.__connectionWatcherInterval=0,this.__unloaded=!1,this.__disableCommunication=evt=>{this.__unloaded=!0,this.__websocket&&(this.__websocket.close(),this.__websocket=void 0)},this.__connectionWatcherTick=()=>()=>{void 0===this.__websocket&&this.open()},TcHmi.EventProvider.register("System.disableCommunication",this.__disableCommunication)}__handleSyncCommandMessageResponse(messageObj){if(!messageObj.command)return;let commandHandler,checkDesignerLock=!0;switch(messageObj.command.name){case"Messages":default:break;case"InjectResources":commandHandler=new Engineering.SyncCmdToFrameworkInjectResources(messageObj.command);break;case"Confirmation":case"TransactionBegin":case"TransactionCommit":return;case"ScrollPositionChanged":checkDesignerLock=!1,commandHandler=new Engineering.SyncCmdToFrameworkScrollPositionChanged(messageObj.command);break;case"RequestDropControlPosition":commandHandler=new Engineering.SyncCmdToFrameworkRequestDropControlPosition(messageObj.command);break;case"CreateControls":commandHandler=new Engineering.SyncCmdToFrameworkCreateControls(messageObj.command);break;case"SyncControls":commandHandler=new Engineering.SyncCmdToFrameworkSyncControls(messageObj.command);break;case"RemoveControls":commandHandler=new Engineering.SyncCmdToFrameworkRemoveControls(messageObj.command);break;case"SelectedControls":commandHandler=new Engineering.SyncCmdToFrameworkSelectedControls(messageObj.command);break;case"ServerAddress":checkDesignerLock=!1,commandHandler=new Engineering.SyncCmdToFrameworkServerAddress(messageObj.command);break;case"DesignerSettings":commandHandler=new Engineering.SyncCmdToFrameworkDesignerSettings(messageObj.command);break;case"DomVisibility":commandHandler=new Engineering.SyncCmdToFrameworkDomVisibility(messageObj.command);break;case"ControlLocked":commandHandler=new Engineering.SyncCmdToFrameworkControlLocked(messageObj.command);break;case"KeyStates":checkDesignerLock=!1,commandHandler=new Engineering.SyncCmdToFrameworkKeyStates(messageObj.command);break;case"CurrentPartialContent":commandHandler=new Engineering.SyncCmdToFrameworkCurrentPartialContent(messageObj.command);break;case"TcHmiConfigChanged":commandHandler=new Engineering.SyncCmdToFrameworkTcHmiConfigChanged(messageObj.command);break;case"Zoom":checkDesignerLock=!1,commandHandler=new Engineering.SyncCmdToFrameworkZoom(messageObj.command);break;case"PartialEditorLocked":checkDesignerLock=!1,commandHandler=new Engineering.SyncCmdToFrameworkPartialEditorLocked(messageObj.command);break;case"PartialEditorUnlocked":checkDesignerLock=!1,commandHandler=new Engineering.SyncCmdToFrameworkPartialEditorUnlocked(messageObj.command);break;case"CurrentPartialEditorLockState":commandHandler=new Engineering.SyncCmdToFrameworkCurrentPartialEditorLockState(messageObj.command);break;case"CurrentPartialHighlightContainerState":commandHandler=new Engineering.SyncCmdToFrameworkCurrentPartialHighlightContainerState(messageObj.command);break;case"LogoutClient":commandHandler=new Engineering.SyncCmdToFrameworkLogoutClient(messageObj.command)}if(!checkDesignerLock||!0!==System.Services.Engineering.designerModeManager.isLocked())if(void 0!==commandHandler)try{commandHandler.run()}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx('[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] An uncaught exception occurred while performing "'+messageObj.command.name+'" command:\n',e)}else TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn('[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] Command "'+messageObj.command.name+'" not implemented.')}__websocketOnOpen(callback){return openEvent=>{if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] WebSocket with url="+this.__websocket.url+" opened."),this.__websocket){if(this.__websocketWasClosedUnexpected)return!TCHMI_ENGINEERING||TCHMI_DESIGNER?void window.location.reload():(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.System.Engineering.DesignerModeComManager"}}),TcHmi.System.Services.dialogManager.showDialog("__DesignerModeComManager",!1,TcHmi.DialogManager.DialogType.Overlay,{force:!0}),TcHmi.System.Services.dialogManager.updateTextEx("__DesignerModeComManager",TcHmi.System.Services.localization.getText("Engineering_Websocket_Restored",{level:TcHmi.Locale.Level.Engineering})+" "+tchmi_format_string(TcHmi.System.Services.localization.getText("Reload_In_N_Seconds",{level:TcHmi.Locale.Level.Engineering}),5),{severity:TcHmi.DialogManager.DialogSeverity.Warning,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Services.dialogManager.showDialog("__DesignerModeComManager",!0,TcHmi.DialogManager.DialogType.Overlay),void setTimeout((()=>{window.location.reload()}),5e3));new Engineering.SyncCmdToCreatorRegisterSyncView({name:"RegisterSyncView",targetPartial:TCHMI_TARGET_PARTIAL,targetInstance:TCHMI_DYNAMIC_INSTANCE_ID,syncViewLevel:TCHMI_DESIGNER?"Master":"Slave",sessionId:TcHmi.System.Services.accessManager.getCurrentUserConfig().session??"",replyTo:null}).send(),TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}else TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.System.Engineering.DesignerModeComManager"}})}}__websocketOnClose(){return closeEvent=>{!0!==this.__unloaded&&this.__websocket&&(this.__websocketWasClosedUnexpected=!0,closeEvent.code&&!closeEvent.reason?TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] WebSocket with url="+this.__websocket.url+" was closed with code="+closeEvent.code+"."):closeEvent.code&&closeEvent.reason?TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] WebSocket with url="+this.__websocket.url+" was closed with code="+closeEvent.code+" and reason="+closeEvent.reason+"."):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] WebSocket with url="+this.__websocket.url+" was closed."),this.__websocket=void 0,this.__connectionWatcherInterval&&window.clearInterval(this.__connectionWatcherInterval),this.__unloaded||(this.__connectionWatcherInterval=window.setInterval(this.__connectionWatcherTick(),DesignerModeComManager.RECONNECT_INTERVAL)))}}__websocketOnMessage(){return messageEvent=>{if(!0===this.__unloaded)return;if(void 0===messageEvent)return;if(void 0===messageEvent.data)return;const messageObj=TcHmi.ValueConverter.toObject(messageEvent.data);if(null!==messageObj&&messageObj.command){try{!0===TCHMI_CONSOLE_LOG_ENGINEERING_COM_MESSAGES&&"KeyStates"!==messageObj.command.name&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] Response from TwinCAT HMI Creator.",{messageObj:messageObj})}catch(e){}this.__handleSyncCommandMessageResponse(messageObj)}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] Failed to parse JSON message from TcHmiCreator!",{messageObj:messageObj})}}open(callback){if(!0!==this.__unloaded){if(void 0===this.__websocket){if(void 0===TCHMI_ENGINEERING_WEBSOCKET)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] Missing flag=TCHMI_ENGINEERING_WEBSOCKET."));try{this.__websocket=new WebSocket(TCHMI_ENGINEERING_WEBSOCKET+"/DesignerWebsocketname="+TCHMI_ENGINEERING_WEBSOCKET)}catch(ex){let reason="Opening connection to Engineering failed";if(ex instanceof DOMException&&(reason=reason+": "+ex.message),callback)return void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.Engineering.DesignerModeComManager",reason:reason}});throw TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] "+reason),new Error(reason)}this.__websocket.onopen=this.__websocketOnOpen(callback),this.__websocket.onclose=this.__websocketOnClose(),this.__websocket.onmessage=this.__websocketOnMessage(),setTimeout((()=>{this.__websocket?.readyState!==WebSocket.OPEN&&TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_TIMEOUT,details:{code:TcHmi.Errors.E_TIMEOUT,message:TcHmi.Errors[TcHmi.Errors.E_TIMEOUT],reason:"TwinCAT HMI Creator Websocket did not respond within expected time.",domain:"TcHmi.System.Engineering.DesignerModeComManager"}})}),3e4)}}else TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.Engineering.DesignerModeComManager",reason:"Website already unloaded."}})}sendCommand(cmd){let messageObj={id:tchmi_create_guid(),timestamp:Date.now(),command:cmd};const message=JSON.stringify(messageObj);void 0!==this.__websocket&&this.__websocket.readyState===WebSocket.OPEN&&(!0===TCHMI_CONSOLE_LOG_ENGINEERING_COM_MESSAGES&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] Request to TwinCAT HMI Creator.",{messageObj:messageObj}),this.__websocket.send(message))}}DesignerModeComManager.RECONNECT_INTERVAL=5e3,Engineering.DesignerModeComManager=DesignerModeComManager}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){Engineering.DesignerModeManager=class{constructor(){this.__locked=!1,this.__partialRequested={},this.__settings={theme:{ChessboardLight:null,ChessboardDark:null},enableSnapping:!0,snapToControls:!0,snapToInnerContainerSides:!0,snapDistanceToControls:10,untransformedColor:null,selectionHighlightColor:null,unSelectedHighlightColor:null,selectedSecondaryColor:null,snapHighlightColor:null},this.metaDataManager=new Engineering.DesignerModeControlMetaDataManager(this),this.partialContentManager=new Engineering.DesignerModePartialContentManager(this),this.resourceInjectionManager=new Engineering.DesignerModeResourceInjectionManager(this),!0===TCHMI_DESIGNER&&(this.hierarchyManager=new Engineering.DesignerModeMasterHierarchyManager(this),this.rootControlManager=new Engineering.DesignerModeMasterRootControlManager(this),this.highlightManager=new Engineering.DesignerModeMasterControlHighlightManager(this),this.syncManager=new Engineering.DesignerModeMasterSyncManager(this),this.interactionManager=new Engineering.DesignerModeMasterInteractionManager(this),this.controlMoveManager=new Engineering.DesignerModeMasterControlMoveManager(this),this.rectSelectManager=new Engineering.DesignerModeMasterRectSelectManager(this),this.controlResizeManager=new Engineering.DesignerModeMasterControlResizeManager(this),this.userControlParameterManager=new Engineering.DesignerModeUserControlParameterManager(this),TcHmi.EventProvider.register("onThemeDataChanged",this.__onThemeDataChanged())),TcHmi.EventProvider.register("onControlAttached",this.__onControlAttached())}__onControlAttached(){let __this=this;return function(e,tco){let purl=null;if(null!=tco&&(purl=tco.getElement()[0].getAttribute("data-tchmi-partial-url"),!0===TCHMI_DESIGNER&&__this.hierarchyManager&&__this.highlightManager&&__this.rootControlManager&&__this.controlMoveManager&&__this.controlResizeManager)){if(!0===__this.hierarchyManager.isDesignerModeControl(tco.getId())){let creatorAttr,isPartialRoot=!1;tchmi_path(purl)===TCHMI_TARGET_PARTIAL&&(isPartialRoot=!0);let bCreatorVisibility=!0;creatorAttr=tco.getElement()[0].getAttribute("data-tchmi-creator-visibility"),creatorAttr&&(creatorAttr=TcHmi.ValueConverter.toType(creatorAttr,"tchmi:framework#/definitions/Visibility")),"Collapsed"===creatorAttr&&(bCreatorVisibility=!1);let bCreatorLocked=!1;creatorAttr=tco.getElement()[0].getAttribute("data-tchmi-creator-locked"),creatorAttr&&(bCreatorLocked=TcHmi.ValueConverter.toType(creatorAttr,"tchmi:general#/definitions/Boolean"));let controlCollapsed=!1;"Collapsed"===tco.getVisibility()&&(controlCollapsed=!0);let ctrlMeta=__this.metaDataManager.getControlMetaData(tco.getId());if(null===ctrlMeta){let controlzindex=0;const aZindex=TcHmi.StyleProvider.getSimpleElementStyle(tco.getElement(),"z-index");void 0!==aZindex["z-index"]&&(controlzindex=parseInt(aZindex["z-index"],10),isNaN(controlzindex)&&(controlzindex=0)),ctrlMeta={id:tco.getId(),parent:null,jControlPosition:__this.highlightManager.createControlPosition(tco,2e3+controlzindex),jHierarchyControlposition:__this.highlightManager.createHierarchyControlPosition(tco,2e3+controlzindex),jOriginalPosition:__this.highlightManager.createOriginalPosition(tco,1e3+controlzindex),jAnchorContainer:__this.highlightManager.createAnchorContainer(tco,3e3+controlzindex,bCreatorLocked),jHierarchyAnchorContainer:__this.highlightManager.createHierarchyAnchorContainer(tco,3e3+controlzindex,bCreatorLocked),isSelected:!1,isSelectedPrev:!1,isPartialRoot:isPartialRoot,controlCollapsed:controlCollapsed,isContainerControl:tco.getIsContainerControl()&&!(tco.getElement()?.[0]?.hasAttribute("data-tchmi-designer-ignore")??1),isGridControl:TcHmi.System.Services.controlManager.getDescriptionTypes(tco.getType()).includes("TcHmi.Controls.System.TcHmiGrid"),domVisibility:bCreatorVisibility,locked:bCreatorLocked,controlAttributeDimension:{},controlCssPixelDimension:{},relativeControlRotation:0,absoluteParentRotation:0},!0===isPartialRoot&&(ctrlMeta.jControlPosition[0].classList.add("tchmi-creator-root-partial"),ctrlMeta.jHierarchyControlposition[0].classList.add("tchmi-creator-root-partial"),ctrlMeta.jOriginalPosition[0].classList.add("tchmi-creator-root-partial"),ctrlMeta.jAnchorContainer[0].classList.add("tchmi-creator-root-partial"),ctrlMeta.jHierarchyAnchorContainer[0].classList.add("tchmi-creator-root-partial")),ctrlMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-locked",bCreatorLocked),ctrlMeta.jHierarchyAnchorContainer[0].classList.toggle("tchmi-creator-control-locked",bCreatorLocked),ctrlMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-height-inactive","Content"===tco.getHeightMode()),ctrlMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-width-inactive","Content"===tco.getWidthMode()),__this.highlightManager.processHighlightType(ctrlMeta),__this.highlightManager.processDomVisibility(ctrlMeta),!0===ctrlMeta.isGridControl&&__this.highlightManager.createGridHighlighter(tco,ctrlMeta),__this.metaDataManager.register(ctrlMeta)}else ctrlMeta.isPartialRoot=isPartialRoot,ctrlMeta.controlCollapsed=controlCollapsed,ctrlMeta.domVisibility=bCreatorVisibility;__this.metaDataManager.refreshControlMetaData(ctrlMeta),__this.controlMoveManager.registerControl(ctrlMeta),__this.hierarchyManager.registerContainerControl(ctrlMeta),__this.controlResizeManager.registerControl(ctrlMeta);let ctco=tco;for(;null!=ctco;){if(ctco.getIsContainerControl()&&!(ctco.getElement()?.[0]?.hasAttribute("data-tchmi-designer-ignore")??1)){let tcoPar=tco.getParent();if(tcoPar&&tcoPar.getId()===ctco.getId()){let ctrlParentMeta=__this.metaDataManager.getControlMetaData(ctco.getId());if(null===ctrlParentMeta){let creatorParentAttr,controlParentZindex=0;controlParentZindex=parseInt(ctco.getElement().css("zIndex"),10),isNaN(controlParentZindex)&&(controlParentZindex=0);let bCreatorParentVisibility=!0;creatorParentAttr=ctco.getElement()[0].getAttribute("data-tchmi-creator-visibility"),creatorParentAttr&&(creatorParentAttr=TcHmi.ValueConverter.toType(creatorAttr,"tchmi:framework#/definitions/Visibility")),"Collapsed"===creatorParentAttr&&(bCreatorParentVisibility=!1);let bCreatorParentLocked=!1;creatorParentAttr=ctco.getElement()[0].getAttribute("data-tchmi-creator-locked"),creatorParentAttr&&(bCreatorParentLocked=TcHmi.ValueConverter.toType(creatorAttr,"tchmi:general#/definitions/Boolean"));let controlParentCollapsed=!1;"Collapsed"===ctco.getVisibility()&&(controlParentCollapsed=!0),ctrlParentMeta={id:ctco.getId(),parent:null,jControlPosition:__this.highlightManager.createControlPosition(ctco,2e3+controlParentZindex),jHierarchyControlposition:__this.highlightManager.createHierarchyControlPosition(ctco,2e3+controlParentZindex),jOriginalPosition:__this.highlightManager.createOriginalPosition(ctco,1e3+controlParentZindex),jAnchorContainer:__this.highlightManager.createAnchorContainer(ctco,3e3+controlParentZindex,bCreatorParentLocked),jHierarchyAnchorContainer:__this.highlightManager.createHierarchyAnchorContainer(ctco,3e3+controlParentZindex,bCreatorParentLocked),isSelected:!1,isSelectedPrev:!1,isPartialRoot:!1,controlCollapsed:controlParentCollapsed,isContainerControl:ctco.getIsContainerControl()&&!(ctco.getElement()?.[0]?.hasAttribute("data-tchmi-designer-ignore")??1),isGridControl:TcHmi.System.Services.controlManager.getDescriptionTypes(ctco.getType()).includes("TcHmi.Controls.System.TcHmiGrid"),domVisibility:bCreatorParentVisibility,locked:bCreatorParentLocked,controlAttributeDimension:{},controlCssPixelDimension:{},relativeControlRotation:0,absoluteParentRotation:0},ctrlParentMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-locked",bCreatorParentLocked),ctrlParentMeta.jHierarchyAnchorContainer[0].classList.toggle("tchmi-creator-control-locked",bCreatorParentLocked),__this.metaDataManager.refreshControlMetaData(ctrlParentMeta),!0===ctrlParentMeta.isGridControl&&__this.highlightManager.createGridHighlighter(ctco,ctrlParentMeta),__this.metaDataManager.register(ctrlParentMeta)}ctrlMeta.parent=ctrlParentMeta}}ctco=ctco.getParent()}let tcoPar=tco.getParent();if(null!==ctrlMeta.parent&&null!==tcoPar){const nextCtrl=tco.getElement().next();let nextCtrlMeta=null;if(0!==nextCtrl.length&&(nextCtrlMeta=__this.metaDataManager.getControlMetaData(nextCtrl[0].id)),nextCtrlMeta)nextCtrlMeta.jOriginalPosition.before(ctrlMeta.jOriginalPosition),nextCtrlMeta.jControlPosition.before(ctrlMeta.jControlPosition),nextCtrlMeta.jControlPosition.before(ctrlMeta.jHierarchyControlposition),nextCtrlMeta.jAnchorContainer.before(ctrlMeta.jAnchorContainer),nextCtrlMeta.jAnchorContainer.before(ctrlMeta.jHierarchyAnchorContainer);else if(!1===ctrlMeta.parent.isGridControl)ctrlMeta.parent.jHierarchyControlposition.append(ctrlMeta.jOriginalPosition),ctrlMeta.parent.jHierarchyControlposition.append(ctrlMeta.jControlPosition),ctrlMeta.parent.jHierarchyControlposition.append(ctrlMeta.jHierarchyControlposition),ctrlMeta.parent.jHierarchyAnchorContainer.append(ctrlMeta.jAnchorContainer),ctrlMeta.parent.jHierarchyAnchorContainer.append(ctrlMeta.jHierarchyAnchorContainer);else{let targetRowIndex=tco.getGridRowIndex();(!targetRowIndex||targetRowIndex>=tcoPar.__rowOptions.length)&&(targetRowIndex=0);let targetColumnIndex=tco.getGridColumnIndex();(!targetColumnIndex||targetColumnIndex>=tcoPar.__columnOptions.length)&&(targetColumnIndex=0);const targetCell=ctrlMeta.parent.jHierarchyControlposition.children("[data-tchmi-creator-grid-rowindex="+targetRowIndex+"][data-tchmi-creator-grid-cellindex="+targetColumnIndex+"]");0===targetCell.length&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Fatal internal error: Could not find target grid cell for "+tco.getParent().getId()+" to attach highlight container."),targetCell.append(ctrlMeta.jOriginalPosition),targetCell.append(ctrlMeta.jControlPosition),targetCell.append(ctrlMeta.jHierarchyControlposition),targetCell.append(ctrlMeta.jAnchorContainer),targetCell.append(ctrlMeta.jHierarchyAnchorContainer)}}else{const HighlightingContainer=__this.rootControlManager.getViewPortHighlightingContainer();HighlightingContainer.append(ctrlMeta.jOriginalPosition),HighlightingContainer.append(ctrlMeta.jControlPosition),HighlightingContainer.append(ctrlMeta.jHierarchyControlposition),HighlightingContainer.append(ctrlMeta.jAnchorContainer),HighlightingContainer.append(ctrlMeta.jHierarchyAnchorContainer);const backgroundTarget=__this.rootControlManager.getBackgroundTarget();document.body.append(backgroundTarget[0],HighlightingContainer[0])}let ctrlAsyncData=__this.highlightManager.requestAsyncHighlighterUpdateForControl(tco);ctrlAsyncData.moved=!0,ctrlAsyncData.resized=!0,ctrlMeta.isPartialRoot&&__this.rootControlManager.setRootControl(tco,ctrlMeta)}}}}__onThemeDataChanged(){let __this=this;return function(e){__this.metaDataManager.refreshControlMetaData()}}resyncSelectedControls(){if(this.metaDataManager.getSelectedControlsMetaDataHasChanged()){let metaData=this.metaDataManager.getSelectedControlsMetaData();const cmd={name:"SelectedControls",targetPartial:TCHMI_TARGET_PARTIAL,controls:[],replyTo:null};for(let id in metaData)cmd.controls.push(id);new Engineering.SyncCmdToCreatorSelectedControls(cmd).send(),this.metaDataManager.resetSelectedControlsMetaDataHasChanged()}}resyncControls(){if(this.metaDataManager.getChangedControlsMetaDataHasChanged()){let metaData=this.metaDataManager.getChangedControlsMetaData();const cmd={name:"SyncControls",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",targetPartial:TCHMI_TARGET_PARTIAL,controls:[],replyTo:null};for(let id in metaData){const md=metaData[id],tco=TcHmi.Controls.get(id);if(!tco)continue;let markup=tco.getPcElement()[0].outerHTML;cmd.controls.push({targetControl:md.id,descriptionPath:TcHmi.System.Services.controlManager.getDescriptionPath(tco.getType()),controlHtml:markup})}new Engineering.SyncCmdToCreatorSyncControls(cmd).send(),this.metaDataManager.resetChangedControlsMetaData()}}syncControl(targetPartial,targetControl,controlHtml){let __this=this;if(!targetControl)return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. Invalid target control."),!1;if(!controlHtml)return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. Invalid or missing html."),!1;if(!controlHtml.endsWith("</div>"))return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. Incomplete html."),!1;const tco=TcHmi.Controls.get(targetControl);if(!tco)return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. Control="+targetControl+" not found in control cache."),!1;let tempDiv=document.createElement("div");tempDiv.innerHTML=controlHtml;let jControlHtmlNew=$(tempDiv.firstElementChild);if(0===jControlHtmlNew.length)return!1;if(1!==jControlHtmlNew.length&&(jControlHtmlNew=jControlHtmlNew.filter("div[data-tchmi-type]"),1!==jControlHtmlNew.length))return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. Only one control is allowed but got "+jControlHtmlNew.length),!1;const controlType=jControlHtmlNew[0].getAttribute("data-tchmi-type");if(!controlType)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed for control="+targetControl+". Missing attribute=data-tchmi-type."),!1;if(!jControlHtmlNew[0].id)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed for control="+targetControl+". Missing attribute=id."),!1;let jControlHtmlCurrent=tco.getPcElement().clone();if(0===jControlHtmlCurrent.length)return!1;if(controlType!==tco.getType())return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed for incompatible control="+targetControl+". Incoming change is for control type="+controlType+" but local control has type="+tco.getType()),!1;if(jControlHtmlNew[0].outerHTML===jControlHtmlCurrent[0].outerHTML)return!1;let attrsCurrent=tco.getAttrs(),attrsNewRes=System.resolveAttributesFromControlElement(jControlHtmlNew[0]);const ctrlMeta=this.metaDataManager.getControlMetaData(targetControl);let newId=attrsNewRes.value.id.value,tcoPar=tco.getParent();if(targetControl!==newId&&tcoPar){let jParentPcElementClone=tcoPar.getPcElement().clone(),tempDiv=document.createElement("div");return tempDiv.innerHTML=controlHtml,jParentPcElementClone.find("#"+tchmi_css_escape_selector(targetControl)).replaceWith($(tempDiv.firstElementChild)),this.syncControl(targetPartial,jParentPcElementClone[0].id,jParentPcElementClone[0].outerHTML),ctrlMeta&&ctrlMeta.isSelected&&TcHmi.EventProvider.register(newId+".onAttached",(function(e,data){__this.select(newId,!0),e.destroy()})),!0}TcHmi.Engineering.ErrorPane.remove(tco.getId()+"requiredAttributeTouched");const creatorAttributesNotSynced={"data-tchmi-creator-visibility":!0,"data-tchmi-creator-locked":!0,"data-tchmi-creator-viewport-width":!0,"data-tchmi-creator-viewport-height":!0,"data-tchmi-zindex":!0};let attrsToProcess=[],attrsToRemove=[];for(let keyNew in attrsNewRes.value){const attrNew=attrsNewRes.value[keyNew],attrCurrent=attrsCurrent[keyNew];if(void 0===attrCurrent||!tchmi_equal(attrNew.value,attrCurrent.value)){if(attrNew.descr&&!0===attrNew.descr.requiredOnCompile){TcHmi.Engineering.ErrorPane.add(tco.getId()+"requiredAttributeTouched","Synchronization problem while changing attribute "+attrNew.descr.name+" of control="+tco.getId()+". It is not possible to change this attribute in runtime. Please save and reload this window.",TcHmi.Engineering.ErrorPane.MessageType.Error);continue}attrsToProcess.push(attrNew)}creatorAttributesNotSynced[attrNew.name]&&delete creatorAttributesNotSynced[attrNew.name]}for(let keyCurrent in attrsCurrent){let attrCurrent=attrsCurrent[keyCurrent];if(void 0===attrsNewRes.value[attrCurrent.name]){if(attrCurrent.descr&&!0===attrCurrent.descr.requiredOnCompile){TcHmi.Engineering.ErrorPane.add(tco.getId()+"requiredAttributeTouched","Synchronization problem while removing attribute "+attrCurrent.descr.name+" of control="+tco.getId()+". This attribute is not allowed to be deleted.",TcHmi.Engineering.ErrorPane.MessageType.Error);continue}attrsToRemove.push(attrCurrent)}}for(let missingCreatorAttribute in creatorAttributesNotSynced){switch(missingCreatorAttribute){case"data-tchmi-creator-visibility":null!==ctrlMeta&&(ctrlMeta.domVisibility=!0);break;case"data-tchmi-creator-locked":null!==ctrlMeta&&(ctrlMeta.locked=!1);break;case"data-tchmi-zindex":if(null!==ctrlMeta){const controlzindex=0;ctrlMeta.jOriginalPosition.css("z-index",1e3+controlzindex),ctrlMeta.jControlPosition.css("z-index",2e3+controlzindex),ctrlMeta.jHierarchyControlposition.css("z-index",2e3+controlzindex),ctrlMeta.jAnchorContainer.css("z-index",3e3+controlzindex),ctrlMeta.jHierarchyAnchorContainer.css("z-index",3e3+controlzindex)}}tco.getElement()[0].removeAttribute(missingCreatorAttribute),tco.getPcElement()[0].removeAttribute(missingCreatorAttribute),delete tco.getAttrs()[missingCreatorAttribute]}if(null!=attrsToProcess)for(let i=0,ii=attrsToProcess.length;i<ii;i++){const attr=attrsToProcess[i];switch(attr.name.toLowerCase()){case"data-tchmi-creator-visibility":if(!0===TCHMI_DESIGNER&&null!==ctrlMeta)if("Collapsed"===TcHmi.ValueConverter.toType(attr.value,"tchmi:framework#/definitions/Visibility"))ctrlMeta.domVisibility=!1;else ctrlMeta.domVisibility=!0;tco.getElement()[0].setAttribute(attr.name,attr.value),tco.getAttrs()[attr.name]=attr;break;case"data-tchmi-creator-locked":!0===TCHMI_DESIGNER&&null!==ctrlMeta&&(ctrlMeta.locked=TcHmi.ValueConverter.toType(attr.value,"tchmi:general#/definitions/Boolean")),tco.getElement()[0].setAttribute(attr.name,attr.value),tco.getAttrs()[attr.name]=attr;break;case"data-tchmi-creator-viewport-width":case"data-tchmi-creator-viewport-height":tco.getElement()[0].setAttribute(attr.name,attr.value),tco.getAttrs()[attr.name]=attr;break;case"data-tchmi-zindex":if(!0===TCHMI_DESIGNER&&null!==ctrlMeta){let controlzindex=parseInt(attr.value,10);isNaN(controlzindex)&&(controlzindex=0),controlzindex>=0&&(ctrlMeta.jOriginalPosition.css("z-index",1e3+controlzindex),ctrlMeta.jControlPosition.css("z-index",2e3+controlzindex),ctrlMeta.jHierarchyControlposition.css("z-index",2e3+controlzindex),ctrlMeta.jAnchorContainer.css("z-index",3e3+controlzindex),ctrlMeta.jHierarchyAnchorContainer.css("z-index",3e3+controlzindex))}}}if("TcHmi.Controls.System.TcHmiHtmlHost"===tco.getType()){let contentNew=jControlHtmlNew[0].innerHTML;contentNew&&tco.setContent(contentNew),contentNew=""}for(let i=0,ii=attrsToRemove.length;i<ii;i++){let attr=attrsToRemove[i];if(void 0===attr.descr||null===attr.descr)continue;if(attr.valueType===System.ControlAttributeValueType.Simple&&tco.getElement()[0].removeAttribute(attr.name),delete tco.getAttrs()[attr.name],!0===attr.descr.readOnly)continue;let isSymbolExpression=TcHmi.Symbol.isSymbolExpression(attr.value),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(attr.value);if(isSymbolExpression&&!isSymbolExpressionEscaped)try{TcHmi.System.Services.bindingManager.removeBinding(attr.descr.propertyName,tco,!0)}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. An uncaught exception occurred while removing binding for attribute="+attr.descr.propertyName+" of control="+tco.getId()+":\n",e)}else{let error=TcHmi.System.Services.controlManager.setControlPropertyByAttribute(tco,attr.descr,null);error&&error.code!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] "+TcHmi.Log.buildMessage(error))}}for(let i=0,ii=attrsToProcess.length;i<ii;i++){let attr=attrsToProcess[i];if(void 0===attr.descr||null===attr.descr)continue;if(attr.valueType===System.ControlAttributeValueType.Simple&&tco.getElement()[0].setAttribute(attr.name,attr.value),tco.getAttrs()[attr.name]=attr,!0===attr.descr.readOnly)continue;let isSymbolExpression=TcHmi.Symbol.isSymbolExpression(attr.value),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(attr.value);if(isSymbolExpression&&!isSymbolExpressionEscaped){let designerPartialParamExpression=null;if(TCHMI_DESIGNER){let attrValueExpression=new TcHmi.SymbolExpression(attr.value);attrValueExpression&&attrValueExpression.getType()===TcHmi.SymbolType.PartialParam&&(designerPartialParamExpression=new TcHmi.SymbolExpression("%pp%TCHMI_TARGET_DESIGNER_PARTIALPARAM::"+attrValueExpression.getContent()+"%/pp%"))}let bResetBinding=!0,existingBinding=TcHmi.System.Services.bindingManager.getBinding(attr.descr.propertyName,tco);if(null!=existingBinding){let existingBindingSymbol=existingBinding.getSymbol();if(null!=existingBindingSymbol){let existingBindingSymbolExpression=existingBindingSymbol.getExpression();if(null!=existingBindingSymbolExpression)if(designerPartialParamExpression){if(designerPartialParamExpression.toString()===existingBindingSymbolExpression.toString()){bResetBinding=!1;break}}else if(attr.value===existingBindingSymbolExpression.toString()){bResetBinding=!1;break}}}if(!0===bResetBinding)try{if(TcHmi.System.Services.bindingManager.removeBinding(attr.descr.propertyName,tco,!1),designerPartialParamExpression){const dPPExpression=designerPartialParamExpression.toString();dPPExpression?TcHmi.System.Services.bindingManager.createBinding(dPPExpression,attr.descr.propertyName,tco):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. designer partial param expression invalid while creating binding for attribute="+attr.descr.propertyName+" of control="+tco.getId()+".")}else TcHmi.System.Services.bindingManager.createBinding(attr.value,attr.descr.propertyName,tco)}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. An uncaught exception occurred while creating binding for attribute="+attr.descr.propertyName+" of control="+tco.getId()+":\n",e)}}else{let prepValue=attr.value;isSymbolExpressionEscaped&&(prepValue=TcHmi.Symbol.escapeSymbolExpression(prepValue));try{TcHmi.System.Services.bindingManager.removeBinding(attr.descr.propertyName,tco,!1)}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. An uncaught exception occurred while removing binding from attribute="+attr.descr.propertyName+" of control="+tco.getId()+":\n",e)}let error=TcHmi.System.Services.controlManager.setControlPropertyByAttribute(tco,attr.descr,prepValue);error&&error.code!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&(error.exception?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] "+TcHmi.Log.buildMessage(error),"\nException:",error.exception):TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] "+TcHmi.Log.buildMessage(error)))}}if(tco.getIsContainerControl()&&!(tco.getElement()?.[0]?.hasAttribute("data-tchmi-designer-ignore")??1)){let jContentChildren=jControlHtmlNew.children(),jCurrentChildren=jControlHtmlCurrent.children("div[data-tchmi-type]"),removed=[];for(let i=0,ii=jCurrentChildren.length;i<ii;i++){let jCurrentChild=jCurrentChildren.eq(i),bDelete=!0;for(let j=0,jj=jContentChildren.length;j<jj;j++)if("DIV"===jContentChildren[j].nodeName&&!1!==jContentChildren[j].hasAttribute("data-tchmi-type")&&jCurrentChild[0].id===jContentChildren[j].id){bDelete=!1;break}if(!0===bDelete){removed.push(jCurrentChild[0].id);let removedControl=TcHmi.Controls.get(jCurrentChild[0].id);if(removedControl){removedControl.__getKeepAlive()&&removedControl.__setKeepAlive(!1),removedControl.destroy()}}}for(let i=0,ii=jContentChildren.length;i<ii;i++){if("DIV"!==jContentChildren[i].nodeName||!1===jContentChildren[i].hasAttribute("data-tchmi-type"))continue;let bRemoved=!1;for(let j=0,jj=removed.length;j<jj;j++)if(jContentChildren[i].id===removed[j]){bRemoved=!0;break}if(!0!==bRemoved)try{this.syncControl(targetPartial,jContentChildren[i].id,jContentChildren[i].outerHTML)}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. An uncaught exception occurred while syncing control="+jContentChildren[i].id+":\n",e)}}let created=[],controlIndex=-1;for(let i=0,ii=jContentChildren.length;i<ii;i++){if("DIV"!==jContentChildren[i].nodeName||!1===jContentChildren[i].hasAttribute("data-tchmi-type"))continue;controlIndex++;let bCreate=!0;for(let j=0,jj=jCurrentChildren.length;j<jj;j++)if(jCurrentChildren[j].id===jContentChildren[i].id){bCreate=!1;break}if(!0===bCreate){created.push(jContentChildren[i].id);try{this.createControl(targetPartial,targetControl,controlIndex,jContentChildren[i].outerHTML,null)}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. Unexpected An uncaught exception occurred while creating control="+jContentChildren[i].id+":\n",e)}}}}const pcElementOld=tco.getPcElement();if(tco.__setPcElement(jControlHtmlNew.clone()),void 0!==tco.getParent()&&null!==tco.getParent()){let temp=tco.getParent();for(;null!==temp;)temp.getPcElement().find("#"+tchmi_css_escape_selector(pcElementOld[0].id)).replaceWith(tco.getPcElement().clone()),temp=temp.getParent()}if(!0===TCHMI_DESIGNER&&this.hierarchyManager&&this.hierarchyManager.isDesignerModeControl(targetControl)&&this.rootControlManager&&this.highlightManager){const tCtrlMeta=this.metaDataManager.refreshControlMetaData(targetControl);if(null!=tCtrlMeta){let ctrlAsyncData=this.highlightManager.requestAsyncHighlighterUpdateForControl(tco);if(ctrlAsyncData.moved=!0,ctrlAsyncData.resized=!0,!0===tCtrlMeta.isPartialRoot);else if(tco.getParent()){let recursiveControl=tco.getParent();do{if(!recursiveControl||"Content"!==recursiveControl.getHeightMode()&&"Content"!==recursiveControl.getWidthMode())recursiveControl=null;else{const parentCtrlMeta=this.metaDataManager.getControlMetaData(recursiveControl.getId());if(!parentCtrlMeta){recursiveControl=null;break}if(parentCtrlMeta.isPartialRoot){this.rootControlManager.setCreatorViewPortPosition(recursiveControl);break}recursiveControl=recursiveControl.getParent()}}while(null!==recursiveControl)}}}return null!==ctrlMeta&&(ctrlMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-locked",ctrlMeta.locked),ctrlMeta.jHierarchyAnchorContainer[0].classList.toggle("tchmi-creator-control-locked",ctrlMeta.locked),ctrlMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-height-inactive","Content"===tco.getHeightMode()),ctrlMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-width-inactive","Content"===tco.getWidthMode())),!0}createControl(targetPartial,targetParentControl,domPos,controlHtml,callback=null){let __this=this,tempDiv=document.createElement("div");tempDiv.innerHTML=controlHtml;let jControlHTML=$(tempDiv.firstElementChild);if(0===jControlHTML.length)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to create control. Invalid control html."));jControlHTML[0].remove();let controlType=jControlHTML[0].getAttribute("data-tchmi-type");if(!controlType)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to create control. Invalid control html. Missing attribute=data-tchmi-type."));let controlId=jControlHTML[0].id;if(!controlId)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to create control. Invalid control html. Missing attribute=id."));if(TcHmi.Controls.get(controlId))return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to create instance of control. Id: "'+controlId+'" does already exist.'));let tpco=null;if(targetParentControl){if(tpco=TcHmi.Controls.get(targetParentControl),!tpco)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to create control. Target parent control="+targetParentControl+" not found in control cache."))}else{if("TcHmi.Controls.System.TcHmiView"!==controlType&&"TcHmi.Controls.System.TcHmiContent"!==controlType&&"TcHmi.Controls.System.TcHmiUserControl"!==controlType)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to create control. Only controls of type "TcHmi.Controls.System.TcHmiView", "TcHmi.Controls.System.TcHmiContent" or "TcHmi.Controls.System.TcHmiUserControl" are valid as a root element.'));jControlHTML.attr("data-tchmi-partial-url",tchmi_path(TCHMI_TARGET_PARTIAL)).attr("data-tchmi-creator-partial-key",TCHMI_TARGET_PARTIAL)}let tco=TcHmi.System.Services.controlManager.compile(jControlHTML[0],tpco,{pos:domPos});if(void 0===tco)return;if(null!==tpco){if(!tpco.getIsContainerControl()||(tco.getElement()?.[0]?.hasAttribute("data-tchmi-designer-ignore")??1)||"function"!=typeof tpco.addChild)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to create control. Can not add child to a not "TcHmiContainerControl" based control! Requested parent target control='+tpco.getId()+" has type="+tpco.getType()));{const updateParents=ctrl=>{const parentCtrl=ctrl.getParent();if(!parentCtrl)return;const controlId=ctrl.getId(),pcElem=ctrl.getPcElement(),parentPcElem=parentCtrl.getPcElement();for(const childElem of parentPcElem[0].children)if(childElem.id===controlId){childElem.replaceWith(pcElem.clone()[0]);break}updateParents(parentCtrl)};if(0===domPos)tpco.getPcElement().prepend(tco.getPcElement().clone());else{const jContentChildren=tpco.getPcElement().children();let intDomPos=-1;for(let controlCounter=0,i=0,ii=jContentChildren.length;i<ii;i++)if("DIV"===jContentChildren[i].nodeName&&!1!==jContentChildren[i].hasAttribute("data-tchmi-type")){if(controlCounter++,domPos===controlCounter){intDomPos=i;break}if(domPos<controlCounter)break}-1===intDomPos?tpco.getPcElement().append(tco.getPcElement().clone()):jContentChildren.eq(intDomPos).after(tco.getPcElement().clone())}updateParents(tpco)}}else{const tcoType=tco.getType();if("TcHmi.Controls.System.TcHmiView"!==tcoType&&"TcHmi.Controls.System.TcHmiUserControl"!==tcoType&&"TcHmi.Controls.System.TcHmiContent"!==tcoType)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to create control. Can not load root element because it is of type="+tcoType+" but only controls of type TcHmi.Controls.System.TcHmiView, TcHmi.Controls.System.TcHmiContent and TcHmi.Controls.System.TcHmiUserControl are allowed as root element."));TcHmi.System.Services.viewManager.loadViewObject(tco)}let tcoId=tco.getId();TcHmi.Engineering.ErrorPane.remove(tcoId+"requiredAttributeTouched"),TcHmi.EventProvider.register(tcoId+".onAttached",(function(e,data){e.destroy(),"function"==typeof callback&&callback.call(__this,{error:TcHmi.Errors.NONE})}))}select(controlId,bIgnoreSync=!1){if(!0!==TCHMI_DESIGNER)return;const ctrlMeta=this.metaDataManager.getControlMetaData(controlId);if(null===ctrlMeta)return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to select control="+controlId+"."));TcHmi.Controls.get(ctrlMeta.id)&&(ctrlMeta.isSelectedPrev=ctrlMeta.isSelected,ctrlMeta.isSelected=!0,this.metaDataManager.selectControl(ctrlMeta),this.highlightManager?.processHighlightType(ctrlMeta),!0!==bIgnoreSync&&this.resyncSelectedControls())}unselect(controlId,bIgnoreSync=!1){if(!0!==TCHMI_DESIGNER)return;const ctrlMeta=this.metaDataManager.getControlMetaData(controlId);if(null===ctrlMeta)return;let tco=TcHmi.Controls.get(ctrlMeta.id);if(!tco)return;ctrlMeta.isSelected=!1,this.metaDataManager.unselectControl(ctrlMeta),ctrlMeta.isSelectedPrev=!1,this.highlightManager?.processHighlightType(ctrlMeta);let tcoPar=tco.getParent();if(tcoPar&&"function"==typeof tcoPar.getChildren&&ctrlMeta.parent){let childSelected=!1;for(let childCtrl of tcoPar.getChildren()){const ctrlChildMeta=this.metaDataManager.getControlMetaData(childCtrl.getId());if(ctrlChildMeta&&ctrlChildMeta.isSelected){childSelected=!0;break}}ctrlMeta.parent.jControlPosition[0].classList.toggle("tchmi-creator-childcontrol-selected",childSelected)}!0!==bIgnoreSync&&this.resyncSelectedControls()}selectEach(bIgnoreSync){let selectionHasChanged=this.unselectEach(!0);const controlsMetaData=this.metaDataManager.getControlMetaData();for(let id in controlsMetaData)!1===controlsMetaData[id].isPartialRoot&&(this.select(id,!0),selectionHasChanged=!0);return!0!==bIgnoreSync&&selectionHasChanged&&this.resyncSelectedControls(),selectionHasChanged}unselectEach(bIgnoreSync){let selectionHasChanged=!1;const controlsMetaData=this.metaDataManager.getControlMetaData();for(let id in controlsMetaData)!0===controlsMetaData[id].isSelected&&(this.unselect(id,!0),selectionHasChanged=!0);return!0!==bIgnoreSync&&selectionHasChanged&&this.resyncSelectedControls(),selectionHasChanged}setControlLocked(targetControl,bLocked){let ctrlMeta=this.metaDataManager.getControlMetaData(targetControl);null!==ctrlMeta&&(ctrlMeta.locked=bLocked,ctrlMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-locked",bLocked),ctrlMeta.jHierarchyAnchorContainer[0].classList.toggle("tchmi-creator-control-locked",bLocked));let tco=TcHmi.Controls.get(targetControl);tco&&(bLocked?(tco.getElement()[0].setAttribute("data-tchmi-creator-locked","True"),tco.getPcElement()[0].setAttribute("data-tchmi-creator-locked","True")):(tco.getElement()[0].removeAttribute("data-tchmi-creator-locked"),tco.getPcElement()[0].removeAttribute("data-tchmi-creator-locked")))}lock(){if(this.__locked=!0,!0===TCHMI_LIVEVIEW)TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiDesignerLock",TcHmi.System.Services.localization.getText("Changes_To_Project_Require_Reload",{level:TcHmi.Locale.Level.Engineering})+' <a onclick="window.location.reload()">'+TcHmi.System.Services.localization.getText("Click_Here_For_Reload",{level:TcHmi.Locale.Level.Engineering})+"</a>",{severity:TcHmi.DialogManager.DialogSeverity.Warning,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Services.dialogManager.showDialog("__TcHmiDesignerLock",!0,TcHmi.DialogManager.DialogType.Overlay);else if(!0===TCHMI_DESIGNER){TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiDesignerLock","",{severity:TcHmi.DialogManager.DialogSeverity.Warning,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Services.dialogManager.showDialog("__TcHmiDesignerLock",!0,TcHmi.DialogManager.DialogType.Overlay),this.unselectEach(!0);const v=System.Services.viewManager.getView();null!=v&&TcHmi.StyleProvider.setSimpleElementStyle(v.getElement(),"filter","blur(2px)")}document.body.style.overflow="hidden"}unlock(){throw new Error("Not implemented!")}isLocked(){return this.__locked}getSettings(){return this.__settings}updateSettings(valueNew){tchmi_equal(this.__settings,valueNew)||(this.__settings=valueNew,this.highlightManager?.updateEngineeringStyles().call(null),this.interactionManager?.clearControlSnapPositionCache(),this.interactionManager?.refreshControlSnapPositionCache())}}}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){Engineering.DesignerModeControlMetaDataManager=class{constructor(designerModeManager){this.__controlsMetaData={},this.__selectedControlsMetaData={},this.__selectedControlsMetaDataHasChanged=!1,this.__changedControlsMetaData={},this.__changedControlsMetaDataHasChanged=!1,this.__selectedControlIdsWithChildren=[],this.__designerModeManager=designerModeManager,TcHmi.EventProvider.register("onControlDetached",this.__onControlDetached())}register(ctrlMeta){this.__controlsMetaData[ctrlMeta.id]=ctrlMeta}unregister(tcoId){void 0!==this.__controlsMetaData[tcoId]&&(!0===TCHMI_DESIGNER&&this.__designerModeManager.highlightManager&&this.__designerModeManager.rootControlManager&&(this.__designerModeManager.highlightManager.handleControlRemoved(this.__controlsMetaData[tcoId]),this.__designerModeManager.rootControlManager.setCreatorViewPortPosition(TcHmi.System.Services.viewManager.getView()),this.__designerModeManager.highlightManager.requestAsyncHighlighterUpdate()),delete this.__controlsMetaData[tcoId]),void 0!==this.__selectedControlsMetaData[tcoId]&&(delete this.__selectedControlsMetaData[tcoId],this.__rebuildSelectIdCache())}__onControlDetached(){let __this=this;return function(e,tco){null!=tco&&__this.unregister(tco.getId())}}getControlMetaData(id){return null==id?this.__controlsMetaData:void 0!==this.__controlsMetaData[id]?this.__controlsMetaData[id]:null}refreshControlMetaData(idOrControl){let ctrlMeta,id;if("string"==typeof idOrControl)ctrlMeta=this.getControlMetaData(idOrControl),id=idOrControl;else{if(!idOrControl){for(let id in this.__controlsMetaData)this.refreshControlMetaData(this.__controlsMetaData[id]);return null}ctrlMeta=idOrControl,id=ctrlMeta.id}if(null==ctrlMeta||!this.__designerModeManager.highlightManager)return null;const tco=TcHmi.Controls.get(id);if(!tco)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(`[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] Failed to refresh Control Meta Data of control "${id}": Not found in control cache.\n`),null;const element=tco.getElement();ctrlMeta.controlAttributeDimension=this.__getControlAttributeDimension(tco),ctrlMeta.relativeControlRotation=this.__getRelativeRotation(element[0]),ctrlMeta.absoluteParentRotation=this.__getAbsoluteRotation(element.offsetParent()[0]),ctrlMeta.controlCssPixelDimension=this.__getControlCssPixelDimension(tco);let ctrlAsyncData=this.__designerModeManager.highlightManager.requestAsyncHighlighterUpdateForControl(tco);return ctrlAsyncData.moved=!0,ctrlAsyncData.resized=!0,ctrlMeta}getChangedControlsMetaData(){return this.__changedControlsMetaData}resetChangedControlsMetaData(){this.__changedControlsMetaDataHasChanged=!1,this.__changedControlsMetaData={}}getChangedControlsMetaDataHasChanged(){return this.__changedControlsMetaDataHasChanged}addChangedControlsMetaData(ctrlMeta){this.__changedControlsMetaData[ctrlMeta.id]||(this.__changedControlsMetaDataHasChanged=!0),this.__changedControlsMetaData[ctrlMeta.id]=ctrlMeta}getSelectedControlsMetaData(){return this.__selectedControlsMetaData}resetSelectedControlsMetaDataHasChanged(){this.__selectedControlsMetaDataHasChanged=!1}getSelectedControlsMetaDataHasChanged(){return this.__selectedControlsMetaDataHasChanged}selectControl(ctrlMeta){this.__selectedControlsMetaData[ctrlMeta.id]||(this.__selectedControlsMetaDataHasChanged=!0),this.__selectedControlsMetaData[ctrlMeta.id]=ctrlMeta;const tco=TcHmi.Controls.get(ctrlMeta.id);if(!tco)return;const hierarchy=TcHmi.System.resolveControlHierarchy(tco,null),getAllChildren=h=>{const ctrl=h.ctrl;if(this.__selectedControlIdsWithChildren.includes(ctrl.getId())||this.__selectedControlIdsWithChildren.push(ctrl.getId()),ctrl.getIsContainerControl()&&!(ctrl.getElement()?.[0]?.hasAttribute("data-tchmi-designer-ignore")??1))for(let i=0,ii=h.children_hierarchy.length;i<ii;i++)getAllChildren(h.children_hierarchy[i])};getAllChildren(hierarchy),this.__rebuildSelectIdCache(ctrlMeta)}unselectControl(ctrlMeta){this.__selectedControlsMetaData[ctrlMeta.id]&&(this.__selectedControlsMetaDataHasChanged=!0),delete this.__selectedControlsMetaData[ctrlMeta.id],this.__rebuildSelectIdCache()}getSelectedControlIdsWithChildren(){return this.__selectedControlIdsWithChildren}__rebuildSelectIdCache(ctrlMeta){if(void 0===ctrlMeta){this.__selectedControlIdsWithChildren=[];for(const ctrlMeta2 of Object.values(this.__controlsMetaData))ctrlMeta2.jControlPosition[0].classList.remove("tchmi-creator-childcontrol-selected");for(const selectedCtrlMeta of Object.values(this.__selectedControlsMetaData))selectedCtrlMeta.isPartialRoot||this.__rebuildSelectIdCache(selectedCtrlMeta);return}if(ctrlMeta.isPartialRoot)return;ctrlMeta.isSelected&&ctrlMeta.parent&&ctrlMeta.parent.jControlPosition[0].classList.add("tchmi-creator-childcontrol-selected");const tco=TcHmi.Controls.get(ctrlMeta.id);if(!tco)return;const hierarchy=TcHmi.System.resolveControlHierarchy(tco,null),getAllChildren=h=>{const ctrl=h.ctrl;if(this.__selectedControlIdsWithChildren.includes(ctrl.getId())||this.__selectedControlIdsWithChildren.push(ctrl.getId()),ctrl.getIsContainerControl()&&!(ctrl.getElement()?.[0]?.hasAttribute("data-tchmi-designer-ignore")??1))for(let i=0,ii=h.children_hierarchy.length;i<ii;i++)getAllChildren(h.children_hierarchy[i])};getAllChildren(hierarchy)}__getControlAttributeDimension(tco){return{topValue:tco.getTop()??null,topUnit:tco.getTopUnit()??"px",leftValue:tco.getLeft()??null,leftUnit:tco.getLeftUnit()??"px",widthValue:tco.getWidth()??null,widthUnit:tco.getWidthUnit()??"px",minWidthValue:tco.getMinWidth()??null,minWidthUnit:tco.getMinWidthUnit()??"px",maxWidthValue:tco.getMaxWidth()??null,maxWidthUnit:tco.getMaxWidthUnit()??"px",widthMode:tco.getWidthMode()??"Value",rightValue:tco.getRight()??null,rightUnit:tco.getRightUnit()??"px",heightValue:tco.getHeight()??null,heightUnit:tco.getHeightUnit()??"px",heightMode:tco.getHeightMode()??"Value",minHeightValue:tco.getMinHeight()??null,minHeightUnit:tco.getMinHeightUnit()??"px",maxHeightValue:tco.getMaxHeight()??null,maxHeightUnit:tco.getMaxHeightUnit()??"px",bottomValue:tco.getBottom()??null,bottomUnit:tco.getBottomUnit()??"px"}}__getControlCssPixelDimension(tco){let res={width:null,height:null,left:null,top:null,right:null,bottom:null},element=tco.getElement();if(element){let width=element.css("width");width&&(res.width=parseFloat(width));let height=element.css("height");height&&(res.height=parseFloat(height));let left=element.css("left");left&&(res.left=parseFloat(left));let top=element.css("top");top&&(res.top=parseFloat(top));let right=element.css("right");right&&(res.right=parseFloat(right));let bottom=element.css("bottom");bottom&&(res.bottom=parseFloat(bottom))}return res}__getAbsoluteRotation(jElem){if(!jElem)return 0;let angleParent=0;const offsetParent=jElem.parentElement;!offsetParent||offsetParent.nodeName&&"HTML"===offsetParent.tagName||(angleParent=this.__getAbsoluteRotation(offsetParent));return angleParent+this.__getRelativeRotation(jElem)}__getRelativeRotation(Elem){if(!Elem)return 0;const tr=TcHmi.StyleProvider.getComputedElementStyle(Elem,"transform").transform;let angle=0;if(tr&&"none"!==tr){const arrMatrixContent=tr.substring(tr.indexOf("(")+1,tr.lastIndexOf(")")).split(",");if(6===arrMatrixContent.length){const a=parseFloat(arrMatrixContent[0]),b=parseFloat(arrMatrixContent[1]);angle=Math.round(Math.atan2(b,a)*(180/Math.PI))}}return angle}}}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){Engineering.DesignerModeMasterSyncManager=class{constructor(designerModeManager){this.__designerModeManager=designerModeManager}updatePcElementAndSync(eventName){const tcoList=[],stylenames=["top","left","width","right","height","bottom"],selectedControlsMeta=this.__designerModeManager.metaDataManager.getSelectedControlsMetaData();for(let id in selectedControlsMeta){const ctrlMeta=selectedControlsMeta[id];if(null==ctrlMeta)continue;const tco=TcHmi.Controls.get(ctrlMeta.id);if(!tco)continue;tcoList.push(tco);let horizontalCount=0,verticalCount=0;const pcElementClone=tco.getPcElement()[0].cloneNode(!0),tValue=TcHmi.StyleProvider.getSimpleElementStyle(tco.getElement(),stylenames);for(let stylename of stylenames)if(void 0!==tValue[stylename]){const styleHtmlName="data-tchmi-"+stylename;let oldValue=pcElementClone.getAttribute(styleHtmlName);if(oldValue){["top","height","bottom"].includes(stylename)?verticalCount++:["right","width","left"].includes(stylename)&&horizontalCount++;let isSymbolExpression=TcHmi.Symbol.isSymbolExpression(oldValue),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(oldValue);if(isSymbolExpression&&!isSymbolExpressionEscaped){let sym=new TcHmi.System.Symbol(oldValue);if(sym){if(sym.getExpression().getType()===TcHmi.SymbolType.Server){sym.destroy();continue}sym.read((function(data){data.error===TcHmi.Errors.NONE&&(oldValue=data.value),sym.destroy()}))}}}"string"==typeof oldValue&&(oldValue=parseFloat(oldValue));const styleUnitHtmlName="data-tchmi-"+stylename+"-unit",oldUnit=pcElementClone.getAttribute(styleUnitHtmlName);let tUnitValue=tValue[stylename].replace(/[-.0-9]/g,"");"px"!==tUnitValue&&"%"!==tUnitValue&&(tUnitValue="px"),oldUnit?oldUnit!==tUnitValue&&pcElementClone.setAttribute(styleUnitHtmlName,tUnitValue):"px"!==tUnitValue&&pcElementClone.setAttribute(styleUnitHtmlName,tUnitValue);let newValue=parseFloat(tValue[stylename]);void 0===oldValue||"number"!=typeof oldValue||Math.round(oldValue)===Math.round(newValue)||["height","width"].includes(stylename)&&["Content","Parent"].includes(pcElementClone.getAttribute("data-tchmi-"+stylename+"-mode")??"")||("px"===tUnitValue?pcElementClone.setAttribute(styleHtmlName,newValue.toFixed(0)):"%"===tUnitValue&&pcElementClone.setAttribute(styleHtmlName,newValue.toFixed(1)))}horizontalCount<2&&tValue.left&&"0px"!==tValue.left&&!pcElementClone.hasAttribute("data-tchmi-left")&&pcElementClone.setAttribute("data-tchmi-left",tValue.left.replace("px","")),verticalCount<2&&tValue.top&&"0px"!==tValue.top&&!pcElementClone.hasAttribute("data-tchmi-top")&&pcElementClone.setAttribute("data-tchmi-top",tValue.top.replace("px","")),!0===ctrlMeta.domVisibility?pcElementClone.removeAttribute("data-tchmi-creator-visibility"):pcElementClone.setAttribute("data-tchmi-creator-visibility","False"),!1===ctrlMeta.locked?pcElementClone.removeAttribute("data-tchmi-creator-locked"):pcElementClone.setAttribute("data-tchmi-creator-locked","True"),this.__designerModeManager.syncControl(TCHMI_TARGET_PARTIAL,ctrlMeta.id,pcElementClone.outerHTML)}TcHmi.EventProvider.raise(eventName,tcoList),this.__designerModeManager.highlightManager?.requestAsyncHighlighterUpdate()}}}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){Engineering.DesignerModeMasterHierarchyManager=class{constructor(designerModeManager){this.__dragtargetContainerHighlighting={},this.__designerModeManager=designerModeManager,TcHmi.System.SharedResources.jqBody.on("dragover.DesignerModeMasterHierarchyManager.body",(event=>{event.preventDefault()})).on("dragenter.DesignerModeMasterHierarchyManager.body",this.__onDragEnter()).on("dragleave.DesignerModeMasterHierarchyManager.body",this.__onDragLeave())}isDesignerModeControl(id){let tpco,res=!1,hierarchyRecursion=function(h){if(h.ctrl.getId()!==id)for(let i=0,ii=h.children_hierarchy.length;i<ii;i++){let childHierarchy=h.children_hierarchy[i];if(hierarchyRecursion(childHierarchy),!0===res)return}else res=!0},partial=document.querySelector(`div[data-tchmi-creator-partial-key="${TCHMI_TARGET_PARTIAL}"]`);if(partial&&(tpco=TcHmi.Controls.get(partial.id)),tpco){let designerIgnore=!1,tco=TcHmi.Controls.get(id);if(tco){let element=tco.getElement();element&&element.length>0&&(designerIgnore=element[0].hasAttribute("data-tchmi-designer-ignore"))}if(designerIgnore)res=!1;else{let hierarchy=TcHmi.System.resolveControlHierarchy(tpco,null);hierarchyRecursion(hierarchy)}}return res}registerContainerControl(ctrlMeta){ctrlMeta.jControlPosition.on("dragover.DesignerModeMasterHierarchyManager."+ctrlMeta.id,(event=>{event.preventDefault()})),ctrlMeta.jControlPosition.on("dragenter.DesignerModeMasterHierarchyManager."+ctrlMeta.id,this.__onDragEnter()),ctrlMeta.jControlPosition.on("dragleave.DesignerModeMasterHierarchyManager."+ctrlMeta.id,this.__onDragLeave())}registerContainerElement(jElem){jElem.on("dragenter.DesignerModeMasterHierarchyManager",this.__onDragEnter()).on("dragleave.DesignerModeMasterHierarchyManager",this.__onDragLeave())}__onDragEnter(){return event=>{event.preventDefault(),void 0!==event.pageX&&void 0!==event.pageY&&this.addHighlightDropTarget({left:event.pageX,top:event.pageY},event.target)}}__onDragLeave(){return event=>{const targetKey=(event.target.hasAttribute("data-tchmi-creator-target-control")?event.target.getAttribute("data-tchmi-creator-target-control"):"body")+"_r"+(event.target.hasAttribute("data-tchmi-creator-grid-rowindex")?event.target.getAttribute("data-tchmi-creator-grid-rowindex"):null)+"_c"+(event.target.hasAttribute("data-tchmi-creator-grid-cellindex")?event.target.getAttribute("data-tchmi-creator-grid-cellindex"):null);this.__dragtargetContainerHighlighting[targetKey]&&(this.__dragtargetContainerHighlighting[targetKey].classList.remove("tchmi-creator-possibledroptarget"),delete this.__dragtargetContainerHighlighting[targetKey])}}addHighlightDropTarget(position,targetElem){const dropConfig=this.getContainerFromPoint(position);if(this.removeHighlightDropTarget(),!dropConfig||!dropConfig.jHighlighter)return;const targetKey=(targetElem.hasAttribute("data-tchmi-creator-target-control")?targetElem.getAttribute("data-tchmi-creator-target-control"):"body")+"_r"+dropConfig.rowIndex+"_c"+dropConfig.columnIndex;dropConfig.jHighlighter[0].classList.add("tchmi-creator-possibledroptarget"),this.__dragtargetContainerHighlighting[targetKey]=dropConfig.jHighlighter[0]}removeHighlightDropTarget(){for(let key in this.__dragtargetContainerHighlighting)this.__dragtargetContainerHighlighting[key].classList.remove("tchmi-creator-possibledroptarget"),delete this.__dragtargetContainerHighlighting[key]}getContainerFromPoint(position){const currentView=TcHmi.System.Services.viewManager.getView();if(null===currentView)return null;const jClickTarget=$(document.elementFromPoint(position.left-window.scrollX,position.top-window.scrollY));let jHighlighter,tco;if(0===jClickTarget.length||jClickTarget[0]===document.body){tco=currentView;const ctrlMeta=this.__designerModeManager.metaDataManager.getControlMetaData(tco.getId());ctrlMeta&&(jHighlighter=ctrlMeta.jControlPosition)}else{const resolvePossibleDropTargets=function(h){const ctrl=h.ctrl,ctrlType=ctrl.getType();if(("TcHmi.Controls.System.TcHmiView"===ctrlType||"TcHmi.Controls.System.TcHmiContent"===ctrlType||"TcHmi.Controls.System.TcHmiUserControl"===ctrlType)&&ctrl.getId()!==currentView.getId())return[];let res=[];if(ctrl.getIsContainerControl()&&!(ctrl.getElement()?.[0]?.hasAttribute("data-tchmi-designer-ignore")??1)){res.push(ctrl);for(let i=0,ii=h.children_hierarchy.length;i<ii;i++){const pdts=resolvePossibleDropTargets(h.children_hierarchy[i]);res=res.concat(pdts)}}return res},hierarchy=TcHmi.System.resolveControlHierarchy(currentView,null),pdts=resolvePossibleDropTargets(hierarchy);let tmpInteractioncont=jClickTarget;do{const targetId=tmpInteractioncont.attr("data-tchmi-creator-target-control");if(void 0!==targetId){let bDropTargetFound=!1;for(let i=0,ii=pdts.length;i<ii;i++){const pdt=pdts[i];if(pdt.getId()===targetId){tco=pdt,jHighlighter=tmpInteractioncont,bDropTargetFound=!0;break}}if(!0===bDropTargetFound)break}tmpInteractioncont=tmpInteractioncont.parent()}while(tmpInteractioncont.length>0);tmpInteractioncont=null,null==tco&&(tco=currentView)}let x=position.left,y=position.top,rowIndex=null,cellIndex=null;if(jHighlighter&&TcHmi.System.Services.controlManager.getDescriptionTypes(tco.getType()).includes("TcHmi.Controls.System.TcHmiGrid")){if(jClickTarget[0].classList.contains("tchmi-creator-gridcell"))jHighlighter=jClickTarget;else{const jClickTargetParent=jClickTarget.parent();jClickTargetParent.length&&jClickTargetParent[0].classList.contains("tchmi-creator-hierarchy-gridcellposition")&&(jHighlighter=jClickTargetParent)}let parsedRowIndex=parseInt(jHighlighter.attr("data-tchmi-creator-grid-rowindex")??"0",10),parsedCellIndex=parseInt(jHighlighter.attr("data-tchmi-creator-grid-cellindex")??"0",10);if(!isNaN(parsedCellIndex)&&!isNaN(parsedRowIndex)){rowIndex=parsedRowIndex,cellIndex=parsedCellIndex;const cellPos=jHighlighter.position();x-=cellPos.left,y-=cellPos.top}}let tmpElem2=tco.getElement();if(tmpElem2.length>0)do{const pos=tmpElem2.position();x-=pos.left,y-=pos.top,tmpElem2=tmpElem2.offsetParent(),x-=parseFloat(tmpElem2.css("border-left-width")),y-=parseFloat(tmpElem2.css("border-top-width"))}while(tmpElem2.length>0&&tmpElem2[0]!==document.body&&tmpElem2[0]!==document.documentElement);const zf=this.__designerModeManager.rootControlManager?.getCreatorZoomFactor()??1;return{tco:tco,jHighlighter:jHighlighter,mousePosXinTarget:Math.round(x/zf),mousePosYinTarget:Math.round(y/zf),rowIndex:rowIndex,columnIndex:cellIndex}}}}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){Engineering.DesignerModeMasterRootControlManager=class{constructor(designerModeManager){this.__scrollPosition={left:0,top:0},this.__creatorZoomFactor=1,this.__viewportCurrentWidth=0,this.__viewportCurrentHeight=0,this.__scrollAnimationFrameId=0,this.__zoomAnimationFrameId=0,this.__designerModeManager=designerModeManager,document.body.classList.add("tchmi-creator-chessboard");let tempDiv=document.createElement("div");tempDiv.innerHTML='<div class="tchmi-creator-view-port-simulator"></div>',this.__viewPortSimulator=$(tempDiv.firstElementChild),tempDiv.innerHTML='<div class="tchmi-creator-view-port-highlighting"></div>',this.__viewPortHighlightingContainer=$(tempDiv.firstElementChild),tempDiv.innerHTML='<div class="tchmi-creator-view-port-background"></div>',this.__backgroundTarget=$(tempDiv.firstElementChild),window.setInterval(this.__onRequiredViewPortSizeWatchTick(),50)}getCreatorZoomFactor(){return this.__creatorZoomFactor}getViewPortSimulator(){return this.__viewPortSimulator}getViewPortHighlightingContainer(){return this.__viewPortHighlightingContainer}getBackgroundTarget(){return this.__backgroundTarget}scroll(p){p.left===this.__scrollPosition.left&&p.top===this.__scrollPosition.top||(this.__scrollPosition.left=p.left,this.__scrollPosition.top=p.top,0!==this.__scrollAnimationFrameId&&window.cancelAnimationFrame(this.__scrollAnimationFrameId),this.__scrollAnimationFrameId=window.requestAnimationFrame((()=>{document.scrollingElement.scrollLeft=this.__scrollPosition.left,document.scrollingElement.scrollTop=this.__scrollPosition.top,this.__scrollAnimationFrameId=0})))}setCreatorZoom(newZoom){void 0!==newZoom&&this.__creatorZoomFactor!==newZoom&&(this.__creatorZoomFactor=newZoom,0!==this.__zoomAnimationFrameId&&window.cancelAnimationFrame(this.__zoomAnimationFrameId),this.__zoomAnimationFrameId=window.requestAnimationFrame((()=>{1!==this.__creatorZoomFactor?this.__viewPortSimulator[0].style.transform="scale("+this.__creatorZoomFactor+")":this.__viewPortSimulator[0].style.transform="",this.__designerModeManager.metaDataManager.refreshControlMetaData(),this.__zoomAnimationFrameId=0})))}setRootControl(tco,newControlMeta){this.setCreatorViewPortPosition(tco),this.__rootControlMeta=newControlMeta,this.__viewPortSimulator[0].setAttribute("data-tchmi-creator-target-control-type",tco.getType())}__onRequiredViewPortSizeWatchTick(){return()=>{if(!this.__rootControlMeta)return;let vpWidth=50,vpHeight=50;for(const elem of[this.__viewPortSimulator[0],this.__rootControlMeta.jHierarchyAnchorContainer[0],this.__rootControlMeta.jAnchorContainer[0]]){const sWidth=elem.scrollWidth,sHeight=elem.scrollHeight;sWidth>vpWidth&&(vpWidth=sWidth),sHeight>vpHeight&&(vpHeight=sHeight)}vpWidth+=30,vpHeight+=30,vpWidth===this.__viewportCurrentWidth&&vpHeight===this.__viewportCurrentHeight||(new Engineering.SyncCmdToCreatorRequestRequiredViewPortSize({name:"RequestRequiredViewPortSize",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",targetPartial:TCHMI_TARGET_PARTIAL,width:vpWidth,height:vpHeight,replyTo:null}).send(),this.__viewportCurrentWidth=vpWidth,this.__viewportCurrentHeight=vpHeight,document.body.style.width=vpWidth+"px",document.body.style.height=vpHeight+"px")}}setCreatorViewPortPosition(tco){if(!tco)return;let viewportWidth,attributeViewportWidth=0,attrStr=tco.getElement()[0].getAttribute("data-tchmi-creator-viewport-width");attrStr&&(attributeViewportWidth=TcHmi.ValueConverter.toType(attrStr,"tchmi:framework#/definitions/PositiveNumber")),viewportWidth="number"==typeof attributeViewportWidth&&attributeViewportWidth>0?attributeViewportWidth:TcHmi.System.config.creatorSettings.viewport.defaultWidth;let viewportWidthActive=!1,widthValue=tco.getWidth();const widthUnit=tco.getWidthUnit(),widthMode=tco.getWidthMode();if("Parent"===widthMode?widthValue=null:"Content"===widthMode&&(widthValue=tco.__getContentWidth()),("%"===widthUnit||null==widthValue)&&(viewportWidthActive=!0),!1===viewportWidthActive&&widthValue){let widthMinValue=tco.getMinWidth(),widthMinUnit=tco.getMinWidthUnit(),widthMinPix=widthMinValue;null!=widthMinValue&&"%"===widthMinUnit&&(widthMinPix=widthMinValue*viewportWidth/100),null!=widthMinPix&&widthValue<widthMinPix&&(viewportWidthActive=!0)}if(!1===viewportWidthActive&&widthValue){let widthMaxValue=tco.getMaxWidth(),widthMaxUnit=tco.getMaxWidthUnit(),widthMaxPix=widthMaxValue;null!=widthMaxValue&&"%"===widthMaxUnit&&(widthMaxPix=widthMaxValue*viewportWidth/100),null!=widthMaxPix&&widthValue>widthMaxPix&&(viewportWidthActive=!0)}let viewportHeight;!1===viewportWidthActive&&widthValue&&(viewportWidth=parseInt(tco.getElement().css("left"),10)+widthValue);let attributeViewportHeight=0;attrStr=tco.getElement()[0].getAttribute("data-tchmi-creator-viewport-height"),attrStr&&(attributeViewportHeight=TcHmi.ValueConverter.toType(attrStr,"tchmi:framework#/definitions/PositiveNumber")),viewportHeight="number"==typeof attributeViewportHeight&&attributeViewportHeight>0?attributeViewportHeight:TcHmi.System.config.creatorSettings.viewport.defaultHeight;let viewportHeightActive=!1,heightValue=tco.getHeight();const heightUnit=tco.getHeightUnit(),heightMode=tco.getHeightMode();if("Parent"===heightMode?heightValue=null:"Content"===heightMode&&(heightValue=tco.__getContentHeight()),("%"===heightUnit||null===heightValue)&&(viewportHeightActive=!0),!1===viewportHeightActive&&heightValue){let heightMinValue=tco.getMinHeight(),heightMinUnit=tco.getMinHeightUnit(),heightMinPix=heightMinValue;null!=heightMinValue&&"%"===heightMinUnit&&(heightMinPix=heightMinValue*viewportHeight/100),null!=heightMinPix&&heightValue<heightMinPix&&(viewportHeightActive=!0)}if(!1===viewportHeightActive&&heightValue){let heightMaxValue=tco.getMaxHeight(),heightMaxUnit=tco.getMaxHeightUnit(),heightMaxPix=heightMaxValue;null!=heightMaxValue&&"%"===heightMaxUnit&&(heightMaxPix=heightMaxValue*viewportHeight/100),null!=heightMaxPix&&heightValue>heightMaxPix&&(viewportHeightActive=!0)}!1===viewportHeightActive&&heightValue&&(viewportHeight=parseInt(tco.getElement().css("top"),10)+heightValue),this.__viewPortSimulator[0].style.width=viewportWidth+"px",this.__viewPortSimulator[0].style.height=viewportHeight+"px",this.__viewPortHighlightingContainer[0].style.width=viewportWidth*this.__creatorZoomFactor+"px",this.__viewPortHighlightingContainer[0].style.height=viewportHeight*this.__creatorZoomFactor+"px"}}}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){Engineering.DesignerModeMasterControlHighlightManager=class{constructor(designerModeManager){this.__highlightContainerVisibility=!0,this.__asyncWorkData={animationFrameId:0,ctrlList:new Map},this.__selectorGripsId=["TopLeft","TopCenter","TopRight","CenterRight","BottomRight","BottomCenter","BottomLeft","CenterLeft"],this.__selectorGrips=["nwse","ns","nesw","ew","nwse","ns","nesw","ew"],this.__designerModeManager=designerModeManager,TcHmi.EventProvider.register("System.onControlsResized",this.__onControlsResized()),TcHmi.EventProvider.register("System.onControlsMoved",this.__onControlsMoved()),TcHmi.EventProvider.register("System.onControlVisibilityChanged",this.__onControlVisibilityChanged()),TcHmi.EventProvider.register("System.onControlGetRowCountChanged",this.__onGridRowOrColumnChanged()),TcHmi.EventProvider.register("System.onControlGetColumnCountChanged",this.__onGridRowOrColumnChanged()),TcHmi.EventProvider.register("System.onGridCellResized",this.__onGridCellResized()),TcHmi.EventProvider.register("System.onControlGridRowIndexChanged",this.__onGridRowOrColumnIndexChanged()),TcHmi.EventProvider.register("System.onControlGridColumnIndexChanged",this.__onGridRowOrColumnIndexChanged()),TcHmi.EventProvider.register("onThemeDataChanged",this.updateEngineeringStyles());let tempDiv=document.createElement("div");tempDiv.innerHTML='<div data-tchmi-creator-target-control=""\n                                class="tchmi-creator-controlposition tchmi-box"\n                                style="z-index:0;">\n                                <div data-tchmi-creator-target-control=""\n                                    class="tchmi-creator-controlname tchmi-box"\n                                    title=""><bdi></bdi></div>\n                        </div>';let controlPosition=tempDiv.firstElementChild;tempDiv.innerHTML='<div data-tchmi-creator-target-control=""\n                                class="tchmi-creator-hierarchy-controlposition tchmi-box"\n                                style="z-index:0;">\n                        </div>';let hierarchyControlPosition=tempDiv.firstElementChild;tempDiv.innerHTML='<div data-tchmi-creator-target-control=""\n                                class="tchmi-creator-originalposition tchmi-box"\n                                style="z-index:0;">\n\n                                <div class="tchmi-creator-distance-top    tchmi-creator-distance-line tchmi-box"></div>\n                                <div class="tchmi-creator-distance-left   tchmi-creator-distance-line tchmi-box"></div>\n                                <div class="tchmi-creator-distance-width  tchmi-creator-distance-line tchmi-box"></div>\n                                <div class="tchmi-creator-distance-right  tchmi-creator-distance-line tchmi-box"></div>\n                                <div class="tchmi-creator-distance-height tchmi-creator-distance-line tchmi-box"></div>\n                                <div class="tchmi-creator-distance-bottom tchmi-creator-distance-line tchmi-box"></div>\n\n                                <div class="tchmi-creator-snapline-top tchmi-creator-snapline tchmi-box"></div>\n                                <div class="tchmi-creator-snapline-left tchmi-creator-snapline tchmi-box"></div>\n                                <div class="tchmi-creator-snapline-right tchmi-creator-snapline tchmi-box"></div>\n                                <div class="tchmi-creator-snapline-bottom tchmi-creator-snapline tchmi-box"></div>\n\n                        </div>';let originalPosition=tempDiv.firstElementChild;tempDiv.innerHTML='<div data-tchmi-creator-target-control=""\n                                class="tchmi-creator-anchorcontainer tchmi-box"\n                                style="border-width: 1px;z-index:0;">\n\n                                <div data-tchmi-creator-anchor-name="TopLeft"      class="tchmi-creator-anchor-top-left      tchmi-creator-anchor-rect tchmi-box"></div>\n                                <div data-tchmi-creator-anchor-name="TopCenter"    class="tchmi-creator-anchor-top-center    tchmi-creator-anchor-rect tchmi-box"></div>\n                                <div data-tchmi-creator-anchor-name="TopRight"     class="tchmi-creator-anchor-top-right     tchmi-creator-anchor-rect tchmi-box"></div>\n                                <div data-tchmi-creator-anchor-name="CenterLeft"   class="tchmi-creator-anchor-center-left   tchmi-creator-anchor-rect tchmi-box"></div>\n                                <div data-tchmi-creator-anchor-name="CenterRight"  class="tchmi-creator-anchor-center-right  tchmi-creator-anchor-rect tchmi-box"></div>\n                                <div data-tchmi-creator-anchor-name="BottomLeft"   class="tchmi-creator-anchor-bottom-left   tchmi-creator-anchor-rect tchmi-box"></div>\n                                <div data-tchmi-creator-anchor-name="BottomCenter" class="tchmi-creator-anchor-bottom-center tchmi-creator-anchor-rect tchmi-box"></div>\n                                <div data-tchmi-creator-anchor-name="BottomRight"  class="tchmi-creator-anchor-bottom-right  tchmi-creator-anchor-rect tchmi-box"></div>\n                        </div>';let anchorContainer=tempDiv.firstElementChild;tempDiv.innerHTML='<div data-tchmi-creator-target-control=""\n                                class="tchmi-creator-hierarchy-anchorcontainer tchmi-box"\n                                style="z-index:0;">\n                        </div>';let hierarchyAnchorContainer=tempDiv.firstElementChild;this.__cloneSource={controlPosition:controlPosition,hierarchyControlPosition:hierarchyControlPosition,originalPosition:originalPosition,anchorContainer:anchorContainer,hierarchyAnchorContainer:hierarchyAnchorContainer}}handleControlRemoved(ctrlMeta){ctrlMeta.jOriginalPosition.remove(),ctrlMeta.jControlPosition.remove(),ctrlMeta.jHierarchyControlposition.remove(),ctrlMeta.jAnchorContainer.remove(),ctrlMeta.jHierarchyAnchorContainer.remove()}requestAsyncHighlighterUpdate(){0===this.__asyncWorkData.animationFrameId&&(this.__asyncWorkData.animationFrameId=window.requestAnimationFrame((()=>{const ctrlList=new Set;for(const[tco,value]of this.__asyncWorkData.ctrlList){const ctrlMeta=this.__designerModeManager.metaDataManager.getControlMetaData(tco.getId());if(null===ctrlMeta)continue;ctrlList.add(tco);const ctrlParent=tco.getParent();ctrlParent&&ctrlMeta.parent&&ctrlMeta.parent.isGridControl&&(ctrlList.has(ctrlParent)||ctrlList.add(ctrlParent)),value.rowColumnChanged&&this.createGridHighlighter(tco,ctrlMeta),value.resized&&ctrlMeta.isPartialRoot&&this.__designerModeManager.rootControlManager?.setCreatorViewPortPosition(tco),this.updateGripCursors(ctrlMeta)}this.setContainerPositions(ctrlList),this.__designerModeManager.interactionManager?.clearControlSnapPositionCache(),this.__designerModeManager.interactionManager?.refreshControlSnapPositionCache(),this.__asyncWorkData.ctrlList.clear(),this.__asyncWorkData.animationFrameId=0})))}__onControlsResized(){return(e,ctrls)=>{if(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager&&!this.__designerModeManager.controlResizeManager.getControlResizing())for(let ctrl of ctrls){this.requestAsyncHighlighterUpdateForControl(ctrl).resized=!0}}}__onControlsMoved(){return(e,ctrls)=>{if(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager&&!this.__designerModeManager.controlMoveManager.getControlMoveActive())for(let ctrl of ctrls){this.requestAsyncHighlighterUpdateForControl(ctrl).moved=!0}}}requestAsyncHighlighterUpdateForControl(ctrl){this.requestAsyncHighlighterUpdate();let resizeMoveInfo=this.__asyncWorkData.ctrlList.get(ctrl);return resizeMoveInfo||(resizeMoveInfo={resized:!1,moved:!1,rowColumnChanged:!1},this.__asyncWorkData.ctrlList.set(ctrl,resizeMoveInfo)),resizeMoveInfo}__onControlVisibilityChanged(){return(e,tco)=>{const ctrlMeta=this.__designerModeManager.metaDataManager.getControlMetaData(tco.getId());if(null===ctrlMeta)return;"Collapsed"===tco.getVisibility()?ctrlMeta.controlCollapsed=!0:ctrlMeta.controlCollapsed=!1;let ctrlAsyncData=this.requestAsyncHighlighterUpdateForControl(tco);ctrlAsyncData.moved=!0,ctrlAsyncData.resized=!0}}__onGridRowOrColumnIndexChanged(){return(e,tco)=>{let tcoPar=tco.getParent();if(!tcoPar||!TcHmi.System.Services.controlManager.getDescriptionTypes(tcoPar.getType()).includes("TcHmi.Controls.System.TcHmiGrid"))return;const ctrlMeta=this.__designerModeManager.metaDataManager.getControlMetaData(tco.getId());if(null===ctrlMeta||null===ctrlMeta.parent)return;let targetRowIndex=tco.getGridRowIndex();(!targetRowIndex||targetRowIndex>=tco.getParent()?.__rowOptions.length)&&(targetRowIndex=0);let targetColumnIndex=tco.getGridColumnIndex();(!targetColumnIndex||targetColumnIndex>=tco.getParent()?.__columnOptions.length)&&(targetColumnIndex=0);const targetCell=ctrlMeta.parent.jHierarchyControlposition.children("[data-tchmi-creator-grid-rowindex="+targetRowIndex+"][data-tchmi-creator-grid-cellindex="+targetColumnIndex+"]");0===targetCell.length&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeMasterHighlightManager] Fatal internal error: Could not find target grid cell for "+tcoPar.getId()+" to attach highlight container."),targetCell.append(ctrlMeta.jOriginalPosition),targetCell.append(ctrlMeta.jControlPosition),targetCell.append(ctrlMeta.jHierarchyControlposition),targetCell.append(ctrlMeta.jAnchorContainer),targetCell.append(ctrlMeta.jHierarchyAnchorContainer)}}__onGridRowOrColumnChanged(){return(e,tco)=>{if(this.requestAsyncHighlighterUpdateForControl(tco).rowColumnChanged=!0,"function"==typeof tco.getChildren){const gridChildren=tco.getChildren();for(const gridChild of gridChildren){this.requestAsyncHighlighterUpdateForControl(gridChild).resized=!0}}}}__onGridCellResized(){return(e,tco)=>{if(!(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager))return;if(this.__designerModeManager.controlResizeManager.getControlResizing())return;this.requestAsyncHighlighterUpdateForControl(tco).resized=!0}}setHighlightContainerVisibility(valueNew){this.__highlightContainerVisibility=valueNew;const controlsMetaData=this.__designerModeManager.metaDataManager.getControlMetaData();for(let id in controlsMetaData){const ctrlMeta=controlsMetaData[id];this.processHighlightType(ctrlMeta)}this.processDomVisibility()}setCreatorVisibilityAttribute(targetControl,bVisibility){let ctrlMeta=this.__designerModeManager.metaDataManager.getControlMetaData(targetControl);null!==ctrlMeta&&(ctrlMeta.domVisibility=bVisibility,this.processDomVisibility(ctrlMeta))}processDomVisibility(processCtrlMeta){if(!0!==TCHMI_DESIGNER)return;let controlsMetaData;controlsMetaData=processCtrlMeta?{singleCtrl:processCtrlMeta}:this.__designerModeManager.metaDataManager.getControlMetaData();for(let id in controlsMetaData){const ctrlMeta=controlsMetaData[id],tco=TcHmi.Controls.get(ctrlMeta.id);tco?(tco.getElement()[0].classList.toggle("tchmi-creator-controlhidden",!1===ctrlMeta.domVisibility),!ctrlMeta.domVisibility||ctrlMeta.controlCollapsed?(ctrlMeta.jOriginalPosition[0].style.display="none",ctrlMeta.jControlPosition[0].style.display="none",ctrlMeta.jHierarchyControlposition[0].style.display="none",ctrlMeta.jAnchorContainer[0].style.display="none",ctrlMeta.jHierarchyAnchorContainer[0].style.display="none"):(ctrlMeta.jOriginalPosition[0].style.display="",ctrlMeta.jControlPosition[0].style.display="",ctrlMeta.jHierarchyControlposition[0].style.display="",ctrlMeta.jAnchorContainer[0].style.display="",ctrlMeta.jHierarchyAnchorContainer[0].style.display="")):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(`[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeMasterHighlightManager] Failed to handle control "${ctrlMeta.id}": Not found in control cache.\n`)}}__handleOuterDimension(dimension,renderedDimension,dimensionName,controlSizeValue,controlSizeUnit,defineCount,tco,ctrlMeta,creatorZoomFactor){if(!(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager))return defineCount;const element=tco.getElement(),distanceline=ctrlMeta.jOriginalPosition[0].querySelector(".tchmi-creator-distance-"+dimensionName),controlPixelSize=renderedDimension[dimensionName],normalizedControlPixelSize=controlPixelSize*creatorZoomFactor;distanceline.style.fontSize="top"!==dimensionName&&normalizedControlPixelSize>=30||"top"===dimensionName&&normalizedControlPixelSize>=50?"":"0px",distanceline.style.width=normalizedControlPixelSize+"px",distanceline.style.display="",distanceline.style.backgroundColor="",distanceline.style.borderColor="",distanceline.style.opacity="",normalizedControlPixelSize>=10?distanceline.classList.remove("no-triangle"):distanceline.classList.add("no-triangle");let dimensionActive=!0;if(null!=controlSizeValue){if("px"===controlSizeUnit)dimension[dimensionName]=normalizedControlPixelSize+controlSizeUnit,this.__designerModeManager.controlResizeManager.getControlResizing()||this.__designerModeManager.controlMoveManager.getControlMoveActive()||!controlSizeValue?distanceline.textContent=controlPixelSize.toFixed(0)+controlSizeUnit:distanceline.textContent=controlSizeValue.toFixed(0)+controlSizeUnit;else if("%"===controlSizeUnit){let controlParentPixelSize;"top"===dimensionName||"bottom"===dimensionName?controlParentPixelSize=parseFloat(element.parent().css("height")):"left"!==dimensionName&&"right"!==dimensionName||(controlParentPixelSize=parseFloat(element.parent().css("width")));let realValue=controlPixelSize/controlParentPixelSize*100;dimension[dimensionName]=realValue+controlSizeUnit,this.__designerModeManager.controlResizeManager.getControlResizing()||this.__designerModeManager.controlMoveManager.getControlMoveActive()||!controlSizeValue?distanceline.textContent=realValue.toFixed(1)+controlSizeUnit:distanceline.textContent=controlSizeValue.toFixed(1)+controlSizeUnit}if(3===++defineCount&&("right"===dimensionName||"bottom"===dimensionName)){dimensionActive=!1,distanceline.style.width="60px",distanceline.style.display="",distanceline.style.opacity="0.5",distanceline.textContent="%"!==controlSizeUnit?controlSizeValue.toFixed(0)+controlSizeUnit:controlSizeValue.toFixed(1)+controlSizeUnit;const ctrl=TcHmi.Controls.get(ctrlMeta.id);let ctrlPxDim,availablePxSize;"bottom"===dimensionName?(ctrlPxDim=ctrl?.getRenderedWidth(),availablePxSize=60):"right"===dimensionName&&(ctrlPxDim=ctrl?.getRenderedHeight(),availablePxSize=90),distanceline.style.fontSize=ctrlPxDim&&availablePxSize&&ctrlPxDim>availablePxSize?"":"0px"}}else dimensionActive=!1,distanceline.style.display="none";return ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-definedfrom"+dimensionName,dimensionActive),defineCount}__handleInnerDimension(dimension,renderedDimension,dimensionName,controlSizeValue,controlSizeUnit,elementSizeMode,defineCount,tco,ctrlMeta,creatorZoomFactor){if(!(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager))return defineCount;const element=tco.getElement(),distanceline=ctrlMeta.jOriginalPosition[0].querySelector(".tchmi-creator-distance-"+dimensionName),controlPixelSize=renderedDimension[dimensionName];if(ctrlMeta.controlCollapsed)dimension[dimensionName]="0",distanceline.style.display="none",defineCount++;else{if(TcHmi.StyleProvider.setSimpleElementStyle(distanceline,{width:controlPixelSize*creatorZoomFactor+"px",display:"",opacity:""}),"px"===controlSizeUnit){let realValue=controlPixelSize*creatorZoomFactor;dimension[dimensionName]=realValue+controlSizeUnit,this.__designerModeManager.controlResizeManager.getControlResizing()||this.__designerModeManager.controlMoveManager.getControlMoveActive()||!controlSizeValue?distanceline.textContent=controlPixelSize.toFixed(0)+controlSizeUnit:distanceline.textContent=controlSizeValue.toFixed(0)+controlSizeUnit,"Parent"!==elementSizeMode&&null!=controlSizeValue&&defineCount++}else if("%"===controlSizeUnit){let realValue=controlPixelSize/parseFloat(element.parent().css(dimensionName))*100;if(dimension[dimensionName]=realValue+controlSizeUnit,this.__designerModeManager.controlResizeManager.getControlResizing()||this.__designerModeManager.controlMoveManager.getControlMoveActive()||!controlSizeValue){const activeAnchor=this.__designerModeManager.interactionManager.getAnchorName();ctrlMeta.isPartialRoot&&activeAnchor&&("height"===dimensionName&&(activeAnchor.includes("Top")||activeAnchor.includes("Bottom"))||"width"===dimensionName&&(activeAnchor.includes("Left")||activeAnchor.includes("Right")))?distanceline.textContent=(controlPixelSize*creatorZoomFactor).toFixed(0)+"px":distanceline.textContent=realValue.toFixed(1)+controlSizeUnit}else distanceline.textContent=controlSizeValue.toFixed(1)+controlSizeUnit;"Parent"!==elementSizeMode&&null!=controlSizeValue&&defineCount++}"Parent"===elementSizeMode||"Content"===elementSizeMode?null!=controlSizeValue?distanceline.style.opacity="0.5":distanceline.style.display="none":"Value"===elementSizeMode&&(null!=controlSizeValue?distanceline.style.opacity="1.0":distanceline.style.display="none")}return defineCount}setContainerPositions(ctrlList){if(!ctrlList||0===ctrlList.size)return;if(!(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager))return;const creatorZoomFactor=this.__designerModeManager.rootControlManager.getCreatorZoomFactor(),dimensionCacheControl=new Map,dimensionCacheGridCells=new Map;for(const tco of ctrlList){if(!tco.getIsAttached()||tco.getIsDestroyed())continue;const element=tco.getElement();if(!element||0===element.length)continue;const ctrlMeta=this.__designerModeManager.metaDataManager.getControlMetaData(tco.getId());if(null==ctrlMeta)continue;if(!1===ctrlMeta.domVisibility)continue;let renderedDimension={top:0,height:0,bottom:0,left:0,width:0,right:0,transform:"","transform-origin":"","border-width":"","border-style":""};if(!ctrlMeta.controlCollapsed){let currentStyle=TcHmi.StyleProvider.getComputedElementStyle(element,Object.keys(renderedDimension));renderedDimension.top=parseFloat(currentStyle.top),renderedDimension.height=parseFloat(currentStyle.height),renderedDimension.bottom=parseFloat(currentStyle.bottom),renderedDimension.left=parseFloat(currentStyle.left),renderedDimension.width=parseFloat(currentStyle.width),renderedDimension.right=parseFloat(currentStyle.right),renderedDimension.transform=currentStyle.transform,renderedDimension["transform-origin"]=currentStyle["transform-origin"],renderedDimension["border-width"]=currentStyle["border-width"],renderedDimension["border-style"]=currentStyle["border-style"]}if(ctrlMeta.controlCollapsed||!ctrlMeta.domVisibility?(ctrlMeta.jAnchorContainer[0].style.display="none",ctrlMeta.jControlPosition[0].style.display="none",ctrlMeta.jHierarchyAnchorContainer[0].style.display="none",ctrlMeta.jHierarchyControlposition[0].style.display="none",ctrlMeta.jOriginalPosition[0].style.display="none"):(ctrlMeta.jAnchorContainer[0].style.display="",ctrlMeta.jControlPosition[0].style.display="",ctrlMeta.jHierarchyAnchorContainer[0].style.display="",ctrlMeta.jHierarchyControlposition[0].style.display="",ctrlMeta.jOriginalPosition[0].style.display=""),dimensionCacheControl.set(tco,renderedDimension),ctrlMeta.isGridControl&&"function"==typeof tco.getChildren){tco.getChildren().forEach((ctrl=>{ctrlList.has(ctrl)||ctrlList.add(ctrl)}));const gridBCR=element[0].getBoundingClientRect();let allGridCells=ctrlMeta.jHierarchyControlposition.children(".tchmi-creator-hierarchy-gridcellposition");allGridCells=allGridCells.add(ctrlMeta.jControlPosition.children(".tchmi-creator-gridcell"));for(let i=0;i<allGridCells.length;i++){const creatorCell=allGridCells[i],rowIndex=parseInt(creatorCell.getAttribute("data-tchmi-creator-grid-rowindex")??"0",10),rowElement=element.children().children(".TcHmi_Controls_System_TcHmiGrid-grid").children().eq(rowIndex),cellIndex=parseInt(creatorCell.getAttribute("data-tchmi-creator-grid-cellindex")??"0",10),cellElement=rowElement.children()[cellIndex];if(0===rowElement.length||!cellElement)return;const elmStyles=TcHmi.StyleProvider.getComputedElementStyle(element,["border-top-width","border-left-width"]),cellStyles=TcHmi.StyleProvider.getComputedElementStyle(cellElement,["border-top-width","border-left-width","padding-top","padding-left"]),gridTopBorderWidth=parseFloat(elmStyles["border-top-width"])*creatorZoomFactor,gridLeftBorderWidth=parseFloat(elmStyles["border-left-width"])*creatorZoomFactor,cellTopOffset=parseFloat(cellStyles["border-top-width"])*creatorZoomFactor+parseFloat(cellStyles["padding-top"])*creatorZoomFactor,cellLeftOffset=parseFloat(cellStyles["border-left-width"])*creatorZoomFactor+parseFloat(cellStyles["padding-left"])*creatorZoomFactor;let offsetHeight,offsetWidth,offsetTop,offsetLeft,creatorCellStyle;if(0===ctrlMeta.absoluteParentRotation&&0===ctrlMeta.relativeControlRotation){const cellBCR=cellElement.getBoundingClientRect();offsetHeight=cellBCR.height,offsetWidth=cellBCR.width,offsetTop=cellBCR.top-gridBCR.top-gridTopBorderWidth,offsetLeft=cellBCR.left-gridBCR.left-gridLeftBorderWidth}else offsetHeight=cellElement.offsetHeight*creatorZoomFactor,offsetWidth=cellElement.offsetWidth*creatorZoomFactor,offsetTop=cellElement.offsetTop*creatorZoomFactor,offsetLeft=cellElement.offsetLeft*creatorZoomFactor;creatorCellStyle=creatorCell.classList.contains("tchmi-creator-gridcell")?{height:offsetHeight+"px",width:offsetWidth+"px",top:gridTopBorderWidth+offsetTop+"px",left:gridLeftBorderWidth+offsetLeft+"px"}:{height:offsetHeight-2*cellTopOffset+"px",width:offsetWidth-2*cellLeftOffset+"px",top:cellTopOffset+offsetTop+"px",left:cellLeftOffset+offsetLeft+"px"},dimensionCacheGridCells.set(creatorCell,creatorCellStyle)}}}for(const[tco,renderedDimension]of dimensionCacheControl){const dimension={top:"",height:"",bottom:"",left:"",width:"",right:""},ctrlMeta=this.__designerModeManager.metaDataManager.getControlMetaData(tco.getId());let defineCount=0,controlSizeValue=tco.getTop(),controlSizeUnit=tco.getTopUnit();defineCount=this.__handleOuterDimension(dimension,renderedDimension,"top",controlSizeValue,controlSizeUnit,defineCount,tco,ctrlMeta,creatorZoomFactor),controlSizeValue=tco.getHeight(),controlSizeUnit=tco.getHeightUnit();let elementSizeMode=tco.getHeightMode();defineCount=this.__handleInnerDimension(dimension,renderedDimension,"height",controlSizeValue,controlSizeUnit,elementSizeMode,defineCount,tco,ctrlMeta,creatorZoomFactor),controlSizeValue=tco.getBottom(),controlSizeUnit=tco.getBottomUnit(),defineCount=this.__handleOuterDimension(dimension,renderedDimension,"bottom",controlSizeValue,controlSizeUnit,defineCount,tco,ctrlMeta,creatorZoomFactor),defineCount<2&&this.__handleOuterDimension(dimension,renderedDimension,"top",0,"px",defineCount,tco,ctrlMeta,creatorZoomFactor),defineCount=0,controlSizeValue=tco.getLeft(),controlSizeUnit=tco.getLeftUnit(),defineCount=this.__handleOuterDimension(dimension,renderedDimension,"left",controlSizeValue,controlSizeUnit,defineCount,tco,ctrlMeta,creatorZoomFactor),controlSizeValue=tco.getWidth(),controlSizeUnit=tco.getWidthUnit(),elementSizeMode=tco.getWidthMode(),defineCount=this.__handleInnerDimension(dimension,renderedDimension,"width",controlSizeValue,controlSizeUnit,elementSizeMode,defineCount,tco,ctrlMeta,creatorZoomFactor),controlSizeValue=tco.getRight(),controlSizeUnit=tco.getRightUnit(),defineCount=this.__handleOuterDimension(dimension,renderedDimension,"right",controlSizeValue,controlSizeUnit,defineCount,tco,ctrlMeta,creatorZoomFactor),defineCount<2&&this.__handleOuterDimension(dimension,renderedDimension,"left",0,"px",defineCount,tco,ctrlMeta,creatorZoomFactor),defineCount=0,TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jOriginalPosition,dimension);const orgTransform=renderedDimension.transform;if(1!==creatorZoomFactor&&orgTransform.startsWith("matrix")){let transformtype="",twoDimMatrixEnties=[],orgTransformArray=orgTransform.substring(orgTransform.lastIndexOf("(")+1,orgTransform.lastIndexOf(")")).split(",");6===orgTransformArray.length?(transformtype="matrix",twoDimMatrixEnties=[4,5]):16===orgTransformArray.length&&(transformtype="matrix3d",twoDimMatrixEnties=[12,13,14]);for(let it of twoDimMatrixEnties)orgTransformArray[it]=(parseInt(orgTransformArray[it],10)*creatorZoomFactor).toString();dimension.transform=transformtype+"("+orgTransformArray.join(",")+")"}else dimension.transform="none"!==orgTransform?orgTransform:"";if(""!==dimension.transform){const orgTransformOrigin=renderedDimension["transform-origin"];if(orgTransformOrigin){let orgTransformOriginArray=orgTransformOrigin.split(" ");for(let it=0,itl=orgTransformOriginArray.length;it<itl;it++)orgTransformOriginArray[it].includes("px")&&(orgTransformOriginArray[it]=parseInt(orgTransformOriginArray[it],10)*creatorZoomFactor+"px");dimension["transform-origin"]=orgTransformOriginArray.join(" ")}else dimension["transform-origin"]=""}else dimension["transform-origin"]="";TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jControlPosition,dimension),TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jHierarchyControlposition,dimension),TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jAnchorContainer,dimension),TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jHierarchyAnchorContainer,dimension);let borderWidth=renderedDimension["border-width"];borderWidth||(borderWidth="0px");let borderStyle=renderedDimension["border-style"];borderStyle||(borderStyle="none");const borderWidthArray=borderWidth.split("px");let normalizedBorderWidth="";for(const strvalue of borderWidthArray){let valueNumber=parseFloat(strvalue);isNaN(valueNumber)||(normalizedBorderWidth+=valueNumber*creatorZoomFactor+"px ")}const borderClone={"border-width":normalizedBorderWidth,"border-style":borderStyle,"border-color":"transparent"};if(TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jHierarchyControlposition,borderClone),TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jHierarchyAnchorContainer,borderClone),tco.getParent()&&ctrlMeta.parent&&ctrlMeta.parent.isGridControl&&0===ctrlMeta.jHierarchyControlposition.parent().length){let targetRowIndex=tco.getGridRowIndex();(!targetRowIndex||targetRowIndex>=tco.getParent()?.__rowOptions.length)&&(targetRowIndex=0);let targetColumnIndex=tco.getGridColumnIndex();(!targetColumnIndex||targetColumnIndex>=tco.getParent()?.__columnOptions.length)&&(targetColumnIndex=0);const targetCell=ctrlMeta.parent.jHierarchyControlposition.children("[data-tchmi-creator-grid-rowindex="+targetRowIndex+"][data-tchmi-creator-grid-cellindex="+targetColumnIndex+"]");0===targetCell.length&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeMasterHighlightManager] Fatal internal error: Could not find target grid cell for "+tco.getParent()?.getId()+" to attach highlight container."),ctrlMeta.jHierarchyControlposition.parent().is(targetCell)||(targetCell.append(ctrlMeta.jOriginalPosition),targetCell.append(ctrlMeta.jControlPosition),targetCell.append(ctrlMeta.jHierarchyControlposition),targetCell.append(ctrlMeta.jAnchorContainer),targetCell.append(ctrlMeta.jHierarchyAnchorContainer))}}for(const[creatorCell,creatorCellStyle]of dimensionCacheGridCells)TcHmi.StyleProvider.setSimpleElementStyle(creatorCell,creatorCellStyle)}updateGripCursors(ctrlMeta){let i,steps=Math.round(((ctrlMeta.relativeControlRotation??0)+(ctrlMeta.absoluteParentRotation??0))*(8/360));for(steps<0&&(steps+=8),i=0;i<8;i++){const index=(i+steps)%8;TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jAnchorContainer[0].querySelectorAll(`[data-tchmi-creator-anchor-name="${this.__selectorGripsId[i]}"]`),"cursor",this.__selectorGrips[index]+"-resize")}}processHighlightType(ctrlMeta){ctrlMeta.isSelected?ctrlMeta.jControlPosition[0].classList.remove("tchmi-creator-active-highlight"):ctrlMeta.jControlPosition[0].classList.toggle("tchmi-creator-active-highlight",this.__highlightContainerVisibility),ctrlMeta.jControlPosition[0].classList.toggle("tchmi-creator-control-selected",ctrlMeta.isSelected),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-selected",ctrlMeta.isSelected),ctrlMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-selected",ctrlMeta.isSelected),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-active-highlight",this.__highlightContainerVisibility)}updateEngineeringStyles(){return e=>{let linkElem=document.querySelector('link[href*="StyleEngineering.css"]');if(!linkElem?.sheet)return;const settings=this.__designerModeManager.getSettings();let cssRules=linkElem.sheet.cssRules[0];if(":root"!==cssRules.selectorText)throw new SyntaxError("StyleEngineering.css has invalid format: First selector has to be :root");let cssStyle=cssRules.style;if(!(cssStyle.getPropertyValue("--tchmi-designer-control-untransformed-color")&&cssStyle.getPropertyValue("--tchmi-designer-control-unselected-color")&&cssStyle.getPropertyValue("--tchmi-designer-control-selected-color")&&cssStyle.getPropertyValue("--tchmi-designer-control-selected-secondary-color")&&cssStyle.getPropertyValue("--tchmi-designer-control-snap-color")))throw new SyntaxError("StyleEngineering.css has invalid format: CSS custom properties missing");const systemColorToRgba=function(color){return"rgba("+color.r+","+color.g+","+color.b+","+color.a/255+")"};settings.untransformedColor&&cssStyle.setProperty("--tchmi-designer-control-untransformed-color",systemColorToRgba(settings.untransformedColor)),settings.unSelectedHighlightColor&&cssStyle.setProperty("--tchmi-designer-control-unselected-color",systemColorToRgba(settings.unSelectedHighlightColor)),settings.selectionHighlightColor&&cssStyle.setProperty("--tchmi-designer-control-selected-color",systemColorToRgba(settings.selectionHighlightColor)),settings.selectedSecondaryColor&&cssStyle.setProperty("--tchmi-designer-control-selected-secondary-color",systemColorToRgba(settings.selectedSecondaryColor)),settings.snapHighlightColor&&cssStyle.setProperty("--tchmi-designer-control-snap-color",systemColorToRgba(settings.snapHighlightColor)),void 0!==settings.snapDistanceToControls&&cssStyle.setProperty("--tchmi-designer-control-remote-snap-distance",settings.snapDistanceToControls+"px"),settings.theme?.ChessboardLight&&cssStyle.setProperty("--tchmi-designer-vs-theme-chessboard-light",systemColorToRgba(settings.theme.ChessboardLight)),settings.theme?.ChessboardDark&&cssStyle.setProperty("--tchmi-designer-vs-theme-chessboard-dark",systemColorToRgba(settings.theme.ChessboardDark));let vsDarkTheme=!1;settings.theme?.ThemeName?vsDarkTheme="Dark"===settings.theme.ThemeName:settings.theme?.ChessboardDark&&(vsDarkTheme=(settings.theme.ChessboardDark?.r??246)<100&&(settings.theme.ChessboardDark?.g??246)<100&&(settings.theme.ChessboardDark?.b??246)<100),document.documentElement.classList.toggle("tchmi-visual-studio-dark",vsDarkTheme),settings.theme?.ThemeName||(document.body.style.overflow="hidden")}}createControlPosition(relatedControl,zindex){let controlId=relatedControl.getId(),typeDisplayName=relatedControl.getType(),module=TcHmi.System.Data.Modules.controls.map.get(typeDisplayName);module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded&&(typeDisplayName=module.descriptionExpanded.displayName||"");let highlighterElement=this.__cloneSource.controlPosition.cloneNode(!0);highlighterElement.setAttribute("data-tchmi-creator-target-control",controlId),highlighterElement.style.zIndex=zindex.toString();let child=highlighterElement.firstElementChild;return child.title=controlId+": "+typeDisplayName,child.firstElementChild.textContent=controlId,child.setAttribute("data-tchmi-creator-target-control",controlId),$(highlighterElement)}createHierarchyControlPosition(relatedControl,zindex){let controlId=relatedControl.getId(),highlighterElement=this.__cloneSource.hierarchyControlPosition.cloneNode(!0);return highlighterElement.setAttribute("data-tchmi-creator-target-control",controlId),highlighterElement.style.zIndex=zindex.toString(),$(highlighterElement)}createOriginalPosition(relatedControl,zindex){let controlId=relatedControl.getId(),highlighterElement=this.__cloneSource.originalPosition.cloneNode(!0);return highlighterElement.setAttribute("data-tchmi-creator-target-control",controlId),highlighterElement.style.zIndex=zindex.toString(),$(highlighterElement)}createAnchorContainer(relatedControl,zindex,locked){let controlId=relatedControl.getId(),highlighterElement=this.__cloneSource.anchorContainer.cloneNode(!0);return highlighterElement.setAttribute("data-tchmi-creator-target-control",controlId),highlighterElement.style.zIndex=zindex.toString(),locked&&highlighterElement.classList.add("tchmi-creator-control-locked"),$(highlighterElement)}createHierarchyAnchorContainer(relatedControl,zindex,locked){let controlId=relatedControl.getId(),highlighterElement=this.__cloneSource.hierarchyAnchorContainer.cloneNode(!0);return highlighterElement.setAttribute("data-tchmi-creator-target-control",controlId),highlighterElement.style.zIndex=zindex.toString(),locked&&highlighterElement.classList.add("tchmi-creator-control-locked"),$(highlighterElement)}createGridHighlighter(gridControl,ctrlMeta){if(!ctrlMeta)return;if(!gridControl.__rowOptions)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeMasterHighlightManager] Grid control "+gridControl.getId()+" has invalid Row Options."));if(!gridControl.__columnOptions)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeMasterHighlightManager] Grid control "+gridControl.getId()+" has invalid Column Options."));const oldGridcells=ctrlMeta.jHierarchyControlposition.children(".tchmi-creator-hierarchy-gridcellposition");oldGridcells.children().detach(),oldGridcells.remove(),ctrlMeta.jControlPosition.children(".tchmi-creator-gridcell").remove();let zIndexControlposition=TcHmi.StyleProvider.getSimpleElementStyle(ctrlMeta.jControlPosition,"z-index"),hierarchyGridcellpositionCollection=$(),gridcellCollection=$(),tempDiv=document.createElement("div");for(let i=0;i<gridControl.__rowOptions.length;i++)for(let j=0;j<gridControl.__columnOptions.length;j++){tempDiv.innerHTML=`<div data-tchmi-creator-target-control="${gridControl.getId()}"\n                                                class="tchmi-creator-hierarchy-gridcellposition tchmi-box"\n                                                style="z-index:${zIndexControlposition["z-index"]}"\n                                                data-tchmi-creator-grid-rowindex="${i}" data-tchmi-creator-grid-cellindex="${j}">\n                                                </div>`;const hierarchyGridcell=$(tempDiv.firstElementChild);hierarchyGridcellpositionCollection=hierarchyGridcellpositionCollection.add(hierarchyGridcell),tempDiv.innerHTML=`<div data-tchmi-creator-target-control="${gridControl.getId()}"\n                                                class="tchmi-creator-gridcell tchmi-box"\n                                                style="z-index:${zIndexControlposition["z-index"]}"\n                                                data-tchmi-creator-grid-rowindex="${i}" data-tchmi-creator-grid-cellindex="${j}">\n                                                </div>`;const highlightGridcell=$(tempDiv.firstElementChild);this.__designerModeManager.hierarchyManager.registerContainerElement(highlightGridcell),gridcellCollection=gridcellCollection.add(highlightGridcell)}ctrlMeta.jHierarchyControlposition.append(hierarchyGridcellpositionCollection),ctrlMeta.jControlPosition.append(gridcellCollection)}}}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){Engineering.DesignerModeMasterRectSelectManager=class{constructor(designerModeManager){this.__rectSelecting=!1,this.__lockRectSelect=!1,this.__documentRectSelectMouseMoveNs="mousemove.DesignerModeManager.DocumentRectSelectMouseMove",this.__documentRectSelectMouseUpNs="mouseup.DesignerModeManager.DocumentRectSelectMouseUp",this.__documentRectSelectMouseDownNs="mousedown.DesignerModeManager.DocumentRectSelectMouseDown",this.__designerModeManager=designerModeManager,this.__selectionDragHighlighter=document.createElement("div"),this.__selectionDragHighlighter.classList.add("tchmi-creator-selection-drag-container"),TcHmi.System.SharedResources.jqDocument.on(this.__documentRectSelectMouseDownNs,this.__onDocumentRectSelectMouseDown())}getRectSelecting(){return this.__rectSelecting}lockRectSelect(){this.__lockRectSelect=!0}resetState(){this.__selectionDragHighlighter.isConnected&&this.__selectionDragHighlighter.remove(),this.__rectSelecting=!1,this.__lockRectSelect=!1,TcHmi.System.SharedResources.jqDocument.off(this.__documentRectSelectMouseMoveNs),TcHmi.System.SharedResources.jqDocument.off(this.__documentRectSelectMouseUpNs)}__onDocumentRectSelectMouseDown(){let __this=this;return function(event){1===event.which&&event.originalEvent?.target!==document.documentElement&&(__this.__designerModeManager.interactionManager?.handleInteractionStart(event,null),__this.__lockRectSelect=!1,TcHmi.System.SharedResources.jqDocument.on(__this.__documentRectSelectMouseMoveNs,__this.__onDocumentRectSelectMouseMove()),TcHmi.System.SharedResources.jqDocument.on(__this.__documentRectSelectMouseUpNs,__this.__onDocumentRectSelectMouseUp()))}}__onDocumentRectSelectMouseMove(){let __this=this;return function(event){if(!(__this.__designerModeManager.rectSelectManager&&__this.__designerModeManager.interactionManager&&__this.__designerModeManager.rootControlManager&&__this.__designerModeManager.hierarchyManager&&__this.__designerModeManager.highlightManager&&__this.__designerModeManager.syncManager&&__this.__designerModeManager.controlMoveManager&&__this.__designerModeManager.controlResizeManager))return;if(void 0===event.pageX||void 0===event.pageY)return;if(1!==event.which)return;if(!0===__this.__designerModeManager.controlMoveManager.getControlMoveActive())return;if(!0===__this.__designerModeManager.controlResizeManager.getControlResizing())return;if(!0===__this.__lockRectSelect)return;const startMousePosition=__this.__designerModeManager.interactionManager.getStartMousePos();let deltaStartLeft=event.pageX-startMousePosition.left,deltaStartTop=event.pageY-startMousePosition.top;if(Math.abs(deltaStartLeft)<=5&&Math.abs(deltaStartTop)<=5)return;let w=0,l=0,h=0,t=0;__this.__designerModeManager.controlMoveManager.setMouseMoving(!0),deltaStartLeft>=0?(w=deltaStartLeft,l=startMousePosition.left):(w=-deltaStartLeft,l=startMousePosition.left+deltaStartLeft),deltaStartTop>=0?(h=deltaStartTop,t=startMousePosition.top):(h=-deltaStartTop,t=startMousePosition.top+deltaStartTop),TcHmi.StyleProvider.setSimpleElementStyle(__this.__selectionDragHighlighter,{width:w+"px",left:l+"px",height:h+"px",top:t+"px","pointer-events":"none"}),__this.__selectionDragHighlighter.parentElement||document.body.appendChild(__this.__selectionDragHighlighter),__this.__rectSelecting=!0,__this.__designerModeManager.controlMoveManager.lockControlMove(),__this.__designerModeManager.controlResizeManager.lockControlResize()}}__onDocumentRectSelectMouseUp(){let __this=this;return function(event){if(!(__this.__designerModeManager.rectSelectManager&&__this.__designerModeManager.interactionManager&&__this.__designerModeManager.rootControlManager&&__this.__designerModeManager.hierarchyManager&&__this.__designerModeManager.highlightManager&&__this.__designerModeManager.syncManager&&__this.__designerModeManager.controlMoveManager&&__this.__designerModeManager.controlResizeManager))return;if(void 0===event.pageX||void 0===event.pageY)return;let resetExistingSelections=!1;1!==event.which?__this.__designerModeManager.controlMoveManager.setMouseMoving(!1):!0===__this.__lockRectSelect&&!1===__this.__rectSelecting||(resetExistingSelections=!__this.__processRectSelect(__this.__selectionDragHighlighter.getBoundingClientRect(),event.ctrlKey??!1,event.altKey??!1),__this.__selectionDragHighlighter.remove(),__this.__designerModeManager.controlMoveManager.setMouseMoving(!1)),resetExistingSelections&&__this.__designerModeManager.unselectEach(!1),__this.resetState()}}__processRectSelect(rectDragSelection,ctrlKeyPressed,altKeyPressed){let res=!1;if(!(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.syncManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager))return res;let selectionHasChanged=!1,isFirstSelect=!0;const controlsToSelect=[],controlsMetaData=this.__designerModeManager.metaDataManager.getControlMetaData();for(let id in controlsMetaData){const ctrlMeta=controlsMetaData[id];if(!1===ctrlMeta.domVisibility||!0===ctrlMeta.controlCollapsed)continue;let bParentalOverride=!1,ctrlParentMeta=ctrlMeta.parent;for(;null!==ctrlParentMeta;){if(!1===ctrlParentMeta.domVisibility||!0===ctrlParentMeta.controlCollapsed){bParentalOverride=!0;break}ctrlParentMeta=ctrlParentMeta.parent}if(!0===bParentalOverride)continue;const tco=TcHmi.Controls.get(ctrlMeta.id);if(!tco)continue;if(!tco.getElement())continue;const controlRect=ctrlMeta.jControlPosition[0].getBoundingClientRect();if(!0===this.__hasClientRectIntersection(controlRect,rectDragSelection,altKeyPressed)){if(!0===ctrlMeta.isPartialRoot)continue;if(res=!0,!0===isFirstSelect&&!1===ctrlKeyPressed){isFirstSelect=!1,this.__designerModeManager.unselectEach(!0)&&(selectionHasChanged=!0)}let activeControl=this.__designerModeManager.controlMoveManager.getActiveControl();if(activeControl&&activeControl.id===ctrlMeta.id&&activeControl.isContainerControl&&ctrlKeyPressed)continue;let skip=!1,temp=activeControl;for(;temp;){if(temp.id===ctrlMeta.id){skip=!0;break}temp=temp.parent}if(skip)continue;controlsToSelect.push(ctrlMeta.id),selectionHasChanged=!0}}return controlsToSelect.forEach((ctrlName=>{this.__designerModeManager.select(ctrlName,!0)})),selectionHasChanged&&this.__designerModeManager.resyncSelectedControls(),res}__hasClientRectIntersection(rc1,rc2,rc1enclosedMode){let rc1l=rc1.left,rc1r=rc1.right,rc1t=rc1.top,rc1b=rc1.bottom,rc2l=rc2.left,rc2r=rc2.right,rc2t=rc2.top,rc2b=rc2.bottom;return!1===rc1enclosedMode?!(rc1l>rc2r||rc1r<rc2l||rc1t>rc2b||rc1b<rc2t):rc1l>rc2l&&rc1r<rc2r&&rc1t>rc2t&&rc1b<rc2b}}}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){Engineering.DesignerModeMasterControlMoveManager=class{constructor(designerModeManager){this.__copyMoveRectHighlightOffset={left:0,top:0},this.__highlightMouseDownNs="mousedown.DesignerModeManager.HighlightMouseDown",this.__highlightMouseUpNs="mouseup.DesignerModeManager.HighlightMouseUp",this.__highlightMouseMoveNs="mousemove.DesignerModeManager.HighlightMouseMove",this.__activeControl=null,this.__activeControlPrev=null,this.__mouseMoving=!1,this.__lockControlMove=!1,this.__controlMoveActive=!1,this.__designerModeManager=designerModeManager,this.__copyMoveRectHighlighter=document.createElement("canvas"),this.__copyMoveRectHighlighter.classList.add("tchmi-creator-copymove-container"),this.__onHighlightMouseUpLastProc=Date.now()}registerControl(ctrlMeta){ctrlMeta.jControlPosition.on(this.__highlightMouseDownNs,this.__onHighlightMouseDown())}getActiveControl(){return this.__activeControl}getActiveControlPrev(){return this.__activeControlPrev}getControlMoveActive(){return this.__controlMoveActive}lockControlMove(){this.__lockControlMove=!0}setMouseMoving(valueNew){this.__mouseMoving=valueNew}resetState(){this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager&&(this.__lockControlMove=!1,this.__controlMoveActive=!1,TcHmi.System.SharedResources.jqDocument.off(this.__highlightMouseMoveNs),TcHmi.System.SharedResources.jqDocument.off(this.__highlightMouseUpNs),document.body.style.cursor="",this.__designerModeManager.hierarchyManager.removeHighlightDropTarget(),this.__copyMoveRectHighlighter.remove(),null!==this.__activeControl&&(this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snaptop"),this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapleft"),this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapbottom"),this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapright"),this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snaptop-remote"),this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapleft-remote"),this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapbottom-remote"),this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapright-remote")))}__onHighlightMouseDown(){let __this=this;return function(event){if(1!==event.which)return;let targetControl=$(event.target).attr("data-tchmi-creator-target-control");if(!targetControl)return;const acNew=__this.__designerModeManager.metaDataManager.getControlMetaData(targetControl);null!==acNew&&(__this.__activeControlPrev=__this.__activeControl,__this.__activeControl=acNew,__this.__designerModeManager.interactionManager&&(__this.__designerModeManager.interactionManager.handleInteractionStart(event,acNew),__this.__designerModeManager.interactionManager.handleInteractionStartCopyMoveOffsetPosition(event),__this.__designerModeManager.interactionManager.setAnchorName(void 0)),__this.__lockControlMove=!1,TcHmi.System.SharedResources.jqDocument.on(__this.__highlightMouseMoveNs,__this.__onHighlightMouseMove()),TcHmi.System.SharedResources.jqDocument.on(__this.__highlightMouseUpNs,__this.__onHighlightMouseUp()))}}__selectedControlsSameParent(preventPointerEvents){if(!this.__activeControl)return null;let selectedControls=[];null===this.__activeControl.parent&&(selectedControls=null);const newCssPointerEvent=preventPointerEvents?"none":"",selectedControlsMeta=this.__designerModeManager.metaDataManager.getSelectedControlsMetaData();for(const ctrlMeta of Object.values(selectedControlsMeta))null!==preventPointerEvents&&(ctrlMeta.jControlPosition[0].style.pointerEvents=newCssPointerEvent,TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jControlPosition[0].querySelectorAll("*"),"pointer-events",newCssPointerEvent),ctrlMeta.jHierarchyControlposition[0].style.pointerEvents=newCssPointerEvent,TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jHierarchyControlposition[0].querySelectorAll("*"),"pointer-events",newCssPointerEvent)),null!==ctrlMeta.parent&&ctrlMeta.parent.id===this.__activeControl.parent.id?selectedControls&&selectedControls.push(ctrlMeta.id):selectedControls=null;return selectedControls}__onHighlightMouseMove(){let __this=this;return function(event){if(null===__this.__activeControl)return;if(!(__this.__designerModeManager.rectSelectManager&&__this.__designerModeManager.interactionManager&&__this.__designerModeManager.rootControlManager&&__this.__designerModeManager.hierarchyManager&&__this.__designerModeManager.highlightManager&&__this.__designerModeManager.controlMoveManager&&__this.__designerModeManager.controlResizeManager))return;if(!0===__this.__designerModeManager.controlResizeManager.getControlResizing())return;if(!0===__this.__activeControl.isPartialRoot)return;if(!0===__this.__designerModeManager.rectSelectManager.getRectSelecting())return;if(!0===__this.__lockControlMove)return;if(void 0===event.pageX||void 0===event.pageY)return;const startMousePosition=__this.__designerModeManager.interactionManager.getStartMousePos(),startMousePositionCopyMoveOffsetPosition=__this.__designerModeManager.interactionManager.getStartMousePosCopyMoveOffsetPosition();let selectedControlsMeta,deltaLeft=event.pageX-startMousePosition.left,deltaTop=event.pageY-startMousePosition.top;if(!0===event.ctrlKey&&__this.__activeControl.isContainerControl&&deltaLeft<10&&deltaTop<10){let temp=__this.__activeControl;for(;temp;)__this.__designerModeManager.unselect(temp.id,!0),temp=temp.parent;return}if(1!==event.which)return void __this.resetState();let iterateMeta=__this.__activeControl;do{if(!0===iterateMeta.locked)return;iterateMeta=iterateMeta.parent}while(iterateMeta);if(!1===__this.__mouseMoving){if(!1===event.ctrlKey&&!1===__this.__activeControl.isSelected){selectedControlsMeta=__this.__designerModeManager.metaDataManager.getSelectedControlsMetaData();for(let id in selectedControlsMeta){let ctrlMeta=selectedControlsMeta[id];null!==ctrlMeta&&null!==__this.__activeControl&&ctrlMeta.id!==__this.__activeControl.id&&__this.__designerModeManager.unselect(ctrlMeta.id,!0)}}__this.__designerModeManager.select(__this.__activeControl.id,!0)}let directionLock="none";if(0!==deltaLeft||0!==deltaTop){if(__this.__mouseMoving=!0,!0===event.shiftKey&&(Math.abs(deltaLeft)>Math.abs(deltaTop)?(deltaTop=0,directionLock="topBottom"):(deltaLeft=0,directionLock="leftRight")),__this.__controlMoveActive=!0,__this.__designerModeManager.rectSelectManager.lockRectSelect(),!1===event.ctrlKey){const creatorZoomFactor=__this.__designerModeManager.rootControlManager.getCreatorZoomFactor();let snappedDelta=__this.__designerModeManager.interactionManager.handleSnapping(__this.__activeControl,{left:deltaLeft/creatorZoomFactor,top:deltaTop/creatorZoomFactor},{left:event.pageX,top:event.pageY},!event.altKey,directionLock);__this.__copyMoveRectHighlighter.parentElement&&(document.body.style.cursor="",__this.__copyMoveRectHighlighter.remove());const ctrlList=[];selectedControlsMeta=__this.__designerModeManager.metaDataManager.getSelectedControlsMetaData();for(let id in selectedControlsMeta){const ctrlMeta=selectedControlsMeta[id];if(!0===ctrlMeta.isPartialRoot)continue;__this.__processMove(ctrlMeta,snappedDelta);const tco=TcHmi.Controls.get(ctrlMeta.id);tco&&ctrlList.push(tco)}__this.__designerModeManager.hierarchyManager.removeHighlightDropTarget();if(null!==__this.__selectedControlsSameParent(!0)){const currentDropTarget=__this.__designerModeManager.hierarchyManager.getContainerFromPoint({left:event.pageX,top:event.pageY});if(currentDropTarget){let tco=TcHmi.Controls.get(__this.__activeControl.id);const parentId=__this.__activeControl.parent?__this.__activeControl.parent.id:"";tco&&(!0!==event.altKey&&parentId!==currentDropTarget.tco.getId()?(__this.__designerModeManager.hierarchyManager.addHighlightDropTarget({left:event.pageX,top:event.pageY},event.target),__this.__activeControl.jControlPosition[0].classList.add("tchmi-creator-will-get-new-parent"),__this.__activeControl.jOriginalPosition[0].classList.add("tchmi-creator-will-get-new-parent")):!0===event.altKey||!__this.__activeControl.parent?.isGridControl||currentDropTarget.columnIndex===tco.getGridColumnIndex()&&currentDropTarget.rowIndex===tco.getGridRowIndex()?(__this.__activeControl.jControlPosition[0].classList.remove("tchmi-creator-will-get-new-parent"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-will-get-new-parent")):(__this.__designerModeManager.hierarchyManager.addHighlightDropTarget({left:event.pageX,top:event.pageY},event.target),__this.__activeControl.jControlPosition[0].classList.add("tchmi-creator-will-get-new-parent"),__this.__activeControl.jOriginalPosition[0].classList.add("tchmi-creator-will-get-new-parent")))}}__this.__designerModeManager.highlightManager.setContainerPositions(new Set(ctrlList)),__this.__selectedControlsSameParent(!1)}else if(Math.abs(deltaLeft)>=5&&Math.abs(deltaTop)>=5)if(__this.__copyMoveRectHighlighter.parentElement){let startMouseOffsetTop=startMousePosition.top-startMousePositionCopyMoveOffsetPosition.top,startMouseOffsetLeft=startMousePosition.left-startMousePositionCopyMoveOffsetPosition.left;__this.__copyMoveRectHighlighter.style.top=__this.__copyMoveRectHighlightOffset.top+deltaTop+window.scrollY+startMouseOffsetTop+"px",__this.__copyMoveRectHighlighter.style.left=__this.__copyMoveRectHighlightOffset.left+deltaLeft+window.scrollX+startMouseOffsetLeft+"px",__this.__designerModeManager.hierarchyManager.addHighlightDropTarget({left:event.pageX,top:event.pageY},event.target)}else{__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snaptop"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapleft"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapbottom"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapright"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snaptop-remote"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapleft-remote"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapbottom-remote"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapright-remote");let combinedBounding={top:Number.POSITIVE_INFINITY,left:Number.POSITIVE_INFINITY,rightside:Number.NEGATIVE_INFINITY,bottomside:Number.NEGATIVE_INFINITY},validSelection=!0;null===__this.__activeControl.parent&&(validSelection=!1);let controlOutlineList=[];selectedControlsMeta=__this.__designerModeManager.metaDataManager.getSelectedControlsMetaData();const ctrlList=[];for(let id in selectedControlsMeta){const ctrlMeta=selectedControlsMeta[id];if(__this.__processMove(ctrlMeta,{left:0,top:0}),TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jControlPosition,"pointer-events","none"),!1===validSelection)continue;if(null===ctrlMeta.parent){validSelection=!1;continue}if(ctrlMeta.parent.id!==__this.__activeControl.parent.id){validSelection=!1;continue}let ctrlBB=ctrlMeta.jControlPosition[0].getBoundingClientRect();combinedBounding.top>ctrlBB.top&&(combinedBounding.top=ctrlBB.top),combinedBounding.left>ctrlBB.left&&(combinedBounding.left=ctrlBB.left),combinedBounding.bottomside<ctrlBB.top+ctrlBB.height&&(combinedBounding.bottomside=ctrlBB.top+ctrlBB.height),combinedBounding.rightside<ctrlBB.left+ctrlBB.width&&(combinedBounding.rightside=ctrlBB.left+ctrlBB.width),controlOutlineList.push({top:ctrlBB.top,left:ctrlBB.left,height:ctrlBB.height,width:ctrlBB.width});const tco=TcHmi.Controls.get(ctrlMeta.id);tco&&ctrlList.push(tco)}if(__this.__designerModeManager.highlightManager.setContainerPositions(new Set(ctrlList)),__this.__designerModeManager.interactionManager.handleInteractionStartCopyMoveOffsetPosition(event),__this.__designerModeManager.hierarchyManager.addHighlightDropTarget({left:event.pageX,top:event.pageY},event.target),!1===validSelection)document.body.style.cursor="no-drop";else{document.body.style.cursor="copy",__this.__copyMoveRectHighlightOffset.top=combinedBounding.top,__this.__copyMoveRectHighlightOffset.left=combinedBounding.left;let pageBoundingTop=combinedBounding.top+deltaTop+window.scrollY,pageBoundingLeft=combinedBounding.left+deltaLeft+window.scrollX,boundingHeight=combinedBounding.bottomside-combinedBounding.top,boundingWidth=combinedBounding.rightside-combinedBounding.left;__this.__copyMoveRectHighlighter.width=boundingWidth,__this.__copyMoveRectHighlighter.height=boundingHeight,__this.__copyMoveRectHighlighter.style.cssText="top:"+pageBoundingTop+"px;left:"+pageBoundingLeft+"px;height:"+boundingHeight+"px;width:"+boundingWidth+"px;";const ctx=__this.__copyMoveRectHighlighter.getContext("2d");if(ctx){ctx.strokeStyle="gray";for(let ctrlOutline of controlOutlineList)void 0!==ctrlOutline.left&&void 0!==ctrlOutline.top&&void 0!==ctrlOutline.width&&void 0!==ctrlOutline.height&&ctx.strokeRect(ctrlOutline.left+window.scrollX+deltaLeft-pageBoundingLeft,ctrlOutline.top+window.scrollY+deltaTop-pageBoundingTop,ctrlOutline.width,ctrlOutline.height);document.body.appendChild(__this.__copyMoveRectHighlighter)}}for(let id in selectedControlsMeta){const ctrlMeta=selectedControlsMeta[id];TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jControlPosition,"pointer-events","")}}}else __this.__designerModeManager.rectSelectManager.lockRectSelect()}}__processMove(ctrlMeta,delta){if(!(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager&&ctrlMeta.controlAttributeDimension&&void 0!==ctrlMeta.absoluteParentRotation&&void 0!==ctrlMeta.relativeControlRotation))return;let deltaLeft=delta.left,deltaTop=delta.top,iterateMeta=ctrlMeta,breakLoop=!1;do{if(!0===iterateMeta.locked){breakLoop=!0;break}iterateMeta=iterateMeta.parent}while(iterateMeta);if(!0===breakLoop)return;const tco=TcHmi.Controls.get(ctrlMeta.id);if(!tco)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(`Failed to move control "${ctrlMeta.id}": Not found in control cache.\n`));let parental_lock=!1,jParentControls=tco.getElement().parents("[data-tchmi-type]");const selectedControlIdsWithChildren=this.__designerModeManager.metaDataManager.getSelectedControlIdsWithChildren();for(let k=0,kk=jParentControls.length;k<kk;k++)if(selectedControlIdsWithChildren.includes(jParentControls[k].id)){parental_lock=!0;break}if(!0===parental_lock)return;let potentialNewSize,parentDimension=null,newStyle={};null!==ctrlMeta.controlAttributeDimension.topValue&&("%"!==ctrlMeta.controlAttributeDimension.topUnit?(potentialNewSize=ctrlMeta.controlAttributeDimension.topValue+Math.sin(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft+Math.cos(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop,newStyle.top=Math.round(potentialNewSize)+"px"):(null===parentDimension&&(parentDimension=tco.getElement().parent().outerHeight()??1),potentialNewSize=ctrlMeta.controlAttributeDimension.topValue+100*(+Math.sin(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft+Math.cos(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop)/parentDimension,newStyle.top=potentialNewSize+"%")),null!==ctrlMeta.controlAttributeDimension.bottomValue&&("%"!==ctrlMeta.controlAttributeDimension.bottomUnit?(potentialNewSize=ctrlMeta.controlAttributeDimension.bottomValue-Math.sin(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft-Math.cos(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop,newStyle.bottom=Math.round(potentialNewSize)+"px"):(null===parentDimension&&(parentDimension=tco.getElement().parent().outerHeight()??1),potentialNewSize=ctrlMeta.controlAttributeDimension.bottomValue+100*(-Math.sin(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft-Math.cos(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop)/parentDimension,newStyle.bottom=potentialNewSize+"%")),null===ctrlMeta.controlAttributeDimension.topValue&&null===ctrlMeta.controlAttributeDimension.bottomValue&&(newStyle.top=Math.round(Math.sin(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft+Math.cos(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop)+"px"),parentDimension=null,null!==ctrlMeta.controlAttributeDimension.leftValue&&("%"!==ctrlMeta.controlAttributeDimension.leftUnit?(potentialNewSize=ctrlMeta.controlAttributeDimension.leftValue+Math.cos(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft+Math.sin(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop,newStyle.left=Math.round(potentialNewSize)+"px"):(null===parentDimension&&(parentDimension=tco.getElement().parent().outerWidth()??1),potentialNewSize=ctrlMeta.controlAttributeDimension.leftValue+100*(+Math.cos(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft+Math.sin(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop)/parentDimension,newStyle.left=potentialNewSize+"%")),null!==ctrlMeta.controlAttributeDimension.rightValue&&("%"!==ctrlMeta.controlAttributeDimension.rightUnit?(potentialNewSize=ctrlMeta.controlAttributeDimension.rightValue-Math.cos(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft-Math.sin(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop,newStyle.right=Math.round(potentialNewSize)+"px"):(null===parentDimension&&(parentDimension=tco.getElement().parent().outerWidth()??1),potentialNewSize=ctrlMeta.controlAttributeDimension.rightValue+100*(-Math.cos(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft-Math.sin(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop)/parentDimension,newStyle.right=potentialNewSize+"%")),null===ctrlMeta.controlAttributeDimension.leftValue&&null===ctrlMeta.controlAttributeDimension.rightValue&&(newStyle.left=Math.round(Math.cos(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft+Math.sin(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop)+"px"),TcHmi.StyleProvider.setSimpleElementStyle(tco.getElement(),newStyle),this.__designerModeManager.metaDataManager.addChangedControlsMetaData(ctrlMeta);const tcoParent=tco.getParent();if(tcoParent&&ctrlMeta.parent&&!0===ctrlMeta.parent.isGridControl){const setWithParent=new Set;setWithParent.add(tcoParent),this.__designerModeManager.highlightManager.setContainerPositions(setWithParent)}}__onHighlightMouseUp(){let __this=this;return function(event){if(!(__this.__designerModeManager.rectSelectManager&&__this.__designerModeManager.interactionManager&&__this.__designerModeManager.rootControlManager&&__this.__designerModeManager.hierarchyManager&&__this.__designerModeManager.highlightManager&&__this.__designerModeManager.syncManager&&__this.__designerModeManager.controlMoveManager&&__this.__designerModeManager.controlResizeManager))return;if(void 0===event.pageX||void 0===event.pageY)return;const ac=__this.__activeControl,acPrev=__this.__activeControlPrev;if(!ac||!ac.controlAttributeDimension||void 0===ac.absoluteParentRotation||void 0===ac.relativeControlRotation)return;let selectedControlsMeta={};if(1!==event.which){if(3===event.which&&!0===__this.__controlMoveActive){selectedControlsMeta=__this.__designerModeManager.metaDataManager.getSelectedControlsMetaData();const controlMap=TcHmi.System.Services.controlManager.getControlsCache();for(let id in selectedControlsMeta){const ctrlMeta=selectedControlsMeta[id];if(!0===ctrlMeta.isPartialRoot)continue;__this.__processMove(ctrlMeta,{left:0,top:0});const control=controlMap.get(id);control&&__this.__designerModeManager.highlightManager.requestAsyncHighlighterUpdateForControl(control)}}return void __this.resetState()}if(!0===__this.__lockControlMove&&!0===__this.__designerModeManager.rectSelectManager.getRectSelecting())return void __this.resetState();if(null===__this.__activeControl)return __this.__mouseMoving=!1,void __this.resetState();!1===__this.__mouseMoving&&(!1===event.ctrlKey&&!1===ac.isSelected&&__this.__designerModeManager.unselectEach(!0),__this.__designerModeManager.select(ac.id,!0),__this.__designerModeManager.rectSelectManager.lockRectSelect());const startMousePosition=__this.__designerModeManager.interactionManager.getStartMousePos(),deltaLeft=event.pageX-startMousePosition.left,deltaTop=event.pageY-startMousePosition.top;let interactionState=0;null!=acPrev&&ac.id===acPrev.id&&Math.abs(deltaLeft)<5&&Math.abs(deltaTop)<5&&Date.now()-__this.__onHighlightMouseUpLastProc<=500&&(interactionState=3),__this.__onHighlightMouseUpLastProc=Date.now();let activeTco=TcHmi.Controls.get(__this.__activeControl.id);if(3===interactionState&&event.ctrlKey&&activeTco){let module=TcHmi.System.Data.Modules.controls.map.get(activeTco.getType());module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded&&!module.descriptionExpanded.defaultDesignerEvent&&(interactionState=0)}if(3===interactionState)activeTco&&new Engineering.SyncCmdToCreatorControlDoubleClick({name:"ControlDoubleClick",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",targetPartial:TCHMI_TARGET_PARTIAL,targetControl:{id:ac.id,type:activeTco.getType()},replyTo:null}).send();else{let command;!0===event.ctrlKey&&!__this.__mouseMoving&&ac.isSelectedPrev&&ac.isSelected&&__this.__designerModeManager.unselect(ac.id,!0),!0===event.ctrlKey&&(Math.abs(deltaLeft)>5||Math.abs(deltaTop)>5)?interactionState=2:!0!==event.altKey&&(Math.abs(deltaLeft)>5||Math.abs(deltaTop)>5)&&(interactionState=1),null===ac.parent&&(interactionState=0);let dropConfig,controls=null;if(0!==interactionState&&(controls=__this.__selectedControlsSameParent(!0),dropConfig=__this.__designerModeManager.hierarchyManager.getContainerFromPoint({left:event.pageX,top:event.pageY}),__this.__selectedControlsSameParent(!1),null===controls&&(interactionState=0)),controls&&dropConfig){if(2===interactionState)command={name:"CopyMoveControls",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",targetPartial:TCHMI_TARGET_PARTIAL,deltaPosition:{left:null,top:null},controls:controls,targetParentControl:dropConfig.tco.getId(),replyTo:null};else if(1===interactionState&&(command={name:"HierarchyMoveControls",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",targetPartial:TCHMI_TARGET_PARTIAL,deltaPosition:{left:null,top:null},controls:controls,targetParentControl:dropConfig.tco.getId(),replyTo:null},controls.includes(dropConfig.tco.getId())))return __this.__mouseMoving=!1,void __this.resetState();if(0!==interactionState&&activeTco){null===dropConfig.rowIndex&&(dropConfig.rowIndex=0),null===dropConfig.columnIndex&&(dropConfig.columnIndex=0);let oldRowIndex=activeTco.getGridRowIndex(),oldColumnIndex=activeTco.getGridColumnIndex();1===interactionState&&dropConfig.rowIndex===oldRowIndex&&dropConfig.columnIndex===oldColumnIndex&&dropConfig.tco===activeTco.getParent()?interactionState=0:!command||dropConfig.rowIndex===oldRowIndex&&dropConfig.columnIndex===oldColumnIndex||(command.attributes=[{name:"data-tchmi-grid-row-index",value:dropConfig.rowIndex},{name:"data-tchmi-grid-column-index",value:dropConfig.columnIndex}])}if(0!==interactionState&&null!==ac.parent&&null!==ac.controlAttributeDimension.topValue&&"px"===ac.controlAttributeDimension.topUnit&&null!==ac.controlAttributeDimension.heightValue&&"px"===ac.controlAttributeDimension.heightUnit&&"Value"===ac.controlAttributeDimension.heightMode&&0===ac.absoluteParentRotation&&dropConfig.jHighlighter&&command){let acBCR=ac.jOriginalPosition.parent()[0].getBoundingClientRect(),targetBCR=dropConfig.jHighlighter[0].getBoundingClientRect();command.deltaPosition.top=Math.round(deltaTop+(acBCR.top-targetBCR.top))}if(0!==interactionState&&null!==ac.parent&&null!==ac.controlAttributeDimension.leftValue&&"px"===ac.controlAttributeDimension.leftUnit&&null!==ac.controlAttributeDimension.widthValue&&"px"===ac.controlAttributeDimension.widthUnit&&"Value"===ac.controlAttributeDimension.widthMode&&dropConfig.jHighlighter&&command&&0===ac.absoluteParentRotation){let acBCR=ac.jOriginalPosition.parent()[0].getBoundingClientRect(),targetBCR=dropConfig.jHighlighter[0].getBoundingClientRect();command.deltaPosition.left=Math.round(deltaLeft+(acBCR.left-targetBCR.left))}}if(2===interactionState&&command&&"CopyMoveControls"===command.name)new Engineering.SyncCmdToCreatorCopyMoveControls(command).send(),__this.__designerModeManager.metaDataManager.resetChangedControlsMetaData();else if(1===interactionState&&command&&"HierarchyMoveControls"===command.name)new Engineering.SyncCmdToCreatorHierarchyMoveControls(command).send(),__this.__designerModeManager.metaDataManager.resetChangedControlsMetaData();else if(0===interactionState&&activeTco){const ctrlList=[],hierarchy=TcHmi.System.resolveControlHierarchy(activeTco,null),hierarchyRecursion=function(h){for(let i=0,ii=h.children_hierarchy.length;i<ii;i++){let childHierarchy=h.children_hierarchy[i];ctrlList.push(childHierarchy.ctrl),hierarchyRecursion(childHierarchy)}};hierarchyRecursion(hierarchy),__this.__designerModeManager.highlightManager.setContainerPositions(new Set(ctrlList)),__this.__controlMoveActive=!1,__this.__designerModeManager.syncManager.updatePcElementAndSync("System.onControlPositionParameterChanged"),__this.__designerModeManager.resyncSelectedControls(),__this.__designerModeManager.resyncControls()}}__this.__mouseMoving=!1,__this.resetState()}}}}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){Engineering.DesignerModeMasterControlResizeManager=class{constructor(designerModeManager){this.__anchorMouseMoveNs="mousemove.DesignerModeManager.AnchorMouseMove",this.__anchorMouseUpNs="mouseup.DesignerModeManager.AnchorMouseUp",this.__anchorMouseDownNs="mousedown.DesignerModeManager.AnchorMouseDown",this.__lockControlResize=!1,this.__controlResizing=!1,this.__activeControl=null,this.__designerModeManager=designerModeManager}registerControl(ctrlMeta){ctrlMeta.jAnchorContainer.children(".tchmi-creator-anchor-rect").on(this.__anchorMouseDownNs,this.__onAnchorMouseDown())}getControlResizing(){return this.__controlResizing}lockControlResize(){this.__lockControlResize=!0}__onAnchorMouseDown(){let __this=this;return function(event){if(!(__this.__designerModeManager.rectSelectManager&&__this.__designerModeManager.interactionManager&&__this.__designerModeManager.rootControlManager&&__this.__designerModeManager.hierarchyManager&&__this.__designerModeManager.highlightManager&&__this.__designerModeManager.syncManager&&__this.__designerModeManager.controlMoveManager&&__this.__designerModeManager.controlResizeManager))return;if(void 0===event.pageX||void 0===event.pageY)return;if(1!==event.which)return;let targetControl=$(event.target).parent().attr("data-tchmi-creator-target-control");if(!targetControl)return;if(__this.__activeControl=__this.__designerModeManager.metaDataManager.getControlMetaData(targetControl),null===__this.__activeControl)return;const anchor=$(event.target).attr("data-tchmi-creator-anchor-name");__this.__designerModeManager.interactionManager.setAnchorName(anchor),anchor&&(__this.__designerModeManager.interactionManager.handleInteractionStart(event,__this.__activeControl),__this.__lockControlResize=!1,TcHmi.System.SharedResources.jqDocument.on(__this.__anchorMouseMoveNs,__this.__onAnchorMouseMove()),TcHmi.System.SharedResources.jqDocument.on(__this.__anchorMouseUpNs,__this.__onAnchorMouseUp()))}}__onAnchorMouseMove(){let __this=this;return function(event){if(!(__this.__designerModeManager.rectSelectManager&&__this.__designerModeManager.interactionManager&&__this.__designerModeManager.rootControlManager&&__this.__designerModeManager.hierarchyManager&&__this.__designerModeManager.highlightManager&&__this.__designerModeManager.syncManager&&__this.__designerModeManager.controlMoveManager&&__this.__designerModeManager.controlResizeManager))return;if(void 0===event.pageX||void 0===event.pageY)return;if(null===__this.__activeControl)return;if(!0===__this.__designerModeManager.rectSelectManager.getRectSelecting())return;if(!0===__this.__lockControlResize)return;const activeAnchor=__this.__designerModeManager.interactionManager.getAnchorName();if(!activeAnchor)return;if(1!==event.which)return TcHmi.System.SharedResources.jqDocument.off(__this.__anchorMouseMoveNs),TcHmi.System.SharedResources.jqDocument.off(__this.__anchorMouseUpNs),__this.__controlResizing=!1,void __this.__designerModeManager.rectSelectManager.resetState();let iterateMeta=__this.__activeControl;do{if(!0===iterateMeta.locked)return;iterateMeta=iterateMeta.parent}while(iterateMeta);__this.__controlResizing=!0,__this.__designerModeManager.rectSelectManager.lockRectSelect();const startMousePosition=__this.__designerModeManager.interactionManager.getStartMousePos(),positionInsideControl=__this.__designerModeManager.interactionManager.getPositionInsideControl(),deltaLeft=event.pageX-startMousePosition.left;let deltaTop=event.pageY-startMousePosition.top,snapControls=!event.altKey;!0===event.shiftKey&&0!==positionInsideControl.width&&("TopLeft"===activeAnchor||"BottomRight"===activeAnchor?(deltaTop=deltaLeft*(positionInsideControl.height/positionInsideControl.width),snapControls=!1):"TopRight"!==activeAnchor&&"BottomLeft"!==activeAnchor||(deltaTop=-deltaLeft*(positionInsideControl.height/positionInsideControl.width),snapControls=!1));const creatorZoomFactor=__this.__designerModeManager.rootControlManager.getCreatorZoomFactor(),selectedControlsMeta=__this.__designerModeManager.metaDataManager.getSelectedControlsMetaData(),snappedDelta=__this.__designerModeManager.interactionManager.handleSnapping(__this.__activeControl,{left:deltaLeft/creatorZoomFactor,top:deltaTop/creatorZoomFactor},{left:event.pageX,top:event.pageY},snapControls,"none");for(let id in selectedControlsMeta){const ctrlMeta=selectedControlsMeta[id];__this.__processResize(ctrlMeta,snappedDelta,activeAnchor),ctrlMeta.isPartialRoot&&__this.__designerModeManager.rootControlManager.setCreatorViewPortPosition(TcHmi.Controls.get(ctrlMeta.id))}}}__processResize(ctrlMeta,delta,anchor){if(!(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.syncManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager&&ctrlMeta.controlAttributeDimension&&void 0!==ctrlMeta.absoluteParentRotation&&void 0!==ctrlMeta.relativeControlRotation))return;let iterateMeta=ctrlMeta,breakLoop=!1;do{if(!0===iterateMeta.locked){breakLoop=!0;break}iterateMeta=iterateMeta.parent}while(iterateMeta);if(!0===breakLoop)return;const tco=TcHmi.Controls.get(ctrlMeta.id);if(!tco)return;let transDeltaTop=Math.sin(-ctrlMeta.absoluteParentRotation*Math.PI/180)*delta.left+Math.cos(-ctrlMeta.absoluteParentRotation*Math.PI/180)*delta.top,transDeltaLeft=Math.cos(ctrlMeta.absoluteParentRotation*Math.PI/180)*delta.left+Math.sin(ctrlMeta.absoluteParentRotation*Math.PI/180)*delta.top;const ctrlRect=this.__getResizedRect(ctrlMeta,anchor,transDeltaLeft,transDeltaTop);let newStyle={};null!==ctrlRect.heightValue&&"Parent"!==ctrlRect.heightMode&&(newStyle.height=ctrlRect.heightValue+ctrlRect.heightUnit),null!==ctrlRect.widthValue&&"Parent"!==ctrlRect.widthMode&&(newStyle.width=ctrlRect.widthValue+ctrlRect.widthUnit),null!==ctrlRect.leftValue&&(newStyle.left=ctrlRect.leftValue+ctrlRect.leftUnit),null!==ctrlRect.topValue&&(newStyle.top=ctrlRect.topValue+ctrlRect.topUnit),null!==ctrlRect.rightValue&&(newStyle.right=ctrlRect.rightValue+ctrlRect.rightUnit),null!==ctrlRect.bottomValue&&(newStyle.bottom=ctrlRect.bottomValue+ctrlRect.bottomUnit),null===ctrlRect.leftValue&&null===ctrlRect.rightValue&&(newStyle.left="0"),null===ctrlRect.topValue&&null===ctrlRect.bottomValue&&(newStyle.top="0"),TcHmi.StyleProvider.setSimpleElementStyle(tco.getElement(),newStyle),this.__designerModeManager.metaDataManager.addChangedControlsMetaData(ctrlMeta);const tcoParent=tco.getParent();if(tcoParent&&ctrlMeta.parent&&!0===ctrlMeta.parent.isGridControl){const setWithParent=new Set;setWithParent.add(tcoParent),this.__designerModeManager.highlightManager.setContainerPositions(setWithParent)}const ctrlList=[];ctrlList.push(tco);const activeControl=TcHmi.Controls.get(this.__activeControl?.id);if(null!==this.__activeControl&&void 0!==activeControl){const hierarchyRecursion=function(h){for(let j=0,jj=h.children_hierarchy.length;j<jj;j++){const childHierarchy=h.children_hierarchy[j];ctrlList.push(childHierarchy.ctrl),hierarchyRecursion(childHierarchy)}};if(activeControl){const hierarchy=TcHmi.System.resolveControlHierarchy(activeControl,null);hierarchyRecursion(hierarchy),this.__designerModeManager.highlightManager.setContainerPositions(new Set(ctrlList))}}this.__designerModeManager.metaDataManager.addChangedControlsMetaData(ctrlMeta)}__getResizedRectRotationOffset(startWidth,startHeight,deltaWidth,deltaHeight,radians,sin,cos){if(0===radians)return{left:0,top:0};null==sin&&(sin=Math.sin(radians)),null==cos&&(cos=Math.cos(radians));const startWidthNum=startWidth??0,startHeightNum=startHeight??0;let xOrig=-startWidthNum/2,yOrig=startHeightNum/2,xRot=-(startWidthNum+deltaWidth)/2,yRot=(startHeightNum+deltaHeight)/2;return{left:yRot*sin+xRot*cos-xRot-(yOrig*sin+xOrig*cos-xOrig),top:yRot*cos-xRot*sin-yRot-(yOrig*cos-xOrig*sin-yOrig)}}__getResizedRect(ctrlMeta,anchorType,deltaLeft,deltaTop){if(!(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.syncManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager&&ctrlMeta.controlAttributeDimension&&ctrlMeta.controlCssPixelDimension&&void 0!==ctrlMeta.absoluteParentRotation&&void 0!==ctrlMeta.relativeControlRotation))return ctrlMeta.controlAttributeDimension;const angle=ctrlMeta.relativeControlRotation;let parentPixelHeight,parentPixelWidth,positionInsideControl;if(ctrlMeta.isPartialRoot){const viewPortContainer=this.__designerModeManager.rootControlManager.getViewPortSimulator();parentPixelHeight=viewPortContainer.outerHeight()??1,parentPixelWidth=viewPortContainer.outerWidth()??1,positionInsideControl=this.__designerModeManager.interactionManager.getPositionInsideControl()}else parentPixelHeight=ctrlMeta.jControlPosition.parent().outerHeight()??1,parentPixelWidth=ctrlMeta.jControlPosition.parent().outerWidth()??1,positionInsideControl={top:0,left:0,width:0,height:0};let resizedRect=tchmi_clone_object(ctrlMeta.controlAttributeDimension);const radians=angle*Math.PI/180,sinAlpha=Math.sin(radians),cosAlpha=Math.cos(radians);let offset,deltaHeight=-sinAlpha*deltaLeft+cosAlpha*deltaTop,deltaWidth=cosAlpha*deltaLeft+sinAlpha*deltaTop;switch(anchorType){case"TopLeft":if(offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha),null!==resizedRect.widthValue){if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue>translatedMaxWidthValue&&(resizedRect.widthValue=translatedMaxWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue/parentPixelWidth*100)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue<translatedMinWidthValue&&(resizedRect.widthValue=translatedMinWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue/parentPixelWidth*100)}if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue-deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.widthValue-resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue-deltaWidth>=translatedMaxWidthValue&&(deltaWidth=resizedRect.widthValue-translatedMaxWidthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue-deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=translatedWidthValue-resizedRect.maxWidthValue)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue-deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.widthValue-resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue-deltaWidth<=translatedMinWidthValue&&(deltaWidth=resizedRect.widthValue-translatedMinWidthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue-deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=translatedWidthValue-resizedRect.minWidthValue)}"%"!==resizedRect.widthUnit?resizedRect.widthValue-deltaWidth<=0&&(deltaWidth=resizedRect.widthValue):resizedRect.widthValue-100*deltaWidth/parentPixelWidth<=0&&(deltaWidth=resizedRect.widthValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.widthValue&&null!==resizedRect.leftValue&&null!==resizedRect.rightValue){let dummyLeft=resizedRect.leftValue;"%"!==resizedRect.leftUnit?dummyLeft+=-(offset.left-deltaWidth):(dummyLeft+=100*-(offset.left-deltaWidth)/parentPixelWidth,dummyLeft=parentPixelWidth*(dummyLeft/100));let dummyRight=resizedRect.rightValue;"%"!==resizedRect.rightUnit?dummyRight+=offset.left:(dummyRight+=100*offset.left/parentPixelWidth,dummyRight=parentPixelWidth*(dummyRight/100)),dummyLeft+dummyRight>=parentPixelWidth&&(deltaWidth=ctrlMeta.controlCssPixelDimension.width??0,offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha))}if(null!==resizedRect.heightValue){if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue>translatedMaxHeightValue&&(resizedRect.heightValue=translatedMaxHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue/parentPixelHeight*100)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue<translatedMinHeightValue&&(resizedRect.heightValue=translatedMinHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue/parentPixelHeight*100)}if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue-deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.heightValue-resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue-deltaHeight>=translatedMaxHeightValue&&(deltaHeight=resizedRect.heightValue-translatedMaxHeightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue-deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=translatedHeightValue-resizedRect.maxHeightValue)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue-deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.heightValue-resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue-deltaHeight<=translatedMinHeightValue&&(deltaHeight=resizedRect.heightValue-translatedMinHeightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue-deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=translatedHeightValue-resizedRect.minHeightValue)}"%"!==resizedRect.heightUnit?resizedRect.heightValue-deltaHeight<=0&&(deltaHeight=resizedRect.heightValue):100*-deltaHeight/parentPixelHeight<=0&&(deltaHeight=resizedRect.heightValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.heightValue&&null!==resizedRect.topValue&&null!==resizedRect.bottomValue){let dummyTop=resizedRect.topValue;"%"!==resizedRect.topUnit?dummyTop+=-(-offset.top-deltaHeight):(dummyTop+=100*-(-offset.top-deltaHeight)/parentPixelHeight,dummyTop=parentPixelHeight*(dummyTop/100));let dummyBottom=resizedRect.bottomValue;"%"!==resizedRect.bottomUnit?dummyBottom+=-offset.top:(dummyBottom+=100*-offset.top/parentPixelHeight,dummyBottom=parentPixelHeight*(dummyBottom/100)),dummyTop+dummyBottom>=parentPixelHeight&&(deltaHeight=ctrlMeta.controlCssPixelDimension.height??0,offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha))}null!==resizedRect.widthValue?"%"!==resizedRect.widthUnit?resizedRect.widthValue+=-deltaWidth:resizedRect.widthValue+=100*-deltaWidth/parentPixelWidth:(null===resizedRect.leftValue&&null!==resizedRect.rightValue||null!==resizedRect.leftValue&&null===resizedRect.rightValue)&&("%"!==resizedRect.widthUnit?resizedRect.widthValue=(ctrlMeta.controlCssPixelDimension.width??0)-deltaWidth:resizedRect.widthValue=(ctrlMeta.controlCssPixelDimension.width??0)/parentPixelWidth*100-100*deltaWidth/parentPixelWidth),null!==resizedRect.heightValue?"%"!==resizedRect.heightUnit?resizedRect.heightValue+=-deltaHeight:resizedRect.heightValue+=100*-deltaHeight/parentPixelHeight:(null===resizedRect.topValue&&null!==resizedRect.bottomValue||null!==resizedRect.topValue&&null===resizedRect.bottomValue)&&("%"!==resizedRect.heightUnit?resizedRect.heightValue=(ctrlMeta.controlCssPixelDimension.height??0)-deltaHeight:resizedRect.heightValue=(ctrlMeta.controlCssPixelDimension.height??0)/parentPixelHeight*100-100*deltaHeight/parentPixelHeight),null!==resizedRect.leftValue&&("%"!==resizedRect.leftUnit?resizedRect.leftValue+=-(offset.left-deltaWidth):resizedRect.leftValue+=100*-(offset.left-deltaWidth)/parentPixelWidth),null!==resizedRect.topValue&&("%"!==resizedRect.topUnit?resizedRect.topValue+=-(-offset.top-deltaHeight):resizedRect.topValue+=100*-(-offset.top-deltaHeight)/parentPixelHeight),null!==resizedRect.rightValue&&("%"!==resizedRect.rightUnit?resizedRect.rightValue+=offset.left:resizedRect.rightValue+=100*offset.left/parentPixelWidth),null!==resizedRect.bottomValue&&("%"!==resizedRect.bottomUnit?resizedRect.bottomValue+=-offset.top:resizedRect.bottomValue+=100*-offset.top/parentPixelHeight);break;case"TopCenter":if(offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,0,deltaHeight,radians,sinAlpha,cosAlpha),null!==resizedRect.heightValue){if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue>translatedMaxHeightValue&&(resizedRect.heightValue=translatedMaxHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue/parentPixelHeight*100)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue<translatedMinHeightValue&&(resizedRect.heightValue=translatedMinHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue/parentPixelHeight*100)}if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue-deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.heightValue-resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue-deltaHeight>=translatedMaxHeightValue&&(deltaHeight=resizedRect.heightValue-translatedMaxHeightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue-deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=translatedHeightValue-resizedRect.maxHeightValue)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue-deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.heightValue-resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue-deltaHeight<=translatedMinHeightValue&&(deltaHeight=resizedRect.heightValue-translatedMinHeightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue-deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=translatedHeightValue-resizedRect.minHeightValue)}"%"!==resizedRect.heightUnit?resizedRect.heightValue-deltaHeight<=0&&(deltaHeight=resizedRect.heightValue):100*-deltaHeight/parentPixelHeight<=0&&(deltaHeight=resizedRect.heightValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,0,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.heightValue&&null!==resizedRect.topValue&&null!==resizedRect.bottomValue){let dummyTop=resizedRect.topValue;"%"!==resizedRect.topUnit?dummyTop+=-offset.top+cosAlpha*deltaHeight:(dummyTop+=100*(-offset.top+cosAlpha*deltaHeight)/parentPixelHeight,dummyTop=parentPixelHeight*(dummyTop/100));let dummyBottom=resizedRect.bottomValue;"%"!==resizedRect.bottomUnit?dummyBottom+=-offset.top:(dummyBottom+=100*-offset.top/parentPixelHeight,dummyBottom=parentPixelHeight*(dummyBottom/100)),dummyTop+dummyBottom>=parentPixelHeight&&(deltaHeight=ctrlMeta.controlCssPixelDimension.height??0,offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,0,deltaHeight,radians,sinAlpha,cosAlpha))}null!==resizedRect.heightValue?"%"!==resizedRect.heightUnit?resizedRect.heightValue+=-deltaHeight:resizedRect.heightValue+=100*-deltaHeight/parentPixelHeight:(null===resizedRect.topValue&&null!==resizedRect.bottomValue||null!==resizedRect.topValue&&null===resizedRect.bottomValue)&&("%"!==resizedRect.heightUnit?resizedRect.heightValue=(ctrlMeta.controlCssPixelDimension.height??0)-deltaHeight:resizedRect.heightValue=(ctrlMeta.controlCssPixelDimension.height??0)/parentPixelHeight*100-100*deltaHeight/parentPixelHeight),null!==resizedRect.leftValue&&("%"!==resizedRect.leftUnit?resizedRect.leftValue+=-(-offset.left+sinAlpha*deltaHeight):resizedRect.leftValue+=100*-(-offset.left+sinAlpha*deltaHeight)/parentPixelWidth),null!==resizedRect.topValue&&("%"!==resizedRect.topUnit?resizedRect.topValue+=-offset.top+cosAlpha*deltaHeight:resizedRect.topValue+=100*(-offset.top+cosAlpha*deltaHeight)/parentPixelHeight),null!==resizedRect.rightValue&&("%"!==resizedRect.rightUnit?resizedRect.rightValue+=offset.left:resizedRect.rightValue+=100*offset.left/parentPixelWidth),null!==resizedRect.bottomValue&&("%"!==resizedRect.bottomUnit?resizedRect.bottomValue+=-offset.top:resizedRect.bottomValue+=100*-offset.top/parentPixelHeight);break;case"TopRight":if(offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha),null!==resizedRect.widthValue){if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue>translatedMaxWidthValue&&(resizedRect.widthValue=translatedMaxWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue/parentPixelWidth*100)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue<translatedMinWidthValue&&(resizedRect.widthValue=translatedMinWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue/parentPixelWidth*100)}if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue+deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.maxWidthValue-resizedRect.widthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue+deltaWidth>=translatedMaxWidthValue&&(deltaWidth=translatedMaxWidthValue-resizedRect.widthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue+deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.maxWidthValue-translatedWidthValue)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue+deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.minWidthValue-resizedRect.widthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue+deltaWidth<=translatedMinWidthValue&&(deltaWidth=translatedMinWidthValue-resizedRect.widthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue+deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.minWidthValue-translatedWidthValue)}"%"!==resizedRect.widthUnit?resizedRect.widthValue+deltaWidth<=0&&(deltaWidth=-resizedRect.widthValue):resizedRect.widthValue+100*deltaWidth/parentPixelWidth<=0&&(deltaWidth=-resizedRect.widthValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.widthValue&&null!==resizedRect.leftValue&&null!==resizedRect.rightValue){let dummyLeft=resizedRect.leftValue;"%"!==resizedRect.leftUnit?dummyLeft+=-offset.left:(dummyLeft+=100*-offset.left/parentPixelWidth,dummyLeft=parentPixelWidth*(dummyLeft/100));let dummyRight=resizedRect.rightValue;"%"!==resizedRect.rightUnit?dummyRight+=-(-offset.left+deltaWidth):(dummyRight+=100*-(-offset.left+deltaWidth)/parentPixelWidth,dummyRight=parentPixelWidth*(dummyRight/100)),dummyLeft+dummyRight>=parentPixelWidth&&(deltaWidth=-(ctrlMeta.controlCssPixelDimension.width??0),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha))}if(null!==resizedRect.heightValue){if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue>translatedMaxHeightValue&&(resizedRect.heightValue=translatedMaxHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue/parentPixelHeight*100)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue<translatedMinHeightValue&&(resizedRect.heightValue=translatedMinHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue/parentPixelHeight*100)}if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue-deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.heightValue-resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue-deltaHeight>=translatedMaxHeightValue&&(deltaHeight=resizedRect.heightValue-translatedMaxHeightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue-deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=translatedHeightValue-resizedRect.maxHeightValue)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue-deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.heightValue-resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue-deltaHeight<=translatedMinHeightValue&&(deltaHeight=resizedRect.heightValue-translatedMinHeightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue-deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=translatedHeightValue-resizedRect.minHeightValue)}"%"!==resizedRect.heightUnit?resizedRect.heightValue-deltaHeight<=0&&(deltaHeight=resizedRect.heightValue):100*-deltaHeight/parentPixelHeight<=0&&(deltaHeight=resizedRect.heightValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.heightValue&&null!==resizedRect.topValue&&null!==resizedRect.bottomValue){let dummyTop=resizedRect.topValue;"%"!==resizedRect.topUnit?dummyTop+=-(-offset.top-deltaHeight):(dummyTop+=100*-(-offset.top-deltaHeight)/parentPixelHeight,dummyTop=parentPixelHeight*(dummyTop/100));let dummyBottom=resizedRect.bottomValue;"%"!==resizedRect.bottomUnit?dummyBottom+=-offset.top:(dummyBottom+=100*-offset.top/parentPixelHeight,dummyBottom=parentPixelHeight*(dummyBottom/100)),dummyTop+dummyBottom>=parentPixelHeight&&(deltaHeight=ctrlMeta.controlCssPixelDimension.height??0,offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha))}null!==resizedRect.widthValue?"%"!==resizedRect.widthUnit?resizedRect.widthValue+=deltaWidth:resizedRect.widthValue+=100*deltaWidth/parentPixelWidth:(null===resizedRect.leftValue&&null!==resizedRect.rightValue||null!==resizedRect.leftValue&&null===resizedRect.rightValue)&&("%"!==resizedRect.widthUnit?resizedRect.widthValue=(ctrlMeta.controlCssPixelDimension.width??0)+deltaWidth:resizedRect.widthValue=(ctrlMeta.controlCssPixelDimension.width??0)/parentPixelWidth*100+100*deltaWidth/parentPixelWidth),null!==resizedRect.heightValue?"%"!==resizedRect.heightUnit?resizedRect.heightValue+=-deltaHeight:resizedRect.heightValue+=100*-deltaHeight/parentPixelHeight:(null===resizedRect.topValue&&null!==resizedRect.bottomValue||null!==resizedRect.topValue&&null===resizedRect.bottomValue)&&("%"!==resizedRect.heightUnit?resizedRect.heightValue=(ctrlMeta.controlCssPixelDimension.height??0)+deltaHeight:resizedRect.heightValue=(ctrlMeta.controlCssPixelDimension.height??0)/parentPixelHeight*100+100*deltaHeight/parentPixelHeight),null!==resizedRect.leftValue&&("%"!==resizedRect.leftUnit?resizedRect.leftValue+=-offset.left:resizedRect.leftValue+=100*-offset.left/parentPixelWidth),null!==resizedRect.topValue&&("%"!==resizedRect.topUnit?resizedRect.topValue+=-(-offset.top-deltaHeight):resizedRect.topValue+=100*-(-offset.top-deltaHeight)/parentPixelHeight),null!==resizedRect.rightValue&&("%"!==resizedRect.rightUnit?resizedRect.rightValue+=-(-offset.left+deltaWidth):resizedRect.rightValue+=100*-(-offset.left+deltaWidth)/parentPixelWidth),null!==resizedRect.bottomValue&&("%"!==resizedRect.bottomUnit?resizedRect.bottomValue+=-offset.top:resizedRect.bottomValue+=100*-offset.top/parentPixelHeight);break;case"CenterLeft":if(offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,0,radians,sinAlpha,cosAlpha),null!==resizedRect.widthValue){if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue>translatedMaxWidthValue&&(resizedRect.widthValue=translatedMaxWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue/parentPixelWidth*100)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue<translatedMinWidthValue&&(resizedRect.widthValue=translatedMinWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue/parentPixelWidth*100)}if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue-deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.widthValue-resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue-deltaWidth>=translatedMaxWidthValue&&(deltaWidth=resizedRect.widthValue-translatedMaxWidthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue-deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=translatedWidthValue-resizedRect.maxWidthValue)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue-deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.widthValue-resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue-deltaWidth<=translatedMinWidthValue&&(deltaWidth=resizedRect.widthValue-translatedMinWidthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue-deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=translatedWidthValue-resizedRect.minWidthValue)}"%"!==resizedRect.widthUnit?resizedRect.widthValue-deltaWidth<=0&&(deltaWidth=resizedRect.widthValue):resizedRect.widthValue-100*deltaWidth/parentPixelWidth<=0&&(deltaWidth=resizedRect.widthValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,0,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.widthValue&&null!==resizedRect.leftValue&&null!==resizedRect.rightValue){let dummyLeft=resizedRect.leftValue;"%"!==resizedRect.leftUnit?dummyLeft+=offset.left+cosAlpha*deltaWidth:(dummyLeft+=100*(offset.left+cosAlpha*deltaWidth)/parentPixelWidth,dummyLeft=parentPixelWidth*(dummyLeft/100));let dummyRight=resizedRect.rightValue;"%"!==resizedRect.rightUnit?dummyRight+=offset.left:(dummyRight+=100*offset.left/parentPixelWidth,dummyRight=parentPixelWidth*(dummyRight/100)),dummyLeft+dummyRight>=parentPixelWidth&&(deltaWidth=ctrlMeta.controlCssPixelDimension.width??0,offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,0,radians,sinAlpha,cosAlpha))}null!==resizedRect.widthValue?"%"!==resizedRect.widthUnit?resizedRect.widthValue+=-deltaWidth:resizedRect.widthValue+=100*-deltaWidth/parentPixelWidth:(null===resizedRect.leftValue&&null!==resizedRect.rightValue||null!==resizedRect.leftValue&&null===resizedRect.rightValue)&&("%"!==resizedRect.widthUnit?resizedRect.widthValue=(ctrlMeta.controlCssPixelDimension.width??0)-deltaWidth:resizedRect.widthValue=(ctrlMeta.controlCssPixelDimension.width??0)/parentPixelWidth*100-100*deltaWidth/parentPixelWidth),null!==resizedRect.leftValue&&("%"!==resizedRect.leftUnit?resizedRect.leftValue+=offset.left+cosAlpha*deltaWidth:resizedRect.leftValue+=100*(offset.left+cosAlpha*deltaWidth)/parentPixelWidth),null!==resizedRect.topValue&&("%"!==resizedRect.topUnit?resizedRect.topValue+=offset.top:resizedRect.topValue+=100*offset.top/parentPixelHeight),null!==resizedRect.rightValue&&("%"!==resizedRect.rightUnit?resizedRect.rightValue+=offset.left:resizedRect.rightValue+=100*offset.left/parentPixelWidth),null!==resizedRect.bottomValue&&("%"!==resizedRect.bottomUnit?resizedRect.bottomValue+=-offset.top:resizedRect.bottomValue+=100*-offset.top/parentPixelHeight);break;case"CenterRight":if(!0===ctrlMeta.isPartialRoot&&(null!==resizedRect.widthValue&&"%"===resizedRect.widthUnit&&(resizedRect.widthUnit="px",resizedRect.widthValue=resizedRect.widthValue/100*positionInsideControl.width),null!==resizedRect.rightValue&&"%"===resizedRect.rightUnit&&(resizedRect.rightUnit="px",resizedRect.rightValue=resizedRect.rightValue/100*parentPixelWidth)),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,0,radians,sinAlpha,cosAlpha),null!==resizedRect.widthValue){if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue>translatedMaxWidthValue&&(resizedRect.widthValue=translatedMaxWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue/parentPixelWidth*100)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue<translatedMinWidthValue&&(resizedRect.widthValue=translatedMinWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue/parentPixelWidth*100)}if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue+deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.maxWidthValue-resizedRect.widthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue+deltaWidth>=translatedMaxWidthValue&&(deltaWidth=translatedMaxWidthValue-resizedRect.widthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue+deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.maxWidthValue-translatedWidthValue)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue+deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.minWidthValue-resizedRect.widthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue+deltaWidth<=translatedMinWidthValue&&(deltaWidth=translatedMinWidthValue-resizedRect.widthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue+deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.minWidthValue-translatedWidthValue)}"%"!==resizedRect.widthUnit?resizedRect.widthValue+deltaWidth<=0&&(deltaWidth=-resizedRect.widthValue):resizedRect.widthValue+100*deltaWidth/parentPixelWidth<=0&&(deltaWidth=-resizedRect.widthValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,0,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.widthValue&&null!==resizedRect.leftValue&&null!==resizedRect.rightValue){let dummyLeft=resizedRect.leftValue;"%"!==resizedRect.leftUnit?dummyLeft+=-offset.left:(dummyLeft+=100*-offset.left/parentPixelWidth,dummyLeft=parentPixelWidth*(dummyLeft/100));let dummyRight=resizedRect.rightValue;"%"!==resizedRect.rightUnit?dummyRight+=-(-offset.left+deltaWidth):(dummyRight+=100*-(-offset.left+deltaWidth)/parentPixelWidth,dummyRight=parentPixelWidth*(dummyRight/100)),dummyLeft+dummyRight>=parentPixelWidth&&(deltaWidth=-(ctrlMeta.controlCssPixelDimension.width??0),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,0,radians,sinAlpha,cosAlpha))}null!==resizedRect.widthValue?"%"!==resizedRect.widthUnit?resizedRect.widthValue+=deltaWidth:resizedRect.widthValue+=100*deltaWidth/parentPixelWidth:(null===resizedRect.leftValue&&null!==resizedRect.rightValue||null!==resizedRect.leftValue&&null===resizedRect.rightValue)&&("%"!==resizedRect.widthUnit?resizedRect.widthValue=(ctrlMeta.controlCssPixelDimension.width??0)+deltaWidth:resizedRect.widthValue=(ctrlMeta.controlCssPixelDimension.width??0)/parentPixelWidth*100+100*deltaWidth/parentPixelWidth),null!==resizedRect.leftValue&&("%"!==resizedRect.leftUnit?resizedRect.leftValue+=-offset.left:resizedRect.leftValue+=100*-offset.left/parentPixelWidth),null!==resizedRect.topValue&&("%"!==resizedRect.topUnit?resizedRect.topValue+=offset.top:resizedRect.topValue+=100*offset.top/parentPixelHeight),null!==resizedRect.rightValue&&("%"!==resizedRect.rightUnit?resizedRect.rightValue+=-(-offset.left+deltaWidth):resizedRect.rightValue+=100*-(-offset.left+deltaWidth)/parentPixelWidth),null!==resizedRect.bottomValue&&("%"!==resizedRect.bottomUnit?resizedRect.bottomValue+=-offset.top:resizedRect.bottomValue+=100*-offset.top/parentPixelHeight);break;case"BottomLeft":if(offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha),null!==resizedRect.heightValue){if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue>translatedMaxHeightValue&&(resizedRect.heightValue=translatedMaxHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue/parentPixelHeight*100)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue<translatedMinHeightValue&&(resizedRect.heightValue=translatedMinHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue/parentPixelHeight*100)}if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue+deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.maxHeightValue-resizedRect.heightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue+deltaHeight>=translatedMaxHeightValue&&(deltaHeight=translatedMaxHeightValue-resizedRect.heightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue+deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.maxHeightValue-translatedHeightValue)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue+deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.minHeightValue-resizedRect.heightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue+deltaHeight<=translatedMinHeightValue&&(deltaHeight=translatedMinHeightValue-resizedRect.heightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue+deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.minHeightValue-translatedHeightValue)}"%"!==resizedRect.heightUnit?resizedRect.heightValue+deltaHeight<=0&&(deltaHeight=-resizedRect.heightValue):resizedRect.heightValue+100*deltaHeight/parentPixelHeight<=0&&(deltaHeight=-resizedRect.heightValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.heightValue&&null!==resizedRect.topValue&&null!==resizedRect.bottomValue){let dummyTop=resizedRect.topValue;"%"!==resizedRect.topUnit?dummyTop+=offset.top:(dummyTop+=100*offset.top/parentPixelHeight,dummyTop=parentPixelHeight*(dummyTop/100));let dummyBottom=resizedRect.bottomValue;"%"!==resizedRect.bottomUnit?dummyBottom+=-(offset.top+deltaHeight):(dummyBottom+=100*-(offset.top+deltaHeight)/parentPixelHeight,dummyBottom=parentPixelHeight*(dummyBottom/100)),dummyTop+dummyBottom>=parentPixelHeight&&(deltaHeight=-(ctrlMeta.controlCssPixelDimension.height??0),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha))}if(null!==resizedRect.widthValue){if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue>translatedMaxWidthValue&&(resizedRect.widthValue=translatedMaxWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue/parentPixelWidth*100)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue<translatedMinWidthValue&&(resizedRect.widthValue=translatedMinWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue/parentPixelWidth*100)}if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue-deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.widthValue-resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue-deltaWidth>=translatedMaxWidthValue&&(deltaWidth=resizedRect.widthValue-translatedMaxWidthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue-deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=translatedWidthValue-resizedRect.maxWidthValue)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue-deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.widthValue-resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue-deltaWidth<=translatedMinWidthValue&&(deltaWidth=resizedRect.widthValue-translatedMinWidthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue-deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=translatedWidthValue-resizedRect.minWidthValue)}"%"!==resizedRect.widthUnit?resizedRect.widthValue-deltaWidth<=0&&(deltaWidth=resizedRect.widthValue):resizedRect.widthValue-100*deltaWidth/parentPixelWidth<=0&&(deltaWidth=resizedRect.widthValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.widthValue&&null!==resizedRect.leftValue&&null!==resizedRect.rightValue){let dummyLeft=resizedRect.leftValue;"%"!==resizedRect.leftUnit?dummyLeft+=-offset.left+deltaWidth:(dummyLeft+=100*(-offset.left+deltaWidth)/parentPixelWidth,dummyLeft=parentPixelWidth*(dummyLeft/100));let dummyRight=resizedRect.rightValue;"%"!==resizedRect.rightUnit?dummyRight+=offset.left:(dummyRight+=100*offset.left/parentPixelWidth,dummyRight=parentPixelWidth*(dummyRight/100)),dummyLeft+dummyRight>=parentPixelWidth&&(deltaWidth=ctrlMeta.controlCssPixelDimension.width??0,offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha))}null!==resizedRect.widthValue?"%"!==resizedRect.widthUnit?resizedRect.widthValue+=-deltaWidth:resizedRect.widthValue+=100*-deltaWidth/parentPixelWidth:(null===resizedRect.leftValue&&null!==resizedRect.rightValue||null!==resizedRect.leftValue&&null===resizedRect.rightValue)&&("%"!==resizedRect.widthUnit?resizedRect.widthValue=(ctrlMeta.controlCssPixelDimension.width??0)-deltaWidth:resizedRect.widthValue=(ctrlMeta.controlCssPixelDimension.width??0)/parentPixelWidth*100-100*deltaWidth/parentPixelWidth),null!==resizedRect.heightValue?"%"!==resizedRect.heightUnit?resizedRect.heightValue+=deltaHeight:resizedRect.heightValue+=100*deltaHeight/parentPixelHeight:(null===resizedRect.topValue&&null!==resizedRect.bottomValue||null!==resizedRect.topValue&&null===resizedRect.bottomValue)&&("%"!==resizedRect.heightUnit?resizedRect.heightValue=(ctrlMeta.controlCssPixelDimension.height??0)+deltaHeight:resizedRect.heightValue=(ctrlMeta.controlCssPixelDimension.height??0)/parentPixelHeight*100+100*deltaHeight/parentPixelHeight),null!==resizedRect.leftValue&&("%"!==resizedRect.leftUnit?resizedRect.leftValue+=-offset.left+deltaWidth:resizedRect.leftValue+=100*(-offset.left+deltaWidth)/parentPixelWidth),null!==resizedRect.topValue&&("%"!==resizedRect.topUnit?resizedRect.topValue+=offset.top:resizedRect.topValue+=100*offset.top/parentPixelHeight),null!==resizedRect.rightValue&&("%"!==resizedRect.rightUnit?resizedRect.rightValue+=offset.left:resizedRect.rightValue+=100*offset.left/parentPixelWidth),null!==resizedRect.bottomValue&&("%"!==resizedRect.bottomUnit?resizedRect.bottomValue+=-(offset.top+deltaHeight):resizedRect.bottomValue+=100*-(offset.top+deltaHeight)/parentPixelHeight);break;case"BottomCenter":if(!0===ctrlMeta.isPartialRoot&&(null!==resizedRect.heightValue&&"%"===resizedRect.heightUnit&&(resizedRect.heightUnit="px",resizedRect.heightValue=resizedRect.heightValue/100*positionInsideControl.height),null!==resizedRect.bottomValue&&"px"===resizedRect.bottomUnit&&(resizedRect.bottomUnit="px",resizedRect.bottomValue=resizedRect.bottomValue/100*parentPixelHeight)),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,0,deltaHeight,radians,sinAlpha,cosAlpha),null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)(resizedRect.heightValue??0)>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;(resizedRect.heightValue??0)>translatedMaxHeightValue&&(resizedRect.heightValue=translatedMaxHeightValue)}else{(resizedRect.heightValue??0)/100*parentPixelHeight>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue/parentPixelHeight*100)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)(resizedRect.heightValue??0)<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;(resizedRect.heightValue??0)<translatedMinHeightValue&&(resizedRect.heightValue=translatedMinHeightValue)}else{(resizedRect.heightValue??0)/100*parentPixelHeight<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue/parentPixelHeight*100)}if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)(resizedRect.heightValue??0)+deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.maxHeightValue-(resizedRect.heightValue??0));else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;(resizedRect.heightValue??0)+deltaHeight>=translatedMaxHeightValue&&(deltaHeight=translatedMaxHeightValue-(resizedRect.heightValue??0))}else{let translatedHeightValue=(resizedRect.heightValue??0)/100*parentPixelHeight;translatedHeightValue+deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.maxHeightValue-translatedHeightValue)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)(resizedRect.heightValue??0)+deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.minHeightValue-(resizedRect.heightValue??0));else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;(resizedRect.heightValue??0)+deltaHeight<=translatedMinHeightValue&&(deltaHeight=translatedMinHeightValue-(resizedRect.heightValue??0))}else{let translatedHeightValue=(resizedRect.heightValue??0)/100*parentPixelHeight;translatedHeightValue+deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.minHeightValue-translatedHeightValue)}if(null!==resizedRect.heightValue)"%"!==resizedRect.heightUnit?resizedRect.heightValue+deltaHeight<=0&&(deltaHeight=-resizedRect.heightValue):resizedRect.heightValue+100*deltaHeight/parentPixelHeight<=0&&(deltaHeight=-resizedRect.heightValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,0,deltaHeight,radians,sinAlpha,cosAlpha);else if(null===resizedRect.heightValue&&null!==resizedRect.topValue&&null!==resizedRect.bottomValue){let dummyTop=resizedRect.topValue;"%"!==resizedRect.topUnit?dummyTop+=offset.top:(dummyTop+=100*offset.top/parentPixelHeight,dummyTop=parentPixelHeight*(dummyTop/100));let dummyBottom=resizedRect.bottomValue;"%"!==resizedRect.bottomUnit?dummyBottom+=-(deltaHeight+offset.top):(dummyBottom+=100*-(deltaHeight+offset.top)/parentPixelHeight,dummyBottom=parentPixelHeight*(dummyBottom/100)),dummyTop+dummyBottom>=parentPixelHeight&&(deltaHeight=-(ctrlMeta.controlCssPixelDimension.height??0),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,0,deltaHeight,radians,sinAlpha,cosAlpha))}null!==resizedRect.heightValue?"%"!==resizedRect.heightUnit?resizedRect.heightValue+=deltaHeight:resizedRect.heightValue+=100*deltaHeight/parentPixelHeight:(null===resizedRect.topValue&&null!==resizedRect.bottomValue||null!==resizedRect.topValue&&null===resizedRect.bottomValue)&&("%"!==resizedRect.heightUnit?resizedRect.heightValue=(ctrlMeta.controlCssPixelDimension.height??0)+deltaHeight:resizedRect.heightValue=(ctrlMeta.controlCssPixelDimension.height??0)/parentPixelHeight*100+100*deltaHeight/parentPixelHeight),null!==resizedRect.leftValue&&("%"!==resizedRect.leftUnit?resizedRect.leftValue+=-offset.left:resizedRect.leftValue+=100*-offset.left/parentPixelWidth),null!==resizedRect.topValue&&("%"!==resizedRect.topUnit?resizedRect.topValue+=offset.top:resizedRect.topValue+=100*offset.top/parentPixelHeight),null!==resizedRect.rightValue&&("%"!==resizedRect.rightUnit?resizedRect.rightValue+=offset.left:resizedRect.rightValue+=100*offset.left/parentPixelWidth),null!==resizedRect.bottomValue&&("%"!==resizedRect.bottomUnit?resizedRect.bottomValue+=-(deltaHeight+offset.top):resizedRect.bottomValue+=100*-(deltaHeight+offset.top)/parentPixelHeight);break;case"BottomRight":if(!0===ctrlMeta.isPartialRoot&&(null!==resizedRect.heightValue&&"%"===resizedRect.heightUnit&&(resizedRect.heightUnit="px",resizedRect.heightValue=resizedRect.heightValue/100*positionInsideControl.height),null!==resizedRect.widthValue&&"%"===resizedRect.widthUnit&&(resizedRect.widthUnit="px",resizedRect.widthValue=resizedRect.widthValue/100*positionInsideControl.width),null!==resizedRect.bottomValue&&"%"===resizedRect.bottomUnit&&(resizedRect.bottomUnit="px",resizedRect.bottomValue=resizedRect.bottomValue/100*parentPixelHeight),null!==resizedRect.rightValue&&"%"===resizedRect.rightUnit&&(resizedRect.rightUnit="px",resizedRect.rightValue=resizedRect.rightValue/100*parentPixelWidth)),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha),null!==resizedRect.heightValue){if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue>translatedMaxHeightValue&&(resizedRect.heightValue=translatedMaxHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue/parentPixelHeight*100)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue<translatedMinHeightValue&&(resizedRect.heightValue=translatedMinHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue/parentPixelHeight*100)}if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue+deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.maxHeightValue-resizedRect.heightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue+deltaHeight>=translatedMaxHeightValue&&(deltaHeight=translatedMaxHeightValue-resizedRect.heightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue+deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.maxHeightValue-translatedHeightValue)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue+deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.minHeightValue-resizedRect.heightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue+deltaHeight<=translatedMinHeightValue&&(deltaHeight=translatedMinHeightValue-resizedRect.heightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue+deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.minHeightValue-translatedHeightValue)}"%"!==resizedRect.heightUnit?resizedRect.heightValue+deltaHeight<=0&&(deltaHeight=-resizedRect.heightValue):resizedRect.heightValue+100*deltaHeight/parentPixelHeight<=0&&(deltaHeight=-resizedRect.heightValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.heightValue&&null!==resizedRect.topValue&&null!==resizedRect.bottomValue){let dummyTop=resizedRect.topValue;"%"!==resizedRect.topUnit?dummyTop+=offset.top:(dummyTop+=100*offset.top/parentPixelHeight,dummyTop=parentPixelHeight*(dummyTop/100));let dummyBottom=resizedRect.bottomValue;"%"!==resizedRect.bottomUnit?dummyBottom+=-(offset.top+deltaHeight):(dummyBottom+=100*-(offset.top+deltaHeight)/parentPixelHeight,dummyBottom=parentPixelHeight*(dummyBottom/100)),dummyTop+dummyBottom>=parentPixelHeight&&(deltaHeight=-(ctrlMeta.controlCssPixelDimension.height??0),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha))}if(null!==resizedRect.widthValue){if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue>translatedMaxWidthValue&&(resizedRect.widthValue=translatedMaxWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue/parentPixelWidth*100)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue<translatedMinWidthValue&&(resizedRect.widthValue=translatedMinWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue/parentPixelWidth*100)}if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue+deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.maxWidthValue-resizedRect.widthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue+deltaWidth>=translatedMaxWidthValue&&(deltaWidth=translatedMaxWidthValue-resizedRect.widthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue+deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.maxWidthValue-translatedWidthValue)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue+deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.minWidthValue-resizedRect.widthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue+deltaWidth<=translatedMinWidthValue&&(deltaWidth=translatedMinWidthValue-resizedRect.widthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue+deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.minWidthValue-translatedWidthValue)}"%"!==resizedRect.widthUnit?resizedRect.widthValue+deltaWidth<=0&&(deltaWidth=-resizedRect.widthValue):resizedRect.widthValue+100*deltaWidth/parentPixelWidth<=0&&(deltaWidth=-resizedRect.widthValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.widthValue&&null!==resizedRect.leftValue&&null!==resizedRect.rightValue){let dummyLeft=resizedRect.leftValue;"%"!==resizedRect.leftUnit?dummyLeft+=-offset.left:(dummyLeft+=100*-offset.left/parentPixelWidth,dummyLeft=parentPixelWidth*(dummyLeft/100));let dummyRight=resizedRect.rightValue;"%"!==resizedRect.rightUnit?dummyRight+=-(-offset.left+deltaWidth):(dummyRight+=100*-(-offset.left+deltaWidth)/parentPixelWidth,dummyRight=parentPixelWidth*(dummyRight/100)),dummyLeft+dummyRight>=parentPixelWidth&&(deltaWidth=-(ctrlMeta.controlCssPixelDimension.width??0),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha))}null!==resizedRect.widthValue?"%"!==resizedRect.widthUnit?resizedRect.widthValue+=deltaWidth:resizedRect.widthValue+=100*deltaWidth/parentPixelWidth:(null===resizedRect.leftValue&&null!==resizedRect.rightValue||null!==resizedRect.leftValue&&null===resizedRect.rightValue)&&("%"!==resizedRect.widthUnit?resizedRect.widthValue=(ctrlMeta.controlCssPixelDimension.width??0)+deltaWidth:resizedRect.widthValue=(ctrlMeta.controlCssPixelDimension.width??0)/parentPixelWidth*100+100*deltaWidth/parentPixelWidth),null!==resizedRect.heightValue?"%"!==resizedRect.heightUnit?resizedRect.heightValue+=deltaHeight:resizedRect.heightValue+=100*deltaHeight/parentPixelHeight:(null===resizedRect.topValue&&null!==resizedRect.bottomValue||null!==resizedRect.topValue&&null===resizedRect.bottomValue)&&("%"!==resizedRect.heightUnit?resizedRect.heightValue=(ctrlMeta.controlCssPixelDimension.height??0)+deltaHeight:resizedRect.heightValue=(ctrlMeta.controlCssPixelDimension.height??0)/parentPixelHeight*100+100*deltaHeight/parentPixelHeight),null!==resizedRect.leftValue&&("%"!==resizedRect.leftUnit?resizedRect.leftValue+=-offset.left:resizedRect.leftValue+=100*-offset.left/parentPixelWidth),null!==resizedRect.topValue&&("%"!==resizedRect.topUnit?resizedRect.topValue+=offset.top:resizedRect.topValue+=100*offset.top/parentPixelHeight),null!==resizedRect.rightValue&&("%"!==resizedRect.rightUnit?resizedRect.rightValue+=-(-offset.left+deltaWidth):resizedRect.rightValue+=100*-(-offset.left+deltaWidth)/parentPixelWidth),null!==resizedRect.bottomValue&&("%"!==resizedRect.bottomUnit?resizedRect.bottomValue+=-(offset.top+deltaHeight):resizedRect.bottomValue+=100*-(offset.top+deltaHeight)/parentPixelHeight)}return resizedRect}__onAnchorMouseUp(){let __this=this;return function(event){1===event.which&&(TcHmi.System.SharedResources.jqDocument.off(__this.__anchorMouseMoveNs),TcHmi.System.SharedResources.jqDocument.off(__this.__anchorMouseUpNs),null!==__this.__activeControl&&(__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snaptop"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapleft"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapbottom"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapright"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snaptop-remote"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapleft-remote"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapbottom-remote"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapright-remote"),!0!==__this.__lockControlResize&&(__this.__controlResizing=!1,__this.__designerModeManager.rectSelectManager?.lockRectSelect(),__this.__designerModeManager.syncManager?.updatePcElementAndSync("System.onControlSizeParameterChanged"),__this.__designerModeManager.resyncControls())))}}}}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){Engineering.DesignerModeMasterInteractionManager=class{constructor(designerModeManager){this.__verPositionCache={},this.__horPositionCache={},this.__anchorName=void 0,this.__designerModeManager=designerModeManager,this.__modifierKeyPressed={ctrl:!1,shift:!1},this.__startMousePosition={left:0,top:0},this.__startMousePositionCopyMoveOffsetPosition={left:0,top:0},this.__positionInsideControl={top:0,left:0,height:0,width:0}}getAnchorName(){return this.__anchorName}setAnchorName(newAnchorName){this.__anchorName=newAnchorName}getStartMousePos(){return this.__startMousePosition}getStartMousePosCopyMoveOffsetPosition(){return this.__startMousePositionCopyMoveOffsetPosition}getPositionInsideControl(){return this.__positionInsideControl}setCtrlModifierKeyState(bState){this.__modifierKeyPressed.ctrl=bState}setShiftModifierKeyState(bState){this.__modifierKeyPressed.shift=bState}clearControlSnapPositionCache(){this.__horPositionCache={},this.__verPositionCache={}}handleInteractionStart(event,activeControl){if(void 0!==event.pageX&&void 0!==event.pageY&&(this.__startMousePosition.left=event.pageX,this.__startMousePosition.top=event.pageY,this.__startMousePositionCopyMoveOffsetPosition.left=0,this.__startMousePositionCopyMoveOffsetPosition.top=0,activeControl&&activeControl.jOriginalPosition)){const untransformedBBox=activeControl.jOriginalPosition[0].getBoundingClientRect();this.__positionInsideControl.top=event.pageY-untransformedBBox.top-window.scrollY,this.__positionInsideControl.left=event.pageX-untransformedBBox.left-window.scrollX,this.__positionInsideControl.height=untransformedBBox.height,this.__positionInsideControl.width=untransformedBBox.width}}handleInteractionStartCopyMoveOffsetPosition(event){void 0!==event.pageX&&void 0!==event.pageY&&(this.__startMousePositionCopyMoveOffsetPosition.left=event.pageX,this.__startMousePositionCopyMoveOffsetPosition.top=event.pageY)}refreshControlSnapPositionCache(ctrlMeta){if(this.__designerModeManager.getSettings().enableSnapping)if(ctrlMeta){if(0===ctrlMeta.absoluteParentRotation&&(this.__addPositionCacheEntry(ctrlMeta.jOriginalPosition[0],ctrlMeta.id,ctrlMeta.isContainerControl),!0===ctrlMeta.isGridControl)){let allGridCells=ctrlMeta.jControlPosition.children(".tchmi-creator-gridcell");for(let i=0,ii=allGridCells.length;i<ii;i++)this.__addPositionCacheEntry(allGridCells[i],ctrlMeta.id,!0)}}else{const controlsMetaData=this.__designerModeManager.metaDataManager.getControlMetaData();for(let id in controlsMetaData)this.refreshControlSnapPositionCache(controlsMetaData[id])}}__addSnapPosition(cache,newEntry,key){cache[key]?cache[key].push(newEntry):cache[key]=[newEntry]}__addPositionCacheEntry(htmlElem,name,isContainer){let designerSettings=this.__designerModeManager.getSettings(),controlDistance=designerSettings.snapDistanceToControls,containerInnerDistance=designerSettings.snapDistanceToControls;const untransformedBBox=htmlElem.getBoundingClientRect(),left=Math.round(untransformedBBox.left+window.scrollX),top=Math.round(untransformedBBox.top+window.scrollY),right=Math.round(untransformedBBox.right+window.scrollX),bottom=Math.round(untransformedBBox.bottom+window.scrollY);designerSettings.snapToControls&&(this.__addSnapPosition(this.__verPositionCache,{name:name,controlTopOrLeft:!0,remoteMatch:!1},top),this.__addSnapPosition(this.__verPositionCache,{name:name,controlTopOrLeft:!0,remoteMatch:!0},top-controlDistance)),isContainer&&designerSettings.snapToInnerContainerSides&&this.__addSnapPosition(this.__verPositionCache,{name:name,controlTopOrLeft:!1,remoteMatch:!0},top+containerInnerDistance),designerSettings.snapToControls&&(this.__addSnapPosition(this.__verPositionCache,{name:name,controlTopOrLeft:!1,remoteMatch:!1},bottom),this.__addSnapPosition(this.__verPositionCache,{name:name,controlTopOrLeft:!1,remoteMatch:!0},bottom+controlDistance)),isContainer&&designerSettings.snapToInnerContainerSides&&this.__addSnapPosition(this.__verPositionCache,{name:name,controlTopOrLeft:!0,remoteMatch:!0},bottom-containerInnerDistance),designerSettings.snapToControls&&(this.__addSnapPosition(this.__horPositionCache,{name:name,controlTopOrLeft:!0,remoteMatch:!1},left),this.__addSnapPosition(this.__horPositionCache,{name:name,controlTopOrLeft:!0,remoteMatch:!0},left-controlDistance)),isContainer&&designerSettings.snapToInnerContainerSides&&this.__addSnapPosition(this.__horPositionCache,{name:name,controlTopOrLeft:!1,remoteMatch:!0},left+containerInnerDistance),designerSettings.snapToControls&&(this.__addSnapPosition(this.__horPositionCache,{name:name,controlTopOrLeft:!1,remoteMatch:!1},right),this.__addSnapPosition(this.__horPositionCache,{name:name,controlTopOrLeft:!1,remoteMatch:!0},right+controlDistance)),isContainer&&designerSettings.snapToInnerContainerSides&&this.__addSnapPosition(this.__horPositionCache,{name:name,controlTopOrLeft:!0,remoteMatch:!0},right-containerInnerDistance)}handleSnapping(ctrlMeta,mouseDelta,mousePos,snapControls,directionLock){let deltaCorrectionLeft=0,deltaCorrectionTop=0;const creatorZoomFactor=this.__designerModeManager.rootControlManager?.getCreatorZoomFactor()??1;let controlSnappedTop="topBottom"===directionLock,controlSnappedBottom="topBottom"===directionLock,controlSnappedLeft="leftRight"===directionLock,controlSnappedRight="leftRight"===directionLock,controlSnappedTopRemoteMatch=!1,controlSnappedBottomRemoteMatch=!1,controlSnappedLeftRemoteMatch=!1,controlSnappedRightRemoteMatch=!1;if(snapControls&&0===ctrlMeta.absoluteParentRotation){const selectedControlIds=this.__designerModeManager.metaDataManager.getSelectedControlIdsWithChildren();let controlSnappointInViewportPixelStr,controlSnappointInViewportPixel,snapAtTop="topBottom"!==directionLock,snapAtBottom="topBottom"!==directionLock,snapAtLeft="leftRight"!==directionLock,snapAtRight="leftRight"!==directionLock;switch(this.__anchorName){case"TopLeft":snapAtBottom=!1,snapAtRight=!1;break;case"TopCenter":snapAtBottom=!1,snapAtLeft=!1,snapAtRight=!1;break;case"TopRight":snapAtBottom=!1,snapAtLeft=!1;break;case"CenterRight":snapAtTop=!1,snapAtBottom=!1,snapAtLeft=!1;break;case"CenterLeft":snapAtTop=!1,snapAtBottom=!1,snapAtRight=!1;break;case"BottomLeft":snapAtTop=!1,snapAtRight=!1;break;case"BottomCenter":snapAtTop=!1,snapAtLeft=!1,snapAtRight=!1;break;case"BottomRight":snapAtTop=!1,snapAtLeft=!1}if(!0===snapAtTop||!0===snapAtBottom)for(controlSnappointInViewportPixelStr in this.__verPositionCache){let snappedControlInfoArray=this.__verPositionCache[controlSnappointInViewportPixelStr];if(controlSnappointInViewportPixel=parseInt(controlSnappointInViewportPixelStr,10),!isNaN(controlSnappointInViewportPixel))if(!0===snapAtTop&&controlSnappointInViewportPixel-5<mousePos.top-this.__positionInsideControl.top&&mousePos.top-this.__positionInsideControl.top<controlSnappointInViewportPixel+5){for(let snappedControlInfo of snappedControlInfoArray)if(!selectedControlIds.includes(snappedControlInfo.name)&&(!0!==snappedControlInfo.remoteMatch||!0!==snappedControlInfo.controlTopOrLeft)){!1===controlSnappedTop&&!1===controlSnappedBottom?(deltaCorrectionTop=controlSnappointInViewportPixel-(mousePos.top-this.__positionInsideControl.top),controlSnappedTop=!0,controlSnappedTopRemoteMatch=snappedControlInfo.remoteMatch):controlSnappointInViewportPixel-deltaCorrectionTop==mousePos.top-this.__positionInsideControl.top&&(controlSnappedTop=!0,controlSnappedTopRemoteMatch=snappedControlInfo.remoteMatch);break}}else if(!0===snapAtBottom&&controlSnappointInViewportPixel-5<mousePos.top-this.__positionInsideControl.top+this.__positionInsideControl.height&&mousePos.top-this.__positionInsideControl.top+this.__positionInsideControl.height<controlSnappointInViewportPixel+5)for(let snappedControlInfo of snappedControlInfoArray)if(!selectedControlIds.includes(snappedControlInfo.name)&&(!0!==snappedControlInfo.remoteMatch||!1!==snappedControlInfo.controlTopOrLeft)){!1===controlSnappedTop&&!1===controlSnappedBottom?(deltaCorrectionTop=controlSnappointInViewportPixel-(mousePos.top-this.__positionInsideControl.top+this.__positionInsideControl.height),controlSnappedBottom=!0,controlSnappedBottomRemoteMatch=snappedControlInfo.remoteMatch):controlSnappointInViewportPixel-deltaCorrectionTop===mousePos.top-this.__positionInsideControl.top+this.__positionInsideControl.height&&(controlSnappedBottom=!0,controlSnappedBottomRemoteMatch=snappedControlInfo.remoteMatch);break}if(!0===controlSnappedTop&&!0===controlSnappedBottom)break}if(!0===snapAtLeft||!0===snapAtRight)for(controlSnappointInViewportPixelStr in this.__horPositionCache){let snappedControlInfoArray=this.__horPositionCache[controlSnappointInViewportPixelStr];if(controlSnappointInViewportPixel=parseInt(controlSnappointInViewportPixelStr,10),!isNaN(controlSnappointInViewportPixel))if(!0===snapAtLeft&&controlSnappointInViewportPixel-5<mousePos.left-this.__positionInsideControl.left&&mousePos.left-this.__positionInsideControl.left<controlSnappointInViewportPixel+5){for(let snappedControlInfo of snappedControlInfoArray)if(!selectedControlIds.includes(snappedControlInfo.name)&&(!0!==snappedControlInfo.remoteMatch||!0!==snappedControlInfo.controlTopOrLeft)){!1===controlSnappedLeft&&!1===controlSnappedRight?(deltaCorrectionLeft=controlSnappointInViewportPixel-(mousePos.left-this.__positionInsideControl.left),controlSnappedLeft=!0,controlSnappedLeftRemoteMatch=snappedControlInfo.remoteMatch):controlSnappointInViewportPixel-deltaCorrectionLeft==mousePos.left-this.__positionInsideControl.left&&(controlSnappedLeft=!0,controlSnappedLeftRemoteMatch=snappedControlInfo.remoteMatch);break}}else if(!0===snapAtRight&&controlSnappointInViewportPixel-5<mousePos.left-this.__positionInsideControl.left+this.__positionInsideControl.width&&mousePos.left-this.__positionInsideControl.left+this.__positionInsideControl.width<controlSnappointInViewportPixel+5)for(let snappedControlInfo of snappedControlInfoArray)if(!selectedControlIds.includes(snappedControlInfo.name)&&(!0!==snappedControlInfo.remoteMatch||!1!==snappedControlInfo.controlTopOrLeft)){!1===controlSnappedLeft&&!1===controlSnappedRight?(deltaCorrectionLeft=controlSnappointInViewportPixel-(mousePos.left-this.__positionInsideControl.left+this.__positionInsideControl.width),controlSnappedRight=!0,controlSnappedRightRemoteMatch=snappedControlInfo.remoteMatch):controlSnappointInViewportPixel-deltaCorrectionLeft===mousePos.left-this.__positionInsideControl.left+this.__positionInsideControl.width&&(controlSnappedRight=!0,controlSnappedRightRemoteMatch=snappedControlInfo.remoteMatch);break}if(!0===controlSnappedLeft&&controlSnappedRight)break}}return ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-snaptop",controlSnappedTop),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-snapbottom",controlSnappedBottom),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-snapleft",controlSnappedLeft),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-snapright",controlSnappedRight),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-snaptop-remote",controlSnappedTopRemoteMatch),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-snapbottom-remote",controlSnappedBottomRemoteMatch),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-snapleft-remote",controlSnappedLeftRemoteMatch),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-snapright-remote",controlSnappedRightRemoteMatch),{left:mouseDelta.left+deltaCorrectionLeft/creatorZoomFactor,top:mouseDelta.top+deltaCorrectionTop/creatorZoomFactor}}}}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){Engineering.DesignerModeResourceInjectionManager=class{constructor(designerModeManager){this.__designerModeManager=designerModeManager}injectPackageResources(packages,callback){let destroyOnControlsRegistered,destroyOnFunctionRegistered,__this=this,pending=0,mPackages=new Map,modControls={map:new Map,urlByName:new Map,array:[]},modFunctions={map:new Map,array:[]},mapControlDescriptionByPath=new Map,mapFunctionDescriptionByPath=new Map,asyncFinalizeStage4=function(){pending>0||(pending=0,destroyOnControlsRegistered&&(destroyOnControlsRegistered(),destroyOnControlsRegistered=null),destroyOnFunctionRegistered&&(destroyOnFunctionRegistered(),destroyOnFunctionRegistered=null),TcHmi.System.Services.typeManager.doForceSchemaDefinitions((data=>{TcHmi.System.Services.controlManager.resolveDescriptionInheritation(),TcHmi.System.Services.themeManager.processActiveTheme(),TcHmi.System.Services.localizationManager.processLocale("en",{level:TcHmi.Locale.Level.Engineering}),TcHmi.System.Services.localizationManager.processLocale(TcHmi.System.Services.localizationManager.getLocale(),{level:TcHmi.Locale.Level.Application}),TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})})))},asyncFinalizeStage3=function(){if(!(pending>0)){pending=0;for(const module of modControls.array){if(!module.description||!module.package||!module.manifestData)return;if(module.description.template){let url=tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+module.description.template),xhr=new XMLHttpRequest;xhr.open("GET",url+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){pending--,200===xhr.status?(TcHmi.System.Data.Caches.templateMarkupCache.set(url,this.responseText),asyncFinalizeStage4()):asyncFinalizeStage4()})),xhr.addEventListener("error",(function(evt){pending--,asyncFinalizeStage4()})),pending++,xhr.send()}if(module.description.languages){const qname=TcHmi.System.resolveQualifiedName(module.description.name,module.description.namespace);for(const[key,languageEntry]of Object.entries(module.description.languages))if(Array.isArray(languageEntry)){const sanitizedLanguageArray=[];for(const subEntry of languageEntry)sanitizedLanguageArray.push(tchmi_path(TcHmi.Environment.getControlBasePath(qname)+"/"+subEntry));TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Control<"+qname+">",key,sanitizedLanguageArray)}else TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Control<"+qname+">",key,tchmi_path(TcHmi.Environment.getControlBasePath(qname)+"/"+languageEntry))}}asyncFinalizeStage4()}},asyncFinalizeStage2=function(){if(pending>0)return;pending=0;let jsincludes=[],packagesSorted=[];mPackages.forEach(((pkg,name)=>{packagesSorted.push(pkg)})),packagesSorted.sort(((a,b)=>{if(a&&a.manifest&&a.manifest.modules)for(let i=0,ii=a.manifest.modules.length;i<ii;i++){let module=a.manifest.modules[i];if((!module||"Package"===module.type)&&module.nugetId===b.name)return-1}if(b&&b.manifest&&b.manifest.modules)for(let i=0,ii=b.manifest.modules.length;i<ii;i++){let module=b.manifest.modules[i];if((!module||"Package"===module.type)&&module.nugetId===a.name)return 1}return 0}));for(let i=0,ii=packagesSorted.length;i<ii;i++){let pkg=packagesSorted[i];if(!pkg)continue;let manifest=pkg.manifest;if(!manifest)continue;let manifestModules=manifest.modules;if(manifestModules)for(let j=0,jj=manifestModules.length;j<jj;j++){let manifestModule=manifestModules[j];if("Control"===manifestModule.type){let descrUrl=tchmi_path(pkg.basePath+"/"+manifestModule.basePath+"/"+manifestModule.descriptionFile),descr=mapControlDescriptionByPath.get(descrUrl);if(!descr)continue;let module={error:TcHmi.Errors.NONE,manifestData:manifestModule,package:pkg,description:descr,descriptionExpanded:{...tchmi_clone_object(descr),inheritationResolved:!1,inheritedTypes:[],inheritedAttributes:[],inheritedAttributesNameMap:new Map,inheritedAttributesPropertyNameMap:new Map,inheritedAttributesPropertyGetterNameMap:new Map,inheritedAttributesPropertySetterNameMap:new Map,inheritedAccess:[],inheritedEvents:[],inheritedFunctions:[],inheritedLanguages:{}}},name=descr.name;if(modControls.array.push(module),1===module.package?.manifest.apiVersion){let qname=TcHmi.System.resolveQualifiedName(descr.name,descr.namespace);modControls.map.has(name)?(modControls.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}),modControls.urlByName.delete(name)):(modControls.map.set(name,module),modControls.urlByName.set(name,descrUrl)),modControls.map.has(qname)?(modControls.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}),modControls.urlByName.delete(qname)):(modControls.map.set(qname,module),modControls.urlByName.set(qname,descrUrl))}else modControls.map.has(name)?(modControls.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}),modControls.urlByName.delete(name)):(modControls.map.set(name,module),modControls.urlByName.set(name,descrUrl));TcHmi.System.Services.themeManager.registerControlThemeFiles(descr);for(let k=0,kk=descr.dependencyFiles.length;k<kk;k++){let dependencyFile=descr.dependencyFiles[k];if(dependencyFile&&(dependencyFile.type&&"JAVASCRIPT"===dependencyFile.type.toUpperCase())){let jsinclude=tchmi_path(pkg.basePath+"/"+manifestModule.basePath+"/"+dependencyFile.name);if(jsincludes.includes(jsinclude))continue;jsincludes.push(jsinclude)}}}else if("Function"===manifestModule.type){let descrUrl=tchmi_path(pkg.basePath+"/"+manifestModule.basePath+"/"+manifestModule.descriptionFile),descr=mapFunctionDescriptionByPath.get(descrUrl);if(!descr)continue;let module={error:TcHmi.Errors.NONE,manifestData:manifestModule,package:pkg,description:descr};modFunctions.array.push(module),modFunctions.map.set(descr.function.name,module);let name=descr.function.name;if(1===pkg.manifest.apiVersion){let qname=TcHmi.System.resolveQualifiedName(descr.function.name,"Namespace");if(modFunctions.map.has(name)?modFunctions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):modFunctions.map.set(name,module),modFunctions.map.has(qname)?modFunctions.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):modFunctions.map.set(qname,module),descr.languages&&module.package&&module.manifestData)for(const[key,languageEntry]of Object.entries(descr.languages))if(Array.isArray(languageEntry))for(const subEntry of languageEntry)TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Function<"+qname+">",key,tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+subEntry));else TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Function<"+qname+">",key,tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+languageEntry))}else modFunctions.map.has(name)?modFunctions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):modFunctions.map.set(name,module);for(let k=0,kk=descr.dependencyFiles.length;k<kk;k++){let dependencyFile=descr.dependencyFiles[k];if(dependencyFile&&(dependencyFile.type&&"JAVASCRIPT"===dependencyFile.type.toUpperCase())){let include=tchmi_path(pkg.basePath+"/"+manifestModule.basePath+"/"+dependencyFile.name);if(jsincludes.includes(include))continue;jsincludes.push(include)}}}else if("Resource"===manifestModule.type&&".js"===manifestModule.path.substr(manifestModule.path.length-3,3).toLowerCase()){let jsinclude=tchmi_path(pkg.basePath+"/"+manifestModule.path);if(jsincludes.includes(jsinclude))continue;jsincludes.push(jsinclude)}}}let fragment=document.createDocumentFragment();destroyOnControlsRegistered=TcHmi.EventProvider.register("System.onControlRegistered",(function(e,data){if(data.error!==TcHmi.Errors.NONE||!data.name)return;let name=data.name,qname=TcHmi.System.resolveQualifiedName(data.name,data.namespace),modControlName=modControls.map.get(name);if(1===modControlName?.package?.manifest.apiVersion){let modControlQualifiedName=modControls.map.get(qname);if(TcHmi.System.Data.Modules.controls.array.push(modControlName),modControlName&&modControlName.error===TcHmi.Errors.NONE)if(modControlName.reg=data,TcHmi.System.Data.Modules.controls.map.has(name)){TcHmi.System.Data.Modules.controls.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}});let url=modControls.urlByName.get(name);url&&TcHmi.System.Data.Modules.controls.urlMap.delete(url)}else{TcHmi.System.Data.Modules.controls.map.set(name,modControlName);let url=modControls.urlByName.get(name);url&&TcHmi.System.Data.Modules.controls.urlMap.set(url,modControlName)}else TcHmi.System.Data.Modules.controls.map.set(name,{error:modControlName.error});if(modControlQualifiedName)if(modControlQualifiedName.error===TcHmi.Errors.NONE)if(modControlQualifiedName.reg=data,TcHmi.System.Data.Modules.controls.map.has(qname)){TcHmi.System.Data.Modules.controls.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}});let url=modControls.urlByName.get(qname);url&&TcHmi.System.Data.Modules.controls.urlMap.delete(url)}else{TcHmi.System.Data.Modules.controls.map.set(qname,modControlQualifiedName);let url=modControls.urlByName.get(qname);url&&TcHmi.System.Data.Modules.controls.urlMap.set(url,modControlQualifiedName)}else TcHmi.System.Data.Modules.controls.map.set(name,{error:modControlQualifiedName.error});else;}else if(modControlName)if(modControlName.error===TcHmi.Errors.NONE){if(modControlName.reg=data,modControlName.reg.directory&&modControlName.reg.template){let cleanTemplatePath=tchmi_path(modControlName.reg.template),cleanTemplateDirectory=tchmi_path(modControlName.reg.directory);if(!cleanTemplatePath.includes(cleanTemplateDirectory)&&modControlName.description&&modControlName.descriptionExpanded){let cleanRelativeTemplatePath=tchmi_path(cleanTemplatePath.replace(cleanTemplateDirectory,""));modControlName.description.template=cleanRelativeTemplatePath,modControlName.descriptionExpanded.template=cleanRelativeTemplatePath}}TcHmi.System.Data.Modules.controls.map.has(name)?TcHmi.System.Data.Modules.controls.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):TcHmi.System.Data.Modules.controls.map.set(name,modControlName)}else TcHmi.System.Data.Modules.controls.map.set(name,{error:modControlName.error})})),destroyOnFunctionRegistered=TcHmi.EventProvider.register("System.onFunctionRegistered",(function(e,data){let name=data.name,qname=TcHmi.System.resolveQualifiedName(data.name,data.namespace),modFunctionName=modFunctions.map.get(name);if(modFunctionName&&modFunctionName.package)if(TcHmi.System.Data.Modules.functions.array.push(modFunctionName),1===modFunctionName.package.manifest.apiVersion){let modFunctionQualifiedName=modFunctions.map.get(qname);modFunctionName&&modFunctionName.error===TcHmi.Errors.NONE?(modFunctionName.reg=data,TcHmi.System.Data.Modules.functions.map.has(name)?TcHmi.System.Data.Modules.functions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):TcHmi.System.Data.Modules.functions.map.set(name,modFunctionName)):TcHmi.System.Data.Modules.functions.map.set(name,{error:modFunctionName.error}),modFunctionQualifiedName&&(modFunctionQualifiedName.error===TcHmi.Errors.NONE?TcHmi.System.Data.Modules.functions.map.has(qname)?TcHmi.System.Data.Modules.functions.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):TcHmi.System.Data.Modules.functions.map.set(qname,modFunctionQualifiedName):TcHmi.System.Data.Modules.functions.map.set(name,{error:modFunctionQualifiedName.error}))}else modFunctionName&&modFunctionName.error===TcHmi.Errors.NONE?(modFunctionName.reg=data,TcHmi.System.Data.Modules.functions.map.has(name)?TcHmi.System.Data.Modules.functions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):TcHmi.System.Data.Modules.functions.map.set(name,modFunctionName)):TcHmi.System.Data.Modules.functions.map.set(name,{error:modFunctionName.error});else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeResourceInjectionManager] Internal error. Did not find function module information.")}));for(let i=0,ii=jsincludes.length;i<ii;i++){!function(include){pending++;let script=document.createElement("script");script.src=include,script.async=!1,script.onload=function(ev){pending--,asyncFinalizeStage3()},script.onerror=function(ev){pending--,asyncFinalizeStage3()},fragment.appendChild(script)}(jsincludes[i])}document.head.appendChild(fragment),asyncFinalizeStage3()},asyncFinalizeStage1=function(){pending>0||(pending=0,mPackages.forEach(((pkg,name)=>{let manifest=pkg.manifest;if(manifest){let manifestModules=manifest.modules;if(manifestModules)for(let i=0,ii=manifestModules.length;i<ii;i++){let manifestModule=manifestModules[i];manifestModule&&("Control"===manifestModule.type?function(pkg,module){let url=tchmi_path(pkg.basePath+"/"+module.basePath+"/"+module.descriptionFile),xhr=new XMLHttpRequest;xhr.open("GET",url+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){if(pending--,200===xhr.status){try{mapControlDescriptionByPath.set(url,JSON.parse(this.responseText))}catch(e){}asyncFinalizeStage2()}else asyncFinalizeStage2()})),xhr.addEventListener("error",(function(evt){pending--,asyncFinalizeStage2()})),pending++,xhr.send()}(pkg,manifestModule):"Function"===manifestModule.type&&function(pkg,module){let url=tchmi_path(pkg.basePath+"/"+module.basePath+"/"+module.descriptionFile),xhr=new XMLHttpRequest;xhr.open("GET",url+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){if(pending--,200===xhr.status){try{mapFunctionDescriptionByPath.set(url,JSON.parse(this.responseText))}catch(e){}asyncFinalizeStage2()}else asyncFinalizeStage2()})),xhr.addEventListener("error",(function(evt){pending--,asyncFinalizeStage2()})),pending++,xhr.send()}(pkg,manifestModule))}}})),asyncFinalizeStage2())};for(let i=0,ii=packages.length;i<ii;i++){let pi=packages[i];TcHmi.System.Data.packages.has(pi.name)||function(pi){let url=tchmi_path(pi.basePath+"/Manifest.json"),xhr=new XMLHttpRequest;xhr.open("GET",url+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){if(pending--,200!==xhr.status)return void asyncFinalizeStage1();let manifest;try{manifest=JSON.parse(this.responseText)}catch(e){}if(!manifest)return void asyncFinalizeStage1();let pkg={name:pi.name,basePath:pi.basePath,manifest:manifest};mPackages.set(pkg.name,pkg),TcHmi.System.Data.packages.set(pkg.name,pkg),asyncFinalizeStage1()})),xhr.addEventListener("error",(function(evt){pending--,asyncFinalizeStage1()})),pending++,xhr.send()}(pi),asyncFinalizeStage1()}}injectProjectResources(){}}}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){Engineering.DesignerModePartialContentManager=class{constructor(designerModeManager){this.__requests=new Map,this.__requestIdCount=0,this.__designerModeManager=designerModeManager}requestCurrentPartialContent(partialUrl,callback){let requestId=0,loopcount=0;do{if(requestId=0,loopcount++,loopcount>=1e6){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModePartialContentManager] Reached maxium of parallel requests."),requestId=null;break}this.__requestIdCount++,this.__requestIdCount>=1e6&&(this.__requestIdCount=1),requestId=this.__requestIdCount}while(this.__requests.has(requestId));if(null===requestId)return()=>{};let piggyBack=null;try{piggyBack=JSON.stringify({requestId:requestId,requestInstance:TCHMI_DYNAMIC_INSTANCE_ID})}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModePartialContentManager] An uncaught exception occurred:\n",e)}let requestObject={callback:callback,timeoutTimer:setTimeout((()=>{null!==requestId&&this.__requests.delete(requestId),TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_TIMEOUT,details:{code:TcHmi.Errors.E_TIMEOUT,message:TcHmi.Errors[TcHmi.Errors.E_TIMEOUT],domain:"TcHmi.System.Engineering.DesignerModePartialContentManager"}})}),TcHmi.System.config.tcHmiServer.websocketSystemTimeout)},destroy=()=>{null!==requestId&&this.__requests.delete(requestId),requestObject&&(clearTimeout(requestObject.timeoutTimer),requestObject.timeoutTimer=0,requestObject.callback=null,requestObject=null)};return requestObject.destroy=destroy,this.__requests.set(requestId,requestObject),new Engineering.SyncCmdToCreatorRequestCurrentPartialContent({name:"RequestCurrentPartialContent",targetPartial:partialUrl,piggyBack:piggyBack,replyTo:TCHMI_DYNAMIC_INSTANCE_ID}).send(),destroy}getRequest(requestId){let request=this.__requests.get(requestId);return request&&this.__requests.delete(requestId),request}}}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){!function(Engineering){Engineering.DesignerModeUserControlParameterManager=class{constructor(designerModeManager){this.__params=new Map,this.__designerModeManager=designerModeManager,this.__params=new Map}add(name,param){this.__params.set(name,param)}remove(name){this.__params.delete(name)}get(name){if(name)return this.__params.get(name)}}}(System.Engineering||(System.Engineering={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){let Locale;!function(Locale){class Framework extends TcHmi.Locale.Localization{constructor(){super(),this.__namespace="TcHmi.System.Localization.Framework"}}Locale.Framework=Framework}(Locale=System.Locale||(System.Locale={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.LocalizationManager=class{constructor(){this.__files=new Map,this.__systeminitFileFetchPromises=new Map,this.__localizations=new Map,this.__localizationCallbacks=new Map,this.__localizationEngineeringCallbacks=new Map,this.__locale=void 0,this.__localeFallback=void 0,this.__localeEngineering=void 0,this.__localeEngineeringFallback=void 0,this.__localizationData=new Map,this.__localizationFallbackData=new Map,this.__localizationEngineeringData=new Map,this.__localizationEngineeringFallbackData=new Map,this.__localizationDataByNsAndUrl=new Map,this.__localizationFilesRequested=[],this.__localizationFallbackFilesRequested=[],this.__localizationEngineeringFilesRequested=[],this.__localizationEngineeringFallbackFilesRequested=[],this.__pendingToProcessEntries=new Set,this.__callbackMap=new Map,TcHmi.EventProvider.register("onInitialized",(evt=>{evt.destroy(),this.__systeminitFileFetchPromises=null}))}getLocale(options){return TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?this.__localeEngineering??void 0:this.__locale??void 0}getLocaleFallback(options){return TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?this.__localeEngineeringFallback:this.__localeFallback??void 0}getLocaleData(namespace,options){return TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?this.__localizationEngineeringData.get(namespace):this.__localizationData.get(namespace)}setLocaleData(namespace,data,fileurl,options){if(TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering){let namespaceData=this.__localizationDataByNsAndUrl.get(namespace);namespaceData||(namespaceData=new Map,this.__localizationDataByNsAndUrl.set(namespace,namespaceData)),namespaceData.set(fileurl,data),this.__localizationEngineeringData.delete(namespace),namespaceData.forEach((localeData=>{const currentData=this.__localizationEngineeringData.get(namespace);currentData?currentData.localizedText={...currentData.localizedText,...localeData.localizedText}:this.__localizationEngineeringData.set(namespace,localeData)}))}else{let namespaceData=this.__localizationDataByNsAndUrl.get(namespace);namespaceData||(namespaceData=new Map,this.__localizationDataByNsAndUrl.set(namespace,namespaceData)),namespaceData.set(fileurl,data),this.__localizationData.delete(namespace),namespaceData.forEach((localeData=>{const currentData=this.__localizationData.get(namespace);currentData?currentData.localizedText={...currentData.localizedText,...localeData.localizedText}:this.__localizationData.set(namespace,localeData)}))}}getLocaleFallbackData(namespace,options){return TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?this.__localizationEngineeringFallbackData.get(namespace):this.__localizationFallbackData.get(namespace)}setLocaleFallbackData(namespace,data,fileurl,options){if(TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering){let namespaceData=this.__localizationDataByNsAndUrl.get(namespace);namespaceData||(namespaceData=new Map,this.__localizationDataByNsAndUrl.set(namespace,namespaceData)),namespaceData.set(fileurl,data),this.__localizationEngineeringFallbackData.delete(namespace),namespaceData.forEach((localeData=>{const currentData=this.__localizationEngineeringFallbackData.get(namespace);currentData?currentData.localizedText={...currentData.localizedText,...localeData.localizedText}:this.__localizationEngineeringFallbackData.set(namespace,localeData)}))}else{let namespaceData=this.__localizationDataByNsAndUrl.get(namespace);namespaceData||(namespaceData=new Map,this.__localizationDataByNsAndUrl.set(namespace,namespaceData)),namespaceData.set(fileurl,data),this.__localizationFallbackData.delete(namespace),namespaceData.forEach((localeData=>{const currentData=this.__localizationFallbackData.get(namespace);currentData?currentData.localizedText={...currentData.localizedText,...localeData.localizedText}:this.__localizationFallbackData.set(namespace,localeData)}))}}loadLocale(locale,callback){locale||TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Missing locale.",domain:"TcHmi.System.LocalizationManager"}}),TcHmi.System.Services.serverManager.request({requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"SetLocale",writeValue:locale}]},TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,this,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})},success:data=>{if(callback){if(locale===this.__locale)return void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE});let callbackList=this.__callbackMap.get(locale);callbackList||(callbackList=[],this.__callbackMap.set(locale,callbackList)),callbackList.push(callback)}}}))}processLocalizationData(namespace,data,fallback,options){if(!namespace)return TcHmi.Errors.E_PARAMETER_INVALID;const fileLocalizedText=data&&void 0!==data.locale&&null!==data.locale&&data.localizedText?data.localizedText:null,fallbackLocalizedText=fallback?fallback.localizedText:null;let localization=this.__localizations.get(namespace);localization||(localization={application:new Map,engineering:new Map},this.__localizations.set(namespace,localization));let keysToRemove=new Set,level=localization.application;TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering&&(level=localization.engineering);let keyTextBefore=new Map;if(level.forEach(((entry,key)=>{!keyTextBefore.has(key)&&entry&&void 0!==entry.text&&null!==entry.text&&keyTextBefore.set(key,entry.text),keysToRemove.add(key)})),fallbackLocalizedText)for(let key in fallbackLocalizedText){const text=fallbackLocalizedText[key];if(null==text)continue;keysToRemove.delete(key);let entry=level.get(key);entry?tchmi_equal(entry.text,text)||(entry.text=text,entry.fallback=!0,entry.dummy=!1,this.__pendingToProcessEntries.add(entry)):(entry={key:key,text:text,fallback:!0,dummy:!1,callbacks:[]},level.set(key,entry))}if(fileLocalizedText)for(let key in fileLocalizedText){const text=fileLocalizedText[key];if(null==text)continue;keysToRemove.delete(key);let entry=level.get(key);if(entry){if(keyTextBefore.has(key)){tchmi_equal(keyTextBefore.get(key),text)||this.__pendingToProcessEntries.add(entry)}else this.__pendingToProcessEntries.add(entry);entry.text=text,entry.fallback=!1,entry.dummy=!1}else entry={key:key,text:text,fallback:!1,dummy:!1,callbacks:[]},level.set(key,entry)}for(let keyToRemove of keysToRemove.values()){let entry=level.get(keyToRemove);entry&&(entry.dummy=!0,entry.fallback=!1,delete entry.text,this.__pendingToProcessEntries.add(entry))}return TcHmi.Errors.NONE}__processLocaleForNamespace(newLocale,namespace,options,callback){let files=this.__files.get(namespace);if(!files||0===files.size)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR});const locale2fileurl=function(newLocale){if(!newLocale||!files)return;let file=files.get(newLocale);if(!file){const arrNewLanguageAndRegion=newLocale.toLowerCase().split("-");for(let language of Array.from(files.keys()))if(language.toLowerCase().split("-")[0]===arrNewLanguageAndRegion[0])return files.get(language)}return file};let fileFallback,file=locale2fileurl(newLocale);fileFallback=TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?locale2fileurl(this.__localeEngineeringFallback):locale2fileurl(this.__localeFallback),!fileFallback&&(namespace.startsWith("TcHmi.System.Localization.Framework")||namespace.startsWith("TcHmi.System.Localization.Control")||namespace.startsWith("TcHmi.System.Localization.Function"))&&(fileFallback=locale2fileurl("en"));let localeRequestErrorMessage,localeFallbackRequestErrorMessage,localeFileRequested,localeFallbackFileRequested,finishedLocaleRequest=!1,finishedLocaleFallbackRequest=!1,localeRequestHasFailed=!1,localeFallbackRequestHasFailed=!1;const finalize=()=>{if(finishedLocaleRequest&&finishedLocaleFallbackRequest){if(localeRequestHasFailed)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=TcHmi, Module=TcHmi.System.LocalizationManager] Failed to load localization file: "'+localeFileRequested+'" for namespace: "'+namespace+'". Details: "'+localeRequestErrorMessage),void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR});localeFallbackRequestHasFailed&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=TcHmi, Module=TcHmi.System.LocalizationManager] Failed to load fallback localization file: "'+localeFallbackFileRequested+'" for namespace: "'+namespace+'". Details: "'+localeFallbackRequestErrorMessage+'". Proceeding without fallback language support.'),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}};(()=>{if(!fileFallback)return finishedLocaleFallbackRequest=!0,void finalize();if(TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering){let allRequested=!0;if("string"==typeof fileFallback)this.__localizationEngineeringFallbackFilesRequested.includes(fileFallback)||(allRequested=!1,this.__localizationEngineeringFallbackFilesRequested.push(fileFallback));else for(let entry of fileFallback)this.__localizationEngineeringFallbackFilesRequested.includes(entry)||(allRequested=!1,this.__localizationEngineeringFallbackFilesRequested.push(entry));if(allRequested)return finishedLocaleFallbackRequest=!0,void finalize()}else{let allRequested=!0;if("string"==typeof fileFallback)this.__localizationFallbackFilesRequested.includes(fileFallback)||(allRequested=!1,this.__localizationFallbackFilesRequested.push(fileFallback));else for(let entry of fileFallback)this.__localizationFallbackFilesRequested.includes(entry)||(allRequested=!1,this.__localizationFallbackFilesRequested.push(entry));if(allRequested)return finishedLocaleFallbackRequest=!0,void finalize()}localeFallbackFileRequested=fileFallback;const engineeringLocData=[],locData=[];if(fileFallback){const fetcher=(fileFallback,index)=>{let getLocaleData=this.__systeminitFileFetchPromises?.get(fileFallback);return getLocaleData||(getLocaleData=fetch(fileFallback+(TCHMI_ENGINEERING?"?preventcache="+Math.random():"")).then((response=>200===response.status&&response.ok?response.json().catch((reason=>(localeFallbackRequestErrorMessage="Could not parse fallback localization JSON file from "+fileFallback,Promise.reject()))):(localeFallbackRequestErrorMessage=response.statusText,Promise.reject()))),this.__systeminitFileFetchPromises?.set(fileFallback,getLocaleData)),getLocaleData.then((fallbackData=>{if(TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering){engineeringLocData[index]=fallbackData;let namespaceData=this.__localizationDataByNsAndUrl.get(namespace);namespaceData||(namespaceData=new Map,this.__localizationDataByNsAndUrl.set(namespace,namespaceData)),namespaceData.set(fileFallback,fallbackData)}else if(locData[index]=fallbackData,TCHMI_ENGINEERING){let namespaceData=this.__localizationDataByNsAndUrl.get(namespace);namespaceData||(namespaceData=new Map,this.__localizationDataByNsAndUrl.set(namespace,namespaceData)),namespaceData.set(fileFallback,fallbackData)}})).catch((()=>{localeFallbackRequestHasFailed=!0}))};let fetchPromise;if("string"==typeof fileFallback)engineeringLocData.length=1,locData.length=1,fetchPromise=fetcher(fileFallback,0);else if(Array.isArray(fileFallback)){engineeringLocData.length=fileFallback.length,locData.length=fileFallback.length;let promiseArray=[];for(const[index,fileFallbackItem]of fileFallback.entries())promiseArray.push(fetcher(fileFallbackItem,index));fetchPromise=Promise.all(promiseArray)}else fetchPromise=Promise.reject();fetchPromise.catch((()=>{})).then((()=>{if(TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering){this.__localizationEngineeringFallbackData.delete(namespace);for(const fallbackData of engineeringLocData){if(!fallbackData)continue;const currentData=this.__localizationEngineeringFallbackData.get(namespace);currentData?currentData.localizedText={...currentData.localizedText,...fallbackData.localizedText}:this.__localizationEngineeringFallbackData.set(namespace,fallbackData)}}else{this.__localizationFallbackData.delete(namespace);for(const fallbackData of locData){if(!fallbackData)continue;const currentData=this.__localizationFallbackData.get(namespace);currentData?currentData.localizedText={...currentData.localizedText,...fallbackData.localizedText}:this.__localizationFallbackData.set(namespace,fallbackData)}}finishedLocaleFallbackRequest=!0,finalize()}))}else finishedLocaleFallbackRequest=!0,finalize()})(),(()=>{if(!file)return finishedLocaleRequest=!0,void finalize();if(TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering){let allRequested=!0;if("string"==typeof file)this.__localizationEngineeringFilesRequested.includes(file)||(allRequested=!1,this.__localizationEngineeringFilesRequested.push(file));else for(let entry of file)this.__localizationEngineeringFilesRequested.includes(entry)||(allRequested=!1,this.__localizationEngineeringFilesRequested.push(entry));if(allRequested)return finishedLocaleRequest=!0,void finalize()}else{let allRequested=!0;if("string"==typeof file)this.__localizationFilesRequested.includes(file)||(allRequested=!1,this.__localizationFilesRequested.push(file));else for(let entry of file)this.__localizationFilesRequested.includes(entry)||(allRequested=!1,this.__localizationFilesRequested.push(entry));if(allRequested)return finishedLocaleRequest=!0,void finalize()}if(file){localeFileRequested=file;const engineeringLocData=[],locData=[],fetcher=(file,index)=>{let getLocaleData=this.__systeminitFileFetchPromises?.get(file);return getLocaleData||(getLocaleData=fetch(file+(TCHMI_ENGINEERING?"?preventcache="+Math.random():"")).then((response=>200===response.status&&response.ok?response.json().catch((reason=>(localeRequestErrorMessage="Could not parse localization JSON file from"+file,Promise.reject()))):(localeRequestErrorMessage=response.statusText,Promise.reject()))),this.__systeminitFileFetchPromises?.set(file,getLocaleData)),getLocaleData.then((localeData=>{if(TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering){engineeringLocData[index]=localeData;let namespaceData=this.__localizationDataByNsAndUrl.get(namespace);namespaceData||(namespaceData=new Map,this.__localizationDataByNsAndUrl.set(namespace,namespaceData)),namespaceData.set(file,localeData)}else if(locData[index]=localeData,TCHMI_ENGINEERING){let namespaceData=this.__localizationDataByNsAndUrl.get(namespace);namespaceData||(namespaceData=new Map,this.__localizationDataByNsAndUrl.set(namespace,namespaceData)),namespaceData.set(file,localeData)}})).catch((()=>{localeRequestHasFailed=!0}))};let fetchPromise;if("string"==typeof file)engineeringLocData.length=1,locData.length=1,fetchPromise=fetcher(file,0);else if(Array.isArray(file)){engineeringLocData.length=file.length,locData.length=file.length;let promiseArray=[];for(const[index,fileItem]of file.entries())promiseArray.push(fetcher(fileItem,index));fetchPromise=Promise.all(promiseArray)}else fetchPromise=Promise.reject();fetchPromise.catch((()=>{})).then((()=>{if(TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering){this.__localizationEngineeringData.delete(namespace);for(const localeData of engineeringLocData){if(!localeData)continue;const currentData=this.__localizationEngineeringData.get(namespace);currentData?currentData.localizedText={...currentData.localizedText,...localeData.localizedText}:this.__localizationEngineeringData.set(namespace,localeData)}}else{this.__localizationData.delete(namespace);for(const localeData of locData){if(!localeData)continue;const currentData=this.__localizationData.get(namespace);currentData?currentData.localizedText={...currentData.localizedText,...localeData.localizedText}:this.__localizationData.set(namespace,localeData)}}finishedLocaleRequest=!0,finalize()}))}else finishedLocaleRequest=!0,finalize()})()}processLocale(newLocale,options,callback){let localeOld,savedCallbackList=this.__callbackMap.get(newLocale)??[];callback&&savedCallbackList.push(callback),savedCallbackList.push((()=>{this.__callbackMap.delete(newLocale)})),TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?newLocale!==this.__localeEngineering&&(this.__localizationEngineeringFilesRequested=[],this.__localizationEngineeringData.clear()):newLocale!==this.__locale&&(this.__localizationFilesRequested=[],this.__localizationData.clear()),TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?(localeOld=this.__localeEngineering,this.__localeEngineering=newLocale):(localeOld=this.__locale,this.__locale=newLocale),document.documentElement.lang=newLocale??"";let namespaces=[];const finalize=()=>{if(!(pending>0)){for(let namespace of namespaces){let localeData,localeFallbackData;TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?(localeData=this.__localizationEngineeringData.get(namespace),localeFallbackData=this.__localizationEngineeringFallbackData.get(namespace)):(localeData=this.__localizationData.get(namespace),localeFallbackData=this.__localizationFallbackData.get(namespace));this.processLocalizationData(namespace,localeData,localeFallbackData,options)!==TcHmi.Errors.NONE&&TcHmi.Log.error('[Source=TcHmi, Module=TcHmi.System.LocalizationManager] Processing localization data "" for locale: "'+newLocale+'" of namespace: "'+namespace+'" failed.')}this.resolveControlLocalizationFileInheritation(),this.processPendingEntryWatches(),this.processLocalizationWatches(namespaces,options),TcHmi.System.Callback.callSafeCallbacks1Param(savedCallbackList,null,{error:TcHmi.Errors.NONE}),TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?localeOld!==newLocale&&TcHmi.EventProvider.raise("onEngineeringLocaleChanged",newLocale):localeOld!==newLocale&&TcHmi.EventProvider.raise("onLocaleChanged",newLocale)}};let pending=this.__files.size;this.__files.forEach(((files,namespace)=>{this.__processLocaleForNamespace(newLocale,namespace,options,(data=>{pending--,data.error===TcHmi.Errors.NONE&&namespaces.push(namespace),finalize()}))})),0===this.__files.size&&finalize()}processPendingEntryWatches(){for(let entry of this.__pendingToProcessEntries.values()){let callbackList=[];for(let j=0,jj=entry.callbacks.length;j<jj;j++)callbackList[j]=entry.callbacks[j];for(let innerCallback of callbackList)entry.callbacks.includes(innerCallback)&&TcHmi.Callback.callSafeEx(innerCallback.callback,this,{error:TcHmi.Errors.NONE,text:entry.text??entry.key,destroy:innerCallback.destroy})}this.__pendingToProcessEntries.clear()}processLocalizationWatches(namespace,options){let namespaces=[];Array.isArray(namespace)?namespaces=namespace:namespaces.push(namespace);for(let namespace of namespaces){let localizationCallbacks;if(localizationCallbacks=TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?this.__localizationEngineeringCallbacks.get(namespace):this.__localizationCallbacks.get(namespace),localizationCallbacks){let localizationReader=this.get(namespace);for(let i=0,ii=localizationCallbacks.length;i<ii;i++){let localizationCallback=localizationCallbacks[i];localizationCallback&&TcHmi.Callback.callSafeEx(localizationCallback.callback,this,{error:TcHmi.Errors.NONE,reader:localizationReader,destroy:localizationCallback.destroy})}}}}registerLocalizationFile(namespace,locale,pathOrPathArray){let files=this.__files.get(namespace);files||(files=new Map,this.__files.set(namespace,files)),files.set(locale,pathOrPathArray)}unregisterLocalizationFile(namespace,locale,pathOrPathArray){let files=this.__files.get(namespace);files&&(files.has(locale)&&tchmi_equal(files.get(locale),pathOrPathArray)&&files.delete(locale),0===files.size&&this.__files.delete(namespace))}resolveControlLocalizationFileInheritation(){if(!TcHmi.System.Services.controlManager)return;let root=TcHmi.System.Services.controlManager.getInheritanceTree();if(!root)return;const merge=(entry,parents)=>{let inheritationHierarchyPath=[entry];parents&&(inheritationHierarchyPath=parents.concat([entry]));let currentInheritationApplicationLocalizations=[],currentInheritationEngineeringLocalizations=[];for(let i=0,ii=inheritationHierarchyPath.length;i<ii;i++){let current=inheritationHierarchyPath[i];if(!current)continue;let isNew=!1,currentLocalization=this.__localizations.get("TcHmi.System.Localization.Control<"+current.controlType+">");currentLocalization||(isNew=!0,currentLocalization={application:new Map,engineering:new Map});for(let j=0,jj=currentInheritationApplicationLocalizations.length;j<jj;j++){let currentInheritationApplicationLocalization=currentInheritationApplicationLocalizations[j];currentInheritationApplicationLocalization&&currentInheritationApplicationLocalization.forEach(((localizedText,key)=>{if(currentLocalization.application.has(key)){let entryToUpdate=currentLocalization.application.get(key);entryToUpdate&&(entryToUpdate.text=localizedText.text,entryToUpdate.dummy=localizedText.dummy,entryToUpdate.fallback=localizedText.fallback)}else currentLocalization.application.set(key,{key:key,text:localizedText.text,dummy:localizedText.dummy,fallback:localizedText.fallback,callbacks:[]})}))}for(let j=0,jj=currentInheritationEngineeringLocalizations.length;j<jj;j++){let currentInheritationEngineeringLocalization=currentInheritationEngineeringLocalizations[j];currentInheritationEngineeringLocalization&&currentInheritationEngineeringLocalization.forEach(((localizedText,key)=>{if(currentLocalization.engineering.has(key)){let entryToUpdate=currentLocalization.engineering.get(key);entryToUpdate&&(entryToUpdate.text=localizedText.text,entryToUpdate.dummy=localizedText.dummy,entryToUpdate.fallback=localizedText.fallback)}else currentLocalization.engineering.set(key,{key:key,text:localizedText.text,dummy:localizedText.dummy,fallback:localizedText.fallback,callbacks:[]})}))}currentInheritationApplicationLocalizations.push(currentLocalization.application),currentInheritationEngineeringLocalizations.push(currentLocalization.engineering),isNew&&this.__localizations.set("TcHmi.System.Localization.Control<"+current.controlType+">",currentLocalization)}},recurse=(entry,parents)=>{if(entry)for(let i=0,ii=entry.children.length;i<ii;i++){let child=entry.children[i],parentsNew=[];if(parents&&0!==parents.length){parentsNew=[];for(let i=0,ii=parents.length;i<ii;i++)parentsNew.push(parents[i]);parentsNew.push(entry)}else parentsNew.push(entry);child.children&&child.children.length>0?recurse(child,parentsNew):merge(child,parentsNew)}};recurse(root,null)}setFallbackLocale(fallback){this.__localeFallback=fallback??void 0}resetFallbackLocale(callback=null){this.__localizationFallbackData.clear(),this.__localizationFallbackFilesRequested=[],this.processLocale(this.__locale)}getFiles(){return this.__files}get(namespace,options){let res={},localization=this.__localizations.get(namespace);if(!localization)return new TcHmi.Locale.LocalizationReader(res);let level=localization.application;return TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering&&(level=localization.engineering),level.forEach(((entry,key)=>{entry.dummy||(res[key]=entry.text)})),new TcHmi.Locale.LocalizationReader(res)}watch(namespace,options={},callback){let localization=this.__localizations.get(namespace);localization||(localization={application:new Map,engineering:new Map},this.__localizations.set(namespace,localization));let callbackCacheEntry={callback:callback,destroy:()=>{}},callbackCache=this.__localizationCallbacks.get(namespace);callbackCache?callbackCache.push(callbackCacheEntry):(callbackCache=[callbackCacheEntry],this.__localizationCallbacks.set(namespace,callbackCache));let destroy=()=>{if(!callbackCache)return;let pos=callbackCache.indexOf(callbackCacheEntry);pos>-1&&callbackCache.splice(pos,1),0===callbackCache.length&&this.__localizationCallbacks.delete(namespace)};callbackCacheEntry.destroy=destroy;let reader=this.get(namespace,options);return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,reader:reader,destroy:destroy}),destroy}getText(namespace,key,options){let localization=this.__localizations.get(namespace);if(localization){let level=localization.application;TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering&&(level=localization.engineering);let entry=level.get(key);return!entry||entry.dummy?key:entry.text??key}return key}watchText(namespace,key,options={},callback){let localization=this.__localizations.get(namespace);localization||(localization={application:new Map,engineering:new Map},this.__localizations.set(namespace,localization));let level=localization.application;TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering&&(level=localization.engineering);let entry=level.get(key);entry||(entry={key:key,fallback:!1,dummy:!0,callbacks:[]},level.set(key,entry));let destroy=function(){if(!entry)return;let index=entry.callbacks.indexOf(co);-1!==index&&(entry.callbacks.splice(index,1),co.callback=void 0)},co={callback:callback,destroy:destroy};return entry.callbacks.push(co),entry.dummy?TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,text:key,destroy:destroy}):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,text:entry.text??key,destroy:destroy}),destroy}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){class ServerManager{constructor(){this.__isInitialized=!1,this.__disabledCommunication=!1,this.__lastConnectState=0,this.__cyclicReconnect=!1,this.__symbolWatchEntryCacheByOptions=new Map,this.__symbolWatchEntryCacheById=new Map,this.__symbolWatchEntryGroups=new Map,this.__requestCache=new Map,this.__requestQueue=[],this.__requestQueuePendingRequest=null,this.__requestIdCount=0,this.__requestGroups=new Map,this.__conWatcherIntervalId=0,this.__firstAccessReject=0,this.__firstAccessRejectTimeoutId=0,this.__symbolWatcherIntervalId=0,this.__symbolWatcherStartTime=Date.now(),this.__checkLicenseSubscriptionId=null,this.__serverStateUrlApiVersion=2,this.__serverStateWatcherIntervalId=0,this.__serverState=null,this.__serverStateOld=null,this.__serverStateLastErrorStatus=null,this.__serverStateLastErrorStatusText=null,this.__serverStateLastErrorStatusOld=null,this.__serverStateLastErrorStatusTextOld=null,this.__serverStateRepeatingInfoConfirmend=!1,this.__serverStateLastRepeatingInfoConfirmend=!1,this.__forceShowErrorOnClose=!1,this.__forcedClose=!1,this.resolveServerState=callback=>{let urlv1=this.__serverBaseUri+"/Config/ServerState",urlv2=urlv1+"/v2",proc=url=>{let xhr=new XMLHttpRequest;xhr.open("GET",url),xhr.addEventListener("load",(evt=>{if(200!==xhr.status)return 404===xhr.status&&url===urlv2?(this.__serverStateUrlApiVersion=1,void proc(urlv1)):(this.__serverStateLastErrorStatusOld=this.__serverStateLastErrorStatus,this.__serverStateLastErrorStatusTextOld=this.__serverStateLastErrorStatusText,this.__serverStateLastErrorStatus=xhr.status,this.__serverStateLastErrorStatusText=xhr.statusText,void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR]}}));let response;this.__serverStateLastErrorStatusOld=this.__serverStateLastErrorStatus,this.__serverStateLastErrorStatusTextOld=this.__serverStateLastErrorStatusText,this.__serverStateLastErrorStatus=null,this.__serverStateLastErrorStatusText=null;try{response=JSON.parse(xhr.responseText)}catch(e){return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR]}})}response?(this.__serverStateOld=this.__serverState,this.__serverState=response,TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR]}})})),xhr.addEventListener("error",(evt=>{TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR]}})})),xhr.send()};if(1===this.__serverStateUrlApiVersion)proc(urlv1);else proc(urlv2)},this.resolveHandleServerState=callback=>{this.resolveServerState((data=>{let timedClient=this.__serverState?.timedClient,timedClientOld=this.__serverStateOld?.timedClient,maintenanceMode=this.__serverState?.maintenanceMode;this.__serverStateOld?.maintenanceMode;if(null!==this.__serverStateLastErrorStatus&&this.__serverStateOld&&this.__serverStateOld.maintenanceMode&&this.__serverStateOld.maintenanceMode.isActive&&this.__serverStateOld.maintenanceMode.isMaintenanceUser)return void window.location.reload();if(this.__serverState&&this.__serverState.maintenanceMode&&this.__serverState.maintenanceMode.isActive&&!this.__serverState.maintenanceMode.isMaintenanceUser)return this.__forceShowErrorOnClose=!0,this.__forcedClose=!0,this.close(),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Maintenance_Mode_Lock",{level:TcHmi.Locale.Level.Engineering})+"<br>"+TcHmi.System.Services.localization.getText("Restore_When_Maintenance_Mode_Lock_Cleared",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),void TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay);if(this.__serverState&&this.__serverState.maintenanceMode&&!this.__serverState.maintenanceMode.isActive&&!this.__serverState.maintenanceMode.isMaintenanceUser&&this.__serverStateOld&&this.__serverStateOld.maintenanceMode&&this.__serverStateOld.maintenanceMode.isActive&&!this.__serverStateOld.maintenanceMode.isMaintenanceUser)return TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!1,TcHmi.DialogManager.DialogType.Overlay),void this.open();let resolveTimer=then=>{let hours=-1,minutes=-1,seconds=-1;if(2===this.__serverStateUrlApiVersion){let parts=ServerManager.REGEXP_ISO8601_DURATION_PARTS.exec(then);const days=parseInt(parts?.[4]??"0",10);hours=parseInt(parts?.[6]??"0",10),minutes=parseInt(parts?.[7]??"0",10),seconds=parseInt(parts?.[8]??"0",10),days>0&&(hours+=24*days)}else{let now=this.__serverState?.serverTime?new Date(this.__serverState.serverTime).getTime():Date.now(),timeleft=new Date(then).getTime()-now,baseHours=36e5,baseMinutes=6e4,baseSeconds=1e3;hours=-1,timeleft>=0&&(hours=Math.floor(timeleft/baseHours),timeleft-=hours*baseHours),minutes=-1,timeleft>=0&&(minutes=Math.floor(timeleft/baseMinutes),timeleft-=minutes*baseMinutes),seconds=-1,timeleft>=0&&(seconds=Math.floor(timeleft/baseSeconds),timeleft-=seconds*baseSeconds)}return(hours<0?"00":hours>=10?hours:"0"+hours)+":"+(minutes<0?"00":minutes>=10?minutes:"0"+minutes)+":"+(seconds<0?"00":seconds>=10?seconds:"0"+seconds)},showWaterMark=then=>{if(!then)return;let timer=resolveTimer(then);TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Watermark,{forceable:!0}),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",timer,{dialogType:TcHmi.DialogManager.DialogType.Watermark,severity:TcHmi.DialogManager.DialogSeverity.Info})},resolveTimeLeft=then=>{let timeleft=0,parts=ServerManager.REGEXP_ISO8601_DURATION_PARTS.exec(then),days=parseInt(parts?.[4]??"0",10);days>0&&(timeleft+=24*days*60*60*1e3);let hours=parseInt(parts?.[6]??"0",10);hours>0&&(timeleft+=60*hours*60*1e3);let minutes=parseInt(parts?.[7]??"0",10);minutes>0&&(timeleft+=60*hours*1e3);let seconds=parseInt(parts?.[8]??"0",10);return minutes>0&&(timeleft+=1e3*seconds),timeleft};if(timedClient&&timedClient.isTimed){if(timedClientOld&&timedClientOld.isTimed&&timedClientOld.expiration&&timedClientOld.availableAgain&&(!timedClient||timedClient&&!timedClient.isTimed||timedClient&&timedClient.isTimed&&!timedClient.availableAgain))return void window.location.reload();if(timedClient&&timedClient.isTimed&&timedClient.expiration&&!timedClient.availableAgain){let timeleft;if(2===this.__serverStateUrlApiVersion)timeleft=resolveTimeLeft(timedClient.expiration);else{let now=this.__serverState?.serverTime?new Date(this.__serverState.serverTime).getTime():Date.now(),then=new Date(timedClient.expiration).getTime();timeleft=then-now}const timeleftLastWarning=12e4;if(!this.__serverStateRepeatingInfoConfirmend||!this.__serverStateLastRepeatingInfoConfirmend&&timeleft<=timeleftLastWarning){let buttonGuid=tchmi_create_guid(),timer=resolveTimer(timedClient.expiration);TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay,{forceable:!0}),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",tchmi_format_string(TcHmi.System.Services.localization.getText("Time_Based_Client_License_Mode",{level:TcHmi.Locale.Level.Engineering}),timer)+'<br />\n<br />\n<input id="'+buttonGuid+'" type="submit" value="'+TcHmi.System.Services.localization.getText("OK",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;">',{severity:TcHmi.DialogManager.DialogSeverity.Info,buttonReload:!1}),document.getElementById(buttonGuid)?.addEventListener("click",(e=>{this.__serverStateRepeatingInfoConfirmend=!0,timeleft<=timeleftLastWarning&&(this.__serverStateLastRepeatingInfoConfirmend=!0),TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!1,TcHmi.DialogManager.DialogType.Overlay),timedClient&&timedClient.expiration&&showWaterMark(timedClient.expiration)}))}else showWaterMark(timedClient.expiration)}else if(timedClient&&timedClient.isTimed&&timedClient.expiration&&timedClient.availableAgain){let timer=resolveTimer(timedClient.availableAgain);TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Time_Based_Client_License_Client_Limit_Exceeded",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.System.Services.localization.getText("Reloading_When_Client_License_Available",{level:TcHmi.Locale.Level.Engineering})+" "+tchmi_format_string(TcHmi.System.Services.localization.getText("Time_Based_Client_License_Available_Again_In",{level:TcHmi.Locale.Level.Engineering}),timer),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay)}}else if(maintenanceMode&&maintenanceMode.isActive&&maintenanceMode.isMaintenanceUser){let timeleft=resolveTimeLeft(maintenanceMode.timer);const timeleftLastWarning=12e4;if(!this.__serverStateRepeatingInfoConfirmend||!this.__serverStateLastRepeatingInfoConfirmend&&timeleft<=timeleftLastWarning){let buttonGuid=tchmi_create_guid(),timer=resolveTimer(maintenanceMode.timer);TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay,{forceable:!0}),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",tchmi_format_string(TcHmi.System.Services.localization.getText("Maintenance_Mode",{level:TcHmi.Locale.Level.Engineering}),timer)+'<br />\n<br />\n<input id="'+buttonGuid+'" type="submit" value="'+TcHmi.System.Services.localization.getText("OK",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;">',{severity:TcHmi.DialogManager.DialogSeverity.Info,buttonReload:!1}),document.getElementById(buttonGuid)?.addEventListener("click",(e=>{this.__serverStateRepeatingInfoConfirmend=!0,timeleft<=timeleftLastWarning&&(this.__serverStateLastRepeatingInfoConfirmend=!0),TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!1,TcHmi.DialogManager.DialogType.Overlay),maintenanceMode&&maintenanceMode.timer&&showWaterMark(maintenanceMode.timer)}))}else showWaterMark(maintenanceMode.timer)}let publishInProgress=!1,publishInProgressOld=!1;if(this.__serverState&&void 0!==this.__serverState.publishInProgress&&(publishInProgress=this.__serverState.publishInProgress),this.__serverStateOld&&void 0!==this.__serverStateOld.publishInProgress&&(publishInProgressOld=this.__serverStateOld.publishInProgress),null===this.__serverStateLastErrorStatus&&!0===publishInProgress&&!1===publishInProgressOld)TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Publish_In_Progress",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.System.Services.localization.getText("Application_Reload_When_Publish_Done",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Warning,buttonReload:!TCHMI_DESIGNER});else if(null===this.__serverStateLastErrorStatus&&!1===publishInProgress&&!0===publishInProgressOld)return void window.location.reload();465===this.__serverStateLastErrorStatus?(TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",(this.__websocket?"":TcHmi.System.Services.localization.getText("Server_Connection_Lost",{level:TcHmi.Locale.Level.Engineering})+" ")+TcHmi.System.Services.localization.getText("Client_Limit_Exceeded",{level:TcHmi.Locale.Level.Engineering})+"<br />"+(this.__websocket?"":(this.__forcedClose?TcHmi.System.Services.localization.getText("Forced_Logout_By_Framework",{level:TcHmi.Locale.Level.Engineering}):TcHmi.System.Services.localization.getText("Forced_Logout_By_Server",{level:TcHmi.Locale.Level.Engineering}))+"<br />")+TcHmi.System.Services.localization.getText("Reloading_When_Client_License_Available",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay)):460===this.__serverStateLastErrorStatus?(TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",(this.__websocket?"":TcHmi.System.Services.localization.getText("Server_Connection_Lost",{level:TcHmi.Locale.Level.Engineering})+" ")+TcHmi.System.Services.localization.getText("License_Expired",{level:TcHmi.Locale.Level.Engineering})+"<br />"+(this.__websocket?"":(this.__forcedClose?TcHmi.System.Services.localization.getText("Forced_Logout_By_Framework",{level:TcHmi.Locale.Level.Engineering}):TcHmi.System.Services.localization.getText("Forced_Logout_By_Server",{level:TcHmi.Locale.Level.Engineering}))+"<br />")+TcHmi.System.Services.localization.getText("Reloading_When_Client_License_Available",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay)):null!==this.__serverStateLastErrorStatus&&(TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",(this.__websocket?"":TcHmi.System.Services.localization.getText("Server_Connection_Lost",{level:TcHmi.Locale.Level.Engineering})+" ")+tchmi_format_string(TcHmi.System.Services.localization.getText("Server_State_Request_Failed",{level:TcHmi.Locale.Level.Engineering}),"Status: "+this.__serverStateLastErrorStatus+", Text: "+this.__serverStateLastErrorStatusText)+"<br />"+(this.__websocket?"":(this.__forcedClose?TcHmi.System.Services.localization.getText("Forced_Logout_By_Framework",{level:TcHmi.Locale.Level.Engineering}):TcHmi.System.Services.localization.getText("Forced_Logout_By_Server",{level:TcHmi.Locale.Level.Engineering}))+"<br />")+TcHmi.System.Services.localization.getText("Reloading_When_Error_State_Cleared",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay)),this.__websocket&&!1===this.__forcedClose&&null===this.__serverStateLastErrorStatusOld&&null!==this.__serverStateLastErrorStatus&&(this.__forceShowErrorOnClose=!0,this.__forcedClose=!0,this.close()),this.__serverState&&this.__serverState.publishInProgress||(!this.__websocket&&this.__forcedClose&&null===this.__serverStateLastErrorStatus?this.reconnect():null===this.__serverStateLastErrorStatus&&null!==this.__serverStateLastErrorStatusOld&&window.location.reload()),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}))},this.__disableCommunication=evt=>{"__TcHmiServerManager"===TcHmi.System.Services.dialogManager.getDialogOwner()&&TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!1),this.__disabledCommunication=!0,this.__cyclicReconnect=!1,this.__lastConnectState=4,this.close()},TcHmi.EventProvider.register("System.disableCommunication",this.__disableCommunication),this.__serverBaseUri=TcHmi.System.hostBaseUri,this.__serverWebsocketUri=this.__serverBaseUri.replace("http:","ws:").replace("https:","wss:")}watchServerState(){TCHMI_ENGINEERING||this.__serverStateWatcherIntervalId||(this.__serverStateWatcherIntervalId=setInterval((()=>{this.resolveHandleServerState()}),TCHMI_SERVER_STATE_WATCH_INTERVAL))}unwatchServerState(){this.__serverStateWatcherIntervalId&&(clearInterval(this.__serverStateWatcherIntervalId),this.__serverStateWatcherIntervalId=0)}onWsOpen(callback){let __this=this;return function(openEvent){if(!__this.__websocket)return void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.System.ServerManager"},url:this.url});TCHMI_ENGINEERING&&TcHmi.Engineering.ErrorPane.remove("E_SERVER_CONNECTION_LOST"),!1===TCHMI_UNITTEST_MODE&&__this.watchServerState(),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ServerManager] WebSocket with url="+__this.__websocket.url+" opened.");let callbackPending=!0,licenseCheck=callback=>{if(__this.__checkLicenseSubscriptionId=TcHmi.Server.subscribeEx([{commandOptions:["SendErrorMessage"],symbol:"Diagnostics::LICENSE"}],1e3,{timeout:TcHmi.System.config.tcHmiServer.websocketSystemTimeout,parallel:!0},(data=>{let connectState=1,errorDetails={code:TcHmi.Errors.NONE};if(data&&data.response&&(data.error===TcHmi.Errors.NONE||data.error===TcHmi.Errors.E_SERVER_RESPONSE_ERROR)){let error=data.response.error;if(void 0!==error)error.code===TcHmi.Server.Error.HMI_E_MISSING_LICENSE_HANDSHAKE||error.code===TcHmi.Server.Error.HMI_E_LICENSE_VERIFY||error.code===TcHmi.Server.Error.HMI_E_LICENSE_TARGET?(connectState=6,errorDetails.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING,TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("License_Missing",{level:TcHmi.Locale.Level.Engineering})+'<br />\n<br />\n<input type="submit" value="'+TcHmi.System.Services.localization.getText("Reload",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;" onclick="window.location.reload()">"',{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER})):(connectState=1,errorDetails.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_CHECK_FAILED,TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_License_Check_Failed",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.DialogManager.buildMessage(error),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}));else{let commands=data.response.commands;if(null==commands||void 0===commands[0]||null===commands[0])connectState=1,TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_License_Check_Failed",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.System.Services.localization.getText("Server_Response_Invalid",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Missing_Commands_Or_Command",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER});else if(void 0!==commands[0].error){let cmdErr=commands[0].error;if(cmdErr.code===TcHmi.Server.Error.HMI_E_MISSING_LICENSE_HANDSHAKE||cmdErr.code===TcHmi.Server.Error.HMI_E_LICENSE_VERIFY||cmdErr.code===TcHmi.Server.Error.HMI_E_LICENSE_TARGET)connectState=6,errorDetails.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING,errorDetails.errors=[cmdErr],TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TCHMI_DESIGNER?TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("License_Missing",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Try_Reopen_Designer_Window",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}):TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("License_Missing",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER});else if(cmdErr.code===TcHmi.Server.Error.HMI_E_INSUFFICIENT_ACCESS)if(TCHMI_DESIGNER)connectState=5,errorDetails.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_NO_ACCESS,errorDetails.errors=[cmdErr],TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_License_Check_Failed",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.System.Services.localization.getText("Insufficient_Access",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Try_Reopen_Designer_Window",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER});else{let bRecon=!1;if(0===__this.__lastConnectState)try{const lsReconCount=window.localStorage.getItem(TcHmi.System.hostPrefix+"TcHmi.System.ServerManager.reconnectCount")??"0",nReconCount=parseInt(lsReconCount,10)+1;window.localStorage.setItem(TcHmi.System.hostPrefix+"TcHmi.System.ServerManager.reconnectCount",nReconCount.toString()),nReconCount<2&&(bRecon=!0)}catch(ex){}if(bRecon)return void window.location.reload();window.localStorage.removeItem(TcHmi.System.hostPrefix+"TcHmi.System.ServerManager.reconnectCount"),connectState=5,errorDetails.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_NO_ACCESS,errorDetails.errors=[cmdErr],TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_License_Check_Failed",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.System.Services.localization.getText("Insufficient_Access",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER})}else connectState=2,errorDetails.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_CHECK_FAILED,errorDetails.errors=[cmdErr],TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_License_Check_Failed",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.DialogManager.buildMessage(cmdErr),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER})}else{let rv=commands[0].readValue;if(null==rv)connectState=1,errorDetails.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_CHECK_FAILED,errorDetails.reason="Server response is invalid. Missing readValue in command object.",TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_License_Check_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Server_Response_Invalid",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Missing_ReadValue",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER});else switch(rv.STATE){case"Engineering":case"Demo":case"OK":connectState=3,TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!1,TcHmi.DialogManager.DialogType.Overlay);break;case"Unregistered":case"Pending":case"Error":connectState=6,errorDetails.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING,errorDetails.reason="License state: '"+rv.STATE+"'.",TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("License_Missing",{level:TcHmi.Locale.Level.Engineering})+" "+tchmi_format_string(TcHmi.System.Services.localization.getText("License_State_Placeholder",{level:TcHmi.Locale.Level.Engineering}),rv.STATE),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER});break;default:connectState=6,errorDetails.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING,errorDetails.reason="Unknown license state: '"+rv.STATE+"'.",TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("License_Missing",{level:TcHmi.Locale.Level.Engineering})+" "+tchmi_format_string(TcHmi.System.Services.localization.getText("License_State_Unknown_Placeholder",{level:TcHmi.Locale.Level.Engineering}),rv.STATE),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER})}}}}else if(connectState=1,errorDetails.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_CHECK_FAILED,TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),data.error!==TcHmi.Errors.NONE){let details=data.details;details||(details={code:data.error,message:TcHmi.Errors[data.error]}),errorDetails.errors=[details],TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_License_Check_Failed",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.DialogManager.buildMessage(details),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER})}else TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_License_Check_Failed",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER});TcHmi.Callback.callSafeEx(callback,null,{error:errorDetails.code,details:errorDetails,connectState:connectState})})),__this.__checkLicenseSubscriptionId){let request=__this.__requestCache.get(__this.__checkLicenseSubscriptionId);request&&(request.refreshLock=!0)}},finalize=(connectState,errorDetails)=>{errorDetails||(errorDetails={code:TcHmi.Errors.NONE});let result={error:errorDetails.code,url:this.url,details:errorDetails};if(errorDetails.message=TcHmi.Errors[errorDetails.code],errorDetails.domain="TcHmi.System.ServerManager",callbackPending&&"function"==typeof callback&&"__TcHmiServerManager"===TcHmi.System.Services.dialogManager.getDialogOwner()&&TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!1),3===connectState)__this.__isInitialized=!0,__this.__cyclicReconnect=!0,__this.__forceShowErrorOnClose=!1,__this.__forcedClose=!1,window.localStorage.removeItem(TcHmi.System.hostPrefix+"TcHmi.System.ServerManager.reconnectCount"),callbackPending&&(callbackPending=!1,0!==__this.__conWatcherIntervalId&&(window.clearInterval(__this.__conWatcherIntervalId),__this.__conWatcherIntervalId=0),__this.refreshSubscriptions((function(data){TcHmi.EventProvider.raise("onWebSocketOpened"),TcHmi.Callback.callSafeEx(callback,null,result),__this.__lastConnectState=connectState,0===__this.__symbolWatcherIntervalId&&(__this.__symbolWatcherStartTime=Date.now(),__this.__symbolWatcherIntervalId=window.setInterval(__this.symbolWatcherTick(),100))})));else if(6===connectState){if(TCHMI_ENGINEERING){const now=Date.now();let isFirstReject=!1;0===__this.__firstAccessReject&&(isFirstReject=!0),__this.__lastConnectState!==connectState&&(__this.__firstAccessReject=now),isFirstReject&&0===__this.__firstAccessRejectTimeoutId?(__this.__firstAccessReject=0,__this.__firstAccessRejectTimeoutId=setTimeout((()=>{6===__this.__lastConnectState&&(callbackPending&&(TcHmi.Callback.callSafeEx(callback,null,result),callbackPending=!1),__this.__firstAccessRejectTimeoutId=0)}),5e3)):now-__this.__firstAccessReject>5e3&&(__this.__firstAccessReject=0,0!==__this.__firstAccessRejectTimeoutId&&(clearTimeout(__this.__firstAccessRejectTimeoutId),__this.__firstAccessRejectTimeoutId=0),callbackPending&&(TcHmi.Callback.callSafeEx(callback,null,result),callbackPending=!1),callbackPending=!1)}else callbackPending&&(TcHmi.Callback.callSafeEx(callback,null,result),callbackPending=!1),callbackPending=!1;__this.__lastConnectState=connectState}else __this.__lastConnectState=connectState,callbackPending&&(TcHmi.Callback.callSafeEx(callback,null,result),callbackPending=!1)};if(__this.__serverState&&__this.__serverState.frameworkApiVersion){let cvres=TcHmi.System.compareVersionStrings(__this.__serverState.frameworkApiVersion,"1.0.0.0");if(0===cvres||1===cvres)return void TcHmi.Server.requestEx({requestType:"ReadWrite",commands:[{commandOptions:["ProcessTimingAsTimespan","SendErrorMessage"],symbol:"__FrameworkHandshake",writeValue:{frameworkApiVersion:"1.0.0.0"}}]},{parallel:!0},(data=>{if(data.error!==TcHmi.Errors.NONE){let errObj;return errObj=data.error===TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING||data.details?.code===TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING||data.details?.errors?.some((error=>error.code===TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING))?{error:TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING,details:{code:TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING],domain:"TcHmi.System.ServerManager"},url:this.url}:{error:TcHmi.Errors.E_SERVER_HANDSHAKE,details:{code:TcHmi.Errors.E_SERVER_HANDSHAKE,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_HANDSHAKE],domain:"TcHmi.System.ServerManager"},url:this.url},data.details&&(errObj.details.errors=[data.details]),void TcHmi.Callback.callSafeEx(callback,null,errObj)}__this.__serverState?.maintenanceMode&&__this.__serverState?.maintenanceMode.isActive&&__this.__serverState?.maintenanceMode.isMaintenanceUser?finalize(3):licenseCheck((data=>{finalize(data.connectState,data.details)}))}))}licenseCheck((data=>{finalize(data.connectState,data.details)}))}}onWsClose(callback){let __this=this;return function(closeEvent){let bShowError=!1;if(__this.__forceShowErrorOnClose&&(__this.__forceShowErrorOnClose=!1,bShowError=!0),__this.releaseRequest(__this.__checkLicenseSubscriptionId),__this.unwatchServerState(),!0===__this.__disabledCommunication);else{let message="[Source=Framework, Module=TcHmi.System.ServerManager] WebSocket with url="+this.url+" was closed";1e3!==closeEvent.code?TCHMI_CONSOLE_LOG_LEVEL>=1&&(message+=" with code="+closeEvent.code,closeEvent.reason&&(message+=" and reason="+closeEvent.reason),message+=".",TcHmi.Log.errorEx(message)):TCHMI_CONSOLE_LOG_LEVEL>=4&&(message+=".",TcHmi.Log.debugEx(message))}if(3===__this.__lastConnectState&&(__this.__lastConnectState=0,!1===__this.__disabledCommunication)){bShowError=!0;const publishInProgress=__this.__serverState?.publishInProgress??!1;TCHMI_RUNTIME&&!publishInProgress&&(TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_Connection_Lost",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.System.Services.localization.getText("Determining_Publish_Or_Failure",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("This_Will_Take_A_Few_Seconds",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Warning,buttonReload:!TCHMI_DESIGNER}))}__this.__symbolWatchEntryCacheByOptions.forEach((function(ws,key){let callbacks=Array.from(ws.callbacks);for(let i=0,ii=callbacks.length;i<ii;i++){let callback=callbacks[i];TcHmi.Callback.callSafeEx(callback.callback,__this,{error:TcHmi.Errors.E_WEBSOCKET_CLOSED,details:{code:TcHmi.Errors.E_WEBSOCKET_CLOSED,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_CLOSED],reason:"The underlying websocket was closed.",domain:"TcHmi.System.ServerManager"}}),callback.dirty=!0}ws.reqId=null}));let removeableRequestCacheEntries=[];if(__this.__requestCache.forEach((function(req,id){clearTimeout(req.timeoutTimer);let callbacks=Array.from(req.callbacks);for(const callback of callbacks){const errObj={error:TcHmi.Errors.E_WEBSOCKET_CLOSED,details:{code:TcHmi.Errors.E_WEBSOCKET_CLOSED,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_CLOSED],reason:"The underlying websocket was closed"+(closeEvent.code?" with code="+closeEvent.code:"")+(closeEvent.reason?" with reason="+closeEvent.reason:"")+".",domain:"TcHmi.System.ServerManager"}};4460!==closeEvent.code&&4465!==closeEvent.code||(errObj.details.errors=[{code:TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING],reason:"License is missing.",domain:"TcHmi.System.ServerManager"}]),TcHmi.Callback.callSafeEx(callback,__this,errObj)}(200!==req.type||200===req.type&&!0===req.managed)&&removeableRequestCacheEntries.push(req)})),removeableRequestCacheEntries.forEach((function(req,index,array){__this.unregisterRequest(req.id)})),TcHmi.EventProvider.raise("onWebSocketClosed"),__this.__isInitialized=!1,4460===closeEvent.code||4465===closeEvent.code?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING,url:this.url}):TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,url:this.url}),__this.__websocket=void 0,!__this.__disabledCommunication){const processServerState=()=>{const publishInProgress=__this.__serverState?.publishInProgress??!1,licenseTimeout=!!(__this.__serverState?.timedClient?.isTimed&&__this.__serverState?.timedClient?.expiration&&__this.__serverState?.timedClient?.availableAgain),maintenanceModeLock=!(!(__this.__serverState&&__this.__serverState.maintenanceMode&&__this.__serverState.maintenanceMode.isActive)||__this.__serverState.maintenanceMode.isMaintenanceUser);!bShowError||publishInProgress||licenseTimeout||maintenanceModeLock||(TcHmi.Engineering.ErrorPane.add("E_SERVER_CONNECTION_LOST",TcHmi.System.Services.localization.getText("Server_Connection_Lost",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Reopen_Connection_In_Progress",{level:TcHmi.Locale.Level.Engineering}),TcHmi.Engineering.ErrorPane.MessageType.Error),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_Connection_Lost",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Reopen_Connection_In_Progress",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay)),__this.__forcedClose||publishInProgress||licenseTimeout||maintenanceModeLock||__this.reconnect(),__this.watchServerState()};__this.__forcedClose?processServerState():__this.resolveHandleServerState((()=>{processServerState()}))}}}onWsMessage(){let __this=this;return function(messageEvent){let response=TcHmi.ValueConverter.toObject(messageEvent.data,null);if(!0===TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.ServerManager] Response from TwinCAT HMI Server:",{response:response}),null==response)return;if(void 0===response.id||null===response.id)return;let request=__this.getRequest(response.id);request&&(TCHMI_DIAGNOSTICS_SERVER&&TcHmi.System.Diagnostics.Server.requestReceived(request,response),0!==request.timeoutTimer&&(clearTimeout(request.timeoutTimer),request.timeoutTimer=0),TcHmi.Callback.callSafeEx(request.responseCallback,__this,{error:TcHmi.Errors.NONE,response:response}))}}reconnect(){this.__cyclicReconnect&&0===this.__conWatcherIntervalId&&(this.__conWatcherIntervalId=window.setInterval(this.conWatcherTick(),ServerManager.RECONNECT_INTERVAL))}conWatcherTick(){return()=>{!0===this.__cyclicReconnect&&void 0===this.__websocket&&this.open()}}open(callback){this.__websocket||(TCHMI_DIAGNOSTICS_SERVER&&TcHmi.System.Diagnostics.Server.start(!0),this.resolveServerState((data=>{try{this.__websocket=new WebSocket(this.__serverWebsocketUri)}catch(ex){return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ServerManager] Opening connection to Hmi Webserver failed!"))}this.__websocket.onopen=this.onWsOpen(callback),this.__websocket.onclose=this.onWsClose(callback),this.__websocket.onmessage=this.onWsMessage()})))}__close(){this.__websocket&&(this.__websocket.close(1e3),this.__websocket=void 0)}close(){this.__websocket&&(0!==this.__conWatcherIntervalId&&(window.clearInterval(this.__conWatcherIntervalId),this.__conWatcherIntervalId=0),this.__close())}requestQueueHasPendingRequest(){return!!this.__requestQueuePendingRequest}requestQueueDone(request){request&&this.__requestQueuePendingRequest&&this.__requestQueuePendingRequest.id===request.id&&(this.__requestQueuePendingRequest.queuePending=!1,this.__requestQueuePendingRequest.queue=!1,this.__requestQueuePendingRequest=null,TCHMI_DIAGNOSTICS_SERVER&&TcHmi.System.Diagnostics.Server.requestPendingDone(request),this.requestQueueNext())}requestQueueAdd(request){this.__requestQueue.push(request),request.queue=!0,TCHMI_DIAGNOSTICS_SERVER&&TcHmi.System.Diagnostics.Server.requestQueued(request),!1===this.requestQueueHasPendingRequest()&&this.requestQueueNext()}requestQueueRemove(request){let pos=-1;for(let i=0,ii=this.__requestQueue.length;i<ii;i++){if(this.__requestQueue[i].id===request.id){pos=i;break}}pos>=0&&this.__requestQueue.splice(pos,1),TCHMI_DIAGNOSTICS_SERVER&&TcHmi.System.Diagnostics.Server.requestUnqueued(request),this.requestQueueDone(request)}requestQueueNext(){if(!this.__websocket)return;let request=this.__requestQueue.shift();request&&(TCHMI_DIAGNOSTICS_SERVER&&TcHmi.System.Diagnostics.Server.requestUnqueued(request),request.queuePending=!0,this.__requestQueuePendingRequest=request,this.__websocket.send(JSON.stringify(request.message)),TCHMI_DIAGNOSTICS_SERVER&&TcHmi.System.Diagnostics.Server.requestSent(request))}getFreeRequestId(){let res=0,loopcount=0;do{if(res=0,loopcount++,loopcount>=1e6){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ServerManager] Reached maxium of parallel requests."),res=null;break}this.__requestIdCount++,this.__requestIdCount>=1e6&&(this.__requestIdCount=1),res=this.__requestIdCount}while(this.__requestCache.has(res));return res}setServerAddress(protocol,host,port){this.__serverBaseUri=protocol+"//"+host+(port?":"+port:""),this.__serverWebsocketUri=this.__serverBaseUri.replace("http:","ws:").replace("https:","wss:")}getRequest(id){if(null!==id)return this.__requestCache.get(id)}registerRequest(id,type,message){if(this.__requestCache.has(id))return null;let request={id:id,type:type,message:message,deletionPending:!1,timeoutCallback:null,timeoutTimer:0,timeout:null,interval:null,callbacks:[],responseCallback:null,queue:!1,queuePending:!1,managed:!1,refreshLock:!1};return this.__requestCache.set(id,request),TCHMI_DIAGNOSTICS_SERVER&&TcHmi.System.Diagnostics.Server.requestRegistered(request),request}unregisterRequest(id){if(null===id)return;let request=this.__requestCache.get(id);request&&(0!==request.timeoutTimer&&(clearTimeout(request.timeoutTimer),request.timeoutTimer=0),this.requestQueueRemove(request),this.__requestCache.delete(id),TCHMI_DIAGNOSTICS_SERVER&&TcHmi.System.Diagnostics.Server.requestUnregistered(request))}registerRequestCallback(reqId,callback){let request=this.__requestCache.get(reqId);request&&request.callbacks.push(callback)}unregisterRequestCallback(reqId,callback){let request=this.__requestCache.get(reqId);if(request){let pos=request.callbacks.indexOf(callback);pos>-1&&request.callbacks.splice(pos,1)}}registerEventCallback(reqId,callback){let __this=this,request=this.registerRequest(reqId,300);return request?(request.responseCallback=function(data){request&&TcHmi.System.Callback.callSafeCallbacks1Param(request.callbacks,__this,{error:TcHmi.Errors.NONE,response:data.response})},this.registerRequestCallback(reqId,callback),reqId):null}symbolWatcherTick(){let __this=this;return function(){if(!0===__this.__isInitialized&&void 0!==__this.__websocket&&null!==__this.__websocket&&__this.__websocket.readyState===WebSocket.OPEN&&Date.now()-__this.__symbolWatcherStartTime>250){1===__this.refreshSymbolWatcher()&&0!==__this.__symbolWatcherIntervalId&&(window.clearInterval(__this.__symbolWatcherIntervalId),__this.__symbolWatcherIntervalId=0)}}}refreshSymbolWatcher(){let error=!1,toUnsubscribe=[],toSubscribeEntries=new Map;if(this.__symbolWatchEntryCacheByOptions.forEach(((s,key)=>{let reqId=s.reqId;if(null!==reqId&&0===s.refs){let watchEntryGroupKey=""+(s.interval??"DEFAULT");watchEntryGroupKey+="_"+(s.timeout??"DEFAULT"),watchEntryGroupKey+="_"+(s.group??"DEFAULT"),this.__symbolWatchEntryCacheByOptions.delete(key),this.__symbolWatchEntryCacheById.delete(s.name+"_"+reqId);let watchEntryGroup=this.__symbolWatchEntryGroups.get(watchEntryGroupKey);watchEntryGroup&&(watchEntryGroup.has(key)&&watchEntryGroup.delete(key),0===watchEntryGroup.size&&this.__symbolWatchEntryGroups.delete(watchEntryGroupKey)),toUnsubscribe.push(reqId),s.reqId=null}})),this.__symbolWatchEntryCacheByOptions.forEach(((s,key)=>{let reqId=s.reqId;(null===reqId||toUnsubscribe.includes(reqId))&&(toSubscribeEntries.get(key)||toSubscribeEntries.set(key,s))})),toSubscribeEntries.forEach(((s,key)=>{let watchEntryGroupKey=""+(s.interval??"DEFAULT");watchEntryGroupKey+="_"+(s.timeout??"DEFAULT"),watchEntryGroupKey+="_"+(s.group??"DEFAULT");let watchEntryGroup=this.__symbolWatchEntryGroups.get(watchEntryGroupKey);watchEntryGroup&&watchEntryGroup.forEach(((s2,key2)=>{s2.reqId&&!toUnsubscribe.includes(s2.reqId)&&toUnsubscribe.push(s2.reqId),s2.reqId=null,toSubscribeEntries.get(key2)||toSubscribeEntries.set(key2,s2)}))})),toUnsubscribe.length>0){let requestObj={requestType:"ReadWrite",commands:[]};for(let i=0,ii=toUnsubscribe.length;i<ii;i++){let reqId=toUnsubscribe[i],req=this.getRequest(reqId);req&&(this.releaseRequest(reqId),req.queue||(requestObj.commands.push({commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"Unsubscribe",writeValue:reqId}),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ServerManager] Unsubscribing request with id="+reqId+".")))}requestObj.commands&&requestObj.commands.length>0&&this.request(requestObj,(data=>{let response=data.response;if(void 0===response)return;response.error&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ServerManager] Server responds with error. "+TcHmi.Log.buildMessage(response.error));let commands=response.commands;if(null!=commands)for(let i=0,ii=commands.length;i<ii;i++){let command=commands[i];null!=command&&(void 0!==command.error&&null!==command.error&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ServerManager] Server responds with error for unsubscribe id="+command.writeValue+". ",TcHmi.Log.buildMessage(command.error)))}}))}let toSubscribeMessages=new Map;if(toSubscribeEntries.forEach((entry=>{let watchEntryGroupKey=""+(entry.interval??"DEFAULT");watchEntryGroupKey+="_"+(entry.timeout??"DEFAULT"),watchEntryGroupKey+="_"+(entry.group??"DEFAULT");let toSubscribeMessage=toSubscribeMessages.get(watchEntryGroupKey),reqId=this.getFreeRequestId();if(reqId){toSubscribeMessage?entry.reqId=toSubscribeMessage.message.id??null:(entry.reqId=reqId,toSubscribeMessage={interval:entry.interval,timeout:entry.timeout,group:entry.group,watchEntries:[],message:{requestType:"Subscription",id:reqId,commands:[]}},null!==entry.interval&&(toSubscribeMessage.message.intervalTime=entry.interval)),toSubscribeMessage.watchEntries.push(entry);let nSubCmds=toSubscribeMessage.message.commands;if(!nSubCmds)return void(error=!0);let bCreate=!0;for(let i=0,ii=nSubCmds.length;i<ii;i++){let nSubCmd=nSubCmds[i];if(nSubCmd.symbol===entry.name&&tchmi_equal(nSubCmd.commandOptions,entry.options)){bCreate=!1;break}}bCreate&&(nSubCmds.push({commandOptions:entry.options,symbol:entry.name}),TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ServerManager] Subscribing symbol "+entry.name+" in request id="+reqId+".")),toSubscribeMessages.set(watchEntryGroupKey,toSubscribeMessage)}else error=!0})),error)return 0;let subscribe=m=>{for(let i=0,ii=m.watchEntries.length;i<ii;i++){let watchEntry=m.watchEntries[i];for(let j=0,jj=watchEntry.callbacks.length;j<jj;j++){let watchEntryCallback=watchEntry.callbacks[j];!1===watchEntryCallback.dirty&&(watchEntryCallback.refreshLock=!0)}}let request=this.getRequest(this.request(m.message,(data=>{if(data.error===TcHmi.Errors.NONE){let response=data.response;response.error&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ServerManager] Server responds with error: "+TcHmi.Log.buildMessage(response.error));for(let command of response.commands){if(!command)continue;let watchEntryId=command.symbol+"_"+response.id,watchEntry=this.__symbolWatchEntryCacheById.get(watchEntryId);if(!watchEntry)continue;if(void 0!==command.error){let res={error:TcHmi.Errors.E_SERVER_COMMAND_ERROR,details:{code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],domain:"TcHmi.System.ServerManager",reason:command.symbol,errors:[command.error]}};response&&(res.response=response),command.processedStart&&(res.processedStart=command.processedStart),command.processedEnd&&(res.processedEnd=command.processedEnd),TcHmi.System.ServerManager.__callSymbolWatchEntryCallbacks(watchEntry.callbacks,this,res);continue}if(void 0===command.readValue)continue;let hasChanged=!tchmi_equal(watchEntry.value,command.readValue);watchEntry.value=command.readValue,command.processedStart&&(watchEntry.processedStart=command.processedStart),command.processedEnd&&(watchEntry.processedEnd=command.processedEnd);let callbackList=[];for(let i=0,ii=watchEntry.callbacks.length;i<ii;i++){let wecb=watchEntry.callbacks[i];callbackList.push(wecb)}for(let innerCallback of callbackList)if(watchEntry.callbacks.includes(innerCallback))if(!1===innerCallback.refreshLock||!0===hasChanged){innerCallback.refreshLock=!1,innerCallback.dirty=!1;let res={error:TcHmi.Errors.NONE,destroy:innerCallback.destroy,value:tchmi_clone_object(watchEntry.value)};response&&(res.response=response),watchEntry.processedStart&&(res.processedStart=watchEntry.processedStart),watchEntry.processedEnd&&(res.processedEnd=watchEntry.processedEnd),TcHmi.Callback.callSafeEx(innerCallback.callback,this,res)}else innerCallback.refreshLock=!1}}else for(let i=0,ii=m.watchEntries.length;i<ii;i++)TcHmi.System.ServerManager.__callSymbolWatchEntryCallbacks(m.watchEntries[i].callbacks,this,{error:data.error,details:data.details})})));if(request){request.managed=!0;for(let i=0;i<m.watchEntries.length;i++){let watchEntry=m.watchEntries[i];this.__symbolWatchEntryCacheById.set(watchEntry.name+"_"+request.id,watchEntry)}}};return toSubscribeMessages.forEach(((message,key)=>{subscribe(message)})),error?0:1}watch(expression,options,callback){if(null==expression)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"No expression given.",domain:"TcHmi.System.ServerManager"}}),function(){};if(expression.getType()!==TcHmi.SymbolType.Server)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"No valid expression given. Needs server symbol expression",domain:"TcHmi.System.ServerManager"}}),function(){};if(null==callback||"function"!=typeof callback)return function(){};let name=expression.getName();if(!name)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"No valid expression given. Needs valid server symbol expression",domain:"TcHmi.System.ServerManager"}}),function(){};let expressionOptions=expression.getOptions(),interval=expressionOptions.Interval?expressionOptions.Interval:null,timeout=expressionOptions.Timeout?expressionOptions.Timeout:null,subscriptionMode=expressionOptions.SubscriptionMode?expressionOptions.SubscriptionMode:null,subscriptionGroup=expressionOptions.SubscriptionGroup?expressionOptions.SubscriptionGroup:null,uniqueHash=expressionOptions.UniqueHash?expressionOptions.UniqueHash:null,__this=this,watchEntryOptions=[],watchEntryId=name;watchEntryId+="_"+(interval??"DEFAULT"),watchEntryId+="_"+(timeout??"DEFAULT"),subscriptionMode&&"Poll"===subscriptionMode?(watchEntryId+="_POLL",watchEntryOptions.push("Poll")):subscriptionMode&&"Change"===subscriptionMode?watchEntryId+="_DEFAULT":"Poll"===TcHmi.System.config.tcHmiServer.websocketSubscriptionMode?(watchEntryId+="_POLL",watchEntryOptions.push("Poll")):watchEntryId+="_DEFAULT",watchEntryId+="_"+(subscriptionGroup??"DEFAULT"),uniqueHash?(watchEntryId+="_UNIQUEHASH",watchEntryOptions.push("UniqueHash")):watchEntryId+="_DEFAULT";let watchEntry=this.__symbolWatchEntryCacheByOptions.get(watchEntryId),destroy=function(){let refresh=!1;if(watchEntry){watchEntry.refs--;let index=-1;for(let i=0,ii=watchEntry.callbacks.length;i<ii;i++)if(watchEntry.callbacks[i].callback===callback){index=i;break}index>-1&&watchEntry.callbacks.splice(index,1),0===watchEntry.refs&&(refresh=!0)}refresh&&0===__this.__symbolWatcherIntervalId&&(__this.__symbolWatcherStartTime=Date.now(),__this.__symbolWatcherIntervalId=window.setInterval(__this.symbolWatcherTick(),100))};if(watchEntry){if(watchEntry.callbacks.push({callback:callback,dirty:!1,refreshLock:!1,destroy:destroy}),watchEntry.refs++,void 0!==watchEntry.value){let res={error:TcHmi.Errors.NONE,destroy:destroy,value:tchmi_clone_object(watchEntry.value)};watchEntry.response&&(res.response=watchEntry.response),watchEntry.processedStart&&(res.processedStart=watchEntry.processedStart),watchEntry.processedEnd&&(res.processedEnd=watchEntry.processedEnd),queueMicrotask((()=>{TcHmi.Callback.callSafeEx(callback,this,res)}))}}else{watchEntry={reqId:null,name:name,interval:interval,timeout:timeout,group:subscriptionGroup,refs:1,value:void 0,options:watchEntryOptions,callbacks:[{callback:callback,dirty:!0,refreshLock:!1,destroy:destroy}]},this.__symbolWatchEntryCacheByOptions.set(watchEntryId,watchEntry);let watchEntryGroupKey=""+(interval??"DEFAULT");watchEntryGroupKey+="_"+(timeout??"DEFAULT"),watchEntryGroupKey+="_"+(subscriptionGroup??"DEFAULT");let watchEntryGroup=this.__symbolWatchEntryGroups.get(watchEntryGroupKey);if(watchEntryGroup)watchEntryGroup.set(watchEntryId,watchEntry);else{let map=new Map;this.__symbolWatchEntryGroups.set(watchEntryGroupKey,map),map.set(watchEntryId,watchEntry)}}return 0===this.__symbolWatcherIntervalId&&(this.__symbolWatcherStartTime=Date.now(),this.__symbolWatcherIntervalId=window.setInterval(this.symbolWatcherTick(),100)),destroy}request(requestObj,callback){return this.requestEx(requestObj,null,callback)}requestEx(requestObj,options,callback){let request,group,res=null;if(!(requestObj=tchmi_clone_object(requestObj)))return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"No request given",domain:"TcHmi.System.ServerManager"}}),null;if(options&&(System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.System.ServerManager",callback)||System.isParameterTypeInvalid(options.refresh,"options.refresh",{type:"boolean",required:"undefinedOk"},"TcHmi.System.ServerManager",callback)||System.isParameterTypeInvalid(options.timeout,"options.timeout",{type:"number",required:"undefinedOk"},"TcHmi.System.ServerManager",callback)||System.isParameterTypeInvalid(options.groupId,"options.groupId",{type:"number",required:"undefinedOk"},"TcHmi.System.ServerManager",callback)))return null;let groupId=options?.groupId,parallel=options?.parallel,timeout=options?.timeout,refresh=options?.refresh,queue=!1,type=0;switch(requestObj.requestType){case"ReadWrite":type=100,queue=!0!==parallel;break;case"Subscription":type=200,queue=!0!==parallel;break;case"Event":type=300,queue=!1}let requestTimeout=timeout??TcHmi.System.config.tcHmiServer.websocketTimeout,requestTimeoutCallback=()=>{let reasonObject={};void 0!==groupId?reasonObject.reason='Request for group id "'+groupId+'" did not respond within expected time.':requestObj.id?reasonObject.reason='Request with id "'+requestObj.id+'" did not respond within expected time.':reasonObject.reason="Request did not respond within expected time.",TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_TIMEOUT,details:{code:TcHmi.Errors.E_TIMEOUT,message:TcHmi.Errors[TcHmi.Errors.E_TIMEOUT],domain:"TcHmi.System.ServerManager",...reasonObject}}),request&&(request.queue&&this.requestQueueDone(request),this.releaseRequest(request.id))},requestResponseCallback=data=>{request&&(TcHmi.System.Callback.callSafeCallbacks1Param(request.callbacks,this,{error:TcHmi.Errors.NONE,response:data.response}),request.queue&&this.requestQueueDone(request),200!==request.type&&this.releaseRequest(request.id))},requestTimeoutTimer=setTimeout((()=>{TcHmi.Callback.callSafeEx(requestTimeoutCallback,this)}),requestTimeout),clearRequestTimeout=()=>{if(requestTimeoutTimer&&(clearTimeout(requestTimeoutTimer),requestTimeoutTimer=0),request&&request.timeoutTimer&&(request.timeoutTimer=0),request&&request.timeoutCallback&&(request.timeoutCallback=null),group&&group.requests)for(let request of group.requests)request.timeoutTimer&&(clearTimeout(request.timeoutTimer),request.timeoutTimer=0)};if(void 0!==groupId){if(group=this.__requestGroups.get(groupId+(options?.parallel?"_PARALLEL=TRUE":"_PARALLEL=FALSE")+(options?.refresh?"_REFRESH=TRUE":"_REFRESH=FALSE")+(options?.timeout?"_TIMEOUT="+options?.timeout:"_TIMEOUT=UNDEFINED")),group)res=group.requestId,group.requests.push({message:requestObj,options:options,callback:callback,timeoutTimer:requestTimeoutTimer});else{const newId=this.getFreeRequestId();if(null===newId)return clearRequestTimeout(),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"No request id could be generated",domain:"TcHmi.System.ServerManager"}}),null;res=newId,group={id:groupId,requestId:newId,options:{parallel:!queue,timeout:timeout,refresh:refresh},requests:[{message:requestObj,options:options,callback:callback,timeoutTimer:requestTimeoutTimer}]},this.__requestGroups.set(groupId+(options?.parallel?"_PARALLEL=TRUE":"_PARALLEL=FALSE")+(options?.refresh?"_REFRESH=TRUE":"_REFRESH=FALSE")+(options?.timeout?"_TIMEOUT="+options?.timeout:"_TIMEOUT=UNDEFINED"),group),(group=>{setTimeout((()=>{this.__requestGroups.delete(groupId+(group?.options?.parallel?"_PARALLEL=TRUE":"_PARALLEL=FALSE")+(group?.options?.refresh?"_REFRESH=TRUE":"_REFRESH=FALSE")+(group?.options?.timeout?"_TIMEOUT="+options?.timeout:"_TIMEOUT=UNDEFINED"));let bundledRequest={requestType:"ReadWrite",id:group.requestId,commands:[]},requestCommandIndicesMap=new Map,responseCommandIndexMap=new Map,responseCommandIndex=0;group.requests.forEach((request=>{let requestResponseCommandIndices=[];request.message.commands?.forEach((command=>{let key=command.symbol;if(command.commandOptions){let clone=tchmi_clone_object(command.commandOptions);clone.sort();for(let option of clone)key+="_"+option}let responseCommandIndexFromMap=responseCommandIndexMap.get(key);void 0!==responseCommandIndexFromMap?requestResponseCommandIndices.push(responseCommandIndexFromMap):(bundledRequest.commands?.push(command),responseCommandIndexMap.set(key,responseCommandIndex),requestResponseCommandIndices.push(responseCommandIndex),responseCommandIndex++)})),requestCommandIndicesMap.set(request,requestResponseCommandIndices)})),this.requestEx(bundledRequest,null,(data=>{clearRequestTimeout(),group.requests.forEach((request=>{let requestResponseCommandIndicesObject={},requestResponseCommandIndices=requestCommandIndicesMap.get(request);requestResponseCommandIndices&&requestResponseCommandIndices.length>0&&(requestResponseCommandIndicesObject.responseCommandIndices=requestResponseCommandIndices),TcHmi.Callback.callSafeEx(request.callback,this,{...data,...requestResponseCommandIndicesObject})}))}))}))})(group)}return res}if(void 0===requestObj.id||null===requestObj.id){const newId=this.getFreeRequestId();if(null===newId)return clearRequestTimeout(),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"No request id could be generated",domain:"TcHmi.System.ServerManager"}}),null;requestObj.id=newId}if(res=requestObj.id,this.__websocket&&this.__websocket.readyState!==WebSocket.CLOSING&&this.__websocket.readyState!==WebSocket.CLOSED&&this.__websocket.readyState!==WebSocket.CONNECTING){if(request=options&&!0===options.refresh?this.getRequest(requestObj.id):this.registerRequest(requestObj.id,type,requestObj),!request)return clearRequestTimeout(),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'A request with the same id: "'+requestObj.id+'" is already in progress.',domain:"TcHmi.System.ServerManager"}}),null;"function"==typeof callback&&this.registerRequestCallback(requestObj.id,callback),!0===TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.ServerManager] Request to TwinCAT HMI Server:",{requestObj:requestObj}),"Subscription"===requestObj.requestType&&(requestObj.intervalTime??(requestObj.intervalTime=TcHmi.System.config.tcHmiServer.websocketIntervalTime),request.interval=requestObj.intervalTime),request.timeout=requestTimeout,request.timeoutCallback=requestTimeoutCallback,request.responseCallback=requestResponseCallback,request.timeoutTimer=requestTimeoutTimer,queue?this.requestQueueAdd(request):(this.__websocket.send(JSON.stringify(request.message)),TCHMI_DIAGNOSTICS_SERVER&&TcHmi.System.Diagnostics.Server.requestSent(request))}else clearRequestTimeout(),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.System.ServerManager"}});return res}releaseRequest(id){this.unregisterRequest(id)}getWebsocketReadyState(){return this.__websocket?.readyState??null}login(username,password,persistent=!0,reload=!0,options,callback){const message={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"Login",writeValue:{userName:username,password:password,persistent:persistent}}]};return TcHmi.System.Services.accessManager.unsubscribe((data=>{TcHmi.System.Services.accessManager.enableReload(reload),System.Services.serverManager.requestEx(message,options,TcHmi.Server.__handleServerResponse({error:data=>{TcHmi.System.Services.accessManager.subscribe((()=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,this,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})}))},success:data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("Login successful with username: "+data.response.commands[0].writeValue.userName);let cookieName="sessionId";data.response.serverId&&(cookieName+="-"+data.response.serverId,document.cookie="sessionId=; expires=Thu, 01 Jan 1970 00:00:00 GMT"),document.cookie=cookieName+"="+data.response.sessionId+"; path=/",reload?window.location.reload():TcHmi.System.Services.accessManager.subscribe((()=>{TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}))}}))})),!0}logout(reload=!0,options,callback){return TcHmi.System.Services.accessManager.unsubscribe((data=>{TcHmi.System.Services.accessManager.enableReload(reload);System.Services.serverManager.requestEx({requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"Logout"}]},options,TcHmi.Server.__handleServerResponse({error:data=>{TcHmi.System.Services.accessManager.subscribe((()=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,this,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})}))},success:data=>{if(reload)window.location.reload();else{let cookieName="sessionId";data.response.serverId&&(cookieName+="-"+data.response.serverId,document.cookie="sessionId=; expires=Thu, 01 Jan 1970 00:00:00 GMT"),document.cookie=cookieName+"="+data.response.sessionId+"; path=/",TcHmi.System.Services.accessManager.subscribe((data=>{TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}))}}}))})),!0}forceLogout(username,options,callback){const message={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"ForceLogout",writeValue:username}]};return System.Services.serverManager.requestEx(message,options,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}})),!0}refreshSubscription(request,callback){this.request({requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"Unsubscribe",writeValue:request.id}]},(data=>{request.message?(null===request.interval&&delete request.message.intervalTime,null===request.timeout&&request.timeoutTimer&&(clearTimeout(request.timeoutTimer),request.timeoutTimer=0),this.requestEx(request.message,{refresh:!0},(data=>{TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}))):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"No message found for refreshSubscription",domain:"TcHmi.System.ServerManager"}})}))}refreshSubscriptions(callback){let pending=0,finalize=()=>{0===pending&&TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})};this.__requestCache.forEach(((request,id)=>{200!==request.type||request.refreshLock||(pending++,this.refreshSubscription(request,(data=>{pending--,finalize()}))),request.refreshLock&&(request.refreshLock=!1)})),finalize()}static __callSymbolWatchEntryCallbacks(callbacks,thisArg,data){let callbackList=[];for(let i=0,ii=callbacks.length;i<ii;i++)callbackList.push(callbacks[i]);for(let innerCallback of callbackList)callbacks.includes(innerCallback)&&TcHmi.Callback.callSafeEx(innerCallback.callback,thisArg,data)}getApiVersion(){return this.__serverState&&this.__serverState.frameworkApiVersion?this.__serverState.frameworkApiVersion:null}}ServerManager.REGEXP_ISO8601_DURATION_PARTS=/^(-?)P(?=\d|T\d)(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)([DW]))?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$/,ServerManager.RECONNECT_INTERVAL=5e3,System.ServerManager=ServerManager}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.ServerEventManager=class{constructor(){this.__subscriptions=new TcHmi.List}confirmAlarm(alarm,callback){let reqObj={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"ConfirmAlarm",writeValue:alarm}]};TcHmi.System.Services.serverManager.request(reqObj,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,this,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}}))}listEvents(filter,callback){const reqObj={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"ListEvents"}]};filter&&(reqObj.commands[0].filter=filter),TcHmi.System.Services.serverManager.request(reqObj,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,this,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})},success:data=>{setTimeout((()=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,events:data.results[0].value})}))}}))}subscribe(filter,eventCallback,doneCallback){const responseId=TcHmi.System.Services.serverManager.getFreeRequestId();if(!responseId)return TcHmi.Callback.callSafeEx(eventCallback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.ServerEventManager",reason:"Reached maxium of parallel requests."}}),responseId;const reqObj={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"SubscribeEvents",writeValue:responseId}]};filter&&(reqObj.commands[0].filter=filter);let subscription={responseId:responseId,callback:eventCallback};return this.__subscriptions.push(subscription),TcHmi.System.Services.serverManager.request(reqObj,TcHmi.Server.__handleServerResponse({error:data=>{let res;res=data.error===TcHmi.Errors.NONE&&data.results?{error:data.results[0].error,details:data.results[0].details}:{error:data.error,details:data.details},TcHmi.Callback.callSafeEx(eventCallback,null,res),TcHmi.Callback.callSafeEx(doneCallback,null,res)},success:data=>{let callbackId=TcHmi.System.Services.serverManager.registerEventCallback(responseId,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(eventCallback,this,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(eventCallback,this,{error:data.error,details:data.details})},success:data=>{setTimeout((()=>{TcHmi.Callback.callSafeEx(eventCallback,null,{error:TcHmi.Errors.NONE,event:data.results[0].value})}))}})),result={error:TcHmi.Errors.NONE};null===callbackId&&(result={error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.ServerEventManager",reason:"Internal Error: Multiple callbacks registered to request id "+responseId}},TcHmi.Callback.callSafeEx(eventCallback,null,result)),TcHmi.Callback.callSafeEx(doneCallback,null,result)}})),responseId}unsubscribe(id,callback){const subscription=this.__subscriptions.firstOrDefault((item=>item.responseId===id));if(null!==subscription){const reqObj={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"UnsubscribeEvents",writeValue:subscription.responseId}]};TcHmi.System.Services.serverManager.releaseRequest(subscription.responseId),this.__subscriptions.remove(subscription),TcHmi.System.Services.serverManager.request(reqObj,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))}else TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:`Failed unsubscribe because no event subscription with the given id ${id} exists`,domain:"TcHmi.System.ServerEventManager"}})}updateSubscription(id,filter,callback){const subscription=this.__subscriptions.firstOrDefault((item=>item.responseId===id));if(null!==subscription){let reqObj={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"UpdateEventsSubscription",writeValue:subscription.responseId}]};filter&&(reqObj.commands[0].filter=filter),TcHmi.System.Services.serverManager.request(reqObj,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))}else TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:`Failed update the subscription because no event subscription with the given id ${id} exists`,domain:"TcHmi.System.ServerEventManager"}})}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.TriggerManager=class{constructor(){}__resolveValue(ctx,value,targetSchema){if(value)switch(value.objectType){case"StaticValue":let prepValue=value.value;if(targetSchema){let convertedValue=TcHmi.ValueConverter.toSchemaType(prepValue,targetSchema);null!=convertedValue&&(prepValue=convertedValue)}ctx.success(prepValue);break;case"Symbol":if(!value.symbolExpression)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'Property: "symbolExpression" within an object of type: "IFunction.Value" with object type: "Symbol" must not be empty, "null" or "undefined".',domain:"TcHmi.System.TriggerManager"});let s=null;try{s=new TcHmi.Symbol({expression:value.symbolExpression,ctx:{args:ctx.args}})}catch(e){return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'An uncaught exception occurred while reading symbol: "'+value.symbolExpression+'".',exception:e,domain:"TcHmi.System.TriggerManager"})}if(null==s)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'Failed to create instance of "TcHmi.Symbol" while reading symbol "'+value.symbolExpression+'".',domain:"TcHmi.System.TriggerManager"});if(targetSchema&&"TcHmi.Symbol"===targetSchema.frameworkInstanceOf)ctx.success(s);else try{s.readEx((function(data){if(data.error===TcHmi.Errors.NONE){let prepValue=data.value;if(targetSchema){let convertedValue=TcHmi.ValueConverter.toSchemaType(prepValue,targetSchema);null!=convertedValue&&(prepValue=convertedValue)}ctx.success(prepValue)}else ctx.error(data.error,data.details);s?.destroy(),s=null}))}catch(e){return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'An uncaught exception occurred while reading symbol "'+value.symbolExpression+'".',exception:e,domain:"TcHmi.System.TriggerManager"})}break;case"FunctionExpression":if(TcHmi.IFunction.isFunctionExpression(value)){let func=new System.FunctionExpression(value.functionExpression);try{let bContextLock=!1;func.execute({success:function(result){if(bContextLock)return;bContextLock=!0;let prepValue=result;if(targetSchema){let convertedValue=TcHmi.ValueConverter.toSchemaType(prepValue,targetSchema);null!=convertedValue&&(prepValue=convertedValue)}ctx.success(prepValue),func.destroy()},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details),func.destroy())}})}catch(e){ctx.error(TcHmi.Errors.E_TRIGGER_FUNCTION_EXPRESSION_EXCEPTION,{code:TcHmi.Errors.E_TRIGGER_FUNCTION_EXPRESSION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_FUNCTION_EXPRESSION_EXCEPTION],reason:'An uncaught exception occurred while executing FunctionExpression: "'+value.functionExpression+'".',exception:e,domain:"TcHmi.System.TriggerManager"})}}else ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],domain:"TcHmi.System.TriggerManager"});break;default:ctx.error(TcHmi.Errors.E_NOT_SUPPORTED,{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TriggerManager"})}else ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'An object of type: "IFunction.Value" must not be "null" or "undefined".',domain:"TcHmi.System.TriggerManager"})}__resolveValueAsArray(ctx,values){let res=[];if(!values||0===values.length)return void ctx.success(res);let l=values.length,c=0,__this=this,proc=function(){let value=values[c],bContextLock=!1;__this.__resolveValue({success:function(result){bContextLock||(bContextLock=!0,res.push(result),c===l-1?ctx.success(res):(c++,proc()))},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))},trigger:ctx.trigger,event:ctx.event,args:ctx.args},value.value,value.targetSchema)};proc()}__resolveConditionExpressionsResult(ctx,expressions){let __this=this,hasError=!1,results=[],pendingExpressionCompares=2*expressions.length,resolveExpressionCompareResult=function(resultObject,compareName){let bContextLock=!1;__this.__resolveValue({success:function(result){bContextLock||(bContextLock=!0,hasError||(resultObject.result[compareName]=result,pendingExpressionCompares--,0===pendingExpressionCompares&&function(){let sEval="";sEval+="(";for(let i=0,ii=results.length;i<ii;i++)null!==results[i].expression.logic&&"OR"!==results[i].expression.logic||(sEval+="("),"=="===results[i].expression.compareOperator||"==="===results[i].expression.compareOperator?(sEval+="tchmi_equal(",sEval+="results["+i+"].result.compare1",sEval+=",",sEval+="results["+i+"].result.compare2",sEval+=",false)"):"!="===results[i].expression.compareOperator||"!=="===results[i].expression.compareOperator?(sEval+="!tchmi_equal(",sEval+="results["+i+"].result.compare1",sEval+=",",sEval+="results["+i+"].result.compare2",sEval+=",false)"):(sEval+="(",sEval+="results["+i+"].result.compare1",sEval+=results[i].expression.compareOperator,sEval+="results["+i+"].result.compare2",sEval+=")"),void 0!==results[i+1]?"AND"===results[i+1].expression.logic?sEval+=" && ":"OR"===results[i+1].expression.logic&&(sEval+=") || "):sEval+=")";sEval+=")",sEval+="\n//# sourceURL=TcHmi_System_TriggerManager_ConditionExpressionsResult_Eval";let res=!1;try{res=gIsolatedEval_TcHmi_System_TriggerManager_ConditionExpressionsResult(sEval,results)}catch(e){ctx.error(TcHmi.Errors.E_EXCEPTION,{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:"An uncaught exception occurred in the processing of "+sEval.toString(),exception:e,domain:"TcHmi.System.TriggerManager"})}ctx.success(res)}()))},error:function(error,details){bContextLock||(bContextLock=!0,hasError=!0,ctx.error(error,details))},trigger:ctx.trigger,event:ctx.event,args:ctx.args},resultObject.expression[compareName])};for(let i=0,ii=expressions.length;i<ii&&!hasError;i++){let resultObject={expression:expressions[i],result:{compare1:void 0,compare2:void 0}};results[i]=resultObject,resolveExpressionCompareResult(resultObject,"compare1"),resolveExpressionCompareResult(resultObject,"compare2")}}__taControlApiFunction(ctx,action,diagGUID){TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __taControlApiFunction called with:",{ctx:ctx,action:action});let f=action;const control=f.control,fn=f.fn;if(null==control)throw new Error('Property: "control" is missing in object of type: TcHmi.Trigger.ControlApiFunction');if(null==fn)throw new Error('Property: "fn" is missing in object of type: TcHmi.Trigger.ControlApiFunction');let tco=null,isSymbolExpression=TcHmi.Symbol.isSymbolExpression(f.control),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(f.control);if(isSymbolExpression&&!isSymbolExpressionEscaped){let se=new TcHmi.SymbolExpression(f.control);tco=TcHmi.Controls.get(se.getName())}else tco=TcHmi.Controls.get(f.control);if(null==tco)throw new Error("Can not find instance of control width id: '"+control+"'.");let descr=TcHmi.System.Services.controlManager.getDescription(tco.getType());if(!descr)throw new Error("Can not find description for control type: '"+tco.getType()+"'.");let funcObj=tco[fn];if("function"!=typeof funcObj)throw new Error('Can not find function with name: "'+fn+'" in instance of control with id: '+control);let fnDescr=null;if(descr.inheritedFunctions)for(let i=0,ii=descr.inheritedFunctions.length;i<ii;i++){let descrFunction=descr.inheritedFunctions[i];if(descrFunction.name===fn){fnDescr=descrFunction;break}}if(!fnDescr)throw new Error("Can't find description of function: \""+fn+'" in description of control type: '+tco.getType());let params=[];if(f.fnParams&&f.fnParams.length>0)for(let i=0,ii=f.fnParams.length;i<ii;i++){let paramDescrIndex=i;fnDescr&&!0===fnDescr.injectContextObject&&paramDescrIndex++;let typeSchema=null;fnDescr.params&&fnDescr.params[paramDescrIndex]&&fnDescr.params[paramDescrIndex].type&&(typeSchema=TcHmi.Type.getSchema(fnDescr.params[paramDescrIndex].type)),params.push(typeSchema?{value:f.fnParams[i],targetSchema:typeSchema}:{value:f.fnParams[i]})}let bContextLock=!1;this.__resolveValueAsArray({success:function(result){if(bContextLock)return;bContextLock=!0;let res,process=!0,wait=!1,params=[];if(fnDescr&&!0===fnDescr.injectContextObject)if("Asynchronous"===fnDescr.waitMode){wait=!0;let bContextLock2=!1;params.push({success:result=>{bContextLock2||(bContextLock2=!0,process&&ctx.success(result))},error:(error,details)=>{bContextLock2||(bContextLock2=!0,process&&ctx.error(error,details))}})}else params.push({args:ctx.args});params.push(...result);try{res=funcObj.call(tco,...params)}catch(e){process=!1,ctx.error(TcHmi.Errors.E_EXCEPTION,{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:"An uncaught exception occurred in the control function of "+tco?.getId()+"."+action.fn,exception:e,domain:"TcHmi.System.TriggerManager"})}!1===wait&&process&&ctx.success(res)},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))},trigger:ctx.trigger,event:ctx.event,args:ctx.args},params)}__taWriteToSymbol(ctx,action,diagGUID){if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __taWriteToSymbol called with:",{ctx:ctx,action:action}),!action.symbolExpression)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'Property: "symbolExpression" within an object of type "TcHmi.Trigger.WriteToSymbol" must not be empty, "null" or "undefined".',domain:"TcHmi.System.TriggerManager"});let s=new TcHmi.System.Symbol(action.symbolExpression);s.resolveSchema((data=>{let bContextLock=!1;this.__resolveValue({success:function(result){bContextLock||(bContextLock=!0,s?.write(result,(function(data){data.error===TcHmi.Errors.NONE?ctx.success():ctx.error(data.error,data.details),s?.destroy(),s=null})))},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))},trigger:ctx.trigger,event:ctx.event,args:ctx.args},action.value,data.schema)}))}__taFunction(ctx,action,diagGUID){if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __taFunction called with:",{ctx:ctx,action:action}),null==action)return;let def={objectType:"Function",active:action.active,fn:action.fn,fnParams:action.fnParams};new TcHmi.Function(def).executeEx2({success:function(result){ctx.success(result)},error:function(error,details){ctx.error(error,details)},args:ctx.args})}__taActionTemplate(ctx,action,diagGUID){if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __taActionTemplate called with:",{ctx:ctx,action:action}),null!=action){let tn=action.templateName;if(null==tn||""===tn||"string"!=typeof tn)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'Property: "templateName" in object of type "TcHmi.Trigger.ActionTemplate" is invalid. Value must be a valid string with a length of at least one character.',domain:"TcHmi.System.TriggerManager"});if(void 0===System.config||null===System.config)return void ctx.error(TcHmi.Errors.E_INVALID,{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:'TcHmi.System.config is not a valid object of type: "IConfig".',domain:"TcHmi.System.TriggerManager"});let at=null;for(let i=0,ii=System.config.actionTemplates.length;i<ii&&(at=System.config.actionTemplates[i],at.name!==tn);i++)at=null;if(null===at)return void ctx.error(TcHmi.Errors.E_INVALID,{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:'Can not find action template with name: "'+tn+'" in configuration. Please check tchmiconfig.json',domain:"TcHmi.System.TriggerManager"});const iGuid=tchmi_create_guid();let hasError=!1,params=at.parameters;const cleanUpParams=function(){if(params&&params.length)for(let i=0,ii=params.length;i<ii;i++){let p=params[i];if(!p.name)continue;let name=iGuid+"."+p.name;TcHmi.System.Services.templateParamSymbolManager.keepAlive(name)||TcHmi.System.Services.templateParamSymbolManager.remove(name)}};let fnParams=action.fnParams;for(let i=0,ii=params.length;i<ii;i++){let p=params[i];if(!p.name)continue;let name=iGuid+"."+p.name,fnParam=fnParams[i];if(TcHmi.IFunction.isSymbol(fnParam)){let expression;try{expression=new TcHmi.SymbolExpression(fnParam.symbolExpression)}catch(e){ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'Property: "symbolExpression" in object of type "TcHmi.Trigger.ActionTemplate" with templateName: "'+action.templateName+'" is no valid symbol expression. Processing will be aborted.',exception:e,domain:"TcHmi.System.TriggerManager"}),hasError=!0;break}TcHmi.System.Services.templateParamSymbolManager.add(name,p.type,expression)}else{if(!TcHmi.IFunction.isStaticValue(fnParam)){if(fnParam){ctx.error(TcHmi.Errors.ERROR,{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:'Unknown objectType: "'+fnParam.objectType+'" in parameter in property: "fnParam" in object of type "TcHmi.Trigger.ActionTemplate" with templateName: "'+action.templateName+'". Supported objectTypes are "Symbol" and "StaticValue". Processing will be aborted.',domain:"TcHmi.System.TriggerManager"}),hasError=!0;break}ctx.error(TcHmi.Errors.ERROR,{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:'Missing property: "fnParam" in object of type "TcHmi.Trigger.ActionTemplate" with templateName: "'+action.templateName+'". Processing will be aborted.',domain:"TcHmi.System.TriggerManager"}),hasError=!0;break}TcHmi.System.Services.templateParamSymbolManager.add(name,p.type,fnParam.value)}}if(hasError)ctx.error(TcHmi.Errors.ERROR,{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.TriggerManager"}),cleanUpParams();else{let aCloneString=JSON.stringify(at.actions);for(let i=0,ii=params.length;i<ii;i++){let p=params[i];p.name&&(aCloneString=aCloneString.replace(new RegExp(tchmi_escape_regex("%tp%"+p.name),"g"),"%tp%"+iGuid+"."+p.name))}let aClone=TcHmi.ValueConverter.toObject(aCloneString);if(null===aClone)ctx.error(TcHmi.Errors.ERROR,{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Failed to reparse json for scoped action in action template.",domain:"TcHmi.System.TriggerManager"});else try{let bContextLock=!1;this.__processActionList({success:function(result){bContextLock||(bContextLock=!0,ctx.success(),cleanUpParams())},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details),cleanUpParams())},trigger:ctx.trigger,event:ctx.event,args:ctx.args},aClone,diagGUID)}catch(e){ctx.error(TcHmi.Errors.E_EXCEPTION,{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:"An uncaught exception occurred in the processing of the "+action.templateName,exception:e,domain:"TcHmi.System.TriggerManager"})}}}}__taFunctionExpression(ctx,action,diagGUID){if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __taFunctionExpression called with action:",{ctx:ctx,action:action}),!TcHmi.Trigger.isFunctionExpression(action))return;if(!action.functionExpression)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"functionExpression was empty",domain:"TcHmi.System.TriggerManager"});let func=new System.FunctionExpression(action.functionExpression),bContextLock=!1;func.execute({success:function(result){bContextLock||(bContextLock=!0,ctx.success(result))},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))},args:ctx.args})}__taJavaScript(ctx,action,diagGUID){if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __taJavaScript called with:",{ctx:ctx,action:action}),!TcHmi.Trigger.isJavaScript(action))return;let sEval="";if(Array.isArray(action.sourceLines)){for(const sourceLine of action.sourceLines)sEval+=tchmi_decode_control_characters(sourceLine,{preserveBackslash:!0})+"\n";sEval+="\n//# sourceURL=TcHmi_System_TriggerManager___taJavaScript_Eval";try{let bContextLock=!1;gIsolatedEval_TcHmi_System_TriggerManager_JavaScriptAction({success:function(){bContextLock||(bContextLock=!0,"Asynchronous"===action.waitMode&&ctx.success())},error:function(error,details){bContextLock||(bContextLock=!0,"Asynchronous"===action.waitMode&&ctx.error(error,details))},args:ctx.args},sEval),"Asynchronous"!==action.waitMode&&ctx.success()}catch(e){"Asynchronous"!==action.waitMode&&ctx.error(TcHmi.Errors.E_TRIGGER_JAVASCRIPT_EVAL_EXCEPTION,{code:TcHmi.Errors.E_TRIGGER_JAVASCRIPT_EVAL_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_JAVASCRIPT_EVAL_EXCEPTION],reason:"An uncaught exception occurred in the processing of a JavaScript action",exception:e,domain:"TcHmi.System.TriggerManager"})}}else ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'Invalid property: "sourceLines" in obect of type "TcHmi.Trigger.JavaScript". Expected an array of strings.',domain:"TcHmi.System.TriggerManager"})}__taCondition(ctx,condition,diagGUID){if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __taCondition called with:",{ctx:ctx,condition:condition}),!condition)return void ctx.error(TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,{code:TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_CONDITION_INVALID],reason:'Object of type "TcHmi.Trigger.Condition" must not be null or undefined.',domain:"TcHmi.System.TriggerManager"});let parts=condition.parts;if(!parts)return void ctx.error(TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,{code:TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_CONDITION_INVALID],reason:'Object of type "TcHmi.Trigger.Condition" requires at least a property with name "part" which is an array with one object which contains a property named "if" with a value of type "TcHmi.Trigger.Expression".',domain:"TcHmi.System.TriggerManager"});if(0===parts.length)return void ctx.success();let __this=this,processedIf=!1,i=0,proc=function(ctx){let expressions,followingActions,part=parts[i];if(part){if(i++,"if"in part&&void 0!==part.if)expressions=part.if,followingActions=part.then,processedIf=!0;else if("elseif"in part&&void 0!==part.elseif){if(expressions=part.elseif,followingActions=part.then,!processedIf)return void ctx.error(TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,{code:TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_CONDITION_INVALID],reason:'Part "elseif" must not be defined before part "if".',domain:"TcHmi.System.TriggerManager"})}else if("else"in part&&void 0!==part.else&&(followingActions=part.else,!processedIf))return void ctx.error(TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,{code:TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_CONDITION_INVALID],reason:'Part "else" must not be defined before part "if".',domain:"TcHmi.System.TriggerManager"});try{let bContextLock=!1;expressions&&followingActions?__this.__resolveConditionExpressionsResult({success:function(result){bContextLock||(bContextLock=!0,!0===result?__this.__processActionList({success:function(result){ctx.success()},error:function(error,details){ctx.success()},trigger:ctx.trigger,event:ctx.event,args:ctx.args},followingActions,diagGUID):proc({success:function(result){ctx.success()},error:function(error,details){ctx.error(error,details)},trigger:ctx.trigger,event:ctx.event,args:ctx.args}))},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))},trigger:ctx.trigger,event:ctx.event,args:ctx.args},expressions):expressions&&!followingActions?__this.__resolveConditionExpressionsResult({success:function(result){bContextLock||(bContextLock=!0,!0===result?ctx.success():proc({success:function(result){ctx.success()},error:function(error,details){ctx.error(error,details)},trigger:ctx.trigger,event:ctx.event,args:ctx.args}))},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))},trigger:ctx.trigger,event:ctx.event,args:ctx.args},expressions):!expressions&&followingActions?__this.__processActionList({success:function(result){ctx.success()},error:function(error,details){ctx.success()},trigger:ctx.trigger,event:ctx.event,args:ctx.args},followingActions,diagGUID):ctx.error(TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,{code:TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_CONDITION_INVALID],reason:"Condition definition is invalid because it contains no expressions and no following actions.",domain:"TcHmi.System.TriggerManager"})}catch(e){ctx.error(TcHmi.Errors.E_TRIGGER_RESOLVE_CONDITION_EXPRESSION_EXCEPTION,{code:TcHmi.Errors.E_TRIGGER_RESOLVE_CONDITION_EXPRESSION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_RESOLVE_CONDITION_EXPRESSION_EXCEPTION],reason:"An uncaught exception occurred in the processing of a condition",exception:e,domain:"TcHmi.System.TriggerManager"})}}else ctx.success()};proc({success:function(result){ctx.success()},error:function(error,details){ctx.error(error,details)},trigger:ctx.trigger,event:ctx.event,args:ctx.args})}__taSwitchCase(ctx,switchCase,diagGUID){if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __taSwitchCase called with:",{ctx:ctx,switchCase:switchCase}),null==switchCase)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'Object of type "TcHmi.Trigger.SwitchCase" must not be null or undefined.',domain:"TcHmi.System.TriggerManager"});let comp=switchCase.compare;if(null==comp)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'Object of type "TcHmi.Trigger.SwitchCase" requires a property: "compare" which must not be null or undefined.',domain:"TcHmi.System.TriggerManager"});let cases=switchCase.cases;if(null==cases)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'Object of type "TcHmi.Trigger.SwitchCase" requires a property: "cases" which must not be null or undefined.',domain:"TcHmi.System.TriggerManager"});let dc=null;void 0!==switchCase.caseDefault&&null!==switchCase.caseDefault&&(dc=switchCase.caseDefault);let cpv,__this=this,bContextLock=!1;this.__resolveValue({success:function(result){bContextLock||(bContextLock=!0,cpv=result,function(){let resultByCase=new WeakMap,pending=cases.length,finalize=function(){if(pending>0)return;let error=null,tc=null;for(let i=0,ii=cases.length;i<ii;i++){let c=cases[i],res=resultByCase.get(c);if(!res){error={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.TriggerManager"};break}if(res.error!==TcHmi.Errors.NONE){error=res.details?res.details:{code:res.error,message:TcHmi.Errors[res.error],domain:"TcHmi.System.TriggerManager"};break}if(!0===tchmi_equal(res.value,cpv,!1)&&(tc=c),null!==tc)break}error?ctx.error(error.code,error):null!==tc?__this.__processActionList({success:function(){ctx.success(TcHmi.Errors.NONE)},error:function(){ctx.success(TcHmi.Errors.NONE)},trigger:ctx.trigger,event:ctx.event,args:ctx.args},tc.actions,diagGUID):null!==dc&&__this.__processActionList({success:function(){ctx.success(TcHmi.Errors.NONE)},error:function(){ctx.success(TcHmi.Errors.NONE)},trigger:ctx.trigger,event:ctx.event,args:ctx.args},dc.actions,diagGUID)};for(let i=0,ii=cases.length;i<ii;i++){const c=cases[i];if(null==c){resultByCase.set(c,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:'Property: "cases" in object of type: "TcHmi.Trigger.SwitchCase" must not contain entries which are null or undefined.',domain:"TcHmi.System.TriggerManager"}}),pending--,finalize();continue}const cv=c.caseValue;if(null!=cv)switch(cv.objectType){case"StaticValue":resultByCase.set(c,{error:TcHmi.Errors.NONE,value:cv.value}),pending--,finalize();break;case"Symbol":let symbol;try{symbol=new System.Symbol(cv.symbolExpression)}catch(e){}symbol?symbol.read((function(data){data.error===TcHmi.Errors.NONE?resultByCase.set(c,{error:TcHmi.Errors.NONE,value:data.value}):resultByCase.set(c,{error:data.error,details:data.details}),pending--,finalize(),symbol?.destroy()})):(resultByCase.set(c,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:'SymbolExpression "'+cv.symbolExpression+'" is not valid.',domain:"TcHmi.System.TriggerManager"}}),pending--,finalize());break;default:resultByCase.set(c,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:'Object type: "'+cv.objectType+'" is not supported in switch case. Please use objects of type: "StaticValue" or symbols.',domain:"TcHmi.System.TriggerManager"}}),pending--,finalize()}else resultByCase.set(c,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.TriggerManager"}}),pending--,finalize()}}())},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))},trigger:ctx.trigger,event:ctx.event,args:ctx.args},comp)}__processAction(ctx,action,diagGUID){let __this=this;if(!1===action.active)return void ctx.success();let bContextLock=!1,ctx2={success:function(result){if(bContextLock)return;bContextLock=!0;let bContextLock2=!1;__this.__processActionList({success:function(result){bContextLock2||(bContextLock2=!0,ctx.success(result))},error:function(error,details){bContextLock2||(bContextLock2=!0,ctx.error(error,details))},trigger:ctx.trigger,event:ctx.event,args:ctx.args},action.success,diagGUID)},error:function(error,details){if(bContextLock)return;bContextLock=!0,details?TCHMI_CONSOLE_LOG_LEVEL>=1&&(details.exception?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TriggerManager, Event="+ctx.event.name+", ObjectType="+action.objectType+"] "+TcHmi.Log.buildMessage(details)+"\nException:",details.exception):TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TriggerManager, Event="+ctx.event.name+", ObjectType="+action.objectType+"] "+TcHmi.Log.buildMessage(details))):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.TriggerManager, Event="+ctx.event.name+", ObjectType="+action.objectType+"] "+TcHmi.Log.buildMessage({code:error,message:TcHmi.Errors[error]}));let bContextLock2=!1;__this.__processActionList({success:function(result){bContextLock2||(bContextLock2=!0,ctx.success(result))},error:function(error,details){bContextLock2||(bContextLock2=!0,ctx.error(error))},trigger:ctx.trigger,event:ctx.event,args:ctx.args},action.error,diagGUID)},trigger:ctx.trigger,event:ctx.event,args:ctx.args};try{switch(action.objectType){case"Condition":this.__taCondition(ctx2,action,diagGUID);break;case"SwitchCase":this.__taSwitchCase(ctx2,action,diagGUID);break;case"ControlApiFunction":this.__taControlApiFunction(ctx2,action,diagGUID);break;case"WriteToSymbol":this.__taWriteToSymbol(ctx2,action,diagGUID);break;case"Function":this.__taFunction(ctx2,action,diagGUID);break;case"JavaScript":this.__taJavaScript(ctx2,action,diagGUID);break;case"ActionTemplate":this.__taActionTemplate(ctx2,action,diagGUID);break;case"FunctionExpression":this.__taFunctionExpression(ctx2,action,diagGUID);break;case"Comment":ctx.success();break;default:ctx.error(TcHmi.Errors.E_NOT_SUPPORTED,{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:'Object type: "'+action.objectType+'" is not supported.',domain:"TcHmi.System.TriggerManager"})}}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TriggerManager, Event=",ctx.event.name,", ObjectType=",action.objectType,"] Throwed",e),ctx.error(TcHmi.Errors.E_TRIGGER_ACTION_EXCEPTION,{code:TcHmi.Errors.E_TRIGGER_ACTION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_ACTION_EXCEPTION],reason:"An uncaught exception occurred in a __processAction call",exception:e,domain:"TcHmi.System.TriggerManager"})}}__processActionList(ctx,actions,diagGUID){if(!actions)return void ctx.success();let l=actions.length;if(0===l)return void ctx.success();let c=0,__this=this,proc=function(){let action=actions[c],next=function(){c===l-1?ctx.success():(c++,proc())},bContextLock=!1;__this.__processAction({success:function(){bContextLock||(bContextLock=!0,void 0!==action.asyncWait&&!0!==action.asyncWait||next())},error:function(error,details){bContextLock||(bContextLock=!0,void 0!==action.asyncWait&&!0!==action.asyncWait||next())},trigger:ctx.trigger,event:ctx.event,args:ctx.args},action,diagGUID),void 0!==action.asyncWait&&!1===action.asyncWait&&next()};proc()}__onTriggerEvent(trigger){let __this=this;return function(event,...data){let diagGUID="";TCHMI_CONSOLE_LOG_LEVEL>=4&&(diagGUID=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __onTriggerEvent called with:",{event:event,data:data});const nativeEventObj=data?.[0];!0===trigger.preventDefault&&"function"==typeof nativeEventObj?.preventDefault&&(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+'] __onTriggerEvent calling data.preventDefault() because "trigger.preventDefault === true".'),nativeEventObj.preventDefault()),__this.__processActionList({success:function(){},error:function(error,details){},trigger:trigger,event:event,args:data},trigger.actions,diagGUID)}}register(triggerArr){if(!0===TCHMI_DESIGNER)return()=>{};if(!triggerArr)return()=>{};let destroyTriggerEvents=[];for(const trigger of triggerArr)"string"==typeof trigger.event&&Array.isArray(trigger.actions)&&destroyTriggerEvents.push(TcHmi.EventProvider.register(trigger.event,this.__onTriggerEvent(trigger),trigger.preventDefault?{passive:!1,capture:!1}:void 0));return()=>{destroyTriggerEvents.forEach((destroy=>{destroy()})),destroyTriggerEvents=[]}}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){TCHMI_DYNAMIC_INSTANCE_ID=tchmi_create_guid();let buildTimeObj=document.head.querySelector('meta[name="tchmi-buildtime"]');buildTimeObj&&(TcHmi.System.buildtime=buildTimeObj.content);class Init{static printGeneralLogInformation(){TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] Loading TwinCAT HMI Application"),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] window.location.href:",window.location.href),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] window.navigator.appName:",window.navigator.appName),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] window.navigator.appCodeName:",window.navigator.appCodeName),window.navigator.userAgentData?(TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] navigator.userAgentData.brands:",JSON.stringify(window.navigator.userAgentData?.brands)),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] navigator.userAgentData.platform:",window.navigator.userAgentData?.platform),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] navigator.userAgentData.mobile:",window.navigator.userAgentData?.mobile)):(TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] window.navigator.appVersion:",window.navigator.appVersion),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] window.navigator.platform:",window.navigator.platform),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] window.navigator.userAgent:",window.navigator.userAgent)),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] window.navigator.cookieEnabled:",window.navigator.cookieEnabled),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] window.navigator.maxTouchPoints:",window.navigator.maxTouchPoints),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_DYNAMIC_INSTANCE_ID:",TCHMI_DYNAMIC_INSTANCE_ID),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_DEBUG_TIME_LOAD_LIBRARY:",TCHMI_DEBUG_TIME_LOAD_LIBRARY),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_ENGINEERING:",TCHMI_ENGINEERING),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_DESIGNER:",TCHMI_DESIGNER),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_LIVEVIEW:",TCHMI_LIVEVIEW),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_RUNTIME:",TCHMI_RUNTIME),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_TARGET_PARTIAL:",TCHMI_TARGET_PARTIAL),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_CONFIG_OVERRIDE: ",TCHMI_CONFIG_OVERRIDE),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_ENGINEERING_WEBSOCKET:",TCHMI_ENGINEERING_WEBSOCKET),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_CONSOLE_LOG_LEVEL:",TCHMI_CONSOLE_LOG_LEVEL),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_CONSOLE_LOG_PERSISTENT:",TCHMI_CONSOLE_LOG_PERSISTENT),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES:",TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES:",TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_CONSOLE_LOG_ENGINEERING_COM_MESSAGES:",TCHMI_CONSOLE_LOG_ENGINEERING_COM_MESSAGES),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_UNITTEST_MODE:",TCHMI_UNITTEST_MODE),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_BENCHMARK_MODE:",TCHMI_BENCHMARK_MODE),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_EVENT_OPTION_OBJECT_SUPPORTED:",TCHMI_EVENT_OPTION_OBJECT_SUPPORTED),TcHmi.System.buildtime&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TcHmi.System.buildtime:",TcHmi.System.buildtime),performance&&"object"==typeof performance&&"function"==typeof performance.now&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] Time elapsed: "+performance.now().toFixed(3).toString()+"ms"))}static printForcedLogInformation(){TCHMI_FLAG_OVERRIDES&&(TcHmi.Log.Force=!0,TcHmi.Log.infoEx('Overrides are used for some client flags.\nTo get rid of the flag overrides either clear the browsers localStorage entry with the key: "TCHMI_FLAG_OVERRIDES" or reset the settings on the "Client" server config page.\nThe following flag overrides are currently used:\n',TCHMI_FLAG_OVERRIDES),TcHmi.Log.Force=!1)}static prepare(){TcHmi.System.SharedResources.jqWindow=$(window),TcHmi.System.SharedResources.jqDocument=$(document);const pathName=new URL(window.location.href).pathname,dirIndex=pathName.lastIndexOf("/");if(0!==dirIndex&&(TcHmi.System.hostPrefix=pathName.substring(1,dirIndex)+":"),TcHmi.System.Services.dialogManager)throw TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Duplicate Framework code running! Please fix JS inclusion. Aborting."),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain","Duplicate Framework code running. Aborting...",{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),new Error("Duplicate Framework code running");try{TcHmi.System.Services.dialogManager=new TcHmi.System.DialogManager,TcHmi.System.Services.splashScreen=new TcHmi.System.SplashScreen}catch(ex){const report=evt=>{document.body.innerText="Internal Error: Creating DialogManager or SplashScreen failed. Aborting load."};throw document.body?report():document.addEventListener("readystatechange",report,{once:!0}),ex}if(document.body)TcHmi.System.SharedResources.jqBody=$(document.body),TcHmi.System.SharedResources.jqBody.empty();else{const populateJqBody=function(){TcHmi.System.SharedResources.jqBody=$(document.body),TcHmi.System.SharedResources.jqBody.empty(),1e4===TcHmi.System.Init.__initStep&&TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay)};document.addEventListener("DOMContentLoaded",populateJqBody,{once:!0})}}static run(initStep){TcHmi.System.Init.__initStep=initStep;let indexedDbRequest,initStage=0,userFunctions=[],userControlPartials=[],viewPartials=[],contentPartials=[],packageControlsLoaded=new Set,packageControls=[],packageFunctionsLoaded=new Set,packageFunctions=[],xhrCacheSuffix=TCHMI_ENGINEERING?"?preventcache="+TCHMI_DYNAMIC_INSTANCE_ID:"";const PendingCounter={PackageLoaded:2e9,BaseConfigLoaded:2e9,BaseDescriptionLoaded:2e9,BasePackageLoaded:2e9,OpenEngineeringConnection:2e9,OpenServerConnection:2e9,ControlsDescriptionLoaded:2e9,ControlsDescriptionResolved:2e9,TypeDefinitionsResolved:2e9,ServerSymbolSchemaCacheResolved:2e9,ControlsTemplatesLoaded:2e9,PackagesFunctionDescriptionLoaded:2e9,UserFunctionDescriptionLoaded:2e9,UserControlsLoaded:2e9,ContentLoaded:2e9,ViewLoaded:2e9,ContentCompiled:2e9,ViewCompiled:2e9};let initStageInfo=new Map([[0,{id:0,text:"System Configuration",toDo:1,done:0}],[1,{id:1,text:"Preparing System",toDo:1,done:0}],[2,{id:2,text:"Loading Packages",toDo:0,done:0}],[3,{id:3,text:"Preparing Controls",toDo:1,done:0}],[4,{id:4,text:"Preparing Functions",toDo:1,done:0}],[5,{id:5,text:"Connectivity",toDo:1,done:0}],[6,{id:6,text:"Validation",toDo:1,done:0}],[7,{id:7,text:"Type Definitions",toDo:1,done:0}],[8,{id:8,text:"Loading UserControls",toDo:0,done:0}],[9,{id:9,text:"Loading Content",toDo:0,done:0}],[10,{id:10,text:"Loading Views",toDo:0,done:0}],[11,{id:11,text:"Compiling Content",toDo:0,done:0}],[12,{id:12,text:"Compiling Views",toDo:0,done:0}],[13,{id:13,text:"Preloading Bindings",toDo:0,done:0}],[14,{id:14,text:"Finalize",toDo:1,done:0}]]),updateSplashScreen=()=>{if(TCHMI_DESIGNER)return;let stage=initStageInfo.get(initStage);stage&&(TcHmi.System.Services.splashScreen.updateVersionInfo("Version: "+TcHmi.version.full),TcHmi.System.Services.splashScreen.updateStageInfo("Stage "+(stage.id+1)+" / "+initStageInfo.size+": "+stage.text),0===stage.done&&0===stage.toDo?TcHmi.System.Services.splashScreen.updateStageProgress(100):0===stage.done&&stage.toDo>0?TcHmi.System.Services.splashScreen.updateStageProgress(0):TcHmi.System.Services.splashScreen.updateStageProgress(stage.done/stage.toDo*100))},packagesLoaded=new Set;const loadPackage=function(packageInfo,callback=null){const cleanPath=tchmi_path(packageInfo.basePath+"/Manifest.json");let xhr=new XMLHttpRequest;xhr.open("GET",cleanPath+xhrCacheSuffix);let error=function(evt){TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:'Failed to load package: "'+packageInfo.name+'" from "Properties/tchmiconfig.json". Missing "Manifest.json". Expected path: "'+cleanPath+'". Details: '+xhr.statusText}})};xhr.addEventListener("load",(function(evt){if(200!==xhr.status)return void error(evt);let manifest=TcHmi.ValueConverter.toObject(xhr.responseText);if(!manifest||!manifest.modules)return void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:'Failed to load package: "'+packageInfo.name+'" from "Properties/tchmiconfig.json". Response returns no valid "Manifest.json" content. Details: '+xhr.responseText}});let packageObj={name:packageInfo.name,basePath:packageInfo.basePath,manifest:manifest};if(TcHmi.System.Data.packages.has(packageObj.name))TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi] Found duplicate entry in Properties/tchmiconfig.json#package "+packageObj.name+" Skipping entry.");else if(TcHmi.System.Data.packages.set(packageObj.name,packageObj),manifest.modules.length>0)for(let i=0,ii=manifest.modules.length;i<ii;i++){let module=manifest.modules[i];if(module&&"Control"===module.type){let descrUrl=tchmi_path(packageObj.basePath+"/"+module.basePath+"/"+module.descriptionFile);if(packageControlsLoaded.has(descrUrl))continue;packageControlsLoaded.add(descrUrl),packageControls.push({package:packageObj,module:module})}else if(module&&"Function"===module.type){let descrUrl=tchmi_path(packageObj.basePath+"/"+module.basePath+"/"+module.descriptionFile);if(packageFunctionsLoaded.has(descrUrl))continue;packageFunctionsLoaded.add(descrUrl),packageFunctions.push({package:packageObj,module:module})}}TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi] Loading "+cleanPath+" finished!"),TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE}),manifest=null})),xhr.addEventListener("error",error),xhr.send()};!function InitStateMachine(){switch(TcHmi.System.Init.__initStep){case 1:break;case 2:{let missingBrowserFeatures=[],neededInGlobal=["WebSocket","Map","WeakMap","MutationObserver","indexedDB","Set","Promise"];for(let feature of neededInGlobal)feature in window||missingBrowserFeatures.push(feature);let neededInDiv=["replaceWith","before","after","prepend","append"];for(let feature of neededInDiv)feature in document.head||missingBrowserFeatures.push("Node."+feature);let neededInArray=["find","includes"];for(let feature of neededInArray)feature in Array.prototype||missingBrowserFeatures.push("Array.prototype."+feature);Array.from||missingBrowserFeatures.push("Array.from");let neededInString=["startsWith","endsWith","includes"];for(let feature of neededInString)feature in String.prototype||missingBrowserFeatures.push("String.prototype."+feature);if(document.head.classList){const testDiv=document.createElement("div");testDiv.classList.add("a","b"),"a b"!==testDiv.className&&missingBrowserFeatures.push("Element.classList.add with multiple arguments"),testDiv.className="a",testDiv.classList.toggle("a",!0),"a"!==testDiv.className&&missingBrowserFeatures.push("Element.classList.toggle with force")}else missingBrowserFeatures.push("Element.classList");if(missingBrowserFeatures.length>0)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi] Browser does not support required features: "+missingBrowserFeatures.join(", ")+"."),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain","Browser does not support required features: <ul><li>"+missingBrowserFeatures.join("</li>\n<li>")+"</li></ul>",{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();TcHmi.System.Init.__initStep=3}case 3:(TCHMI_DESIGNER?Promise.resolve():fetch(window.location.href,{method:"HEAD"}).then((response=>{if(!response.ok)return Promise.reject(response.status+" "+response.statusText);const hostBaseUri=response.headers.get("X-Custom-Reverse-Proxy-Host-Uri");hostBaseUri&&(TcHmi.System.hostBaseUri=hostBaseUri,TcHmi.System.hostPrefix=hostBaseUri+":")}))).then((()=>{TcHmi.System.Init.__initStep=4})).catch((e=>{TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Resolving host environment failed. Detail: "+e),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain","Resolving host environment failed. Details: "+e,{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4})).finally((()=>{TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()}))}));break;case 4:{TcHmi.System.Init.__initStep=1,TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.BASE_CONFIGURATION"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.BASE_CONFIGURATION")),PendingCounter.BaseConfigLoaded=1;const tchmiConfigPath="Properties/tchmiconfig.json";let xhrTcHmiConfig=new XMLHttpRequest;xhrTcHmiConfig.open("GET",tchmiConfigPath+xhrCacheSuffix);let xhrTcHmiConfigSuccess=function(evt){if(200!==xhrTcHmiConfig.status)return void xhrTcHmiConfigError(evt);if(1e4===TcHmi.System.Init.__initStep)return;let config=TcHmi.System.config=TcHmi.ValueConverter.toObject(xhrTcHmiConfig.responseText);if(!config)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Configuration file: "Properties/tchmiconfig.json" is not valid.'),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",'Configuration file: "Properties/tchmiconfig.json" is not valid.',{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();for(let key in config)if(key.startsWith("__COMMENT"))return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Configuration file: "Properties/tchmiconfig.json" is not valid. Content was not generated from "tchmiconfig.tpl.json".'),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",'Configuration file: "Properties/tchmiconfig.json" is not valid. Content was not generated from "tchmiconfig.tpl.json".',{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();config.basePath??(config.basePath=""),config.scaleMode??(config.scaleMode="None"),config.startupView??(config.startupView=""),config.activeTheme??(config.activeTheme="Base"),config.themes??(config.themes={}),config.tcHmiServer??(config.tcHmiServer={websocketIntervalTime:500,websocketSystemTimeout:6e4,websocketTimeout:6e4}),config.symbols??(config.symbols={internal:{}}),config.trigger??(config.trigger=[]),config.packages??(config.packages=[]),config.views??(config.views=[]),config.userFunctions??(config.userFunctions=[]),config.userControls??(config.userControls=[]),config.content??(config.content=[]),config.actionTemplates??(config.actionTemplates=[]),config.languages??(config.languages={}),config.keyboardLayouts??(config.keyboardLayouts=[]),config.creatorSettings?config.creatorSettings.viewport||(config.creatorSettings.viewport={defaultHeight:768,defaultWidth:1024}):config.creatorSettings={viewport:{defaultHeight:768,defaultWidth:1024}},config.tcHmiServer.websocketIntervalTime||(config.tcHmiServer.websocketIntervalTime=500),config.tcHmiServer.websocketTimeout||(config.tcHmiServer.websocketTimeout=6e4),config.tcHmiServer.websocketSystemTimeout||(config.tcHmiServer.websocketSystemTimeout=6e4),config.binding?config.binding.symbolError||(config.binding.symbolError="Ignore"):config.binding={symbolError:"Ignore"},userFunctions=[];let userFunctionsPrepared=new Set;for(const entry of tchmi_clone_object(TcHmi.System.config.userFunctions))entry.url=tchmi_path(entry.url),userFunctionsPrepared.has(entry.url)||(userFunctionsPrepared.add(entry.url),userFunctions.push(entry));userControlPartials=[];let userControlPartialsPrepared=new Set;for(const entry of tchmi_clone_object(TcHmi.System.config.userControls))entry.url=tchmi_path(entry.url),userControlPartialsPrepared.has(entry.url)||(userControlPartialsPrepared.add(entry.url),userControlPartials.push(entry));initStageInfo.get(8).toDo+=2*userControlPartials.length,contentPartials=[];let contentPartialsPrepared=new Set;for(const entry of tchmi_clone_object(TcHmi.System.config.content))entry.url=tchmi_path(entry.url),contentPartialsPrepared.has(entry.url)||(!0===entry.preload&&(initStageInfo.get(9).toDo++,initStageInfo.get(11).toDo++,entry.keepAlive=!0),void 0===entry.keepAlive&&(entry.keepAlive=!1),!0!==entry.keepAlive||TCHMI_DESIGNER?TcHmi.System.Data.isKeepAlivePartial.set(entry.url,!1):TcHmi.System.Data.isKeepAlivePartial.set(entry.url,!0),!0!==entry.preloadBindings||TCHMI_DESIGNER?TcHmi.System.Data.isPreloadBindingPartial.set(entry.url,!1):TcHmi.System.Data.isPreloadBindingPartial.set(entry.url,!0),TcHmi.System.Data.isLoadSyncContent.set(entry.url,!!entry.loadSync),contentPartialsPrepared.add(entry.url),contentPartials.push(entry));PendingCounter.ContentCompiled=contentPartials.length,viewPartials=[];let viewPartialsPrepared=new Set;for(const entry of tchmi_clone_object(TcHmi.System.config.views))entry.url=tchmi_path(entry.url),viewPartialsPrepared.has(entry.url)||(!0===entry.preload&&(initStageInfo.get(10).toDo++,initStageInfo.get(12).toDo++,entry.keepAlive=!0),void 0===entry.keepAlive&&(entry.keepAlive=!1),!0===entry.keepAlive?TcHmi.System.Data.isKeepAlivePartial.set(entry.url,!0):TcHmi.System.Data.isKeepAlivePartial.set(entry.url,!1),!0!==entry.preloadBindings||TCHMI_DESIGNER?TcHmi.System.Data.isPreloadBindingPartial.set(entry.url,!1):TcHmi.System.Data.isPreloadBindingPartial.set(entry.url,!0),viewPartialsPrepared.add(entry.url),viewPartials.push(entry));if(PendingCounter.ViewCompiled=viewPartials.length,PendingCounter.PackageLoaded=TcHmi.System.config.packages.length,initStageInfo.get(2).toDo=TcHmi.System.config.packages.length,TCHMI_ENGINEERING){const TchmiConfigOverride=TCHMI_CONFIG_OVERRIDE;TchmiConfigOverride&&(void 0!==TchmiConfigOverride.basePath&&(TcHmi.System.config.basePath=TchmiConfigOverride.basePath),TchmiConfigOverride.tcHmiServer&&TchmiConfigOverride.tcHmiServer.websocketIntervalTime&&(TcHmi.System.config.tcHmiServer.websocketIntervalTime=TchmiConfigOverride.tcHmiServer.websocketIntervalTime))}TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi] Loading Properties/tchmiconfig.json finished."),PendingCounter.BaseConfigLoaded--,0===PendingCounter.BaseConfigLoaded&&(TcHmi.System.Init.__initStep=5,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()})))},xhrTcHmiConfigError=function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading Properties/tchmiconfig.json failed! Detail: "+xhrTcHmiConfig.statusText),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",'Loading configuration file: "Properties/tchmiconfig.json" failed. Details: '+xhrTcHmiConfig.statusText,{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),1e4!==TcHmi.System.Init.__initStep&&(TcHmi.System.Init.__initStep=1e4,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()})))};xhrTcHmiConfig.addEventListener("load",xhrTcHmiConfigSuccess),xhrTcHmiConfig.addEventListener("error",xhrTcHmiConfigError),xhrTcHmiConfig.send()}break;case 5:{TcHmi.System.Init.__initStep=1,TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.BASE_DESCRIPTION"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.BASE_DESCRIPTION")),PendingCounter.BaseDescriptionLoaded=1;const frameworkDescriptionPath=tchmi_path(TcHmi.System.config.basePath+"/Description.json");let xhrFwDescr=new XMLHttpRequest;xhrFwDescr.open("GET",frameworkDescriptionPath+xhrCacheSuffix);let xhrFwDescrSuccess=function(evt){if(200===xhrFwDescr.status){if(1e4!==TcHmi.System.Init.__initStep){if(TcHmi.System.description=TcHmi.ValueConverter.toObject(xhrFwDescr.responseText),!TcHmi.System.description||!TcHmi.System.description.version)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Loading Framework description file: "'+frameworkDescriptionPath+'" failed. File is not a valid Framework description file. Details: '+xhrFwDescr.responseText),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",'Loading Framework description file: "'+frameworkDescriptionPath+'" failed. File is not a valid Framework description file.',{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();TcHmi.version=TcHmi.System.description.version,TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi] TcHmi.version.full: "+TcHmi.version.full),PendingCounter.BaseDescriptionLoaded--,0===PendingCounter.BaseDescriptionLoaded&&(TcHmi.System.Init.__initStep=6,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()})))}}else xhrFwDescrError(evt)},xhrFwDescrError=function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Loading Framework description file: "'+frameworkDescriptionPath+'" failed. Details: '+xhrFwDescr.statusText),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",'Loading Framework description file: "'+frameworkDescriptionPath+'" failed. Details: '+xhrFwDescr.statusText,{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),1e4!==TcHmi.System.Init.__initStep&&(TcHmi.System.Init.__initStep=1e4,InitStateMachine())};xhrFwDescr.addEventListener("load",xhrFwDescrSuccess),xhrFwDescr.addEventListener("error",xhrFwDescrError),xhrFwDescr.send()}break;case 6:{TcHmi.System.Init.__initStep=1,TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.BASE_PACKAGE_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.BASE_PACKAGE_LOAD")),PendingCounter.BasePackageLoaded=1;const frameworkPackageInfo=TcHmi.System.config.packages.find((packageInfo=>"Beckhoff.TwinCAT.HMI.Framework"===packageInfo.name));if(!frameworkPackageInfo)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Loading Framework package "Beckhoff.TwinCAT.HMI.Framework" failed. Details: Package information in tchmiconfig.json is missing.'),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",'Loading Framework package "Beckhoff.TwinCAT.HMI.Framework" failed. Details: Package information in tchmiconfig.json is missing.',{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();packagesLoaded.add(frameworkPackageInfo.name),loadPackage(tchmi_clone_object(frameworkPackageInfo),(data=>{data.error===TcHmi.Errors.NONE?(PendingCounter.PackageLoaded--,PendingCounter.BasePackageLoaded--,initStageInfo.get(initStage).done++,updateSplashScreen(),PendingCounter.BasePackageLoaded<=0&&(TcHmi.System.Init.__initStep=7,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()})))):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Loading Framework package "Beckhoff.TwinCAT.HMI.Framework" failed. Details: '+TcHmi.Log.buildMessage(data.details)),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",'Loading Framework package "Beckhoff.TwinCAT.HMI.Framework" failed. Details: '+TcHmi.Log.buildMessage(data.details),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,InitStateMachine())}));break}case 7:{if(TcHmi.System.Services.localizationManager=new System.LocalizationManager,TcHmi.System.description.languages)for(let locale in TcHmi.System.description.languages){const languageEntry=tchmi_clone_object(TcHmi.System.description.languages[locale]);if(Array.isArray(languageEntry)){const sanitizedLanguageArray=[];for(const subEntry of languageEntry)sanitizedLanguageArray.push(tchmi_path(TcHmi.System.config.basePath+"/"+subEntry));TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Framework",locale,sanitizedLanguageArray)}else TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Framework",locale,tchmi_path(TcHmi.System.config.basePath+"/"+languageEntry))}if(TcHmi.System.config.languagesForFramework)for(const[locale,languageEntry]of Object.entries(TcHmi.System.config.languagesForFramework))if(Array.isArray(languageEntry)){const sanitizedLanguageArray=[];for(const subEntry of languageEntry)sanitizedLanguageArray.push(tchmi_path(subEntry));TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Framework",locale,sanitizedLanguageArray)}else TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Framework",locale,tchmi_path(languageEntry));let pending=0;const finalize=()=>{pending>0||(TcHmi.System.Init.__initStep=8,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()})))};TCHMI_DESIGNER&&(pending++,TcHmi.System.Services.localizationManager.processLocale("en",{level:TcHmi.Locale.Level.Engineering},(data=>{pending--,finalize()}))),pending++,TcHmi.System.Services.localizationManager.processLocale("en",{level:TcHmi.Locale.Level.Application},(data=>{pending--,finalize()}))}break;case 8:if(!document.body||!TcHmi.System.SharedResources.jqBody)return void setTimeout((()=>{TcHmi.System.Init.__initStep=8,InitStateMachine()}),25);TCHMI_DESIGNER?(document.documentElement.classList.add("tchmi-html-designer"),document.body.classList.add("tchmi-body-designer")):(document.documentElement.classList.add("tchmi-html-runtime"),document.body.classList.add("tchmi-body-runtime")),TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.THEME_MANAGER_EARLY"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.THEME_MANAGER_EARLY")),TcHmi.System.Init.__initStep=1,TcHmi.System.Services.themeManager=new System.ThemeManager,TcHmi.System.Services.themeManager.processActiveTheme((()=>{initStageInfo.get(initStage).done++,TcHmi.System.Init.__initStep=9,TCHMI_DESIGNER?InitStateMachine():"hidden"!==document.visibilityState?window.requestAnimationFrame((()=>{TcHmi.System.Services.splashScreen.show(),updateSplashScreen(),setTimeout((()=>{initStage=1,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))}))})):(TcHmi.System.Services.splashScreen.show(),InitStateMachine())}),{ignorePackageModules:!0});break;case 9:{Init.__fetchFromIndexedDb=!TcHmi.System.config.disableLoadingOptimization;window.localStorage.getItem(TcHmi.System.hostPrefix+"TcHmi.Init.lastLoadingUser")||(Init.__fetchFromIndexedDb=!1),TcHmi.EventProvider.register("onUserChanged",((evt,currentUser)=>{if(evt.destroy(),currentUser){const lastLoadingUser=window.localStorage.getItem(TcHmi.System.hostPrefix+"TcHmi.Init.lastLoadingUser");if(lastLoadingUser)lastLoadingUser!==currentUser&&(Init.__fetchFromIndexedDb=!1,window.localStorage.removeItem(TcHmi.System.hostPrefix+"TcHmi.Init.lastLoadingUser"));else try{window.localStorage.setItem(TcHmi.System.hostPrefix+"TcHmi.Init.lastLoadingUser",currentUser)}catch(ex){}}}));let cachedBuildtime=null;TcHmi.System.buildtime&&(cachedBuildtime=window.localStorage.getItem(TcHmi.System.hostPrefix+"TcHmi.Init.cachedBuildtime"));const currentObjectStoreNames=["controlTemplate","contentMarkup","userControlMarkup","userControlConfig"].sort();indexedDbRequest=window.indexedDB.open(TcHmi.System.hostPrefix+"TcHmi.Init"),indexedDbRequest.onerror=function(event){indexedDbRequest=void 0},indexedDbRequest.onupgradeneeded=function(event){try{for(const name of currentObjectStoreNames){if(this.result.objectStoreNames.contains(name))try{this.result.deleteObjectStore(name)}catch(e){}this.result.createObjectStore(name)}cachedBuildtime=TcHmi.System.buildtime,cachedBuildtime&&window.localStorage.setItem(TcHmi.System.hostPrefix+"TcHmi.Init.cachedBuildtime",cachedBuildtime)}catch(e){}},indexedDbRequest.onsuccess=function(event){if(!TCHMI_DESIGNER&&TcHmi.System.buildtime){const deleteDatabase=!tchmi_equal(Array.from(this.result.objectStoreNames).sort(),currentObjectStoreNames);if(cachedBuildtime===TcHmi.System.buildtime&&!deleteDatabase&&Init.__fetchFromIndexedDb){const transaction=this.result.transaction(currentObjectStoreNames,"readonly");transaction.objectStore("controlTemplate").openCursor().onsuccess=function(event){if(!Init.__fetchFromIndexedDb)return;const result=this.result;result&&(TcHmi.System.Data.Caches.templateMarkupCache.set(result.key,result.value),result.continue())},transaction.objectStore("userControlMarkup").openCursor().onsuccess=function(event){if(!Init.__fetchFromIndexedDb)return;const result=this.result;result&&(TcHmi.System.Data.Caches.partialMarkupCache.set(result.key,{markup:result.value}),result.continue())},transaction.objectStore("userControlConfig").openCursor().onsuccess=function(event){if(!Init.__fetchFromIndexedDb)return;const result=this.result;result&&(TcHmi.System.Data.Caches.partialCompositeConfigCache.set(result.key,result.value),result.continue())},transaction.objectStore("contentMarkup").openCursor().onsuccess=function(event){if(!Init.__fetchFromIndexedDb)return;const result=this.result;result&&(TcHmi.System.Data.Caches.partialMarkupCache.set(result.key,{markup:result.value}),result.continue())}}else try{if(deleteDatabase)window.localStorage.removeItem(TcHmi.System.hostPrefix+"TcHmi.Init.cachedBuildtime"),window.indexedDB.deleteDatabase(TcHmi.System.hostPrefix+"TcHmi.Init");else{for(const name of currentObjectStoreNames)this.result.transaction(name,"readwrite").objectStore(name).clear();cachedBuildtime=TcHmi.System.buildtime,window.localStorage.setItem(TcHmi.System.hostPrefix+"TcHmi.Init.cachedBuildtime",cachedBuildtime)}}catch(e){}}},TcHmi.System.Init.__initStep=10}case 10:if(TcHmi.System.Init.__initStep=1,TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.SYSTEM_PREPARATION"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.SYSTEM_PREPARATION")),"3.6.4"!==$().jquery)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Mismatching jquery version. Please avoid overriding."),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",TcHmi.System.Services.localization?.getText("Jquery_Version_Missmatch",{level:TcHmi.Locale.Level.Engineering})??"Mismatching jQuery version. Please avoid overriding",{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();if(!document.body||!TcHmi.System.SharedResources.jqBody)return void setTimeout((()=>{TcHmi.System.Init.__initStep=10,InitStateMachine()}),25);try{TcHmi.System.Services.internalSymbolManager=new System.InternalSymbolManager,TcHmi.System.Services.templateParamSymbolManager=new System.TemplateParamSymbolManager,TcHmi.System.Services.bindingManager=new System.BindingManager,TcHmi.System.Services.localization=new System.Locale.Framework,TcHmi.System.Services.serverManager=new System.ServerManager,TcHmi.System.Services.triggerManager=new System.TriggerManager,TcHmi.System.Services.accessManager=new System.AccessManager,TcHmi.System.Services.topMostLayer=new System.TopMostLayer,TcHmi.System.Services.serverEventManager=new System.ServerEventManager,TcHmi.System.Services.controlManager=new System.ControlManager,TcHmi.System.Services.styleManager=new System.StyleManager,TcHmi.System.Services.typeManager=new System.Type.TypeManager,TcHmi.System.Services.animationProvider=new System.AnimationProvider,TcHmi.System.Services.viewManager=new System.ViewManager,TcHmi.System.Services.tcSpeechManager=new System.TcSpeechManager,TcHmi.System.Services.keyboardManager=new System.KeyboardManager,TCHMI_ENGINEERING&&(TcHmi.System.Services.Engineering.designerModeManager=new System.Engineering.DesignerModeManager,TcHmi.System.Services.Engineering.designerModeComManager=new System.Engineering.DesignerModeComManager,TcHmi.System.Services.Engineering.errorPane=new System.Engineering.ErrorPane)}catch(e){return TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",(TcHmi.System.Services.localization?.getText("System_Service_Initialization_Failed",{level:TcHmi.Locale.Level.Engineering})??"System service initialization has failed")+": "+e.message,{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.Log.errorEx((TcHmi.System.Services.localization?.getText("System_Service_Initialization_Failed",{level:TcHmi.Locale.Level.Engineering})??"System service initialization has failed")+": ",e),TcHmi.System.Init.__initStep=1e4,void InitStateMachine()}if(TCHMI_DESIGNER){const tchmiConfigOverride=TCHMI_CONFIG_OVERRIDE;null!==tchmiConfigOverride&&tchmiConfigOverride.tcHmiServer?.websocketOverwrite&&TcHmi.System.Services.serverManager.setServerAddress(window.location.protocol,tchmiConfigOverride.tcHmiServer.websocketOverwrite.host?tchmiConfigOverride.tcHmiServer.websocketOverwrite.host:window.location.host,tchmiConfigOverride.tcHmiServer.websocketOverwrite.port)}TcHmi.EventProvider.raise("System.onInitializedServices"),TcHmi.System.Init.__initStep=11,TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=2,InitStateMachine()):(initStageInfo.get(initStage).done++,updateSplashScreen(),setTimeout((()=>{initStage=2,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})));break;case 11:if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.PACKAGES_MANIFEST_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.PACKAGES_MANIFEST_LOAD")),TcHmi.System.Init.__initStep=1,TcHmi.System.config.packages.length>0)for(const packageInfo of TcHmi.System.config.packages)"Beckhoff.TwinCAT.HMI.Framework"!==packageInfo.name&&(packagesLoaded.has(packageInfo.name)?PendingCounter.PackageLoaded--:(packagesLoaded.add(packageInfo.name),loadPackage(tchmi_clone_object(packageInfo),(data=>{data.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Failed to load package: "'+packageInfo.name+'" from "Properties/tchmiconfig.json". Details: '+TcHmi.Log.buildMessage(data.details)),PendingCounter.PackageLoaded--,initStageInfo.get(initStage).done++,updateSplashScreen(),PendingCounter.PackageLoaded<=0&&(TcHmi.System.Data.packages.forEach((packageIterator=>{packageIterator.manifest.modules.forEach((moduleData=>{"Package"===moduleData.type&&(TcHmi.System.Data.packages.has(moduleData.nugetId)||TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi] Package",packageIterator.name,"references the unknown package",moduleData.nugetId,". Reference will be skipped."))}))})),TcHmi.System.Init.__initStep=12,initStage=3,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():(updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))))}))));else TcHmi.System.Init.__initStep=12,initStageInfo.get(initStage).done++,TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=3,InitStateMachine()):(updateSplashScreen(),setTimeout((()=>{initStage=3,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})));break;case 12:if("complete"!==document.readyState){document.addEventListener("readystatechange",InitStateMachine,{once:!0});break}if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.CONTROLS_DESCRIPTION_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.CONTROLS_DESCRIPTION_LOAD")),TcHmi.System.Init.__initStep=1,packageControls&&packageControls.length>0){PendingCounter.ControlsDescriptionLoaded=packageControls.length;const loadControLDescription=function(packageControl){packageControl.module.basePath||(packageControl.module.basePath="");const cleanPath=tchmi_path(packageControl.package.basePath+"/"+packageControl.module.basePath+"/"+packageControl.module.descriptionFile);let xhrCtrlDescr=new XMLHttpRequest;xhrCtrlDescr.open("GET",cleanPath+xhrCacheSuffix);let xhrCtrlDescrError=function(evt){1e4!==TcHmi.System.Init.__initStep&&(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Failed to load control description: "'+cleanPath+'". Related control type will not be available. Details: Status: '+xhrCtrlDescr.status+", StatusText: "+xhrCtrlDescr.statusText+"."),PendingCounter.ControlsDescriptionLoaded--,PendingCounter.ControlsDescriptionLoaded<=0&&(TcHmi.System.Init.__initStep=13,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()}))))};xhrCtrlDescr.addEventListener("load",(function(evt){if(200!==xhrCtrlDescr.status)return void xhrCtrlDescrError(evt);if(1e4===TcHmi.System.Init.__initStep)return;let descr=TcHmi.ValueConverter.toObject(xhrCtrlDescr.responseText);if(descr&&1===packageControl.package.manifest.apiVersion){let name=descr.name;descr.apiVersion||TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn('[Source=Framework, Module=TcHmi] Package: "'+packageControl.package.name+'": API Version mismatch. This may lead to consequential errors. Please contact the developer of the package. Control module: "'+name+'" has apiVersion: "0" but package has apiVersion: "1". Do not mix TwinCAT HMI 1.10 and TwinCAT 1.12 and greater API modules in one package. If the package is designed to provide TwinCAT HMI 1.10 API controls the apiVersion of the Manifest.json has to be set to "0" if it is designed to provide TwinCAT HMI 1.12 api logic remove the TwinCAT HMI 1.10 API control or set the apiVersion in Description.json to "1" if the control is designed based on TwinCAT HMI 1.12 API.');let qname,namespace=descr.namespace;namespace&&(qname=TcHmi.System.resolveQualifiedName(name,namespace));let registration=TcHmi.System.Data.Registrations.controls.map.get(name);if(registration&&registration.error!==TcHmi.Errors.E_NOT_UNIQUE||!qname||(registration=TcHmi.System.Data.Registrations.controls.map.get(qname)),registration&&registration.error===TcHmi.Errors.NONE){let module={error:TcHmi.Errors.NONE,manifestData:packageControl.module,package:packageControl.package,reg:registration,description:descr,descriptionExpanded:{...tchmi_clone_object(descr),inheritationResolved:!1,inheritedTypes:[],inheritedAttributes:[],inheritedAttributesNameMap:new Map,inheritedAttributesPropertyNameMap:new Map,inheritedAttributesPropertyGetterNameMap:new Map,inheritedAttributesPropertySetterNameMap:new Map,inheritedAccess:[],inheritedEvents:[],inheritedFunctions:[],inheritedLanguages:{}}};if(TcHmi.System.Data.Modules.controls.array.push(module),registration.namespace!==namespace){let qnameErrorhandling;TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Package: "'+packageControl.package.name+'": Namespace from Description.json ('+namespace+") and control registration ("+registration.namespace+") for control "+descr.name+" are different. Please contact the developer of the package."),namespace?qnameErrorhandling=TcHmi.System.resolveQualifiedName(name,namespace):registration.namespace&&(qnameErrorhandling=TcHmi.System.resolveQualifiedName(name,registration.namespace));let modulError={error:TcHmi.Errors.E_CONTROL_INVALID_CONFIGURATION,errorDetails:{code:TcHmi.Errors.E_CONTROL_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INVALID_CONFIGURATION],domain:"TcHmi",reason:"Namespace from Description.json("+namespace+") and control registration("+registration.namespace+") for control "+descr.name+" are different."}};TcHmi.System.Data.Modules.controls.map.set(name,modulError),qnameErrorhandling&&TcHmi.System.Data.Modules.controls.map.set(qnameErrorhandling,modulError)}else TcHmi.System.Data.Modules.controls.map.has(name)?(TcHmi.System.Data.Modules.controls.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi",reason:'Ambiguous module definitions for the name: "'+name+'". Please try fully qualified name.'}}),TcHmi.System.Data.Modules.controls.urlMap.delete(cleanPath)):(TcHmi.System.Data.Modules.controls.map.set(name,module),TcHmi.System.Data.Modules.controls.urlMap.set(cleanPath,module));if(qname&&(TcHmi.System.Data.Modules.controls.map.has(qname)?(TcHmi.System.Data.Modules.controls.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi",reason:"Multiple module definitions with the name "+qname+" found."}}),TcHmi.System.Data.Modules.controls.urlMap.delete(cleanPath)):(TcHmi.System.Data.Modules.controls.map.set(qname,module),TcHmi.System.Data.Modules.controls.urlMap.set(cleanPath,module))),qname){let nameLegacy=TcHmi.System.mapControlNamesFromPackageManifestApi1ToApi0.get(qname);nameLegacy&&(TcHmi.System.Data.Modules.controls.map.has(nameLegacy)?TcHmi.System.Data.Modules.controls.map.set(nameLegacy,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi",reason:"Multiple module definitions with the name "+nameLegacy+" found."}}):TcHmi.System.Data.Modules.controls.map.set(nameLegacy,module))}System.Services.themeManager.registerControlThemeFiles(descr)}else if(registration)registration.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Registration of control type "'+qname+'" is not valid and will therefore not be available. Details: '+TcHmi.Log.buildMessage(registration.errorDetails));else{TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Control type "'+qname+'" is not registered and will therefore not be available.\nPossible reason/s:\n- Related source file contains a call to "TcHmi.Controls.registerEx" or "TcHmi.Controls.register" with name and/or namespace not matching the definition in control description file: "'+cleanPath+'".\n- Related source file is not included in html document.\n- Related source file is not included in required order in html document (would result in console errors).\n- Related source file contains no call to "TcHmi.Controls.registerEx" or "TcHmi.Controls.register".');let modulError={error:TcHmi.Errors.E_CONTROL_INVALID_CONFIGURATION,errorDetails:{code:TcHmi.Errors.E_CONTROL_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INVALID_CONFIGURATION],domain:"TcHmi",reason:'Control type "'+qname+'" is not registered and will therefore not be available.'}};TcHmi.System.Data.Modules.controls.urlMap.set(cleanPath,modulError)}}else if(descr){let name=descr.name,registration=TcHmi.System.Data.Registrations.controls.map.get(name);if(registration&&registration.error===TcHmi.Errors.NONE){if(registration.directory&&registration.template){let cleanTemplatePath=tchmi_path(registration.template),cleanTemplateDirectory=tchmi_path(registration.directory);cleanTemplatePath.includes(cleanTemplateDirectory)&&(descr.template=cleanTemplatePath.replace(cleanTemplateDirectory,""))}let module={error:TcHmi.Errors.NONE,manifestData:packageControl.module,package:packageControl.package,reg:registration,description:descr,descriptionExpanded:{...tchmi_clone_object(descr),inheritationResolved:!1,inheritedTypes:[],inheritedAttributes:[],inheritedAttributesNameMap:new Map,inheritedAttributesPropertyNameMap:new Map,inheritedAttributesPropertyGetterNameMap:new Map,inheritedAttributesPropertySetterNameMap:new Map,inheritedAccess:[],inheritedEvents:[],inheritedFunctions:[],inheritedLanguages:{}}};TcHmi.System.Data.Modules.controls.array.push(module),TcHmi.System.Data.Modules.controls.map.has(name)?(TcHmi.System.Data.Modules.controls.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi",reason:'Ambiguous module definitions for the name: "'+name+'". Please try fully qualified name.'}}),TcHmi.System.Data.Modules.controls.urlMap.delete(cleanPath)):(TcHmi.System.Data.Modules.controls.map.set(name,module),TcHmi.System.Data.Modules.controls.urlMap.set(cleanPath,module)),System.Services.themeManager.registerControlThemeFiles(descr)}else registration?registration.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Registration of control type "'+name+'" is not valid and will therefore not be available. Details: '+TcHmi.Log.buildMessage(registration.errorDetails)):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Control type "'+name+'" is not registered and will therefore not be available.\nPossible reason/s:\n- Related source file contains a call to "TcHmi.Controls.registerEx" or "TcHmi.Controls.register" with name and/or namespace not matching the definition in control description file: "'+cleanPath+'".\n- Related source file is not included in html document.\n- Related source file is not included in required order in html document (would result in console errors).\n- Related source file contains no call to "TcHmi.Controls.registerEx" or "TcHmi.Controls.register".')}else if(!descr)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Failed to load description file of control "'+packageControl.package.name+'". Response contains no valid control description file.'),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Control_Description_Response_Invalid",{level:TcHmi.Locale.Level.Engineering}),packageControl.package.name),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,void(TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()})));PendingCounter.ControlsDescriptionLoaded--,PendingCounter.ControlsDescriptionLoaded<=0&&(descr=null,TcHmi.System.Init.__initStep=13,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()})))})),xhrCtrlDescr.addEventListener("error",xhrCtrlDescrError),xhrCtrlDescr.send()};for(let i=0,ii=packageControls.length;i<ii;i++){loadControLDescription(packageControls[i])}break}TcHmi.System.Init.__initStep=13,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()}));break;case 13:TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.CONTROLS_DESCRIPTION_RESOLVE"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.CONTROLS_DESCRIPTION_RESOLVE")),TcHmi.System.Init.__initStep=1,PendingCounter.ControlsDescriptionResolved=1;try{TcHmi.System.Services.controlManager.resolveDescriptionInheritation()}catch(e){return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(e),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",TcHmi.System.Services.localization.getText("Resolving_Control_Description_Inheritation_Failed",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,void InitStateMachine()}PendingCounter.ControlsDescriptionResolved=0,TcHmi.System.Init.__initStep=14,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()}));break;case 14:{if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.LOCALIZATION_FINAL"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.LOCALIZATION_FINAL")),TcHmi.System.config.languages)for(const[key,languageEntry]of Object.entries(TcHmi.System.config.languages))if(Array.isArray(languageEntry)){const sanitizedLanguageArray=[];for(const subEntry of languageEntry)sanitizedLanguageArray.push(tchmi_path(subEntry));TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Application",key,sanitizedLanguageArray)}else TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Application",key,tchmi_path(languageEntry));if(TcHmi.System.config.languageFallback&&TcHmi.System.Services.localizationManager.setFallbackLocale(TcHmi.System.config.languageFallback),TcHmi.System.Data.Modules.controls.array.forEach((module=>{if(module&&module.descriptionExpanded&&module.descriptionExpanded.languages){if(module.error!==TcHmi.Errors.NONE||!module.reg)return;if(0===module.reg.apiVersion)return;let qname=TcHmi.System.resolveQualifiedName(module.reg.name,module.reg.namespace);for(let key in module.descriptionExpanded.languages){const languageEntry=module.descriptionExpanded.languages[key];if(Array.isArray(languageEntry)){const sanitizedLanguageArray=[];for(const subEntry of languageEntry)sanitizedLanguageArray.push(tchmi_path(TcHmi.Environment.getControlBasePath(qname)+"/"+subEntry));TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Control<"+qname+">",key,sanitizedLanguageArray)}else TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Control<"+qname+">",key,tchmi_path(TcHmi.Environment.getControlBasePath(qname)+"/"+languageEntry))}}})),TcHmi.System.config.languagesForControls)for(const[name,files]of Object.entries(TcHmi.System.config.languagesForControls))for(const[locale,languageEntry]of Object.entries(files))if(Array.isArray(languageEntry)){const sanitizedLanguageArray=[];for(const subEntry of languageEntry)sanitizedLanguageArray.push(tchmi_path(subEntry));TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Control<"+name+">",locale,sanitizedLanguageArray)}else TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Control<"+name+">",locale,tchmi_path(languageEntry));if(TcHmi.System.Data.Modules.functions.array.forEach((module=>{if(module&&module.description&&module.description.languages){if(module.error!==TcHmi.Errors.NONE||!module.reg||!module.package||!module.manifestData)return;let qname=TcHmi.System.resolveQualifiedName(module.reg.name,module.reg.namespace);for(let key in module.description.languages){const languageEntry=module.description.languages[key];if(Array.isArray(languageEntry))for(const subEntry of languageEntry)TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Function<"+qname+">",key,tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+subEntry));else TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Function<"+qname+">",key,tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+languageEntry))}}})),TcHmi.System.config.languagesForFunctions)for(const[name,files]of Object.entries(TcHmi.System.config.languagesForFunctions))for(const[locale,languageEntry]of Object.entries(files))if(Array.isArray(languageEntry))for(const subEntry of languageEntry)TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Function<"+name+">",locale,tchmi_path(subEntry));else TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Function<"+name+">",locale,tchmi_path(languageEntry));const finalize=()=>{TcHmi.System.Init.__initStep=15,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()}))};TCHMI_DESIGNER?TcHmi.System.Services.localizationManager.processLocale("en",{level:TcHmi.Locale.Level.Engineering},(data=>{finalize()})):finalize()}break;case 15:TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.THEME_MANAGER_FINAL"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.THEME_MANAGER_FINAL")),TcHmi.System.Init.__initStep=1,TcHmi.System.Services.themeManager.processActiveTheme(),TcHmi.System.Init.__initStep=16,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()}));break;case 16:{TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.CONTROLS_TEMPLATES_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.CONTROLS_TEMPLATES_LOAD")),TcHmi.System.Init.__initStep=1;let templates=[];if(TcHmi.System.Data.Modules.controls.array.forEach(((module,index)=>{module.descriptionExpanded&&module.descriptionExpanded.inheritedTemplate&&!templates.includes(module.descriptionExpanded.inheritedTemplate)&&templates.push(module.descriptionExpanded.inheritedTemplate)})),PendingCounter.ControlsTemplatesLoaded=templates.length,templates&&templates.length>0){const loadControlTemplate=function(url){let xhrCtrlTempl=new XMLHttpRequest;xhrCtrlTempl.open("GET",url+xhrCacheSuffix);let xhrCtrlTemplError=function(evt){1e4!==TcHmi.System.Init.__initStep&&(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading "+url+" failed! Detail: "+xhrCtrlTempl.statusText),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Loading_File_Failed_With_Error",{level:TcHmi.Locale.Level.Engineering}),url,xhrCtrlTempl.statusText),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,InitStateMachine())};xhrCtrlTempl.addEventListener("load",(function(evt){200===xhrCtrlTempl.status?1e4!==TcHmi.System.Init.__initStep&&(System.Data.Caches.templateMarkupCache.set(url,xhrCtrlTempl.responseText),!TCHMI_DESIGNER&&Init.__fetchFromIndexedDb&&"done"===indexedDbRequest?.readyState&&indexedDbRequest.result?.objectStoreNames?.contains("controlTemplate")&&indexedDbRequest.result.transaction("controlTemplate","readwrite").objectStore("controlTemplate").put(xhrCtrlTempl.responseText,url),PendingCounter.ControlsTemplatesLoaded--,PendingCounter.ControlsTemplatesLoaded<=0&&(initStageInfo.get(initStage).done++,updateSplashScreen(),TcHmi.System.Init.__initStep=17,TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=4,InitStateMachine()):setTimeout((()=>{initStage=4,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})))):xhrCtrlTemplError(evt)})),xhrCtrlTempl.addEventListener("error",xhrCtrlTemplError),xhrCtrlTempl.send()};for(const template of templates)Init.__fetchFromIndexedDb&&TcHmi.System.Data.Caches.templateMarkupCache.has(template)?PendingCounter.ControlsTemplatesLoaded--:loadControlTemplate(template)}PendingCounter.ControlsTemplatesLoaded<=0&&(initStageInfo.get(initStage).done++,TcHmi.System.Init.__initStep=17,TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=4,InitStateMachine()):(updateSplashScreen(),setTimeout((()=>{initStage=4,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))}))))}break;case 17:if("complete"!==document.readyState){document.addEventListener("readystatechange",InitStateMachine,{once:!0});break}if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.PACKAGES_FUNCTION_DESCRIPTION_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.PACKAGES_FUNCTION_DESCRIPTION_LOAD")),TcHmi.System.Init.__initStep=1,packageFunctions&&packageFunctions.length>0){PendingCounter.PackagesFunctionDescriptionLoaded=packageFunctions.length,TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] Loading and processing "+PendingCounter.PackagesFunctionDescriptionLoaded+" package function description files");const loadPackageFunctionDescription=function(packageFunction){if(packageFunction.module.basePath||(packageFunction.module.basePath=""),!packageFunction.module.descriptionFile)return PendingCounter.PackagesFunctionDescriptionLoaded--,PendingCounter.PackagesFunctionDescriptionLoaded<=0?(TcHmi.System.Init.__initStep=18,void(TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()})))):void 0;const cleanPath=tchmi_path(packageFunction.package.basePath+"/"+packageFunction.module.basePath+"/"+packageFunction.module.descriptionFile);let xhrPackageFunctionDescr=new XMLHttpRequest;xhrPackageFunctionDescr.open("GET",cleanPath+xhrCacheSuffix);let xhrPackageFunctionDescrError=function(evt){if(1e4!==TcHmi.System.Init.__initStep)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Failed to load function description: "'+cleanPath+'". Related functions will not be available. Details: Status: '+xhrPackageFunctionDescr.status+", StatusText: "+xhrPackageFunctionDescr.statusText+"."),PendingCounter.PackagesFunctionDescriptionLoaded--,PendingCounter.PackagesFunctionDescriptionLoaded<=0?(TcHmi.System.Init.__initStep=18,void(TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()})))):void 0};xhrPackageFunctionDescr.addEventListener("load",(function(evt){if(200!==xhrPackageFunctionDescr.status)return void xhrPackageFunctionDescrError(evt);if(1e4===TcHmi.System.Init.__initStep)return;let descr=TcHmi.ValueConverter.toObject(xhrPackageFunctionDescr.responseText);if(!descr||!descr.function)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Failed to load function description: "'+cleanPath+'". Related functions will not be available. Response is no valid function JSON: \n'+xhrPackageFunctionDescr.responseText),PendingCounter.PackagesFunctionDescriptionLoaded--,PendingCounter.PackagesFunctionDescriptionLoaded<=0?(TcHmi.System.Init.__initStep=18,void(TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()})))):void 0;let name=descr.function.name,namespace=descr.function.namespace,qname=TcHmi.System.resolveQualifiedName(name,namespace),registration=TcHmi.System.Data.Registrations.functions.map.get(name);if(registration&&registration.error!==TcHmi.Errors.E_NOT_UNIQUE||(registration=TcHmi.System.Data.Registrations.functions.map.get(qname)),registration&&registration.error===TcHmi.Errors.NONE){let module={error:TcHmi.Errors.NONE,manifestData:packageFunction.module,package:packageFunction.package,reg:registration,description:descr};TcHmi.System.Data.Modules.functions.map.has(name)?TcHmi.System.Data.Modules.functions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi",reason:'Ambiguous module definitions for the name: "'+name+'". Please try fully qualified name.'}}):TcHmi.System.Data.Modules.functions.map.set(name,module),qname!==name&&(TcHmi.System.Data.Modules.functions.map.has(qname)?TcHmi.System.Data.Modules.functions.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi",reason:"Multiple module definitions with the name "+qname+" found."}}):TcHmi.System.Data.Modules.functions.map.set(qname,module))}else registration?registration.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Registration of function "'+qname+'" is not valid and function will therefore not be available. Details: '+TcHmi.Log.buildMessage(registration.errorDetails)):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Function "'+qname+'" is not registered and will therefore not be available.\nPossible reason/s:\n- Source file: "'+cleanPath.replace(".function.json",".js")+'" contains a call to "TcHmi.Functions.registerFunctionEx" or "TcHmi.Functions.registerFunction" with name and/or namespace not matching the definition in function description file: "'+cleanPath+'".\n- Source file: "'+cleanPath.replace(".function.json",".js")+'" is not included in html document.\n- Source file: "'+cleanPath.replace(".function.json",".js")+'" contains no call to "TcHmi.Functions.registerFunctionEx" or "TcHmi.Functions.registerFunction".');return PendingCounter.PackagesFunctionDescriptionLoaded--,PendingCounter.PackagesFunctionDescriptionLoaded<=0?(TcHmi.System.Init.__initStep=18,void(TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()})))):void 0})),xhrPackageFunctionDescr.addEventListener("error",xhrPackageFunctionDescrError),xhrPackageFunctionDescr.send()};for(let i=0,ii=packageFunctions.length;i<ii;i++)loadPackageFunctionDescription(packageFunctions[i]);break}TcHmi.System.Init.__initStep=18,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()}));break;case 18:if("complete"!==document.readyState){document.addEventListener("readystatechange",InitStateMachine,{once:!0});break}if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.USER_FUNCTION_DESCRIPTION_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.USER_FUNCTION_DESCRIPTION_LOAD")),TcHmi.System.Init.__initStep=1,PendingCounter.UserFunctionDescriptionLoaded=userFunctions.length,userFunctions&&userFunctions.length>0){const loadUserFunctionDescription=function(url){const cleanPath=tchmi_path(url);let xhrUserFunctionDescr=new XMLHttpRequest;xhrUserFunctionDescr.open("GET",url+xhrCacheSuffix);let xhrUserFunctionDescrError=function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Failed to load function description: "'+cleanPath+'". Related functions will not be available. Details: Status: '+xhrUserFunctionDescr.status+", StatusText: "+xhrUserFunctionDescr.statusText+"."),PendingCounter.UserFunctionDescriptionLoaded--,PendingCounter.UserFunctionDescriptionLoaded<=0&&(TcHmi.System.Init.__initStep=20,TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=5,InitStateMachine()):(initStageInfo.get(initStage).done++,updateSplashScreen(),setTimeout((()=>{initStage=5,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))}))))};xhrUserFunctionDescr.addEventListener("load",(function(evt){if(200!==xhrUserFunctionDescr.status)return void xhrUserFunctionDescrError(evt);let descr=TcHmi.ValueConverter.toObject(xhrUserFunctionDescr.responseText);if(!descr||!descr.function)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Failed to load function description: "'+cleanPath+'". Related functions will not be available. Response is no valid function JSON: \n'+xhrUserFunctionDescr.responseText),PendingCounter.UserFunctionDescriptionLoaded--,PendingCounter.UserFunctionDescriptionLoaded<=0?(TcHmi.System.Init.__initStep=20,void(TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{InitStateMachine()})))):void 0;let name=descr.function.name,namespace=descr.function.namespace,qname=TcHmi.System.resolveQualifiedName(name,namespace),registration=TcHmi.System.Data.Registrations.functions.map.get(name);if(registration&&registration.error!==TcHmi.Errors.E_NOT_UNIQUE||(registration=TcHmi.System.Data.Registrations.functions.map.get(qname)),registration&&registration.error===TcHmi.Errors.NONE){let module={error:TcHmi.Errors.NONE,reg:registration,description:descr};TcHmi.System.Data.Modules.functions.map.has(name)?TcHmi.System.Data.Modules.functions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi",reason:'Ambiguous module definitions for the name: "'+name+'". Please try fully qualified name.'}}):TcHmi.System.Data.Modules.functions.map.set(name,module),qname!==name&&(TcHmi.System.Data.Modules.functions.map.has(qname)?TcHmi.System.Data.Modules.functions.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi",reason:"Multiple module definitions with the name "+qname+" found."}}):TcHmi.System.Data.Modules.functions.map.set(qname,module))}else registration?registration.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Registration of function "'+qname+'" is not valid and function will therefore not be available. Details: '+TcHmi.Log.buildMessage(registration.errorDetails)):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Function "'+qname+'" is not registered and will therefore not be available.\nPossible reason/s:\n- Source file: "'+cleanPath.replace(".function.json",".js")+'" contains a call to "TcHmi.Functions.registerFunctionEx", "TcHmi.Functions.registerFunction" (deprecated) or "TcHmi.Functions.registerFrameworkFunction" (deprecated) with name and/or namespace not matching the definition in function description file: "'+url+'".\n- Source file: "'+cleanPath.replace(".function.json",".js")+'" contains no call to "TcHmi.Functions.registerFunctionEx", "TcHmi.Functions.registerFunction" (deprecated) or "TcHmi.Functions.registerFrameworkFunction" (deprecated).\n- Source file: "'+cleanPath.replace(".function.json",".js")+'" is not included in html document.\n');PendingCounter.UserFunctionDescriptionLoaded--,PendingCounter.UserFunctionDescriptionLoaded<=0&&(TcHmi.System.Init.__initStep=20,TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=5,InitStateMachine()):(initStageInfo.get(initStage).done++,updateSplashScreen(),setTimeout((()=>{initStage=5,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))}))))})),xhrUserFunctionDescr.addEventListener("error",xhrUserFunctionDescrError),xhrUserFunctionDescr.send()};for(const userFunction of userFunctions)if(userFunction.url.endsWith(".js")){loadUserFunctionDescription(userFunction.url.replace(".js",".function.json"))}else TcHmi.Log.errorEx('[Source=Framework, Module=TcHmi] Configuration file: "Properties/tchmiconfig.json" is not valid. userFunctions includes a wrong formed entry. url must end with ".js". Reference will be skipped. Entry: ',userFunction),PendingCounter.UserFunctionDescriptionLoaded--}PendingCounter.UserFunctionDescriptionLoaded<=0&&(TcHmi.System.Init.__initStep=20,TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=5,InitStateMachine()):(initStageInfo.get(initStage).done++,updateSplashScreen(),setTimeout((()=>{initStage=5,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))}))));break;case 20:{const unresolvedControlRegistrations=TcHmi.System.Data.Registrations.controls.array.filter((registeredControl=>!!registeredControl.name&&!TcHmi.System.Services.controlManager.getDescription(TcHmi.System.resolveQualifiedName(registeredControl.name,registeredControl.namespace)))),controlsWithoutMetadataNameList=[];for(const registration of unresolvedControlRegistrations)registration.name&&controlsWithoutMetadataNameList.push(TcHmi.System.resolveQualifiedName(registration.name,registration.namespace));controlsWithoutMetadataNameList.length&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Missing metadata for controls: "+controlsWithoutMetadataNameList.join(", ")+". Control types will not be available. Possible reasons could be: Missing entry in tchmiconfig.json#packages, incomplete Manifest.json or missing/invalid Description.json");const unresolvedFunctionRegistrations=TcHmi.System.Data.Registrations.functions.array.filter((registeredFunction=>!!registeredFunction.name&&!TcHmi.System.Data.Modules.functions.map.has(TcHmi.System.resolveQualifiedName(registeredFunction.name,registeredFunction.namespace)))),functionsWithoutMetadataNameList=[];for(const registration of unresolvedFunctionRegistrations)registration.name&&functionsWithoutMetadataNameList.push(TcHmi.System.resolveQualifiedName(registration.name,registration.namespace));functionsWithoutMetadataNameList.length&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Missing metadata for functions: "+functionsWithoutMetadataNameList.join(", ")+". Functions will not be available. Possible reasons could be: Missing entry in tchmiconfig.json#userFunctions, incomplete Manifest.json or missing/invalid *.function.json"),TcHmi.System.Init.__initStep=21}case 21:TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.OPEN_SERVER_CONNECTION"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.OPEN_SERVER_CONNECTION")),TcHmi.System.Init.__initStep=1,PendingCounter.OpenServerConnection=1,TcHmi.System.Services.serverManager.open((resultObject=>{if(0===PendingCounter.OpenServerConnection)return;if(PendingCounter.OpenServerConnection=0,1e4===TcHmi.System.Init.__initStep)return;let finalized=!1;const finalize=()=>{finalized||(finalized=!0,initStageInfo.get(initStage).done++,updateSplashScreen(),resultObject.error===TcHmi.Errors.NONE?(TcHmi.System.Init.__initStep=19,InitStateMachine()):(resultObject.error===TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_CHECK_FAILED?(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Failed to check server license: "+TcHmi.Log.buildMessage(resultObject.details)),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Server_License_Check_Failed failed",{level:TcHmi.Locale.Level.Engineering})+"<br/>\n"+TcHmi.DialogManager.buildMessage(resultObject.details)+'<br/>\n<input type="submit" value="'+TcHmi.System.Services.localization.getText("Reload",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;" onclick="window.location.reload()">',{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER})):resultObject.error===TcHmi.Errors.E_SERVER_COMMAND_ERROR?(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Server license symbol invalid: "+TcHmi.Log.buildMessage(resultObject.details)),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Server_Command_Error",{level:TcHmi.Locale.Level.Engineering})+"<br/>\n"+TcHmi.DialogManager.buildMessage(resultObject.details),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER})):resultObject.error===TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING?(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Server license is missing: "+TcHmi.Log.buildMessage(resultObject.details)),TCHMI_DESIGNER?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("License_Missing",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Reopen_Editor_Window",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER})):(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("License_Missing",{level:TcHmi.Locale.Level.Engineering})+"<br/>\n"+TcHmi.DialogManager.buildMessage(resultObject.details),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}))):resultObject.error===TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_NO_ACCESS?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Server_Denied_Access",{level:TcHmi.Locale.Level.Engineering})+" "+tchmi_format_string(TcHmi.System.Services.localization.getText("Reload_In_N_Seconds",{level:TcHmi.Locale.Level.Engineering}),"5")+"<br/>\n"+TcHmi.DialogManager.buildMessage(resultObject.details),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),window.setTimeout((function(){window.location.reload()}),5e3)):TCHMI_DESIGNER?(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Opening connection to server engineering server failed: "+TcHmi.Log.buildMessage(resultObject.details)),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Engineering_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Please_Start_Engineering_Server",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER})):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Opening connection to server failed: "+TcHmi.Log.buildMessage(resultObject.details)),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+"<br />\n"+TcHmi.System.Services.localization.getText("Possible_Reasons",{level:TcHmi.Locale.Level.Engineering})+":<br />\n- "+TcHmi.System.Services.localization.getText("Possibly_Reason_Server_Websocket_Certificate_Not_Trusted",{level:TcHmi.Locale.Level.Engineering})+"<br />\n- "+tchmi_format_string(TcHmi.System.Services.localization.getText("Possibly_Reason_Url_Targets_No_Running_Websocket_Server",{level:TcHmi.Locale.Level.Engineering}),resultObject.url)+"<br />\n- "+TcHmi.System.Services.localization.getText("Possibly_Reason_Proxy_Problem",{level:TcHmi.Locale.Level.Engineering})+"<br />\n<br />\n"+TcHmi.System.Services.localization.getText("Browser_Console_Could_Have_More_Information",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER})),TcHmi.System.Init.__initStep=1e4,InitStateMachine()))};if(TcHmi.System.Services.accessManager.isReady()||resultObject.error!==TcHmi.Errors.NONE)finalize();else{let timeoutId=0,destroy=TcHmi.EventProvider.register("System.onAccessManagerReady",((e,data)=>{clearTimeout(timeoutId),e.destroy(),destroy=null,finalize()}));timeoutId=setTimeout((()=>{destroy&&(destroy(),destroy=null),finalize()}),5e3)}}));break;case 19:if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.OPEN_ENGINEERING_CONNECTION"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.OPEN_ENGINEERING_CONNECTION")),!TCHMI_ENGINEERING)return TcHmi.System.Init.__initStep=22,initStage=7,updateSplashScreen(),void setTimeout((()=>{InitStateMachine()}));TcHmi.System.Init.__initStep=1,PendingCounter.OpenEngineeringConnection=1,TcHmi.System.Services.Engineering.designerModeComManager.open((resultObject=>{0!==PendingCounter.OpenEngineeringConnection&&1e4!==TcHmi.System.Init.__initStep&&(resultObject.error===TcHmi.Errors.NONE?(PendingCounter.OpenEngineeringConnection=0,TcHmi.System.Init.__initStep=22,initStage=7,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))}))):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Communication to TwinCAT HMI Creator failed: "+TcHmi.Log.buildMessage(resultObject.details)),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TCHMI_DESIGNER?TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Engineering_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.DialogManager.buildMessage(resultObject.details)+"<br/>\n"+TcHmi.System.Services.localization.getText("Try_Reopen_Designer_Window",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}):TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Engineering_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.DialogManager.buildMessage(resultObject.details),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),PendingCounter.OpenEngineeringConnection=0,TcHmi.System.Init.__initStep=1e4,InitStateMachine()))}));break;case 22:TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.TYPEDEFINITIONS"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.TYPEDEFINITIONS")),TcHmi.System.Init.__initStep=1,PendingCounter.TypeDefinitionsResolved=1,System.Services.typeManager.doWatchSchemaDefinitions((function(data){data.error===TcHmi.Errors.NONE?(PendingCounter.TypeDefinitionsResolved=0,TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi] Resolving type definitions finished."),TcHmi.System.Init.__initStep=23):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Resolving type definitions failed: "+TcHmi.Log.buildMessage(data.details)),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",TcHmi.System.Services.localization.getText("Resolving_Type_Definition_Failed",{level:TcHmi.Locale.Level.Engineering})+": "+TcHmi.Log.buildMessage(data.details),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4),InitStateMachine()}));break;case 23:TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.SERVER_SYMBOL_SCHEMA_CACHE"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.SERVER_SYMBOL_SCHEMA_CACHE")),TcHmi.System.Init.__initStep=1,PendingCounter.ServerSymbolSchemaCacheResolved=1,System.Symbol.resolveServerSymbolSchemaCache((function(data){if(initStageInfo.get(initStage).done++,updateSplashScreen(),data.error===TcHmi.Errors.NONE){PendingCounter.ServerSymbolSchemaCacheResolved=0;for(const[key,item]of Object.entries(tchmi_clone_object(TcHmi.System.config.symbols.internal)))TcHmi.System.Services.internalSymbolManager.add(key,item);TcHmi.System.Init.__initStep=24,TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=6,InitStateMachine()):setTimeout((()=>{initStage=6,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))}))}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Resolving server symbol schema cache failed: "+TcHmi.Log.buildMessage(data.details)),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",TcHmi.System.Services.localization.getText("Resolving_Server_Symbol_Schema_Cache_Failed",{level:TcHmi.Locale.Level.Engineering})+": "+TcHmi.Log.buildMessage(data.details),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,InitStateMachine()}));break;case 24:TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.VALIDATION"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.VALIDATION")),TcHmi.System.Data.Modules.controls.array.forEach((module=>{module.description?.attributes.forEach((attribute=>{const res=TcHmi.System.Services.typeManager.getSchemaEx(attribute.type);res.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Attribute "+attribute.propertyName+" of control "+System.resolveQualifiedName(module.description.name,module.description?.namespace)+" uses invalid data type "+attribute.type+": "+TcHmi.Log.buildMessage(res.details))}))})),TcHmi.System.Data.Modules.functions.array.forEach((module=>{let qname=TcHmi.System.resolveQualifiedName(module.description.function.name,module.description?.function.namespace);if(module.description?.function.returnValue?.type){const res=TcHmi.System.Services.typeManager.getSchemaEx(module.description.function.returnValue.type);res.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] ReturnValue of function "+qname+" uses invalid data type "+module.description?.function.returnValue.type+": "+TcHmi.Log.buildMessage(res.details))}module.description?.function.arguments&&module.description.function.arguments.forEach(((argument,index)=>{const res=TcHmi.System.Services.typeManager.getSchemaEx(argument.type);res.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Argument#"+index+" "+argument.name+" of function "+qname+" uses invalid data type "+argument.type+": "+TcHmi.Log.buildMessage(res.details))}))})),TcHmi.System.Init.__initStep=25,initStage=8,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():(updateSplashScreen(),setTimeout((()=>{InitStateMachine()})));break;case 25:if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.USERCONTROL_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.USERCONTROL_LOAD")),TcHmi.System.Init.__initStep=1,userControlPartials&&userControlPartials.length>0){PendingCounter.UserControlsLoaded=2*userControlPartials.length;const loadUserControlMarkup=function(url){if(TCHMI_ENGINEERING)TcHmi.System.Services.Engineering.designerModeManager.partialContentManager.requestCurrentPartialContent(url,(data=>{if(data.error===TcHmi.Errors.NONE){if(1e4===TcHmi.System.Init.__initStep)return;System.Data.Caches.partialMarkupCache.set(url,{markup:data.content}),initStageInfo.get(initStage).done++,PendingCounter.UserControlsLoaded--,updateSplashScreen(),PendingCounter.UserControlsLoaded<=0&&(TcHmi.System.Services.controlManager.resolveUcAttributes(),TcHmi.System.Services.themeManager.retriggerUserControls(),TcHmi.System.Init.__initStep=26,TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=9,InitStateMachine()):setTimeout((()=>{initStage=9,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})))}else{if(1e4===TcHmi.System.Init.__initStep)return;TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading "+url+" failed. Errordetail: "+TcHmi.Log.buildMessage(data.details)),url===TCHMI_TARGET_PARTIAL?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Loading_File_Failed",{level:TcHmi.Locale.Level.Engineering}),url),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,InitStateMachine()):(initStageInfo.get(initStage).done++,PendingCounter.UserControlsLoaded--,PendingCounter.UserControlsLoaded<=0&&(TcHmi.System.Services.controlManager.resolveUcAttributes(),TcHmi.System.Services.themeManager.retriggerUserControls(),TcHmi.System.Init.__initStep=26,TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=9,InitStateMachine()):setTimeout((()=>{initStage=9,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))}))))}}));else{let xhrUserControl=new XMLHttpRequest;xhrUserControl.open("GET",url+xhrCacheSuffix);let xhrUserControlSuccess=function(evt){200===xhrUserControl.status?1e4!==TcHmi.System.Init.__initStep&&(System.Data.Caches.partialMarkupCache.set(url,{markup:xhrUserControl.responseText}),!TCHMI_DESIGNER&&Init.__fetchFromIndexedDb&&"done"===indexedDbRequest?.readyState&&indexedDbRequest.result?.objectStoreNames?.contains("userControlMarkup")&&indexedDbRequest.result.transaction("userControlMarkup","readwrite").objectStore("userControlMarkup").put(xhrUserControl.responseText,url),initStageInfo.get(initStage).done++,PendingCounter.UserControlsLoaded--,updateSplashScreen(),PendingCounter.UserControlsLoaded<=0&&(TcHmi.System.Services.controlManager.resolveUcAttributes(),TcHmi.System.Services.themeManager.retriggerUserControls(),TcHmi.System.Init.__initStep=26,TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=9,InitStateMachine()):setTimeout((()=>{initStage=9,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})))):xhrUserControlError(evt)},xhrUserControlError=function(evt){1e4!==TcHmi.System.Init.__initStep&&(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading "+url+" failed. Errordetail: "+xhrUserControl.statusText),url===TCHMI_TARGET_PARTIAL?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Loading_File_Failed",{level:TcHmi.Locale.Level.Engineering}),url)+" "+TcHmi.System.Services.localization.getText("Propably_Syntax_Error_Html_Or_Wrong_Entry_Config",{level:TcHmi.Locale.Level.Engineering})+" "+tchmi_format_string(TcHmi.System.Services.localization.getText("Details_Placeholder",{level:TcHmi.Locale.Level.Engineering}),xhrUserControl.statusText),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,InitStateMachine()):(PendingCounter.UserControlsLoaded--,initStageInfo.get(initStage).done++,updateSplashScreen(),PendingCounter.UserControlsLoaded<=0&&(TcHmi.System.Services.controlManager.resolveUcAttributes(),TcHmi.System.Services.themeManager.retriggerUserControls(),TcHmi.System.Init.__initStep=26,TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=9,InitStateMachine()):setTimeout((()=>{initStage=9,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})))))};xhrUserControl.addEventListener("load",xhrUserControlSuccess),xhrUserControl.addEventListener("error",xhrUserControlError),xhrUserControl.send()}},loadUserControlConfig=function(url){let xhrUserControlDescr=new XMLHttpRequest;xhrUserControlDescr.open("GET",url+xhrCacheSuffix);let xhrUserControlDescrError=function(evt){PendingCounter.UserControlsLoaded--,PendingCounter.UserControlsLoaded<=0&&(TcHmi.System.Services.controlManager.resolveUcAttributes(),TcHmi.System.Services.themeManager.retriggerUserControls(),TcHmi.System.Init.__initStep=26,initStage=9,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})))};xhrUserControlDescr.addEventListener("load",(function(evt){if(200!==xhrUserControlDescr.status)return void xhrUserControlDescrError(evt);let ucConfig=TcHmi.ValueConverter.toObject(xhrUserControlDescr.responseText);ucConfig?(TcHmi.System.Data.Caches.partialCompositeConfigCache.set(url,ucConfig),!TCHMI_DESIGNER&&Init.__fetchFromIndexedDb&&"done"===indexedDbRequest?.readyState&&indexedDbRequest.result?.objectStoreNames?.contains("userControlConfig")&&indexedDbRequest.result.transaction("userControlConfig","readwrite").objectStore("userControlConfig").put(ucConfig,url)):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi] Failed to load user control config: "'+url+'". Response is no valid user control JSON: \n'+xhrUserControlDescr.responseText),PendingCounter.UserControlsLoaded--,initStageInfo.get(initStage).done++,updateSplashScreen(),PendingCounter.UserControlsLoaded<=0&&(TcHmi.System.Services.controlManager.resolveUcAttributes(),TcHmi.System.Services.themeManager.retriggerUserControls(),TcHmi.System.Init.__initStep=26,initStage=9,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})))})),xhrUserControlDescr.addEventListener("error",xhrUserControlDescrError),xhrUserControlDescr.send()};for(const usercControlPartial of userControlPartials){if(Init.__fetchFromIndexedDb&&TcHmi.System.Data.Caches.partialMarkupCache.has(usercControlPartial.url)?(PendingCounter.UserControlsLoaded--,initStageInfo.get(initStage).done++):loadUserControlMarkup(usercControlPartial.url),!usercControlPartial.url.endsWith(".usercontrol")){TcHmi.Log.errorEx('[Source=Framework, Module=TcHmi] Configuration file: "Properties/tchmiconfig.json" is not valid. userControls includes a wrong formed entry. url must end with ".js". Reference will be skipped. Entry: ',usercControlPartial),PendingCounter.UserControlsLoaded--,initStageInfo.get(initStage).done++;continue}let configurl=usercControlPartial.url.replace(".usercontrol",".usercontrol.json");Init.__fetchFromIndexedDb&&TcHmi.System.Data.Caches.partialCompositeConfigCache.has(configurl)?(PendingCounter.UserControlsLoaded--,initStageInfo.get(initStage).done++):loadUserControlConfig(configurl)}PendingCounter.UserControlsLoaded<=0&&(TcHmi.System.Services.controlManager.resolveUcAttributes(),TcHmi.System.Services.themeManager.retriggerUserControls(),TcHmi.System.Init.__initStep=26,initStage=9,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})))}else TcHmi.System.Init.__initStep=26,TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=9,InitStateMachine()):(updateSplashScreen(),setTimeout((()=>{initStage=9,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})));break;case 26:if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.CONTENT_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.CONTENT_LOAD")),TcHmi.System.Init.__initStep=1,PendingCounter.ContentLoaded=contentPartials.length,contentPartials&&contentPartials.length>0){const loadContent=function(url){if(TCHMI_ENGINEERING)TcHmi.System.Services.Engineering.designerModeManager.partialContentManager.requestCurrentPartialContent(url,(data=>{if(data.error===TcHmi.Errors.NONE){if(1e4===TcHmi.System.Init.__initStep)return;System.Data.Caches.partialMarkupCache.set(url,{markup:data.content}),initStageInfo.get(initStage).done++,PendingCounter.ContentLoaded--,updateSplashScreen(),PendingCounter.ContentLoaded<=0&&(TcHmi.System.Init.__initStep=27,initStage=10,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})))}else{if(1e4===TcHmi.System.Init.__initStep)return;TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading "+url+" failed. Errordetail: "+TcHmi.Log.buildMessage(data.details)),url===TCHMI_TARGET_PARTIAL?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Loading_File_Failed",{level:TcHmi.Locale.Level.Engineering}),url),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,InitStateMachine()):(PendingCounter.ContentLoaded--,PendingCounter.ContentLoaded<=0&&(TcHmi.System.Init.__initStep=27,initStage=10,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))}))))}}));else{let xhrContent=new XMLHttpRequest;xhrContent.open("GET",url+xhrCacheSuffix);let xhrContentSuccess=function(evt){200===xhrContent.status?1e4!==TcHmi.System.Init.__initStep&&(System.Data.Caches.partialMarkupCache.set(url,{markup:xhrContent.responseText}),!TCHMI_DESIGNER&&Init.__fetchFromIndexedDb&&"done"===indexedDbRequest?.readyState&&indexedDbRequest.result?.objectStoreNames?.contains("contentMarkup")&&indexedDbRequest.result.transaction("contentMarkup","readwrite").objectStore("contentMarkup").put(xhrContent.responseText,url),initStageInfo.get(initStage).done++,PendingCounter.ContentLoaded--,updateSplashScreen(),PendingCounter.ContentLoaded<=0&&(TcHmi.System.Init.__initStep=27,initStage=10,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})))):xhrContentError(evt)},xhrContentError=function(evt){1e4!==TcHmi.System.Init.__initStep&&(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading "+url+" failed. Errordetail: "+xhrContent.statusText),url===TCHMI_TARGET_PARTIAL?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Loading_File_Failed",{level:TcHmi.Locale.Level.Engineering}),url)+" "+TcHmi.System.Services.localization.getText("Propably_Syntax_Error_Html_Or_Wrong_Entry_Config",{level:TcHmi.Locale.Level.Engineering})+" "+tchmi_format_string(TcHmi.System.Services.localization.getText("Details_Placeholder",{level:TcHmi.Locale.Level.Engineering}),xhrContent.statusText),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,InitStateMachine()):(PendingCounter.ContentLoaded--,PendingCounter.ContentLoaded<=0&&(TcHmi.System.Init.__initStep=27,initStage=10,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})))))};xhrContent.addEventListener("load",xhrContentSuccess),xhrContent.addEventListener("error",xhrContentError),xhrContent.send()}};for(const contentPartial of contentPartials)!0!==contentPartial.preload||TCHMI_DESIGNER||TCHMI_ENGINEERING&&contentPartial.url===TCHMI_TARGET_PARTIAL?(!TCHMI_DESIGNER&&!0===contentPartial.preload&&TCHMI_ENGINEERING&&contentPartial.url===TCHMI_TARGET_PARTIAL&&(initStageInfo.get(initStage).done++,updateSplashScreen()),PendingCounter.ContentLoaded--):Init.__fetchFromIndexedDb&&System.Data.Caches.partialMarkupCache.has(contentPartial.url)?(initStageInfo.get(initStage).done++,PendingCounter.ContentLoaded--):loadContent(contentPartial.url)}PendingCounter.ContentLoaded<=0&&(TcHmi.System.Init.__initStep=27,TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=10,InitStateMachine()):(updateSplashScreen(),setTimeout((()=>{initStage=10,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))}))));break;case 27:if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.VIEW_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.VIEW_LOAD")),TcHmi.System.Init.__initStep=1,PendingCounter.ViewLoaded=viewPartials.length,viewPartials&&viewPartials.length>0){const loadView=function(url){if(TCHMI_ENGINEERING)TcHmi.System.Services.Engineering.designerModeManager.partialContentManager.requestCurrentPartialContent(url,(data=>{if(data.error===TcHmi.Errors.NONE){if(1e4===TcHmi.System.Init.__initStep)return;System.Data.Caches.partialMarkupCache.set(url,{markup:data.content}),initStageInfo.get(initStage).done++,PendingCounter.ViewLoaded--,updateSplashScreen(),PendingCounter.ViewLoaded<=0&&(TcHmi.System.Init.__initStep=28,initStage=11,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})))}else{if(1e4===TcHmi.System.Init.__initStep)return;TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading "+url+" failed. Errordetail: "+TcHmi.Log.buildMessage(data.details)),url===TCHMI_TARGET_PARTIAL?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Loading_File_Failed",{level:TcHmi.Locale.Level.Engineering}),url),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,InitStateMachine()):(PendingCounter.ViewLoaded--,PendingCounter.ViewLoaded<=0&&(TcHmi.System.Init.__initStep=28,initStage=11,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))}))))}}));else{let xhrView=new XMLHttpRequest;xhrView.open("GET",url+xhrCacheSuffix);let xhrViewSuccess=function(evt){200===xhrView.status?1e4!==TcHmi.System.Init.__initStep&&(System.Data.Caches.partialMarkupCache.set(url,{markup:xhrView.responseText}),initStageInfo.get(initStage).done++,PendingCounter.ViewLoaded--,updateSplashScreen(),PendingCounter.ViewLoaded<=0&&(TcHmi.System.Init.__initStep=28,initStage=11,TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})))):xhrViewError(evt)},xhrViewError=function(evt){if(1e4!==TcHmi.System.Init.__initStep)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading "+url+" failed. Errordetail: "+xhrView.statusText),url===TCHMI_TARGET_PARTIAL?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Loading_File_Failed",{level:TcHmi.Locale.Level.Engineering}),url)+" "+TcHmi.System.Services.localization.getText("Propably_Syntax_Error_Html_Or_Wrong_Entry_Config",{level:TcHmi.Locale.Level.Engineering})+" "+tchmi_format_string(TcHmi.System.Services.localization.getText("Details_Placeholder",{level:TcHmi.Locale.Level.Engineering}),xhrView.statusText),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,void InitStateMachine()):(PendingCounter.ViewLoaded--,PendingCounter.ViewLoaded<=0?(TcHmi.System.Init.__initStep=28,initStage=11,void(TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})))):void 0)};xhrView.addEventListener("load",xhrViewSuccess),xhrView.addEventListener("error",xhrViewError),xhrView.send()}};for(const viewPartial of viewPartials)!0!==viewPartial.preload||TCHMI_DESIGNER||TCHMI_ENGINEERING&&viewPartial.url===TCHMI_TARGET_PARTIAL?(!TCHMI_DESIGNER&&TCHMI_ENGINEERING&&!0===viewPartial.preload&&viewPartial.url===TCHMI_TARGET_PARTIAL&&(initStageInfo.get(initStage).done++,updateSplashScreen()),PendingCounter.ViewLoaded--):loadView(viewPartial.url)}PendingCounter.ViewLoaded<=0&&(TcHmi.System.Init.__initStep=28,TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=11,InitStateMachine()):(updateSplashScreen(),setTimeout((()=>{initStage=11,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))}))));break;case 28:if("complete"!==document.readyState){document.addEventListener("readystatechange",InitStateMachine,{once:!0});break}TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.CONTENT_COMPILE"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.CONTENT_COMPILE")),TcHmi.System.Init.__initStep=1;for(let contentPartial of contentPartials)!0!==contentPartial.preload||TCHMI_DESIGNER||TCHMI_ENGINEERING&&contentPartial.url===TCHMI_TARGET_PARTIAL?(!TCHMI_DESIGNER&&!0===contentPartial.preload&&TCHMI_ENGINEERING&&contentPartial.url===TCHMI_TARGET_PARTIAL&&(initStageInfo.get(initStage).done++,updateSplashScreen()),PendingCounter.ContentCompiled--):function(contentPartial){setTimeout((()=>{const cleanPath=contentPartial.url;let htmlFiltered=System.Data.Caches.partialMarkupCache.get(cleanPath);if(htmlFiltered){let tempDiv=document.createElement("div");tempDiv.innerHTML=htmlFiltered.markup;let tempContentPartial=tempDiv.firstElementChild;if(tempContentPartial){tempContentPartial.remove(),htmlFiltered.partialId=tempContentPartial.id,tempContentPartial.setAttribute("data-tchmi-partial-url",cleanPath);let contentControl=TcHmi.System.Services.controlManager.compile(tempContentPartial);void 0!==contentControl&&contentControl.__setKeepAlive(!0)}}if(PendingCounter.ContentCompiled--,initStageInfo.get(initStage).done++,updateSplashScreen(),PendingCounter.ContentCompiled<=0)return TcHmi.System.Init.__initStep=29,initStage=12,void(TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})))}))}(contentPartial);if(PendingCounter.ContentCompiled<=0)return TcHmi.System.Init.__initStep=29,void(TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=12,InitStateMachine()):(updateSplashScreen(),setTimeout((()=>{initStage=12,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))}))));break;case 29:if("complete"!==document.readyState){document.addEventListener("readystatechange",InitStateMachine,{once:!0});break}TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.VIEW_COMPILE"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.VIEW_COMPILE")),TcHmi.System.Init.__initStep=1;for(let viewPartial of viewPartials)!0!==viewPartial.preload||TCHMI_DESIGNER||TCHMI_ENGINEERING&&viewPartial.url===TCHMI_TARGET_PARTIAL?(!TCHMI_DESIGNER&&!0===viewPartial.preload&&TCHMI_ENGINEERING&&!0===viewPartial.preload&&viewPartial.url===TCHMI_TARGET_PARTIAL&&(initStageInfo.get(initStage).done++,updateSplashScreen()),PendingCounter.ViewCompiled--):function(viewPartial){setTimeout((()=>{const cleanPath=viewPartial.url;let htmlFiltered=System.Data.Caches.partialMarkupCache.get(cleanPath);if(htmlFiltered){let tempDiv=document.createElement("div");tempDiv.innerHTML=htmlFiltered.markup;let tempViewPartial=tempDiv.firstElementChild;if(tempViewPartial){tempViewPartial.remove(),tempViewPartial.setAttribute("data-tchmi-partial-url",cleanPath),htmlFiltered.partialId=tempViewPartial.id;let viewControl=TcHmi.System.Services.controlManager.compile(tempViewPartial);void 0!==viewControl&&viewControl.__setKeepAlive(!0),htmlFiltered=void 0}}if(PendingCounter.ViewCompiled--,initStageInfo.get(initStage).done++,updateSplashScreen(),PendingCounter.ViewCompiled<=0)return TcHmi.System.Init.__initStep=30,initStage=14,void(TCHMI_DESIGNER||"hidden"===document.visibilityState?InitStateMachine():setTimeout((()=>{updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})))}))}(viewPartial);if(PendingCounter.ViewCompiled<=0)return TcHmi.System.Init.__initStep=30,void(TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=13,InitStateMachine()):(updateSplashScreen(),setTimeout((()=>{initStage=13,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))}))));break;case 30:{const done=()=>{TcHmi.System.isPreloaded=!0,TcHmi.System.Init.__initStep=1e3,TCHMI_DESIGNER||"hidden"===document.visibilityState?(initStage=14,InitStateMachine()):(updateSplashScreen(),setTimeout((()=>{initStage=14,updateSplashScreen(),setTimeout((()=>{InitStateMachine()}))})))};let preloadingBindings=TcHmi.System.Services.bindingManager.getPreloadingBindings();if(0===preloadingBindings.size)done();else{let preloadingBindingsSizeStart=preloadingBindings.size;initStageInfo.get(13).toDo=preloadingBindingsSizeStart,preloadingBindings.forEach((binding=>{binding.__resume(!0)})),TcHmi.System.Services.bindingManager.watchPreloadingBindings((data=>{initStageInfo.get(13).done=preloadingBindingsSizeStart-data.result.size,updateSplashScreen(),0===data.result.size&&(data.destroy?.(),done())}))}}break;case 1e3:{let vurl;if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.FINAL"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.FINAL")),TcHmi.System.Init.__initStep=1,TcHmi.System.destroyGlobalTrigger=TcHmi.System.Services.triggerManager.register(tchmi_clone_object(TcHmi.System.config.trigger)),TCHMI_DESIGNER)vurl=tchmi_path(TCHMI_TARGET_PARTIAL);else{const cfgvurl=TcHmi.System.config.startupView;if(!cfgvurl)return TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",TcHmi.System.Services.localization.getText("Startup_View_Not_Defined_Please_Configure",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();let bValid=!1;const cleanStartupPath=tchmi_path(cfgvurl);for(const viewPartial of viewPartials)if(tchmi_path(viewPartial.url)===cleanStartupPath){bValid=!0;break}if(!bValid)return TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",TcHmi.System.Services.localization.getText("Unable_To_Find_View_Definition_Matching_Startup_View_Definition",{level:TcHmi.Locale.Level.Engineering}),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();vurl=cfgvurl}TcHmi.System.Services.viewManager.setScaleMode(TcHmi.System.config.scaleMode),TcHmi.System.Services.viewManager.loadView(vurl,(function(data){if(initStageInfo.get(initStage).done++,updateSplashScreen(),data.error!==TcHmi.Errors.NONE)return TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateTextEx("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Loading_File_Failed",{level:TcHmi.Locale.Level.Engineering}),vurl),{severity:TcHmi.DialogManager.DialogSeverity.Error,buttonReload:!TCHMI_DESIGNER}),TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("Failed to load "+vurl+": "+TcHmi.Log.buildMessage(data.details)),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();"done"!==indexedDbRequest?.readyState||indexedDbRequest.error||indexedDbRequest.result.close(),TcHmi.System.isInitialized=!0,TcHmi.EventProvider.raise("onInitialized"),TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] End"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] Time elapsed: "+performance.now().toFixed(3).toString()+"ms")),"hidden"!==document.visibilityState?setTimeout((()=>{TcHmi.System.Services.splashScreen.hide()})):TcHmi.System.Services.splashScreen.hide()}))}break;case 1e4:if(TcHmi.System.Services.splashScreen.hide(),TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.ERROR"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.ERROR")),"loading"===document.readyState){const restartStatemaschine=function(){TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),InitStateMachine()};document.addEventListener("readystatechange",restartStatemaschine,{once:!0});break}TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] End"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] Time elapsed: "+performance.now().toFixed(3).toString()+"ms"));break;default:TcHmi.System.Init.__initStep=1}}()}}Init.__initStep=0,Init.__fetchFromIndexedDb=!0,System.Init=Init}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),!0!==TCHMI_UNITTEST_MODE&&(TcHmi.System.Init.printGeneralLogInformation(),TcHmi.System.Init.printForcedLogInformation(),TcHmi.System.Init.prepare(),TcHmi.System.Init.run(2));