-
Notifications
You must be signed in to change notification settings - Fork 86
/
brightics-va-commons.min.js
2 lines (2 loc) · 272 KB
/
brightics-va-commons.min.js
1
2
/* Brightics VA Build 200427 */
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=20)}([function(t,e,n){"use strict";var r=function(t){for(var e,n=t||16,r="",i=0;i<n;i++)r+=(e="23456789abcdefghjkmnpqrstuvwxyz").charAt(Math.floor(Math.random()*e.length));return r},i={project:{id:function(){return"p"+r(15)}},model:{id:function(){return"m"+r(15)}},control:{id:function(){return"c"+r(15)}},func:{id:function(){return"f"+r(15)}},table:{id:function(){return"t"+r(15)}},link:{id:function(){return"k"+r(15)}},template:{id:function(){return"t"+r(15)}},notice:{id:function(){return"n"+r(15)}},send:{id:function(){return"s"+r(39)}},report:{id:function(t){return"r"+r(t||8)}},schedule:{id:function(){return"j"+r(15)}},file:{id:function(){return"f"+r(8)}},reportPage:{id:function(){return"rp"+r(14)}},reportContent:{id:function(){return"rc"+r(14)}},dataSource:{id:function(){return"ds"+r(14)}},udf:{id:function(t){return"udf_"+t+"_"+r(8)}},uuid:{id:function(t){return r(t)}},importedFile:{id:function(t){return"importedFile_"+r(8)}},version:{id:function(t){return"v"+r(t||15)}}};t.exports=i},function(t,e,n){"use strict";var r=n(12)();t.exports=function(t){return t!==r&&null!==t}},function(t,e,n){t.exports=function(){var t="function",e="object",n=typeof document===e?document:{},r=function(t,e){return typeof t===e},i=typeof Node===t?function(t){return t instanceof Node}:function(t){return t&&r(t,e)&&"nodeType"in t&&r(t.ownerDocument,e)},o=function(t){return t instanceof Array},a=function(t,e){o(e)?e.map(function(e){a(t,e)}):(s.isNode(e)||(e=n.createTextNode(e)),t.appendChild(e))};function s(){var i,c=arguments,l=c[0],u=c[1],p=2,d=c.length,h=s.attrMap;if(l=s.isElement(l)?l:n.createElement(l),1===d)return l;if((!r(u,e)||s.isNode(u)||o(u))&&(--p,u=null),d-p==1&&r(c[p],"string")&&void 0!==l.textContent)l.textContent=c[p];else for(;p<d;++p)if(null!=(i=c[p]))if(o(i))for(var f=0;f<i.length;++f)a(l,i[f]);else a(l,i);for(var g in u)if(h[g]){var v=h[g];typeof v===t?v(l,u[g]):l.setAttribute(v,u[g])}else r(u[g],t)?l[g]=u[g]:l.setAttribute(g,u[g]);return l}return s.attrMap={},s.isElement=function(t){return s.isNode(t)&&1===t.nodeType},s.isNode=i,"undefined"!=typeof Proxy&&(s.proxy=new Proxy(s,{get:function(t,e){return!(e in s)&&(s[e]=s.bind(null,e)),s[e]}})),s}()},function(t,e,n){"use strict";var r,i,o,a,s,c,l,u=n(5),p=n(19),d=Function.prototype.apply,h=Function.prototype.call,f=Object.create,g=Object.defineProperty,v=Object.defineProperties,y=Object.prototype.hasOwnProperty,m={configurable:!0,enumerable:!1,writable:!0};i=function(t,e){var n,i;return p(e),i=this,r.call(this,t,n=function(){o.call(i,t,n),d.call(e,this,arguments)}),n.__eeOnceListener__=e,this},s={on:r=function(t,e){var n;return p(e),y.call(this,"__ee__")?n=this.__ee__:(n=m.value=f(null),g(this,"__ee__",m),m.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:i,off:o=function(t,e){var n,r,i,o;if(p(e),!y.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(r=n[t]))for(o=0;i=r[o];++o)i!==e&&i.__eeOnceListener__!==e||(2===r.length?n[t]=r[o?0:1]:r.splice(o,1));else r!==e&&r.__eeOnceListener__!==e||delete n[t];return this},emit:a=function(t){var e,n,r,i,o;if(y.call(this,"__ee__")&&(i=this.__ee__[t]))if("object"==typeof i){for(n=arguments.length,o=new Array(n-1),e=1;e<n;++e)o[e-1]=arguments[e];for(i=i.slice(),e=0;r=i[e];++e)d.call(r,this,o)}else switch(arguments.length){case 1:h.call(i,this);break;case 2:h.call(i,this,arguments[1]);break;case 3:h.call(i,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,o=new Array(n-1),e=1;e<n;++e)o[e-1]=arguments[e];d.call(i,this,o)}}},c={on:u(r),once:u(i),off:u(o),emit:u(a)},l=v({},c),t.exports=e=function(t){return null==t?f(l):v(Object(t),c)},e.methods=s},function(t,e,n){t.exports=function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){if(o)return o(a,!0);throw new Error("Cannot find module '"+a+"'")}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){return i(e[a][1][t]||t)},c,c.exports,t,e,n,r)}return n[a].exports}for(var o=!1,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e,n){(function(r,i,o,a,s,c,l,u,p){"use strict";function d(t,e){return function(t,e){var n;if(void 0===(n="passthrough"!==e.algorithm?y.createHash(e.algorithm):new v).write&&(n.write=n.update,n.end=n.update),g(e,n).dispatch(t),n.update||n.end(""),n.digest)return n.digest("buffer"===e.encoding?void 0:e.encoding);var r=n.read();return"buffer"===e.encoding?r:r.toString(e.encoding)}(t,e=h(t,e))}function h(t,e){if((e=e||{}).algorithm=e.algorithm||"sha1",e.encoding=e.encoding||"hex",e.excludeValues=!!e.excludeValues,e.algorithm=e.algorithm.toLowerCase(),e.encoding=e.encoding.toLowerCase(),e.ignoreUnknown=!0===e.ignoreUnknown,e.respectType=!1!==e.respectType,e.respectFunctionNames=!1!==e.respectFunctionNames,e.respectFunctionProperties=!1!==e.respectFunctionProperties,e.unorderedArrays=!0===e.unorderedArrays,e.unorderedSets=!1!==e.unorderedSets,e.unorderedObjects=!1!==e.unorderedObjects,e.replacer=e.replacer||void 0,e.excludeKeys=e.excludeKeys||void 0,void 0===t)throw new Error("Object argument required.");for(var n=0;n<m.length;++n)m[n].toLowerCase()===e.algorithm.toLowerCase()&&(e.algorithm=m[n]);if(-1===m.indexOf(e.algorithm))throw new Error('Algorithm "'+e.algorithm+'" not supported. supported values: '+m.join(", "));if(-1===b.indexOf(e.encoding)&&"passthrough"!==e.algorithm)throw new Error('Encoding "'+e.encoding+'" not supported. supported values: '+b.join(", "));return e}function f(t){return"function"==typeof t&&null!=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(t))}function g(t,e,n){n=n||[];var r=function(t){return e.update?e.update(t,"utf8"):e.write(t,"utf8")};return{dispatch:function(e){t.replacer&&(e=t.replacer(e));var n=typeof e;return null===e&&(n="null"),this["_"+n](e)},_object:function(e){var i,a=Object.prototype.toString.call(e),s=/\[object (.*)\]/i.exec(a);if(s=(s=s?s[1]:"unknown:["+a+"]").toLowerCase(),(i=n.indexOf(e))>=0)return this.dispatch("[CIRCULAR:"+i+"]");if(n.push(e),void 0!==o&&o.isBuffer&&o.isBuffer(e))return r("buffer:"),r(e);if("object"===s||"function"===s){var c=Object.keys(e);t.unorderedObjects&&(c=c.sort()),!1===t.respectType||f(e)||c.splice(0,0,"prototype","__proto__","constructor"),t.excludeKeys&&(c=c.filter(function(e){return!t.excludeKeys(e)})),r("object:"+c.length+":");var l=this;return c.forEach(function(n){l.dispatch(n),r(":"),t.excludeValues||l.dispatch(e[n]),r(",")})}if(!this["_"+s]){if(t.ignoreUnknown)return r("["+s+"]");throw new Error('Unknown object type "'+s+'"')}this["_"+s](e)},_array:function(e,i){i=void 0!==i?i:!1!==t.unorderedArrays;var o=this;if(r("array:"+e.length+":"),!i||e.length<=1)return e.forEach(function(t){return o.dispatch(t)});var a=[],s=e.map(function(e){var r=new v,i=n.slice();return g(t,r,i).dispatch(e),a=a.concat(i.slice(n.length)),r.read().toString()});return n=n.concat(a),s.sort(),this._array(s,!1)},_date:function(t){return r("date:"+t.toJSON())},_symbol:function(t){return r("symbol:"+t.toString())},_error:function(t){return r("error:"+t.toString())},_boolean:function(t){return r("bool:"+t.toString())},_string:function(t){r("string:"+t.length+":"),r(t.toString())},_function:function(e){r("fn:"),f(e)?this.dispatch("[native]"):this.dispatch(e.toString()),!1!==t.respectFunctionNames&&this.dispatch("function-name:"+String(e.name)),t.respectFunctionProperties&&this._object(e)},_number:function(t){return r("number:"+t.toString())},_xml:function(t){return r("xml:"+t.toString())},_null:function(){return r("Null")},_undefined:function(){return r("Undefined")},_regexp:function(t){return r("regex:"+t.toString())},_uint8array:function(t){return r("uint8array:"),this.dispatch(Array.prototype.slice.call(t))},_uint8clampedarray:function(t){return r("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(t))},_int8array:function(t){return r("uint8array:"),this.dispatch(Array.prototype.slice.call(t))},_uint16array:function(t){return r("uint16array:"),this.dispatch(Array.prototype.slice.call(t))},_int16array:function(t){return r("uint16array:"),this.dispatch(Array.prototype.slice.call(t))},_uint32array:function(t){return r("uint32array:"),this.dispatch(Array.prototype.slice.call(t))},_int32array:function(t){return r("uint32array:"),this.dispatch(Array.prototype.slice.call(t))},_float32array:function(t){return r("float32array:"),this.dispatch(Array.prototype.slice.call(t))},_float64array:function(t){return r("float64array:"),this.dispatch(Array.prototype.slice.call(t))},_arraybuffer:function(t){return r("arraybuffer:"),this.dispatch(new Uint8Array(t))},_url:function(t){return r("url:"+t.toString())},_map:function(e){r("map:");var n=Array.from(e);return this._array(n,!1!==t.unorderedSets)},_set:function(e){r("set:");var n=Array.from(e);return this._array(n,!1!==t.unorderedSets)},_blob:function(){if(t.ignoreUnknown)return r("[blob]");throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n')},_domwindow:function(){return r("domwindow")},_process:function(){return r("process")},_timer:function(){return r("timer")},_pipe:function(){return r("pipe")},_tcp:function(){return r("tcp")},_udp:function(){return r("udp")},_tty:function(){return r("tty")},_statwatcher:function(){return r("statwatcher")},_securecontext:function(){return r("securecontext")},_connection:function(){return r("connection")},_zlib:function(){return r("zlib")},_context:function(){return r("context")},_nodescript:function(){return r("nodescript")},_httpparser:function(){return r("httpparser")},_dataview:function(){return r("dataview")},_signal:function(){return r("signal")},_fsevent:function(){return r("fsevent")},_tlswrap:function(){return r("tlswrap")}}}function v(){return{buf:"",write:function(t){this.buf+=t},end:function(t){this.buf+=t},read:function(){return this.buf}}}var y=t("crypto");(n=e.exports=d).sha1=function(t){return d(t)},n.keys=function(t){return d(t,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},n.MD5=function(t){return d(t,{algorithm:"md5",encoding:"hex"})},n.keysMD5=function(t){return d(t,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var m=y.getHashes?y.getHashes().slice():["sha1","md5"];m.push("passthrough");var b=["buffer","hex","binary","base64"];n.writeToStream=function(t,e,n){return void 0===n&&(n=e,e={}),g(e=h(t,e),n).dispatch(t)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_e8180ef5.js","/")},{buffer:3,crypto:5,lYpoI2:10}],2:[function(t,e,n){(function(t,e,r,i,o,a,s,c,l){!function(t){"use strict";function e(t){var e=t.charCodeAt(0);return e===r||e===c?62:e===i||e===l?63:e<o?-1:e<o+10?e-o+26+26:e<s+26?e-s:e<a+26?e-a+26:void 0}var n="undefined"!=typeof Uint8Array?Uint8Array:Array,r="+".charCodeAt(0),i="/".charCodeAt(0),o="0".charCodeAt(0),a="a".charCodeAt(0),s="A".charCodeAt(0),c="-".charCodeAt(0),l="_".charCodeAt(0);t.toByteArray=function(t){function r(t){l[p++]=t}var i,o,a,s,c,l;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var u=t.length;c="="===t.charAt(u-2)?2:"="===t.charAt(u-1)?1:0,l=new n(3*t.length/4-c),a=c>0?t.length-4:t.length;var p=0;for(i=0,o=0;i<a;i+=4,o+=3)r((16711680&(s=e(t.charAt(i))<<18|e(t.charAt(i+1))<<12|e(t.charAt(i+2))<<6|e(t.charAt(i+3))))>>16),r((65280&s)>>8),r(255&s);return 2===c?r(255&(s=e(t.charAt(i))<<2|e(t.charAt(i+1))>>4)):1===c&&(r((s=e(t.charAt(i))<<10|e(t.charAt(i+1))<<4|e(t.charAt(i+2))>>2)>>8&255),r(255&s)),l},t.fromByteArray=function(t){function e(t){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)}function n(t){return e(t>>18&63)+e(t>>12&63)+e(t>>6&63)+e(63&t)}var r,i,o,a=t.length%3,s="";for(r=0,o=t.length-a;r<o;r+=3)s+=n(i=(t[r]<<16)+(t[r+1]<<8)+t[r+2]);switch(a){case 1:s+=e((i=t[t.length-1])>>2),s+=e(i<<4&63),s+="==";break;case 2:s+=e((i=(t[t.length-2]<<8)+t[t.length-1])>>10),s+=e(i>>4&63),s+=e(i<<2&63),s+="="}return s}}(void 0===n?this.base64js={}:n)}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:10}],3:[function(t,e,n){(function(e,r,i,o,a,s,c,l,u){function i(t,e,n){if(!(this instanceof i))return new i(t,e,n);var r,o,a,s=typeof t;if("base64"===e&&"string"===s)for(t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t);t.length%4!=0;)t+="=";if("number"===s)r=E(t);else if("string"===s)r=i.byteLength(t,e);else{if("object"!==s)throw new Error("First argument needs to be a number, array or string.");r=E(t.length)}if(i._useTypedArrays?o=i._augment(new Uint8Array(r)):((o=this).length=r,o._isBuffer=!0),i._useTypedArrays&&"number"==typeof t.byteLength)o._set(t);else if(function(t){return F(t)||i.isBuffer(t)||t&&"object"==typeof t&&"number"==typeof t.length}(t))for(a=0;a<r;a++)i.isBuffer(t)?o[a]=t.readUInt8(a):o[a]=t[a];else if("string"===s)o.write(t,0,e);else if("number"===s&&!i._useTypedArrays&&!n)for(a=0;a<r;a++)o[a]=0;return o}function p(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;var a=e.length;N(a%2==0,"Invalid hex string"),r>a/2&&(r=a/2);for(var s=0;s<r;s++){var c=parseInt(e.substr(2*s,2),16);N(!isNaN(c),"Invalid hex string"),t[n+s]=c}return i._charsWritten=2*s,s}function d(t,e,n,r){return i._charsWritten=j(B(e),t,n,r)}function h(t,e,n,r){return i._charsWritten=j(function(t){for(var e=[],n=0;n<t.length;n++)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function f(t,e,n,r){return i._charsWritten=j(O(e),t,n,r)}function g(t,e,n,r){return i._charsWritten=j(function(t){for(var e,n,r,i=[],o=0;o<t.length;o++)n=(e=t.charCodeAt(o))>>8,r=e%256,i.push(r),i.push(n);return i}(e),t,n,r)}function v(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;i++)r+=String.fromCharCode(t[i]);return r}function y(t,e,n,r){r||(N("boolean"==typeof n,"missing or invalid endian"),N(null!=e,"missing offset"),N(e+1<t.length,"Trying to read beyond buffer length"));var i,o=t.length;if(!(e>=o))return n?(i=t[e],e+1<o&&(i|=t[e+1]<<8)):(i=t[e]<<8,e+1<o&&(i|=t[e+1])),i}function m(t,e,n,r){r||(N("boolean"==typeof n,"missing or invalid endian"),N(null!=e,"missing offset"),N(e+3<t.length,"Trying to read beyond buffer length"));var i,o=t.length;if(!(e>=o))return n?(e+2<o&&(i=t[e+2]<<16),e+1<o&&(i|=t[e+1]<<8),i|=t[e],e+3<o&&(i+=t[e+3]<<24>>>0)):(e+1<o&&(i=t[e+1]<<16),e+2<o&&(i|=t[e+2]<<8),e+3<o&&(i|=t[e+3]),i+=t[e]<<24>>>0),i}function b(t,e,n,r){if(r||(N("boolean"==typeof n,"missing or invalid endian"),N(null!=e,"missing offset"),N(e+1<t.length,"Trying to read beyond buffer length")),!(e>=t.length)){var i=y(t,e,n,!0);return 32768&i?-1*(65535-i+1):i}}function C(t,e,n,r){if(r||(N("boolean"==typeof n,"missing or invalid endian"),N(null!=e,"missing offset"),N(e+3<t.length,"Trying to read beyond buffer length")),!(e>=t.length)){var i=m(t,e,n,!0);return 2147483648&i?-1*(4294967295-i+1):i}}function w(t,e,n,r){return r||(N("boolean"==typeof n,"missing or invalid endian"),N(e+3<t.length,"Trying to read beyond buffer length")),R.read(t,e,n,23,4)}function _(t,e,n,r){return r||(N("boolean"==typeof n,"missing or invalid endian"),N(e+7<t.length,"Trying to read beyond buffer length")),R.read(t,e,n,52,8)}function I(t,e,n,r,i){i||(N(null!=e,"missing value"),N("boolean"==typeof r,"missing or invalid endian"),N(null!=n,"missing offset"),N(n+1<t.length,"trying to write beyond buffer length"),k(e,65535));var o=t.length;if(!(n>=o))for(var a=0,s=Math.min(o-n,2);a<s;a++)t[n+a]=(e&255<<8*(r?a:1-a))>>>8*(r?a:1-a)}function A(t,e,n,r,i){i||(N(null!=e,"missing value"),N("boolean"==typeof r,"missing or invalid endian"),N(null!=n,"missing offset"),N(n+3<t.length,"trying to write beyond buffer length"),k(e,4294967295));var o=t.length;if(!(n>=o))for(var a=0,s=Math.min(o-n,4);a<s;a++)t[n+a]=e>>>8*(r?a:3-a)&255}function x(t,e,n,r,i){i||(N(null!=e,"missing value"),N("boolean"==typeof r,"missing or invalid endian"),N(null!=n,"missing offset"),N(n+1<t.length,"Trying to write beyond buffer length"),M(e,32767,-32768)),n>=t.length||I(t,e>=0?e:65535+e+1,n,r,i)}function T(t,e,n,r,i){i||(N(null!=e,"missing value"),N("boolean"==typeof r,"missing or invalid endian"),N(null!=n,"missing offset"),N(n+3<t.length,"Trying to write beyond buffer length"),M(e,2147483647,-2147483648)),n>=t.length||A(t,e>=0?e:4294967295+e+1,n,r,i)}function $(t,e,n,r,i){i||(N(null!=e,"missing value"),N("boolean"==typeof r,"missing or invalid endian"),N(null!=n,"missing offset"),N(n+3<t.length,"Trying to write beyond buffer length"),P(e,3.4028234663852886e38,-3.4028234663852886e38)),n>=t.length||R.write(t,e,n,r,23,4)}function D(t,e,n,r,i){i||(N(null!=e,"missing value"),N("boolean"==typeof r,"missing or invalid endian"),N(null!=n,"missing offset"),N(n+7<t.length,"Trying to write beyond buffer length"),P(e,1.7976931348623157e308,-1.7976931348623157e308)),n>=t.length||R.write(t,e,n,r,52,8)}function V(t,e,n){return"number"!=typeof t?n:(t=~~t)>=e?e:t>=0||(t+=e)>=0?t:0}function E(t){return(t=~~Math.ceil(+t))<0?0:t}function F(t){return(Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)})(t)}function U(t){return t<16?"0"+t.toString(16):t.toString(16)}function B(t){for(var e=[],n=0;n<t.length;n++){var r=t.charCodeAt(n);if(r<=127)e.push(t.charCodeAt(n));else{var i=n;r>=55296&&r<=57343&&n++;for(var o=encodeURIComponent(t.slice(i,n+1)).substr(1).split("%"),a=0;a<o.length;a++)e.push(parseInt(o[a],16))}}return e}function O(t){return L.toByteArray(t)}function j(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);i++)e[i+n]=t[i];return i}function S(t){try{return decodeURIComponent(t)}catch(t){return String.fromCharCode(65533)}}function k(t,e){N("number"==typeof t,"cannot write a non-number as a number"),N(t>=0,"specified a negative value for writing an unsigned value"),N(t<=e,"value is larger than maximum value for type"),N(Math.floor(t)===t,"value has a fractional component")}function M(t,e,n){N("number"==typeof t,"cannot write a non-number as a number"),N(t<=e,"value larger than maximum allowed value"),N(t>=n,"value smaller than minimum allowed value"),N(Math.floor(t)===t,"value has a fractional component")}function P(t,e,n){N("number"==typeof t,"cannot write a non-number as a number"),N(t<=e,"value larger than maximum allowed value"),N(t>=n,"value smaller than minimum allowed value")}function N(t,e){if(!t)throw new Error(e||"Failed assertion")}var L=t("base64-js"),R=t("ieee754");n.Buffer=i,n.SlowBuffer=i,n.INSPECT_MAX_BYTES=50,i.poolSize=8192,i._useTypedArrays=function(){try{var t=new ArrayBuffer(0),e=new Uint8Array(t);return e.foo=function(){return 42},42===e.foo()&&"function"==typeof e.subarray}catch(t){return!1}}(),i.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.isBuffer=function(t){return!(null==t||!t._isBuffer)},i.byteLength=function(t,e){var n;switch(t+="",e||"utf8"){case"hex":n=t.length/2;break;case"utf8":case"utf-8":n=B(t).length;break;case"ascii":case"binary":case"raw":n=t.length;break;case"base64":n=O(t).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*t.length;break;default:throw new Error("Unknown encoding")}return n},i.concat=function(t,e){if(N(F(t),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===t.length)return new i(0);if(1===t.length)return t[0];var n;if("number"!=typeof e)for(e=0,n=0;n<t.length;n++)e+=t[n].length;var r=new i(e),o=0;for(n=0;n<t.length;n++){var a=t[n];a.copy(r,o),o+=a.length}return r},i.prototype.write=function(t,e,n,r){if(isFinite(e))isFinite(n)||(r=n,n=void 0);else{var i=r;r=e,e=n,n=i}e=Number(e)||0;var o,a=this.length-e;switch(n?(n=Number(n))>a&&(n=a):n=a,r=String(r||"utf8").toLowerCase()){case"hex":o=p(this,t,e,n);break;case"utf8":case"utf-8":o=d(this,t,e,n);break;case"ascii":o=h(this,t,e,n);break;case"binary":o=function(t,e,n,r){return h(t,e,n,r)}(this,t,e,n);break;case"base64":o=f(this,t,e,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":o=g(this,t,e,n);break;default:throw new Error("Unknown encoding")}return o},i.prototype.toString=function(t,e,n){var r,i=this;if(t=String(t||"utf8").toLowerCase(),e=Number(e)||0,(n=void 0!==n?Number(n):n=i.length)===e)return"";switch(t){case"hex":r=function(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;o++)i+=U(t[o]);return i}(i,e,n);break;case"utf8":case"utf-8":r=function(t,e,n){var r="",i="";n=Math.min(t.length,n);for(var o=e;o<n;o++)t[o]<=127?(r+=S(i)+String.fromCharCode(t[o]),i=""):i+="%"+t[o].toString(16);return r+S(i)}(i,e,n);break;case"ascii":r=v(i,e,n);break;case"binary":r=function(t,e,n){return v(i,e,n)}(0,e,n);break;case"base64":r=function(t,e,n){return 0===e&&n===t.length?L.fromByteArray(t):L.fromByteArray(t.slice(e,n))}(i,e,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=function(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}(i,e,n);break;default:throw new Error("Unknown encoding")}return r},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},i.prototype.copy=function(t,e,n,r){var o=this;if(n||(n=0),r||0===r||(r=this.length),e||(e=0),r!==n&&0!==t.length&&0!==o.length){N(r>=n,"sourceEnd < sourceStart"),N(e>=0&&e<t.length,"targetStart out of bounds"),N(n>=0&&n<o.length,"sourceStart out of bounds"),N(r>=0&&r<=o.length,"sourceEnd out of bounds"),r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var a=r-n;if(a<100||!i._useTypedArrays)for(var s=0;s<a;s++)t[s+e]=this[s+n];else t._set(this.subarray(n,n+a),e)}},i.prototype.slice=function(t,e){var n=this.length;if(t=V(t,n,0),e=V(e,n,n),i._useTypedArrays)return i._augment(this.subarray(t,e));for(var r=e-t,o=new i(r,void 0,!0),a=0;a<r;a++)o[a]=this[a+t];return o},i.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},i.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},i.prototype.readUInt8=function(t,e){if(e||(N(null!=t,"missing offset"),N(t<this.length,"Trying to read beyond buffer length")),!(t>=this.length))return this[t]},i.prototype.readUInt16LE=function(t,e){return y(this,t,!0,e)},i.prototype.readUInt16BE=function(t,e){return y(this,t,!1,e)},i.prototype.readUInt32LE=function(t,e){return m(this,t,!0,e)},i.prototype.readUInt32BE=function(t,e){return m(this,t,!1,e)},i.prototype.readInt8=function(t,e){if(e||(N(null!=t,"missing offset"),N(t<this.length,"Trying to read beyond buffer length")),!(t>=this.length))return 128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){return b(this,t,!0,e)},i.prototype.readInt16BE=function(t,e){return b(this,t,!1,e)},i.prototype.readInt32LE=function(t,e){return C(this,t,!0,e)},i.prototype.readInt32BE=function(t,e){return C(this,t,!1,e)},i.prototype.readFloatLE=function(t,e){return w(this,t,!0,e)},i.prototype.readFloatBE=function(t,e){return w(this,t,!1,e)},i.prototype.readDoubleLE=function(t,e){return _(this,t,!0,e)},i.prototype.readDoubleBE=function(t,e){return _(this,t,!1,e)},i.prototype.writeUInt8=function(t,e,n){n||(N(null!=t,"missing value"),N(null!=e,"missing offset"),N(e<this.length,"trying to write beyond buffer length"),k(t,255)),e>=this.length||(this[e]=t)},i.prototype.writeUInt16LE=function(t,e,n){I(this,t,e,!0,n)},i.prototype.writeUInt16BE=function(t,e,n){I(this,t,e,!1,n)},i.prototype.writeUInt32LE=function(t,e,n){A(this,t,e,!0,n)},i.prototype.writeUInt32BE=function(t,e,n){A(this,t,e,!1,n)},i.prototype.writeInt8=function(t,e,n){n||(N(null!=t,"missing value"),N(null!=e,"missing offset"),N(e<this.length,"Trying to write beyond buffer length"),M(t,127,-128)),e>=this.length||(t>=0?this.writeUInt8(t,e,n):this.writeUInt8(255+t+1,e,n))},i.prototype.writeInt16LE=function(t,e,n){x(this,t,e,!0,n)},i.prototype.writeInt16BE=function(t,e,n){x(this,t,e,!1,n)},i.prototype.writeInt32LE=function(t,e,n){T(this,t,e,!0,n)},i.prototype.writeInt32BE=function(t,e,n){T(this,t,e,!1,n)},i.prototype.writeFloatLE=function(t,e,n){$(this,t,e,!0,n)},i.prototype.writeFloatBE=function(t,e,n){$(this,t,e,!1,n)},i.prototype.writeDoubleLE=function(t,e,n){D(this,t,e,!0,n)},i.prototype.writeDoubleBE=function(t,e,n){D(this,t,e,!1,n)},i.prototype.fill=function(t,e,n){if(t||(t=0),e||(e=0),n||(n=this.length),"string"==typeof t&&(t=t.charCodeAt(0)),N("number"==typeof t&&!isNaN(t),"value is not a number"),N(n>=e,"end < start"),n!==e&&0!==this.length){N(e>=0&&e<this.length,"start out of bounds"),N(n>=0&&n<=this.length,"end out of bounds");for(var r=e;r<n;r++)this[r]=t}},i.prototype.inspect=function(){for(var t=[],e=this.length,r=0;r<e;r++)if(t[r]=U(this[r]),r===n.INSPECT_MAX_BYTES){t[r+1]="...";break}return"<Buffer "+t.join(" ")+">"},i.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(i._useTypedArrays)return new i(this).buffer;for(var t=new Uint8Array(this.length),e=0,n=t.length;e<n;e+=1)t[e]=this[e];return t.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var W=i.prototype;i._augment=function(t){return t._isBuffer=!0,t._get=t.get,t._set=t.set,t.get=W.get,t.set=W.set,t.write=W.write,t.toString=W.toString,t.toLocaleString=W.toString,t.toJSON=W.toJSON,t.copy=W.copy,t.slice=W.slice,t.readUInt8=W.readUInt8,t.readUInt16LE=W.readUInt16LE,t.readUInt16BE=W.readUInt16BE,t.readUInt32LE=W.readUInt32LE,t.readUInt32BE=W.readUInt32BE,t.readInt8=W.readInt8,t.readInt16LE=W.readInt16LE,t.readInt16BE=W.readInt16BE,t.readInt32LE=W.readInt32LE,t.readInt32BE=W.readInt32BE,t.readFloatLE=W.readFloatLE,t.readFloatBE=W.readFloatBE,t.readDoubleLE=W.readDoubleLE,t.readDoubleBE=W.readDoubleBE,t.writeUInt8=W.writeUInt8,t.writeUInt16LE=W.writeUInt16LE,t.writeUInt16BE=W.writeUInt16BE,t.writeUInt32LE=W.writeUInt32LE,t.writeUInt32BE=W.writeUInt32BE,t.writeInt8=W.writeInt8,t.writeInt16LE=W.writeInt16LE,t.writeInt16BE=W.writeInt16BE,t.writeInt32LE=W.writeInt32LE,t.writeInt32BE=W.writeInt32BE,t.writeFloatLE=W.writeFloatLE,t.writeFloatBE=W.writeFloatBE,t.writeDoubleLE=W.writeDoubleLE,t.writeDoubleBE=W.writeDoubleBE,t.fill=W.fill,t.inspect=W.inspect,t.toArrayBuffer=W.toArrayBuffer,t}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(t,e,n){(function(n,r,i,o,a,s,c,l,u){i=t("buffer").Buffer;var p=new i(4);p.fill(0);e.exports={hash:function(t,e,n,r){return i.isBuffer(t)||(t=new i(t)),function(t,e,n){for(var r=new i(e),o=n?r.writeInt32BE:r.writeInt32LE,a=0;a<t.length;a++)o.call(r,t[a],4*a,!0);return r}(e(function(t,e){if(t.length%4!=0){var n=t.length+(4-t.length%4);t=i.concat([t,p],n)}for(var r=[],o=e?t.readInt32BE:t.readInt32LE,a=0;a<t.length;a+=4)r.push(o.call(t,a));return r}(t,r),8*t.length),n,r)}}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],5:[function(t,e,n){(function(e,r,i,o,a,s,c,l,u){function p(t,e){var n=v[t=t||"sha1"],r=[];return n||d("algorithm:",t,"is not yet supported"),{update:function(t){return i.isBuffer(t)||(t=new i(t)),r.push(t),t.length,this},digest:function(t){var o=i.concat(r),a=e?function(t,e,n){i.isBuffer(e)||(e=new i(e)),i.isBuffer(n)||(n=new i(n)),e.length>y?e=t(e):e.length<y&&(e=i.concat([e,m],y));for(var r=new i(y),o=new i(y),a=0;a<y;a++)r[a]=54^e[a],o[a]=92^e[a];var s=t(i.concat([r,n]));return t(i.concat([o,s]))}(n,e,o):n(o);return r=null,t?a.toString(t):a}}}function d(){var t=[].slice.call(arguments).join(" ");throw new Error([t,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}i=t("buffer").Buffer;var h=t("./sha"),f=t("./sha256"),g=t("./rng"),v={sha1:h,sha256:f,md5:t("./md5")},y=64,m=new i(y);m.fill(0),n.createHash=function(t){return p(t)},n.createHmac=function(t,e){return p(t,e)},n.randomBytes=function(t,e){if(!e||!e.call)return new i(g(t));try{e.call(this,void 0,new i(g(t)))}catch(t){e(t)}},function(t,e){for(var n in t)e(t[n])}(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],function(t){n[t]=function(){d("sorry,",t,"is not implemented yet")}})}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:10}],6:[function(t,e,n){(function(n,r,i,o,a,s,c,l,u){function p(t,e){t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,a=0;a<t.length;a+=16){var s=n,c=r,l=i,u=o;n=h(n,r,i,o,t[a+0],7,-680876936),o=h(o,n,r,i,t[a+1],12,-389564586),i=h(i,o,n,r,t[a+2],17,606105819),r=h(r,i,o,n,t[a+3],22,-1044525330),n=h(n,r,i,o,t[a+4],7,-176418897),o=h(o,n,r,i,t[a+5],12,1200080426),i=h(i,o,n,r,t[a+6],17,-1473231341),r=h(r,i,o,n,t[a+7],22,-45705983),n=h(n,r,i,o,t[a+8],7,1770035416),o=h(o,n,r,i,t[a+9],12,-1958414417),i=h(i,o,n,r,t[a+10],17,-42063),r=h(r,i,o,n,t[a+11],22,-1990404162),n=h(n,r,i,o,t[a+12],7,1804603682),o=h(o,n,r,i,t[a+13],12,-40341101),i=h(i,o,n,r,t[a+14],17,-1502002290),n=f(n,r=h(r,i,o,n,t[a+15],22,1236535329),i,o,t[a+1],5,-165796510),o=f(o,n,r,i,t[a+6],9,-1069501632),i=f(i,o,n,r,t[a+11],14,643717713),r=f(r,i,o,n,t[a+0],20,-373897302),n=f(n,r,i,o,t[a+5],5,-701558691),o=f(o,n,r,i,t[a+10],9,38016083),i=f(i,o,n,r,t[a+15],14,-660478335),r=f(r,i,o,n,t[a+4],20,-405537848),n=f(n,r,i,o,t[a+9],5,568446438),o=f(o,n,r,i,t[a+14],9,-1019803690),i=f(i,o,n,r,t[a+3],14,-187363961),r=f(r,i,o,n,t[a+8],20,1163531501),n=f(n,r,i,o,t[a+13],5,-1444681467),o=f(o,n,r,i,t[a+2],9,-51403784),i=f(i,o,n,r,t[a+7],14,1735328473),n=g(n,r=f(r,i,o,n,t[a+12],20,-1926607734),i,o,t[a+5],4,-378558),o=g(o,n,r,i,t[a+8],11,-2022574463),i=g(i,o,n,r,t[a+11],16,1839030562),r=g(r,i,o,n,t[a+14],23,-35309556),n=g(n,r,i,o,t[a+1],4,-1530992060),o=g(o,n,r,i,t[a+4],11,1272893353),i=g(i,o,n,r,t[a+7],16,-155497632),r=g(r,i,o,n,t[a+10],23,-1094730640),n=g(n,r,i,o,t[a+13],4,681279174),o=g(o,n,r,i,t[a+0],11,-358537222),i=g(i,o,n,r,t[a+3],16,-722521979),r=g(r,i,o,n,t[a+6],23,76029189),n=g(n,r,i,o,t[a+9],4,-640364487),o=g(o,n,r,i,t[a+12],11,-421815835),i=g(i,o,n,r,t[a+15],16,530742520),n=v(n,r=g(r,i,o,n,t[a+2],23,-995338651),i,o,t[a+0],6,-198630844),o=v(o,n,r,i,t[a+7],10,1126891415),i=v(i,o,n,r,t[a+14],15,-1416354905),r=v(r,i,o,n,t[a+5],21,-57434055),n=v(n,r,i,o,t[a+12],6,1700485571),o=v(o,n,r,i,t[a+3],10,-1894986606),i=v(i,o,n,r,t[a+10],15,-1051523),r=v(r,i,o,n,t[a+1],21,-2054922799),n=v(n,r,i,o,t[a+8],6,1873313359),o=v(o,n,r,i,t[a+15],10,-30611744),i=v(i,o,n,r,t[a+6],15,-1560198380),r=v(r,i,o,n,t[a+13],21,1309151649),n=v(n,r,i,o,t[a+4],6,-145523070),o=v(o,n,r,i,t[a+11],10,-1120210379),i=v(i,o,n,r,t[a+2],15,718787259),r=v(r,i,o,n,t[a+9],21,-343485551),n=y(n,s),r=y(r,c),i=y(i,l),o=y(o,u)}return Array(n,r,i,o)}function d(t,e,n,r,i,o){return y(function(t,e){return t<<i|t>>>32-i}(y(y(e,t),y(r,o))),n)}function h(t,e,n,r,i,o,a){return d(e&n|~e&r,t,e,i,o,a)}function f(t,e,n,r,i,o,a){return d(e&r|n&~r,t,e,i,o,a)}function g(t,e,n,r,i,o,a){return d(e^n^r,t,e,i,o,a)}function v(t,e,n,r,i,o,a){return d(n^(e|~r),t,e,i,o,a)}function y(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}var m=t("./helpers");e.exports=function(t){return m.hash(t,p,16)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(t,e,n){(function(t,n,r,i,o,a,s,c,l){!function(){var t,n;t=function(t){for(var e,n=new Array(t),r=0;r<t;r++)0==(3&r)&&(e=4294967296*Math.random()),n[r]=e>>>((3&r)<<3)&255;return n},this.crypto&&crypto.getRandomValues&&(n=function(t){var e=new Uint8Array(t);return crypto.getRandomValues(e),e}),e.exports=n||t}()}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],8:[function(t,e,n){(function(n,r,i,o,a,s,c,l,u){function p(t,e){t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var n=Array(80),r=1732584193,i=-271733879,o=-1732584194,a=271733878,s=-1009589776,c=0;c<t.length;c+=16){for(var l=r,u=i,p=o,v=a,y=s,m=0;m<80;m++){n[m]=m<16?t[c+m]:g(n[m-3]^n[m-8]^n[m-14]^n[m-16],1);var b=f(f(g(r,5),d(m,i,o,a)),f(f(s,n[m]),h(m)));s=a,a=o,o=g(i,30),i=r,r=b}r=f(r,l),i=f(i,u),o=f(o,p),a=f(a,v),s=f(s,y)}return Array(r,i,o,a,s)}function d(t,e,n,r){return t<20?e&n|~e&r:t<40?e^n^r:t<60?e&n|e&r|n&r:e^n^r}function h(t){return t<20?1518500249:t<40?1859775393:t<60?-1894007588:-899497514}function f(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function g(t,e){return t<<e|t>>>32-e}var v=t("./helpers");e.exports=function(t){return v.hash(t,p,20,!0)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(t,e,n){(function(n,r,i,o,a,s,c,l,u){var p=t("./helpers"),d=function(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n},h=function(t,e){return t>>>e|t<<32-e},f=function(t,e){return t>>>e},g=function(t,e,n){return t&e^~t&n},v=function(t,e,n){return t&e^t&n^e&n},y=function(t){return h(t,2)^h(t,13)^h(t,22)},m=function(t){return h(t,6)^h(t,11)^h(t,25)},b=function(t){return h(t,7)^h(t,18)^f(t,3)},C=function(t){return h(t,17)^h(t,19)^f(t,10)},w=function(t,e){var n,r,i,o,a,s,c,l,u,p,h=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),f=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),w=new Array(64);t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var _=0;_<t.length;_+=16){n=f[0],r=f[1],i=f[2],o=f[3],a=f[4],s=f[5],c=f[6],l=f[7];for(var I=0;I<64;I++)w[I]=I<16?t[I+_]:d(d(d(C(w[I-2]),w[I-7]),b(w[I-15])),w[I-16]),u=d(d(d(d(l,m(a)),g(a,s,c)),h[I]),w[I]),p=d(y(n),v(n,r,i)),l=c,c=s,s=a,a=d(o,u),o=i,i=r,r=n,n=d(u,p);f[0]=d(n,f[0]),f[1]=d(r,f[1]),f[2]=d(i,f[2]),f[3]=d(o,f[3]),f[4]=d(a,f[4]),f[5]=d(s,f[5]),f[6]=d(c,f[6]),f[7]=d(l,f[7])}return f};e.exports=function(t){return p.hash(t,w,32,!0)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],10:[function(t,e,n){(function(t,n,r,i,o,a,s,c,l){function u(){}(t=e.exports={}).nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;(e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)&&n.shift()()},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),t.title="browser",t.browser=!0,t.env={},t.argv=[],t.on=u,t.addListener=u,t.once=u,t.off=u,t.removeListener=u,t.removeAllListeners=u,t.emit=u,t.binding=function(t){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(t){throw new Error("process.chdir is not supported")}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:10}],11:[function(t,e,n){(function(t,e,r,i,o,a,s,c,l){n.read=function(t,e,n,r,i){var o,a,s=8*i-r-1,c=(1<<s)-1,l=c>>1,u=-7,p=n?i-1:0,d=n?-1:1,h=t[e+p];for(p+=d,o=h&(1<<-u)-1,h>>=-u,u+=s;u>0;o=256*o+t[e+p],p+=d,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+t[e+p],p+=d,u-=8);if(0===o)o=1-l;else{if(o===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=l}return(h?-1:1)*a*Math.pow(2,o-r)},n.write=function(t,e,n,r,i,o){var a,s,c,l=8*o-i-1,u=(1<<l)-1,p=u>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,f=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),(e+=a+p>=1?d/c:d*Math.pow(2,1-p))*c>=2&&(a++,c/=2),a+p>=u?(s=0,a=u):a+p>=1?(s=(e*c-1)*Math.pow(2,i),a+=p):(s=e*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;t[n+h]=255&s,h+=f,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;t[n+h]=255&a,h+=f,a/=256,l-=8);t[n+h-f]|=128*g}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ieee754/index.js","/node_modules/ieee754")},{buffer:3,lYpoI2:10}]},{},[1])(1)},function(t,e,n){"use strict";var r=n(6),i=n(14),o=n(15),a=n(16);(t.exports=function(t,e){var n,o,s,c,l;return arguments.length<2||"string"!=typeof t?(c=e,e=t,t=null):c=arguments[2],null==t?(n=s=!0,o=!1):(n=a.call(t,"c"),o=a.call(t,"e"),s=a.call(t,"w")),l={value:e,configurable:n,enumerable:o,writable:s},c?r(i(c),l):l}).gs=function(t,e,n){var s,c,l,u;return"string"!=typeof t?(l=n,n=e,e=t,t=null):l=arguments[3],null==e?e=void 0:o(e)?null==n?n=void 0:o(n)||(l=n,n=void 0):(l=e,e=n=void 0),null==t?(s=!0,c=!1):(s=a.call(t,"c"),c=a.call(t,"e")),u={get:e,set:n,configurable:s,enumerable:c},l?r(i(l),u):u}},function(t,e,n){"use strict";t.exports=n(7)()?Object.assign:n(8)},function(t,e,n){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,n){"use strict";var r=n(9),i=n(13),o=Math.max;t.exports=function(t,e){var n,a,s,c=o(arguments.length,2);for(t=Object(i(t)),s=function(r){try{t[r]=e[r]}catch(t){n||(n=t)}},a=1;a<c;++a)e=arguments[a],r(e).forEach(s);if(void 0!==n)throw n;return t}},function(t,e,n){"use strict";t.exports=n(10)()?Object.keys:n(11)},function(t,e,n){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,n){"use strict";var r=n(1),i=Object.keys;t.exports=function(t){return i(r(t)?Object(t):t)}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var r=n(1);t.exports=function(t){if(!r(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,n){"use strict";var r=n(1),i=Array.prototype.forEach,o=Object.create;t.exports=function(t){var e=o(null);return i.call(arguments,function(t){r(t)&&function(t,e){var n;for(n in t)e[n]=t[n]}(Object(t),e)}),e}},function(t,e,n){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,n){"use strict";t.exports=n(17)()?String.prototype.contains:n(18)},function(t,e,n){"use strict";var r="razdwatrzy";t.exports=function(){return"function"==typeof r.contains&&!0===r.contains("dwa")&&!1===r.contains("foo")}},function(t,e,n){"use strict";var r=String.prototype.indexOf;t.exports=function(t){return r.call(this,t,arguments[1])>-1}},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"CORE_VERSION",function(){return xt});var i=n(3);function o(t){}function a(t,e){o.call(this),this.$el=t,this.options=e}function s(t,e){a.call(this,t,e)}function c(t,e){s.call(this,t,e),this.listeners={},this.jqxOptions=this._brtcOptions2jqxOptions(this.options),this.keyIndex=0}function l(t,e){a.call(this,t,e)}function u(t,e){l.call(this,t,e),this.jqxOptions=this._brtcOptions2jqxOptions(e),this._initEventListener()}n.n(i)()(o.prototype),a.prototype=Object.create(o.prototype),a.prototype.constructor=a,a.prototype.getParent=function(){return this.$el},a.prototype.getOptions=function(){return this.options},a.prototype.render=function(){throw new Error("not implemented")},a.prototype.destroy=function(){},s.prototype=Object.create(a.prototype),s.prototype.constructor=s,s.prototype.update=function(t){throw new Error("not implemented")},c.prototype=Object.create(s.prototype),c.prototype.constructor=c,c.prototype.update=function(t){this.source.localdata=t,this.$content.jqxGrid("updatebounddata"),this.options.selectable&&this.$content.jqxGrid("clearselection")},c.prototype.render=function(){return this.$template=$(['<div class="brtc-va-base-list">',' <div class="brtc-va-base-list-wrapper">',' <div class="brtc-va-base-list-content">'," </div>"," </div>","</div>"].join("\n")),this.$wrapper=this.$template.find(".brtc-va-base-list-wrapper"),this.$wrapper.perfectScrollbar(),this.$content=this.$template.find(".brtc-va-base-list-content"),this._registerAllListeners(this.listeners),this.$content.jqxGrid(this.jqxOptions),this.$el.empty(),this.$el.append(this.$template),this._initEventListeners(),this},c.prototype.destroy=function(){this.$content.jqxGrid("destroy")},c.prototype._brtcOptions2jqxOptions=function(t){var e={theme:"office"};return e.sortable=t.sortable||!1,e.selectionmode=t.selectable?"checkbox":"none",e.columnsresize=!1,e.filterable=!1,e.altrows=!1,e.showfiltercolumnbackground=!1,e.rowsheight=t.rowsHeight||53,e.columnsheight=t.rowsHeight||53,e.enabletooltips=!0,e.width=t.width||"auto",e.height=t.height||"auto",this.source=this._getSource(t.columns),e.source=new $.jqx.dataAdapter(this.source),t.data&&t.data.length&&(e.source.localdata=t.data),e.columns=this._getJqxGridColumnsOption(t.columns),e},c.prototype._getSource=function(t){var e={localdata:[],datatype:"array"};return e.datafileds=_.map(t,function(t){return{name:t.key,type:t.type||"string"}}),e},c.prototype._getJqxGridColumnsOption=function(t){var e={cellclassname:"brtc-va-base-list-grid-cell",renderer:this._getDefaultHeaderRenderer()};return _.map(t,function(t){if(t.key){var n={text:t.name,datafield:t.key,width:t.width||"auto",align:t.headerAlign||"center",cellsalign:t.dataAlign||"center",cellsrenderer:t.dataRenderer?this._getGenerativeRenderer(t.dataAlign,t.dataRenderer):this._getDefaultDataRenderer(t.type,t.dataAlign)};return _.extend({},e,n)}}.bind(this))},c.prototype._getDefaultHeaderRenderer=function(){return function(t){return'<div class="brtc-va-base-list-column-header">'+_.escape(t)+"</div>"}},c.prototype._getDefaultDataRenderer=function(t,e){var n=[this._getAlignClass(e)].join(" ");return function(e,r,i){return this._wrap("<div>"+_.escape(this._format(i,t))+"</div>",n)}.bind(this)},c.prototype._getAlignClass=function(t){return{left:"brtc-va-base-list-grid-cell-flex-left",center:"brtc-va-base-list-grid-cell-flex-center",right:"brtc-va-base-list-grid-cell-flex-right"}[t||"center"]},c.prototype._getGenerativeRenderer=function(t,e){var n=[this._getAlignClass(t)].join(" ");return function(t,r,i){var o=e(t,i);return this._wrap(this._getHtmlWithEventHandler(o,t),n)}.bind(this)},c.prototype._getHtmlWithEventHandler=function(t,e){var n=this.source.localdata[e],r=e,i=function(t){var e=$._data(t,"events");_.forOwn(e,function(e,i){var o=this._genHandlerKey();this.listeners[i]=this.listeners[i]||{},this.listeners[i][o]={fn:function(t){_.forEach(e,function(e){e.handler(t)})},data:n,index:r},t.setAttribute(i+"__key__",o)}.bind(this))}.bind(this),o=function(t){var e=t.children;i(t),_.forEach(e,function(t){i(t),o(t)})};return o(t[0]),t[0].outerHTML},c.prototype._wrap=function(t,e){return['<div class="'+e+'">',t,"</div>"].join("")},c.prototype._format=function(t,e){var n=t||"";return"date"==(e||"string")&&n?moment(n).format("YYYY-MM-DD HH:mm:ss"):n},c.prototype._genHandlerKey=function(){return parseInt(++this.keyIndex)},c.prototype._initEventListeners=function(t){this.$content.on("cellclick",function(t){return!(t.args.originalEvent&&t.args.originalEvent.cancel||"_checkboxcolumn"==t.args.datafield||(this.emit("cell-click",{data:this.source.localdata[t.args.rowindex],index:t.args.rowindex}),0))}.bind(this)),this.$content.on("rowselect",function(t){return!(t.args.originalEvent&&t.args.originalEvent.cancel||(this.emit("row-select",{data:this.source.localdata[t.args.rowindex],index:t.args.rowindex}),0))}.bind(this)),this.$content.on("rowunselect",function(t){return!(t.args.originalEvent&&t.args.originalEvent.cancel||(this.emit("row-unselect",{data:this.source.localdata[t.args.rowindex],index:t.args.rowindex}),0))}.bind(this))},c.prototype._registerAllListeners=function(t){var e=this.$content;_.forEach(["mousedown","click","change","dblclick","keydown","keyup"],function(n){e.on(n,function(e){e.preventDefault(),e.stopPropagation();var r=n+"__key__",i=(e.originalEvent||e.args.originalEvent).target.getAttribute(r);return t[n]&&t[n][i]&&(e.cancel=!0,e.data=t[n][i].data,e.index=t[n][i].index,t[n][i].fn(e)),!1})})},c.prototype.getSelectedRows=function(){var t=this.$content.jqxGrid("getselectedrowindexes");return _.map(t,function(t){return this.source.localdata[t]}.bind(this))},l.prototype=Object.create(a.prototype),l.prototype.constructor=l,l.prototype.setItems=function(t){throw new Error("not implemented")},l.prototype.getItems=function(){throw new Error("not implemented")},l.prototype.getSelectedItem=function(){throw new Error("not implemented")},l.prototype.isSelected=function(){throw new Error("not implemented")},l.prototype.isOpened=function(){throw new Error("not implemented")},l.prototype.open=function(){throw new Error("not implemented")},l.prototype.close=function(){throw new Error("not implemented")},l.prototype.enable=function(){throw new Error("not implemented")},l.prototype.disable=function(){throw new Error("not implemented")},u.prototype=Object.create(l.prototype),u.prototype.constructor=u,u.prototype._initEventListener=function(){this.$el.on("open",function(t){this.emit("open",t)}.bind(this)),this.$el.on("close",function(t){this.emit("close",t)}.bind(this)),this.$el.on("select",function(t){this.emit("select",t)}.bind(this))},u.prototype._getAutoDropDownHeight=function(t){return!(t.itemHeight*t.source.length>t.dropDownHeight)},u.prototype._brtcOptions2jqxOptions=function(t){var e={theme:"office"};return e.width=t.width||"100%",e.itemHeight=t.itemHeight||30,e.height=e.itemHeight,e.dropDownHeight=t.height||300,this.renderer=this._getRenderer(t.renderer),e.placeHolder=void 0!==t.placeHolder?t.placeHolder:"choose",this.data=t.data||[],e.source=this._getRenderedData(this.data),e.autoDropDownHeight=this._getAutoDropDownHeight(e),e},u.prototype._getRenderer=function(t){return t||function(t){return t}},u.prototype._getRenderedData=function(t){return _.map(t,this.renderer)},u.prototype.render=function(){return this.$el.jqxDropDownList(this.jqxOptions),this},u.prototype.setItems=function(t){return this.data=t,this.jqxOptions.source=this._getRenderedData(this.data),this.jqxOptions.autoDropDownHeight=this._getAutoDropDownHeight(this.jqxOptions),this.$el.jqxDropDownList({source:this.jqxOptions.source}),this},u.prototype.getItems=function(){return this.data},u.prototype.getSelectedItem=function(){if(!this.isSelected())throw new Error("not selected");return this.data[this.$el.jqxDropDownList("selectedIndex")]},u.prototype.isSelected=function(){return this.$el.jqxDropDownList("selectedIndex")>-1},u.prototype.isOpened=function(){return this.$el.jqxDropDownList("isOpened")},u.prototype.open=function(){return this.$el.jqxDropDownList("open"),this},u.prototype.close=function(){return this.$el.jqxDropDownList("close"),this},u.prototype.enable=function(){return this.$el.jqxDropDownList({disabled:!1}),this},u.prototype.disable=function(){return this.$el.jqxDropDownList({disabled:!0}),this},u.prototype.focus=function(){return this.$el.jqxDropDownList("focus"),this};var p={createListControl:function(t,e){return new c(t,e)},createDropdownControl:function(t,e){return new u(t,e)}},d={Wrapper:{ListWrapper:s,JqxListWrapper:c,DropdownWrapper:l,JqxDropdownWrapper:u},Base:a,ControlFactory:p},h=function(t){return Promise.resolve($.ajax(t))},f=function(t){return h({type:"GET",url:t})},g=function(t,e){var n={type:"POST",data:JSON.stringify(e),contentType:"application/json; charset=utf-8",url:t};return h(n)},v=function(t,e){var n={type:"POST",data:JSON.stringify(e),contentType:"application/json; charset=utf-8",url:t,async:!1};return h(n)},y=function(t){t.contents=Brightics.VA.Core.Utils.ModelUtils.extendModel(t.contents);var e=Object.keys(Brightics.VA.Core.Interface.Clazz);void 0!==t&&e.indexOf(t.contents.type)<0||(t.contents.title=t.label,t.contents.mid=t.id,t.contents.adjustLinks())},m=function(t){t.contents=Brightics.VA.Core.Utils.ModelUtils.extendModel(t.contents);var e=Object.keys(Brightics.VA.Core.Interface.Clazz);"undefined"!=typeof file&&e.indexOf(t.contents.type)<0||(t.contents.title=t.label,t.contents.mid=t.file_id,t.contents.version_id=t.version_id,t.contents.adjustLinks())},b=0,C=function(t){b=b||new Brightics.VA.Core.Tools.ModelMigrator.Executor;try{b.migrate(t)}catch(t){throw console.error(t),new Error("Migration failed.")}};function w(){}w.prototype.equals=function(t){throw new Error("not implemented")},w.prototype.getHashCode=function(){throw new Error("not implemented")},w.prototype.toJSON=function(){throw new Error("not implemented")},w.prototype.getResourceName=function(){throw new Error("not implemented")};var I=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t};function A(t){this.data=t||{},this.data.update_time&&(this.data.update_time=new Date(moment(this.data.update_time).format())),this.data.create_time&&(this.data.create_time=new Date(moment(this.data.create_time).format())),this.data.contents?(y(this.data),C(this.data.contents)):this.data.contents={}}I(A,w),A.prototype.getFileId=function(){return this.data.id},A.prototype.setFileId=function(t){return this.data.id=t,this.data.contents.mid=t,this},A.prototype.getDescription=function(){return this.data.description},A.prototype.setDescription=function(t){return this.data.description=t,this},A.prototype.getType=function(){return this.data.type},A.prototype.setType=function(t){return this.data.type=t,this},A.prototype.getEventKey=function(){return this.data.event_key},A.prototype.setEventKey=function(t){return this.data.event_key=t,this},A.prototype.getLabel=function(){return this.data.label},A.prototype.setLabel=function(t){return this.data.label=t,this.data.contents.title=t,this},A.prototype.getProjectId=function(){return this.data.project_id},A.prototype.setProjectId=function(t){return this.data.project_id=t,this},A.prototype.getUpdateTime=function(){return new Date(this.data.update_time)},A.prototype.setUpdateTime=function(t){return this.data.update_time=t,this},A.prototype.getCreateTime=function(){return new Date(this.data.create_time)},A.prototype.setCreateTime=function(t){return this.data.create_time=t,this},A.prototype.getUpdater=function(){return this.data.updater},A.prototype.setUpdater=function(t){return this.data.updater=t,this},A.prototype.getCreator=function(){return this.data.creator},A.prototype.setCreator=function(t){return this.data.creator=t,this},A.prototype.getFromVersion=function(){return this.data.from_version},A.prototype.setFromVersion=function(t){return this.data.from_version=t,this},A.prototype.getModelImage=function(){return this.data.model_image},A.prototype.setModelImage=function(t){return this.data.model_image=t,this},A.prototype.setContents=function(t){return this.data.contents=t,this.data.contents.title=this.data.label,y(this.data),C(this.data.contents),this},A.prototype.getContents=function(t){return this.data.contents},A.prototype.toJSON=function(){return this.data},A.prototype.getHashCode=function(){return this.getFileId()},A.prototype.equals=function(t){return this.getFileId()==t.getFileId()&&this.getEventKey()==t.getEventKey()&&Number(this.getUpdateTime())==Number(t.getUpdateTime())},A.prototype.getResourceName=function(){return"file"},A.prototype.getInnerModels=function(){return this.data.contents.innerModels},A.prototype.getInnerModel=function(t){if(this.data.contents.innerModels)return this.data.contents.innerModels[t]},A.prototype.getParam=function(){return this.data.contents.param},A.prototype.setParam=function(t,e){this.data.contents.param[t]=e};var x=n(4),T=n.n(x);const{map:D,compact:V,first:E,flow:F}=_,U=t=>{try{return new A(t)}catch(t){return void console.warn("Some files are ignored.")}},B=t=>V(D(t,U)),O=F(E,U),j={getFiles:function(t){return f(`api/va/v2/ws/projects/${t}/files`).then(B)},getFile:function(t,e){return f(`api/va/v2/ws/projects/${t}/files/${e}`).then(t=>t.length?O(t):null)},addFile:function(t,e){return g(`api/va/v2/ws/projects/${t}/files`,e.toJSON())},updateFile:function(t,e){const n=`api/va/v2/ws/projects/${t}/files/${e.getFileId()}/update`;return g(n,e.toJSON()).then(O)},updateFileSync:function(t,e){const n=`api/va/v2/ws/projects/${t}/files/${e.getFileId()}/update`;return v(n,e.toJSON()).then(O)},deleteFile:function(t,e){return g(`api/va/v2/ws/projects/${t}/files/${e}/delete`)},saveFileSync:function(t,e,n){const r=`api/va/v2/ws/projects/${t}/files/${e.getFileId()}/save`,i=(o=e.getContents(),JSON.parse(JSON.stringify(o)));var o;const a=Object.assign(_.omit(e.toJSON(),"contents"),{modelDiff:n,hash:T()(i,{respectFunctionProperties:!1,respectFunctionNames:!1,respectType:!1})});return v(r,a).then(E)}};function S(t){this.data=t||{}}I(S,w),S.prototype.getProjectId=function(){return this.data.id},S.prototype.setProjectId=function(t){return this.data.id=t,this},S.prototype.getLabel=function(){return this.data.label},S.prototype.setLabel=function(t){return this.data.label=t,this},S.prototype.getUpdateTime=function(){return new Date(moment(this.data.update_time).format())},S.prototype.setUpdateTime=function(t){return this.data.update_time=t,this},S.prototype.getCreateTime=function(){return new Date(moment(this.data.create_time).format())},S.prototype.setCreateTime=function(t){return this.data.create_time=t,this},S.prototype.getCreator=function(){return this.data.creator},S.prototype.setCreator=function(t){return this.data.creator=t,this},S.prototype.getUpdater=function(){return this.data.updater},S.prototype.setUpdater=function(t){return this.data.updater=t,this},S.prototype.getDescription=function(){return this.data.description},S.prototype.setDescription=function(t){return this.data.description=t,this},S.prototype.getModelCount=function(){return parseInt(this.data.model_count)},S.prototype.setModelCount=function(t){return this.data.model_count=t,this},S.prototype.getReportCount=function(){return parseInt(this.data.report_count)},S.prototype.setReportCount=function(t){return this.data.report_count=t,this},S.prototype.getTag=function(){return this.data.tag},S.prototype.setTag=function(t){return this.data.tag=t,this},S.prototype.getType=function(){return this.data.type},S.prototype.setType=function(t){return this.data.type=t,this},S.prototype.toJSON=function(){return this.data},S.prototype.equals=function(t){return this.getProjectId()==t.getProjectId()&&Number(this.getUpdateTime())==Number(t.getUpdateTime())},S.prototype.getHashCode=function(){return this.getProjectId()},S.prototype.getResourceName=function(){return"project"};var k=function(t){return new S(t)},M=function(t){return _.map(t,k)},P={getProjects:function(){return f("api/va/v2/ws/projects").then(M)},getProject:function(t){return f("api/va/v2/ws/projects/"+t).then(function(t){return k(t[0])})},addProject:function(t){return g("api/va/v2/ws/projects",t.toJSON()).then(k)},updateProject:function(t){var e="api/va/v2/ws/projects/"+t.getProjectId()+"/update";return g(e,t.toJSON()).then(k)},deleteProject:function(t){return g("api/va/v2/ws/projects/"+t+"/delete")}};function N(t){this.data=t||{},this.data.contents?(m(this.data),C(this.data.contents)):this.data.contents={}}I(N,w),N.prototype.getVersionId=function(){return this.data.version_id},N.prototype.setVersionId=function(t){return this.data.version_id=t,this.data.contents.version_id=t,this},N.prototype.getLabel=function(){return this.data.label},N.prototype.setLabel=function(t){return this.data.label=t,this.data.contents.title=t,this},N.prototype.getDescription=function(){return this.data.description},N.prototype.setDescription=function(t){return this.data.description=t,this},N.prototype.getFileId=function(){return this.data.file_id},N.prototype.setFileId=function(t){return this.data.file_id=t,this.data.contents.mid=t,this},N.prototype.getMajorVersion=function(){return this.data.major_version},N.prototype.setMajorVersion=function(t){return this.data.major_version=t,this},N.prototype.getMinorVersion=function(){return this.data.minor_version},N.prototype.setMinorVersion=function(t){return this.data.minor_version=t,this},N.prototype.getVersion=function(){return this.data.major_version+"."+this.data.minor_version},N.prototype.getType=function(){return this.data.type},N.prototype.setType=function(t){return this.data.type=t,this},N.prototype.getTags=function(){return this.data.tags},N.prototype.setTags=function(t){return this.data.tags=t,this},N.prototype.getModelImage=function(){return this.data.model_image},N.prototype.setModelImage=function(t){return this.data.image=t,this},N.prototype.getUpdateTime=function(){return new Date(moment(this.data.update_time).format())},N.prototype.setUpdateTime=function(t){return this.data.update_time=t,this},N.prototype.getUpdater=function(){return this.data.updater},N.prototype.setUpdater=function(t){return this.data.updater=t,this},N.prototype.getCreateTime=function(){return new Date(moment(this.data.create_time).format())},N.prototype.setCreateTime=function(t){return this.data.create_time=t,this},N.prototype.getCreator=function(){return this.data.creator},N.prototype.setCreator=function(t){return this.data.creator=t,this},N.prototype.getContents=function(){return this.data.contents},N.prototype.setContents=function(t){return this.data.contents=t,m(this.data),C(this.data.contents),this},N.prototype.toJSON=function(t){return t?this.data:_.omit(this.data,["isManual","isMajor"])},N.prototype.setIsMajor=function(t){return this.data.isMajor=t,this},N.prototype.setIsManual=function(t){return this.data.isManual=t,this},N.prototype.compareToByVersion=function(t){return this.getMajorVersion()!==t.getMajorVersion()?this.getMajorVersion()-t.getMajorVersion():this.getMinorVersion()-t.getMinorVersion()},N.prototype.equals=function(t){return this.getVersionId()===t.getVersionId()&&Number(this.getUpdateTime())===Number(t.getUpdateTime())},N.prototype.getHashCode=function(){return this.getVersionId()},N.prototype.getResourceName=function(){return"version"};var L=function(t){return new N(t)},R=function(t){return _.map(t,L)},W={getVersions:function(t,e){return f("api/va/v2/ws/projects/"+t+"/files/"+e+"/versions").then(R)},getVersion:function(t,e,n){return f("api/va/v2/ws/projects/"+t+"/files/"+e+"/versions/"+n).then(L)},addVersion:function(t,e,n){return g("api/va/v2/ws/projects/"+t+"/files/"+e+"/versions",n.toJSON(!0)).then(L)},updateVersion:function(t,e,n){var r="api/va/v2/ws/projects/"+t+"/files/"+e+"/versions/"+n.getVersionId()+"/update";return g(r,n)},loadVersion:function(t,e,n){return g("api/va/v2/ws/projects/"+t+"/files/"+e+"/versions/"+n+"/load").then(function(t){if(t.length)return new A(t[0])})},getVersionsForced:function(t,e,n,r){var i={type:"GET",blocking:!0,async:!1,url:"api/va/v2/ws/projects/"+t+"/files/"+e+"/versions",contentType:"application/json; charset=utf-8"};return $.ajax(i).done(function(t){if(n&&"function"==typeof n)return n(R(t))}).fail(function(t){if(r&&"function"==typeof r)return r(t)})},getVersionForced:function(t,e,n,r,i){var o={type:"GET",blocking:!0,async:!1,url:"api/va/v2/ws/projects/"+t+"/files/"+e+"/versions/"+n,contentType:"application/json; charset=utf-8"};return $.ajax(o).done(function(t){if(r&&"function"==typeof r)return r(L(t))}).fail(function(t){if(i&&"function"==typeof i)return i(t)})}},q=function(t){return f("api/admin/v2/s3/"+t)},G={DB:{getDbTypes:function(){return f("api/admin/v2/datasources/dbtype")},getDatasources:function(){return f("api/admin/v2/datasources")},getDatasource:function(t){return f("api/admin/v2/datasources/"+t)},addDatasource:function(t){var e="api/admin/v2/datasources/"+t.datasourceName;return g(e,t)},updateDatasource:function(t){var e="api/admin/v2/datasources/"+t.datasourceName+"/update";return g(e,t)},deleteDatasource:function(t){return g("api/admin/v2/datasources/"+t+"/delete")}},Cloud:{getS3s:function(){return f("api/admin/v2/s3")},getS3:q,addS3:function(t){var e="api/admin/v2/s3/"+t.datasourceName;return q(t.datasourceName).then(function(n){if(n)throw{errors:[{code:500,message:"Datasource name already exists."}]};return g(e,t)})},updateS3:function(t){var e="api/admin/v2/s3/"+t.datasourceName+"/update";return g(e,t)},deleteS3:function(t){return g("api/admin/v2/s3/"+t+"/delete")}}};function H(){this.map={},this.chk={}}function K(t,e){o.call(this),this.key=t,this.data=e,this.__parentNode=this,this.__childrenNodes=[],this.__childrenMap=new H}function z(){this.__root=new K}H.prototype.set=function(t,e){this.map[t]=e,this.chk[t]=!0},H.prototype.get=function(t){return this.map[t]},H.prototype.remove=function(t){var e=this.map[t];return this.chk[t]=!1,delete this.map[t],e},H.prototype.has=function(t){return this.chk[t]},H.prototype.toArray=function(){return _.toArray(this.map)},H.prototype.toJSON=function(){return this.map},I(K,o),K.prototype.hasChild=function(t){return this.__childrenMap.has(t)},K.prototype.setData=function(t){return this.data=t,this},K.prototype.getData=function(){return this.data},K.prototype.getKey=function(){return this.key},K.prototype.setParent=function(t){this.__patrentNode=t},K.prototype.getParent=function(){return this.__parentNode},K.prototype.addChild=function(t,e){if(this.__childrenMap.has(t))return this.__childrenMap.get(t).setData(e);var n=new K(t,e);return n.setParent(this),this.__childrenMap.set(t,n),this.__childrenNodes.push(n),n},K.prototype.deleteChild=function(t){var e=this.__childrenMap.remove(t);return _.remove(this.__childrenNodes,function(e){return e.getKey()==t}),e},K.prototype.updateChild=function(t,e){return this.__childrenMap.get(t).setData(e)},K.prototype.getChildren=function(){return _.map(this.__childrenNodes,function(t){return t.getData()})},K.prototype.getChildrenNodes=function(){return this.__childrenNodes},K.prototype.getChildrenMap=function(){return _.forIn(this.__childrenMap.toJSON(),function(t){return t.getData()})},K.prototype.go=function(t){return this.__childrenMap.get(t)},K.prototype.getChild=function(t){return this.__childrenMap.get(t)},K.prototype.findChildNodeBruteForce=function(t){var e=_.findIndex(this.__childrenNodes,function(e){return t(e)});return e>-1?this.__childrenNodes[e]:null},I(z,o),z.prototype.getRootNode=function(){return this.__root},z.prototype.getProjectNode=function(t){return this.__root.go(t)},z.prototype.getProjectNodeBruteForce=function(t){return this.getRootNode().findChildNodeBruteForce(t)},z.prototype.getProjectNodeByFileId=function(t){return this.getProjectNodeBruteForce(function(e){return e.hasChild(t)})},z.prototype.getFileNode=function(t,e){return t?this.getProjectNode(t).go(e):(console.warn("NO PROJECT ID"),this.getProjectNodeByFileId(e).go(e))},z.prototype.getVersionNode=function(t,e,n){return this.getFileNode(t,e).go(n)},z.prototype.getProjectMap=function(){return this.getRootNode().getChildrenMap()},z.prototype.getProjectArray=function(){return this.getRootNode().getChildren()},z.prototype.getFileMap=function(t){return this.getProjectNode(t).getChildrenMap()},z.prototype.getFileArray=function(t){return this.getProjectNode(t).getChildren()},z.prototype.getVersionMap=function(t,e){return this.getFileNode(t,e).getChildrenMap()},z.prototype.getVersionArray=function(t,e){return this.getFileNode(t,e).getChildren()},z.prototype.getProjects=function(){try{return this.getRootNode().getChildren()}catch(t){return}},z.prototype.getProject=function(t){var e=this.getProjectNode(t);if(e)return e.getData()},z.prototype.getFiles=function(t){try{return this.getProjectNode(t).getChildren()}catch(t){return}},z.prototype.getFile=function(t,e){try{return this.getFileNode(t,e).getData()}catch(t){return}},z.prototype.getVersions=function(t,e){try{return this.getFileNode(t,e).getChildren()}catch(t){return}},z.prototype.getVersion=function(t,e,n){try{return this.getVersionNode(t,e,n).getData()}catch(t){return}},z.prototype.updateProject=function(t){return this.getProjectNode(t.getProjectId()).setData(t)},z.prototype.updateFile=function(t,e){return this.getFileNode(t,e.getFileId()).setData(e)},z.prototype.updateVersion=function(t,e,n){return this.getVersionNode(t,e,n.getVersionId()).setData(n)},z.prototype.addProject=function(t){return this.getRootNode().addChild(t.getProjectId(),t)},z.prototype.addFile=function(t,e){return this.getProjectNode(t).addChild(e.getFileId(),e)},z.prototype.addVersion=function(t,e,n){return this.getFileNode(t,e).addChild(n.getVersionId(),n)},z.prototype.deleteProject=function(t){return this.getRootNode().deleteChild(t).getData()},z.prototype.deleteFile=function(t,e){return this.getProjectNode(t).deleteChild(e).getData()},z.prototype.deleteVersion=function(t,e,n){return this.getFileNode(t,e).deleteChild(n).getData()};var J=function(t){return _.reduce(t,function(t,e){return t.then(function(t){return e(t)})},Promise.resolve())},Y=function(t){return Promise.all(_.map(t,function(t){return t()}))},Z=function(t,e){return _.forEach(t,e)};function Q(){this.validateVersion={3.5:this.validateVersion3_5,3.6:this.validateVersion3_5}}Q.prototype.getValidateFunction=function(t){return this.validateVersion[t]||this.validateLegacy},Q.prototype.validate=function(t,e){return this.getValidateFunction(t.version)(t,e)},Q.prototype.validateLegacy=function(t,e){var n="Invalid Model File.",r="",i=["data","control","visual","deeplearning"];"Report"===e&&(n="Invalid Report File.");try{if(t instanceof Array){var o=[];for(var a in t){if(void 0===t[a].mid||-1===i.indexOf(t[a].type)){r=n;break}"visual"===t[a].type&&o.push(t[a])}("Report"===e&&0===o.length||"Model"===e&&o.length>0)&&(r=n)}else void 0===t.mid?r=t.jid?"Runnable Model File.":n:("Report"===e&&"visual"!==t.type||"Model"===e&&"visual"===t.type||-1===i.indexOf(t.type))&&(r=n);return r}catch(t){return"Invalid Model(.json) File."}},Q.prototype.validateVersion3_5=function(t,e){var n="";return t.main&&t.models?n="Runnable Model File.":0===t.data.length?n="Invalid Model File.":"project"===t.type&&(n="Project File."),n};var X=new Q,tt="project:add",et="project:change",nt="project:delete",rt="file:add",it="file:change",ot="file:delete",at="version:add",st="version:change",ct="version:delete";function lt(){o.call(this),this.projectTree=new z}I(lt,o),lt.prototype.initProject=function(t){var e=this;return this.fetchFiles(t.getProjectId()).then(function(t){return Promise.all(_.map(t,e.initFile.bind(e)))})},lt.prototype.initFile=function(t){return this.fetchVersions(t.getProjectId(),t.getFileId())},lt.prototype._getResourceDiff=function(t,e){var n=_.compact(_.flatten(t)),r=new H,i=[];return Z(n,function(t){r.set(t.getHashCode(),t)}),Z(e,function(t){var e=t.getHashCode();r.has(e)?(r.get(e).equals(t)||i.push({type:"change",data:t}),r.remove(e)):i.push({type:"add",data:t})}),Z(r.toArray(),function(t){i.push({type:"delete",data:t})}),i},lt.prototype._syncProject=function(t){var e=this;Z(t,function(t){var n=t.data;"add"==t.type&&e._addProject(n),"change"==t.type&&e._updateProject(n),"delete"==t.type&&e._deleteProject(n.getProjectId())})},lt.prototype._syncFile=function(t){var e=this;Z(t,function(t){var n=t.data;"add"==t.type&&e._addFile(n.getProjectId(),n),"change"==t.type&&e._updateFile(n.getProjectId(),n),"delete"==t.type&&e._deleteProject(n.getProjectId(),n.getFileId())})},lt.prototype._syncVersion=function(t){var e=this;Z(t,function(t){var n=t.data,r=e.projectTree.getProjectNodeByFileId(n.getFileId()).getData().getProjectId();"add"==t.type&&e._addVersion(r,n.getFileId(),n),"change"==t.type&&e._updateVersion(r,n.getFileId(),n)})},lt.prototype._updateProject=function(t){this.projectTree.updateProject(t),this.emit(et,t)},lt.prototype._addProject=function(t){this.projectTree.addProject(t),this.emit(tt,t)},lt.prototype._deleteProject=function(t){var e=this.projectTree.deleteProject(t);return this.emit(nt,e),e},lt.prototype._updateFile=function(t,e){return this.projectTree.updateFile(t,e),this.emit(it,e),e},lt.prototype._addFile=function(t,e){return this.projectTree.addFile(t,e),this.emit(rt,e),e},lt.prototype._deleteFile=function(t,e){var n=this.projectTree.deleteFile(t,e);return this.emit(ot,n),n},lt.prototype._updateVersion=function(t,e,n){return this.projectTree.updateVersion(t,e,n),this.emit(st,n),n},lt.prototype._addVersion=function(t,e,n){return this.projectTree.addVersion(t,e,n),this.emit(at,n),n},lt.prototype._deleteVersion=function(t,e,n){var r=this.projectTree.addVersion(t,e,n);return this.emit(ct,r),r},lt.prototype.fetchProject=function(t){var e=this;return P.getProject(t).then(function(n){var r=e.projectTree.getProject(t);return e._syncProject(e._getResourceDiff([r],[n])),n}).catch(function(t){throw console.error(t),new Error("failed to fetch project")})},lt.prototype.fetchProjects=function(){var t=this;return P.getProjects().then(function(e){var n=t.projectTree.getProjects();return t._syncProject(t._getResourceDiff([n],e)),e}).catch(function(t){throw new Error("failed to fetch projects")})},lt.prototype.fetchFiles=function(t){var e=this;return j.getFiles(t).then(function(n){var r=e.projectTree.getFiles(t);return e._syncFile(e._getResourceDiff([r],n)),n})},lt.prototype.fetchFile=function(t,e){var n=this;return j.getFile(t,e).then(function(r){var i=n.projectTree.getFile(t,e);return n._syncFile(n._getResourceDiff([i],[r])),r}).catch(function(t){throw new Error("filed to fetch file")})},lt.prototype.fetchVersions=function(t,e){var n=this;return W.getVersions(t,e).then(function(t){var r=n.projectTree.getProjectNodeByFileId(e).getData().getProjectId(),i=n.projectTree.getVersions(r,e);return n._syncVersion(n._getResourceDiff([i],t)),t}).catch(function(t){throw new Error("failed to fetch versions")})},lt.prototype.fetchVersion=function(t,e,n){var r=this;return W.getVersion(t,e,n).then(function(i){var o=r.projectTree.getVersion(t,e,n);return r._syncVersion(r._getResourceDiff([o],[i])),i}).catch(function(t){throw new Error("filed to fetch version")})},lt.prototype.build=function(){var t=this;return this.fetchProjects().then(function(e){return Promise.all(_.map(e,t.initProject.bind(t)))})},lt.prototype.getProjects=function(){return this.projectTree.getProjects()},lt.prototype.getProject=function(t){return this.projectTree.getProject(t)},lt.prototype.addProject=function(t){var e=this;return P.addProject(t).then(function(){return e._addProject(t),t}).catch(function(t){throw console.error(t),t})},lt.prototype.updateProject=function(t){var e=this;return P.updateProject(t).then(function(){return e._updateProject(t),t}).catch(function(t){throw console.error(t),t})},lt.prototype.deleteProject=function(t){var e=this;return P.deleteProject(t).then(function(){return e._deleteProject(t)}).catch(function(t){throw console.error(t),t})},lt.prototype.getFiles=function(t){return this.projectTree.getFiles(t)},lt.prototype.getFilesByModelType=function(t,e){return _.filter(this.getFiles(t),function(t){return t.getContents().type==e})},lt.prototype.getFile=function(t,e){return this.projectTree.getFile(t,e)},lt.prototype.addFile=function(t,e){var n=this;return j.addFile(t,e).then(function(){return n._addFile(t,e),e}).catch(function(t){throw console.error(t),t})},lt.prototype.updateFile=function(t,e){var n=this;return this.lastQuery=this.lastQuery||Promise.resolve(),this.lastQuery=this.lastQuery.then(function(){return new Promise(function(r,i){j.updateFileSync(t,e).then(function(i){e.setEventKey(i.getEventKey()),e.setUpdateTime(i.getUpdateTime()),n._updateFile(t,e),r([null,e])}).catch(function(t){console.error(t),r([t,e])})})}),this.lastQuery},lt.prototype.saveFile=function(t,e,n){return this.lastQuery=this.lastQuery||Promise.resolve(),this.lastQuery=this.lastQuery.then(()=>j.saveFileSync(t,e,n).then(n=>{if(n){const{event_key:r,update_time:i}=n;return e.setEventKey(r),e.setUpdateTime(i),this._updateFile(t,e),e}return new Promise(n=>{j.updateFileSync(t,e).then(r=>{e.setEventKey(r.getEventKey()),e.setUpdateTime(r.getUpdateTime()),this._updateFile(t,e),n([null,e])}).catch(function(t){console.error(t),n([t,e])})})}).catch(function(t){throw console.error(t),t})),this.lastQuery},lt.prototype.deleteFile=function(t,e){var n=this;return j.deleteFile(t,e).then(function(){return n._deleteFile(t,e)}).catch(function(t){throw console.error(t),t})},lt.prototype.getVersions=function(t,e){return this.projectTree.getVersions(t,e)},lt.prototype.getVersion=function(t,e,n){return this.projectTree.getVersion(t,e,n)},lt.prototype.addVersion=function(t,e,n){var r=this;return W.addVersion(t,e,n).then(function(n){return r._addVersion(t,e,n),n}).catch(function(t){throw console.error(t),t})},lt.prototype.updateVersion=function(t,e,n){var r=this;return W.updateVersion(t,e,n).then(function(){return r._updateVersion(t,e,n),n}).catch(function(t){throw console.error(t),t})},lt.prototype.loadVersion=function(t,e,n){var r=this;return W.loadVersion(t,e,n).then(function(e){return r._updateFile(t,e),e}).catch(function(t){throw console.error(t),t})},lt.prototype.validateFile=function(t,e){return X.validate(t,e)};var ut=new lt;const pt="table",dt={"1.0":{in:{data:"inData"},out:{data:"outData"}},3.5:{in:{data:"inData"},out:{data:"outData"}},3.6:{in:{data:"inputs"},out:{data:"outputs"}}};function ht(){o.call(this)}I(ht,o),ht.prototype.getMeta=function(t){return t.meta?t.meta:void 0},ht.prototype.getVersion=function(t){return t.version?t.version:"1.0"},ht.prototype._getVersionPath=function(t){var e=this.getVersion(t);return dt[e]},ht.prototype._getPath=function(t,e,n){var r=this._getVersionPath(t);return Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(r,[e,n])},ht.prototype.getInputs=function(t){var e=this._getPath(t,"in","data");return Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(t,e)},ht.prototype.getOutputs=function(t){var e=this._getPath(t,"out","data");return Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(t,e)},ht.prototype.getInputsToObject=function(t){if(!t)return{};var e={},n=this.getInputs(t);if(this.hasMeta(t))for(var r in n)e[n[r]]=r;else{var i=this.getLabel(t);for(var o in n)e[n[o]]="["+o+"]"+i}return e},ht.prototype.getOutputsToObject=function(t){if(!t)return{};var e={},n=this.getOutputs(t);if(this.hasMeta(t))for(var r in n)if(Array.isArray(n[r]))for(var i in n[r])e[n[r][i]]=r;else e[n[r]]=r;else{var o=this.getLabel(t);for(var i in n)e[n[i]]="["+i+"]"+o}return e},ht.prototype.getInData=function(t,e){var n=[],r=this.getMeta(t),i=this.getInputs(t);if(r)for(var o in i)i[o]&&(e?r[o].type===e&&(n=n.concat(i[o])):n=n.concat(i[o]));else e?e===pt&&(n=i):n=i;return n},ht.prototype.getOutData=function(t,e){var n=[],r=this.getMeta(t),i=this.getOutputs(t);if(r)for(var o in i)i[o]&&(e?r[o].type===e&&(n=n.concat(i[o])):n=n.concat(i[o]));else e?e===pt&&(n=i):n=i;return n},ht.prototype._getData=function(t){var e=t=>_.isUndefined(t)?[]:_.isString(t)?[t]:_.isArray(t)?t.map(t=>e(t)):Object.values(t).map(t=>e(t));return _.compact(_.flattenDeep([e(t.inputs||[]),e(t.outputs||[])]))},ht.prototype.getAllData=function(t){return _.union(this.getInData(t),this.getOutData(t),this._getData(t))},ht.prototype.getData=function(t,e){return"in"===e?this.getInData(t):this.getOutData(t)},ht.prototype.getInputTypes=function(t){var e=this.getMeta(t);if(!e)return[pt];var n=[],r=this.getInputs(t);for(var i in r)n.indexOf(e[i].type)<0&&n.push(e[i].type);return n},ht.prototype.getOutputTypes=function(t){var e=this.getMeta(t);if(!e)return[pt];var n=[],r=this.getOutputs(t);for(var i in r)n.indexOf(e[i].type)<0&&n.push(e[i].type);return n},ht.prototype.getTypes=function(t,e){return"in"===e?this.getInputTypes(t):this.getOutputTypes(t)},ht.prototype.getKeyByTableId=function(t,e){if(!t)return"";if(!this.getMeta(t))return"";var n=_.assign({},this.getInputs(t),this.getOutputs(t));for(var r in n)if(n[r].indexOf(e)>-1)return r},ht.prototype.getTypeByTableId=function(t,e){if(!t)return"";var n=this.getMeta(t);if(!n)return pt;var r=_.assign({},this.getInputs(t),this.getOutputs(t));for(var i in r)if(r[i].indexOf(e)>-1)return n[i].type;return""},ht.prototype.getTypeByKey=function(t,e){if(!t)return"";var n=this.getMeta(t);return n?n[e].type:pt},ht.prototype.getInTable=function(t){var e=[],n=this.getMeta(t);if(n){var r=this.getInputs(t);for(var i in r)r[i]&&n[i].type===pt&&r[i]&&(e=e.concat(r[i]))}else e=t[IN_DATA];return e},ht.prototype.getInTableByKeys=function(t,e){var n=[],r=this.getMeta(t);if(r){var i,o=this.getInputs(t);for(let t=0;t<e.length;t++)o[i=e[t]]&&r[i].type===pt&&o[i]&&(n=n.concat(o[i]))}return n},ht.prototype.getOutTable=function(t){var e=[],n=this.getMeta(t);if(n){var r=this.getOutputs(t);for(var i in r)r[i]&&n[i].type===pt&&r[i]&&(e=e.concat(r[i]))}else e=t[OUT_DATA];return e},ht.prototype.getInModel=function(t){var e=[],n=this.getMeta(t);if(n){var r=this.getInputs(t);for(var i in r)r[i]&&"model"===n[i].type&&r[i]&&(e=e.concat(r[i]))}return e},ht.prototype.getOutModel=function(t){var e=[],n=this.getMeta(t);if(n){var r=this.getOutputs(t);for(var i in r)r[i]&&"model"===n[i].type&&r[i]&&(e=e.concat(r[i]))}return e},ht.prototype.getInImage=function(t){var e=[],n=this.getMeta(t);if(n){var r=this.getInputs(t);for(var i in r)r[i]&&"image"===n[i].type&&r[i]&&(e=e.concat(r[i]))}return e},ht.prototype.getOutImage=function(t){var e=[],n=this.getMeta(t);if(n){var r=this.getOutputs(t);for(var i in r)r[i]&&"image"===n[i].type&&r[i]&&(e=e.concat(r[i]))}return e},ht.prototype.getPreviousFnUnits=function(t){var e=this,n=[],r=this.getParent(t),i=r.getPrevious(t.fid);return _.forEach(i,function(t){var i=r.getFnUnitById(t),o=e.isProcessFunction(i)?r.getAllPreviousFnUnits(i.fid):[i];n=_.union(n,o)}),n},ht.prototype.getLinkedTable=function(t){var e=this,n=[],r=this.getPreviousFnUnits(t);return _.forEach(r,function(t){n=n.concat(e.getOutTable(t))}),n},ht.prototype.getTable=function(t,e){return"in"===e?this.getInTable(t):this.getOutTable(t)},ht.prototype.getModel=function(t,e){return"in"===e?this.getInModel(t):this.getOutModel(t)},ht.prototype.getImage=function(t,e){return"in"===e?this.getInImage(t):this.getOutImage(t)},ht.prototype.hasMeta=function(t){return!!t.meta},ht.prototype.hasInput=function(t){var e=this._getPath(t,"in","data");return!!Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(t,e)},ht.prototype.hasOutput=function(t){var e=this._getPath(t,"out","data");return!!Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(t,e)},ht.prototype.getInRange=function(t){var e={},n=this.getMeta(t);if(n){var r=this.getInputs(t);for(var i in r){var o=n[i].type;e[o]||(e[o]={min:0,max:0}),n[i].range?(e[o].min+=n[i].range.min,e[o].max+=n[i].range.max):(e[o].min+=1,e[o].max+=1)}}else{var a=Brightics.VA.Core.Utils.WidgetUtils.getFunctionLibrary("data",t.func);e[pt]=a["in-range"]}return e},ht.prototype.getOutRange=function(t){var e={},n=this.getMeta(t);if(n){var r=this.getOutputs(t);for(var i in r){var o=n[i].type;e[o]||(e[o]={min:1,max:1}),n[i].range&&(e[o].min=n[i].range.min,e[o].max=n[i].range.max)}}else{var a=Brightics.VA.Core.Utils.WidgetUtils.getFunctionLibrary("data",t.func);e[pt]=a["out-range"]}return e},ht.prototype.getTotalInRangeCount=function(t){var e={min:0,max:0},n=this.getInRange(t);for(var r in n)e.min+=n[r].min,e.max+=n[r].max;return e},ht.prototype.getTotalOutRangeCount=function(t){var e={min:0,max:0},n=this.getOutRange(t);for(var r in n)e.min+=n[r].min,e.max+=n[r].max;return e},ht.prototype.getKeyByType=function(t,e,n){var r=this.getMeta(t);if(r){var i="in"===n?this.getInputs(t):this.getOutputs(t);for(var o in i)if(r[o].type===e)return o}},ht.prototype.isProcessFunction=function(t){return["SetValue","ImportData","ExportData","brightics.function.io$unload_model"].indexOf(t[FUNCTION_NAME])>=0},ht.prototype.isSkip=function(t){return t.skip&&_.isEqual(t.skip,!0)},ht.prototype.getDefinition=function(t,e){return Brightics.VA.Core.Utils.WidgetUtils.getFunctionLibrary(t,e)},ht.prototype.isExist=function(t,e){var n=this.getOutData(t),r=this.getInData(e);return _.forEach(n,function(t){_.forEach(r,function(e){if(t===e)return!0})}),!1},ht.prototype.isConnectable=function(t,e){var n=this.getDefinition("data",t.func),r=this.getDefinition("data",e.func);if(n["connectable-functions"]){if(n["connectable-functions"].indexOf(e.func)<0)return!1}else if(r["acceptable-functions"]&&r["acceptable-functions"].indexOf(t.func)<0)return!1;var i=this.getOutputTypes(t),o=this.getInputTypes(e),a=0;for(var s in i){var c=i[s];o.indexOf(c)>-1&&a++}if(0===a)return!1;var l=this.getInRange(e),u=0;for(var p in l){var d=l[p].max;this.getInData(e,p).length<d&&u++}return 0!==u},ht.prototype.connect=function(t,e){var n=this.getOutData(t),r=this.getInputTypes(e),i={table:[],model:[],image:[]};for(var o in n){var a=n[o];i[s=this.getTypeByTableId(t,a)].push(a)}for(var s in i)0!==i[s].length&&r.indexOf(s)>-1&&this.addInData(e,s,i[s])},ht.prototype.disconnect=function(t,e){var n=this.getOutData(t),r={table:[],model:[],image:[]};for(var i in n){var o=n[i];r[a=this.getTypeByTableId(t,o)].push(o)}for(var a in r)0!==r[a].length&&this.removeInData(e,a,r[a])},ht.prototype.addInData=function(t,e,n){var r=this;if(0!==n.length)if(e===pt)if(this.getMeta(t)){var i=this.getInputs(t);_.forEach(i,function(i,o){_.isArray(i)&&_.isEqual(e,r.getTypeByKey(t,o))?t.inputs[o]=_.union([],i,n):_.isEmpty(i)&&_.isEqual(e,r.getTypeByKey(t,o))&&_.isEmpty(r.getKeyByTableId(t,n[0]))&&(t.inputs[o]=n[0])})}else t[IN_DATA].push(n[0]);else"model"===e?(i=this.getInputs(t),_.forEach(i,function(i,o){_.isArray(i)&&_.isEqual(e,r.getTypeByKey(t,o))?t.inputs[o]=_.union([],i,n):_.isEmpty(i)&&_.isEqual(e,r.getTypeByKey(t,o))&&_.isEmpty(r.getKeyByTableId(t,n[0]))&&(t.inputs[o]=n[0])})):"image"===e&&(i=this.getInputs(t),_.forEach(i,function(i,o){_.isArray(i)&&_.isEqual(e,r.getTypeByKey(t,o))?t.inputs[o]=_.union([],i,n):_.isEmpty(i)&&_.isEqual(e,r.getTypeByKey(t,o))&&_.isEmpty(r.getKeyByTableId(t,n[0]))&&(t.inputs[o]=n[0])}))},ht.prototype.removeInData=function(t,e,n){0!==n.length&&(n=Array.isArray(n)?n:[n],this.getMeta(t)?_.forEach(this.getInputs(t),function(e,r){_.forEach(n,function(n){_.isArray(e)&&_.indexOf(e,n)>-1?(_.remove(e,function(t){return t==n}),t.inputs[r]=e):_.isEqual(e,n)&&(t.inputs[r]="")})}):Brightics.VA.Core.Utils.CommonUtils.removeArrayElement(t[IN_DATA],n))},ht.prototype.createOutData=function(t,e){var n=this.getDefinition("data",e),r=$.extend(!0,{},n.defaultFnUnit),i={};if(r.meta)for(var o in i.outputs=r.outputs,i.outputs)Array.isArray(i.outputs[o])?i.outputs[o].push(Brightics.VA.Core.Utils.IDGenerator.table.id()):i.outputs[o]=Brightics.VA.Core.Utils.IDGenerator.table.id();else{i[OUT_DATA]=r[OUT_DATA];for(var a=n["out-range"],s=0;s<a.min;s++)i[OUT_DATA].push(Brightics.VA.Core.Utils.IDGenerator.table.id())}return i},ht.prototype.wrapInputs=function(t){return Array.isArray(t)?{inData:t}:{inputs:t}},ht.prototype.clearInData=function(t){if(this.hasInput(t))if(this.getMeta(t))for(var e in t.inputs){var n=Array.isArray(t.inputs[e])?[]:"";t.inputs[e]=n}else t[IN_DATA]=[]},ht.prototype.isArray=function(t){return Array.isArray(t)},ht.prototype.getFunc=function(t){return t?t.func:""},ht.prototype.getName=function(t){return t?t.name:""},ht.prototype.getLabel=function(t){return t?t.display.label:""},ht.prototype.getId=function(t){return t?t.fid:""},ht.prototype.getParam=function(t){return t?t.param:{}},ht.prototype.getKeyLabel=function(t,e){var n=this.getMeta(t);return _.isEmpty(n)?"":n[e].label?n[e].label:e},ht.prototype.getCategory=function(t){return this.getDefinition("data",t.func).category},ht.prototype.getContext=function(t){return t.context||"scala"},ht.prototype.isFlexibleFunction=function(t){return"control"===this.getCategory(t)||"script"===this.getCategory(t)||"rowAppend"===this.getFunc(t)},ht.prototype.inputChangable=function(t){return"script"!==this.getCategory(t)&&"rowAppend"!==this.getFunc(t)},ht.prototype.getDataPanel=function(t,e){var n=Brightics.VA.Core.Editors.Sheet.Panels.DataPanel;if("out"===e){var r=this.getFunc(t);n=Brightics.VA.Implementation.DataFlow.Functions[r]&&Brightics.VA.Implementation.DataFlow.Functions[r].DataPanel||n}return n},ht.prototype.getParent=function(t){return"function"==typeof t.parent?t.parent():Studio.getEditorContainer().getActiveModelEditor().getActiveModel()},ht.prototype.hasTable=function(t){return this.getTypes(t).indexOf(pt)>-1},ht.prototype.changeData=function(t,e,n){if(this.hasMeta(t)){var r=this.getInputs(t),i=this.getOutputs(t);_.forEach(r,function(r,i){_.isEqual(r,e)&&(t.inputs[i]=n)}),_.forEach(i,function(r,i){_.isEqual(r,e)&&(t.outputs[i]=n)});var o=t=>_.isString(t)?_.isEqual(t,e)?n:t:_.isArray(t)?t.map(t=>o(t)):_.isObject(t)?_.zipObject(Object.entries(t).map(t=>{var e=t[0],n=t[1];return[e,o(n)]})):void 0;t.inputs&&(t.inputs=o(t.inputs)),t.outputs&&(t.outputs=o(t.outputs))}else _.forEach(t.inData,function(r,i){_.isEqual(r,e)&&(t.inData[i]=n)}),_.forEach(t.outData,function(r,i){_.isEqual(r,e)&&(t.outData[i]=n)})},ht.prototype.isDustNode=function(t){return["brightics"].indexOf(this.getCategory(t))>-1},ht.prototype.isBluffNode=function(t){return!(t.inData||t.outData||t.inputs||t.outputs)},ht.prototype.isInputtable=function(t){return this.getTotalInRangeCount(t).min>0||this.isBluffNode(t)},ht.prototype.isOutputtable=function(t){return!Brightics.VA.Core.Utils.WidgetUtils.getFunctionLibrary("data",t.func)["out-node"]},ht.prototype.isSkippable=function(t){return this.isBluffNode(t)||this.isProcessFunction(t)},ht.prototype.isAvailable=function(t){var e=this.getFunc(t);return!_.isUndefined(Brightics.VA.Core.Interface.Functions.data[e])},ht.prototype.isThirdPartyFunction=function(t){return["DataFrameExportForTableau","DataFrameExportForMSTR","DataFrameExportForQlikSense"].indexOf(t[FUNCTION_NAME])>=0};var ft=new ht,gt={duplicate:function(t){return'"'+t+'" is already exist'},index:function(){return"Should be filled previous element first"},empty:function(){return'can not switch to "Empty"'}};function vt(){}vt.prototype.render=function(t){return this.empty(t),this.init(t),this.createLayout(t),this.createInputs(t),this.bindEvents(t),this},vt.prototype.init=function(t){ft.hasMeta(t.fnUnit)?this.DATA_TYPE="object":this.DATA_TYPE="array"},vt.prototype.getPrevFnUnitByTableId=function(t,e){var n=ft.getPreviousFnUnits(t);for(var r in n){var i=n[r];if(ft.getOutData(i).indexOf(e)>-1)return i}},vt.prototype.empty=function(t){t.appendTo.empty()},vt.prototype.createLayout=function(t){var e=$('<div class="brtc-va-editors-sheet-controls-input-list"> <div class="brtc-va-editors-sheet-controls-input-list-content"/></div>');e.attr("autoArrange",t.autoArrange||!1);var n=$('<div class="brtc-va-editors-sheet-controls-input-list-container"></div>');e.append(n),t.appendTo.append(e)},vt.prototype.createInputs=function(t){var e=this,n=ft.getInputs(t.fnUnit);if(ft.hasMeta(t.fnUnit))_.forEach(n,function(n,r){var i={type:ft.getTypeByKey(t.fnUnit,r),tableId:n,key:r,fnUnit:t.fnUnit,appendTo:t.appendTo,emptyLabel:t.emptyLabel,readOnly:t.readOnly,autoArrange:!1};e.createInputUnit(i)});else{var r=ft.getInRange(t.fnUnit).table.max;ft.isFlexibleFunction(t.fnUnit)&&(r=ft.getInTable(t.fnUnit).length);for(var i=0;i<r;i++){var o={type:"table",tableId:n[i],key:"["+i+"]"+ft.getLabel(t.fnUnit),fnUnit:t.fnUnit,appendTo:t.appendTo,emptyLabel:t.emptyLabel,readOnly:t.readOnly,autoArrange:!0};e.createInputUnit(o)}}},vt.prototype.enableDragEvent=function(t){var e=t.hasClass("brtc-style-controls-inputselector-box-wrapper")?t:t.closest(".brtc-style-controls-inputselector-box-wrapper");this.isDraggable(e)&&e.draggable("enable")},vt.prototype.disableDragEvent=function(t){var e=t.hasClass("brtc-style-controls-inputselector-box-wrapper")?t:t.closest(".brtc-style-controls-inputselector-box-wrapper");this.isDraggable(e)&&e.draggable("disable")},vt.prototype.isDraggable=function(t){return(t.hasClass("brtc-style-controls-inputselector-box-wrapper")?t:t.closest(".brtc-style-controls-inputselector-box-wrapper")).hasClass("ui-draggable")},vt.prototype.createInputUnit=function(t){var e=t.key,n=t.tableId,r=t.type,i=t.fnUnit,o=this.getPrevFnUnitByInTableId(i,n),a=t.readOnly,s=t.autoArrange,c=this.createBox({appendTo:t.appendTo,label:e,type:r});!t.readOnly&&_.isEqual(this.DATA_TYPE,"array")&&(this.createDragEvent(t.appendTo,c),n?this.enableDragEvent(c):this.disableDragEvent(c)),"array"!==this.DATA_TYPE||a||c.css("cursor","move"),c.attr("key",e),c.attr("type",r),c.attr("table-id",n);var l=c.find(".brtc-style-controls-inputselector-box-contents"),u=l.find(".brtc-style-controls-inputselector-box-contents-figure"),p=l.find(".brtc-style-controls-inputselector-box-contents-remove"),d=l.find(".brtc-style-controls-inputselector-box-key");t.appendTo.find(".brtc-va-editors-sheet-controls-input-list-container").append(c),l.append(h);var h=this.createEmptyItem({parent:u,type:r,label:t.emptyLabel,readOnly:a}),f=this.createFuncItem({label:ft.getLabel(o),func:ft.getFunc(o),type:ft.getTypeByTableId(o,n),tableId:n}),g=ft.getOutputsToObject(o),v=this.createKeyItem({key:g[n],type:r}),y=this.createRemoveButton({autoArrange:s});return u.append(f),d.append(v),a||p.append(y),a||this.createDropEvent(c),n?(h.hide(),f.show(),v.show(),y.show()):(h.show(),f.hide(),v.hide(),y.hide()),this.registerRemoveEvent(y),c},vt.prototype.getPrevFnUnitByInTableId=function(t,e){if(t){var n=ft.getPreviousFnUnits(t);for(var r in n){var i=ft.getOutData(n[r]);if(i&&i.indexOf(e)>-1)return n[r]}}},vt.prototype.createBox=function(t){return this.createBoxWrapper(t.label,t.type)},vt.prototype.createDragEvent=function(t,e){e.draggable({helper:"clone",appendTo:t,start:function(t,n){e.css("opacity",".3"),n.helper.css({width:"220px",border:"none"}),n.helper.find(".brtc-style-controls-inputselector-box-title").hide()},stop:function(t,n){e.css("opacity","1")}})},vt.prototype.createBoxWrapper=function(t,e){var n=$('<div class="brtc-style-controls-inputselector-box-wrapper"></div>'),r=$('<div class="brtc-style-controls-inputselector-box-title brtc-style-ellipsis"><div class="icon"></div><div class="brtc-label"></div></div>'),i=$('<div class="brtc-style-controls-inputselector-box-contents"><div class="brtc-style-controls-inputselector-box-contents-figure"></div><div class="brtc-style-controls-inputselector-box-contents-remove"></div></div>'),o=$('<div class="brtc-style-controls-inputselector-box-key"></div>');return n.append(r).append(i),i.append(o),r.find(".icon").attr("type",e),r.find(".brtc-label").text(t),n},vt.prototype.createFuncItem=function(t){var e=t.label,n=t.func,r=t.type,i=t.tableId,o=$('<div class="brtc-va-editors-sheet-controls-inputselector-item"></div>'),a=Brightics.VA.Core.Utils.WidgetUtils.createPaletteBox({func:n,label:e});return o.append(a),a.find(".brtc-va-views-palette-fnunit-label").addClass("brtc-style-ellipsis"),a.find(".brtc-va-views-palette-fnunit-label").text(e),o.attr("table-id",i),o.attr("type",r),a.find(".brtc-va-views-palette-fnunit-label").text(e),a.attr("title",e),a.addClass("item"),o},vt.prototype.createKeyItem=function(t){var e=$('<div class="brtc-style-controls-inputselector-box-key-wrapper"></div>'),n=$('<div class="brtc-style-controls-inputselector-box-key-type"></div>'),r=$('<div class="brtc-style-ellipsis brtc-style-controls-inputselector-box-key-label"></div>');return e.append(n).append(r),r.text(t.key),r.attr("title",t.key),n.append(this.createTypeIcon(t.type)),e},vt.prototype.createTypeIcon=function(t){return $('<div class="brtc-style-controls-inputselector-box-key-type-icon"></div>').attr("type",t)},vt.prototype.createEmptyItem=function(t){var e=t.label||"Drop Data",n=t.parent,r=t.type,i=t.readOnly,o=$('<div class="brtc-va-fnunit-input-empty"> <div>'+e+"</div></div>");return n.append(o),i||this.createDropEvent(o,r),o},vt.prototype.getDropFuncTarget=function(t){return t.find(".brtc-style-controls-inputselector-box-contents")},vt.prototype.getDroppableCssSelector=function(){return[".brtc-va-fnunit-input-empty",".brtc-va-editors-sheet-controls-inputselector-item",".brtc-va-tools-sidebar-variable-remove",".brtc-style-controls-inputselector-box-key-wrapper"].join(",")},vt.prototype.addActivateClass=function(t){t.find(this.getDroppableCssSelector()).addClass("brtc-style-droppable-active")},vt.prototype.removeActivateClass=function(t){t.find(this.getDroppableCssSelector()).removeClass("brtc-style-droppable-active")},vt.prototype.addHoverClass=function(t){t.find(this.getDroppableCssSelector()).addClass("brtc-style-droppable-hover")},vt.prototype.removeHoverClass=function(t){t.find(this.getDroppableCssSelector()).removeClass("brtc-style-droppable-hover")},vt.prototype.createDropEvent=function(t){var e=this,n=t.attr("type");t.droppable({accept:".brtc-va-controls-datatree-li-table[type="+n+"] .ui-draggable, .brtc-style-controls-inputselector-box-wrapper",activate:function(t,n){e.addActivateClass($(this))},deactivate:function(t,n){e.removeActivateClass($(this)),e.removeHoverClass($(this))},over:function(t,n){e.addHoverClass($(this))},out:function(t,n){e.removeHoverClass($(this))},drop:function(t,n){var r=n.draggable,i=e.getMainArea($(this)),o=r.text(),a=e.validate(r,$(this));_.isEmpty(a)?(e.removeActivateClass($(this)),e.removeHoverClass($(this)),e.switchData(r,$(this)),e.handleChange($(this))):e.handleError(i,gt[a.type](o))}})},vt.prototype.validate=function(t,e){return this.checkDuplicated(t,e)?{type:"duplicate"}:this.checkIndex(t,e)?{type:"index"}:this.checkEmpty(t,e)?{type:"empty"}:void 0},vt.prototype.checkDuplicated=function(t,e){var n=this.getInputs(this.getMainArea(e)),r=t.closest("li").attr("table-id");for(var i in n)if(_.isEqual(n[i],r))return!0;return!1},vt.prototype.checkIndex=function(t,e){if("object"===this.DATA_TYPE)return!1;var n=e.prev();return!(_.isEmpty(n)||!this.isEmptyBox(n))},vt.prototype.checkEmpty=function(t,e){return!(t.hasClass("jqx-tree-item")||!this.isEmptyBox(t)&&!this.isEmptyBox(e))},vt.prototype.switchData=function(t,e){if(t.hasClass("brtc-style-controls-inputselector-box-wrapper")){var n=t.closest(".brtc-style-controls-inputselector-box-wrapper").find(".brtc-style-controls-inputselector-box-contents"),r=n.clone(),i=e.closest(".brtc-style-controls-inputselector-box-wrapper").find(".brtc-style-controls-inputselector-box-contents"),o=i.clone();return i.replaceWith(r),n.replaceWith(o),this.registerRemoveEvent(r.find(".brtc-va-tools-sidebar-variable-remove")),this.registerRemoveEvent(o.find(".brtc-va-tools-sidebar-variable-remove")),this.isEmptyBox(r)?this.disableDragEvent(r):this.enableDragEvent(r),this.isEmptyBox(o)?this.disableDragEvent(o):this.enableDragEvent(o),o}var a=t.closest("li").attr("key"),s=t.closest("li").attr("label"),c=t.closest("li").attr("type"),l=t.closest("li").attr("func"),u=t.closest("li").attr("table-id"),p=this.createFuncItem({label:s,func:l,type:c,tableId:u}),d=this.createKeyItem({key:a,type:c}),h=e.closest(".brtc-style-controls-inputselector-box-wrapper"),f=h.find(".brtc-style-controls-inputselector-box-contents"),g=f.find(".brtc-va-editors-sheet-controls-inputselector-item"),v=f.find(".brtc-style-controls-inputselector-box-key-wrapper"),y=f.find(".brtc-va-fnunit-input-empty"),m=f.find(".brtc-va-tools-sidebar-variable-remove");y.hide(),e.show(),v.show(),m.show(),this.registerRemoveEvent(m),g.replaceWith(p),v.replaceWith(d),this.enableDragEvent(p),this.createDropEvent(h)},vt.prototype.createRemoveButton=function(t){return $('<span class="brtc-va-tools-sidebar-variable-remove"></span>')},vt.prototype.registerRemoveEvent=function(t){var e=this;t.off("click"),t.click(function(){var t=e.getMainArea($(this)),n=$(this).closest(".brtc-style-controls-inputselector-box-wrapper"),r=n.find(".brtc-va-editors-sheet-controls-inputselector-item"),i=n.find(".brtc-style-controls-inputselector-box-key-wrapper"),o=n.find(".brtc-va-fnunit-input-empty");n.find(".brtc-va-tools-sidebar-variable-remove").hide(),i.hide(),r.hide(),o.show(),e.disableDragEvent(n),"true"===t.attr("autoArrange")&&e.autoArrange(n),e.handleRemove(t)})},vt.prototype.autoArrange=function(t){var e=t.next();if(!_.isEmpty(e)&&!this.isEmptyBox(e)){var n=this.switchData(e,t);this.autoArrange(n)}},vt.prototype.isEmptyBox=function(t){return(t.hasClass("brtc-style-controls-inputselector-box-wrapper")?t:t.closest(".brtc-style-controls-inputselector-box-wrapper")).find(".brtc-va-fnunit-input-empty").is(":visible")},vt.prototype.handleChange=function(t){this.getMainArea(t).trigger("change",[this.getInputs(t)])},vt.prototype.handleRemove=function(t){this.getMainArea(t).trigger("change",[this.getInputs(t)])},vt.prototype.handleError=function(t,e){this.getMainArea(t).trigger("error",[e])},vt.prototype.getPreviousFnUnits=function(t){var e=[],n=t.parent(),r=n.getPrevious(ft.getId(t));return _.forEach(r,function(t){e.push(n.getFnUnitById(t))}),e},vt.prototype.getMainArea=function(t){return t.closest(".brtc-va-editors-sheet-controls-input-list")||t},vt.prototype.getInputs=function(t){var e=this.getMainArea(t).find(".brtc-style-controls-inputselector-box-wrapper"),n={};return _.forEach(e,function(t){var e=$(t),r=e.find(".brtc-va-editors-sheet-controls-inputselector-item"),i=e.attr("key"),o=r.is(":visible")?r.attr("table-id"):"";n[i]=o}),n},vt.prototype.destroyDragEvent=function(t){t.on("dragstop",function(e,n){t.hasClass("ui-draggable")&&n.helper.attr("table-id")!==e.target.getAttribute("table-id")&&t.draggable("destroy")})},vt.prototype.bindEvents=function(t){var e=t.appendTo.find(".brtc-va-editors-sheet-controls-input-list");"function"==typeof t.onClick&&e.bind("click",t.onClick),"function"==typeof t.onChange&&e.bind("change",t.onChange),"function"==typeof t.onError&&e.bind("error",t.onError)};var yt=new vt;function mt(){}mt.prototype.create=function(t){return this.createUnit(t)},mt.prototype.createUnit=function(t){var e=t.key,n=t.tableId,r=t.type,i=t.label,o=t.func,a=this.createBox(e);a.attr("key",e),a.attr("type",r),a.attr("label",i),a.attr("func",o),a.attr("table-id",n);var s=a.find(".brtc-style-controls-inputselector-box-contents"),c=s.find(".brtc-style-controls-inputselector-box-contents-figure"),l=s.find(".brtc-style-controls-inputselector-box-key"),u=this.createFuncItem({label:i,func:o,type:r,tableId:n}),p=this.createKeyItem({key:e,type:r});return this.createRemoveButton(),c.append(u),l.append(p),a},mt.prototype.bindEvents=function(t,e){"function"==typeof e.onClick&&t.bind("click",e.onClick),"function"==typeof e.onChange&&t.bind("change",e.onChange),"function"==typeof e.onRemove&&t.bind("remove",e.onRemove)},mt.prototype.getPrevFnUnitByInTableId=function(t,e){if(t){var n=FnUnitUtils.getPreviousFnUnits(t);for(var r in n){var i=FnUnitUtils.getOutData(n[r]);if(i&&i.indexOf(e)>-1)return n[r]}}},mt.prototype.createBox=function(t){return this.createBoxWrapper(t)},mt.prototype.createBoxWrapper=function(t){var e=$('<div class="brtc-style-controls-inputselector-box-wrapper"></div>');e.css("width","100%"),e.css("height","55px");var n=$('<div class="brtc-style-controls-inputselector-box-contents"><div class="brtc-style-controls-inputselector-box-contents-figure"></div><div class="brtc-style-controls-inputselector-box-contents-remove"></div></div>'),r=$('<div class="brtc-style-controls-inputselector-box-key"></div>');return e.append(n),n.append(r),e},mt.prototype.createFuncItem=function(t){var e=t.label,n=t.func,r=t.type,i=t.tableId,o=$('<div class="brtc-va-editors-sheet-controls-inputselector-item"></div>'),a=Brightics.VA.Core.Utils.WidgetUtils.createPaletteBox({func:n,label:e});return o.append(a),a.find(".brtc-va-views-palette-fnunit-label").text(e),o.attr("table-id",i),o.attr("type",r),a.find(".brtc-va-views-palette-fnunit-label").text(e),a.attr("title",e),a.addClass("item"),o},mt.prototype.createKeyItem=function(t){var e=$('<div class="brtc-style-controls-inputselector-box-key-wrapper"></div>'),n=$('<div class="brtc-style-controls-inputselector-box-key-type"></div>'),r=$('<div class="brtc-style-controls-inputselector-box-key-label"></div>');return e.append(n).append(r),r.text(t.key),n.append(this.createTypeIcon()),e},mt.prototype.createTypeIcon=function(){return $('<div class="brtc-style-controls-inputselector-box-key-type-icon" type="table"></div>')},mt.prototype.createEmptyItem=function(t){var e=t.label||"Drop Data",n=t.parent,r=t.type,i=t.readOnly,o=$('<div class="brtc-va-fnunit-input-empty"> <div>'+e+"</div></div>");return n.append(o),i||this.createDropEvent(o,r),o},mt.prototype.getDropFuncTarget=function(t){return 1==t.find(".brtc-va-views-palette-fnunit").length?t.find(".brtc-va-views-palette-fnunit"):t},mt.prototype.createDropEvent=function(t){var e=this;t.droppable({accept:".key-items-draggable",activate:function(t,n){e.getDropFuncTarget($(this)).addClass("brtc-style-droppable-active")},deactivate:function(t,n){var r=e.getDropFuncTarget($(this));r.removeClass("brtc-style-droppable-active"),r.removeClass("brtc-style-droppable-hover")},over:function(t,n){e.getDropFuncTarget($(this)).addClass("brtc-style-droppable-hover")},out:function(t,n){e.getDropFuncTarget($(this)).removeClass("brtc-style-droppable-hover")},drop:function(t,n){var r=n.draggable,i=e.getDropFuncTarget($(this)),o=e.getMainArea($(this));i.removeClass("brtc-style-droppable-active"),i.removeClass("brtc-style-droppable-hover"),e.switchData(r,$(this));var a=e.getItems(o);o.trigger("change",[a])}})},mt.prototype.switchData=function(t,e){var n=t.closest("li").attr("key"),r=t.closest("li").attr("label"),i=t.closest("li").attr("type"),o=t.closest("li").attr("func"),a=t.closest("li").attr("table-id"),s=this.createFuncItem({label:r,func:o,type:i,tableId:a}),c=this.createKeyItem({key:n,type:i}),l=(e.hasClass("brtc-style-controls-inputselector-empty-fnunit"),e.closest(".brtc-style-controls-inputselector-box-wrapper")),u=l.find(".brtc-style-controls-inputselector-box-contents"),p=u.find(".brtc-va-editors-sheet-controls-inputselector-item"),d=u.find(".brtc-style-controls-inputselector-box-key-wrapper"),h=u.find(".brtc-va-fnunit-input-empty"),f=u.find(".brtc-va-tools-sidebar-variable-remove");h.hide(),e.show(),d.show(),f.show(),p.replaceWith(s),d.replaceWith(c),this.createDropEvent(l)},mt.prototype.createRemoveButton=function(){var t=this,e=$('<span class="brtc-va-tools-sidebar-variable-remove"></span>');return e.click(function(){var e=$(this).closest(".brtc-style-controls-inputselector-box-wrapper"),n=e.find(".brtc-va-editors-sheet-controls-inputselector-item"),r=e.find(".brtc-style-controls-inputselector-box-key-wrapper"),i=e.find(".brtc-va-fnunit-input-empty");e.find(".brtc-va-tools-sidebar-variable-remove").hide(),r.hide(),n.hide(),i.show(),t.handleRemove($(this))}),e},mt.prototype.handleRemove=function(t){this.getMainArea(t).trigger("change",[this.getItems(t)])},mt.prototype.getPreviousFnUnits=function(t){var e=[],n=t.parent(),r=n.getPrevious(FnUnitUtils.getId(t));return _.forEach(r,function(t){e.push(n.getFnUnitById(t))}),e},mt.prototype.getMainArea=function(t){return t.closest(".brtc-va-editors-sheet-controls-input-list")||t},mt.prototype.getItems=function(t){var e=this.getMainArea(t).find(".brtc-style-controls-inputselector-box-wrapper"),n={};return _.forEach(e,function(t){var e=$(t),r=e.find(".brtc-va-editors-sheet-controls-inputselector-item"),i=e.attr("key"),o=r.is(":visible")?r.attr("table-id"):"";n[i]=o}),n},mt.prototype.destroyDragEvent=function(t){t.on("dragstop",function(e,n){t.hasClass("ui-draggable")&&n.helper.attr("table-id")!==e.target.getAttribute("table-id")&&t.draggable("destroy")})};var bt=new mt;function Ct(){this.init()}Ct.prototype.init=function(){this.board={}},Ct.prototype.add=function(t,e,n){this.board[t]={status:e,message:n}},Ct.prototype.remove=function(t){delete this.board[t]},Ct.prototype.get=function(t){return this.board[t]},Ct.prototype.refresh=function(){this.init()},Ct.prototype.show=function(t,e){this.get(t)&&e.attr("title",this.get(t).message)};var wt=new Ct,_t={IN_DATA:"inData",OUT_DATA:"outData",INPUTS:"inputs",OUTPUTS:"outputs",FUNCTIONS:"functions",TYPE:"type",TITLE:"title",PARAMETER:"param",MODEL_ID:"mid",INNER_MODELS:"innerModels",PERSIST_MODE:"persist-mode",SOURCE_FID:"sourceFid",TARGET_FID:"targetFid",FUNCTION_NAME:"name",FONT_SIZES:["10","11","12","14","16","18","24","36","48","64"]},It=n(0),At=n.n(It);const xt="3.6";function Tt(t,e){this.project={},this.children=[],t&&(this.project=t),e&&e instanceof Array&&(this.children=this.children.concat(e))}function $t(t){this.data=[],t&&(t instanceof Array?this.data=this.data.concat(t):this.data.push(t))}Tt.prototype.toJSON=function(){return{type:"project",data:this.project.toJSON(),children:_.map(this.children,function(t){return{type:t.getResourceName(),data:t.toJSON()}}),version:this.getCoreVersion()}},Tt.prototype.setProject=function(t){return this.project=t,this},Tt.prototype.addFile=function(t){return this.children.add(t),this},Tt.prototype.addFiles=function(t){return this.children=this.children.concat(t),this},Tt.prototype.getProject=function(){return this.project},Tt.prototype.getFiles=function(){return this.children},Tt.prototype.getCoreVersion=function(){return xt},$t.prototype.toJSON=function(){return{type:"files",data:_.map(this.data,function(t){return{type:t.getResourceName(),data:t.toJSON(!0)}}),version:this.getCoreVersion()}},$t.prototype.addFile=function(t){return this.data.push(t),this},$t.prototype.addFiles=function(t){return this.data=this.data.concat(t),this},$t.prototype.getFiles=function(){return this.data},$t.prototype.getCoreVersion=function(){return xt};const Dt=function(){const t=function(t,e){const n=$.ajax({url:"api/va/v2/convert/store",type:"POST",data:JSON.stringify({contents:t,version:e}),contentType:"application/json; charset=utf-8"});return Promise.resolve(n).then(function(t){return t.contents}).catch(function(e){throw e.responseJSON.errors[0].mid=t.mid,e})},e=t=>new A(t),n=t=>new N(t);return{convertFilesSpec:function(r,i){const o=t=>t.data.map(_.property("data")),a=i?o(r).map(_.property("contents")):_.isArray(r)?r:[r];return Promise.all(_.map(a,e=>t(e,i))).then(function(t){return new $t((i?t=>_.zip(o(r),t).map(([t,r])=>(r.version_id?n:e)(Object.assign({},t,{contents:r}))):t=>t.map(t=>(t.version_id?function(t){const e=(new N).setVersionId(t.version_id).setFileId(t.mid).setLabel(t.title).setTags(t.versionTags).setDescription(t.versionDescription).setType(t.type).setMajorVersion(_.has(t,"majorVersion")?t.majorVersion:t.major_version).setMinorVersion(_.has(t,"minorVersion")?t.minorVersion:t.minor_version).setCreator(Brightics.VA.Env.Session.userId).setIsManual(!0);return e.setContents(_.omit(t,["versionId","versionTags","versionDescription","majorVersion","minorVersion"])),e}:function(t){return(new A).setFileId(t.mid).setLabel(t.title).setDescription("").setCreator(Brightics.VA.Env.Session.userId).setContents(t)})(t)))(t)).toJSON()})},convertProjectSpec:function(r,i){const[o,a,s]=function(){if(!i){const t=t=>_.merge({contents:{gv:[]}},t);return[r[0].files.map(t),r[0].versions.map(t),new S(_.omit(r[0],["files","versions"]))]}const[t,e]=_.partition(r.children,_.matchesProperty("type","file")).map(t=>t.map(_.property("data")));return[t,e,new S(r.data)]}(),c=function(e){return function(n){return(r=n,t(r.contents,i).then(function(t){return _.assign({},r,{contents:t})})).then(e);var r}};return Promise.all([].concat(_.map(o,c(e)),_.map(a,c(n)))).then(function(t){return new Tt(s,t).toJSON()})}}}(),Vt={},Et=[S,A,N];_.forEach(Et,function(t){Vt[t.prototype.getResourceName()]={_constructor:t}});const Ft=new class{exportProject(t){return ut.fetchProject(t).then(e=>ut.fetchFiles(t).then(e=>this._collectResources(e,t,!0)).then(t=>this._exportProjectFromResources(e,t))).catch(t=>{console.error(t)})}_collectResources(t,e,n){const r=_.isArray(t)?t:[t];return Promise.all(_.map(r,t=>n?this._getDependentResources(t,e):[t])).then(t=>this._makeUnique(_.flatten(t))).then(t=>this._appendMissedFiles(t,e))}exportJSON(t,e,n){return ut.fetchFile(e,t).then(_.bind(this._collectResources,this,_,e,n)).then(_.bind(this._exportFilesFromResources,this)).catch(console.error)}exportJSONs(t,e,n){return Promise.all(_.map(t,_.bind(this.exportJSON,this,_,e,n))).catch(console.error)}_exportFilesFromResources(t,e){return new $t(t).toJSON()}_exportProjectFromResources(t,e){return new Tt(t,e).toJSON()}_appendMissedFiles(t,e){return this._getMissedFile(t,e).then(function(e){return t.concat(e)})}_traverseParamFunctions(t,e){_.forEach(t,t=>{t.param.functions&&this._traverseParamFunctions(t.param.functions,e),e(t)})}_getDependentResources(t,e){const n=t.getContents(),r=new H,i=function(t){return Promise.all(_.map(t.functions,function(t){if("Flow"===t[FUNCTION_NAME]){if(t.param.mid&&t.param.versionId){if(!r.has(t.param.versionId))return ut.fetchVersion(e,t.param.mid,t.param.versionId).then(function(e){return r.set(t.param.versionId,e),o(e)}).catch(_.noop)}else if(t.param.mid&&!r.has(t.param.mid))return ut.fetchFile(e,t.param.mid).then(function(e){return r.set(t.param.mid,e),o(e)}).catch(_.noop)}else if("loadFromStaging"===t.func&&t.param.modelId&&!r.has(t.param.model))return ut.fetchFile(e,t.param.modelId).then(function(e){return r.set(t.param.modelId,e),o(e)}).catch(_.noop);const a=Brightics.VA.Core.Utils.NestedFlowUtils.getSubModels(n,t);return Promise.all(_.map(a,i))}))},o=function(t){const e=t.getContents();return i(e)};return o(t).then(function(){return _.compact(r.toArray()).concat([t])})}_makeUnique(t){const e=new H;return _.forEach(t,function(t){e.set(t.getHashCode(),t)}),e.toArray()}_getMissedFile(t,e){const n=new H;_.forEach(t,function(t){t instanceof A&&n.set(t.getFileId(),t)});const r=new H;return _.forEach(t,function(t){t instanceof N&&!n.has(t.getFileId())&&!r.has(t.getFileId())&&r.set(t.getFileId(),t.getFileId())}),Promise.all(_.map(r.toArray(),function(t){return ut.fetchFile(e,t)}))}_jsons2resource(t){return _.map(t,function(t){return new(0,Vt[t.type]._constructor)(t.data)})}_importResources(t,e){this._changePrevKeys(t);const n=this._collectVersionId(t),r=this._collectModelId(t);this._remapProjectId(t,e),this._remapFileAndVersionId(t,r,n);const i=[],o=[];_.forEach(t,function(t){if(t instanceof S)throw new Error("unexpected data");t instanceof A&&i.push(function(){return ut.addFile(e,t)}),t instanceof N&&(t.setIsManual(!0),o.push(function(){return ut.addVersion(e,t.getFileId(),t)}))});const a=function(t){return function(){return Y(t)}};return J([a([]),a(i),a(o)])}checkPreviousFileSpec(t){let e=!0;return"project"===t.type&&(e=!1),_.has(t,"version")&&(e=!1),e}importJSONs(t,e){return(t=>Promise.all(_.map(t,t=>"files"!==t.type?this.checkPreviousFileSpec(t)?Dt.convertFilesSpec(t,t.version):Promise.reject(new Error("invalid export file spec")):t.version!==xt?Dt.convertFilesSpec(t,t.version):t)))(t).then(t=>_.map(t,t=>this._jsons2resource(t.data))).then(_.flatten).then(this._makeUnique.bind(this)).then(t=>this._importResources(t,e))}importJSON(t,e){return this.importJSONs([t],e)}_collectVersionId(t){const e=new H;return _.forEach(t,function(t){t instanceof N&&(e.has(t.getVersionId())||e.set(t.getVersionId(),At.a.version.id()))}),e}_collectModelId(t){const e=new H,n=function(t){e.has(t)||e.set(t,At.a.model.id())};return _.forEach(t,function(t){(t instanceof A||t instanceof N)&&(n(t.getFileId()),_.forIn(t.getContents().functions,function(t){t.param&&t.param.modelId&&n(t.param.modelId)}),_.forIn(t.getContents().innerModels,function(t){n(t.mid)}))}),e}_remapProjectId(t,e){_.forEach(t,function(t){t instanceof A&&t.setProjectId(e)})}_remapFileAndVersionId(t,e,n){const r=function(t,i){_.forEach(i.functions,function(i){"Flow"===i[FUNCTION_NAME]&&(i.param.mid&&(i.param.mid=e.get(i.param.mid)||i.param.mid),i.param.versionId&&(i.param.versionId=n.get(i.param.versionId)||i.param.versionId)),"DataViewer"===i[FUNCTION_NAME]&&(i.param.mid=e.get(i.param.mid)),"If"===i[FUNCTION_NAME]&&(i.param.if.mid=e.get(i.param.if.mid)||i.param.if.mid,_.forEach(i.param.elseif,function(t){t.mid=e.get(t.mid)||t.mid}),i.param.else.mid=e.get(i.param.else.mid)||i.param.else.mid),"ForLoop"!==i[FUNCTION_NAME]&&"WhileLoop"!==i[FUNCTION_NAME]||(i.param.mid=e.get(i.param.mid)||i.param.mid);const o=Brightics.VA.Core.Utils.NestedFlowUtils.getSubModels(t,i);_.forEach(o,_.partial(r,t,_))})};_.forEach(t,function(t){if(t instanceof A||t instanceof N){t.setFileId(e.get(t.getFileId())),t.getContents().mid=t.getFileId(),t instanceof N&&(t.setVersionId(n.get(t.getVersionId())),t.getContents().version_id=t.getVersionId()),t instanceof A&&"visual"===t.getType()&&_.forEach(t.getContents().functions,function(t){t.param.modelId&&(t.param.modelId=e.get(t.param.modelId))});const i=t.getContents(),o=_.reduce(_.map(i.innerModels,function(t,n){const r={};return t.mid=e.get(n)||n,r[t.mid]=t,r}),_.merge,{});i.innerModels=o,r(i,i)}})}_changePrevKeys(t){const e={fidCache:{},tidCache:{}};_.forEach(t,function(t){if(t instanceof A||t instanceof N){const n=t.getContents();Brightics.VA.Core.Utils.ModelUtils.createCacheNestedFlow(n,n,e)}}),_.forEach(t,function(t){if(t instanceof A||t instanceof N){const n=t.getContents(),r=Brightics.VA.Core.Utils.ModelUtils.setKeyNestedFlow(n,n,e);t.setContents(r)}})}preprocessProjectJson(t){return"project"===t.type&&t.version===xt?Promise.resolve(t):Dt.convertProjectSpec(t,t.version)}importProject(t){return this.preprocessProjectJson(t).then(function(t){const e=new S(t.data),n=At.a.project.id();e.setProjectId(n);const r=this._jsons2resource(t.children);return ut.addProject(e).then(()=>ut.fetchProject(n)).then(t=>this._importResources(r,n)).then(()=>n).catch(t=>{console.error(t)})}.bind(this))}validateExportedProjectSpec(t){try{return this.preprocessProjectJson(t)}catch(t){return Promise.reject(t)}}duplicateFile(t,e,n,r,i,o){return this.exportJSON(t,e,r).then(e=>{const r=_.cloneDeep(e);return function(e){e.data=_.map(e.data,function(e){return"file"===e.type&&e.data.id===t?e.data.label=o:e.data.label+="_"+i,e})}(r),this.importJSON(r,n)}).catch(function(t){console.error(t)})}calcTableIdLinks(t){const e=[],n=function(t,r){_.forEach(r.functions,function(i){"DataViewer"===i[FUNCTION_NAME]&&_.forEach(i[OUT_DATA],function(t){e.push({source:["",Brightics.VA.Env.Session.userId,i.param.mid,i[OUT_DATA]].join("/"),alias:["",Brightics.VA.Env.Session.userId,r.mid,i[OUT_DATA]].join("/")})});const o=Brightics.VA.Core.Utils.NestedFlowUtils.getSubModels(t,i);_.forEach(o,_.partial(n,t,_))})};return _.forEach(t,function(t){if(t instanceof A||t instanceof N){const e=t.getContents();n(e,e)}}),e}};var Ut=function(t){return _.clone(t)},Bt=n(2),Ot=n.n(Bt);function jt(t){var e;this.ee=new o,this.connectionKey=t,window.addEventListener("storage",(e=this.ee,function(t){var n=t.key,r=JSON.parse(t.newValue)||{};e.emit(n,r)}))}jt.prototype.request=function(t,e,n){var r=this,i=(n||{}).timeout||5e3;return new Promise(function(n,o){var a=Date.now(),s="req_"+a,c=function(e){e.connectionKey===r.connectionKey&&e.requestKey===s&&(n(e.value),r.off(t,c))};r.on(t,c),setTimeout(function(){o(new Error("TIMEOUT")),r.off(t,c)},i),r.emit(t,{timestamp:a,requestKey:"req_"+a,connectionKey:r.connectionKey,value:e,timeout:i})})},jt.prototype.setConnectionKey=function(t){this.connectionKey=t},jt.prototype.getConnectionKey=function(){return this.connectionKey},jt.prototype.listen=function(t,e){var n=this;n.on(t,function(r){if(r.connectionKey===n.connectionKey){var i=Date.now();i-r.timestamp>=r.timeout||n.emit(t,_.assign({},r,{value:e(r),timestamp:i,responseKey:"res_"+i}))}})},jt.prototype.on=function(t,e){this.ee.on("_TAB_CH_"+t,e)},jt.prototype.off=function(t,e){this.ee.off("_TAB_CH_"+t,e)},jt.prototype.emit=function(t,e){localStorage.setItem("_TAB_CH_"+t,JSON.stringify(e))};const St="__brtc__model__sync__";function kt(t,e){var n={};return n[t]=e,n}function Mt(t){return _.reduce(t,function(t,e,n){return _.isFunction(e)||(t[n]=e),t},{})}window.__module__=window.__module__||{},window.brtc_require=function(t){return window.__module__[t]};var Pt=function(t,e){window.__module__[t]=window.__module__[t]||{},window.__module__[t]=e};Pt("DataStructures",{HashMap:H,ProjectTree:z,TreeNode:K}),Pt("Dao",{ProjectDao:P,FileDao:j,VersionDao:W,DatasourceDao:G}),Pt("Controls",d),Pt("ResourceManager",ut),Pt("FnUnitUtils",ft),Pt("FnUnitInputs",yt),Pt("StatusBoard",wt),Pt("KeyItems",bt),Pt("Vo",{Project:S,File:A,Version:N,PROP_KEY:_t}),_.forIn(_t,function(t,e){window[e]=t}),Pt("EventEmitter",o),Pt("ClassUtils",{inherits:I}),Pt("IDGenerator",At.a),Pt("ResourceService",Ft),Pt("PromiseUtils",{serial:J,parallel:Y}),Pt("ObjectUtils",{get:function(t,e){return e instanceof Array?function(t,e){try{for(var n=-1,r=e.length,i=t;++n<r;)i=i[e[n]];return i}catch(t){return}}(t,e):t[e]},updateProp:function(t,e,n){for(var r=t,i=-1,o=e.length;++i<o-1;)r=r[e[i]];var a=Ut(r[e[e.length-1]]);return r[e[e.length-1]]=Ut(n),a},addProp:function(t,e,n){for(var r=t,i=-1,o=e.length;++i<o-1;)r=r[e[i]];Array.isArray(r)?r.splice(e[e.length-1],0,n):r[e[e.length-1]]=Ut(n)},removeProp:function(t,e){for(var n=t,r=-1,i=e.length;++r<i-1;)n=n[e[r]];var o=Ut(n[e[e.length-1]]);return Array.isArray(n)?n.splice(e[e.length-1],1):delete n[e[e.length-1]],o}}),Pt("_",_),window.crel=Ot.a,Pt("crel",Ot.a),Pt("TabChannel",jt),Pt("DATA_TYPES",{integertype:{type:"number",internalType:"Integer"},longtype:{type:"number",internalType:"Long"},doubletype:{type:"number",internalType:"Double"},booleantype:{type:"string",internalType:"Boolean"},stringtype:{type:"string",internalType:"String"},"arraytype(doubletype)":{type:"number[]",internalType:"Double[]"},"arraytype(longtype)":{type:"number[]",internalType:"Long[]"},"arraytype(booleantype)":{type:"string[]",internalType:"Boolean[]"},"arraytype(stringtype)":{type:"string[]",internalType:"String[]"},"arraytype(bytetype)":{type:"byte[]",internalType:"Byte[]"},"arraytype(doubletype,true)":{type:"number[]",internalType:"Double[]"},"arraytype(longtype,true)":{type:"number[]",internalType:"Long[]"},"arraytype(stringtype,true)":{type:"string[]",internalType:"String[]"},"arraytype(bytetype,true)":{type:"byte[]",internalType:"Byte[]"},"maptype(integertype,doubletype)":{type:"map",internalType:"Map(Integer,Double)"},"maptype(stringtype,doubletype)":{type:"map",internalType:"Map(String,Double)"},"maptype(integertype,doubletype,true)":{type:"map",internalType:"Map(Integer,Double)"},"maptype(stringtype,doubletype,true)":{type:"map",internalType:"Map(String,Double)"},"maptype(stringtype,stringtype,true)":{type:"map",internalType:"Map(String,String)"},timestamptype:{type:"date",internalType:"Date"},timestamp:{type:"date",internalType:"Date"},date:{type:"date",internalType:"Date"},string:{type:"string",internalType:"String"},double:{type:"number",internalType:"Double"},boolean:{type:"string",internalType:"Boolean"},long:{type:"number",internalType:"Long"},int:{type:"number",internalType:"Integer"},integer:{type:"number",internalType:"Integer"},"array(string)":{type:"string[]",internalType:"String[]"},"array(double)":{type:"number[]",internalType:"Double[]"},"array(long)":{type:"number[]",internalType:"Long[]"},"array(int)":{type:"number[]",internalType:"Integer[]"},"array(integer)":{type:"number[]",internalType:"Integer[]"},"map(integer,double)":{type:"map",internalType:"Map(Integer,Double)"},"map(string,double)":{type:"map",internalType:"Map(String,Double)"},"map(int,double)":{type:"map",internalType:"Map(Integer,Double)"},tinyint:{type:"byte",internalType:"Byte"},float:{type:"number",internalType:"Float"},bigint:{type:"number",internalType:"Long"},smallint:{type:"short",internalType:"Short"},"array<string>":{type:"string[]",internalType:"String[]"},"array<double>":{type:"number[]",internalType:"Double[]"},"array<long>":{type:"number[]",internalType:"Long[]"},"array<int>":{type:"number[]",internalType:"Integer[]"},"array<integer>":{type:"number[]",internalType:"Integer[]"},"array<tinyint>":{type:"byte[]",internalType:"Byte[]"},"map<integer,double>":{type:"map",internalType:"Map(Integer,Double)"},"map<string,double>":{type:"map",internalType:"Map(String,Double)"},"map<int,double>":{type:"map",internalType:"Map(Integer,Double)"}}),Pt("modelDiff",function(t,e){return function t(e,n){if(e===n)return{};var r=_.isArray(e),i=_.isArray(n);if(r&&i)return function(e,n){var r=Math.max(e.length,n.length);return _.range(r).reduce(function(r,i){if(!_.has(e,i))return _.merge(r,kt(i,{[St]:!0,action:"add",val:n[i]}));if(!_.has(n,i))return _.merge(r,kt(i,{[St]:!0,action:"remove"}));var o=t(e[i],n[i]);return _.isObject(o)&&_.isEmpty(o)?r:_.merge(r,kt(i,o))},{})}(e,n);if(r||i||!_.isObject(e)||!_.isObject(n))return{[St]:!0,action:"update",val:n};var o=_.union(_.keys(e),_.keys(n));return _.reduce(o,function(r,i){if(!_.has(e,i))return _.merge(r,kt(i,{[St]:!0,action:"add",val:n[i]}));if(!_.has(n,i))return _.merge(r,kt(i,{[St]:!0,action:"remove"}));var o=t(e[i],n[i]);return _.isObject(o)&&_.isEmpty(o)?r:_.merge(r,kt(i,o))},{})}(Mt(t),Mt(e))}),Pt("ENV",r)}]),function(){"use strict";var t=window.__module__;this.Brightics=this.Brightics||{};var e=this.Brightics,n=brtc_require("FnUnitUtils"),r=brtc_require("ENV");$.extend(!0,this.Brightics,{VA:{Core:{Interface:{Clazz:{},Label:{},Editor:{},ModelLayoutManager:{},Toolbar:{},SideBarManager:{},RightSideBarAdapter:{},LeftSideBarAdapter:{},Validator:{},Launcher:{},LauncherDialog:{},Functions:{},WidgetUtils:{},DefaultModel:{},ProjectContextMenuList:{},Clipboard:{},RunnableFactory:{},AddonFunctionUtil:{}},Components:{Base:{}},Controls:{},Default:{},Dialogs:{FunctionProperties:{},RefineSteps:{}},Editors:{Diagram:{Commands:{ControlEditor:{}}},Sheet:{Controls:{Optimization:{}},Commands:{},Panels:{Properties:{}}}},Functions:{Library:{}},Shapes:{},Tools:{MenuBar:{},Adapter:{},Manager:{},ModelMigrator:{Executor:{},RuleList:{}}},Utils:{},Views:{Pages:{}},Widget:{Controls:{}},Wizards:{Pages:{}},Validator:{},AddonFunctionManager:{}},Implementation:{},Window:{Utils:{}},Controls:t.Controls,Dao:t.Dao,DataStructures:t.DataStructures,Default:{},Dialogs:{},Setting:{Registry:{},Implement:{}},Env:{Session:{},Recommend:{}},Utils:{},Views:{},Workspace:{},Log:{},EventEmitter:t.EventEmitter,ClassUtils:t.ClassUtils,Vo:t.Vo},Admin:{},COMMUNITY:{}}),this.Brightics.VA.Core.Utils.IDGenerator=t.IDGenerator,this.Brightics.VA.Env.Theme="office",this.Brightics.VA.Env.CoreVersion=r.CORE_VERSION,this.Brightics.VA.Env.Diagram={PAPER_MARGIN_TOP:20,PAPER_MARGIN_LEFT:20,FIGURE_WIDTH:195,FIGURE_HEIGHT:60,GAP_WIDTH:55,GAP_HEIGHT:40},this.Brightics.VA.Env.DiagramInit={PAPER_MARGIN_TOP:20,PAPER_MARGIN_LEFT:20,FIGURE_WIDTH:195,FIGURE_HEIGHT:60,GAP_WIDTH:55,GAP_HEIGHT:20},this.Brightics.VA.Env.Multiplicity={Zero:"0",geZero:"0..*",One:"1",geOne:"1..*"},this.Brightics.VA.Env.Recommend.NextChart={load:["table","scatter"],associationRule:["table","network"],bigDataScatter:["scatter","table"],bigDataLine:["line","table"],bigDataBoxPlot:["boxplot","table"],bigDataColumn:["column","table"],bigDataBar:["bar","table"]},this.Brightics.VA.Env.Recommend.Next={data:{default:["load","createTable","brightics.function.io$load13889","brightics.function.io$read_csv97059"],mdReplaceNumber:["mdReplaceString","imputeNumberTypeFillColumn","numericalVariableDerivation"],mdReplaceString:["mdReplaceNumber","imputeStringTypeFillColumn"],numericalVariableDerivation:["conditionalUpdate","conditionalDerivation"],conditionalDerivation:["conditionalUpdate"],conditionFilter:["minmaxFilter","lengthFilter","stringFilter"],lengthFilter:["stringFilter","conditionFilter","minmaxFilter"],minmaxFilter:["conditionFilter","stringFilter","lengthFilter"],stringFilter:["lengthFilter","conditionFilter","minmaxFilter"],imputeNumberTypeFillColumn:["mdReplaceNumber","numericalVariableDerivation"],imputeRemoveLine:["mdReplaceNumber","mdReplaceString"],imputeStringTypeFillColumn:["mdReplaceString"],join:["imputeRemoveLine","imputeNumberTypeFillColumn","imputeStringTypeFillColumn"],changeColumnName:["capitalizeColName"],frequency:["join"],frequencyMat:["join"],statisticSummary:["join"],capitalizeColName:["changeColumnName"],linearRegressionTrain:["linearRegressionPredict"],linearRegressionPredict:["regressionEvaluation"],logisticRegressionTrain:["logisticRegressionPredict"],logisticRegressionPredict:["binaryClassEvaluation"],movingAverage:["ewma"],pivot:["imputeRemoveLine","imputeNumberTypeFillColumn","imputeStringTypeFillColumn"],hierarchicalClustering:["hierarchicalClusteringPostProcess"],timeSeriesTranspose:["timeSeriesDistance"],quantileDiscretizer:["typeCast"],reorganizeTable:["changeColumnName","capitalizeColName"]},realtime:{default:["streamingRead"]},etl:{default:["erdTSum","fabData","ept"]},deeplearning:{default:["dlLoad","conv2D","maxPooling2D"]},getList:function(t,e){return this[e||"data"][t]||[]}},this.Brightics.VA.Env.Tags={data:["Trend","Timeseries","Transform","Sort","Preprocessing","Add Column","Filter","Remove","Missing Value","Statistics","Prescriptive"],realtime:["I/O","Clustering","Filter","Preprocessing","Prescriptive","Trend","Transform"],etl:[]},this.Brightics.VA.Default.model={addProblems:function(t){t&&this.problemList.indexOf(t)<0&&(this.problemList=this.problemList.concat(t))},getProblemsByFid:function(t){var e=[];for(var n in this.problemList)this.problemList[n]&&this.problemList[n].fid===t&&e.push(this.problemList[n]);return e},getProblemsByMid:function(t){var e=[];for(var n in this.problemList)this.problemList[n]&&this.problemList[n].mid===t&&e.push(this.problemList[n]);return e},newFnUnit:function(t){var r=e.VA.Core.Utils.WidgetUtils.getFunctionLibrary(this.type,t),i={fid:e.VA.Core.Utils.IDGenerator.func.id()};if("ifElse"===t)i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()},{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}};else if("outData"===t){var o=e.VA.Core.Utils.IDGenerator.func.id(),a=e.VA.Core.Utils.IDGenerator.func.id(),s="/brtc/repo/tmp/"+e.VA.Core.Utils.IDGenerator.file.id();i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:o,param:{"fs-paths":[s]}},{fid:a,param:{"input-path":s,"output-path":s+".csv"}}],links:[{kid:e.VA.Core.Utils.IDGenerator.link.id(),sourceFid:o,targetFid:a}]}}}else"refine"===t?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}}:"dbReader"===t?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}}:"load"===t?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}}:"Subflow"===r.defaultFnUnit[FUNCTION_NAME]?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}}:"if"===t?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{if:$.extend(!0,r.defaultFnUnit.param.if,{mid:e.VA.Core.Utils.IDGenerator.model.id()}),elseif:[],else:$.extend(!0,r.defaultFnUnit.param.else,{mid:e.VA.Core.Utils.IDGenerator.model.id()})}}:"forLoop"===t?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{mid:e.VA.Core.Utils.IDGenerator.model.id(),type:"count",prop:{start:"${=}",end:"${=}","index-variable":""}}}:"whileLoop"===t&&(i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{mid:e.VA.Core.Utils.IDGenerator.model.id(),type:"while",prop:{expression:"${=}","index-variable":""}}});if(r.defaultFnUnit.outputs||r.defaultFnUnit.outData){var c=n.createOutData(this.type,t);$.extend(i,c),"refine"===t?(i.param.functions[0][OUT_DATA]=i[OUT_DATA],i.param.entries=[i.param.functions[0].fid]):"dbReader"===t?(i.param.functions[0][OUT_DATA]=i[OUT_DATA],i.param.functions[0].param={"df-names":[i[OUT_DATA][0]]}):"load"===t?(i.param.functions[0][OUT_DATA]=i[OUT_DATA],i.param.functions[0].param={"df-names":[i[OUT_DATA][0]]},i.param.entries=[i.param.functions[0].fid]):"Subflow"===r.defaultFnUnit[FUNCTION_NAME]&&(i.param.functions[0][OUT_DATA]=i[OUT_DATA],i.param.entries=[i.param.functions[0].fid])}return $.extend(!0,{"persist-mode":"auto"},r.defaultFnUnit,i)},addFnUnit:function(t,e){var n=this;t.parent=function(){return n},void 0!==e&&e>-1?n.functions.splice(e,0,t):n.functions.push(t)},removeFnUnit:function(t){var e=-1;for(var n in this.functions){var r=this.functions[n];if(r.fid==t){e=n,delete r.parent;break}}if(e>-1){var i=this.functions[e];return this.functions.splice(e,1),i}},getFnUnitById:function(t){for(var e in this.functions){var n=this.functions[e];if(n.fid==t)return n}},getFnUnitNameById:function(t,e){e=e||this.functions;for(var n in e){var r=e[n];if(r.param&&r.param.functions){var i=this.getFnUnitNameById(t,r.param.functions);if(i)return r.func+"."+i}if(r.fid==t)return r.func}},existsFnUnit:function(t){for(var e in this.functions){var n=this.functions[e];if(n.fid==t)return n;if("Subflow"==n[FUNCTION_NAME])for(var r in n.param.functions)if(n.param.functions[r].fid==t)return n}},getFnUnitByOutTable:function(t){for(var e in this.functions){var r=this.functions[e],i=n.getOutTable(r);if($.inArray(t,i)>-1)return r}},getFnUnitByOutData:function(t){for(var e in this.functions){var r=this.functions[e],i=n.getOutData(r);if($.inArray(t,i)>-1)return r}},getLinkUnitById:function(t){for(var e in this.links){var n=this.links[e];if(n.kid==t)return n}},getRoots:function(t){var e=[],n=this.getPrevious(t);if(0==n.length)e.push(t);else for(var r in n)e=e.concat(this.getRoots(n[r]));return e},getParents:function(t){var e=[];for(var n in this.links){var r=this.links[n];r[TARGET_FID]==t&&(e.push(r[SOURCE_FID]),e=e.concat(this.getParents(r[SOURCE_FID])))}return e},getPrevious:function(t){var e=[];for(var n in this.links){var r=this.links[n];r[TARGET_FID]==t&&e.push(r[SOURCE_FID])}return e},getPreFnUnitByCondition:function(t,e){var n=this.getPrevious(t);for(var r in n){var i=this.getFnUnitById(n[r]);if(e(i))return i}},getNext:function(t){var e=[];for(var n in this.links){var r=this.links[n];r[SOURCE_FID]==t&&e.push(r[TARGET_FID])}return e},getLeafs:function(){var t=[];for(var e in this.functions){var n=this.functions[e];0===this.getNext(n.fid).length&&t.push(n.fid)}return t},getConnectedLinkUnits:function(t){var e=[];for(var n in this.links){var r=this.links[n];r[SOURCE_FID]!=t&&r[TARGET_FID]!=t||e.push(r)}return e},getParamValue:function(t,e){return this.getFnUnitById(t).param[e]},adjustLinks:function(){var t,e=[];for(t in this.functions)this.functions[t]&&e.push(this.functions[t].fid);var n=[];for(t in this.links){var r=this.links[t];(e.indexOf(r[SOURCE_FID]||r["source-fid"])<0||e.indexOf(r[TARGET_FID]||r["target-fid"])<0)&&n.push(r)}for(t in n)this.links.splice(this.links.indexOf(n[t]),1)},getAllPreviousFnUnitIds:function(t){var n=this.getPrevious(t),r=this;return _.unique(n.reduce(function(t,n){var i=r.getFnUnitById(n);if(e.VA.Core.Utils.NestedFlowUtils.isProcessFunction(i)){var o=r.getAllPreviousFnUnitIds(n);return t.concat(o)}return t.concat(n)},[]))},getAllNextFnUnitIds:function(t){var n=this.getNext(t),r=this;return _.unique(n.reduce(function(t,n){var i=r.getFnUnitById(n);if(e.VA.Core.Utils.NestedFlowUtils.isProcessFunction(i)){var o=r.getAllNextFnUnitIds(n);return t.concat(o)}return t.concat(n)},[]))},getAllPreviousFnUnits:function(t){var e=this;return this.getAllPreviousFnUnitIds(t).map(function(t){return e.getFnUnitById(t)})},getAllNextFnUnits:function(t){var e=this;return this.getAllNextFnUnitIds(t).map(function(t){return e.getFnUnitById(t)})},getLinkSourceFnUnits:function(t){var n=this,r=this.getFnUnitById(t);if(e.VA.Core.Utils.NestedFlowUtils.isProcessFunction(r)){var i=this.getPrevious(t);return _.unique(i.reduce(function(t,e){return t.concat(n.getLinkSourceFnUnits(e))},[r]),"fid")}return[r]},getLinkTargetFnUnits:function(t){var n=this,r=this.getFnUnitById(t);if(e.VA.Core.Utils.NestedFlowUtils.isProcessFunction(r)){var i=this.getNext(t);return _.unique(i.reduce(function(t,e){return t.concat(n.getLinkTargetFnUnits(e))},[r]),"fid")}return[r]}},this.Brightics.VA.Default.analyticsModel={type:"data",sheets:[],param:{},functions:[],links:[],preferences:{},problemList:[],report:{title:"Report",data:[]},inVariableList:function(t){return _.findIndex(this.variableRef,function(e){return e.fid===t})},getVariable:function(t,e){var n=this.inVariableList(t);if(n>-1)return this.variableRef[n].param[e]},getVariables:function(t){var e=this.inVariableList(t);if(e>-1)return this.variableRef[e].param},getParameters:function(){return this.param},getParameter:function(t){return this.param[t]},setParameter:function(t,e){this.param[t]=e},addVariableDef:function(t,e){this.variables[t]=$.extend({},e)},removeVariableDef:function(t){delete this.variables[t]},setVariableDef:function(t,e){this.variables[t]&&(this.variables[t]=$.extend({},e))},addVariable:function(t,e,n){var r=this.inVariableList(t);if(r>-1)this.variableRef[r].param[e]=n;else{var i={fid:t,param:{}};i.param[e]=n,this.variableRef.push(i)}},setVariable:function(t,e,n){var r=this.inVariableList(t);r>-1&&this.variableRef[r].param[e]&&(this.variableRef[r].param[e]=n)},removeVariable:function(t,e){var n=this.inVariableList(t);n>-1&&(delete this.variableRef[n].param[e],0===Object.keys(this.variableRef[n].param).length&&this.variableRef.splice(n,1))}},this.Brightics.VA.Utils.CookieUtil={setCookie:function(t,e,n){var r="";if(n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),r="expires="+i.toUTCString()}document.cookie=t+"="+e+"; "+r},getCookie:function(t){for(var e=t+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){for(var i=n[r];" "==i.charAt(0);)i=i.substring(1);if(0==i.indexOf(e))return i.substring(e.length,i.length)}}},this.Brightics.VA.Env.SQLFunctions=["ROUND()","MAX()","MIN()","SUM()","AVG()","OVER()","NVL()","CONCAT()","LPAD()","LTRIM()","RPAD()","RTRIM()","SUBSTR()","SUBSTRING()","FROM_UNIXTIME()","YEAR()","MONTH()","WEEKOFYEAR()"],this.Brightics.VA.Env.PersistFalseFunctions=[]}.call(this),function(){"use strict";var t={},e=brtc_require("crel");t.USER_INPT_ARR_DELIMETER="[i]",this.Brightics.VA.Core.Utils.CommonUtils={getUserBrowserName:function(){!!window.chrome&&window.chrome.webstore;return window.navigator.userAgent.indexOf("Chrome")>=0?"Chrome":document.documentMode?"Internet Explorer":!!window.opr&&!!opr.addons||!!window.opera||navigator.userAgent.indexOf(" OPR/")>=0?"Opera":"undefined"!=typeof InstallTrigger?"Firefox":Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0||"[object SafariRemoteNotification]"===(!window.safari||safari.pushNotification).toString()?"Safari":void 0},downloadJsonFile:function(t,e){var n=this.getUserBrowserName(),r=new Blob([t],{type:"text/json;charset=utf-8;"});if("Internet Explorer"===n)window.navigator.msSaveBlob(r,e+".json");else{var i=URL.createObjectURL(r),o=document.createElement("a");o.setAttribute("href",i),o.setAttribute("download",e+".json"),o.click(),URL.revokeObjectURL(i)}},numberToStringWithComma:function(t){return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},getTimeDifferenceFromNow:function(t){var e=new Date(t);return((new Date).getTime()-e.getTime())/36e5},transferTimestampToDateString:function(t){var e=function(t){return t<10?"0"+t:t};return t.getFullYear()+"-"+e(t.getMonth()+1)+"-"+e(t.getDate())+" "+e(t.getHours())+":"+e(t.getUTCMinutes())+":"+e(t.getUTCSeconds())},convertDataTypeForText:function(t,e){if(void 0===t)return"-";if(-1!==t.indexOf("[")){var n,r=e.replace("[]","");switch(r){case"String":n="S";break;case"Integer":n="I";break;case"Long":n="L";break;case"Double":n="Db";break;case"Date":n="Dt";break;case"Boolean":n="Bl";break;case"Byte":n="Bt";break;default:n=r}return"Array("+n+")"}return"map"===t?"Map":e},convertDataTypeForTitle:function(t,e){return void 0===t?"Undefined Type":-1!==t.indexOf("[")?"Array("+e.replace("[]","")+")":e},getTypes:function(){return[{type:"number",internalType:"Integer"},{type:"number",internalType:"Long"},{type:"number",internalType:"Double"},{type:"string",internalType:"Boolean"},{type:"string",internalType:"String"},{type:"number[]",internalType:"Double[]"},{type:"number[]",internalType:"Long[]"},{type:"string[]",internalType:"Boolean[]"},{type:"string[]",internalType:"String[]"},{type:"byte[]",internalType:"Byte[]"},{type:"number[]",internalType:"Double[]"},{type:"number[]",internalType:"Long[]"},{type:"string[]",internalType:"String[]"},{type:"byte[]",internalType:"Byte[]"},{type:"map",internalType:"Map(Integer,Double)"},{type:"map",internalType:"Map(String,Double)"},{type:"map",internalType:"Map(Integer,Double)"},{type:"map",internalType:"Map(String,String)"},{type:"date",internalType:"Date"}]},fetchFromObject:function(e,n){if(void 0!==e&&void 0!==n)try{var r=e.indexOf("."),i=e.slice(0,r).indexOf(t.USER_INPT_ARR_DELIMETER);if(i>-1){var o=[],a=n[e.substring(0,i)];if(a)for(var s=0;s<a.length;s++){e.indexOf(".")>-1&&o.push(this.fetchFromObject(e.substr(i+4),a[s]))}return o.length>0?o:a}return r>-1?this.fetchFromObject(e.substr(r+1),n[e.substring(0,r)]):n[e]}catch(t){console.error(e),console.error(t)}},isPC:function(){var t=!0;return["win16","win32","win64","macintel","mac"].indexOf(navigator.platform.toLowerCase())<0&&(t=!1),t},byteCalculation:function(t){t=parseInt(t);var e=["bytes","KB","MB","GB","TB","PB"],n=Math.floor(Math.log(t)/Math.log(1024));return"-Infinity"==n?"0 "+e[0]:(t/Math.pow(1024,Math.floor(n))).toFixed(2)+" "+e[n]},getQueryString:function(t){return _.map(t,function(t,e){return e+"="+t}).join("&")},getObjByJsonPath:function(t,e){var n=Array.isArray(e)?e.reduce(function(t,e,n,r){return t=t&&t[e]?t[e]:void 0},t):t[e];return Array.isArray(n)?$.extend(!0,[],n):"object"==typeof n?$.extend(!0,{},n):n},removeArrayElement:function(t,e){_.remove(t,function(t){return e.indexOf(t)>-1})},dim:function(t,n){var r=$((n||{}).appendTo||document.body),i=Promise.resolve().then(function(){return"function"==typeof t?t():t}),o=$(e("div",{class:"brtc-dim"},e("div",{class:"brtc-dim-text brtc-style-apper-1sendond"},e("i",{class:"fa fa-spinner fa-pulse fa-5x fa-fw"}))));return r.append(o),i.then(function(t){return o.remove(),t}).catch(function(t){throw o.remove(),t})},progress:function(t,e){var n=e||{},r=e.showPercent||!1,i=e.msg||"",o=$(n.appendTo||document.body),a=Promise.resolve().then(function(){return"function"==typeof t?t():t}),s=$(' <div class="brtc-va-progress"> <div> <span class="brtc-va-progress-loading"/> <p>'+i+"</p>"+(r?'<p class="brtc-va-progress-percent"></p>':"")+" </div></div>");return s.css("top","0"),s.css("left","0"),o.append(s),a.then(function(t){return s.remove(),t}).catch(function(t){throw s.remove(),t})}}}.call(this),function(){"use strict";this.Brightics.VA.Core.Utils.WidgetUtils={ALPHABET:"23456789abcdefghijkmnpqrstuvwxyz",ID_LENGTH:8,retrieveWidget:function(t){return"string"==typeof t?$(t):t},putWorkspaceRef:function(t,e){this.putData(t,"brtc-va-workspace-body-area-ref",e)},getWorkspaceRef:function(t){var e=t.closest(".brtc-va-workspace-body-area");return this.getData(e,"brtc-va-workspace-body-area-ref")},putStudioRef:function(t,e){this.putData(t,"brtc-studio-ref",e)},getStudioRef:function(t){var e=$(".brtc-va-studio");return this.getData(e,"brtc-studio-ref")},putUdfRef:function(t,e){this.removeUdfRefData(t),this.putData(t,"brtc-udf-ref",e)},getUdfRef:function(t){return this.getData(t,"brtc-udf-ref")},putModelEditorRef:function(t,e){this.putEditorRef(t,e)},getModelEditorRef:function(t){return this.getEditorRef(t,"brtc-va-editors-modeleditor")},closestModelEditor:function(t){return this.closestEditor(t,"brtc-va-editors-modeleditor")},putEditorRef:function(t,e){this.putData(t,"brtc-va-editor-ref",e)},getEditorRef:function(t,e){var n=e||"brtc-va-editor",r=this.closestEditor(t,n);return this.getData(r,"brtc-va-editor-ref")},closestEditor:function(t,e){return t.closest("."+e)},putData:function(t,e,n){t.data(e,n)},getData:function(t,e){return t.data(e)},removeUdfRefData:function(t){t.removeData("brtc-udf-ref")},isRightClick:function(t){var e,n=t||window.event;return n.which?e=3==n.which:n.button&&(e=2==n.button),e||$.jqx.mobile.isTouchDevice()},getRightClick:function(t){if(Brightics.VA.Core.Utils.WidgetUtils.isRightClick(t)){var e=$(window).scrollTop(),n=$(window).scrollLeft();return{x:parseInt(t.clientX)+n,y:parseInt(t.clientY)+e}}},createPaletteItem:function(t,e,n){var r,i,o=$('<div class="brtc-va-views-palette-fnunit-content">'),a=$('<div class="brtc-va-views-palette-fnunit brtc-style-views-palette-fnunit brtc-va-studio-dm-draggable"> <div class="brtc-va-views-palette-fnunit-icon brtc-style-views-palette-fnunit-icon"></div> <div class="brtc-va-views-palette-fnunit-label brtc-style-views-palette-fnunit-label"></div></div>');o.append(a);var s=!1,c=Brightics.VA.Core.Interface.WidgetUtils[n];if(c&&c.createPaletteItem){var l=c.createPaletteItem(e);r=l.label,i=l.category}else{var u="",p="",d="scala";void 0===Brightics.VA.Core.Interface.Functions[n][e]?(u="none",p="none"):(u=Brightics.VA.Core.Interface.Functions[n][e].defaultFnUnit.display.label,p=Brightics.VA.Core.Interface.Functions[n][e].category,s=s||Brightics.VA.Core.Interface.Functions[n][e].deprecated,d=Brightics.VA.Core.Interface.Functions[n][e].defaultFnUnit.context||d),r=u,i="brtc-va-fnunit-category-"+p}return a.attr("title",r),"udf"!==p&&a.attr("context",d).attr("category",p),a.find(".brtc-va-views-palette-fnunit-label").text(r),s&&(r+="\nDeprecated: "+Brightics.VA.Core.Interface.Functions[n][e]["deprecated-message"]),a.attr("title",r),s&&a.addClass("deprecated"),a.addClass(i),t.append(o),this.putData(a,"func",e),a},createPaletteUDFItem:function(t,e,n,r){var i,o,a=$('<div class="brtc-va-views-palette-fnunit-content">'),s=$('<div class="brtc-va-views-palette-fnunit brtc-style-views-palette-fnunit brtc-va-studio-dm-draggable"> <div class="brtc-va-views-palette-fnunit-icon brtc-style-views-palette-fnunit-icon"></div> <div class="brtc-va-views-palette-fnunit-label brtc-style-views-palette-fnunit-label"></div> <div class="brtc-va-views-palette-fnunit-remove-icon brtc-style-views-palette-fnunit-remove-icon" title="Delete"></div></div>');a.append(s);var c=!1,l=Brightics.VA.Core.Interface.WidgetUtils[n];if(l&&l.createPaletteItem){var u=l.createPaletteItem(e);i=u.label,o=u.category}else{var p="",d="",h="scala";void 0===Brightics.VA.Core.Interface.Functions[n][e]?(p="none",d="none"):(p=Brightics.VA.Core.Interface.Functions[n][e].defaultFnUnit.display.label,d=Brightics.VA.Core.Interface.Functions[n][e].category,c=c||Brightics.VA.Core.Interface.Functions[n][e].deprecated,h=Brightics.VA.Core.Interface.Functions[n][e].defaultFnUnit.context),i=p,o="brtc-va-fnunit-category-"+d}return s.attr("title",i),"udf"!==d&&s.attr("context",h),s.find(".brtc-va-views-palette-fnunit-label").text(i),c&&(i+="\nDeprecated: "+Brightics.VA.Core.Interface.Functions[n][e]["deprecated-message"]),s.attr("title",i),s.find(".brtc-va-views-palette-fnunit-remove-icon").on("click",function(e){e.stopPropagation();var n={contentText:"These items will be permanently deleted and cannot be recovered. Are you sure?",close:r,isCancel:!0};Brightics.VA.Core.Utils.WidgetUtils.createCommonConfirmDialog(t,n)}),s.find(".brtc-va-views-palette-fnunit-remove-icon").hide(),s.mouseover(function(t){$(this).find(".brtc-va-views-palette-fnunit-remove-icon").show()}),s.mouseout(function(t){$(this).find(".brtc-va-views-palette-fnunit-remove-icon").hide()}),c&&s.addClass("deprecated"),s.addClass(o),t.append(a),this.putData(s,"func",e),s},createPaletteBox:function(t){var e,n=$('<div class="brtc-va-views-palette-fnunit-content">'),r=$('<div class="brtc-va-views-palette-box-fnunit brtc-va-studio-dm-draggable"> <div class="brtc-va-views-palette-fnunit-icon brtc-style-views-palette-fnunit-icon"></div> <div class="brtc-va-views-palette-fnunit-label brtc-style-views-palette-fnunit-label"></div></div>');n.append(r);var i=Brightics.VA.Core.Interface.WidgetUtils.data;if(i&&i.createPaletteItem){e=i.createPaletteItem(t.func).category}else{var o="",a="scala";void 0===Brightics.VA.Core.Interface.Functions.data[t.func]?o="none":(o=Brightics.VA.Core.Interface.Functions.data[t.func].category,a=Brightics.VA.Core.Interface.Functions.data[t.func].defaultFnUnit.context),e="brtc-va-fnunit-category-"+o}return r.attr("title",t.label),r.find(".brtc-va-views-palette-fnunit-icon").attr("context",a||"scala"),r.find(".brtc-va-views-palette-fnunit-label").text(t.label),r.addClass(e),this.putData(r,"func",t.func),r},createTableItem:function(t,e){var n=$('<div class="brtc-va-views-table-content">'),r=$('<div class="brtc-style-views-table brtc-va-studio-dm-draggable"> <div class="brtc-style-views-table-icon">'+e.type.substring(0,1)+'</div> <div class="brtc-style-views-table-label"></div></div>');return n.append(r),r.attr("title",e.label),r.find(".brtc-style-views-table-label").text(e.label),t.append(n),r},createKeyItem:function(t){var e=$('<div class="brtc-va-views-key-content">'),n=$('<div class="brtc-style-views-key"> <div class="brtc-style-views-key-icon"><i></i></div> <div class="brtc-style-views-key-label"></div></div>');return e.append(n),n.attr("title",t.label),n.find(".brtc-style-views-key-icon").attr(t.type),n.find(".brtc-style-views-key-label").text(t.label),n.find("i").addClass({table:"fa fa-table",model:"fa fa-table",image:"fa fa-table"}[t.type]),e},createDialogContentsArea:function(t,e){var n=$('<div class="brtc-va-dialogs-body-content"> <span class="brtc-va-dialogs-body-content-icon"></span> <div class="brtc-va-dialogs-body-content-content-text"><span></span></div></div>');t.append(n),n.find(".brtc-va-dialogs-body-content-icon").attr("alert",e.type),n.find(".brtc-va-dialogs-body-content-content-text span").text(e.contentText),n.find(".brtc-va-dialogs-body-content-content-text").attr("title",e.contentText),n.find(".brtc-va-dialogs-body-content-content-text").innerHeight()>30&&n.find(".brtc-va-dialogs-body-content-content-text").css("line-height","15px")},openConfirmDialog:function(t,e){this.createCommonConfirmDialog($("body"),{type:"info",isCancel:!0,contentText:t,close:e})},openConfirmWithOptionDialog:function(t,e,n,r){this.createCommonConfirmWithOptionDialog($("body"),{title:t,type:"info",isCancel:!0,contentText:e,optionText:n,close:r})},checkAgentStatus:function(){return $.ajax({url:"api/va/v2/analytics/agentuser/status",blocking:!1,type:"GET"})},createProgressDialog:function(t,e){var n,r={OK:!1,Cancel:!0},i=$('<div class="brtc-va-dialogs-main"> <div class="brtc-va-dialogs-body"> <div class="brtc-va-progress"> <div style="padding-left: 120px;"><span class="brtc-va-progress-loading"></span></div> </div> <div class="brtc-va-dialogs-contents"> <span class="brtc-va-dialogs-body-content-icon" alert="info"></span> <div class="brtc-va-dialogs-body-content-content-text">Please try again later.</div> </div> <div class="brtc-va-dialogs-buttonbar"> <input type="button" class="brtc-va-dialogs-buttonbar-ok" value="OK" /> </div> </div></div>');t.append(i),i.find(".brtc-va-dialogs-body-content-content-text").css("display","none"),i.find(".brtc-va-dialogs-body-content-icon").css("display","none"),(n=i.find(".brtc-va-dialogs-buttonbar-ok")).css("display","none");var o={theme:Brightics.VA.Env.Theme,width:400,height:280,title:e.title,modal:!0,resizable:!1,showCloseButton:!1,open:function(){n.jqxButton({theme:Brightics.VA.Env.Theme}),n.click(function(){r={OK:!0,Cancel:!1},i.dialog("close")})},close:function(){i.dialog("destroy"),i.remove(),"function"==typeof e.close&&e.close(r)},focus:function(){},keyboardCloseKey:""};return i.dialog(o),i.attr("name",o.title),i},getBadRequestErrorMessage:function(t){if(400==t.status){var e=t.responseJSON;if(!e)try{e=JSON.parse(t.responseText)}catch(t){console.error(t)}if(e&&"BR-3203"===e.errors[0].code)return"Sorry! The workspace is not available. Please contact administrator."}},openBadRequestErrorDialog:function(t,e){if(400===t.status){var n=t.responseJSON;if(!n)try{n=JSON.parse(t.responseText)}catch(t){n={errors:[{message:"Sorry! An unexpected error occurred. Please contact administrator.",code:400,detailMessage:t.responseText,detailContentType:"application/json"}]}}if(n&&"BR-3203"===n.errors[0].code){var r=this,i=this.createProgressDialog($("body"),{title:"Preparing workspace...",close:e}),o=0,a=function(){var t=function(){i.find(".brtc-va-progress").css("display","none"),i.find(".brtc-va-dialogs-body-content-content-text").css("display","block"),i.find(".brtc-va-dialogs-body-content-icon").css("display","block"),i.find(".brtc-va-dialogs-buttonbar-ok").css("display","block")};o++,r.checkAgentStatus().done(function(e){"STOP"===e?o>30?(clearTimeout(r.timer),t()):(clearTimeout(r.timer),r.timer=setTimeout(a,2e3)):(clearTimeout(r.timer),t())}).fail(function(e){clearTimeout(r.timer),t()})};clearTimeout(r.timer),r.timer=setTimeout(a,2e3)}else n&&n.errors?this.openErrorDialog(n,e):this.openErrorDialog("Sorry! An unexpected error occurred. Please contact administrator.",e)}else"function"==typeof e&&e({OK:!1,Cancel:!0})},openErrorDialog:function(t,e){var n,r,i;"string"==typeof t?n=this.codeToMessage(t):t.errors&&Array.isArray(t.errors)&&((n=t.errors[0].message)||(n="Sorry! An unexpected error occurred. Please contact administrator."),0==n.indexOf("SparkException:")||0==n.indexOf("NoClassDefFoundError:")?n="Sorry! An unexpected error occurred. Please contact administrator.":0==n.indexOf("Exception:")?n=n.substring(10,msg.length).trim():0==n.indexOf("AnalysisException:")?n=n.substring(18,msg.length).trim():0==n.indexOf("InvalidInputException:")&&(n="Input path does not exist."),n.indexOf("Not allowed condition")>-1&&(n="Can not update. Check schedule status."),t.errors[0].detailMessage&&(r=t.errors[0].detailMessage),t.errors[0].contentType&&(i=t.errors[0].contentType));var o=this;clearTimeout(this.openError),this.openError=setTimeout(function(){o.createCommonConfirmDialog($("body"),{type:"error",isCancel:!1,contentText:n,close:e,detailText:r,detailContentType:i})},500)},openInformationDialog:function(t,e){this.createCommonConfirmDialog($("body"),{type:"info",isCancel:!1,contentText:t,close:e})},openQuestionDialog:function(t,e){this.createCommonConfirmDialog($("body"),{type:"info",okLabel:"Yes",cancelLabel:"No",isCancel:!0,contentText:t,close:e})},openWarningDialog:function(t,e){var n=this;clearTimeout(this.openWarning),this.openWarning=setTimeout(function(){n.createCommonConfirmDialog($("body"),{type:"warn",isCancel:!1,contentText:t,close:e})},500)},createCommonConfirmDialog:function(t,e){var n,r,i,o={OK:!1,Cancel:!0},a=$('<div class="brtc-va-dialogs-main"> <div class="brtc-va-dialogs-body"> <div class="brtc-va-dialogs-contents" style="padding-right: 0 !important; padding-bottom: 10px !important;"> </div> <div class="brtc-va-dialogs-buttonbar"> <input type="button" class="brtc-va-dialogs-buttonbar-ok" value="OK" /> </div> </div></div>');t.append(a),n=a.find(".brtc-va-dialogs-buttonbar-ok"),e.okLabel&&n.val(e.okLabel),e.isCancel&&(r=$('<input type="button" class="brtc-va-dialogs-buttonbar-cancel" value="Cancel" />'),a.find(".brtc-va-dialogs-buttonbar").append(r),e.cancelLabel&&r.val(e.cancelLabel)),e.detailText&&(i=$('<input type="button" class="brtc-va-dialogs-buttonbar-detail" value="Detail" />'),a.find(".brtc-va-dialogs-buttonbar").append(i));var s=this,c={theme:Brightics.VA.Env.Theme,width:400,height:210,modal:!0,resizable:!1,cancelButton:r,open:function(){$(".ui-dialog-titlebar.ui-widget-header").attr("style","border-bottom: none !important;"),$("button.ui-dialog-titlebar-close").css("top","30px !important"),s.createDialogContentsArea(a.find(".brtc-va-dialogs-contents"),e),n.jqxButton({theme:Brightics.VA.Env.Theme}),n.click(function(){o={OK:!0,Cancel:!1},a.dialog("close")}),e.isCancel&&(r.jqxButton({theme:Brightics.VA.Env.Theme}),r.click(function(){o={OK:!1,Cancel:!0},a.dialog("close")})),e.detailText&&(i.jqxButton({theme:Brightics.VA.Env.Theme}),i.click(function(){if(e.detailContentType&&e.detailContentType.startsWith("text/html")){window.open("/detail-popup","Detail Information",["width=800","height=600","menubar=no","status=no","toolbar=no","location=no"].join(",")).document.write(e.detailText)}else new Brightics.VA.Core.Dialogs.DetailDialog(a,{title:"Detail Information",detailText:e.detailText})}))},close:function(){a.dialog("destroy"),a.remove(),"function"==typeof e.close&&e.close(o)},focus:function(){a.focus()}};return a.dialog(c),a.find(".brtc-va-dialogs-main").css("padding-left","5px"),a.attr("name",c.title),a},createCommonConfirmWithOptionDialog:function(t,e){new Brightics.VA.Core.Dialogs.ConfirmWithOptionDialog(t,e)},codeToMessage:function(t){var e;if(t&&Array.isArray(t.errors)){var n="";for(var r in t.errors)(e=t.errors[r].message)||(e="Sorry! An unexpected error occurred. Please contact administrator."),0==e.indexOf("SparkException:")||0==e.indexOf("NoClassDefFoundError:")?e="Sorry! An unexpected error occurred. Please contact administrator.":0==e.indexOf("Exception:")?e=e.substring(10,e.length).trim():0==e.indexOf("AnalysisException:")?e=e.substring(18,e.length).trim():0==e.indexOf("InvalidInputException:")&&(e="Input path does not exist."),e.indexOf("Not allowed condition")>-1&&(e="Can not update. Check schedule status."),n+=e+"\n";return n}return"string"==typeof t?(0==(e=t).indexOf("SparkException:")||0==e.indexOf("NoClassDefFoundError:")?e="Sorry! An unexpected error occurred. Please contact administrator.":0==e.indexOf("Exception:")?e=e.substring(10,e.length).trim():0==e.indexOf("AnalysisException:")?e=e.substring(18,e.length).trim():0==e.indexOf("InvalidInputException:")&&(e="Input path does not exist."),e):t},convertHTMLSpecialChar:function(t){return t?t=(t=(t=(t=(t=t.replace(/&/g,"&")).replace(/</g,"<")).replace(/>/g,">")).replace(/"/g,""")).replace(/\s/g," "):t},adjustCodeMirrorEsc:function(t){t.on("endCompletion",function(t){window.event instanceof KeyboardEvent&&"keydown"==window.event.type&&"Escape"==window.event.key&&window.event.stopPropagation()})},setValidatorToCodeMirror:function(t){var e={};return e.type=void 0===t?"":t["valid-type"],e.isValid=function(t){return!e.type||Brightics.VA.Core.Utils.InputValidator.isValid[e.type](t)},e},changeCodeMirrorLineToSingle:function(t,e){var n=this.setValidatorToCodeMirror(e);t.on("beforeChange",function(t,r){var i=r.text.join("").replace(/\n/g,"");r.update(r.from,r.to,[i]);var o="+input"==r.origin&&"object"==typeof r.text&&""==r.text.join(" "),a="setValue"===r.origin||"+delete"===r.origin?void 0:r.text.join("")||"",s=n.isValid(a);if(!s){var c="※ This character( "+(a="\t"===(a=a.length>10?a.substring(0,9)+"...":a)?"Tab":""===a?"Enter":a)+" ) is NOT allowed.";Brightics.VA.Core.Widget.Factory.createFadeOutMessage($(t.display.lineDiv).closest(".CodeMirror"),{message:c,position:e["valid-message-position"]})}if(o||!s)return t.doc.setCursor(t.getCursor()),r.cancel();if("paste"==r.origin&&"object"==typeof r.text&&r.text.length>1){var l=r.text.join(" ");return r.update(null,null,[l])}return null}),t.setSize("100%","27px")},setCodeMirrorMaxLength:function(t){t.on("beforeChange",function(t,e){var n=t.getOption("maxLength");if(n&&e.update){var r=e.text.join("\n"),i=r.length-(t.indexFromPos(e.to)-t.indexFromPos(e.from));if(i<=0)return $(t.getTextArea()).trigger("hideOverflow"),!0;(i=t.getValue().length+i-n)>0&&($(t.getTextArea()).trigger("showOverflow"),r=r.substr(0,r.length-i),e.update(e.from,e.to,r.split("\n")))}return!0})},createUDFItem:function(t,e,n,r,i){var o,a,s=$('<div class="brtc-va-views-udf-fnunit-content brtc-va-views-udf-type-'+e.type+'">'),c=$('<div class="brtc-va-views-udf-fnunit brtc-style-views-udf-fnunit brtc-va-studio-dm-draggable"> <div class="brtc-va-views-udf-fnunit-icon"></div> <div class="brtc-va-views-udf-fnunit-label"></div> <div class="brtc-va-views-udf-fnunit-version"></div> <div class="brtc-va-views-udf-fnunit-remove-icon brtc-style-udf-fnunit-remove-icon" title="Delete"></div></div>');s.append(c);var l=Brightics.VA.Core.Interface.WidgetUtils[n];if(l&&l.createPaletteItem){var u=l.createPaletteItem(e.id);o=u.label,a=u.category}else{var p="",d="";Brightics.VA.Core.Interface.Functions[n][e.id],p=e.label,d=" ver"+e.version,o=p,a="brtc-va-fnunit-category-"+"udf"}return c.find(".brtc-va-views-udf-fnunit-open-icon").hide(),c.find(".brtc-va-views-udf-fnunit-remove-icon").hide(),c.attr("title",o),c.find(".brtc-va-views-udf-fnunit-label").text(o),c.find(".brtc-va-views-udf-fnunit-version").text(d),c.find(".brtc-va-views-udf-fnunit-open-icon").on("click",function(){i()}),c.mouseover(function(t){$(this).find(".brtc-va-views-udf-fnunit-open-icon").show(),$(this).find(".brtc-va-views-udf-fnunit-remove-icon").show()}),c.mouseout(function(t){$(this).find(".brtc-va-views-udf-fnunit-open-icon").hide(),$(this).find(".brtc-va-views-udf-fnunit-remove-icon").hide()}),c.find(".brtc-va-views-udf-fnunit-remove-icon").on("click",function(){var e={contentText:"These items will be permanently deleted and cannot be recovered. Are you sure?",close:r,isCancel:!0};Brightics.VA.Core.Utils.WidgetUtils.createCommonConfirmDialog(t,e)}),c.addClass(a),t.append(s),this.putData(c,"udf",e),c},getFunctionLibrary:function(t,e){return void 0===Brightics.VA.Core.Interface.Functions[t][e]?Brightics.VA.Core.Interface.Functions[t].unknownFunction:Brightics.VA.Core.Interface.Functions[t][e]},createPrivatePolicy:function(t){var e=$('<div class="brtc-va-widget-utils-private-policy-division"> <span class="brtc-va-widget-utils-private-policy-span">Private Policy</span></div>');t.append(e),e.click(function(){window.open("/private-policy","Brightics Private Policy")});var n=t.find(".brtc-va-workspace-project-list");n&&n.length&&n.css("height","calc(100% - 98px)")},updateGridSource:function(t,e){var n=new $.jqx.dataAdapter(e);t.jqxGrid("source",n),t.jqxGrid("clearfilters"),t.jqxGrid("clearselection"),this.updatePageButton(t)},updatePageButton:function(t){var e=t.jqxGrid("getpaginginformation"),n=t.find(".jqx-grid-pager div[type=button][title=first]"),r=t.find(".jqx-grid-pager div[type=button][title=previous]"),i=t.find(".jqx-grid-pager div[type=button][title=last]"),o=t.find(".jqx-grid-pager div[type=button][title=next]");0===e.pagenum?(n.css("opacity",".3").jqxButton({disabled:!0}),r.css("opacity",".3").jqxButton({disabled:!0})):(n.css("opacity","1").jqxButton({disabled:!1}),r.css("opacity","1").jqxButton({disabled:!1})),0===e.pagescount||e.pagenum===e.pagescount-1?(i.css("opacity",".3").jqxButton({disabled:!0}),o.css("opacity",".3").jqxButton({disabled:!0})):(i.css("opacity","1").jqxButton({disabled:!1}),o.css("opacity","1").jqxButton({disabled:!1}))},debounce:function(t,e){return _.debounce(t,e,{maxWait:e})},setTrimInputControlOnFocusout:function(t){t.focusout(function(e){var n=t.val(),r=Brightics.VA.Core.Utils.InputValidator.isValid;(r.startWithSpace(n)||r.endWithSpace(n))&&(t.val(n.trim()),Brightics.VA.Core.Widget.Factory.createFadeOutMessage(t,{message:"This input value is trimmed.",position:"bottom"}))})},convertInequalitySign:function(t){return t?t=(t=t.replace(/<=/g,"≤")).replace(/>=/g,"≥"):t},destroyJqxControl:function(t){t.find(".jqx-widget").each(function(){var t=$(this).data();if(t.jqxWidget){var e=t.jqxWidget.widgetName;"function"==typeof $(this)[e]&&$(this)[e]("destroy")}})}}}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Dao,n=brtc_require("ResourceManager"),r=brtc_require("FnUnitUtils");function i(t){var e={fidCache:{},outputCache:{}};for(var n in t){var r=t[n];$.extend(!0,e,o(r))}return e}function o(e){var n={fidCache:{},outputCache:{}},r=n.fidCache,o=n.outputCache;for(var a in r[e.fid]=t.VA.Core.Utils.IDGenerator.func.id(),e[OUT_DATA])o[e[OUT_DATA][a]]=t.VA.Core.Utils.IDGenerator.table.id();return e.param.functions&&$.extend(!0,n,i(e.param.functions)),n}function a(e,n,i){var o=i.fidCache,a=i.tidCache,s=function(){return t.VA.Core.Utils.IDGenerator.table.id()},c=function(t,e,n){t[e]=t[e]||n},l=function(e){c(o,e.fid,t.VA.Core.Utils.IDGenerator.func.id()),_.forEach(r.getAllData(e),function(t){c(a,t,s())}),e.param.tableId&&c(a,e.param.tableId,s()),e.param.functions&&_.forEach(e.param.functions,function(t){l(t)})},u=function(n){_.forEach([IN_DATA,OUT_DATA],function(t){_.forEach(n[t],function(t){c(a,t,s())})}),_.forEach(n.functions,function(n){l(n);var r=t.VA.Core.Utils.NestedFlowUtils.getSubModels(e,n);_.forEach(r,u)})};return u(n),i}function s(e,n,r){var i=r.fidCache,o=r.tidCache,a=function(n){for(var s in u(n,o),p(n,o),n.functions){var c=n.functions[s];c.fid=i[c.fid],u(c,o),p(c,o),d(c,o),h(c,i),v(c,o,i),b(c,o),"deeplearning"===n.type&&y(c,i),c.param&&c.param.functions&&a(c.param,r);var l=t.VA.Core.Utils.NestedFlowUtils.getSubModels(e,c);_.forEach(l,a)}n.report&&(_.forEach(n.report.data,function(t){t.originData&&t.originData.data&&(t.originData.data.fid=c.fid,m(t,o))}),n.report=C(n.report,i)),f(n,i)};return a(n),g(e,i),e}function c(e,n){_.forEach(e,function(e){!function(e,n){var r=n.fidCache,i=n.outputCache;e.fid.startsWith("d")?r[e.fid]=r[e.fid]||t.VA.Core.Utils.IDGenerator.dataSource.id():r[e.fid]=r[e.fid]||t.VA.Core.Utils.IDGenerator.func.id();_.forEach(e.outData,function(e){i[e]=i[e]||t.VA.Core.Utils.IDGenerator.table.id()}),e.param.functions&&c(e.param.functions,n)}(e,n)})}function l(t,e){var n=e.fidCache,r=e.outputCache;for(var i in t.functions){var o=t.functions[i];o.fid=n[o.fid],(o=b(o=v(o=h(o=d(o=p(o=u(o,r),r),r),n),r,n),r)).param&&o.param.functions&&l(o.param,e),"deeplearning"==t.type&&(o=y(o,n))}if(t.report){for(var a in t.report.data)t.report.data[a].originData.data.fid=o.fid,t.report.data[a]=m(t.report.data[a],r);t.report=C(t.report,n)}return t=g(t=f(t,n),n)}function u(t,e){return _.forEach(e,function(e,n){r.changeData(t,n,e)}),t}function p(t,e){return _.forEach(e,function(e,n){r.changeData(t,n,e)}),t}function d(t,e){if(t.param&&t.param["df-names"])for(var n in t.param["df-names"])t.param["df-names"][n]=e[t.param["df-names"][n]];return t}function h(t,e){if(t.param&&t.param.entries)for(var n in t.param.entries)t.param.entries[n]=e[t.param.entries[n]];return t}function f(e,n){for(var r in e.links){var i=e.links[r],o=t.VA.Core.Utils.IDGenerator.link.id();i.kid=o,i[SOURCE_FID]=n[i[SOURCE_FID]],i[TARGET_FID]=n[i[TARGET_FID]]}return e}function g(t,e){for(var n in t.variableRef){var r=t.variableRef[n].fid;t.variableRef[n].fid=e[r]}return t}function v(e,n,r){if("outData"===e.func&&"Subflow"===e[FUNCTION_NAME])for(var i in e.param.functions)if("exportData"===e.param.functions[i].func){var o="/brtc/repo/tmp/"+t.VA.Core.Utils.IDGenerator.file.id();e.param["fs-paths"]=[o],e.param.functions[i]&&(e.param.functions[i].param["input-path"]=o,e.param.functions[i].param["output-path"]=o+".csv")}return"DataViewer"===e[FUNCTION_NAME]&&(e.param.fid=r[e.param.fid]),e.param.target&&e.param.linked&&e.param.linked.outputs&&(e.param.target=r[e.param.target],e.param.linked.outputs.model=n[e.param.linked.outputs.model]),e.param.variables&&_.forEach(e.param.variables,function(t,r){const i=e.param.variables[r].param.inData;i&&n[i]&&(e.param.variables[r].param.inData=n[i])}),e}function y(t,e){var n=["train_data","validation_data"];if(!t.param)return t;for(var r=0;r<n.length;r++)t.param[n[r]]&&e[t.param[n[r]]]&&(t.param[n[r]]=e[t.param[n[r]]]);return t}function m(t,e){return t.originData.data.table=e[t.originData.data.table],t}function b(t,e){return t.param.tableId&&(t.param.tableId=e[t.param.tableId]),t}function C(t,e){if(t.pages)for(var n in t.pages){var r=Object.keys(t.pages[n].contents);for(var i in r)t.pages[n].contents[r[i]].dataSourceId=e[t.pages[n].contents[r[i]].dataSourceId]}return t}this.Brightics.VA.Core.Utils.ModelUtils={extendParent:function(t,e){if(e.parent=function(){return t},e.param&&e.param.functions)for(var n in e.param.functions)void 0!==e.param.functions[n].fid&&this.extendParent(e,e.param.functions[n])},extendMainFunc:function(e,n){n.getMainModel=function(){return e},n.isMainModel=function(){return this===this.getMainModel()};var r=t.VA.Core.Utils.NestedFlowUtils.getChildModels(e,n);_.forEach(r,_.partial(this.extendMainFunc.bind(this),e,_))},extendModel:function(e,n){var r,i=this,o=t.VA.Core.Interface.DefaultModel[e.type];if(o){for(var a in r=n?$.extend(!0,{},o,e):$.extend(!0,e,o),_.forIn(r.innerModels,function(t){i.extendInnerModel(r,t)}),(r=$.extend(!0,r,t.VA.Default.model)).functions)r.functions[a]&&(this.extendParent(r,r.functions[a]),void 0===r.functions[a]["persist-mode"]&&(r.functions[a]["persist-mode"]="auto"));return void 0===r["persist-mode"]&&(r["persist-mode"]="auto"),this.extendMainFunc(r,r),r}console.error("Create DefaultModel("+e.type+")!")},extendInnerModel:function(e,n,r){var i,o=t.VA.Implementation.DataFlow.innerModel;if(o){for(var a in i=r?$.extend(!0,{},o,n):$.extend(!0,n,o),(i=$.extend(!0,i,t.VA.Default.model)).functions)i.functions[a]&&(this.extendParent(i,i.functions[a]),void 0===i.functions[a]["persist-mode"]&&(i.functions[a]["persist-mode"]="auto"));return void 0===i["persist-mode"]&&(i["persist-mode"]="auto"),this.extendMainFunc(e,i),i}console.error("Create DefaultModel("+n.type+")!")},exportAsRunnablePromise:function(e,r,i){var o=n.getFile(void 0,e.mid).getProjectId();return t.VA.Core.Utils.NestedFlowUtils.makeRunnable(o,r)},exportAsRunnable:function(t,e){var n=this,r=this.extendModel(t,!0);for(var i in delete r.FUNC_ID_CHAR,delete r.FUNC_ID_LENGTH,delete r.preferences,delete r.problemList,delete r.sheets,void 0!==e&&e||delete r.report,r.entries=[],r.functions){var o=r.functions[i],a=o.display.label||"";if(o.label=a,delete o.display,o.parent().getPrevious(o.fid).length<1&&r.entries.push(o.fid),this.checkAndRemoveOptionalInputs(o),this.carvePersist(o,!0),this.deleteEmptyArray(o),"Subflow"==o[FUNCTION_NAME]&&o.param.functions.length>0)for(var s in o.param.entries||(o.param.entries=[o.param.functions[0].fid]),o.param.functions){var c=o.param.functions[s];a=o.label||"";c.label=a,delete c.display}}return r.innerModels&&(r.innerModels=_.reduce(_.map(r.innerModels,function(t,e){var r={};return r[e]=n.exportAsRunnable(t),r}),_.merge,{})),r},previousFnUnitList:function(t,e,n){var r=t.getPrevious(e);for(var i in r)-1==n.indexOf(r[i])&&n.push(r[i]),this.previousFnUnitList(t,r[i],n)},previousLinks:function(t,e,n){for(var r in t.links){var i=t.links[r];i[TARGET_FID]==e&&(n.push(i),this.previousLinks(t,i[SOURCE_FID],n))}},exportAsRunnableForRealTime:function(t,e,n){var r=this.extendModel(t,!0),i=[];i.push(e.fid),this.previousFnUnitList(r,e.fid,i);var o=[];for(var a in r.functions)for(var s in i)i[s]===r.functions[a].fid&&o.push(r.functions[a]);var c=[];for(var l in this.previousLinks(r,e.fid,c),r.functions=o,r.links=c,delete r.FUNC_ID_CHAR,delete r.FUNC_ID_LENGTH,delete r.preferences,delete r.problemList,delete r.sheets,delete r.title,void 0!==n&&n||delete r.report,r.entries=[],r.functions){if(delete(e=r.functions[l]).display,e.parent().getPrevious(e.fid).length<1&&r.entries.push(e.fid),this.deleteEmptyArray(e),"Subflow"==e[FUNCTION_NAME]&&e.param.functions.length>0)for(var a in e.param.entries||(e.param.entries=[e.param.functions[0].fid]),e.param.functions){delete e.param.functions[a].display}}return r},getModelIds:function t(e,n,r){if("object"!=typeof e)return r;for(var i in e)e.hasOwnProperty(i)&&(i===n&&r.push(e[i]),t(e[i],n,r));return r},getModelIdsWithVersion:function t(e,n,r){if("object"!=typeof e)return r;for(var i in e)if(e.hasOwnProperty(i)){if(i===n){var o={};o[i]=e[i],e.hasOwnProperty("version_id")&&(o.version_id=e.version_id),r.push(o)}t(e[i],n,r)}return r},exportAsRunnableFileByTree:function(t,e,n){return this.createModelTree(t,e).then(function(t){return this._exportAsRunnableFileByTree(e,t,n)}.bind(this))},_exportAsRunnableFileByTree:function(t,e,n){var r=this.exportAsRunnable(t),i={user:"input_user_id",jid:"input_job_id",main:r.mid,args:n,models:{}};if(i.models[r.mid]=r,"control"===r.type){var o=this.getModelIdsWithVersion(r.functions,"mid",[]);_.forEach(o,function(t){var n=t.version_id?t.mid+"_"+t.version_id:t.mid,r=t.version_id?e[t.mid].version[t.version_id]:e[t.mid].main;i.models[n]=this.exportAsRunnable(r.contents)}.bind(this))}else for(var a in r.gv){var s=r.gv[a];for(var c in s.param)n&&!n[s.param[c]]&&delete s.param[c];Object.keys(s.param).length<1&&r.gv.splice(a,1)}return i},createModelTree:function(t,e){var n={};return Promise.all(this._createModelTree(t,e,n)).then(function(){return n})},_createModelTree:function(t,e,r){var i=e.functions,o=function(t,e,r){return r?n.fetchVersion(t,e,r):n.fetchFile(t,e)},a=function(t,e,n){return r[e]=r[e]||{version:{}},n?r[e].version[n]=t:r[e].main=t,!0},s=[];return _.forEach(i,function(e){e.param.functions&&s.push(this._createModelTree(t,e.param.functions,r)),"DataFlow"===e[FUNCTION_NAME]&&s.push(o(t,e.param.mid,e.param.version_id).then(function(t){return void 0===t?Promise.reject('"'+e.display.label+'" dataflow was deleted or format is invalid in selected control flow'):a(t,e.param.mid,e.param.version_id)})),void 0!==e.param.modelId&&s.push(o(t,e.param.modelId,e.param.version_id).then(function(t){return void 0===t?Promise.reject('"'+e.display.label+'" dataflow was deleted or format is invalid in selected report model'):a(t,e.param.modelId,e.param.version_id)}))}.bind(this)),_.flatten(s)},flattenModelTree:function(t,e){var n=[],r=function(t,e){return t.getMajorVersion()!==e.getMajorVersion()?e.getMajorVersion()-t.getMajorVersoin():e.getMinorVersion()-t.getMinorVersion()};return _.forOwn(t,function(t){var e=[],i=!1;_.forOwn(t.version,function(t){e.push(t),i=!0}),e.sort(r),e=_.map(e,function(t){var e=_.cloneDeep(t.getContents());return e.versionTags=t.getTags(),e.versionDescription=t.getDescription(),e.majorVersion=t.getMajorVersion(),e.minorVersion=t.getMinorVersion(),e}),i?e.push(_.omit(e[0],["version_id","versionTags","versionDescription","majorVersion","minorVersion"])):e.push(t.main.contents),n.push(e)}),_.flatten(n)},getModelArrayByTree:function(e,n,r){var i=t.VA.Core.Utils.ModelUtils.flattenModelTree(e,r);return i.push(n.getContents()),i},exportAsRunnableFile:function(e,n,r,i,o){var a=this.exportAsRunnable(e,i),s={};void 0!==a.report&&(s=$.extend(!0,{},a.report),delete a.report);var c={main:a.mid,models:{},reports:{},version:t.VA.Env.CoreVersion};if(o&&(c.duration=o),c.models[a.mid]=a,"control"===a.type){var l=this,u=this.getModelIds(a.functions,"mid",[]);$.each(u,function(t,e){for(var r in n)n[r].id==e&&(c.models[e]=l.exportAsRunnable(n[r].contents,i));c.models[e]&&(i&&c.models[e].report&&c.models[e].report.data.length>0&&(c.reports[e]=$.extend(!0,{},c.models[e].report)),delete c.models[e].report)})}else for(var p in i&&s.data.length>0&&(c.reports[a.mid]=s),a.gv){var d=a.gv[p];for(var h in d.param)r&&!r[d.param[h]]&&delete d.param[h];Object.keys(d.param).length<1&&a.gv.splice(p,1)}return c},fileArrayToModelTree:function(t){var e={};return _.forOwn(t,function(t){var n=t instanceof Array?t:[t];_.forEach(n,function(t){t.version_id?function(t){e[t.mid]=e[t.mid]||{version:{}},e[t.mid].version[t.version_id]=t}(t):function(t){e[t.mid]=e[t.mid]||{},e[t.mid].main=t}(t)})}),e},importModels:function(r,i,o,a){var s={},c={},l={},u=this.cloneModelsByTree(this.fileArrayToModelTree(i));_.forOwn(u,function(e){s[e.main.mid]=t.VA.Core.Utils.IDGenerator.model.id(),l[e.main.mid]=e.main.title});var p=function(t){_.forOwn(t,function(t){t.param.functions&&p(t.param.functions),t.param.mid&&s[t.param.mid]&&(t.param.mid=s[t.param.mid]),t.param.modelId&&s[t.param.modelId]&&(t.param.modelId=s[t.param.modelId]),t.param.tableId&&c[t.param.tableId]&&(t.param.tableId=c[t.param.tableId])})},d={},h=[];return _.forOwn(u,function(n){n.main&&p(n.main.functions),_.forOwn(n.version,function(n){var i=(new t.VA.Vo.Version).setFileId(s[n.mid]).setLabel(n.title).setTags(n.versionTags).setDescription(n.versionDescription).setIsManual(!0).setType(n.type).setMajorVersion(n.majorVersion).setMinorVersion(n.minorVersion),o=_.omit(n,["versionId","versionTags","versionDescription","majorVersion","minorVersion"]);i.setContents(o),h.push(e.VersionDao.addVersion(r,i.getFileId(),i).then(function(t){return d[n.version_id]=t.getVersionId(),t}))})}),Promise.all(h).then(function(){var e=[];return _.forOwn(u,function(i){_.forEach(i.main.functions,function(t){"DataFlow"===t[FUNCTION_NAME]&&t.param.version_id&&(t.param.version_id=d[t.param.version_id])});var o=(new t.VA.Vo.File).setFileId(s[i.main.mid]).setProjectId(r).setLabel(l[i.main.mid]).setDescription("").setCreator(t.VA.Env.Session.userId).setContents(i.main);e.push(n.addFile(r,o))}),Promise.all(e).then(function(t){return _.map(t,function(t){return n.fetchVersions(r,t.getFileId())})})})},makeEntries:function(t){if("Subflow"==t[FUNCTION_NAME]&&t.param.functions.length>0)for(var e in t.param.links||(t.param.links=[]),t.param.entries||(t.param.entries=[],t.param.entries.push(t.param.functions[0].fid)),t.param.functions)this.makeEntries(t.param.functions[e])},isControlFunction:function(t,e){return"data"===(e?e.type:t.parent().type)&&["If","ForLoop","WhileLoop"].indexOf(t[FUNCTION_NAME])>-1},isEmptyExpression:function(t){var e=t||"";return!_.trim(e.substring(3,e.length-1))},deleteEmptyExpression:function(t,e){var n=t.param;"ForLoop"===t[FUNCTION_NAME]?"count"===n.type?(_.has(n.prop,"start")&&this.isEmptyExpression(n.prop.start)&&delete n.prop.start,_.has(n.prop,"end")&&this.isEmptyExpression(n.prop.end)&&delete n.prop.end):"collection"===n.type&&_.has(n.prop,"collection")&&this.isEmptyExpression(n.prop.collection)&&delete n.prop.collection:"While"===t[FUNCTION_NAME]&&"while"===n.type&&_.has(n.prop,"expression")&&this.isEmptyExpression(n.prop.expression)&&delete n.prop.expression},isEmpty:function(t){return _.isUndefined(t)||_.isNull(t)||_.isNaN(t)||(_.isString(t)||_.isArray(t))&&_.isEmpty(t)},deleteEmptyArray:function(e,n){if(e.param)for(var r in e.param)if(this.isControlFunction(e,n))this.deleteEmptyExpression(e,n);else if("functions"==r)for(var i in e.param.functions)this.deleteEmptyArray(e.param.functions[i],n||e.parent());else if(["boolean","number"].some(t=>t===typeof e.param[r])||e.param[r]){var o=e.param[r];if(_.isArray(o)){if(o.length>1)continue;if(this.isEmpty(o[0])){if(this.isEmpty(o[0])){var a=n?n.type:e.parent().type;if(t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(a,e.func).mandatory&&-1!==$.inArray(r,t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(a,e.func).mandatory))continue;delete e.param[r]}}else if(_.isArray(o[0])){if(o[0].length>1)continue;this.isEmpty(o[0][0])&&delete e.param[r]}else this.isEmpty(o[0])&&delete e.param[r]}}else{a=n?n.type:e.parent().type;if(t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(a,e.func).mandatory&&-1!==$.inArray(r,t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(a,e.func).mandatory))continue;delete e.param[r]}},deleteDisplay:function(t){var e="";if(t.display&&t.display.label&&(e=t.display.label),t.label=e,t.display={label:e},"Subflow"==t[FUNCTION_NAME]){var n=t.param.functions;for(var r in n)this.deleteDisplay(n[r])}},getKeyMapFromModelTree:function(t){var e={fidCache:{},outputCache:{}};return _.forOwn(t,function(t){t.main&&c(t.main.functions,e),t.version&&_.forOwn(t.version,function(t){c(t.functions,e)})}),e},cloneModelsByTree:function(e){var n=this.getKeyMapFromModelTree(e),r={},i=function(e,n,r){var i=$.extend(!0,{},e);return r&&i.mid&&(i.mid=t.VA.Core.Utils.IDGenerator.model.id()),i=l(i,n)};return _.forOwn(e,function(t,e){r[e]={},t.main&&(r[e].main=i(t.main,n)),t.version&&(r[e].version={},_.forOwn(t.version,function(t,o){r[e].version[o]=i(t,n)}))}),r},cloneModel:function(e){if("data"===e.type)return function(e){var n=_.cloneDeep(e),r={},i=function(e){r[e]=r[e]||t.VA.Core.Utils.IDGenerator.model.id()},o=function(t){return r[t]},c=function(e){_.forEach(e.functions,function(e){"If"===e[FUNCTION_NAME]&&(i(e.param.if.mid),_.forEach(e.param.elseif,function(t){i(t.mid)}),i(e.param.else.mid)),"ForLoop"!==e[FUNCTION_NAME]&&"WhileLoop"!==e[FUNCTION_NAME]||i(e.param.mid);var r=t.VA.Core.Utils.NestedFlowUtils.getSubModels(n,e);_.forEach(r,c)})};_.forEach(n.innerModels,function(t,e){i(e)});var l=function(e){_.forEach(e.functions,function(e){var r=t.VA.Core.Utils.NestedFlowUtils.getSubModels(n,e);_.forEach(r,l),"If"===e[FUNCTION_NAME]&&(e.param.if.mid=o(e.param.if.mid),_.forEach(e.param.elseif,function(t){t.mid=o(t.mid)}),e.param.else.mid=o(e.param.else.mid)),"ForLoop"!==e[FUNCTION_NAME]&&"WhileLoop"!==e[FUNCTION_NAME]||(e.param.mid=o(e.param.mid))})};c(n),l(n),n.innerModels=_.reduce(_.map(n.innerModels,function(t){t.mid=o(t.mid);var e={};return e[t.mid]=t,e}),_.merge,{});var u={fidCache:{},tidCache:{}};return a(n,n,u),s(n,n,u),n}(this.extendModel(e));var n=$.extend(!0,{},e);return n.mid&&(n.mid=t.VA.Core.Utils.IDGenerator.model.id()),n=l(n,i(n.functions))},cloneFnUnit:function(t){var e=o(t),n=$.extend(!0,{},t),r=e.fidCache,i=e.outputCache;return n.fid=r[n.fid],n[IN_DATA]&&(n[IN_DATA]=[]),"unload"===n.func&&(n.param["df-names"]=[]),(n=p(n,i)).param=l(n.param,e),n},checkAndRemoveOptionalInputs:function(t){t.inputs&&t.meta&&Object.keys(t.inputs).filter(e=>""===t.inputs[e]&&t.meta[e]&&t.meta[e].optional).forEach(e=>delete t.inputs[e])},carvePersist:function(e,n){var r,i=t.VA.SettingStorage.DEFAULT_SETTINGS["common.persist.mode"];r=t.VA.Core.Functions.Library[e.func]?t.VA.Core.Functions.Library[e.func].defaultFnUnit.persist:i;var o=e.parent()["persist-mode"];"user-mode"===i&&("true"===e["persist-mode"]?e.persist=!0:"false"===e["persist-mode"]?e.persist=!1:e.persist="true"===o||"false"!==o),"performance-mode"===i&&(e.persist=void 0!==r&&r),"storage-mode"===i&&(e.persist=void 0===r||r),"Subflow"===e[FUNCTION_NAME]&&e.param.functions.length>0&&(e.param.functions[e.param.functions.length-1].persist=!0)},generateVersionText:function(t){return t.major_version+"."+t.minor_version},openDocumentationPopup:function(){if("true"===t.VA.SettingStorage.getValue("common.document.useonline")){var e=t.VA.SettingStorage.getValue("common.document.onlinedocurl");""===e&&(e=t.VA.SettingStorage.getValue("common.document.onlinedocurl.default")),window.open(e).blur()}else t.VA.Core.Utils.WidgetUtils.openErrorDialog("Help document installed in Local does not exist.\nSet up on-line help service url or contact your administrator.\n(Settings > Preferences > Common > Use on-line help..)")},openFunctionReferencePopup:function(e,n,r,i){var o,a;if("true"===t.VA.SettingStorage.getValue("common.document.useonline")){var s=t.VA.SettingStorage.getValue("common.document.onlinedocurl");""===s&&(s=t.VA.SettingStorage.getValue("common.document.onlinedocurl.default")),s=_.trimRight(s,"/");try{var c=[s,(navigator.language||navigator.userLanguage).toLowerCase(),"ai","v"+(t.VA.Env.CoreVersion||"3.0"),"function_reference",r||"scala",n].join("/");o=window.open(c)}catch(t){o=window.open(s)}}else a="api/va/v2/help/function",n&&(a=a+"/"+n),a=a+"?type="+e+(r?"&context="+r:"")+(i?"&func="+i:""),o=window.open(a,"Brightics Help");o.blur()},createCachePersist:function(t,e){return c(t,e)},setKeys:function(t,e){return l(t,e)},createFileContents:function(e,n,r,i){var o=$.extend(!0,{},e);o.mid=n,r&&(o.title=r),i&&(o.description=i);var a,s,c,l,u,p,d,h,f={},g={};for(a in o.functions){for(c in f[(u=o.functions[a]).fid]=t.VA.Core.Utils.IDGenerator.func.id(),u[OUT_DATA])g[u[OUT_DATA][c]]=t.VA.Core.Utils.IDGenerator.table.id();if("Subflow"===u[FUNCTION_NAME])for(b in u.param.functions)for(l in f[(p=u.param.functions[b]).fid]=t.VA.Core.Utils.IDGenerator.func.id(),p[OUT_DATA])g[p[OUT_DATA][l]]=t.VA.Core.Utils.IDGenerator.table.id()}for(a in o.functions){for(b in(u=o.functions[a]).fid=f[u.fid],u[IN_DATA])u[IN_DATA][b]=g[u[IN_DATA][b]];for(b in u[OUT_DATA])u[OUT_DATA][b]=g[u[OUT_DATA][b]];if("unload"===u.func)for(b in u.param["df-names"])u.param["df-names"][b]=g[u.param["df-names"][b]];if("Subflow"===u[FUNCTION_NAME]){for(b in u.param.entries)u.param.entries[b]=f[u.param.entries[b]];for(b in u.param.functions){for(s in(p=u.param.functions[b]).fid=f[p.fid],p[IN_DATA])p[IN_DATA][s]=g[p[IN_DATA][s]];for(s in p[OUT_DATA])p[OUT_DATA][s]=g[p[OUT_DATA][s]];if("load"===p.func)for(s in p.param["df-names"])p.param["df-names"][s]=g[p.param["df-names"][s]];if("unload"==p.func){for(s in p.param["df-names"])p.param["df-names"][s]=g[p.param["df-names"][s]];var v="/brtc/repo/tmp/"+t.VA.Core.Utils.IDGenerator.file.id();p.param["fs-paths"]=[v],u.param.functions[parseInt(b)+1]&&(u.param.functions[parseInt(b)+1].param["input-path"]=v,u.param.functions[parseInt(b)+1].param["output-path"]=v+".csv")}}for(b in u.param.links)(h=u.param.links[b]).kid=t.VA.Core.Utils.IDGenerator.link.id(),h[SOURCE_FID]=f[h[SOURCE_FID]],h[TARGET_FID]=f[h[TARGET_FID]]}}for(a in o.links)(d=o.links[a]).kid=t.VA.Core.Utils.IDGenerator.link.id(),d[SOURCE_FID]=f[d[SOURCE_FID]],d[TARGET_FID]=f[d[TARGET_FID]];if("visual"===o.type){var y=o.report.pages;for(a in y.push({id:t.VA.Core.Utils.IDGenerator.reportPage.id(),contents:{}}),y){var m=y[a].contents;for(var b in m)m[b].dataSourceId&&f[m[b].dataSourceId]&&(m[b].dataSourceId=f[m[b].dataSourceId])}}return o},initDefaultModelContents:function(){var t=this,e={url:"api/va/v2/studio/templates/data",type:"GET",contentType:"application/json; charset=utf-8",blocking:!0};$.ajax(e).done(function(e){var n=_.findIndex(e,function(t){return"Default"===t.name});n>-1&&(t.defaultModelContents=e[n].contents)})},getDefaultModelContents:function(){return this.defaultModelContents},createCacheNestedFlow:a,setKeyNestedFlow:s}}.call(this),function(){"use strict";this.Brightics.VA.Core.Utils.InputValidator={isDefaultKeyCode:function(t){var e=t.keyCode,n=t.ctrlKey;return!!(-1!==$.inArray(e,[46,8,9,27,13,110])||n||16===e||17===e||e>=35&&e<=40)},isNotInsertKeyCode:function(t){var e=t.keyCode,n=t.ctrlKey;return!!(-1!==$.inArray(e,[8,27,46,110])||n&&-1!==$.inArray(e,[65,67,88,90])||e>=35&&e<=40)},isValid:{type1:function(t){return new RegExp("^[a-zA-Z0-9_]+$").test(t)},type2:function(t){return new RegExp("^[a-zA-Z0-9_\\s]+$").test(t)},type3:function(t){return new RegExp("^[a-zA-Z0-9_{}\\$]+$").test(t)},type4:function(t){return new RegExp("^[a-zA-Z0-9_\\.]+$").test(t)},type5:function(t){return new RegExp("^[0-9_]").test(t)},type6:function(t){return new RegExp("^[a-zA-Z ]+$").test(t)},columnNameType:function(t){return!new RegExp("^[0-9]+").test(t)},integerType:function(t){return new RegExp("^[0-9]+$").test(t)},startWithSpace:function(t){return new RegExp("^\\s").test(t)},endWithSpace:function(t){return new RegExp("\\s$").test(t)},cronType:function(t){return new RegExp("^[A-Z0-9-?*/,# ]+$").test(t)},rangeType:function(t){return new RegExp("^[0-9_.-~]+$").test(t)},featureEncodingRangeType:function(t){return new RegExp("^[0-9_.~]+$").test(t)},fileNameType:function(t){return new RegExp("^[a-zA-Z0-9_./@]+$").test(t)},renamefileType:function(t){return new RegExp("^[a-zA-Z0-9_.]+$").test(t)}},replaceKoreanToEmpty:function(t){return t.replace(/[ㄱ-ㅎㅏ-ㅣ가-힣]/g,"")},appendValidationCondition:function(t){var e=this;if(t.attr("valid-type")){var n=t.attr("valid-type");t.on("paste",function(r){var i=(r.originalEvent.clipboardData||window.clipboardData).getData("Text");if(!e.isValid[n](i)){r.preventDefault();Brightics.VA.Core.Widget.Factory.createFadeOutMessage(t,{message:"※ This pasted string is NOT allowed."})}}),t.keydown(function(r){if(!e.isDefaultKeyCode(r)){var i,o={Spacebar:" ",Up:"ArrowUp",Down:"ArrowDown",Left:"ArrowLeft",Right:"ArrowRight"}[(i=r).key]||i.key;if(e.isValid[n](o)||"Process"!==o){if(!e.isValid[n](o)){r.preventDefault();a="※ This character( "+o+" ) is NOT allowed.";Brightics.VA.Core.Widget.Factory.createFadeOutMessage(t,{message:a})}}else{var a="※ Korean character is NOT allowed.";Brightics.VA.Core.Widget.Factory.createFadeOutMessage(t,{message:a});var s=e.replaceKoreanToEmpty(t.val());e.replaceKoreanToEmptyTimeout&&clearTimeout(e.replaceKoreanToEmptyTimeout),e.replaceKoreanToEmptyTimeout=setTimeout(function(){t.val(s)},100)}}})}}}}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){try{this.$mainControl=t,this.options=e,this.verifier=e.verifier,this.data=null,this.createControls()}catch(t){console.error(t)}}e.prototype.createControls=function(){this.verifier&&this.verifier.getSyntaxRule();this.initCodeMirror()},e.prototype.initCodeMirror=function(){var e=this,n={mode:this.verifier?this.verifier.getRuleMode():"brtc-default",theme:"default",lineNumbers:!1,lineWrapping:!0,scrollbarStyle:void 0!==e.options.scrollbarStyle?"null":"simple",placeholder:"Enter value",extraKeys:{"Ctrl-Space":"autocomplete"},showTrailingSpace:!0,autoCloseBrackets:!0,matchBrackets:!0},r=$.extend(!0,{},n,this.options);this.codeMirror=CodeMirror.fromTextArea(this.$mainControl[0],r),this.codeMirror.on("focus",function(t,n){e.old=t.getValue()}),this.codeMirror.on("blur",function(t,n){t.getValue()!=e.old&&"function"==typeof e.callback&&e.callback("change",n)}),t.VA.Core.Utils.WidgetUtils.adjustCodeMirrorEsc(this.codeMirror)},e.prototype.getValue=function(){return this.codeMirror.getValue()},e.prototype.setValue=function(t){this.codeMirror.setValue(t)},e.prototype.onChange=function(t){this.callback=t},e.prototype.getControl=function(){return this.$mainControl},this.Brightics.VA.Core.Editors.Sheet.Controls.TextAreaControl=e}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){this.parentId=t,this.options=this.setOptions(e),this.retrieveParent(),this.createControls(),this.createEditorCommands(),this.registerEventListener(),this.setValue(this.options.value),this.navigateFileEnd()}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId)},e.prototype.setOptions=function(t){return $.extend(!0,{},t)},e.prototype.createControls=function(){this.$mainControl=$('<div class="brtc-va-widget-ace-editor-control"></div>'),this.$parent.append(this.$mainControl),this.editor=ace.edit(this.$mainControl[0]),this.options.mode&&this.editor.session.setMode("ace/mode/"+this.options.mode),this.editor.setTheme("ace/theme/eclipse");var t={enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0,minLines:10,maxLines:10};this.options.editorOptions&&$.extend(!0,t,this.options.editorOptions),this.editor.setOptions(t),this.editor.setShowPrintMargin(!1),this.editor.$blockScrolling=1/0},e.prototype.getWrapperDiv=function(){return this.$mainControl},e.prototype.createEditorCommands=function(){for(var t in this.options.commands)this.editor.commands.addCommand(this.options.commands[t])},e.prototype.registerEventListener=function(){for(var t in this.options.events)this.editor.addEventListener(this.options.events[t].name,this.options.events[t].event)},e.prototype.setValue=function(t){this.editor.setValue(t)},e.prototype.getValue=function(){return this.editor.getValue()},e.prototype.getEditor=function(){return this.editor},e.prototype.resize=function(){this.editor.resize()},e.prototype.navigateFileEnd=function(){return this.editor.navigateFileEnd()},e.prototype.getCursorPosition=function(){return this.editor.getCursorPosition()},e.prototype.getSession=function(){return this.editor.session},e.prototype.insert=function(t){this.editor.insert(t)},e.prototype.focus=function(){this.editor.focus()},e.prototype.setHeight=function(t){this.$mainControl.css("height",t)},e.prototype.destroy=function(){this.editor.destroy(),this.$mainControl.remove()},t.VA.Core.Widget.Controls.AceEditorControl=e}.call(this),function(){"use strict";var t=this.Brightics,e={button:{visible:!0,disabled:!1,checked:!0,on:{label:"ON",value:"on"},off:{label:"OFF",value:"off"}}};function n(t,e){this.parentId=t,this.initOptions(e),this.retrieveParent(),this.createControls(),this.setInputValue()}n.prototype.initOptions=function(t){this.options=$.extend(!0,{},e,t),this.variableKey=Object.keys(this.options.variable)[0],this.inputType=this.options.variable[this.variableKey].type,this.variableType=this.options.variable[this.variableKey]["variable-type"],this.variableValue=this.options.variable[this.variableKey].value},n.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId)},n.prototype.createControls=function(){var t=this;this.$mainControl=$('<div class="brtc-va-widget-container"> <div class ="brtc-va-widget-remove" /> <div class="brtc-va-widget-header"> <div class="brtc-va-widget-label">'+this.variableKey+'</div> <div class="brtc-va-widget-type-button-area"><div class="brtc-va-widget-type-switch-button"></div></div> </div> <div class="brtc-va-widget-contents"><div class="brtc-va-widget-contents-input-container-wrapper"></div></div></div>'),this.$parent.append(this.$mainControl),this.$mainControl.find(".brtc-va-widget-label").addClass(this.variableType),this.options.mandatory&&this.$mainControl.find(".brtc-va-widget-label").addClass("mandatory"),this.createTypeButtonControl(),this.createContentsArea(),this.$mainControl.find(".brtc-va-widget-remove").on("click",function(){"function"==typeof t.options.onRemoveCallback&&(t.options.onRemoveCallback(t.createFormattedValue()),t.$mainControl.remove())}),"calculation"===this.variableType&&(this.$mainControl.find(".brtc-va-widget-type-button-area").hide(),this.$mainControl.find(".brtc-va-widget-contents-input-control-container").addClass("read-only"))},n.prototype.createTypeButtonControl=function(){var t=this;if(this.$btnArea=this.$mainControl.find(".brtc-va-widget-type-switch-button"),this.options.button.visible){var e,n,r=this.options.button.on.label,i=this.options.button.on.value;this.isArrayValue()?(e="Variable",n="expression"):(e=this.options.button.off.label,n=this.options.button.off.value),this.$btnArea.jqxSwitchButton({height:"100%",width:"100px",thumbSize:"15%",onLabel:r,offLabel:e,checked:this.setSwitchButtonChecked()}),this.inputType=this.$btnArea.val()?i:n,this.$btnArea.on("change",function(e){t.variableValue=t.getInputValue(),t.inputType=t.$btnArea.val()?i:n,t.$contentsArea.empty(),t.createContentsArea(),t.setInputValue(),t.triggerChangeInputValue(!0)})}},n.prototype.setSwitchButtonChecked=function(){var t,e,n=this.options.button.on.value;return e=this.isArrayValue()?"expression":this.options.button.off.value,this.inputType===n?t=!0:this.inputType===e?t=!1:(this.inputType=this.options.button.checked?n:e,t=this.options.button.checked),t},n.prototype.isArrayValue=function(){return"array"===this.variableType&&this.options.button.visible},n.prototype.createContentsArea=function(){this.$contentsArea=this.$mainControl.find(".brtc-va-widget-contents-input-container-wrapper"),this.isArrayValue()?"expression"!==this.inputType?this.createArrayInputControl():(this.$contentsArea.append($('<div class="brtc-va-widget-contents-input-container"> <div class="brtc-va-widget-contents-input-control-container"></div></div>')),this.createCodeInputControl(this.$contentsArea.find(".brtc-va-widget-contents-input-control-container"))):this.createSingleInputControl()},n.prototype.createArrayInputControl=function(){if(0===this.variableValue.length)this.createInputControlLayout(0,this.isArrayValue());else if(this.variableValue instanceof Array)for(var t=0;t<this.variableValue.length;t++)this.createInputControlLayout(t,this.isArrayValue());else this.createInputControlLayout(0,this.isArrayValue());this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar()},n.prototype.createSingleInputControl=function(){this.createInputControlLayout(0,!1)},n.prototype.createInputControlLayout=function(t,e,n){var r=this.$contentsArea,i=this,o=!1,a=$('<div class="brtc-va-widget-contents-input-container"></div>'),s=r.find(".brtc-va-widget-contents-input-container");0!==s.length&&s[t]?($(s[t]).after(a),o=!0):r.append(a);var c,l,u=$('<div class="brtc-va-widget-contents-input-control-container"></div>');a.append(u),(t>0||o)&&(l=$('<div class="brtc-va-widget-contents-input-control-delete"></div>'),a.append(l),l.click(function(t){i.handleDeleteButtonClick($(this).closest(".brtc-va-widget-contents-input-container"))})),e&&(c=$('<div class="brtc-va-widget-contents-input-control-add"></div>'),a.append(c),c.click(function(t){i.handleAddInputControlEvent($(this).closest(".brtc-va-widget-contents-input-container"))})),this.isArrayValue()?this.createInputControl(u,n):this.createCodeInputControl(u,n)},n.prototype.createInputControl=function(e,n){var r=this,i=$('<input type="text" class="brtc-va-widget-contents-input-control"/>');e.append(i);var o={theme:t.VA.Env.Theme,height:"25px",width:"100%",placeHolder:"Enter value"};i.jqxInput(o),n&&i.jqxInput("focus"),i.keydown(function(t){13==t.keyCode&&r.isArrayValue()&&r.handleAddInputControlEvent(i.closest(".brtc-va-widget-contents-input-container"),!0)}),i.focusout(function(t){r.triggerChangeInputValue()})},n.prototype.createCodeInputControl=function(e,n){var r=this,i=$('<textarea class="brtc-va-widget-contents-input-control"/>');e.append(i);var o={mode:"brtc-control",scrollbarStyle:"null",placeholder:this.options.button.visible?"calculation"==this.inputType?"Enter expression\tex. ${Variable1}+${Variable2}":"Enter value\tex. 1":"Enter variable\tex. ${Variable1}",lineWrapping:!1,matchBrackets:!1,extraKeys:{"Ctrl-Space":"autocomplete",Tab:!1,"Shift-Tab":!1},showTrailingSpace:!0,hintOptions:{list:[]},readOnly:"calculation"===this.variableType};this.codeMirror=CodeMirror.fromTextArea(i[0],o);var a={"valid-message-position":this.options["valid-message-position"],"valid-type":this.options.button.visible?this.isArrayValue&&"expression"===this.inputType?"type3":"":"type3"};t.VA.Core.Utils.WidgetUtils.changeCodeMirrorLineToSingle(this.codeMirror,a),this.codeMirror.on("blur",function(t,e){r.triggerChangeInputValue()})},n.prototype.handleAddInputControlEvent=function(t,e){var n=t.index();this.createInputControlLayout(n,!0,e),this.triggerChangeInputValue(),this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar("update");var r=this.$mainControl.parents(".ps-container");r&&r.length&&r.perfectScrollbar("update")},n.prototype.handleDeleteButtonClick=function(t){t.remove(),this.triggerChangeInputValue(),this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar("update");var e=this.$mainControl.parents(".ps-container");e&&e.length&&e.perfectScrollbar("update")},n.prototype.triggerChangeInputValue=function(t){if("function"==typeof this.options.onChangeCallback){var e=this.getInputValue();(JSON.stringify(e)!==JSON.stringify(this.variableValue)||t)&&(this.variableValue=e,this.options.onChangeCallback(this.createFormattedValue()))}},n.prototype.createFormattedValue=function(){return{key:this.variableKey,type:this.inputType,"variable-type":this.variableType,value:this.variableValue}},n.prototype.getFormattedValue=function(){return{key:this.variableKey,type:this.inputType,"variable-type":this.variableType,value:this.getInputValue()}},n.prototype.getInputValue=function(){var t,e=this.$contentsArea.find(".brtc-va-widget-contents-input-control");if(this.isArrayValue()&&"expression"!==this.inputType){t=[];for(var n=0;n<e.length;n++)t.push($(e[n]).val())}else t=this.codeMirror.getValue();return t},n.prototype.setVariableType=function(t){this.variableType=t,this.$contentsArea.empty(),this.createContentsArea()},n.prototype.setInputValue=function(t){void 0!==t&&(this.variableValue=t);var e,n=this.$contentsArea.find(".brtc-va-widget-contents-input-control");if(this.isArrayValue()&&"expression"!==this.inputType)if(Array.isArray(this.variableValue))if(n.length>this.variableValue.length)for(e=0;e<n.length;e++)void 0===this.variableValue[e]?$(n[e]).parents(".brtc-va-widget-contents-input-container").remove():$(n[e]).val(this.variableValue[e]||"");else{for(e=n.length;e<this.variableValue.length;e++)this.createInputControlLayout(e,!0);for(n=this.$contentsArea.find(".brtc-va-widget-contents-input-control"),e=0;e<n.length;e++)$(n[e]).val(this.variableValue[e]||"")}else $(n[0]).val(this.variableValue||"");else Array.isArray(this.variableValue)?this.codeMirror.setValue(this.variableValue[0]):this.codeMirror.setValue(this.variableValue)},n.prototype.setRemovable=function(t){this.options.removable=t,t?this.$mainControl.find(".brtc-va-widget-remove").addClass("removable"):this.$mainControl.find(".brtc-va-widget-remove").removeClass("removable")},n.prototype.getOptions=function(){return this.options},this.Brightics.VA.Core.Widget.Controls.ArgumentControl=n}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){this.parentId=t,this.initOptions(e),this.retrieveParent(),this.createControls()}e.prototype.initOptions=function(t){this.options=t,this._isNumberType="number"===this.options.type},e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId)},e.prototype.createControls=function(){this.$mainControl=$('<div class="brtc-va-widget-container"> <div class="brtc-va-widget-contents"><div class="brtc-va-widget-contents-input-container-wrapper"></div></div></div>'),this.$parent.append(this.$mainControl),this.$contentsArea=this.$mainControl.find(".brtc-va-widget-contents-input-container-wrapper"),this.createArrayInputControl(this.$contentsArea)},e.prototype.createArrayInputControl=function(){this.createInputControlLayout(0),this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar()},e.prototype.createInputControlLayout=function(t){var e=this.$contentsArea,n=this,r=!1,i=$('<div class="brtc-va-widget-contents-input-container"></div>'),o=e.find(".brtc-va-widget-contents-input-container");0!==o.length&&o[t]?($(o[t]).after(i),r=!0):e.append(i);var a,s,c=$('<div class="brtc-va-widget-contents-input-control-container"></div>');i.append(c),(t>0||r)&&(s=$('<div class="brtc-va-widget-contents-input-control-delete"></div>'),i.append(s),s.click(function(t){n.handleDeleteButtonClick($(this).closest(".brtc-va-widget-contents-input-container"))})),a=$('<div class="brtc-va-widget-contents-input-control-add"></div>'),i.append(a),a.click(function(t){n.handleAddInputControlEvent($(this).closest(".brtc-va-widget-contents-input-container"))}),this._isNumberType?this.createNumericInputControl(c):this.createInputControl(c)},e.prototype.createNumericInputControl=function(e){var n=this,r={theme:t.VA.Env.Theme,height:"25px",width:"100%",numberType:"double",placeHolder:this.options.placeholder||"Enter value",className:["brtc-va-widget-contents-array-input-control"]};new t.VA.Core.Widget.Controls.NumericInput(e,r).onChange(function(){n.triggerChangeInputValue()})},e.prototype.createInputControl=function(e){var n=this,r=$('<input type="text" class="brtc-va-widget-contents-array-input-control"/>');e.append(r);var i={theme:t.VA.Env.Theme,height:"25px",width:"100%",placeHolder:this.options.placeholder||"Enter value"};r.jqxInput(i),r.focusout(function(t){n.triggerChangeInputValue()})},e.prototype.handleAddInputControlEvent=function(t){var e=t.index();this.createInputControlLayout(e),this.triggerChangeInputValue(),this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar("update");var n=this.$mainControl.parents(".ps-container");n&&n.length&&n.perfectScrollbar("update")},e.prototype.handleDeleteButtonClick=function(t){t.remove(),this.triggerChangeInputValue(),this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar("update");var e=this.$mainControl.parents(".ps-container");e&&e.length&&e.perfectScrollbar("update")},e.prototype.triggerChangeInputValue=function(t){if("function"==typeof this.options.onChangeCallback){var e=this.getInputValue();(JSON.stringify(e)!==JSON.stringify(this._preValue)||t)&&(this.options.onChangeCallback(e),this._preValue=e)}},e.prototype.getInputValue=function(){var t,e=this.$contentsArea.find(".brtc-va-widget-contents-array-input-control");(t=[]).length=e.length;for(var n=0;n<e.length;n++){var r=this.getValueByType($(e[n]).val());t[n]=r}return t},e.prototype.setValue=function(t){this._preValue=t;var e,n=this.$contentsArea.find(".brtc-va-widget-contents-array-input-control");if(n.length>t.length)for(e=0;e<n.length;e++)void 0!==t[e]&&$(n[e]).val(this.getValueByType(t[e])),e>=t.length&&0!==t.length&&$(n[e]).closest(".brtc-va-widget-contents-input-container").remove();else{for(e=n.length;e<t.length;e++)this.createInputControlLayout(e,!0);for(n=this.$contentsArea.find(".brtc-va-widget-contents-array-input-control"),e=0;e<n.length;e++)$(n[e]).val(this.getValueByType(t[e]))}},e.prototype.toString=function(t){return _.isNull(t)||_.isUndefined(t)||""===t?"":_.isNumber(t)?_.isNaN(t)||_.isUndefined(t)?"":t.toString():t},e.prototype.toNumber=function(t){return _.isNull(t)||_.isUndefined(t)||""===t?null:Number(this.toString(Number(t)))},e.prototype.getValueByType=function(t){return this._isNumberType?this.toNumber(t):this.toString(t)},this.Brightics.VA.Core.Widget.Controls.ArrayInputControl=e}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){this.$parent=t,this.options=e;var n=this.getParentOffset(),r=this.getParentSize();this.removePreMessageBox(),this.createMessageBox(n,r),this.notifyMessage()}e.prototype.getParentOffset=function(){return this.$parent.offset()},e.prototype.getParentSize=function(){return{width:this.$parent.width(),height:this.$parent.height()}},e.prototype.removePreMessageBox=function(){var t=$("body").children(".brtc-va-widget-messagebox-container");t.length>0&&t.remove()},e.prototype.removeMessageBoxTimeout=function(){var t=this;setTimeout(function(){var e=$("body").children(".brtc-va-widget-messagebox-container");e.find("div").length>0?t.removeMessageBoxTimeout():e.remove()},1e3)},e.prototype.createMessageBox=function(t,e){this.$messageBox=$('<div class="brtc-va-widget-messagebox-container"></div>'),$("body").append(this.$messageBox),this.messageBoxWidth=this.$messageBox.width(),this.removeMessageBoxTimeout()},e.prototype.getMessageBoxOffset=function(t,e){var n=this.options.position;return"bottom"===n?{top:t.top+e.height+10,left:t.left}:"left"===n?{top:t.top,left:t.left-this.messageBoxWidth-10}:{top:t.top,left:t.left+e.width+10}},e.prototype.notifyMessage=function(){$("<div>"+this.options.message+"</div>").jqxNotification({width:"100%",appendContainer:this.$messageBox,opacity:.9,autoClose:!0,autoOpen:!0,template:"info",theme:"office"})},t.VA.Core.Widget.Controls.FadeOutMessage=e}.call(this),function(){"use strict";var t=this.Brightics;t.VA.Core.Utils;function e(t,e){this.parentId=t,this.defaultOptions={multiple:!0,fileType:["json"]},this.options=$.extend(!0,this.defaultOptions,e),this.files={},this.retrieveParent(),this.createControls()}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId)},e.prototype.createControls=function(){this.$mainControl=$('<div class="brtc-va-widget-controls-fileList"> <div class="brtc-va-widget-controls-fileList-toolbar"></div> <div class="brtc-va-widget-controls-fileList-list-wrapper"> <div class="brtc-va-widget-controls-fileList-list"></div> </div></div>'),this.$toolbarArea=this.$mainControl.find(".brtc-va-widget-controls-fileList-toolbar"),this.$listArea=this.$mainControl.find(".brtc-va-widget-controls-fileList-list"),this.$mainControl.find(".brtc-va-widget-controls-fileList-list-wrapper").perfectScrollbar(),this.$parent.append(this.$mainControl),this.renderToolbarArea(this.$toolbarArea),this.renderListArea(this.$listArea)},e.prototype.renderToolbarArea=function(t){this.createSumArea(t),this.createDeleteFileButton(t),this.createSelectFileButton(t)},e.prototype.renderListArea=function(e){var n=this;e.append($('<div class="brtc-va-dialogs-publish-management-grid"></div>'));var r=new $.jqx.dataAdapter({localdata:[],datafields:[{name:"name",type:"string"},{name:"size",type:"string"},{name:"lastModifiedDate",type:"date"},{name:"lastModified",type:"timestamp"},{name:"type",type:"string"},{name:"webkitRelativePath",type:"string"},{name:"fileKey",type:"string"}],datatype:"json"});this.$fileListGrid=e.find(".brtc-va-dialogs-publish-management-grid").jqxGrid({theme:t.VA.Env.Theme,width:"100%",height:"calc(100% - 45px)",altrows:!1,filterable:!1,source:r,sortable:!1,columnsresize:!0,selectionmode:"checkbox",showfiltercolumnbackground:!1,rowsheight:53,columns:[{text:"Name",datafield:"name",align:"center",cellclassname:"brtc-grid-cell",cellsrenderer:n.renderer,renderer:n.gridV2Renderer,width:"50%"},{text:"Size",datafield:"size",align:"center",cellclassname:"brtc-grid-cell",cellsrenderer:n.fileSizeRenderer,renderer:n.gridV2Renderer,width:80},{text:"Last Modified Date",datafield:"lastModifiedDate",align:"center",cellclassname:"brtc-grid-cell",renderer:n.gridV2Renderer,cellsalign:"center",cellsformat:"yyyy-MM-dd h:mm:ss"},{text:"fileKey",datafield:"fileKey",hidden:!0},{text:"lastModified",datafield:"lastModified",hidden:!0},{text:"type",datafield:"type",hidden:!0},{text:"webkitRelativePath",datafield:"webkitRelativePath",hidden:!0}]}),this.setGridStyleV2(this.$fileListGrid);var i=function(){n.$fileListGrid.jqxGrid("getselectedrowindexes").length>0?(n.$deleteButton.jqxButton({disabled:!1}),n.$deleteButton.css("cursor","pointer")):(n.$deleteButton.jqxButton({disabled:!0}),n.$deleteButton.css("cursor","default"))};this.$fileListGrid.on("rowselect",i.bind(n)),this.$fileListGrid.on("rowunselect",i.bind(n))},e.prototype.fileSizeRenderer=function(e,n,r){var i="1.00 KB";return r>1024&&(i=t.VA.Core.Utils.CommonUtils.byteCalculation(r)),'<div index="'+e+'" style="float: right;height:53px;line-height:53px;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 15px); ">'+i+"</div>"},e.prototype.renderer=function(t,e,n,r,i,o){var a="",s="float: left;margin-left: 15px;height:53px;line-height:53px;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 15px); ";return o.errorMessage?(s+="color:red;",a=o.errorMessage):a=n,'<div title="'+a+'" fileKey="'+o.fileKey+'" index="'+t+'" style="'+s+'">'+n+"</div>"},e.prototype.gridV2Renderer=function(t){return'<div style="opacity:0.8; font-family: Arial; font-size: 16px; font-weight: bold; text-align: center; color: rgba(0, 0, 0, 0.8);">'+t+"</div>"},e.prototype.setGridStyleV2=function(t){t.addClass("GridStyleV2"),t.css({height:"calc(100% - 35px) !important","margin-top":"15px !important","margin-bottom":"20px !important"}),this.$mainControl.find("input[type=button]").width(100)},e.prototype.createSumArea=function(t){this.$sumArea=$('<div class="brtc-va-widget-controls-fileList-toolbar-sum"> <span>Total<strong class="brtc-va-widget-controls-fileList-toolbar-sum-count">0</strong></span></div>'),t.append(this.$sumArea)},e.prototype.createSelectFileButton=function(e){var n=this,r=$('<div class="brtc-va-widget-controls-fileList-toolbar-selectfile"> <input for="brtc-va-widget-controls-fileList-toolbar-selectfile-button" type="button" id="fileselect-local" value="Select File" /> <input type="file" id="brtc-va-widget-controls-fileList-toolbar-selectfile-file" name="fileToUpload" accept=".json"></div>');e.append(r);var i=r.find("#fileselect-local"),o=r.find("#brtc-va-widget-controls-fileList-toolbar-selectfile-file");this.options.multiple&&o.attr("multiple",!0),o.hide(),i.jqxButton({theme:t.VA.Env.Theme}),i.on("click",function(){o.click()}),o.on("input",function(e){var r=$(this)[0].files;if(n.isJsonFile(r)){var i=n.addFileKey(r),a=n.renderFiles(i);n.$parent.trigger("addFile",[i,a])}else t.VA.Core.Utils.WidgetUtils.openErrorDialog(".json file can be imported only");o.val(null)})},e.prototype.setTotalCount=function(){this.$sumArea.find(".brtc-va-widget-controls-fileList-toolbar-sum-count").text(this.$fileListGrid.jqxGrid("getRows").length)},e.prototype.addFileKey=function(e){for(var n={},r=0;r<e.length;r++){n[t.VA.Core.Utils.IDGenerator.importedFile.id()]=e[r]}return n},e.prototype.createDeleteFileButton=function(e){var n=this,r=$('<div class="brtc-va-widget-controls-fileList-toolbar-deletefile"> <input class="brtc-va-widget-controls-fileList-toolbar-deletefile-button" type="button" value="Delete File" /></div>');e.append(r),this.$deleteButton=r.find(".brtc-va-widget-controls-fileList-toolbar-deletefile-button"),this.$deleteButton.jqxButton({theme:t.VA.Env.Theme,disabled:!0}),this.$deleteButton.on("click",function(){for(var t=[],e=n.$fileListGrid.jqxGrid("getselectedrowindexes").sort(function(t,e){return t-e}),r=e.length-1;r>=0;r--){var i=n.$fileListGrid.jqxGrid("getrowdata",e[r]);t.push(i.fileKey),delete n.files[i.fileKey];var o=n.$fileListGrid.jqxGrid("getrowid",e[r]);n.$fileListGrid.jqxGrid("deleterow",o)}n.$parent.trigger("removeFile",[t]),n.setTotalCount(),n.$deleteButton.jqxButton({disabled:!0})})},e.prototype.makeGridSource=function(t,e){var n=[],r=$.extend(!0,{},e);return r.fileKey=t,this.files[t]=r,n.push(r),n},e.prototype.equal=function(t,e){return t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified},e.prototype.renderFiles=function(t){var e={};for(var n in t){var r=!1;for(var i in this.files)if(this.equal(this.files[i],t[n])){e[n]=!0,r=!0;break}r||this.$fileListGrid.jqxGrid("addrow",null,this.makeGridSource(n,t[n]))}return this.setTotalCount(),e},e.prototype.isJsonFile=function(t){for(var e=0;e<t.length;e++){var n=t[e].name.split(".");if(this.options.fileType.indexOf(n[n.length-1])<0)return!1}return!0},e.prototype.getFiles=function(){return this.files},e.prototype.setDisableFile=function(t,e){var n,r=-1,i=this.$fileListGrid.jqxGrid("getRows");for(var o in i)if(i[o].fileKey===t){r=o,(n=i[o]).errorMessage=e;break}this.$fileListGrid.jqxGrid("updaterow",r,n)},t.VA.Core.Widget.Controls.FileList=e}.call(this),function(){"use strict";var t=this.Brightics;t.VA.Core.Utils;function e(t,e){this.parentId=t,this.options=e,this.options.selectedItems=[],this.options.selectedIndexes=[],this.options.changedItems={},this.options.items=[],this.eventListeners={},this.sortOptions={},this._initEventListeners(),this.retrieveParent(),this.createControls(),this._setSortFunction()}e.prototype._setSortFunction=function(){this.compareFunctionGenerator=function(t,e){return e=e||function(t){return t},function(n,r){return t(e(n),e(r))}};var t,e=function(t,e){return String(t).localeCompare(String(e))},n=(t=this,function(e){return t.options.items[e].item});this.sortOptions={comp:e,getter:n,sortOnIndex:this.compareFunctionGenerator(e,n),sortOnValue:this.compareFunctionGenerator(e)}},e.prototype._initEventListeners=function(){this.eventListeners={selectAll:this._handleSelectAll.bind(this),unselectAll:this._handleUnselectAll.bind(this),select:this._handleSelect.bind(this),unselect:this._handleUnselect.bind(this),close:this._handleClose.bind(this)}},e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId)},e.prototype.createControls=function(){var e=this;this.$mainControl=$('<div class="brtc-va-widget-controls-itemlist"> <div class="brtc-va-widget-controls-itemlist-selectbutton-wrapper"> <span class="brtc-va-widget-controls-itemlist-selectcounter counter">0</span> <span class="brtc-va-widget-controls-itemlist-selectcounter">items selected</span> <button class="brtc-va-widget-controls-itemlist-clearbutton">Clear</button> <button class="brtc-va-widget-controls-itemlist-selectbutton">Select</button> </div> <div class="brtc-va-widget-controls-itemlist-control" />'),this.$parent.append(this.$mainControl),this.$selectButton=this.$mainControl.find(".brtc-va-widget-controls-itemlist-selectbutton"),this.$selectButton.jqxButton({theme:t.VA.Env.Theme,height:25}),this.$selectButton.on("click",function(){e.openItemSelector()}),this.$clearButton=this.$mainControl.find(".brtc-va-widget-controls-itemlist-clearbutton"),this.$clearButton.jqxButton({theme:t.VA.Env.Theme,height:25}),this.$clearButton.on("click",function(){e.clearSelectedItems()}),this.$itemControl=this.$mainControl.find(".brtc-va-widget-controls-itemlist-control"),this.createItemListControl(this.$itemControl),this.createItemSelector()},e.prototype.createItemListControl=function(e){var n=this,r={localdata:this.options.selectedItems,datatype:"array",beforeprocessing:function(){r.totalrecords=n.options.selectedItems.length}},i=new $.jqx.dataAdapter(r);$(e).jqxGrid({width:n.options.width||"100%",theme:t.VA.Env.Theme,height:n.options.height||120,virtualmode:!0,pageable:!1,source:i,rendergridrows:function(t){for(var e={},r=t.startindex;r<t.endindex&&r<n.options.selectedItems.length;++r)e[r]={item:n.options.selectedItems[r]};return e},selectionmode:"none",showheader:!1,rowsheight:20,columns:[{text:"Item",datafield:"item",cellsrenderer:function(t,e,r){if(t<n.options.selectedItems.length)return'<div class="brtc-va-widget-controls-itemselector-itemcontainer-element" row-index="'+t+'"> <span class="brtc-va-widget-controls-itemselector-itemcontainer-element-name" title="'+r+'">'+r+'</span> <span class="brtc-va-widget-controls-itemselector-itemcontainer-element-remove"></span></div>'},width:"100%",cellsalign:"left"}]}),$(e).jqxGrid("localizestrings",{emptydatastring:" "})},e.prototype.createItemSelector=function(){var e=this;this.options.multiple=!0,this.options.fromModal=!0,this.itemSelector=new t.VA.Core.Widget.Controls.ItemSelector(this.$mainControl,{multiple:e.options.multiple,fromModal:e.options.fromModal,limit:e.options.limit,showDesc:e.options.showDesc,changed:function(t,n){e.eventListeners[t]&&"function"==typeof e.eventListeners[t]&&e.eventListeners[t](n)}})},e.prototype._getUniqueItems=function(t,e){for(var n={},r=[],i=0;i<t.length;++i){var o=void 0===e?t[i]:t[i][e];void 0===n[o]&&(n[o]=!0,r.push(t[i]))}return r},e.prototype.setItems=function(t){this.options.items=this._getUniqueItems(t,"item"),this.itemSelector.setSortOptions(this.sortOptions),this.itemSelector.setSource(this.options.items)},e.prototype.setSelectedItems=function(t){var e=this._getUniqueItems(t||[]);this.options.selectedItems=$.extend(!0,[],e),this.options.selectedItems.sort(this.compareFunctionGenerator(this.sortOptions.comp,function(t){return t.item})),this.options.selectedIndexes=this.itemSelector.calcSelectedIndexes(this.options.selectedItems),this.refreshControl()},e.prototype.getSelectedItems=function(){return this.options.selectedItems},e.prototype.refreshControl=function(){var t=this;this.$itemControl.jqxGrid("updatebounddata"),this.$mainControl.find(".brtc-va-widget-controls-itemlist-selectcounter.counter").text(this.options.selectedItems.length),this.$itemControl.find(".jqx-grid-cell").mouseover(function(e){$(this).find(".brtc-va-widget-controls-itemselector-itemcontainer-element-remove").show();$(this).find(".brtc-va-widget-controls-itemselector-itemcontainer-element-remove").unbind("click"),$(this).find(".brtc-va-widget-controls-itemselector-itemcontainer-element-remove").bind("click",function(){var e=$(this).closest(".brtc-va-widget-controls-itemselector-itemcontainer-element").attr("row-index");t.removeItem(e),t.refreshControl()})}),this.$itemControl.find(".jqx-grid-cell").mouseout(function(t){$(this).find(".brtc-va-widget-controls-itemselector-itemcontainer-element-remove").hide()})},e.prototype.clearSelectedItems=function(){this.itemSelector.clearSelectedItems(),this.setSelectedItems([]),this.options.changed("clear",{items:[]})},e.prototype.removeItem=function(t){var e=this.options.selectedItems[t],n=this.options.selectedIndexes[t];this.options.selectedItems.splice(t,1),this.options.selectedIndexes.splice(t,1),this.itemSelector.unselectRow(n),this.options.changed("removed",{added:[],removed:[e],items:this.options.selectedItems})},e.prototype.openItemSelector=function(){this.itemSelector.open(this.$clearButton,this.options.selectedItems,this.options.selectedIndexes)},e.prototype.getSelectorPosition=function(){var t={left:0,top:0};t.left=this.$mainControl.offset().left+this.$mainControl.width()+5,t.top=this.$mainControl.offset().top;var e=document.all?document.body.clientHeight:window.innerHeight,n=this.itemSelector.getHeight();return e-n-10<t.top&&(t.top=e-n-10),t},e.prototype.isLimited=function(e){return this.options.limit<this.options.selectedItems.length+(e||0)&&(t.VA.Core.Utils.WidgetUtils.openWarningDialog("You are only allowed to select "+this.options.limit+" items."),this.itemSelector.close(),!0)},e.prototype.processing=function(t){this.itemSelector._processing(t)},e.prototype._updateChangedItemOrDelete=function(t,e){void 0!==this.options.changedItems[e]&&this.options.changedItems[e]!==t?delete this.options.changedItems[e]:this.options.changedItems[e]=t},e.prototype._handleSelectAll=function(t){for(var e=[],n=0,r=0;n<this.options.selectedIndexes.length&&r<t.length&&!this.isLimited(e.length+1);)this.options.selectedIndexes[n]<t[r].id?n++:this.options.selectedIndexes[n]>t[r].id?(this._updateChangedItemOrDelete("select",t[r].value),e.push(t[r]),r++):(n++,r++);for(;r<t.length&&!this.isLimited(e.length+1);)this._updateChangedItemOrDelete("select",t[r].value),e.push(t[r]),r++;var i=[],o=[];for(n=0,r=0;n<this.options.selectedIndexes.length&&r<e.length;)this.options.selectedIndexes[n]<e[r].id?(i.push(this.options.selectedIndexes[n]),o.push(this.options.selectedItems[n]),n++):this.options.selectedIndexes[n]>e[r].id?(i.push(e[r].id),o.push(e[r].value),r++):(i.push(this.options.selectedIndexes[n]),o.push(this.options.selectedItems[n]),n++,r++);for(;n<this.options.selectedIndexes.length;)i.push(this.options.selectedIndexes[n]),o.push(this.options.selectedItems[n]),n++;for(;r<e.length;)i.push(e[r].id),o.push(e[r].value),r++;this.options.selectedIndexes=i,this.options.selectedItems=o,this.refreshControl()},e.prototype._handleUnselectAll=function(t){for(var e=[],n=[],r=0,i=0;r<this.options.selectedItems.length&&i<t.length;)this.options.selectedIndexes[r]<t[i].id?(e.push(this.options.selectedIndexes[r]),n.push(this.options.selectedItems[r]),r++):this.options.selectedIndexes[r]>t[i].id?i++:(this._updateChangedItemOrDelete("unselect",t[i].value),r++,i++);for(;r<this.options.selectedItems.length;)e.push(this.options.selectedIndexes[r]),n.push(this.options.selectedItems[r]),r++;this.options.selectedIndexes=e,this.options.selectedItems=n,this.refreshControl()},e.prototype._handleSelect=function(t){if(!this.isLimited(1)){for(var e=0;e<this.options.selectedItems.length&&this.options.selectedIndexes[e]<t.id;)++e;e<this.options.selectedItems.length&&this.options.selectedIndexes[e]===t.id||(this.options.selectedIndexes.splice(e,0,t.id),this.options.selectedItems.splice(e,0,t.value),this._updateChangedItemOrDelete("select",t.value),this.refreshControl())}},e.prototype._handleUnselect=function(t){var e=this.options.selectedIndexes.indexOf(t.id);-1!==e&&(this.options.selectedItems.splice(e,1),this.options.selectedIndexes.splice(e,1),this._updateChangedItemOrDelete("unselect",t.value),this.refreshControl())},e.prototype._handleClose=function(t){var e=[],n=[];for(var r in this.options.changedItems)"select"===this.options.changedItems[r]?e.push(r):n.push(r);(e.length>0||n.length>0)&&this.options.changed("change",{added:e,removed:n,items:this.options.selectedItems}),this.options.changedItems={}},t.VA.Core.Widget.Controls.ItemList=e}.call(this),function(){"use strict";var t=this.Brightics;t.VA.Core.Utils;function e(t,e){this.parentId=t,this.options=e,this.sortOptions={},this.initOptions(),this.retrieveParent(),this.createControl()}e.prototype.initOptions=function(){this.options=$.extend(!0,{source:[],width:290,height:320,resizable:!0,fromModal:!1,limit:99999999,showDesc:!1},this.options)},e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId)},e.prototype.createControl=function(){var e=this;this.$mainControl=$('<div class="brtc-va-widget-controls-itemselector"> <div class="brtc-va-widget-controls-itemselector-header" /> <div class="brtc-va-widget-controls-itemselector-content brtc-style-full brtc-style-display-flex brtc-style-flex-direction-column" /></div>'),this.$parent.append(this.$mainControl);var n=this.$mainControl.find(".brtc-va-widget-controls-itemselector-content");this.createFilter(n),this.createSelectButton(n),this.createItemContainer(n),this.closeHandler=function(t){0===e.$mainControl.closest(".ui-dialog").has(t.target).length&&e.$mainControl.dialog("close")};var r={theme:t.VA.Env.Theme,width:this.options.width,height:this.options.height,resizable:!0,title:"Select Items",autoOpen:!1,modal:!1,showAnimationDuration:50,minHeight:285,minWidth:307,zIndex:this.getHighestZindex(),close:function(){e.options.fromModal||$(".jqx-window-modal").remove(),$(window).off("mousedown",e.closeHandler),e.options.changed("close",[])}};this.$mainControl.dialog(r),this.$mainControl.siblings(".ui-dialog-titlebar.ui-widget-header").addClass("brtc-style-itemselector"),this.$mainControl.css("z-index",this.getHighestZindex())},e.prototype.createFilter=function(e){var n=this,r=$('<div class="brtc-va-widget-controls-itemselector-filter-container"></div>');e.append(r),this.$filterControl=$('<input type="search" placeholder="Search Item" />'),r.append(this.$filterControl),this.$filterControl.jqxInput({theme:t.VA.Env.Theme,placeHolder:"Search Item",height:31,minLength:1}),this.$filterControl.on("keyup search",function(t){n.$itemControl.jqxGrid("clearfilters");var e=new $.jqx.filter,r=e.createfilter("stringfilter",t.target.value,"contains");e.addfilter(1,r),n.$itemControl.jqxGrid("addfilter","item",e),n.$itemControl.jqxGrid("applyfilters")})},e.prototype.createSelectButton=function(e){var n=this,r=$('<div class="brtc-item-check-box-wrapper"></div>');e.append(r),this.$selectAllButton=$('<input type="button" value="Select All" style="width: 100%; float:left; margin-left: 0px;"/>'),this.$clearAllButton=$('<input type="button" value="Unselect All" style="width: 100%; float:left; margin-left: 2px; margin-bottom: 2px;"/>'),r.append(this.$selectAllButton),r.append(this.$clearAllButton),this.$selectAllButton.jqxButton({height:23,width:134,Theme:t.VA.Env.Theme}),this.$clearAllButton.jqxButton({height:23,width:134,Theme:t.VA.Env.Theme}),this.$selectAllButton.on("click",function(){n.selectedAll()}),this.$clearAllButton.on("click",function(){n._processing(!0),n.unSelectedAll(),n._processing(!1)})},e.prototype.createItemContainer=function(e){var n=this,r=$('<div class="brtc-va-progress"> <span class="brtc-va-progress-loading"></span></div><div class="brtc-va-widget-controls-itemselector-itemcontainer-wrapper brtc-style-flex-1"> <div class="brtc-va-widget-controls-itemselector-itemcontrol brtc-style-border-box"></div></div>');e.append(r);var i=function(t,e,n){return'<div class="brtc-va-widget-controls-itemselector-itemcontainer-element" row-index="'+t+'"> <span class="brtc-va-widget-controls-itemselector-itemcontainer-element-name" title="'+n+'">'+n+"</span></div>"};this.$progress=e.find(".brtc-va-progress"),this.$progress.hide(),this.$itemControl=r.find(".brtc-va-widget-controls-itemselector-itemcontrol");var o=[{text:"Item",datafield:"item",cellsrenderer:i,minwidth:120,cellsalign:"left"}];this.options.showDesc&&(o[0].minwidth=90,o.push({text:"Description",datafield:"description",cellsrenderer:i,width:110,minwidth:90,maxwidth:110,cellsalign:"left"})),this.$itemControl.jqxGrid({width:"100%",theme:t.VA.Env.Theme,height:"100%",pageable:!1,selectionmode:"checkbox",showheader:!1,rowsheight:20,columns:o}),this.$itemControl.on("rowselect",function(t){if(!n.systemEvent){var e=t.args.rowindex;n.options.changed("select",{id:n.invPos[e],value:n.options.source[e].item})}}),this.$itemControl.on("rowunselect",function(t){if(!n.systemEvent){var e=t.args.rowindex;n.options.changed("unselect",{id:n.invPos[e],value:n.options.source[e].item})}})},e.prototype.selectedAll=function(){var t=this;this.systemEvent=!0;var e=this.$itemControl.jqxGrid("getrows");this.chkCnt++;var n=e.map(function(e){var n=void 0!==e.dataindex?e.dataindex:e.boundindex;return t.chk[n]=t.chkCnt,n}),r=this.pos.filter(function(e){return t.chk[e]===t.chkCnt}),i=this._getSelectedRowIndexes(),o=r.map(function(e){return{id:t.invPos[e],value:t.options.source[e].item}});this.$itemControl.jqxGrid({selectedrowindexes:this._union(i,n)}),this.$itemControl.jqxGrid("refresh"),this.options.changed("selectAll",o),this.systemEvent=!1},e.prototype.unSelectedAll=function(){var t=this;this.systemEvent=!0;var e=this.$itemControl.jqxGrid("getrows");this.chkCnt++;var n=e.map(function(e){var n=void 0!==e.dataindex?e.dataindex:e.boundindex;return t.chk[n]=t.chkCnt,n}),r=this.pos.filter(function(e){return t.chk[e]===t.chkCnt}).map(function(e){return{id:t.invPos[e],value:t.options.source[e].item}}),i=this._getSelectedRowIndexes();this.$itemControl.jqxGrid({selectedrowindexes:this._difference(i,n)}),this.$itemControl.jqxGrid("refresh"),this.options.changed("unselectAll",r),this.systemEvent=!1},e.prototype._getSelectedRowIndexes=function(){return this._countingSort(this.$itemControl.jqxGrid("getselectedrowindexes"),this.options.source.length)},e.prototype._preCalculation=function(t){var e=this;this.pos=[],this.invPos=[],this.chk=[],this.chkCnt=0;for(var n=t.length,r=0;r<n;++r)this.pos.push(r),this.invPos.push(-1),this.chk.push(-1);this.pos.sort(this.sortOptions.sortOnIndex),this.pos.forEach(function(t,n){e.invPos[t]=n})},e.prototype.setSource=function(t){this.options.source=t,this._preCalculation(t);var e=[{name:"item",type:"string"}];this.options.showDesc&&e.push({name:"description",type:"string"});var n={localdata:this.options.source,datatype:"array",datafields:e},r=new $.jqx.dataAdapter(n);this.$itemControl.jqxGrid({source:r})},e.prototype.getSource=function(){return this.options.source},e.prototype.calcSelectedIndexes=function(t){for(var e=[],n=0,r=0;n<t.length&&r<this.pos.length;){var i=t[n],o=this.options.source[this.pos[r]].item,a=this.sortOptions.comp(i,o);a<0?n++:a>0?r++:(e.push(r),n++,r++)}return e},e.prototype.setSelectedItems=function(t,e){var n=this;this._processing(!0),this.systemEvent=!0;var r=e.filter(function(t){return t<n.options.source.length});this.chkCnt++;var i=r.map(function(t){return n.pos[t]});i.forEach(function(t){n.chk[t]=n.chkCnt}),i=this._countingSort(i,this.options.source.length),this.$itemControl.jqxGrid({selectedrowindexes:i}),this.$itemControl.jqxGrid("refresh"),this.systemEvent=!1,this._processing(!1)},e.prototype._countingSort=function(t,e){for(var n=[],r=0;r<e;++r)n.push(-1);return t.forEach(function(t){n[t]=t}),n.filter(function(t,e){return t===e})},e.prototype._processing=function(t){t?($(window).off("mousedown",this.closeHandler),this.$progress.show()):($(window).on("mousedown",this.closeHandler),this.$progress.hide())},e.prototype.open=function(t,e,n){this.selectEventFlag=!1,this.systemEvent=!0,this.$itemControl.jqxGrid("clearselection"),this.systemEvent=!1,this.$mainControl.dialog({position:{my:"left top",at:"right+5, top",of:t}}),this.$mainControl.dialog("open"),this.$mainControl.css("z-index",this.getHighestZindex()),$(window).on("mousedown",this.closeHandler);var r=[{name:"item",type:"string"}];this.options.showDesc&&r.push({name:"description",type:"string"});var i={localdata:this.options.source,datatype:"array",datafields:r},o=new $.jqx.dataAdapter(i);this.$itemControl.jqxGrid({source:o}),this.setSelectedItems(e,n)},e.prototype.close=function(){this.$mainControl.dialog("close")},e.prototype.getHighestZindex=function(){for(var t=$("body").children(".jqx-window"),e=0,n=0,r=0;r<t.length;r++)(n=parseInt($(t[r]).css("z-index"))||0)>e&&(e=n);return e+1},e.prototype.getHeight=function(){return this.$mainControl.height()},e.prototype.clear=function(){this.systemEvent=!0;for(var t=0;t<this.options.source.length;++t)this.$itemControl.jqxGrid({selectedrowindexes:[]});this.systemEvent=!1},e.prototype.clearSelectedItems=function(){this.$itemControl.jqxGrid({selectedrowindexes:[]})},e.prototype.unselectRow=function(t){this.$itemControl.jqxGrid("unselectrow",this.pos[t])},e.prototype._union=function(t,e){for(var n=0,r=0,i=[];n<t.length&&r<e.length;)t[n]<e[r]?(i.push(t[n]),n++):t[n]>e[r]?(i.push(e[r]),r++):(i.push(t[n]),n++,r++);for(;n<t.length;)i.push(t[n]),n++;for(;r<e.length;)i.push(e[r]),r++;return i},e.prototype._difference=function(t,e){for(var n=0,r=0,i=[];n<t.length&&r<e.length;)t[n]<e[r]?(i.push(t[n]),n++):t[n]>e[r]?r++:(n++,r++);for(;n<t.length;)i.push(t[n]),n++;return i},e.prototype.setSortOptions=function(t){this.sortOptions=t},t.VA.Core.Widget.Controls.ItemSelector=e}.call(this),function(){"use strict";var t=this.Brightics;const e=[["style",["bold","italic","underline","clear"]],["fontsize",["fontsize"]],["color",["color"]],["para",["ul","ol","paragraph"]],["table",["table"]],["height",["height"]]];function n(t,e){this.parentId=t,this.options=this.setOptions(e),this.retrieveParent(),this.createControls(),this.createEvents()}n.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId)},n.prototype.setOptions=function(t){return $.extend(!0,{},t)},n.prototype.createControls=function(){var t=this.options.description||"";if(this.$mainControl=$('<div class="brtc-va-widget-note-control">'+t+"</div>"),this.$parent.append(this.$mainControl),document.createRange)try{document.getSelection().removeAllRanges()}catch(t){document.getSelection().addRange(document.createRange())}this.$mainControl.summernote({focus:void 0===this.options.focus||this.options.focus,toolbar:this.options.toolbar||e,fontSizes:FONT_SIZES,popover:{},height:this.options.height-24,disableDragAndDrop:!0,maximumImageFileSize:1,callbacks:$.extend(!0,{},this.options.callbacks)})},n.prototype.createEvents=function(){this.setRestrictCondition(),this.$mainControl.closest(".ui-dialog").length>0&&this._setStopPropagationMouseDown()},n.prototype.setRestrictCondition=function(){this.options.maxLength&&(this.createMessageArea(),this.createLengthRestriction(),this.createInputRestriction())},n.prototype._setStopPropagationMouseDown=function(){this.$parent.mousedown(function(t){t.stopPropagation()})},n.prototype.createMessageArea=function(){this.$messageArea=$('<div class="brtc-va-widget-note-message"></div>'),this.$parent.append(this.$messageArea),this.$messageArea.text(this.$parent.find(".note-editable").text().length+" / "+this.options.maxLength+" characters")},n.prototype.deleteImageElement=function(){this.$parent.find(".note-editing-area img").remove()},n.prototype.deleteHrefAttribute=function(){this.$parent.find(".note-editing-area a").removeAttr("href")},n.prototype.createLengthRestriction=function(){var t=this;this.$mainControl.on("summernote.change",function(e,n){t.deleteImageElement(),t.deleteHrefAttribute();var r=t.$parent.find(".note-editable").text().length;t.$messageArea.text(r+" / "+t.options.maxLength+" characters"),r>t.options.maxLength?(t.setOkbuttonCondition(!0),t.$messageArea.addClass("error")):(t.setOkbuttonCondition(!1),t.$messageArea.removeClass("error"))})},n.prototype.createInputRestriction=function(){var e=this;this.$mainControl.on("summernote.keydown",function(n,r){e.$parent.find(".note-editable").text().length>e.options.maxLength&&(t.VA.Core.Utils.InputValidator.isNotInsertKeyCode(r)||r.preventDefault())})},n.prototype.setOkbuttonCondition=function(t){this.options.okButton&&this.options.okButton.jqxButton({disabled:t})},n.prototype.getCode=function(){return this.getValue()},n.prototype.setCode=function(t){this.setValue(t)},n.prototype.focus=function(){this.$mainControl.summernote("focus")},n.prototype.isEmpty=function(){return this.$mainControl.summernote("isEmpty")},n.prototype.setHeight=function(t){this.$parent.find(".note-editable.panel-body").css({height:t})},n.prototype.getValue=function(){return this.$mainControl.summernote("code")},n.prototype.setValue=function(t){this.$mainControl.summernote("focus"),this.$mainControl.summernote("code",t||"")},n.prototype.clear=function(){this.$mainControl.summernote("focus"),this.$mainControl.summernote("reset")},n.prototype.destroy=function(){this.$mainControl.summernote("destroy")},t.VA.Core.Widget.Controls.NoteControl=n}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){return this.parentId=t,this.options=this.setOptions(e),this.value="",this.retrieveParent(),this.createControls(),this.createFocusEvent(),this}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId)},e.prototype.setOptions=function(t){var e={numberType:"int",min:void 0,max:void 0,minus:!0,placeholder:"Enter value",enterCallback:function(){}},n=$.extend(!0,e,t);return"int"==n.numberType?(n.max=n.max?n.max:"1073741824",n.min=n.min?n.min:"-1073741824"):"double"==n.numberType&&(n.max=n.max?n.max:"1073741824",n.min=n.min?n.min:"-1073741824"),n},e.prototype.createControls=function(){var t=["brtc-va-editors-sheet-controls-numericInput"].concat(this.options.className||[]).join(" ");this.$mainControl=$('<input type="text" class="'+t+'" contenteditable>'),this.$mainControl.attr("placeholder",this.options.placeholder),this.$parent.append(this.$mainControl),this.addKeyEventListener()},e.prototype.setValue=function(t){this.$mainControl.val(t)},e.prototype.getValue=function(){return this.$mainControl.val()},e.prototype.setDisabled=function(t){return this.$mainControl.prop("disabled",t)},e.prototype.onChange=function(t){this.callback=t},e.prototype.parseToNumber=function(t){return""===t?t:isNaN(t)?"":Number(t)},e.prototype.createFocusEvent=function(){var t=this;this.$mainControl.focus(function(){t.preValue=t.parseToNumber(t.$mainControl.val())}),this._OnNumericInputFocusOut=function(){var e=t.$mainControl.val();+e||t.isZero(e)?(void 0!==t.options.min&&+e<+t.options.min&&t.$mainControl.val(t.options.min),void 0!==t.options.max&&+e>+t.options.max&&t.$mainControl.val(t.options.max)):""===e&&t.options.mandatory&&void 0!==t.options.min&&t.$mainControl.val(t.options.min)},this.$mainControl.focusout(function(){t._OnNumericInputFocusOut();var e=t.parseToNumber(t.$mainControl.val());t.$mainControl.val(e),(e!==t.preValue&&"function"==typeof t.callback||t.options.checkValueChanged)&&t.callback(t.$mainControl.val())}),$("svg").on("mousedown",function(){var e=t.parseToNumber(t.$mainControl.val());t.$mainControl.val(e),e!==t.preValue&&"function"==typeof t.callback&&t.$mainControl.is(":focus")&&t.callback(t.$mainControl.val())})},e.prototype.getControl=function(){return this.$mainControl},e.prototype.addKeyEventListener=function(){var t=this;this._OnNumericInputKeyDown=function(e){var n=e.which||e.keyCode;if(13===n)return t.options.enterCallback(t.getControl()),e.preventDefault(),!1;if(!e.shiftKey&&!e.altKey&&!e.ctrlKey&&n>=65&&n<=90||32==n||13==n)return e.preventDefault(),!1;if(!e.shiftKey&&!e.altKey&&!e.ctrlKey&&n>=48&&n<=57||n>=96&&n<=105||65==e.keyCode&&!0===e.ctrlKey||67==n&&!0===e.ctrlKey||88==n&&!0===e.ctrlKey||n>=35&&n<=39||8==n||9==n||13==n||46==n||45==n)return!0;var r=t.$mainControl.val();return 109==n||189==n?!("-"===r[0]||!t.options.minus):(!(e.shiftKey||e.altKey||e.ctrlKey||190!=n)||188==n||110==n)&&(!/[\.,]/.test(r)&&"int"!==t.options.numberType)},this.$mainControl.keydown(this._OnNumericInputKeyDown),this._OnNumericInputKeyUp=function(e){var n=t.$mainControl.val();n&&(n=(n=("-"===n[0]?"-":"")+n.replace(/[^0-9\.]/g,"")).replace(/\.(?=(.*)\.)+/g,""),t.$mainControl.val(n))},this.$mainControl.keyup(this._OnNumericInputKeyUp)},e.prototype.isZero=function(t){return null!=t&&""!=t&&0==+t},e.prototype.focus=function(){this.$mainControl.focus()},t.VA.Core.Widget.Controls.NumericInput=e}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){this.parentId=t,this.options=e,this.retrieveParent(),this.init()}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId)},e.prototype.init=function(){var t=this;for(var e in this.$tabHeaderWrapper=this.$parent.children("ul"),this.$tabHeaders=this.$tabHeaderWrapper.children("li"),this.$tabContents=this.$parent.children("div"),this.$tabHeaderWrapper.addClass("brtc-style-tab-header-wrapper"),this.$tabHeaders.addClass("brtc-va-tab-header").addClass("brtc-style-tab-header"),this.$tabContents.addClass("brtc-style-tab"),this.$tabHeaders){var n=this.$tabHeaders.eq(e),r=n.text();n.html('<div class="brtc-va-tab-header-titlewrapper brtc-style-tab-header-titlewrapper"></div>'),n.find(".brtc-va-tab-header-titlewrapper").text(r)}this.$tabHeaders.eq(0).addClass("selected"),this.$tabContents.eq(0).addClass("selected"),this.$tabHeaders.on("click",function(e){var n=t.$tabHeaders.index(this);t.$tabHeaders.removeClass("selected"),$(this).addClass("selected"),t.$tabContents.removeClass("selected"),t.$tabContents.eq(n).addClass("selected"),t.$parent.trigger("selected",[n]),$("body").hasClass("scroll-always")&&1==n&&t.$parent.find(".brtc-va-dialogs-selectfnunit-tab-allfunctions").perfectScrollbar("update")})},e.prototype.select=function(t){this.$tabHeaders.removeClass("selected"),$(this.$tabHeaders[t||0]).addClass("selected"),this.$tabContents.removeClass("selected"),this.$tabContents.eq(t).addClass("selected"),$("body").hasClass("scroll-always")&&1==t&&this.$parent.find(".brtc-va-dialogs-selectfnunit-tab-allfunctions").perfectScrollbar("update")},t.VA.Core.Widget.Controls.TabControl=e}.call(this),function(){"use strict";var t=this.Brightics,e=["number","string","array[string]","array[number]"],n=["array[string]","array[number]"],r=["number","array[number]"],i=brtc_require("FnUnitUtils");function o(t,e){this.parentId=t,this.initOptions(e),this.retrieveParent(),this.createControls(),this.setInputValue()}o.prototype.initOptions=function(t){this.options=$.extend(!0,{},t),this.variableKey=Object.keys(this.options.variable)[0],this.variableType=this.options.variable[this.variableKey]["variable-type"],this.inputType=this.getInputType(this.variableType),this.variableValue=this.options.variable[this.variableKey].value},o.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId)},o.prototype.createControls=function(){var t=this;this.$mainControl=$('<div class="brtc-va-widget-container"> <div class ="brtc-va-widget-remove" /> <div class="brtc-va-widget-label" /> <div class="brtc-va-widget-header" /> <div class="brtc-va-widget-contents"><div class="brtc-va-widget-contents-input-container-wrapper"></div></div></div>'),this.$parent.append(this.$mainControl),this._renderLabel(),this.createContentsArea(),this.$mainControl.find(".brtc-va-widget-remove").on("click",function(){"function"==typeof t.options.onRemoveCallback&&(t.options.onRemoveCallback(t.createFormattedValue()),t.$mainControl.remove())})},o.prototype._renderLabel=function(){let t=this.$mainControl.find(".brtc-va-widget-label");if(this.options.label){this.options.mandatory&&t.addClass("mandatory"),this.variableType=this.variableType||"";var e=this.variableType.indexOf("array")>=0?"array":this.variableType;t.addClass(e),t.text(this.options.label),t.show()}else t.hide()},o.prototype.isArrayValue=function(){return n.indexOf(this.variableType)>-1},o.prototype.isCellValue=function(){return"cell"===this.variableType},o.prototype.createContentsArea=function(){this.$contentsArea=this.$mainControl.find(".brtc-va-widget-contents-input-container-wrapper");let t=this.$mainControl.find(".brtc-va-widget-header");t.hide(),this.isCellValue()?this.createCellInputControl():this.isArrayValue()?(t.show(),this.createArrayInputControl()):this.createSingleInputControl()},o.prototype.createCellInputControl=function(){this.createCellControlLayout()},o.prototype._createArrayInputHeaderArea=function(){this.$arrayInputHeader&&this.$arrayInputHeader.remove(),this.$arrayInputHeader=$('\n <div class="brtc-va-widget-contents-array-input-header-area">\n <div class="brtc-va-widget-contents-array-header-button" current-edit-type="control">Bulk edit</div>\n </div>');let t=this.$arrayInputHeader.find(".brtc-va-widget-contents-array-header-button");this.$mainControl.find(".brtc-va-widget-header").append(this.$arrayInputHeader),t.click(()=>{"control"===t.attr("current-edit-type")?(this._changeControlToBulk(),this._changeArrayInputHeaderButton("bulk")):"bulk"===t.attr("current-edit-type")&&(this._changeBulkToControl(),this._changeArrayInputHeaderButton("control")),this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar("update")})},o.prototype._changeArrayInputHeaderButton=function(t){let e=this.$arrayInputHeader.find(".brtc-va-widget-contents-array-header-button");"bulk"===t?(e.attr("current-edit-type","bulk"),e.text("Apply"),this.$mainControl.find(".brtc-va-widget-contents").scrollTop(0)):"control"===t&&(e.attr("current-edit-type","control"),e.text("Bulk edit"))},o.prototype._isBulkType=function(){return"bulk"===this.$arrayInputHeader.find(".brtc-va-widget-contents-array-header-button").attr("current-edit-type")},o.prototype._changeControlToBulk=function(){let e=this.getInputValue();this.$contentsArea.empty(),this._bulkAceEditorControl=t.VA.Core.Widget.Factory.aceEditorControl(this.$contentsArea,{value:e.join("\n"),editorOptions:{enableBasicAutocompletion:!1,enableSnippets:!1,enableLiveAutocompletion:!1}});let n=this._bulkAceEditorControl.getSession();n.setOption("indentedSoftWrap",!1),n.setUseWrapMode(!0),n.setWrapLimitRange()},o.prototype._changeBulkToControl=function(){let t=this._getBulkListValue();this.setInputValue(t),this.triggerChangeInputValue(!0),this._destroyBulkAceEditor()},o.prototype._destroyBulkAceEditor=function(){this._bulkAceEditorControl&&(this._bulkAceEditorControl.destroy(),this._bulkAceEditorControl=void 0)},o.prototype.createArrayInputControl=function(){if(this._createArrayInputHeaderArea(),this.variableValue&&0!==this.variableValue.length)if(this.variableValue instanceof Array)for(var t=0;t<this.variableValue.length;t++)this.createInputControlLayout(t,this.isArrayValue());else this.createInputControlLayout(0,this.isArrayValue());else this.createInputControlLayout(0,this.isArrayValue());this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar()},o.prototype.createSingleInputControl=function(){this.createInputControlLayout(0,!1)},o.prototype.createCellControlLayout=function(){var t=this.$contentsArea,e=$('<div class="brtc-va-widget-contents-input-container brtc-style-flex-direction-column brtc-style-height-auto brtc-style-align-items-flex-start"> <div class="data-area brtc-style-display-flex brtc-style-col-12 brtc-style-margin-top-5"> <div class="brtc-style-width-100 brtc-style-line-height-30">Input Data</div> </div> <div class="row-area brtc-style-display-flex brtc-style-col-12 brtc-style-margin-top-5"> <div class="brtc-style-width-100 brtc-style-line-height-30">Row Index</div> </div> <div class="column-area brtc-style-display-flex brtc-style-col-12 brtc-style-margin-top-5"> <div class="brtc-style-width-100 brtc-style-line-height-30">Column Name</div> </div></div>');t.append(e);var n=$('<div class="brtc-style-width-minus-100"></div>'),r=$('<div class="brtc-style-width-minus-100"></div>'),i=$('<div class="brtc-style-width-minus-100"></div>'),o=e.find(".data-area"),a=e.find(".row-area"),s=e.find(".column-area");o.append(n),a.append(r),s.append(i),this.createCellControl(n,r,i)},o.prototype.createInputControlLayout=function(t,e,n){var r=this.$contentsArea,i=this,o=!1,a=$('<div class="brtc-va-widget-contents-input-container"></div>'),s=r.find(".brtc-va-widget-contents-input-container");0!==s.length&&s[t]?($(s[t]).after(a),o=!0):r.append(a);var c,l,u=$('<div class="brtc-va-widget-contents-input-control-container"></div>');a.append(u),(t>0||o)&&(l=$('<div class="brtc-va-widget-contents-input-control-delete"></div>'),a.append(l),l.click(function(t){i.handleDeleteButtonClick($(this).closest(".brtc-va-widget-contents-input-container"))})),e&&(c=$('<div class="brtc-va-widget-contents-input-control-add"></div>'),a.append(c),c.click(function(t){i.handleAddInputControlEvent($(this).closest(".brtc-va-widget-contents-input-container"))})),this.isArrayValue()?this.isNumericType()?this.createNumericInputControl(u,n):this.createInputControl(u,n):this.isNumericType()?this.createNumericInputControl(u,n):this.createCodeInputControl(u,n)},o.prototype.createNumericInputControl=function(e,n){var r=this,i={theme:t.VA.Env.Theme,height:"25px",width:"100%",numberType:"double",placeHolder:"Enter value",className:["brtc-va-widget-contents-input-control"],enterCallback:function(t){this.isArrayValue()&&this.handleAddInputControlEvent(t.closest(".brtc-va-widget-contents-input-container"),!0)}.bind(this)},o=new t.VA.Core.Widget.Controls.NumericInput(e,i);o.onChange(function(){r.triggerChangeInputValue(!1)}),n&&o.focus()},o.prototype.createDropDownList=function(e,n){var r={theme:t.VA.Env.Theme,height:"25px",autoDropDownHeight:!0,enableBrowserBoundsDetection:!0,width:"calc(100% - 100px)"};n&&$.extend(r,n),e.jqxDropDownList(r)},o.prototype.createIndataSource=function(){var t=Studio.getEditorContainer().getActiveModelEditor().getActiveModel();return i.getInTable(this.options.fnUnit).map(function(e){var n=t.getFnUnitByOutTable(e);return{label:n.display.label,tid:e,type:n.func}})},o.prototype.createCellControl=function(e,n,r){var i=this;this.$data=e,this.createDropDownList(e,{source:this.createIndataSource(),displayMember:"label",valueMember:"tid"}),e.change(function(){i.triggerChangeCellValue()});var o={theme:t.VA.Env.Theme,height:"25px",width:"100%",numberType:"int",minus:!1,placeholder:"(0 < value)",className:["brtc-va-widget-contents-input-control"]};this.rowInput=new t.VA.Core.Widget.Controls.NumericInput(n,o),this.rowInput.onChange(function(){i.triggerChangeCellValue()}),this.rowInput.focus(),this.$columnControl=$('<input type="text" class="brtc-va-widget-contents-input-control"/>'),r.append(this.$columnControl);var a={theme:t.VA.Env.Theme,height:"25px",width:"100%",placeHolder:"Enter value"};this.$columnControl.jqxInput(a),this.$columnControl.focusout(function(t){i.triggerChangeCellValue()})},o.prototype.createInputControl=function(e,n){var r=this,i=$('<input type="text" class="brtc-va-widget-contents-input-control"/>');e.append(i);var o={theme:t.VA.Env.Theme,height:"25px",width:"100%",placeHolder:"Enter value"};i.jqxInput(o),n&&i.jqxInput("focus"),i.keydown(function(t){13==t.keyCode&&r.isArrayValue()&&r.handleAddInputControlEvent(i.closest(".brtc-va-widget-contents-input-container"),!0)}),i.focusout(function(t){r.triggerChangeInputValue(!1)})},o.prototype.createCodeInputControl=function(e,n){var r=this,i=$('<textarea class="brtc-va-widget-contents-input-control"/>');e.append(i);var o={mode:this.isLiteralType(this.variableType)?"brtc-system-variable":"brtc-control",scrollbarStyle:"null",placeholder:this.isLiteralType(this.variableType)?"Enter value":"Enter expression",lineWrapping:!1,matchBrackets:!1,extraKeys:{"Ctrl-Space":"autocomplete",Tab:!1,"Shift-Tab":!1},showTrailingSpace:!0,hintOptions:{list:"literal"==this.variableType?["${sys.user}","${sys.date}"]:[]}};this.codeMirror=CodeMirror.fromTextArea(i[0],o);var a={"valid-message-position":this.options["valid-message-position"]};t.VA.Core.Utils.WidgetUtils.changeCodeMirrorLineToSingle(this.codeMirror,a),this.codeMirror.on("blur",function(t,e){r.triggerChangeInputValue(!1)})},o.prototype.handleAddInputControlEvent=function(t,e){var n=t.index();this.createInputControlLayout(n,!0,e),this.triggerChangeInputValue(),this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar("update");var r=this.$mainControl.parents(".ps-container");r&&r.length&&r.perfectScrollbar("update")},o.prototype.handleDeleteButtonClick=function(t){t.remove(),this.triggerChangeInputValue(),this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar("update");var e=this.$mainControl.parents(".ps-container");e&&e.length&&e.perfectScrollbar("update")},o.prototype.triggerChangeInputValue=function(t){if("function"==typeof this.options.onChangeCallback){var e=this.getInputValue();(JSON.stringify(e)!==JSON.stringify(this.variableValue)||t)&&(this.variableValue=e,this.options.onChangeCallback(this.createFormattedValue()))}},o.prototype.triggerChangeCellValue=function(t){if("function"==typeof this.options.onChangeCallback){var e={inData:this.$data.val(),rowIndex:this.rowInput.getValue(),column:this.$columnControl.val()};(JSON.stringify(e)!==JSON.stringify(this.variableValue)||t)&&(this.variableValue=e,this.options.onChangeCallback(this.createFormattedCellValue()))}},o.prototype.createFormattedCellValue=function(){return{key:this.variableKey,type:this.inputType,"variable-type":this.variableType,value:this.variableValue}},o.prototype.createFormattedValue=function(){return{key:this.variableKey,type:this.inputType,"variable-type":this.variableType,value:this.isLiteralType(this.variableType)?this.variableValue:t.VA.Core.Utils.VariableUtils.wrap(this.variableValue)}},o.prototype.getFormattedValue=function(){return{key:this.variableKey,type:this.inputType,"variable-type":this.variableType,value:"calculation"===this.variableType?t.VA.Core.Utils.VariableUtils.wrap(this.getInputValue()):this.getInputValue()}},o.prototype._getBulkListValue=function(){let t=[],e=this._bulkAceEditorControl.getValue();return e&&e.split("\n").forEach(e=>{t.push(this.getValueByType(e))}),0===t.length&&(t=this.isNumericType()?[0]:[""]),t},o.prototype.getInputValue=function(){var t,e=this.$contentsArea.find(".brtc-va-widget-contents-input-control");if(this.isArrayValue()){(t=[]).length=e.length;for(var n=0;n<e.length;n++){var r=this.getValueByType($(e[n]).val());t[n]=r}}else t=this.isNumericType()?this.getValueByType(e.val()):this.getValueByType(this.codeMirror.getValue());return t},o.prototype.setVariableType=function(t){this.variableType=t,this.$contentsArea.empty(),this.createContentsArea()},o.prototype.setInputValue=function(t){void 0!==t&&(this.variableValue=t);var e=this.$contentsArea.find(".brtc-va-widget-contents-input-control");if(this.isCellValue())this.rowInput.setValue(this.variableValue.rowIndex),this.$columnControl.val(this.variableValue.column),this.$data.val(this.variableValue.inData);else if(this.isArrayValue()){var n;if(e.length>this.variableValue.length)for(n=0;n<e.length;n++)void 0===this.variableValue[n]?$(e[n]).parents(".brtc-va-widget-contents-input-container").remove():$(e[n]).val(this.getValueByType(this.variableValue[n]));else{for(n=e.length;n<this.variableValue.length;n++)this.createInputControlLayout(n,!0);for(e=this.$contentsArea.find(".brtc-va-widget-contents-input-control"),n=0;n<e.length;n++)$(e[n]).val(this.getValueByType(this.variableValue[n]))}this._destroyBulkAceEditor(),this._changeArrayInputHeaderButton("control")}else Array.isArray(this.variableValue)?this.isNumericType()?e.val(this.getValueByType(this.variableValue[0])):this.codeMirror.setValue(this.getValueByType(this.variableValue[0])):this.isNumericType()?e.val(this.getValueByType(this.variableValue)):this.codeMirror.setValue(this.getValueByType(this.variableValue))},o.prototype.setRemovable=function(t){this.options.removable=t,t?this.$mainControl.find(".brtc-va-widget-remove").addClass("removable"):this.$mainControl.find(".brtc-va-widget-remove").removeClass("removable")},o.prototype.getOptions=function(){return this.options},o.prototype.isLiteralType=function(t){return e.indexOf(t)>-1},o.prototype.getInputType=function(t){return this.isLiteralType(t)?"literal":"expression"},o.prototype.isNumericType=function(){return r.indexOf(this.variableType)>-1},o.prototype.toString=function(t){return _.isNull(t)||_.isUndefined(t)||""===t?"":_.isNumber(t)?_.isNaN(t)||_.isUndefined(t)?"":t.toString():t},o.prototype.toNumber=function(t){return _.isNull(t)||_.isUndefined(t)||""===t?0:Number(this.toString(Number(t)))},o.prototype.getValueByType=function(e){return this.isNumericType()?this.toNumber(e):this.isLiteralType(this.variableType)?this.toString(e):t.VA.Core.Utils.VariableUtils.strip(e)},this.Brightics.VA.Core.Widget.Controls.VariableControl=o}.call(this),function(){"use strict";var t=this;t.Brightics.VA.Core.Widget.Factory={variableControl:function(e,n){return new t.Brightics.VA.Core.Widget.Controls.VariableControl(e,n)},arrayInputControl:function(e,n){return new t.Brightics.VA.Core.Widget.Controls.ArrayInputControl(e,n)},argumentControl:function(e,n){return new t.Brightics.VA.Core.Widget.Controls.ArgumentControl(e,n)},createFadeOutMessage:function(e,n){new t.Brightics.VA.Core.Widget.Controls.FadeOutMessage(e,n)},noteControl:function(e,n){return new t.Brightics.VA.Core.Widget.Controls.NoteControl(e,n)},numericInputControl:function(e,n){return new t.Brightics.VA.Core.Widget.Controls.NumericInput(e,n)},aceEditorControl:function(e,n){return new t.Brightics.VA.Core.Widget.Controls.AceEditorControl(e,n)},tabControl:function(e,n){return new t.Brightics.VA.Core.Widget.Controls.TabControl(e,n)},colorPickerControl:function(e,n){return new t.Brightics.VA.Core.Widget.Controls.ColorPickerControl(e,n)},opacityControl:function(e,n){return new t.Brightics.VA.Core.Widget.Controls.OpacityControl(e,n)},borderControl:function(e,n){return new t.Brightics.VA.Core.Widget.Controls.BorderControl(e,n)}}}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){this.parentId=t,this.options=e,this.dialogResult={OK:!1,Cancel:!0},this.analyticsModel=this.options.analyticsModel,this.retrieveParent(),this.createControls(),this.initContents()}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId)},e.prototype.createControls=function(){this.$mainControl=$('<div class="brtc-va-dialogs-main brtc-va-dialogs-run"> <div class="brtc-va-dialogs-body"> <div class="brtc-va-dialogs-contents"> </div> <div class="brtc-va-dialogs-buttonbar"> <input type="button" class="brtc-va-dialogs-buttonbar-ok" value="OK" /> </div> </div></div>'),this.$parent.append(this.$mainControl),this.$contentsArea=this.$mainControl.find(".brtc-va-dialogs-contents"),this.$okButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-ok");var e=this;this.$mainControl.dialog({theme:t.VA.Env.Theme,title:"Variables",width:450,height:630,modal:!0,resizable:!1,draggable:!0,close:function(){"function"==typeof e.options.close&&e.options.close(e.dialogResult)}})},e.prototype.initContents=function(){this.$mainControl.find(".brtc-va-dialogs-contents").addClass("scrollable"),this.createDialogContentsArea(this.$mainControl.find(".brtc-va-dialogs-contents")),this.$okButton.jqxButton({theme:t.VA.Env.Theme,disabled:!1}),this.$okButton.click(this.handleOkClicked.bind(this))},e.prototype.createDialogContentsArea=function(e){var n,r=this.analyticsModel.variables||{};this.variableControlList=[];for(var i=Object.keys(r),o=0;o<i.length;o++){(n={})[i[o]]={value:r[i[o]].value||"","variable-type":r[i[o]].type||"string"};var a={button:{visible:!1},variable:n,label:i[o]};this.variableControlList.push(t.VA.Core.Widget.Factory.variableControl(e,a))}e.perfectScrollbar()},e.prototype.createVariablesList=function(){for(var t,e={},n=0;n<this.variableControlList.length;n++)e[(t=this.variableControlList[n].getFormattedValue()).key]=t.value;return e},e.prototype.handleOkClicked=function(){this.dialogResult={OK:!0,Cancel:!1,args:this.createVariablesList()},this.$mainControl.dialog("close")},t.VA.Core.Dialogs.RunDataDialog=e}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){this.parentId=t,this.options=e,this.dialogResult={OK:!1,Cancel:!0},this.analyticsModel=this.options.analyticsModel,this.retrieveParent(),this.createControls(),this.initContents()}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId)},e.prototype.createControls=function(){this.$mainControl=$('<div class="brtc-va-dialogs-main brtc-va-dialogs-run"> <div class="brtc-va-dialogs-body"> <div class="brtc-va-dialogs-contents"> </div> <div class="brtc-va-dialogs-buttonbar"> <input type="button" class="brtc-va-dialogs-buttonbar-ok" value="OK" /> </div> </div></div>'),this.$parent.append(this.$mainControl),this.$contentsArea=this.$mainControl.find(".brtc-va-dialogs-contents"),this.$okButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-ok");var e=this;this.$mainControl.dialog({theme:t.VA.Env.Theme,title:"Variables",width:450,height:630,modal:!0,resizable:!1,draggable:!0,close:function(){"function"==typeof e.options.close&&e.options.close(e.dialogResult)}})},e.prototype.initContents=function(){this.$mainControl.find(".brtc-va-dialogs-contents").addClass("scrollable"),this.createDialogContentsArea(this.$mainControl.find(".brtc-va-dialogs-contents")),this.$okButton.jqxButton({theme:t.VA.Env.Theme,disabled:!1}),this.$okButton.click(this.handleOkClicked.bind(this))},e.prototype.createDialogContentsArea=function(e){var n,r=this.analyticsModel.variables||[];this.variableControlList=[];for(var i=0;i<r.length;i++){(n={})[r[i].name]={type:"literal",value:r[i].value||"","variable-type":r[i].type};var o={button:{visible:!1},variable:n,label:r[i].name};this.variableControlList.push(t.VA.Core.Widget.Factory.variableControl(e,o))}e.perfectScrollbar()},e.prototype.createVariablesList=function(){for(var t,e={},n=0;n<this.variableControlList.length;n++)e[(t=this.variableControlList[n].getFormattedValue()).key]=t.value;return e},e.prototype.handleOkClicked=function(){this.dialogResult={OK:!0,Cancel:!1,args:this.createVariablesList()},this.$mainControl.dialog("close")},t.VA.Core.Dialogs.RunControlDialog=e}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){this.parentId=t,this.options=e,this.dialogResult={OK:!1,Cancel:!0},this.analyticsModel=this.options.analyticsModel,this.retrieveParent(),this.createControls(),this.initContents()}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId)},e.prototype.createControls=function(){this.$mainControl=$('<div class="brtc-va-dialogs-main brtc-va-dialogs-run"> <div class="brtc-va-dialogs-body"> <div class="brtc-va-dialogs-contents"> </div> <div class="brtc-va-dialogs-buttonbar"> <input type="button" class="brtc-va-dialogs-buttonbar-ok" value="OK" /> </div> </div></div>'),this.$parent.append(this.$mainControl),this.$contentsArea=this.$mainControl.find(".brtc-va-dialogs-contents"),this.$okButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-ok");var e=this;this.$mainControl.dialog({theme:t.VA.Env.Theme,title:"Variables",width:450,height:630,modal:!0,resizable:!1,draggable:!0,close:function(){"function"==typeof e.options.close&&e.options.close(e.dialogResult)}})},e.prototype.initContents=function(){this.$mainControl.find(".brtc-va-dialogs-contents").addClass("scrollable"),this.createDialogContentsArea(this.$mainControl.find(".brtc-va-dialogs-contents")),this.$okButton.jqxButton({theme:t.VA.Env.Theme,disabled:!1}),this.$okButton.click(this.handleOkClicked.bind(this))},e.prototype.createDialogContentsArea=function(e){var n,r=this.analyticsModel["gv-def"]||{};this.variableControlList=[],this.duration={};var i={Duration:{type:"literal",value:"5","variable-type":"string"}},o={button:{visible:!1},variable:i};this.duration=t.VA.Core.Widget.Factory.variableControl(e,o);for(var a=0;a<Object.keys(r).length;a++){(n={})[Object.keys(r)[a]]={type:"literal",value:r[Object.keys(r)[a]].value||"","variable-type":r[Object.keys(r)[a]]["variable-type"]||"string"};var s={button:{visible:!1},variable:n};this.variableControlList.push(t.VA.Core.Widget.Factory.variableControl(e,s))}e.perfectScrollbar()},e.prototype.createVariablesList=function(){for(var t,e={},n=0;n<this.variableControlList.length;n++){("array"==(t=this.variableControlList[n].getFormattedValue())["variable-type"]&&1==t.value.length?t.value[0]:t.value)&&(e[t.key]=t.value)}return e},e.prototype.handleOkClicked=function(){this.dialogResult={OK:!0,Cancel:!1,args:this.createVariablesList(),duration:this.duration.getFormattedValue().value},this.$mainControl.dialog("close")},t.VA.Core.Dialogs.RunRealTimeDialog=e}.call(this),function(){"use strict";var t=this.Brightics;t.VA.Core.Utils;function e(t){this.editorInput=t,this.reportData=t.getContents().report.data||[]}function n(t,e){return t+"-"+e}function r(t){var e="Title",n=t.title.fnUnitLabel;return null!=n&&(e="["+n+"] "),void 0!==t.title.panelTitle&&(e+=t.title.panelTitle),e}function i(t){this.$controlArea=t}e.prototype.addReportData=function(t){var e=this;return new Promise(function(n,r){if(function(t){return t.options.id&&t.options.chartOption&&t.data.mid&&t.data.table}(t)){var i=e.reportData.push(e.formattedData(t));e.editorInput.getContents().report={data:e.reportData},n(i-1)}else r("Data are not correct")})},e.prototype.openDialog=function(e,n){var r=this;e.dialog({theme:t.VA.Env.Theme,width:950,maxWidth:950,minWidth:950,height:800,minHeight:400,maxHeight:1200,modal:!0,resizable:!1,open:function(){r.initReportViewer(e),r.render()},keyboardCloseKey:""}),this.$reportWindow.on("close",function(){n(),e.dialog("destroy")})},e.prototype.formattedData=function(t){return{id:t.options.id+"-"+t.options.chartOption.chart.type,type:"Chart",originData:t}},e.prototype.removeReportData=function(t,e){var r=n(t,e);for(var i in this.reportData)if(this.reportData[i].id===r)return void this.removeReportDataByIndex(i)},e.prototype.initReportViewer=function(t){this.$reportWindow=t,this.initReportWindowToolbar(),this.initReportWindowBody()},e.prototype.initReportWindowToolbar=function(){var t=this;this.$reportWindowBody=this.$reportWindow.find(".brtc-va-editors-modeleditor-report-window-body");var e=$('<div class="brtc-va-editors-modeleditor-report-window-head-tools-container"></div>');this.$reportWindowBody.prepend(e);var n=$('<div class="brtc-va-editors-modeleditor-report-window-head-tools brtc-va-editors-modeleditor-report-window-head-tools-share fa fa-share-alt" title="Publish"></div>'),r=$('<div class="brtc-va-editors-modeleditor-report-window-head-tools brtc-va-editors-modeleditor-report-window-head-tools-add" title="Click to add text"></div>'),i=$('<div class="brtc-va-editors-modeleditor-report-window-head-tools brtc-va-editors-modeleditor-report-window-head-tools-report-all" title="Download Report Image"></div>'),o=$('<div class="brtc-va-editors-modeleditor-report-window-head-tools brtc-va-editors-modeleditor-report-window-head-tools-report-each" title="Download Report Each Element Image"></div>');e.append(i),e.append(o),e.append(r),e.append(n),i.on("click",function(){t.downloadAll()}),o.on("click",function(){t.downloadEachAll()}),n.on("click",function(){t.publishReport()}),r.on("click",function(){t.addReportTextBox()})},e.prototype.publishReport=function(){var e=this;if(this.editorInput.getContents().report.id)this.showPublishInfo();else{this.editorInput.getContents().report.id=t.VA.Core.Utils.IDGenerator.report.id(60);var n={url:"/report",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({reportId:this.editorInput.getContents().report.id,userId:t.VA.Env.Session.userId,modelId:this.editorInput.id,projectId:this.editorInput.getProjectId()})};$.ajax(n).done(function(){e.showPublishInfo()})}},e.prototype.showPublishInfo=function(){var e=this;$.ajax({url:"/report/publishsite",type:"GET",contentType:"application/json; charset=utf-8"}).done(function(n){var r={title:"Publish Information"};r.window={theme:t.VA.Env.Theme,width:"600px",height:"150px",maxWidth:"600px",maxHeight:"150px",modal:!0,resizable:!1,cancelButton:e.$cancelButton,open:function(){e.createDialogContentsArea($(this.element).find(".brtc-va-dialogs-contents"),n)}},new t.VA.Core.Dialogs.Dialog(e.$reportWindowBody,r)})},e.prototype.createDialogContentsArea=function(e,n){var r="http://"+n.ip+":"+n.port+"/report?report="+this.editorInput.getContents().report.id;e.append('<div style="width:100%"> <div style="width:10%;float: left">url: </div> <div style="width:70%;float: left"><input class="brtc-va-widget-contents-input-control" value="'+r+'" readonly></div> <div style="width:20%;float: left;display: flex;justify-content: center;"><button class="brtc-va-copy-clipboard-button" type="button"">Copy</button></div></div>');var i=e.find(".brtc-va-copy-clipboard-button");i.jqxButton({theme:t.VA.Env.Theme}),i.on("click",function(){window.prompt("Copy to clipboard: Ctrl+C",r)})},e.prototype.initReportWindowBody=function(){this.$reportWindowBody.perfectScrollbar(),this.$reportContentsArea=$('<div class="brtc-va-editors-modeleditor-report-contents-area"></div>'),this.$reportContainer=this.$reportWindow.find(".brtc-va-editors-modeleditor-report-element-container"),this.$reportContainer.append(this.$reportContentsArea),this.pageHandler=new i(this.$reportContentsArea),this.$processingWindow=$('<div><div>Processing ...</div><div><div class="brtc-va-progress"><div><span class="brtc-va-progress-loading"></div></div></div>'),this.$reportContainer.append(this.$processingWindow),$(this.$processingWindow).dialog({width:300,height:200,theme:t.VA.Env.Theme,showCloseButton:!1,autoOpen:!1,modal:!0,resizable:!1,keyboardCloseKey:""})},e.prototype.addReportTextBox=function(){var e=this.reportData.push({id:t.VA.Core.Utils.IDGenerator.report.id()+"-Text",type:"Text",originData:""});this.renderIndexData(e-1)},e.prototype.render=function(){var t=this;$(this.$reportWindow).on("open",function(){t.showProcessingWindow()}),this.clearReport(),this.setReportContentsAreaSize();var e=[];for(var n in e.push(new Promise(function(e,n){$(t.$processingWindow).on("open",function(){e()})})),this.reportData){var r=this.renderIndexData(n);e.push(r)}Promise.all(e).then(function(){t.hideProcessingWindow(),t.convertReportLayout()},function(e){t.hideProcessingWindow()})},e.prototype.renderIndexData=function(t){if(this.reportData[t]){var e=this.renderReportElementBox(this.reportData[t],t);return this.attachReportElementBoxHeaderItems(this.reportData[t],e.elementBox),e.promise}},e.prototype.clearReport=function(){this.$reportContentsArea.empty()},e.prototype.setReportContentsAreaSize=function(){var t=this.reportData,e=0;this.relativeContentsIndexList=[];for(var n=0;n<t.length;n++)t[n].position?e=Math.max(e,t[n].position.top+t[n].size.height+5):this.relativeContentsIndexList.push(n);var r=300*this.relativeContentsIndexList.length;this.$reportContentsArea.css("height",e+r)},e.prototype.containsData=function(t,e){var r=n(t,e);for(var i in this.reportData)if(this.reportData[i].id===r)return!0;return!1},e.prototype.renderReportElementBox=function(t,e){return"Chart"===t.type?this.renderReportChartBox(t,e):"Text"===t.type?this.renderReportTextBox(t,e):void 0},e.prototype.renderReportChartBox=function(e,n){var i=$('<div class="brtc-va-editors-modeleditor-report-element" content-type="'+e.type+'"> <div class="brtc-va-editors-modeleditor-report-element-head"> <div class="brtc-va-editors-modeleditor-report-element-head-label" title="'+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(r(e.originData))+'">'+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(r(e.originData))+'</div> </div> <div class="brtc-va-editors-modeleditor-report-element-body"></div></div>');this.$reportContentsArea.append(i),this.setContentsSizeAndPosition(i,e.size,e.position,n),this.setResizable(i),this.setDraggable(i);var o=e.originData.data.table||e.originData.data.fid,a=!1;if(this.editorInput.getContents().mid&&!this.editorInput.getContents().getFnUnitByOutTable(o)){var s=i.find(".brtc-va-editors-modeleditor-report-element-head-label");s.text("Function has been removed."),s.addClass("function-removed"),a=!0}var c=new Promise(function(n,r){var o;(o=e.originData.data,new Promise(function(e,n){t.VA.Core.DataQueryTemplate.queryTable(o.mid,o.table||o.fid,function(t){e(t)},function(t){n(t)})})).then(function(t){var r=$.extend({},e.originData.options.chartOption,t);a&&(r.columns=[],r.data=[]),i.find(".brtc-va-editors-modeleditor-report-element-body").BrighticsChart(r),n()},function(t){r(t)})});return{elementBox:i,promise:c}},e.prototype.setContentsSizeAndPosition=function(t,e,n,r){if(e&&n)t.css({position:"absolute",top:n.top,left:n.left,width:e.width,height:e.height});else{var i=this.$reportContentsArea.height(),o=this.relativeContentsIndexList.length,a=this.relativeContentsIndexList.indexOf(parseInt(r));t.css({position:"absolute",top:i-300*(o-a),left:15,width:900,height:290})}},e.prototype.setNewContentsSizeAndPosition=function(t,e){var n=this.$reportContentsArea.height(),r=n;this.pageHandler.increasePageHeight(290),t.css({position:"absolute",top:n,left:15,width:300,height:290}),e.position={top:r,left:15},e.size={width:300,height:290}},e.prototype.renderReportTextBox=function(t,e){var n=$('<div class="brtc-va-editors-modeleditor-report-element" content-type="'+t.type+'"> <div class="brtc-va-editors-modeleditor-report-element-head"> <div class="brtc-va-editors-modeleditor-report-element-head-label"></div> </div> <div class="brtc-va-editors-modeleditor-report-element-body"> <div class="brtc-va-editors-modeleditor-report-element-body-contents"></div> </div></div>');this.$reportContentsArea.append(n),this.setContentsSizeAndPosition(n,t.size,t.position),this.setResizable(n),this.setDraggable(n);var r=n.find("textarea.brtc-va-editors-modeleditor-report-element-body-textarea");return r.val(t.originData),r.on("blur",function(){t.originData=$(this).val().trim()}),n.find(".brtc-va-editors-modeleditor-report-element-body-contents").append(t.originData),{elementBox:n,promise:Promise.resolve()}},e.prototype.setResizable=function(t){var e=this;t.resizable({autoHide:!0,stop:function(n,r){var i=r.element.index(),o=r.position,a={width:r.element.outerWidth(),height:r.element.outerHeight()};a=e.configureContentSize(t,o,a),e.setPositionToReportDataByIndex(i,o,a)},resize:function(t,n){var r=n.position,i=(n.element.outerWidth(),n.element.outerHeight()),o=r.top+i;e.pageHandler.handlePageHeight(o)},minHeight:80,minWidth:150})},e.prototype.setDraggable=function(t){var e=this;t.draggable({handle:e.$reportContentsArea.find(".brtc-va-editors-modeleditor-report-element-head"),stop:function(n,r){var i=r.helper.index(),o=r.position,a={width:r.helper.outerWidth(),height:r.helper.outerHeight()};o=e.configureContentPosition(t,o,a),e.setPositionToReportDataByIndex(i,o,a)},drag:function(t,n){var r=n.position.top+n.helper.height();e.pageHandler.handlePageHeight(r+10)}})},e.prototype.configureContentSize=function(t,e,n){var r=e.left+n.width,i=this.$reportContentsArea.width();return r>i&&(t.width(i-e.left),n.width=i-e.left),n},e.prototype.configureContentPosition=function(t,e,n){var r=e.left+n.width,i=this.$reportContentsArea.width();return e.top<5&&(e.top=5),e.left<5&&(e.left=5),r>i&&(e.left=e.left-(r-i)),t.css({top:e.top,left:e.left}),e},e.prototype.attachReportElementBoxHeaderItems=function(e,n){var r=this,i=n.find(".brtc-va-editors-modeleditor-report-element-head");if("Text"===e.type){var o=$('<div class="brtc-va-editors-modeleditor-report-element-toolbar brtc-va-editors-modeleditor-report-element-toolbar-edit"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></div>');i.append(o),o.click(function(){var n=$(this).parents(".brtc-va-editors-modeleditor-report-element"),r=n.find(".brtc-va-editors-modeleditor-report-element-body-contents"),i={contents:r.html(),save:function(t){e.originData=t,n.attr("content-type","Text"),r.empty(),r.append(t)}};new t.VA.Core.Dialogs.NoteDialog($(this).closest(".brtc-va-editors-modeleditor-report-element-body"),i)}),e.position||this.setNewContentsSizeAndPosition(n,e)}var a=$('<div class="brtc-va-editors-modeleditor-report-element-toolbar brtc-va-editors-modeleditor-report-element-toolbar-remove"></div>');i.append(a),a.click(function(){var e=$(this).parents(".brtc-va-editors-modeleditor-report-element").index();t.VA.Core.Utils.WidgetUtils.openConfirmDialog("Are you sure you want to delete this graph?",function(t){t.OK&&r.removeReportDataByIndex(e)})})},e.prototype.removeReportDataByIndex=function(t){if(t>-1){var e=this.$reportContentsArea.find(".brtc-va-editors-modeleditor-report-element");e.length>t&&e[t].remove(),this.reportData.splice(t,1)}},e.prototype.setPositionToReportDataByIndex=function(t,e,n){this.reportData[t].size=n,this.reportData[t].position=e},e.prototype.showProcessingWindow=function(){$(this.$processingWindow).dialog("open")},e.prototype.hideProcessingWindow=function(){$(this.$processingWindow).dialog("close")},e.prototype.convertReportLayout=function(){var t=this.$reportContentsArea.find(".brtc-va-editors-modeleditor-report-element");this.pageHandler.setHeight(this.$reportContentsArea.height());for(var e=t.length-1;e>=0;e--)this.convertRelativeToAbsolute(e,$(t[e]));this.relativeContentsIndexList=[]},e.prototype.convertRelativeToAbsolute=function(t,e){var n,r,i;i=e.position(),n=e.outerHeight(),r=e.outerWidth(),e.css({position:"absolute",width:r,height:n,left:i.left,top:i.top}),this.setPositionToReportDataByIndex(t,i,{width:r,height:n})},e.prototype.downloadAll=function(){this.showProcessingWindow(),this.changeReportCss(!1),html2canvas(this.$reportContainer,{onrendered:function(t){var e=t.toDataURL("image/png"),n=$("<a>").attr("href",e).attr("download","report.png").appendTo("body");n[0].click(),n.remove()}}),this.changeReportCss(!0),this.hideProcessingWindow()},e.prototype.downloadEachAll=function(){var t=this;this.showProcessingWindow(),this.changeReportCss(!1);var e=this.$reportContentsArea.find(".brtc-va-editors-modeleditor-report-element"),n=0;!function r(){n<e.length?html2canvas(e[n],{onrendered:function(t){var e=t.toDataURL("image/png"),i=$("<a>").attr("href",e).attr("download","report"+n+".png").appendTo("body");i[0].click(),i.remove(),n++,r()}}):(t.changeReportCss(!0),t.hideProcessingWindow())}()},e.prototype.changeReportCss=function(t){t?(this.$reportWindowBody.perfectScrollbar(),this.$reportWindowBody.css({height:this.reportWindowBodyHeight}),this.$reportWindow.css({height:this.reportWindowHeight,"max-height":this.reportWindowMaxHeight})):(this.$reportWindowBody.perfectScrollbar("destroy"),this.reportWindowBodyHeight=this.$reportWindowBody.css("height"),this.$reportWindowBody.css({height:"auto"}),this.reportWindowHeight=this.$reportWindow.css("height"),this.reportWindowMaxHeight=this.$reportWindow.css("max-height"),this.$reportWindow.css({"max-height":"",height:"auto"}))},i.prototype.setHeight=function(t){this.$controlArea.height(t)},i.prototype.increasePageHeight=function(t){t=t||50;var e=this.$controlArea.height()||0;this.$controlArea.height(e+t)},i.prototype.handlePageHeight=function(t){t+10>this.$controlArea.height()&&this.$controlArea.height(t+10)},t.VA.Core.ReportManager=e}.call(this),function(){"use strict";var t=this.Brightics;t.VA.Core.DataQueryTemplate={schemaCache:{},cache:{},requested:{},addCache:function(t,e,n){var r=t+"_"+e;this.schemaCache[r]=n},removeCache:function(t,e){if(e){var n=t+"_"+e;delete this.cache[n],delete this.schemaCache[n]}else{var r=[];for(var i in this.cache)0==i.indexOf(t+"_")&&r.push(i);for(var o in r)delete this.cache[r[o]];for(var i in r=[],this.schemaCache)0==i.indexOf(t+"_")&&r.push(i);for(var o in r)delete this.schemaCache[r[o]]}},isCached:function(t,e){var n=t+"_"+e;return this.cache[n]},clearCache:function(){this.cache={},this.schemaCache={}},queryTable:function(t,e,n,r,i,o){var a=t+"_"+e;o=o||{};!0!==i&&this.cache[a]?n(this.cache[a],e):o.publish?(o.destination="publish",this.queryData(t,e,o.offset||0,o.limit||1e3,n,r,o)):this.queryData(t,e,o.offset||0,o.limit||1e3,n,r,o)},queryTableForReport:function(t,e,n,r,i){var o=t+"_"+e;!0!==i&&this.cache[o]?n(this.cache[o],e):this.queryData(t,e,0,1e3,n,r,"/report")},fetchMore:function(t,e,n,r,i){var o=1e3,a=t+"_"+e;o=this.cache[a]&&this.cache[a].columns&&this.cache[a].data?this.cache[a].data.length+n:n,this.queryData(t,e,0,o,r,i)},queryData:function(e,n,r,i,o,a,s){var c=this,l=e+"_"+n,u=s||{};this.requested[l]||(this.requested[l]=[]),this.requested[l].push({done:o,fail:a});var p=u.user||t.VA.Env.Session.userId,d=(u.destination||"api/va/v2/data")+"/staging/query?user="+p+"&mid="+e+"&tab="+n+"&offset="+r+"&limit="+i;$.get(d).done(function(t){c.addCache(e,n,t),c.requested[l].shift().done(t,n)}).fail(function(t){c.removeCache(e,n);c.requested[l].shift().fail({columns:[],data:[],count:0},n,t)})},getSchemaAsync:function(e,n,r,i,o){var a=this,s=(o||{}).user||t.VA.Env.Session.userId,c="api/va/v2/data/staging/query?"+t.VA.Core.Utils.CommonUtils.getQueryString({user:s,mid:e,tab:n,offset:0,limit:1});$.get(c).done(function(t){return a.addCache(e,n,t),r(t.columns)}).fail(function(t){return a.removeCache(e,n),i([],n,t)})},getSchema:function(t,e){var n=t+"_"+e;return this.schemaCache[n]&&void 0!==e?this.schemaCache[n].columns:void 0},querySchema:function(t,e,n,r,i){this.queryTable(t,e,n,r,i)},getSchemaFromData:function(t,e){return console.warn("This method is deprecated"),this.getData(t,e)},getData:function(t,e){var n=t+"_"+e;return this.schemaCache[n]&&void 0!==e?this.schemaCache[n].data:void 0},getTable:function(t,e){var n=t+"_"+e;return this.schemaCache[n]&&void 0!==e?this.schemaCache[n]:void 0}}}.call(this);